Debian Codegraph @

texmf-dist/tex/latex-dev/tools/layout.sty

raw
1 %%
2 %% This is file `layout.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% layout.dtx (with options: `package')
8 %%
9 %% This is a generated file.
10 %%
11 %% The source is maintained by the LaTeX Project team and bug
12 %% reports for it can be opened at https://latex-project.org/bugs/
13 %% (but please observe conditions on bug reports sent to that address!)
14 %%
15 %%
16 %% Copyright (C) 1993-2026
17 %% The LaTeX Project and any individual authors listed elsewhere
18 %% in this file.
19 %%
20 %% This file was generated from file(s) of the Standard LaTeX `Tools Bundle'.
21 %% --------------------------------------------------------------------------
22 %%
23 %% It may be distributed and/or modified under the
24 %% conditions of the LaTeX Project Public License, either version 1.3c
25 %% of this license or (at your option) any later version.
26 %% The latest version of this license is in
27 %% https://www.latex-project.org/lppl.txt
28 %% and version 1.3c or later is part of all distributions of LaTeX
29 %% version 2005/12/01 or later.
30 %%
31 %% This file may only be distributed together with a copy of the LaTeX
32 %% `Tools Bundle'. You may however distribute the LaTeX `Tools Bundle'
33 %% without such generated files.
34 %%
35 %% The list of all files belonging to the LaTeX `Tools Bundle' is
36 %% given in the file `manifest.txt'.
37 %%
38 \NeedsTeXFormat{LaTeX2e}
39 \ProvidesPackage{layout}
40 [2023-08-20 v1.2e Show layout parameters]
41 \DeclareOption{dutch}{%
42 \def\Headertext{Kopregel}
43 \def\Bodytext{Broodtekst}
44 \def\Footertext{Voetregel}
45 \def\MarginNotestext{Marge\\Notities}
46 \def\oneinchtext{een inch}
47 \def\notshown{niet getoond}
48 }
49 \DeclareOption{german}{%
50 \def\Headertext{Kopfzeile}
51 \def\Bodytext{Haupttext}
52 \def\Footertext{Fu{\ss}zeile}
53 \def\MarginNotestext{Rand-\\ notizen}
54 \def\oneinchtext{ein Zoll}
55 \def\notshown{ohne Abbildung}
56 }
57 \DeclareOption{ngerman}{\ExecuteOptions{german}}
58 \DeclareOption{english}{%
59 \def\Headertext{Header}
60 \def\Bodytext{Body}
61 \def\Footertext{Footer}
62 \def\MarginNotestext{Margin\\Notes}
63 \def\oneinchtext{one inch}
64 \def\notshown{not shown}
65 }
66 \DeclareOption{french}{%
67 \def\Headertext{Ent\^{e}te}
68 \def\Bodytext{Corps}
69 \def\Footertext{Pied de page}
70 \def\MarginNotestext{Marge\\Notes}
71 \def\oneinchtext{un pouce}
72 \def\notshown{non affich\'{e}}
73 }
74 \DeclareOption{francais}{\ExecuteOptions{french}}
75 \DeclareOption{spanish}{%
76 \def\Headertext{Encabezamiento}
77 \def\Bodytext{Cuerpo}
78 \def\Footertext{Pie de p\'agina}
79 \def\MarginNotestext{Notas\\ Marginales}
80 \def\oneinchtext{una pulgada}
81 \def\notshown{no mostradas}
82 }
83 \DeclareOption{portuguese}{%
84 \def\Headertext{Cabe\c{c}alho}
85 \def\Bodytext{Corpo}
86 \def\Footertext{Rodap\'e}
87 \def\MarginNotestext{Notas\\ Marginais}
88 \def\oneinchtext{uma polegada}
89 \def\notshown{n\~ao mostradas}
90 }
91 \DeclareOption{brazilian}{%
92 \def\Headertext{Cabe\c{c}alho}
93 \def\Bodytext{Corpo}
94 \def\Footertext{Rodap\'e}
95 \def\MarginNotestext{Notas\\ Marginais}
96 \def\oneinchtext{uma polegada}
97 \def\notshown{n\~ao mostradas}
98 }
99 \DeclareOption{italian}{%
100 \def\Headertext{Testatina}
101 \def\Bodytext{Corpo}
102 \def\Footertext{Piedino}
103 \def\MarginNotestext{Note\\ Marginali}
104 \def\oneinchtext{un pollice}
105 \def\notshown{non mostrato}
106 }
107 \DeclareOption{romanian}{%
108 \def\Headertext{Antet}
109 \def\Bodytext{Corp}
110 \def\Footertext{Subsol}
111 \def\MarginNotestext{Note\\ Marginale}
112 \def\oneinchtext{un inch}
113 \def\notshown{neafi\textcommabelow sat}
114 }
115 \DeclareOption{japanese}{%
116 \def\Headertext{天}
117 \def\Bodytext{基本版面}
118 \def\Footertext{地}
119 \def\MarginNotestext{傍\\注}
120 \def\oneinchtext{1インチ}
121 \def\notshown{非表示}
122 }
123 \DeclareOption{verbose}{\let\LayOuttype\typeout}
124 \DeclareOption{silent}{\let\LayOuttype\@gobble}
125 \def\lay@value{}
126 \DeclareOption{integers}{%
127 \renewcommand*{\lay@value}[2]{%
128 \expandafter\number\csname #1@#2\endcsname pt}}
129 \DeclareOption{reals}{%
130 \renewcommand*{\lay@value}[2]{\the\csname #2\endcsname}}
131 \ExecuteOptions{english,silent,integers}
132 \ProcessOptions
133 \newcommand\LayOutbs{}
134 \chardef\LayOutbs`\\
135 \def\ConvertToCount#1#2{%
136 #1=#2
137 \divide #1 by 65536}
138 \def\SetToHalf#1#2{#1=#2\relax\divide#1by\tw@}
139 \def\SetToQuart#1#2{#1=#2\relax\divide#1by4}
140 \def\Identify#1{%
141 \put(\PositionX,\PositionY){\circle{20}}
142 \put(\PositionX,\PositionY){\makebox(0,0){\tiny #1}}
143 }
144 \def\InsideHArrow#1{{%
145 \ArrowLength = #1
146 \divide\ArrowLength by \tw@
147 \advance\ArrowLength by -10
148 \advance\PositionX by -10
149 \ifnum\ArrowLength<\z@
150 \put(\PositionX,\PositionY){\vector(1,0){-\ArrowLength}}
151 \advance\PositionX by 20
152 \put(\PositionX,\PositionY){\vector(-1,0){-\ArrowLength}}
153 \else
154 \put(\PositionX,\PositionY){\vector(-1,0){\ArrowLength}}
155 \advance\PositionX by 20
156 \put(\PositionX,\PositionY){\vector(+1,0){\ArrowLength}}
157 \fi
158 }}
159 \def\InsideVArrow#1{{%
160 \ArrowLength = #1
161 \divide\ArrowLength by \tw@
162 \advance\ArrowLength by -10
163 \advance\PositionY by -10
164 \put(\PositionX,\PositionY){\vector(0,-1){\ArrowLength}}
165 \advance\PositionY by 20
166 \put(\PositionX,\PositionY){\vector(0,+1){\ArrowLength}}
167 }}
168 \def\OutsideHArrow#1#2#3{{%
169 \PositionX = #1
170 \advance\PositionX by #3
171 \put(\PositionX,\PositionY){\vector(-1,0){#3}}
172 \PositionX = #1 \advance\PositionX-#2
173 \advance\PositionX by -#3
174 \put(\PositionX,\PositionY){\vector(+1,0){#3}}
175 }}
176 \def\OutsideVArrow#1#2#3#4{{%
177 \PositionY = #1
178 \advance\PositionY by -#3
179 \put(\PositionX,\PositionY){\vector(0,+1){#3}}
180 \PositionY = #1
181 \advance\PositionY#2
182 \advance\PositionY#4
183 \put(\PositionX,\PositionY){\vector(0,-1){#4}}
184 }}
185 \def\Show#1#2{\LayOutbs #2 = \lay@value{#1}{#2}}
186 \def\Type#1#2{%
187 \LayOuttype{#2 = \lay@value{#1}{#2}}}
188 \newcount\oneinch
189 \oneinch=72
190 \newcount\cnt@paperwidth
191 \newcount\cnt@paperheight
192 \ConvertToCount\cnt@paperwidth\paperwidth
193 \ConvertToCount\cnt@paperheight\paperheight
194 \newcount\cnt@hoffset
195 \newcount\cnt@voffset
196 \ConvertToCount\cnt@hoffset\hoffset
197 \ConvertToCount\cnt@voffset\voffset
198 \newcount\cnt@textheight
199 \newcount\cnt@textwidth
200 \newcount\cnt@topmargin
201 \newcount\cnt@oddsidemargin
202 \newcount\cnt@evensidemargin
203 \newcount\cnt@headheight
204 \newcount\cnt@headsep
205 \newcount\cnt@marginparsep
206 \newcount\cnt@marginparwidth
207 \newcount\cnt@marginparpush
208 \newcount\cnt@footskip
209 \newcount\fheight
210 \fheight=12
211 \newcount\ref@top
212 \ref@top=\cnt@paperheight \advance\ref@top by -\oneinch
213 \newcount\ref@hoffset
214 \newcount\ref@voffset
215 \ref@hoffset=\cnt@hoffset \advance\cnt@hoffset by \oneinch
216 \ref@voffset=\cnt@voffset
217 \cnt@voffset=\ref@top
218 \advance\cnt@voffset by -\ref@voffset
219 \newcount\ref@head
220 \newcount\ref@body
221 \newcount\ref@foot
222 \newcount\ref@margin
223 \newcount\ref@marginwidth
224 \newcount\ref@marginpar
225 \newcount\Interval
226 \newcount\ExtraYPos
227 \newcount\PositionX
228 \newcount\PositionY
229 \newcount\ArrowLength
230 \def\lay@getvalues{%
231 \ConvertToCount\cnt@textheight\textheight
232 \ConvertToCount\cnt@textwidth\textwidth
233 \ConvertToCount\cnt@topmargin\topmargin
234 \ConvertToCount\cnt@oddsidemargin\oddsidemargin
235 \ConvertToCount\cnt@evensidemargin\evensidemargin
236 \ConvertToCount\cnt@headheight\headheight
237 \ConvertToCount\cnt@headsep\headsep
238 \ConvertToCount\cnt@marginparsep\marginparsep
239 \ConvertToCount\cnt@marginparwidth\marginparwidth
240 \ConvertToCount\cnt@marginparpush\marginparpush
241 \ConvertToCount\cnt@footskip\footskip
242 \ref@head=\ref@top
243 \advance\ref@head by -\ref@voffset
244 \advance\ref@head by -\cnt@topmargin
245 \advance\ref@head by -\cnt@headheight
246 \ref@body=\ref@head
247 \advance\ref@body by -\cnt@headsep
248 \advance\ref@body by -\cnt@textheight
249 \ref@foot=\ref@body
250 \advance\ref@foot by -\cnt@footskip
251 }
252 \AtBeginDocument{\lay@getvalues}
253 \newcommand\layout{%
254 \@ifstar{\lay@getvalues\lay@xlayout}{\lay@xlayout}}
255 \def\lay@xlayout{%
256 \lay@layout
257 \if@twoside
258 \lay@layout
259 \fi}
260 \newcommand\lay@layout{%
261 \thispagestyle{empty}
262 \if@twoside
263 \ifodd\count\z@
264 \typeout{Two-sided document style, odd page.}
265 \ref@marginwidth=\cnt@oddsidemargin
266 \ref@marginpar=\oneinch
267 \advance\ref@marginpar by \ref@hoffset
268 \advance\ref@marginpar by \cnt@oddsidemargin
269 \ref@margin\ref@marginpar
270 \if@reversemargin
271 \advance\ref@marginpar by -\cnt@marginparsep
272 \advance\ref@marginpar by -\cnt@marginparwidth
273 \else
274 \advance\ref@marginpar by \cnt@textwidth
275 \advance\ref@marginpar by \cnt@marginparsep
276 \fi
277 \else
278 \typeout{Two-sided document style, even page.}
279 \ref@marginwidth=\cnt@evensidemargin
280 \ref@marginpar=\oneinch
281 \advance\ref@marginpar by \ref@hoffset
282 \advance\ref@marginpar by \cnt@evensidemargin
283 \ref@margin\ref@marginpar
284 \if@reversemargin
285 \advance\ref@marginpar by \cnt@textwidth
286 \advance\ref@marginpar by \cnt@marginparsep
287 \else
288 \advance\ref@marginpar by -\cnt@marginparsep
289 \advance\ref@marginpar by -\cnt@marginparwidth
290 \fi
291 \fi
292 \else
293 \typeout{One-sided document style.}
294 \ref@marginwidth=\cnt@oddsidemargin
295 \ref@marginpar=\oneinch
296 \advance\ref@marginpar by \ref@hoffset
297 \advance\ref@marginpar by \cnt@oddsidemargin
298 \ref@margin\ref@marginpar
299 \if@reversemargin
300 \advance\ref@marginpar by -\cnt@marginparsep
301 \advance\ref@marginpar by -\cnt@marginparwidth
302 \else
303 \advance\ref@marginpar by \cnt@textwidth
304 \advance\ref@marginpar by \cnt@marginparsep
305 \fi
306 \fi
307 \setlength{\unitlength}{.5pt}
308 \begin{picture}(\cnt@paperwidth,\cnt@paperheight)
309 \centering
310 \thicklines
311 \put(0,0){\framebox(\cnt@paperwidth,\cnt@paperheight){\mbox{}}}
312 \put(0,\cnt@voffset){\dashbox{10}(\cnt@paperwidth,0){\mbox{}}}
313 \put(\cnt@hoffset,0){\dashbox{10}(0,\cnt@paperheight){\mbox{}}}
314 \put(\ref@margin,\ref@head){%
315 \framebox(\cnt@textwidth,\cnt@headheight)%
316 {\footnotesize\Headertext}}
317 \put(\ref@margin,\ref@body){%
318 \framebox(\cnt@textwidth,\cnt@textheight){\Bodytext}}
319 \put(\ref@margin,\ref@foot){%
320 \framebox(\cnt@textwidth,\fheight){\footnotesize\Footertext}}
321 \put(\ref@marginpar,\ref@body){%
322 \framebox(\cnt@marginparwidth,\cnt@textheight)%
323 {\footnotesize\shortstack{\MarginNotestext}}}
324 \thinlines
325 \SetToHalf\PositionX\cnt@textwidth
326 \advance\PositionX by \ref@margin
327 \PositionY = \ref@body
328 \advance\PositionY by 50
329 \Identify{8}
330 \InsideHArrow\cnt@textwidth
331 \SetToHalf\PositionY\cnt@textheight
332 \advance\PositionY by \ref@body
333 \PositionX = \cnt@textwidth
334 \divide\PositionX by 5
335 \multiply \PositionX by 4
336 \advance\PositionX by \ref@margin
337 \Identify{7}
338 \InsideVArrow\cnt@textheight
339 \PositionY = 50
340 \SetToHalf\PositionX\cnt@hoffset
341 \Identify{1}
342 \InsideHArrow\cnt@hoffset
343 \SetToQuart\PositionY\cnt@textheight
344 \advance\PositionY by \ref@body
345 \ifnum\ref@marginwidth > 0
346 \OutsideHArrow\ref@margin\ref@marginwidth{20}
347 \PositionX = \cnt@hoffset
348 \else
349 \OutsideHArrow\cnt@hoffset{-\ref@marginwidth}{20}
350 \PositionX = \ref@margin
351 \fi
352 \advance\PositionX by -30
353 \Identify{3}
354 \SetToQuart\PositionY\cnt@textheight
355 \advance\PositionY by \ref@body
356 \advance\PositionY by 30
357 \SetToHalf\PositionX\cnt@marginparwidth
358 \advance\PositionX by \ref@marginpar
359 \Identify{10}
360 \InsideHArrow\cnt@marginparwidth
361 \advance\PositionY by 30
362 \if@twoside
363 \if@reversemargin
364 \ifodd\count\z@
365 \OutsideHArrow\ref@margin\cnt@marginparsep{20}
366 \PositionX = \ref@margin
367 \else
368 \OutsideHArrow\ref@marginpar\cnt@marginparsep{20}
369 \PositionX = \ref@marginpar
370 \fi
371 \else
372 \ifodd\count\z@
373 \OutsideHArrow\ref@marginpar\cnt@marginparsep{20}
374 \PositionX = \ref@marginpar
375 \else
376 \OutsideHArrow\ref@margin\cnt@marginparsep{20}
377 \PositionX = \ref@margin
378 \fi
379 \fi
380 \else
381 \if@reversemargin
382 \OutsideHArrow\ref@margin\cnt@marginparsep{20}
383 \PositionX = \ref@margin
384 \else
385 \OutsideHArrow\ref@marginpar\cnt@marginparsep{20}
386 \PositionX = \ref@marginpar
387 \fi
388 \fi
389 \advance\PositionX by -\cnt@marginparsep
390 \advance\PositionX by -30
391 \Identify{9}
392 \PositionX = \cnt@textwidth
393 \divide\PositionX by 8
394 \advance\PositionX by \ref@margin
395 \OutsideVArrow\ref@foot\cnt@footskip{20}{20}
396 \PositionY = \ref@foot
397 \advance\PositionY by \cnt@footskip
398 \advance\PositionY by 30
399 \Identify{11}
400 \PositionX = \cnt@paperwidth
401 \advance\PositionX by -50
402 \PositionY = \cnt@paperheight
403 \ExtraYPos = \PositionY
404 \advance\ExtraYPos by -\cnt@voffset
405 \advance\PositionY by \cnt@voffset
406 \divide\PositionY by \tw@
407 \Identify{2}
408 \InsideVArrow\ExtraYPos
409 \Interval = \cnt@textwidth
410 \divide\Interval by 8
411 \PositionX = \ref@margin
412 \advance\PositionX by \Interval
413 \ifnum\cnt@topmargin > \z@
414 \ExtraYPos = \ref@head
415 \advance\ExtraYPos\cnt@headheight
416 \OutsideVArrow\ExtraYPos\cnt@topmargin{20}{20}
417 \PositionY = \ExtraYPos
418 \advance\PositionY by \cnt@topmargin
419 \else
420 \ExtraYPos = \cnt@voffset
421 \OutsideVArrow\ExtraYPos{-\cnt@topmargin}{20}{20}
422 \PositionY = \ExtraYPos
423 \advance\PositionY by -\cnt@topmargin
424 \fi
425 \advance\PositionY by 30
426 \Identify{4}
427 \advance\PositionX by \Interval
428 \OutsideVArrow\ref@head\cnt@headheight{20}{20}
429 \PositionY = \ref@head
430 \advance\PositionY by \cnt@headheight
431 \advance\PositionY by 30
432 \Identify{5}
433 \advance\PositionX by \Interval
434 \ExtraYPos=\ref@body
435 \advance\ExtraYPos\cnt@textheight
436 \OutsideVArrow\ExtraYPos\cnt@headsep{20}{20}
437 \PositionY = \ref@body
438 \advance\PositionY by \cnt@textheight
439 \advance\PositionY by -30
440 \Identify{6}
441 \end{picture}
442
443 \medskip
444 \vtop to 0pt{%
445 \@minipagerestore\footnotesize\ttfamily
446 \begin{tabular}{@{}rl@{\hspace{20pt}}rl}
447 1 & \oneinchtext\ + \LayOutbs\texttt{hoffset}
448 & 2 & \oneinchtext\ + \LayOutbs\texttt{voffset} \\
449 3 & \if@twoside
450 \ifodd\count\z@ \Show{cnt}{oddsidemargin}
451 \else \Show{cnt}{evensidemargin}
452 \fi
453 \else
454 \Show{cnt}{oddsidemargin}
455 \fi & 4 & \Show{cnt}{topmargin} \\
456 5 & \Show{cnt}{headheight} & 6 & \Show{cnt}{headsep} \\
457 7 & \Show{cnt}{textheight} & 8 & \Show{cnt}{textwidth} \\
458 9 & \Show{cnt}{marginparsep}&10& \Show{cnt}{marginparwidth} \\
459 11& \Show{cnt}{footskip} & & \Show{cnt}{marginparpush}
460 \rlap{(\notshown)}\\
461 & \Show{ref}{hoffset} & & \Show{ref}{voffset} \\
462 & \Show{cnt}{paperwidth} & & \Show{cnt}{paperheight} \\
463
464 \end{tabular}\vss}
465 \Type{ref}{hoffset}
466 \Type{ref}{voffset}
467 \Type{cnt}{textheight}
468 \Type{cnt}{textwidth}
469 \newpage
470 }
471 \endinput
472 %%
473 %% End of file `layout.sty'.