Move a tag
[latex2e.git] / latex2e-20160201 / required / tools / layout.dtx
blob5d96f1dda4fad74aa41fa8948bf1669f2b32c9d8
1 % \iffalse meta-comment
3 % Copyright 1993-2014
5 % The LaTeX3 Project and any individual authors listed elsewhere
6 % in this file.
8 % This file is part of the Standard LaTeX `Tools Bundle'.
9 % -------------------------------------------------------
11 % It may be distributed and/or modified under the
12 % conditions of the LaTeX Project Public License, either version 1.3c
13 % of this license or (at your option) any later version.
14 % The latest version of this license is in
15 %    http://www.latex-project.org/lppl.txt
16 % and version 1.3c or later is part of all distributions of LaTeX
17 % version 2005/12/01 or later.
19 % The list of all files belonging to the LaTeX `Tools Bundle' is
20 % given in the file `manifest.txt'.
22 % \fi
23 % \CheckSum{920}
24 %\iffalse
25 %    This file is built for \LaTeXe, so we make sure an error is
26 %    generated when it is used with another format
27 %<*dtx>
28 \ProvidesFile{layout.dtx}
29 %</dtx>
30 %<+package>\NeedsTeXFormat{LaTeX2e}
31 %<+package>\ProvidesPackage{layout}
32 %<+driver>\ProvidesFile{layout.drv}
33 %\ProvidesFile{layout.dtx}
34                 [2014/10/28 v1.2c Show layout parameters]
36 %    A short driver is provided that can be extracted if necessary by
37 %    the \textsf{DocStrip} program provided with \LaTeXe.
38 %    \begin{macrocode}
39 %<*driver>
40 \documentclass{ltxdoc}
42 \usepackage{layout}
44 \newcommand\Lopt[1]{\textsf{#1}}
45 \pagestyle{myheadings}
46 \DisableCrossrefs
47 \begin{document}
48 \DocInput{layout.dtx}
49 \end{document}
50 %</driver>
51 %    \end{macrocode}
52 %\fi
53 % \changes{v1.1c}{1994/07/13}{Moved Identification code to the front
54 %    and removed the permanent use of \cs{filedate} and friends}
55 % \changes{v1.1d}{1994/09/08}{Stored texts in control sequences to
56 %    allow other languages}
58 % \GetFileInfo{layout.dtx}
59 % \title{Displaying page layout variables}
60 % \author{Kent McPherson a.o.\thanks{Converted for \LaTeXe\ by
61 %        Johannes Braams and modified by Hideo Umeki}}
62 % \date{\filedate}
64 % \markboth{layout package version \fileversion\space as of \filedate}
65 %          {layout package version \fileversion\space as of \filedate}
67 % \MaintainedByLaTeXTeam{tools}
68 % \maketitle
70 % \section{Introduction}
72 %    This \LaTeXe\ package is a reimplementation of
73 %    \texttt{layout.sty} by Kent McPherson. It defines the command
74 %    |\layout| which produces an overview of the layout of the current
75 %    document. The command |\layout*| recomputes the values it uses to
76 %    produce the overview.
78 %    The figure on the next page shows the output of the |\layout|
79 %    command for this document.
81 % \begin{figure}[p]
82 % \layout
83 % \end{figure}
85 % \StopEventually{}
87 % \section{The implementation}
89 % \changes{v1.1b}{1994/03/23}{removed the \cs{wlog} as
90 %    \cs{ProvidesPackage} does that now}
91 % \changes{v1.1d}{1994/09/08}{Added language options dutch and
92 %    english}
94 %    This package prints a figure to illustrate the layout that is
95 %    implemented by the document class. In the figure several words
96 %    appear. They are stored in control sequences to be able to select
97 %    a different language.
98 % \changes{v1.1e}{1994/10/29}{The dutch texts should be one word.}
99 % \changes{v1.1f}{1995/03/14}{Added \cs{notshown}}
100 % \changes{v1.1f}{1995/03/14}{Added option french}
101 % \changes{v1.1j}{1995/10/29}{Added the options spanish, brazilian and
102 %    portuguese}
103 % \changes{v1.1k}{1995/11/23}{Documentation fixes}
104 % \changes{v1.2}{1998/04/13}{Redesign of the output by Hideo Umeki}
105 % \changes{v1.2c}{2000/09/21}{Added option german}
106 % \changes{v1.2c}{2000/09/25}{Added option for italian by Claudio Beccari}
107 %    \begin{macrocode}
108 %<*package>
109 \DeclareOption{dutch}{%
110   \def\Headertext{Kopregel}
111   \def\Bodytext{Broodtekst}
112   \def\Footertext{Voetregel}
113   \def\MarginNotestext{Marge\\Notities}
114   \def\oneinchtext{een inch}
115   \def\notshown{niet getoond}
116   }
117 \DeclareOption{german}{%
118   \def\Headertext{Kopfzeile}
119   \def\Bodytext{Haupttext}
120   \def\Footertext{Fu{\ss}zeile}
121   \def\MarginNotestext{Rand-\\ notizen}
122   \def\oneinchtext{ein Zoll}
123   \def\notshown{ohne Abbildung}
124   }
125 \DeclareOption{ngerman}{\ExecuteOptions{german}}
126 \DeclareOption{english}{%
127   \def\Headertext{Header}
128   \def\Bodytext{Body}
129   \def\Footertext{Footer}
130   \def\MarginNotestext{Margin\\Notes}
131   \def\oneinchtext{one inch}
132   \def\notshown{not shown}
133   }
134 \DeclareOption{french}{%
135   \def\Headertext{Ent\^{e}te}
136   \def\Bodytext{Corps}
137   \def\Footertext{Pied de page}
138   \def\MarginNotestext{Marge\\Notes}
139   \def\oneinchtext{un pouce}
140   \def\notshown{non affich\'{e}}
141   }
142 \DeclareOption{francais}{\ExecuteOptions{french}}
143 \DeclareOption{spanish}{%
144   \def\Headertext{Encabezamiento}
145   \def\Bodytext{Cuerpo}
146   \def\Footertext{Pie de p\'agina}
147   \def\MarginNotestext{Notas\\ Marginales}
148   \def\oneinchtext{una pulgada}
149   \def\notshown{no mostradas}
150   }
151 \DeclareOption{portuguese}{%
152   \def\Headertext{Cabe\c{c}alho}
153   \def\Bodytext{Corpo}
154   \def\Footertext{Rodap\'e}
155   \def\MarginNotestext{Notas\\ Marginais}
156   \def\oneinchtext{uma polegada}
157   \def\notshown{n\~ao mostradas}
158   }
159 \DeclareOption{brazilian}{%
160   \def\Headertext{Cabe\c{c}alho}
161   \def\Bodytext{Corpo}
162   \def\Footertext{Rodap\'e}
163   \def\MarginNotestext{Notas\\ Marginais}
164   \def\oneinchtext{uma polegada}
165   \def\notshown{n\~ao mostradas}
166   }
167 \DeclareOption{italian}{%
168   \def\Headertext{Testatina}
169   \def\Bodytext{Corpo}
170   \def\Footertext{Piedino}
171   \def\MarginNotestext{Note\\ Marginali}
172   \def\oneinchtext{un pollice}
173   \def\notshown{non mostrato}
174   }
175 %    \end{macrocode}
177 %    This package has an option \Lopt{verbose}. Using it will make the
178 %    command |\layout| type some of the parameters on the terminal.
179 %    \begin{macrocode}
180 \DeclareOption{verbose}{\let\LayOuttype\typeout}
181 \DeclareOption{silent}{\let\LayOuttype\@gobble}
182 %    \end{macrocode}
184 % \changes{v1.1h}{1995/04/07}{Added the options \Lopt{integers}
185 %    (default) and \Lopt{reals}}
187 %    The normal behaviour of this package when showing the values of
188 %    the parameters is to truncate them. However, if you want to see
189 %    the real parameter values you can use the option \Lopt{reals} to
190 %    get that effect.
191 % \changes{v1.1i}{1995/06/25}{\LaTeX\ release 1995/06/01 no longer
192 %    needs double hashmarks in the argument of \cs{DeclareOption}}
193 %    \begin{macrocode}
194 \def\lay@value{}
195 \DeclareOption{integers}{%
196   \renewcommand*{\lay@value}[2]{%
197     \expandafter\number\csname #1@#2\endcsname pt}}
198 \DeclareOption{reals}{%
199   \renewcommand*{\lay@value}[2]{\the\csname #2\endcsname}}
200 %    \end{macrocode}
202 %    The default language is English, the default mode is
203 %    \Lopt{silent} and the default way of showing parameter values is
204 %    to use integers.
205 %    \begin{macrocode}
206 \ExecuteOptions{english,silent,integers}
207 \ProcessOptions
208 %    \end{macrocode}
210 % \begin{macro}{\LayOutbs}
211 %    Define |\LayOutbs| to produce a backslash. We use a definition
212 %    which also works with OT1 fonts.
213 % \changes{v1.2b}{1998/06/21}{Renamed \cs{bs} to avoid possible conflicts
214 %   with other packages}
215 %    \begin{macrocode}
216 \newcommand\LayOutbs{}
217 \chardef\LayOutbs`\\
218 %    \end{macrocode}
219 % \end{macro}
221 % \begin{macro}{\ConvertToCount}
222 %    This macro stores the value of a \emph{length} register in a
223 %    \emph{count} register.
224 %    \begin{macrocode}
225 \def\ConvertToCount#1#2{%
226 %    \end{macrocode}
227 %    First copy the value
228 %    \begin{macrocode}
229   #1=#2
230 %    \end{macrocode}
231 %    Then divide it by 65536.
232 %    \begin{macrocode}
233   \divide #1 by 65536}
234 %    \end{macrocode}
235 %    The result of this is that the \emph{count} register holds the
236 %    value of the \emph{length} register in points.
237 % \end{macro}
239 % \begin{macro}{\SetToHalf}
240 % \begin{macro}{\SetToQuart}
241 %    Small macros used in computing positions.
242 %    \begin{macrocode}
243 \def\SetToHalf#1#2{#1=#2\relax\divide#1by\tw@}
244 \def\SetToQuart#1#2{#1=#2\relax\divide#1by4}
245 %    \end{macrocode}
246 % \end{macro}
248 % \begin{macro}{\Identify}
249 %    A small macro used in identifying dimensions.
250 %    \begin{macrocode}
251 \def\Identify#1{%
252   \put(\PositionX,\PositionY){\circle{20}}
253   \put(\PositionX,\PositionY){\makebox(0,0){\tiny #1}}
255 %    \end{macrocode}
256 % \end{macro}
257 % \end{macro}
259 % \begin{macro}{\InsideHArrow}
260 %    This macro is used to produce two horizontal arrows inside a box.
261 %    The argument gives the width of the box.
262 % \changes{v1.1c}{1994/07/14}{Added check for a negative arrow length}
263 %    \begin{macrocode}
264 \def\InsideHArrow#1{{%
265   \ArrowLength = #1
266   \divide\ArrowLength by \tw@
267   \advance\ArrowLength by -10
268   \advance\PositionX by -10
269   \ifnum\ArrowLength<\z@
270     \put(\PositionX,\PositionY){\vector(1,0){-\ArrowLength}}
271     \advance\PositionX by 20
272     \put(\PositionX,\PositionY){\vector(-1,0){-\ArrowLength}}
273   \else
274     \put(\PositionX,\PositionY){\vector(-1,0){\ArrowLength}}
275     \advance\PositionX by 20
276     \put(\PositionX,\PositionY){\vector(+1,0){\ArrowLength}}
277   \fi
279 %    \end{macrocode}
280 % \end{macro}
282 % \begin{macro}{\InsideVArrow}
283 %    This macro is used to produce two vertical arrows inside a box.
284 %    The argument gives the height of the box.
285 %    \begin{macrocode}
286 \def\InsideVArrow#1{{%
287   \ArrowLength = #1
288   \divide\ArrowLength by \tw@
289   \advance\ArrowLength by -10
290   \advance\PositionY by -10
291   \put(\PositionX,\PositionY){\vector(0,-1){\ArrowLength}}
292   \advance\PositionY by 20
293   \put(\PositionX,\PositionY){\vector(0,+1){\ArrowLength}}
295 %    \end{macrocode}
296 % \end{macro}
298 % \begin{macro}{\OutsideHArrow}
299 %    This macro is used to produce two horizontal arrows to delimit a
300 %    length. The first argument is the position for the right arrow,
301 %    the second argument gives the length and the third specifies the
302 %    length of the arrows.
303 %    \begin{macrocode}
304 \def\OutsideHArrow#1#2#3{{%
305   \PositionX = #1
306   \advance\PositionX by #3
307   \put(\PositionX,\PositionY){\vector(-1,0){#3}}
308   \PositionX = #1 \advance\PositionX-#2
309   \advance\PositionX by -#3
310   \put(\PositionX,\PositionY){\vector(+1,0){#3}}
312 %    \end{macrocode}
313 % \end{macro}
315 % \begin{macro}{\OutsideVArrow}
316 %    This macro is used to produce two vertical arrows to delimit a
317 %    length. The first argument is the position for the lower arrow,
318 %    the second argument gives the length and the third and fourth
319 %    specify the lenghts of the lower and upper arrow.
320 %    \begin{macrocode}
321 \def\OutsideVArrow#1#2#3#4{{%
322   \PositionY = #1
323   \advance\PositionY by -#3
324   \put(\PositionX,\PositionY){\vector(0,+1){#3}}
325   \PositionY = #1
326   \advance\PositionY#2
327   \advance\PositionY#4
328   \put(\PositionX,\PositionY){\vector(0,-1){#4}}
330 %    \end{macrocode}
331 % \end{macro}
333 % \begin{macro}{\Show}
334 % \changes{v1.1g}{1995/04/03}{Simplified the definition, now show
335 %    complete value}
336 % \changes{v1.1h}{1995/04/07}{Use \cs{lay@value} to show the value
337 %    because of the option which decides which of two ways of doing it
338 %    should be used}
340 %    Macro used in the table that shows the setting of the parameters.
341 %    \begin{macrocode}
342 \def\Show#1#2{\LayOutbs #2 = \lay@value{#1}{#2}}
343 %    \end{macrocode}
344 % \end{macro}
346 % \begin{macro}{\Type}
347 % \changes{v1.1g}{1995/04/03}{Simplified the definition, now show
348 %    complete value}
349 % \changes{v1.1h}{1995/04/07}{Use \cs{lay@value} to show the value
350 %    because of the option which decides which of two ways of doing it
351 %    should be used}
352 % \changes{v1.2b}{1998/06/21}{Renamed \cs{type} to \cs{LayOuttype}
353 %   to avoid possible conflicts with other packages}
355 %    Macro used to show a setting of a parameter on the terminal.
356 %    \begin{macrocode}
357 \def\Type#1#2{%
358   \LayOuttype{#2 = \lay@value{#1}{#2}}}
359 %    \end{macrocode}
360 % \end{macro}
362 % \begin{macro}{\oneinch}
363 %    A constant, giving the length of an inch in points (approximately)
364 %    \begin{macrocode}
365 \newcount\oneinch
366 \oneinch=72
367 %    \end{macrocode}
368 % \end{macro}
370 %    Because the overview of the layout is produced in a figure
371 %    environment we need to allocate a number of counters that are
372 %    used to store the values of various dimensions.
374 % \begin{macro}{\cnt@paperwidth}
375 % \begin{macro}{\cnt@paperheight}
376 %    The dimensions of the paper
377 %    \begin{macrocode}
378 \newcount\cnt@paperwidth
379 \newcount\cnt@paperheight
380 \ConvertToCount\cnt@paperwidth\paperwidth
381 \ConvertToCount\cnt@paperheight\paperheight
382 %    \end{macrocode}
383 % \end{macro}
384 % \end{macro}
386 % \begin{macro}{\cnt@hoffset}
387 % \begin{macro}{\cnt@voffset}
388 %    the offsets,
389 %    \begin{macrocode}
390 \newcount\cnt@hoffset
391 \newcount\cnt@voffset
392 \ConvertToCount\cnt@hoffset\hoffset
393 \ConvertToCount\cnt@voffset\voffset
394 %    \end{macrocode}
395 % \end{macro}
396 % \end{macro}
398 % \begin{macro}{\cnt@textheight}
399 % \begin{macro}{\cnt@textwidth}
400 %    dimensions of the text area,
401 %    \begin{macrocode}
402 \newcount\cnt@textheight
403 \newcount\cnt@textwidth
404 %    \end{macrocode}
405 % \end{macro}
406 % \end{macro}
408 % \begin{macro}{\cnt@topmargin}
409 % \begin{macro}{\cnt@oddsidemargin}
410 % \begin{macro}{\cnt@evensidemargin}
411 %    margins,
412 %    \begin{macrocode}
413 \newcount\cnt@topmargin
414 \newcount\cnt@oddsidemargin
415 \newcount\cnt@evensidemargin
416 %    \end{macrocode}
417 % \end{macro}
418 % \end{macro}
419 % \end{macro}
421 % \begin{macro}{\cnt@headheight}
422 % \begin{macro}{\cnt@headsep}
423 %    dimensions of the running heads,
424 %    \begin{macrocode}
425 \newcount\cnt@headheight
426 \newcount\cnt@headsep
427 %    \end{macrocode}
428 % \end{macro}
429 % \end{macro}
431 % \begin{macro}{\cnt@marginparsep}
432 % \begin{macro}{\cnt@marginparwidth}
433 % \begin{macro}{\cnt@marginparpush}
434 %    marginal paragraphs,
435 %    \begin{macrocode}
436 \newcount\cnt@marginparsep
437 \newcount\cnt@marginparwidth
438 \newcount\cnt@marginparpush
439 %    \end{macrocode}
440 % \end{macro}
441 % \end{macro}
442 % \end{macro}
444 % \begin{macro}{\cnt@footskip}
445 %    the distance between the running footers and the text,
446 %    \begin{macrocode}
447 \newcount\cnt@footskip
448 %    \end{macrocode}
449 % \end{macro}
450 %    and the height of the footers, which is needed here to display a
451 %    box, but which isn't used by \LaTeX.
452 % \begin{macro}{\fheight}
453 %    \begin{macrocode}
454 \newcount\fheight
455 \fheight=12
456 %    \end{macrocode}
457 % \end{macro}
459 %    Apart from integer representations of the page layout parameters
460 %    we also need registers to store reference values in.
462 % \begin{macro}{\ref@top}
463 %    The position of the top of the `printable area' is
464 %    one inch below the top of the paper by default. The value of
465 %    |\ref@top| is relative to the lower left corner of the picture
466 %    environment that will be used.
468 %    \begin{macrocode}
469 \newcount\ref@top
470 \ref@top=\cnt@paperheight \advance\ref@top by -\oneinch
471 %    \end{macrocode}
472 % \end{macro}
474 % \begin{macro}{\ref@hoffset}
475 % \begin{macro}{\ref@voffset}
476 %    For the offsets,
477 %    \begin{macrocode}
478 \newcount\ref@hoffset
479 \newcount\ref@voffset
480 %    \end{macrocode}
481 %    The |\hoffset| and |\voffset| values are added to the default
482 %    offset of one inch.
483 %    \begin{macrocode}
484 \ref@hoffset=\cnt@hoffset  \advance\cnt@hoffset by \oneinch
485 \ref@voffset=\cnt@voffset
486 %    \end{macrocode}
488 %    |\cnt@voffset| is converted to be relative to the origin of the
489 %    picture.
490 %    \begin{macrocode}
491 \cnt@voffset=\ref@top
492 \advance\cnt@voffset by -\ref@voffset
493 %    \end{macrocode}
494 % \end{macro}
495 % \end{macro}
497 % \begin{macro}{\ref@head}
498 %    and the text areas, running heads,
499 %    \begin{macrocode}
500 \newcount\ref@head
501 %    \end{macrocode}
502 % \end{macro}
504 % \begin{macro}{\ref@body}
505 %    body of the text
506 %    \begin{macrocode}
507 \newcount\ref@body
508 %    \end{macrocode}
509 % \end{macro}
511 % \begin{macro}{\ref@foot}
512 %    and running footers.
513 %    \begin{macrocode}
514 \newcount\ref@foot
515 %    \end{macrocode}
516 % \end{macro}
518 % \begin{macro}{\ref@margin}
519 % \begin{macro}{\ref@marginwidth}
520 % \begin{macro}{\ref@marginpar}
521 %    These are different for even and odd pages, so they are computed
522 %    by |\layout|.
523 %    \begin{macrocode}
524 \newcount\ref@margin
525 \newcount\ref@marginwidth
526 \newcount\ref@marginpar
527 %    \end{macrocode}
528 % \end{macro}
529 % \end{macro}
530 % \end{macro}
532 %    The following are a number of scratch registers, used in the
533 %    positioning of the various pices of the picture.
534 %    \begin{macrocode}
535 \newcount\Interval
536 \newcount\ExtraYPos
537 \newcount\PositionX
538 \newcount\PositionY
539 \newcount\ArrowLength
540 %    \end{macrocode}
542 %  \begin{macro}{\lay@getvalues}
543 % \changes{v1.1j}{1995/10/30}{Added macro to compute values at later
544 %    time}
545 %    All values that might change during the document are computed by
546 %    calling the macro |\lay@getvalues|. By default this macro is
547 %    executed at |\begin{document}|.
548 %    \begin{macrocode}
549 \def\lay@getvalues{%
550   \ConvertToCount\cnt@textheight\textheight
551   \ConvertToCount\cnt@textwidth\textwidth
552   \ConvertToCount\cnt@topmargin\topmargin
553   \ConvertToCount\cnt@oddsidemargin\oddsidemargin
554   \ConvertToCount\cnt@evensidemargin\evensidemargin
555   \ConvertToCount\cnt@headheight\headheight
556   \ConvertToCount\cnt@headsep\headsep
557   \ConvertToCount\cnt@marginparsep\marginparsep
558   \ConvertToCount\cnt@marginparwidth\marginparwidth
559   \ConvertToCount\cnt@marginparpush\marginparpush
560   \ConvertToCount\cnt@footskip\footskip
561   \ref@head=\ref@top
562     \advance\ref@head by -\ref@voffset
563     \advance\ref@head by -\cnt@topmargin
564     \advance\ref@head by -\cnt@headheight
565   \ref@body=\ref@head
566     \advance\ref@body by -\cnt@headsep
567     \advance\ref@body by -\cnt@textheight
568   \ref@foot=\ref@body
569     \advance\ref@foot by -\cnt@footskip
570   }
571 \AtBeginDocument{\lay@getvalues}
572 %    \end{macrocode}
573 %  \end{macro}
574 %  \begin{macro}{\computevalues}
576 % \begin{macro}{\layout}
577 % \begin{macro}{\layout*}
578 %    The command |\layout| makes the picture and table that display
579 %    the current settings of the layout parameters.
581 % \changes{v1.1b}{1994/03/23}{Produce two pages in twoside mode}
582 % \changes{v1.1j}{1995/10/30}{Added \cs{layout*}}
583 %    \begin{macrocode}
584 \newcommand\layout{%
585   \@ifstar{\lay@getvalues\lay@xlayout}{\lay@xlayout}}
586 \def\lay@xlayout{%
587   \lay@layout
588   \if@twoside
589     \lay@layout
590   \fi}
591 %    \end{macrocode}
593 % \begin{macro}{\lay@layout}
594 %    The internal macro |\lay@layout| does all the dirty work.
595 %    \begin{macrocode}
596 \newcommand\lay@layout{%
597   \thispagestyle{empty}
598 %    \end{macrocode}
600 %    The actions of |\layout| depend on the pagestyle.
601 %    \begin{macrocode}
602   \if@twoside
603     \ifodd\count\z@
604 %    \end{macrocode}
606 %    Here we deal with an odd page in the twosided case.
608 %    \begin{macrocode}
609       \typeout{Two-sided document style, odd page.}
610 %    \end{macrocode}
612 %    So we compute |\ref@marginwidth|, |\ref@marginpar| and
613 %    |\ref@margin|.
614 % \changes{v1.1}{1994/02/23}{Added check for reversemargin}
615 %    \begin{macrocode}
616       \ref@marginwidth=\cnt@oddsidemargin
617       \ref@marginpar=\oneinch
618       \advance\ref@marginpar by \ref@hoffset
619       \advance\ref@marginpar by \cnt@oddsidemargin
620       \ref@margin\ref@marginpar
621       \if@reversemargin
622         \advance\ref@marginpar by -\cnt@marginparsep
623         \advance\ref@marginpar by -\cnt@marginparwidth
624       \else
625         \advance\ref@marginpar by \cnt@textwidth
626         \advance\ref@marginpar by \cnt@marginparsep
627       \fi
628 %    \end{macrocode}
630 %    \begin{macrocode}
631     \else
632 %    \end{macrocode}
634 %    Here we deal with an even page in the twosided case.
636 %    \begin{macrocode}
637   \typeout{Two-sided document style, even page.}
638 %    \end{macrocode}
640 %    So we compute |\ref@marginwidth|, |\ref@marginpar| and
641 %    |\ref@margin|.
642 % \changes{v1.1}{1994/02/23}{Added check for reversemargin}
643 %    \begin{macrocode}
644       \ref@marginwidth=\cnt@evensidemargin
645       \ref@marginpar=\oneinch
646       \advance\ref@marginpar by \ref@hoffset
647       \advance\ref@marginpar by \cnt@evensidemargin
648       \ref@margin\ref@marginpar
649       \if@reversemargin
650         \advance\ref@marginpar by \cnt@textwidth
651         \advance\ref@marginpar by \cnt@marginparsep
652       \else
653         \advance\ref@marginpar by -\cnt@marginparsep
654         \advance\ref@marginpar by -\cnt@marginparwidth
655       \fi
656 %    \end{macrocode}
658 %    \begin{macrocode}
659     \fi
660   \else
661 %    \end{macrocode}
663 %    Finally we the case for single sided printing.
665 % \changes{v1.1}{1994/02/23}{Added check for reversemargin}
666 %    \begin{macrocode}
667     \typeout{One-sided document style.}
668     \ref@marginwidth=\cnt@oddsidemargin
669     \ref@marginpar=\oneinch
670     \advance\ref@marginpar by \ref@hoffset
671     \advance\ref@marginpar by \cnt@oddsidemargin
672     \ref@margin\ref@marginpar
673     \if@reversemargin
674       \advance\ref@marginpar by -\cnt@marginparsep
675       \advance\ref@marginpar by -\cnt@marginparwidth
676     \else
677       \advance\ref@marginpar by \cnt@textwidth
678       \advance\ref@marginpar by \cnt@marginparsep
679     \fi
680   \fi
681 %    \end{macrocode}
684 %  Now we begin the picture environment; dividing all the lengths by
685 %  two is done by setting |\unitlength| to \texttt{0.5pt}
686 %    \begin{macrocode}
687   \setlength{\unitlength}{.5pt}
688   \begin{picture}(\cnt@paperwidth,\cnt@paperheight)
689     \centering
690     \thicklines
691 %    \end{macrocode}
693 %    First we have the pagebox and reference lines,
695 %    \begin{macrocode}
696     \put(0,0){\framebox(\cnt@paperwidth,\cnt@paperheight){\mbox{}}}
697     \put(0,\cnt@voffset){\dashbox{10}(\cnt@paperwidth,0){\mbox{}}}
698     \put(\cnt@hoffset,0){\dashbox{10}(0,\cnt@paperheight){\mbox{}}}
699 %    \end{macrocode}
701 %    then the header,
703 %    \begin{macrocode}
704     \put(\ref@margin,\ref@head){%
705       \framebox(\cnt@textwidth,\cnt@headheight)%
706         {\footnotesize\Headertext}}
707 %    \end{macrocode}
709 %    the body of the text area,
711 %    \begin{macrocode}
712     \put(\ref@margin,\ref@body){%
713       \framebox(\cnt@textwidth,\cnt@textheight){\Bodytext}}
714 %    \end{macrocode}
716 %     the footer
718 %    \begin{macrocode}
719     \put(\ref@margin,\ref@foot){%
720       \framebox(\cnt@textwidth,\fheight){\footnotesize\Footertext}}
721 %    \end{macrocode}
723 %    and the space for marginal notes.
725 %    \begin{macrocode}
726     \put(\ref@marginpar,\ref@body){%
727       \framebox(\cnt@marginparwidth,\cnt@textheight)%
728                {\footnotesize\shortstack{\MarginNotestext}}}
729 %    \end{macrocode}
731 %    Then we start putting in `arrows' to mark the various parameters.
732 %    From here we use |\thinlines|.
733 %    \begin{macrocode}
734     \thinlines
735 %    \end{macrocode}
737 %    |\PositionX| and |\PositionY| will be the coordinates of the center of
738 %    the arrow displaying |\textwidth|.
739 %    \begin{macrocode}
740     \SetToHalf\PositionX\cnt@textwidth
741     \advance\PositionX by \ref@margin
742 %    \end{macrocode}
743 %    The arrow should be a bit above the bottom of the `body box'.
744 %    \begin{macrocode}
745     \PositionY = \ref@body
746     \advance\PositionY by 50
747 %    \end{macrocode}
748 %    An identifying number is put here, in a circle.
749 %    \begin{macrocode}
750     \Identify{8}
751 %    \end{macrocode}
752 %    Then the arrow is drawn.
753 %    \begin{macrocode}
754     \InsideHArrow\cnt@textwidth
755 %    \end{macrocode}
757 %    Now the |\textheight|
758 %    \begin{macrocode}
759     \SetToHalf\PositionY\cnt@textheight
760     \advance\PositionY by \ref@body
761 %    \end{macrocode}
763 %    The x-position of the arrow is at $4/5$ of the width of the `body
764 %    box'.
765 %    \begin{macrocode}
766     \PositionX = \cnt@textwidth
767     \divide\PositionX by 5
768     \multiply \PositionX by 4
769     \advance\PositionX by \ref@margin
770 %    \end{macrocode}
772 %    An identifying number is put here, in a circle.
773 %    \begin{macrocode}
774     \Identify{7}
775     \InsideVArrow\cnt@textheight
776 %    \end{macrocode}
779 %    The |\hoffset|,
780 % \changes{v1.2}{1998/04/13}{\cs{PositionY} for label 1 is
781 %    fixed at 50}
782 %    \begin{macrocode}
783     \PositionY = 50
784     \SetToHalf\PositionX\cnt@hoffset
785     \Identify{1}
786     \InsideHArrow\cnt@hoffset
787 %    \end{macrocode}
790 %    The width of the margin.
791 % \changes{v1.2}{1998/04/13}{The direction of the arrows should be
792 %    switched by the sign of \cs{oddsidemargin}}
793 %    \begin{macrocode}
794     \SetToQuart\PositionY\cnt@textheight
795     \advance\PositionY by \ref@body
796     \ifnum\ref@marginwidth > 0
797       \OutsideHArrow\ref@margin\ref@marginwidth{20}
798       \PositionX = \cnt@hoffset
799     \else
800       \OutsideHArrow\cnt@hoffset{-\ref@marginwidth}{20}
801       \PositionX = \ref@margin
802     \fi
803     \advance\PositionX by -30
804     \Identify{3}
805 %    \end{macrocode}
807 %    the |\marginparwidth|,
808 %    \begin{macrocode}
809     \SetToQuart\PositionY\cnt@textheight
810     \advance\PositionY by \ref@body
811 %    \end{macrocode}
812 %    This arrow has to be bit below the one for the |\oddsidemargin|
813 %    or\\ |\evensidemargin|.
814 %    \begin{macrocode}
815     \advance\PositionY by 30
816     \SetToHalf\PositionX\cnt@marginparwidth
817     \advance\PositionX by \ref@marginpar
818     \Identify{10}
819     \InsideHArrow\cnt@marginparwidth
820 %    \end{macrocode}
823 %    The |\marginparsep|, this depends on single or double sided
824 %    printing.
825 %    \begin{macrocode}
826     \advance\PositionY by 30
827     \if@twoside
828 %    \end{macrocode}
830 %    Twosided mode, reversemargin;
831 % \changes{v1.1b}{1994/03/23}{\cs{OutSideHArrow} should be
832 %    \cs{OutsideHArrow}}
833 % \changes{v1.2}{1998/04/13}{Added check for reversemargin}
834 %    \begin{macrocode}
835       \if@reversemargin
836         \ifodd\count\z@
837           \OutsideHArrow\ref@margin\cnt@marginparsep{20}
838           \PositionX = \ref@margin
839         \else
840           \OutsideHArrow\ref@marginpar\cnt@marginparsep{20}
841           \PositionX = \ref@marginpar
842         \fi
843       \else
844 %    \end{macrocode}
845 %    Not reversemargin;
846 %    \begin{macrocode}
847         \ifodd\count\z@
848           \OutsideHArrow\ref@marginpar\cnt@marginparsep{20}
849           \PositionX = \ref@marginpar
850         \else
851           \OutsideHArrow\ref@margin\cnt@marginparsep{20}
852           \PositionX = \ref@margin
853         \fi
854       \fi
855     \else
856 %    \end{macrocode}
858 %    Single sided mode.
859 % \changes{v1.2}{1998/04/13}{Added check for reversemargin}
860 %    \begin{macrocode}
861       \if@reversemargin
862         \OutsideHArrow\ref@margin\cnt@marginparsep{20}
863         \PositionX = \ref@margin
864       \else
865         \OutsideHArrow\ref@marginpar\cnt@marginparsep{20}
866         \PositionX = \ref@marginpar
867       \fi
868     \fi
869 %    \end{macrocode}
870 % \changes{v1.2}{1998/04/13}{The \cs{PositionX} of the label 9 is
871 %    changed to the left side of the arrows}
872 %    \begin{macrocode}
873     \advance\PositionX by -\cnt@marginparsep
874     \advance\PositionX by -30
875     \Identify{9}
876 %    \end{macrocode}
878 %    Identify the |\footskip|. The arrow will be located on $1/8$th of
879 %    the |\textwidth|.
880 % \changes{v1.2}{1998/04/13}{The \cs{PositionY} of the label 11 is
881 %    changed to the upper side of the arrows}
882 %    \begin{macrocode}
883     \PositionX = \cnt@textwidth
884     \divide\PositionX by 8
885     \advance\PositionX by \ref@margin
886     \OutsideVArrow\ref@foot\cnt@footskip{20}{20}
887     \PositionY = \ref@foot
888     \advance\PositionY by \cnt@footskip
889     \advance\PositionY by 30
890     \Identify{11}
891 %    \end{macrocode}
893 %    Identify the |\voffset|. The arrow will be located a bit to the
894 %    left of the edge of the paper.
895 %    \begin{macrocode}
896     \PositionX = \cnt@paperwidth
897     \advance\PositionX by -50
898     \PositionY = \cnt@paperheight
899     \ExtraYPos = \PositionY
900     \advance\ExtraYPos by -\cnt@voffset
901     \advance\PositionY by \cnt@voffset
902     \divide\PositionY by \tw@
903     \Identify{2}
904     \InsideVArrow\ExtraYPos
905 %    \end{macrocode}
907 %    Identify |\topmargin|, |\headheight| and |\headsep|.
909 %    The arrows will be located on $1/8$th of the |\textwidth|, with
910 %    intervals of the same size, stored in |\Interval|.
911 %    \begin{macrocode}
912     \Interval = \cnt@textwidth
913     \divide\Interval by 8
914     \PositionX = \ref@margin
915     \advance\PositionX by \Interval
916 %    \end{macrocode}
917 %    First the |\topmargin|. If |\topmargin| has a positive value, the
918 %    arrow is upward. Otherwise, it is downward. The number label is
919 %    always placed at the base of the arrow.
920 % \changes{v1.2}{1998/04/13}{The direction of the arrows should be
921 %    switched by the sign of \cs{topmargin}}
922 %    \begin{macrocode}
923     \ifnum\cnt@topmargin > \z@
924       \ExtraYPos = \ref@head
925       \advance\ExtraYPos\cnt@headheight
926       \OutsideVArrow\ExtraYPos\cnt@topmargin{20}{20}
927       \PositionY = \ExtraYPos
928       \advance\PositionY by \cnt@topmargin
929     \else
930       \ExtraYPos = \cnt@voffset
931       \OutsideVArrow\ExtraYPos{-\cnt@topmargin}{20}{20}
932       \PositionY = \ExtraYPos
933       \advance\PositionY by -\cnt@topmargin
934     \fi
935     \advance\PositionY by 30
936     \Identify{4}
937     \advance\PositionX by \Interval
938 %    \end{macrocode}
939 %    Then the |\headheight|
940 % \changes{v1.2}{1998/04/13}{The \cs{PositionY} of the label 5 is
941 %    fixed}
942 %    \begin{macrocode}
943     \OutsideVArrow\ref@head\cnt@headheight{20}{20}
944     \PositionY = \ref@head
945     \advance\PositionY by \cnt@headheight
946     \advance\PositionY by 30
947     \Identify{5}
948     \advance\PositionX by \Interval
949 %    \end{macrocode}
950 %    and finally the |\headsep|
951 % \changes{v1.2}{1998/04/13}{The \cs{PositionY} of the label 6 is
952 %    fixed}
953 %    \begin{macrocode}
954     \ExtraYPos=\ref@body
955     \advance\ExtraYPos\cnt@textheight
956     \OutsideVArrow\ExtraYPos\cnt@headsep{20}{20}
957     \PositionY = \ref@body
958     \advance\PositionY by \cnt@textheight
959     \advance\PositionY by -30
960     \Identify{6}
961 %    \end{macrocode}
963 %    Here we can end the picture environment and insert a little
964 %    space.
965 %    \begin{macrocode}
966   \end{picture}
968   \medskip
969 %    \end{macrocode}
971 %    Below the picture we put a table to show the actual values of the
972 %    parameters.  Note that fractional points are truncated, i.e.,
973 %    \texttt{72.27pt} is displayed as \texttt{72pt}
975 %    The table is typeset inside a box with a depth of 0 to always
976 %    keep it on the same page as the picture.
977 % \changes{v1.1b}{1994/03/23}{Showing oddside and evenside margins was
978 %    defective}
979 % \changes{v1.1c}{1994/07/14}{in compatibility mode \cs{footnotesize}
980 %    calls \cs{normalfont}; therefore we need to switch to a tt font
981 %    later}
982 % \changes{v1.1f}{1995/03/14}{introduced \cs{notshown}}
983 %    \begin{macrocode}
984   \vtop to 0pt{%
985     \@minipagerestore\footnotesize\ttfamily
986     \begin{tabular}{@{}rl@{\hspace{20pt}}rl}
987       1 & \oneinchtext\ + \LayOutbs\texttt{hoffset}
988         & 2 & \oneinchtext\ + \LayOutbs\texttt{voffset} \\
989       3 & \if@twoside
990             \ifodd\count\z@ \Show{cnt}{oddsidemargin}
991             \else \Show{cnt}{evensidemargin}
992             \fi
993           \else
994             \Show{cnt}{oddsidemargin}
995           \fi                    & 4 & \Show{cnt}{topmargin} \\
996       5 & \Show{cnt}{headheight} & 6 & \Show{cnt}{headsep} \\
997       7 & \Show{cnt}{textheight} & 8 & \Show{cnt}{textwidth} \\
998       9 & \Show{cnt}{marginparsep}&10& \Show{cnt}{marginparwidth} \\
999       11& \Show{cnt}{footskip}   &   & \Show{cnt}{marginparpush}
1000        \rlap{(\notshown)}\\
1001         & \Show{ref}{hoffset}    &   & \Show{ref}{voffset} \\
1002         & \Show{cnt}{paperwidth} &   & \Show{cnt}{paperheight} \\
1004   \end{tabular}\vss}
1005 %    \end{macrocode}
1006 %    When the option \Lopt{verbose} was used the following lines will
1007 %    show dimensions on the terminal.
1008 %    \begin{macrocode}
1009   \Type{ref}{hoffset}
1010   \Type{ref}{voffset}
1011   \Type{cnt}{textheight}
1012   \Type{cnt}{textwidth}
1013 %    \end{macrocode}
1014 %    Finally we start a new page.
1015 %    \begin{macrocode}
1016   \newpage
1018 %</package>
1019 %    \end{macrocode}
1020 % \end{macro}
1021 % \end{macro}
1022 % \end{macro}
1023 % \end{macro}
1025 % \Finale
1026 \endinput