Debian Codegraph @

texmf-dist/source/latex/tools/layout.dtx

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