Debian Codegraph @

texmf-dist/source/latex/layouts/layouts.dtx

raw
1 % \iffalse meta-comment
2 %
3 % layouts.dtx
4 % Author: Peter Wilson (Herries Press))
5 % Maintainer: Will Robertson (will dot robertson at latex-project dot org)
6 % Copyright 1998--2004 Peter R. Wilson
7 %
8 % This work may be distributed and/or modified under the
9 % conditions of the LaTeX Project Public License, either
10 % version 1.3c of this license or (at your option) any
11 % later version: <http://www.latex-project.org/lppl.txt>
12 %
13 % This work has the LPPL maintenance status "maintained".
14 % The Current Maintainer of this work is Will Robertson.
15 %
16 % This work consists of the files listed in the README file.
17 %
18 %
19 %<*driver>
20 \documentclass[twoside]{ltxdoc}
21 \usepackage{url}
22 \makeatletter
23 \@mparswitchfalse
24 \makeatother
25 \EnableCrossrefs
26 \CodelineIndex
27 \setcounter{StandardModuleDepth}{1}
28 \renewcommand{\MakeUppercase}[1]{#1}
29 \pagestyle{headings}
30 \begin{document}
31 \raggedbottom
32 \DocInput{layouts.dtx}
33 \end{document}
34 %</driver>
35 %
36 % \fi
37 %
38 % \CheckSum{6212}
39 %
40 % \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath}
41 % \DoNotIndex{\@centercr,\@cite}
42 % \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue}
43 % \DoNotIndex{\@input,\@ixpt,\@m}
44 % \DoNotIndex{\@minus,\@mkboth,\@ne,\@nil,\@nomath,\@plus,\@set@topoint}
45 % \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb}
46 % \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt}
47 % \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt}
48 % \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace}
49 % \DoNotIndex{\advance,\Alph,\alph}
50 % \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box}
51 % \DoNotIndex{\bullet}
52 % \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption}
53 % \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass}
54 % \DoNotIndex{% \DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist}
55 % \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup}
56 % \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter}
57 % \DoNotIndex{\fbox}
58 % \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef}
59 % \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule}
60 % \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi}
61 % \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi}
62 % \DoNotIndex{\input}
63 % \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark}
64 % \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright}
65 % \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment}
66 % \DoNotIndex{\NeedsTeXFormat,\newdimen}
67 % \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number}
68 % \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@}
69 % \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip}
70 % \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions}
71 % \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright}
72 % \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font}
73 % \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily,\roman}
74 % \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength}
75 % \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space}
76 % \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase}
77 % \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt}
78 % \DoNotIndex{\viipt,\vipt,\vskip,\vspace}
79 % \DoNotIndex{\wd,\xiipt,\year,\z@}
80 %
81 % \DoNotIndex{\put,\vector,\line,\texttt,\multiply}
82 %
83 % \def\dtxfile{layouts.dtx}
84 % \def\fileversion{v2.3b} \def\filedate{1999/03/06}
85 % \def\fileversion{v2.4} \def\filedate{2001/04/30}
86 % \def\fileversion{v2.5} \def\filedate{2001/11/11}
87 % \def\fileversion{v2.5a} \def\filedate{2002/03/24}
88 % \def\fileversion{v2.6} \def\filedate{2002/06/09}
89 % \def\fileversion{v2.6a} \def\filedate{2002/12/12}
90 % \def\fileversion{v2.6b} \def\filedate{2003/11/25}
91 % \def\fileversion{v2.6c} \def\filedate{2004/10/25}
92 % \def\fileversion{v2.6d} \def\filedate{2009/09/02}
93 % \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package
94 % \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option
95 % \newcommand*{\file}[1]{\texttt {#1}} ^^A typeset a file
96 % \newcommand*{\Lcount}[1]{\textsl {\small#1}} ^^A typeset a counter
97 % \newcommand*{\pstyle}[1]{\textsl {#1}} ^^A typeset a pagestyle
98 % \newcommand*{\Lenv}[1]{\texttt {#1}} ^^A typeset an environment
99 %
100 % \title{The \Lpack{layouts} package: Code\thanks{This
101 % file (\texttt{\dtxfile}) has version number \fileversion, last revised
102 % \filedate.}}
103 %
104 % \author{
105 % Author: Peter Wilson, Herries Press \\
106 % Maintainer: Will Robertson \\
107 % \texttt{will dot robertson at latex-project dot org}
108 % }
109 % \date{\filedate}
110 % \maketitle
111 % \begin{abstract}
112 % The \Lpack{layouts} package provides facilities for document designers
113 % to experiment with various aspects of the layout of \LaTeX ed documents.
114 % There is a separate user manual for the package.
115 % \end{abstract}
116 % \tableofcontents
117 %
118 % \StopEventually{}
119 %
120 %
121 %
122 % \section{Introduction}
123 %
124 % This document provides the commented source for a \LaTeX{}
125 % package file developed as part of a suite designed for the typesetting of
126 % documents according to the rules for ISO international
127 % standards~\cite{PRW96i}.
128 % A separate document provides the user manual.
129 %
130 % Section~\ref{sec:lays} describes a package to assist in the
131 % design of new \LaTeX{} classes and packages by graphically
132 % depicting the layout\footnote{With thanks to Frank Mittelbach
133 % for noticing some problems with version 2.4 and suggesting additional
134 % features.} of various logical elements of a document.
135 % This package has general applicability and is not restricted to
136 % typesetting ISO documents.
137 %
138 % This manual is typeset according to the conventions of the
139 % \LaTeX{} \textsc{docstrip} utility which enables the automatic
140 % extraction of the \LaTeX{} macro source files~\cite{GOOSSENS94}.
141 %
142 %
143 %
144 % \section{The \Lpack{layouts} package} \label{sec:lays}
145 %
146 % Announce the name and version of the package which requires \LaTeXe.
147 % \changes{v2.1}{1998/10/14}{Changed the Title, the Introduction, and other text}
148 % \changes{v2.1}{1998/10/14}{Added requirement for LaTeX2e}
149 % \changes{v2.2}{1998/11/14}{Tidied a lot of code}
150 % \changes{v2.2}{1998/11/14}{Added drawing of font boxes}
151 % \changes{v2.3}{1999/01/21}{Eliminated several new counters}
152 % \changes{v2.3}{1999/01/21}{Corrected ToC layout}
153 % \changes{v2.3}{1999/01/21}{Added ...values commands}
154 % \changes{v2.3a}{1999/01/21}{Tweaked the ToC layout for dotted leader}
155 % \changes{v2.3b}{1999/03/06}{Undeleted the l@youtscale command}
156 % \changes{v2.4}{2001/04/30}{Added \cs{drawstock} for the memoir class}
157 % \changes{v2.4}{2001/04/30}{Added control to switch on/off marginpars}
158 % \changes{v2.5}{2001/10/22}{Added several booleans}
159 % \changes{v2.5}{2001/11/01}{Added diagram and design macros}
160 % \changes{v2.5a}{2002/01/06}{Fixed footheight in page diagrams}
161 % \changes{v2.6}{2002/06/09}{Added more bells to page layouts}
162 % \changes{v2.6}{2002/06/09}{General tidying of page layouts code}
163 % \changes{v2.6a}{2002/12/12}{Cater for negative length in list layout}
164 % \changes{v2.6b}{2003/11/25}{Corrected spelling and grammatical errors}
165 % \changes{v2.6c}{2004/10/25}{Privatised the \cs{*inch}, etc., macros}
166 % \begin{macrocode}
167 %<*lays>
168 \NeedsTeXFormat{LaTeX2e}
169 \ProvidesPackage{layouts}[2009/09/02 v2.6d graphical depiction of document elements]
170
171 % \end{macrocode}
172 %
173 % The \Lpack{layouts} package provides means of graphically displaying the layout
174 % of various logical elements of a document such as section headings,
175 % lists, floats, and others.
176 %
177 %
178 % \section{Counters and such}
179 %
180 % First we define some commands, counters, etc., that will be useful
181 % later on.
182 %
183 % \begin{macro}{\bs}
184 % We will be doing a lot of printing of \LaTeX{} commands, so we
185 % need a short command to print a backslash.
186 % \changes{v2.4}{2001/04/30}{Better definition for the \cs{bs} command}
187 % \begin{macrocode}
188 \@ifundefined{bs}{\newcommand{\bs}{\texttt{\char`\\}}}%
189 {\renewcommand{\bs}{\texttt{\char`\\}}}
190
191 % \end{macrocode}
192 % \end{macro}
193 %
194 % \begin{macro}{\l@yoneinch}
195 % \begin{macro}{\l@yeighthalfinch}
196 % \begin{macro}{\l@yteninch}
197 % \begin{macro}{\l@yeleveninch}
198 % \begin{macro}{\l@yonepoint}
199 % \changes{v2.3}{1999/01/21}{Made `useful values' commands not counters}
200 % Some generally useful values. |\l@yonepoint| is set to 65536 sp and all
201 % the others are set to a value in pts.
202 % \begin{macrocode}
203 \newcommand{\l@yoneinch}{72}
204 \newcommand{\l@yeighthalfinch}{615}
205 \newcommand{\l@yteninch}{723}
206 \newcommand{\l@yeleveninch}{795}
207 \newcommand{\l@yonepoint}{65536}
208 % \end{macrocode}
209 % \end{macro}
210 % \end{macro}
211 % \end{macro}
212 % \end{macro}
213 % \end{macro}
214 %
215 % \begin{macro}{\l@youtscale}
216 % Internal command that stores the drawing scale factor. Initialised
217 % to half scale.
218 % \begin{macrocode}
219 \newcommand{\l@youtscale}{0.5}
220
221 % \end{macrocode}
222 % \end{macro}
223 %
224 % \begin{macro}{\l@ylen}
225 % A length.
226 % \begin{macrocode}
227 \newlength{\l@ylen}
228 % \end{macrocode}
229 % \end{macro}
230 %
231 % \begin{macro}{\layoutsbox}
232 % A box for storing something. There seems to be no reason why the user
233 % should not be able to use this.
234 % \begin{macrocode}
235 \newsavebox{\layoutsbox}
236 % \end{macrocode}
237 % \end{macro}
238 %
239 % \begin{macro}{\l@youtunitlength}
240 % This will be used for setting the |\unitlength| for a \Lenv{picture}.
241 % \begin{macrocode}
242 \newlength{\l@youtunitlength}
243 % \end{macrocode}
244 % \end{macro}
245 %
246 % \begin{macro}{\l@youtlinethick}
247 % \begin{macro}{\l@youtlinethickii}
248 % These will be used as parameters to a |\linethickness| command.
249 % \begin{macrocode}
250 \newlength{\l@youtlinethick}
251 \newlength{\l@youtlinethickii}
252
253 % \end{macrocode}
254 % \end{macro}
255 % \end{macro}
256 %
257 % \begin{macro}{\l@ysetupparskip}%
258 % \begin{macro}{\l@ysetupbaselineskip}
259 % Used for storing the document's |\parskip| and |\baselineskip|.
260 % \begin{macrocode}
261 \newlength{\l@ysetupparskip}
262 \newlength{\l@ysetupbaselineskip}
263
264 % \end{macrocode}
265 % \end{macro}
266 % \end{macro}
267 %
268 % \begin{macro}{\l@yonem}
269 % \begin{macro}{\l@yonex}
270 % Used for storing the document's value for 1em and 1ex.
271 % \begin{macrocode}
272 \newlength{\l@yonem}
273 \newlength{\l@yonex}
274
275 % \end{macrocode}
276 % \end{macro}
277 % \end{macro}
278 %
279 % \begin{macro}{\l@ylmarg}
280 % \begin{macro}{\l@yrmarg}
281 % \begin{macro}{\l@yitmindent}
282 % \begin{macro}{\l@ylblwidth}
283 % \begin{macro}{\l@ylblsep}
284 % \begin{macro}{\l@ylparindent}
285 % \begin{macro}{\l@ytsep}
286 % \begin{macro}{\l@ypskip}
287 % \begin{macro}{\l@yptsep}
288 % \begin{macro}{\l@ypsep}
289 % \begin{macro}{\l@yitmsep}
290 % We need to store a list environment's values for use when tabulating
291 % the actual list values.
292 % \begin{macrocode}
293 \newlength{\l@ylmarg}
294 \newlength{\l@yrmarg}
295 \newlength{\l@yitmindent}
296 \newlength{\l@ylblwidth}
297 \newlength{\l@ylblsep}
298 \newlength{\l@ylparindent}
299 \newlength{\l@ytsep}
300 \newlength{\l@ypskip}
301 \newlength{\l@yptsep}
302 \newlength{\l@ypsep}
303 \newlength{\l@yitmsep}
304
305 % \end{macrocode}
306 % \end{macro}
307 % \end{macro}
308 % \end{macro}
309 % \end{macro}
310 % \end{macro}
311 % \end{macro}
312 % \end{macro}
313 % \end{macro}
314 % \end{macro}
315 % \end{macro}
316 % \end{macro}
317 %
318 % \begin{macro}{\l@ytok}
319 % A useful token
320 % \begin{macrocode}
321 \newtoks\l@ytok
322
323 % \end{macrocode}
324 % \end{macro}
325 %
326 % \begin{macro}{\l@youtpw}
327 % \begin{macro}{\l@youtph}
328 % We use these for storing the page width and height.
329 % \begin{macrocode}
330 \newcount\l@youtpw
331 \newcount\l@youtph
332
333 % \end{macrocode}
334 % \end{macro}
335 % \end{macro}
336 %
337 % \begin{macro}{\l@youthpi}
338 % \begin{macro}{\l@youthpii}
339 % \begin{macro}{\l@youthpiii}
340 % \begin{macro}{\l@youthpiv}
341 % \begin{macro}{\l@youthpv}
342 % \begin{macro}{\l@youthpvi}
343 % \begin{macro}{\l@youthpvii}
344 % Counters for horizontal drawing parameters.
345 %
346 % \begin{macrocode}
347 \newcount\l@youthpi
348 \newcount\l@youthpii
349 \newcount\l@youthpiii
350 \newcount\l@youthpiv
351 \newcount\l@youthpv
352 \newcount\l@youthpvi
353 \newcount\l@youthpvii
354
355 % \end{macrocode}
356 % \end{macro}
357 % \end{macro}
358 % \end{macro}
359 % \end{macro}
360 % \end{macro}
361 % \end{macro}
362 % \end{macro}
363 %
364 % \begin{macro}{\l@youtparskip}
365 % \begin{macro}{\l@youtvpi}
366 % \begin{macro}{\l@youtvpii}
367 % \begin{macro}{\l@youtvpiii}
368 % \begin{macro}{\l@youtvpiv}
369 % \begin{macro}{\l@youtvpv}
370 % \begin{macro}{\l@youtvpvi}
371 % \begin{macro}{\l@youtvpvii}
372 % Counters for vertical drawing parameters.
373 %
374 % \begin{macrocode}
375 \newcount\l@youtparskip
376 \newcount\l@youtvpi
377 \newcount\l@youtvpii
378 \newcount\l@youtvpiii
379 \newcount\l@youtvpiv
380 \newcount\l@youtvpv
381 \newcount\l@youtvpvi
382 \newcount\l@youtvpvii
383
384 % \end{macrocode}
385 % \end{macro}
386 % \end{macro}
387 % \end{macro}
388 % \end{macro}
389 % \end{macro}
390 % \end{macro}
391 % \end{macro}
392 % \end{macro}
393 %
394 % \begin{macro}{\l@youthdo}
395 % \begin{macro}{\l@youthdi}
396 % \begin{macro}{\l@youthdii}
397 % \begin{macro}{\l@youthdiii}
398 % \begin{macro}{\l@youthdiv}
399 % \begin{macro}{\l@youthdv}
400 % \begin{macro}{\l@youthdvi}
401 % \begin{macro}{\l@youthdvii}
402 % Horizontal dimensions.
403 %
404 % \begin{macrocode}
405 \newcount\l@youthdo
406 \newcount\l@youthdi
407 \newcount\l@youthdii
408 \newcount\l@youthdiii
409 \newcount\l@youthdiv
410 \newcount\l@youthdv
411 \newcount\l@youthdvi
412 \newcount\l@youthdvii
413
414 % \end{macrocode}
415 % \end{macro}
416 % \end{macro}
417 % \end{macro}
418 % \end{macro}
419 % \end{macro}
420 % \end{macro}
421 % \end{macro}
422 % \end{macro}
423 %
424 % \begin{macro}{\l@youtvdo}
425 % \begin{macro}{\l@youtvdi}
426 % \begin{macro}{\l@youtvdii}
427 % \begin{macro}{\l@youtvdiii}
428 % \begin{macro}{\l@youtvdiv}
429 % \begin{macro}{\l@youtvdv}
430 % \begin{macro}{\l@youtvdvi}
431 % \begin{macro}{\l@youtvdvii}
432 % \begin{macro}{\l@youtvdviii}
433 % Vertical dimensions.
434 % \begin{macrocode}
435 \newcount\l@youtvdo
436 \newcount\l@youtvdi
437 \newcount\l@youtvdii
438 \newcount\l@youtvdiii
439 \newcount\l@youtvdiv
440 \newcount\l@youtvdv
441 \newcount\l@youtvdvi
442 \newcount\l@youtvdvii
443 \newcount\l@youtvdviii
444
445 % \end{macrocode}
446 % \end{macro}
447 % \end{macro}
448 % \end{macro}
449 % \end{macro}
450 % \end{macro}
451 % \end{macro}
452 % \end{macro}
453 % \end{macro}
454 % \end{macro}
455 %
456 % \begin{macro}{\l@youtxci}
457 % \begin{macro}{\l@youtxcii}
458 % \begin{macro}{\l@youtxciii}
459 % \begin{macro}{\l@youtxciv}
460 % \begin{macro}{\l@youtxcv}
461 % \begin{macro}{\l@youtxcvi}
462 % X coordinates.
463 % \begin{macrocode}
464 \newcount\l@youtxci
465 \newcount\l@youtxcii
466 \newcount\l@youtxciii
467 \newcount\l@youtxciv
468 \newcount\l@youtxcv
469 \newcount\l@youtxcvi
470
471 % \end{macrocode}
472 % \end{macro}
473 % \end{macro}
474 % \end{macro}
475 % \end{macro}
476 % \end{macro}
477 % \end{macro}
478 %
479 % \begin{macro}{\l@youtyci}
480 % \begin{macro}{\l@youtycii}
481 % \begin{macro}{\l@youtyciii}
482 % \begin{macro}{\l@youtyciv}
483 % \begin{macro}{\l@youtycv}
484 % \begin{macro}{\l@youtycvi}
485 % \begin{macro}{\l@youtycvii}
486 % \begin{macro}{\l@youtycviii}
487 % Y coordinates.
488 % \begin{macrocode}
489 \newcount\l@youtyci
490 \newcount\l@youtycii
491 \newcount\l@youtyciii
492 \newcount\l@youtyciv
493 \newcount\l@youtycv
494 \newcount\l@youtycvi
495 \newcount\l@youtycvii
496 \newcount\l@youtycviii
497
498 % \end{macrocode}
499 % \end{macro}
500 % \end{macro}
501 % \end{macro}
502 % \end{macro}
503 % \end{macro}
504 % \end{macro}
505 % \end{macro}
506 % \end{macro}
507 %
508 % \begin{macro}{\l@youtxco}
509 % \begin{macro}{\l@youtyco}
510 % For the (X,Y) coordinates of the bottom left hand corner of the page.
511 % \changes{v2.4}{2001/04/30}{Added \cs{l@youtxco} and \cs{l@youtyco}}
512 % \begin{macrocode}
513 \newcount\l@youtxco
514 \newcount\l@youtyco
515
516 % \end{macrocode}
517 % \end{macro}
518 % \end{macro}
519 %
520 % \section{Initialisations}
521 %
522 % The following are used to set up default conditions.
523 %
524 % \begin{macro}{\ifoddpagelayout}
525 % Set TRUE to draw an oddside page.
526 % \begin{macrocode}
527 \newif\ifoddpagelayout
528 \oddpagelayouttrue
529 % \end{macrocode}
530 % \end{macro}
531 %
532 % \begin{macro}{\iftwocolumnlayout}
533 % Set TRUE to draw a two column page.
534 % \begin{macrocode}
535 \newif\iftwocolumnlayout
536 \twocolumnlayoutfalse
537 % \end{macrocode}
538 % \end{macro}
539 %
540 % \begin{macro}{\ifdrawmarginpars}
541 % Set TRUE to draw marginpars on a page.
542 % \begin{macrocode}
543 \newif\ifdrawmarginpars
544 \drawmarginparstrue
545 % \end{macrocode}
546 % \end{macro}
547 %
548 % \begin{macro}{\ifdrawparameters}
549 % Set TRUE to draw a layout with marked dimension lines.
550 % \begin{macrocode}
551 \newif\ifdrawparameters
552 \drawparameterstrue
553 % \end{macrocode}
554 % \end{macro}
555 %
556 % \begin{macro}{\iflistaspara}
557 % Set TRUE to draw lists as stand-alone paragraph.
558 % \begin{macrocode}
559 \newif\iflistaspara
560 \listasparatrue
561 % \end{macrocode}
562 % \end{macro}
563 %
564 % \begin{macro}{\ifruninhead}
565 % Set TRUE to draw a run-in heading.
566 % \begin{macrocode}
567 \newif\ifruninhead
568 \runinheadfalse
569 % \end{macrocode}
570 % \end{macro}
571 %
572 % \begin{macro}{\ifprintparameters}
573 % Set TRUE to print table of actual parameter values
574 % \changes{v2.5}{2001/10/22}{Added \cs{ifprintparameters}}
575 % \begin{macrocode}
576 \newif\ifprintparameters
577 \printparameterstrue
578 % \end{macrocode}
579 % \end{macro}
580 %
581 % \begin{macro}{\ifdrawdimensions}
582 % Set TRUE to draw dimension lines
583 % \changes{v2.5}{2001/10/22}{Added \cs{ifdrawdimensions}}
584 % \begin{macrocode}
585 \newif\ifdrawdimensions
586 \drawdimensionsfalse
587 % \end{macrocode}
588 % \end{macro}
589 %
590 % \begin{macro}{\ifprintheadings}
591 % Set TRUE to print text about dashed lines.
592 % \changes{v2.5}{2001/10/22}{Added \cs{ifprintheadings}}
593 % \begin{macrocode}
594 \newif\ifprintheadings
595 \printheadingstrue
596 % \end{macrocode}
597 % \end{macro}
598 %
599 % \begin{macro}{\ifl@ytempif}
600 % A scratch |\if|.
601 % \changes{v2.5}{2001/10/22}{Added \cs{ifl@ytempif}}
602 % \begin{macrocode}
603 \newif\ifl@ytempif
604 % \end{macrocode}
605 % \end{macro}
606 %
607 % \begin{macro}{\l@yor}
608 % |\l@yor{|\meta{ifA}|}{|\meta{ifB}|}| sets |\ifl@ytempif| to TRUE
609 % unless \meta{ifA} is FALSE and \meta{ifB} is FALSE (i.e.,
610 % |\ifl@tempif| = \meta{ifA} OR \meta{ifB}).
611 % \changes{v2.5}{2001/10/22}{Added \cs{l@yor}}
612 % \begin{macrocode}
613 \newcommand{\l@yor}[2]{%
614 \l@ytempiftrue
615 #1
616 \else
617 #2
618 \else
619 \l@ytempiffalse
620 \fi
621 \fi}
622 % \end{macrocode}
623 % \end{macro}
624 %
625 % \begin{macro}{\l@ynnand}
626 % |\l@ynnand{|\meta{ifA}|}{|\meta{ifB}|}| sets |\ifl@ytempif| to FALSE
627 % unless \meta{ifA} is FALSE and \meta{ifB} is TRUE
628 % \changes{v2.5}{2001/10/22}{Added \cs{l@ynnand}}
629 % \begin{macrocode}
630 \newcommand{\l@ynnand}[2]{%
631 \l@ytempiffalse
632 #1
633 \else
634 #2
635 \l@ytempiftrue
636 \fi
637 \fi}
638 % \end{macrocode}
639 % \end{macro}
640 %
641 % \begin{macro}{\l@ynox}
642 % |\l@ynox{|\meta{ifA}|}{|\meta{ifB}|}| sets |\ifl@ytempif| to TRUE
643 % unless \meta{ifA} is TRUE and \meta{ifB} is FALSE.
644 % \changes{v2.5}{2001/10/22}{Added \cs{l@ynox}}
645 % \begin{macrocode}
646 \newcommand{\l@ynox}[2]{%
647 \l@ytempiftrue
648 #1
649 #2
650 \else
651 \l@ytempiffalse
652 \fi
653 \fi}
654 % \end{macrocode}
655 % \end{macro}
656 %
657 % \begin{macro}{\testdrawdimensions}
658 % \begin{macro}{\testprintparameters}
659 % \changes{v2.5}{2001/10/21}{Added \cs{testdrawdimensions} and
660 % \cs{testprintparameters}}
661 % \changes{v2.5}{2001/10/21}{Use \cs{testdrawdimensions} for check to
662 % draw dimensions in actual layouts}
663 % \changes{v2.5}{2001/10/21}{Use \cs{testprintparameters} for check to
664 % list parameter values in actual layouts}
665 % \begin{macrocode}
666 \newcommand{\testdrawdimensions}{%
667 \l@yor{\ifdrawparameters}{\ifdrawdimensions}}
668 \newcommand{\testprintparameters}{%
669 \l@ynnand{\ifdrawparameters}{\ifprintparameters}}
670
671 % \end{macrocode}
672 % \end{macro}
673 % \end{macro}
674 %
675 % \begin{macro}{\setlabelfont}
676 % \begin{macro}{\l@ylabelfont}
677 % The font for labels in the diagrams.
678 % \changes{v2.5}{2001/10/22}{Added \cs{setlabelfont} and \cs{l@ylabelfont}}
679 % \begin{macrocode}
680 \newcommand{\setlabelfont}[1]{\renewcommand{\l@ylabelfont}{#1}}
681 \newcommand{\l@ylabelfont}{\normalfont}
682 % \end{macrocode}
683 % \end{macro}
684 % \end{macro}
685 %
686 % \begin{macro}{\setparametertextfont}
687 % \begin{macro}{\l@yparamfont}
688 % The font size for parameters.
689 % \changes{v2.5}{2001/10/22}{Added \cs{setparametertextfont} and \cs{l@yparamfont}}
690 % \begin{macrocode}
691 \newcommand{\setparametertextfont}[1]{\renewcommand{\l@yparamfont}{#1}}
692 \newcommand{\l@yparamfont}{\footnotesize}
693 % \end{macrocode}
694 % \end{macro}
695 % \end{macro}
696 %
697 % \begin{macro}{\setvaluestextsize}
698 % \begin{macro}{\l@yvalsize}
699 % The font size for value tables.
700 % \changes{v2.5}{2001/10/22}{Added \cs{setvaluestextsize} and \cs{l@yvalsize}}
701 % \begin{macrocode}
702 \newcommand{\setvaluestextsize}[1]{\renewcommand{\l@yvalsize}{#1}}
703 \newcommand{\l@yvalsize}{\normalsize}
704 % \end{macrocode}
705 % \end{macro}
706 % \end{macro}
707 %
708 %
709 % \begin{macro}{\setlayoutscale}
710 % A user command to set the drawing scale. The scale is initialised
711 % to half size.
712 % \changes{v2.5a}{2002/01/06}{Added warning to \cs{setlayoutscale}}
713 % \begin{macrocode}
714 \newcommand{\setlayoutscale}[1]{\setlength{\l@youtunitlength}{1pt}
715 \l@youtunitlength = #1\l@youtunitlength
716 \renewcommand{\l@youtscale}{#1}
717 \PackageWarning{layouts}{Layout scale set to #1}}
718 %%%\setlayoutscale{0.5}
719 % \end{macrocode}
720 % \end{macro}
721 %
722 % \begin{macro}{\setuplayouts}
723 % The |\setuplayouts| command should be called immediately at
724 % the |\begin{document}|. It must be called before any command that
725 % changes font sizes or makes any change to the document layout.
726 % It stores relevant skips.
727 % \begin{macrocode}
728 \newcommand{\setuplayouts}{%
729 \setlength{\l@ysetupparskip}{\parskip}
730 \setlength{\l@ysetupbaselineskip}{\baselineskip}
731 \setlength{\l@yonem}{1em}
732 \setlength{\l@yonex}{1ex}
733 \setlayoutscale{0.5}
734 %%% \PackageWarning{layouts}{Layout scale set to 0.5}
735 }
736 \AtBeginDocument{\setuplayouts}
737 % \end{macrocode}
738 % \end{macro}
739 %
740 % \section{Utility commands}
741 %
742 % A variety of utility commands.
743 %
744 % \begin{macro}{\l@yltoc}
745 % |\l@yltoc{|\meta{length}|}{|\meta{counter}|}| converts a length into a
746 % counter value. The counter value is to the nearest
747 % pt of the length.
748 % \begin{macrocode}
749 \newcommand{\l@yltoc}[2]{\setlength{\l@ylen}{#1}%
750 \ifdim\l@ylen > \z@ \advance\l@ylen by 0.5\p@ \else
751 \ifdim\l@ylen < \z@ \advance\l@ylen by -0.5\p@
752 \fi
753 \fi
754 #2=\l@ylen
755 \divide #2 by \l@yonepoint\relax}
756 % \end{macrocode}
757 % \end{macro}
758 %
759 % \begin{macro}{\l@yvuda}
760 % \begin{macro}{\l@yhrda}
761 % |\l@yvuda{|\meta{x}|}{|\meta{y}|}{|\meta{distance}|}| draws a line
762 % vertically upwards from (\meta{x},\meta{y}) a \meta{distance} with an
763 % outward pointing arrowhead at each end of the line. |\l@yhrda| is
764 % similar except that a horizontal line is drawn to the right. Simplistically,
765 % the commands produce something like |<---->|.
766 % \begin{macrocode}
767 \newcommand{\l@yvuda}[3]{\put(#1,#2){\vector(0,1){#3}}
768 \put(#1,#2){\vector(0,-1){0}}}
769 \newcommand{\l@yhrda}[3]{\put(#1,#2){\vector(1,0){#3}}
770 \put(#1,#2){\vector(-1,0){0}}}
771 % \end{macrocode}
772 % \end{macro}
773 % \end{macro}
774 %
775 % \begin{macro}{\l@yvudia}
776 % \begin{macro}{\l@yhrdia}
777 % |\l@yvudia{|\meta{x}|}{|\meta{y}|}{|\meta{distance}|}| draws two vertical
778 % arrowheads pointing to each other. One is at (\meta{x},\meta{y}) and
779 % the other is at (\meta{x},\meta{y + distance}). |\l@yhrdia| is
780 % similar except that the arrowheads are horizontal.
781 % Simplistically, the commands produce something like |> <|.
782 % \begin{macrocode}
783 \newcommand{\l@yvudia}[3]{\begingroup
784 \l@youthpvii=#1\relax
785 \l@youtvpvii=#2\relax
786 \l@youthdvii=#3\relax
787 \put(\l@youthpvii,\l@youtvpvii){\vector(0,1){0}}
788 \advance\l@youtvpvii by \l@youthdvii
789 \put(\l@youthpvii,\l@youtvpvii){\vector(0,-1){0}}
790 \endgroup}
791 \newcommand{\l@yhrdia}[3]{\begingroup
792 \l@youthpvii=#1\relax
793 \l@youtvpvii=#2\relax
794 \l@youthdvii=#3\relax
795 \put(\l@youthpvii,\l@youtvpvii){\vector(1,0){0}}
796 \advance\l@youthpvii by \l@youthdvii
797 \put(\l@youthpvii,\l@youtvpvii){\vector(-1,0){0}}
798 \endgroup}
799 % \end{macrocode}
800 % \end{macro}
801 % \end{macro}
802 %
803 % \begin{macro}{\l@ypcmd}
804 % \begin{macro}{\l@ycmd}
805 % |\l@ypcmd{|\meta{cmdname}|}| typesets a command \meta{cmdname} (which does
806 % not include the backslash) (in a picture). For example, |\l@ypcmd{fred}|
807 % prints |\fred|. The font size is given by |\l@yparamfont|. The
808 % |\l@ycmd| macro is similar but does not set the font size.
809 % \begin{macrocode}
810 \newcommand{\l@ypcmd}[1]{{\l@yparamfont\texttt{\bs #1}}}
811 \newcommand{\l@ycmd}[1]{\texttt{\bs #1}}
812
813 % \end{macrocode}
814 % \end{macro}
815 % \end{macro}
816 %
817 % \begin{macro}{\printinunitsof}
818 % \begin{macro}{\l@yunitperpt}
819 % \begin{macro}{\l@yunits}
820 % |\printinunitsof{|\meta{unit}|}| sets |\l@yunits| to the value of \meta{unit}
821 % and |\l@yunitperpt| to the number of \meta{unit} in 1pt.
822 % \changes{v2.5}{2001/10/21}{Added \cs{printinunitsof}, \cs{l@yunitperpt}
823 % and \cs{units}}
824 % \begin{macrocode}
825 \newcommand{\printinunitsof}[1]{%
826 \def\l@yunitperpt{1.0}\def\l@yunits{pt}%
827 \def\l@yta{#1}\def\l@ytb{pt}%
828 \ifx \l@yta\l@ytb
829 \def\l@yunitperpt{1.0}\def\l@yunits{pt}%
830 \else
831 \def\l@ytb{pc}%
832 \ifx \l@yta\l@ytb
833 \def\l@yunitperpt{0.083333}\def\l@yunits{pc}%
834 \else
835 \def\l@ytb{in}%
836 \ifx \l@yta\l@ytb
837 \def\l@yunitperpt{0.013837}\def\l@yunits{in}%
838 \else
839 \def\l@ytb{mm}%
840 \ifx \l@yta\l@ytb
841 \def\l@yunitperpt{0.351459}\def\l@yunits{mm}%
842 \else
843 \def\l@ytb{cm}%
844 \ifx \l@yta\l@ytb
845 \def\l@yunitperpt{0.0351459}\def\l@yunits{cm}%
846 \else
847 \def\l@ytb{bp}%
848 \ifx \l@yta\l@ytb
849 \def\l@yunitperpt{0.996264}\def\l@yunits{bp}%
850 \else
851 \def\l@ytb{dd}%
852 \ifx \l@yta\l@ytb
853 \def\l@yunitperpt{0.9345718}\def\l@yunits{dd}%
854 \else
855 \def\l@ytb{cc}%
856 \ifx \l@yta\l@ytb
857 \def\l@yunitperpt{0.0778809}\def\l@yunits{cc}%
858 \else
859 \def\l@ytb{PT}%
860 \ifx \l@yta\l@ytb
861 \def\l@yunitperpt{1.0}\def\l@yunits{PT}%
862 \fi
863 \fi
864 \fi
865 \fi
866 \fi
867 \fi
868 \fi
869 \fi
870 \fi
871 }
872 \printinunitsof{pt}
873
874 % \end{macrocode}
875 % \end{macro}
876 % \end{macro}
877 % \end{macro}
878 %
879 % \begin{macro}{\l@ytempdima}
880 % \begin{macro}{\prntlen}
881 % |\l@ytempdima| is a scratch length. |\prntlen{|\meta{length}|}|
882 % prints the value of \meta{length} in the units set by |\printinunitsof|.
883 % \changes{v2.5}{2001/10/21}{Added \cs{l@ytempdima} and \cs{prntlen}}
884 % \begin{macrocode}
885 \newlength{\l@ytempdima}
886 \newcommand{\prntlen}[1]{%
887 \def\l@yta{pt}\ifx\l@yta\l@yunits\the#1\else
888 \def\l@yta{PT}%
889 \l@ytempdima=\l@yunitperpt #1\relax\strip@pt\l@ytempdima
890 \ifx\l@yta\l@yunits pt\else\l@yunits\fi\fi}
891
892 % \end{macrocode}
893 % \end{macro}
894 % \end{macro}
895 %
896 % \begin{macro}{\l@yval}
897 % |\l@yval{|\meta{lcmd}|}| prints a value of the (length) command \meta{lcmd}
898 % (which includes the backslash); for example |\l@yval{\mylength}|.
899 % \changes{v2.5}{2001/10/21}{Changed the definition of \cs{l@yval}}
900 % \begin{macrocode}
901 %%% \newcommand{\l@yval}[1]{\the#1}
902 \newcommand{\l@yval}[1]{\prntlen{#1}}
903
904 % \end{macrocode}
905 % \end{macro}
906 %
907 % \section{Drawing the layout of a page}
908 %
909 % A variety of commands are used to draw the layout of a page.
910 %
911 % First some utility commands for setting the layout dimensions.
912 % \begin{macro}{\trypaperwidth}
913 % Sets the |paperwidth| and stores the result in |\l@youtpw|.
914 % \begin{macrocode}
915 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
916 %%%% PAGE LAYOUT
917 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
918 \newcommand{\trypaperwidth}[1]{\l@yltoc{#1}{\l@youtpw}}
919 % \end{macrocode}
920 % \end{macro}
921 %
922 % \begin{macro}{\trypaperheight}
923 % Sets the |paperheight| and stores the result in |\l@youtph|.
924 % \begin{macrocode}
925 \newcommand{\trypaperheight}[1]{\l@yltoc{#1}{\l@youtph}}
926 % \end{macrocode}
927 % \end{macro}
928 %
929 % \begin{macro}{\tryhoffset}
930 % Sets the |hoffset| and stores the result in |\l@youthpi|.
931 % \begin{macrocode}
932 \newcommand{\tryhoffset}[1]{\l@yltoc{#1}{\l@youthpi}}
933 % \end{macrocode}
934 % \end{macro}
935 %
936 % \begin{macro}{\tryvoffset}
937 % Sets the |voffset| and stores the result in |\l@youtvpi|.
938 % \begin{macrocode}
939 \newcommand{\tryvoffset}[1]{\l@yltoc{#1}{\l@youtvpi}}
940 % \end{macrocode}
941 % \end{macro}
942 %
943 % \begin{macro}{\trytopmargin}
944 % Sets the |topmargin| and stores the result in |\l@youtvpii|.
945 % \begin{macrocode}
946 \newcommand{\trytopmargin}[1]{\l@yltoc{#1}{\l@youtvpii}}
947 % \end{macrocode}
948 % \end{macro}
949 %
950 % \begin{macro}{\tryheadheight}
951 % Sets the |headheight| and stores the result in |\l@youtvpiii|.
952 % \begin{macrocode}
953 \newcommand{\tryheadheight}[1]{\l@yltoc{#1}{\l@youtvpiii}}
954 % \end{macrocode}
955 % \end{macro}
956 %
957 % \begin{macro}{\tryheadsep}
958 % Sets the |headsep| and stores the result in |\l@youtvpiv|.
959 % \begin{macrocode}
960 \newcommand{\tryheadsep}[1]{\l@yltoc{#1}{\l@youtvpiv}}
961 % \end{macrocode}
962 % \end{macro}
963 %
964 % \begin{macro}{\trytextheight}
965 % Sets the |textheight| and stores the result in |\l@youtvpv|.
966 % \begin{macrocode}
967 \newcommand{\trytextheight}[1]{\l@yltoc{#1}{\l@youtvpv}}
968 % \end{macrocode}
969 % \end{macro}
970 %
971 % \begin{macro}{\tryfootskip}
972 % Sets the |footskip| and stores the result in |\l@youtvpvi|.
973 % \begin{macrocode}
974 \newcommand{\tryfootskip}[1]{\l@yltoc{#1}{\l@youtvpvi}}
975 % \end{macrocode}
976 % \end{macro}
977 %
978 % \begin{macro}{\tryoddsidemargin}
979 % Sets the |oddsidemargin| and stores the result in |\l@youthpv|.
980 % \begin{macrocode}
981 \newcommand{\tryoddsidemargin}[1]{\l@yltoc{#1}{\l@youthpv}}
982 % \end{macrocode}
983 % \end{macro}
984 %
985 % \begin{macro}{\tryevensidemargin}
986 % Sets the |evensidemargin| and stores the result in |\l@youthpiv|.
987 % \begin{macrocode}
988 \newcommand{\tryevensidemargin}[1]{\l@yltoc{#1}{\l@youthpiv}}
989 % \end{macrocode}
990 % \end{macro}
991 %
992 % \begin{macro}{\trytextwidth}
993 % Sets the |textwidth| and stores the result in |\l@youthpii|.
994 % \begin{macrocode}
995 \newcommand{\trytextwidth}[1]{\l@yltoc{#1}{\l@youthpii}}
996 % \end{macrocode}
997 % \end{macro}
998 %
999 % \begin{macro}{\trymarginparsep}
1000 % Sets the |marginparsep| and stores the result in |\l@youthpvi|.
1001 % \begin{macrocode}
1002 \newcommand{\trymarginparsep}[1]{\l@yltoc{#1}{\l@youthpvi}}
1003 % \end{macrocode}
1004 % \end{macro}
1005 %
1006 % \begin{macro}{\trymarginparwidth}
1007 % Sets the |marginparwidth| and stores the result in |\l@youthpvii|.
1008 % \begin{macrocode}
1009 \newcommand{\trymarginparwidth}[1]{\l@yltoc{#1}{\l@youthpvii}}
1010 % \end{macrocode}
1011 % \end{macro}
1012 %
1013 % \begin{macro}{\trymarginparpush}
1014 % Sets the |marginparpush| and stores the result in |\l@youtvpvii|.
1015 % \begin{macrocode}
1016 \newcommand{\trymarginparpush}[1]{\l@yltoc{#1}{\l@youtvpvii}}
1017 % \end{macrocode}
1018 % \end{macro}
1019 %
1020 % \begin{macro}{\trycolumnsep}
1021 % Sets the |columnsep| and stores the result in |\l@youthpiii|.
1022 % \begin{macrocode}
1023 \newcommand{\trycolumnsep}[1]{\l@yltoc{#1}{\l@youthpiii}}
1024 % \end{macrocode}
1025 % \end{macro}
1026 %
1027 % \begin{macro}{\trycolumnseprule}
1028 % Sets the |columnseprule| and stores the result in |\l@youtlinethick|.
1029 % \begin{macrocode}
1030 \newcommand{\trycolumnseprule}[1]{\setlength{\l@youtlinethick}{#1}}
1031 % \end{macrocode}
1032 % \end{macro}
1033 %
1034 % \begin{macro}{\setfootbox}
1035 % Sets the height and depth of the footer box and stores the results
1036 % in |\l@youtvdv| and |\l@youtvdvi|.
1037 % \changes{v2.5a}{2002/03/05}{Added \cs{setfootbox}}
1038 % \begin{macrocode}
1039 \newcommand{\setfootbox}[2]{\l@yltoc{#1}{\l@youtvdv}\l@yltoc{#2}{\l@youtvdvi}}
1040 % \end{macrocode}
1041 % \end{macro}
1042 %
1043 % \begin{macro}{\ifreversemarginpar}
1044 % \begin{macro}{\ifmarginparswitch}
1045 % Flags for where marginpars should go.
1046 % \begin{macrocode}
1047 \newif\ifreversemarginpar
1048 \reversemarginparfalse
1049 \newif\ifmarginparswitch
1050 \marginparswitchtrue
1051
1052 % \end{macrocode}
1053 % \end{macro}
1054 % \end{macro}
1055 %
1056 % \begin{macro}{\ifl@yrightmpars}
1057 % Internal flag for marginpar location
1058 % \begin{macrocode}
1059 \newif\ifl@yrightmpars
1060 \l@yrightmparstrue
1061 % \end{macrocode}
1062 % \end{macro}
1063 %
1064 %
1065 % \begin{macro}{\currentpage}
1066 % This routine sets the layout page parameters to those specified
1067 % for the document, specifically as on the current page.
1068 % \changes{v2.5a}{2002/01/06}{Added footheight to \cs{currentpage}}
1069 % \changes{v2.6}{2002/06/09}{Added further settings in \cs{currentpage}}
1070 % \changes{v2.6}{2002/06/09}{Split \cs{currentpage} into two
1071 % (plus \cs{commonl@ypage}}
1072 % \begin{macrocode}
1073 \newcommand{\currentpage}{%
1074 \@ifundefined{paperwidth}{\trypaperwidth{8.5in}}%
1075 {\trypaperwidth{\paperwidth}}%
1076 \@ifundefined{paperheight}{\trypaperheight{11in}}%
1077 {\trypaperheight{\paperheight}}%
1078 \tryhoffset{\hoffset}% % typically 0pt
1079 \tryvoffset{\voffset}% % typically 0pt
1080 \tryoddsidemargin{\oddsidemargin}% % typically 21-63pt
1081 \tryevensidemargin{\evensidemargin}% % typically 39-82pt
1082 \trytopmargin{\topmargin}% % typically 27pt
1083 \commonl@ypage%
1084 }
1085 % \end{macrocode}
1086 % \end{macro}
1087 %
1088 %
1089 % \begin{macro}{\commonl@ypage}
1090 % This routine sets the layout page parameters common to both the
1091 % standard and memoir classes, to those specified
1092 % for the document, specifically as on the current page.
1093 % \changes{v2.6}{2002/06/09}{Added \cs{commonl@ypage}}
1094 % \begin{macrocode}
1095 \newcommand{\commonl@ypage}{%
1096 \trymarginparwidth{\marginparwidth}% % typically 68-107pt
1097 \trymarginparsep{\marginparsep}% % typically 10-11pt
1098 \trymarginparpush{\marginparpush}% % typically 5-7pt
1099 \tryheadheight{\headheight}% % typically 12pt
1100 \tryheadsep{\headsep}% % typically 25pt
1101 \tryfootskip{\footskip}% % typically 30pt
1102 \trytextheight{\textheight}% % typically 36-43 times baselineskip
1103 \trytextwidth{\textwidth}% % typically 345-390pt
1104 \trycolumnsep{\columnsep}% % typically 10pt
1105 \trycolumnseprule{\columnseprule}% % typically 0pt
1106 \setfootbox{\baselineskip}{0pt}% % footheight = 1 line
1107 \reversemarginparfalse % reversemargin
1108 \if@reversemargin \reversemarginpartrue \fi
1109 \marginparswitchfalse % mparswitch
1110 \if@mparswitch \marginparswitchtrue \fi
1111 \twocolumnlayoutfalse
1112 \if@twocolumn \twocolumnlayouttrue \fi
1113 \oddpagelayouttrue
1114 \if@twoside
1115 \ifodd\count\z@
1116 \else
1117 \oddpagelayoutfalse
1118 \fi
1119 \fi
1120 }
1121 % \end{macrocode}
1122 % \end{macro}
1123 %
1124 % \begin{macro}{\drawpage}
1125 % This routine draws a page layout.
1126 %
1127 % \begin{macrocode}
1128 \newcommand{\drawpage}{%
1129 % \end{macrocode}
1130 % First set some default vertical and horizontal dimension values.
1131 % \begin{macrocode}
1132 \l@youtvdiii=\l@yteninch\relax
1133 \divide\l@youtvdiii by 24\relax
1134 \l@youthdii=\l@youtvdiii
1135 \ifdrawparameters
1136 % \end{macrocode}
1137 % When |drawparameters| is TRUE, we draw a generic layout showing the
1138 % controlling layout variables.
1139 % \changes{v2.5a}{2002/01/06}{Added default footheight in \cs{drawpage}}
1140 %
1141 % \begin{macrocode}
1142 \l@youtph=\l@yeleveninch\relax % page height
1143 \l@youtpw=\l@yeighthalfinch\relax % page width
1144 \l@youtvpi=\z@ % voffset
1145 \l@youtvpii=\l@youtvdiii % topmargin
1146 \l@youtvpiii=\l@youtvdiii % headheight
1147 \l@youtvpiv=\l@youtvdiii % headsep
1148 \l@youtvpv=\l@yoneinch\relax % textheight
1149 \multiply\l@youtvpv by 6\relax
1150 \l@youtvpvi=\l@youtvdiii % footskip
1151 \multiply\l@youtvpvi by \tw@
1152 \l@youtvdv=\l@youtvdiii % default footboxheight
1153 \l@youtvdvi=\z@ % default footboxdepth
1154 \l@youtvpvii=\l@youtvdiii % marginparpush
1155 \l@youthpi=\z@ % hoffset
1156 \l@youthpii=\l@youthdii % textwidth
1157 \multiply\l@youthpii by 13\relax
1158 \l@youthpiii=\l@youthdii % columnsep
1159 \l@youthpiv=\l@youthdii % evensidemargin
1160 \l@youthpv=\l@youthdii % oddsidemargin
1161 \l@youthpvi=\l@youthdii % marginparsep
1162 \l@youthpvii=\l@youthdii % marginparwidth
1163 \multiply\l@youthpvii by \tw@
1164 \fi
1165 % \end{macrocode}
1166 % Calculate coordinates for use in the drawing.
1167 % \begin{macrocode}
1168 \l@youtycvi=\l@youtph % one inch below top of page
1169 \advance\l@youtycvi by -\l@yoneinch\relax
1170 \l@youtxci=\l@youthpi % hofref
1171 \advance\l@youtxci by \l@yoneinch\relax
1172 \l@youtycv=\l@youtycvi % vofref
1173 \advance\l@youtycv by -\l@youtvpi
1174 \l@youtyciv=\l@youtycv % headref
1175 \advance\l@youtyciv by -\l@youtvpii
1176 \advance\l@youtyciv by -\l@youtvpiii
1177 \l@youtycii=\l@youtyciv % bodyref
1178 \advance\l@youtycii by -\l@youtvpiv
1179 \advance\l@youtycii by -\l@youtvpv
1180 \ifnum\l@youtvdv>\l@youtvpvi
1181 \PackageWarning{layouts}{The footbox is higher than the footskip}
1182 \l@youtvdv=\l@youtvpvi
1183 \fi
1184 \l@youtyci=\l@youtycii % footref
1185 \advance\l@youtyci by -\l@youtvpvi
1186 \advance\l@youtyci by -\l@youtvdvi % box depth
1187 \l@youtvdvii=\l@youtvdv % box height
1188 \advance\l@youtvdvii by \l@youtvdvi % plus depth
1189 \l@youtvdii=\l@youtvpv % noteheight
1190 \divide\l@youtvdii by 4\relax
1191 \l@youtyciii=\l@youtycii % noteref
1192 \advance\l@youtyciii by \l@youtvdii
1193 \advance\l@youtyciii by \l@youtvpvii
1194 \l@youtxcii=\l@youtxci % marginref
1195 \ifoddpagelayout
1196 % \end{macrocode}
1197 % Some values are different on odd and even pages
1198 % \begin{macrocode}
1199 \advance\l@youtxcii by \l@youthpv
1200 \else
1201 \advance\l@youtxcii by \l@youthpiv
1202 \fi
1203 \l@youtxciv=\l@youtxcii % margnoteref
1204 % \end{macrocode}
1205 % The next part of the code was supplied by Frank Mittelbach\footnote{Email
1206 % dated 2002/05/18.}
1207 % to add facilities for reversed marginpars. Now find where the marginpars
1208 % go. |\@tempcnta| = (1 --- right, -1 --- left) corresponds to the
1209 % treatment in the kernel.
1210 % \begin{macrocode}
1211 \@tempcnta\@ne
1212 \ifmarginparswitch
1213 \ifoddpagelayout \else \@tempcnta\m@ne \fi
1214 \fi
1215 \ifreversemarginpar \@tempcnta -\@tempcnta \fi
1216 % \end{macrocode}
1217 % Change layout values to suit.
1218 % \begin{macrocode}
1219 \ifnum\@tempcnta > \z@
1220 \l@yrightmparstrue
1221 \advance\l@youtxciv by \l@youthpii
1222 \advance\l@youtxciv by \l@youthpvi
1223 \else
1224 \l@yrightmparsfalse
1225 \advance\l@youtxciv by -\l@youthpvi
1226 \advance\l@youtxciv by -\l@youthpvii
1227 \fi
1228 % \end{macrocode}
1229 % Back to my code. Do column dependent values.
1230 % \begin{macrocode}
1231 \l@youthdi=\l@youthpii % columnwidth
1232 \l@youtxciii=\l@youtxcii % colref
1233 \iftwocolumnlayout
1234 \advance\l@youthdi by -\l@youthpiii
1235 \divide\l@youthdi by \tw@
1236 \advance\l@youtxciii by \l@youthdi
1237 \advance\l@youtxciii by \l@youthpiii
1238 \l@youtxcv=\l@youthpiii % centre of gutter
1239 \divide\l@youtxcv by \tw@
1240 \advance\l@youtxcv by \l@youtxcii
1241 \advance\l@youtxcv by \l@youthdi
1242 \fi
1243 % \end{macrocode}
1244 %
1245 % Print the caption for the top of the drawing.
1246 % \changes{v2.5}{2001/10/21}{Don't always print dashed text}
1247 % \begin{macrocode}
1248 \l@yor{\ifdrawparameters}{\ifprintheadings}
1249 \begin{center}
1250 \ifl@ytempif
1251 \begin{small} The circle is at 1 inch from the top and left of the
1252 page. Dashed lines represent (\texttt{\bs hoffset + 1 inch}) and
1253 (\texttt{\bs voffset + 1 inch}) from the top and left of the
1254 page.
1255 \end{small} \\
1256 \medskip
1257 \fi
1258 % \end{macrocode}
1259 %
1260 % Draw the picture!
1261 %
1262 % \begin{macrocode}
1263 \setlength{\unitlength}{\l@youtunitlength}
1264 \begin{picture}(\l@youtpw,\l@youtph)
1265 \thicklines
1266 % \end{macrocode}
1267 % Either reference lines for the page top and side, or the page.
1268 % \begin{macrocode}
1269 \ifdrawparameters
1270 \put(0,0){\line(0,1){\l@youtph}}
1271 \put(0,\l@youtph){\line(1,0){\l@youtpw}}
1272 \else
1273 \put(0,0){\framebox(\l@youtpw,\l@youtph){}}
1274 \fi
1275 % \end{macrocode}
1276 % Draw the offset lines and a circle 1 inch from the top LH corner
1277 % of the page.
1278 % \begin{macrocode}
1279 \put(\l@yoneinch,\l@youtycvi){\circle{12}}
1280 \put(0,\l@youtycv){\dashbox{10}(\l@youtpw,0){}}
1281 \put(\l@youtxci,0){\dashbox{10}(0,\l@youtph){}}
1282 % \end{macrocode}
1283 % Draw the header. |put(marginref,headref){framebox(textwidth,headheight)}|
1284 % \begin{macrocode}
1285 \put(\l@youtxcii,\l@youtyciv){\framebox(\l@youthpii,\l@youtvpiii)%
1286 {\l@ylabelfont Header}}
1287 % \end{macrocode}
1288 % Draw the body.
1289 % \begin{macrocode}
1290 \iftwocolumnlayout
1291 % \end{macrocode}
1292 % |put(marginref,bodyref){framebox(columnwidth,textheight)}| and \\
1293 % |put(colref,bodyref){framebox(columnwidth,textheight)}|.
1294 % \begin{macrocode}
1295 \put(\l@youtxcii,\l@youtycii){\framebox(\l@youthdi,\l@youtvpv)%
1296 {\l@ylabelfont Col. 1}}
1297 \put(\l@youtxciii,\l@youtycii){\framebox(\l@youthdi,\l@youtvpv)%
1298 {\l@ylabelfont Col. 2}}
1299 \linethickness{\l@youtscale\l@youtlinethick}
1300 \put(\l@youtxcv,\l@youtycii){\line(0,1){\l@youtvpv}}
1301 \thicklines
1302 \else
1303 % \end{macrocode}
1304 % |put(marginref,bodyref){framebox(textwidth,textheight)}|.
1305 % \begin{macrocode}
1306 \put(\l@youtxcii,\l@youtycii){\framebox(\l@youthpii,\l@youtvpv)%
1307 {\l@ylabelfont Body}}
1308 \fi
1309 % \end{macrocode}
1310 % Draw the footer. |put(marginref,footref){framebox(textwidth,footheight)}|
1311 % Draw this as an open box as there is no defined height for this.
1312 % \changes{v2.5a}{2002/01/06}{Footer drawn as open box on page diagram}
1313 % \begin{macrocode}
1314 \put(\l@youtxcii,\l@youtyci){\framebox(\l@youthpii,\l@youtvdvii)%
1315 {\l@ylabelfont Footer}}
1316 % \end{macrocode}
1317 % Marginal notes (two examples), if asked for. \\
1318 % |put(margnoteref,bodyref){framebox(marginparwidth,noteheight)}| and \\
1319 % |put(margnoteref,noteref){framebox(marginparwidth,noteheight)}|.
1320 % \changes{v2.4}{2001/04/30}{Added checks for drawing marginpars to \cs{drawpage}}
1321 % \begin{macrocode}
1322 \ifdrawmarginpars
1323 \ifdrawparameters
1324 \put(\l@youtxciv,\l@youtycii){\framebox(\l@youthpvii,\l@youtvdii){}}
1325 \put(\l@youtxciv,\l@youtyciii){\framebox(\l@youthpvii,\l@youtvdii)%
1326 {\l@ylabelfont\shortstack{Margin\\Note}}}
1327 \else
1328 \put(\l@youtxciv,\l@youtycii){\framebox(\l@youthpvii,\l@youtvdii)%
1329 {\l@ylabelfont Note}}
1330 \put(\l@youtxciv,\l@youtyciii){\framebox(\l@youthpvii,\l@youtvdii)%
1331 {\l@ylabelfont Margin}}
1332 \fi
1333 \fi
1334 % \end{macrocode}
1335 % If the footbox has a depth, draw a dashed line to mark the footskip.
1336 % \begin{macrocode}
1337 \ifnum\l@youtvdvi > \z@
1338 \thinlines
1339 \advance\l@youtyci by \l@youtvdvi
1340 \put(\l@youtxcii,\l@youtyci){\dashbox{10}(\l@youthpii,0){}}
1341 \fi
1342 % \end{macrocode}
1343 % We now draw labelled vectors indicating the layout parameters.
1344 % Life gets tedious as we have to calculate a few more coordinate and
1345 % length values. The code below is fairly incomprehensible as we are
1346 % trying to minimise the number of counters.
1347 % \changes{v2.5}{2001/10/21}{Changed test for drawing dimensions}
1348 % \begin{macrocode}
1349 \testdrawdimensions
1350 \ifl@ytempif
1351 \thinlines
1352 % \end{macrocode}
1353 % Calculate more coordinates
1354 % \begin{macrocode}
1355 \l@youtxcv=\l@youtxcii % X coord for vertical dimensions
1356 \advance\l@youtxcv by \l@youthdii
1357 \l@youtxcvi=\l@youthpvii % X coord for marginparpush
1358 \divide\l@youtxcvi by \tw@
1359 \advance\l@youtxcvi by \l@youtxciv
1360 \l@youtvdviii=\l@youtvdiii % half l@youtvdiii
1361 \divide\l@youtvdviii by \tw@
1362 \l@youtycvii=\l@youtycii % Y coord for low dimensions
1363 \advance\l@youtycvii by \l@youtvdiii
1364 \l@youtycviii=\l@youtycvii % Y coord for mid dimensions
1365 \advance\l@youtycviii by \l@youtvdiii
1366 \l@youtvdi=\l@youtvpv % Y coord for top dimensions
1367 \multiply\l@youtvdi by \tw@
1368 \divide\l@youtvdi by 3\relax
1369 \advance\l@youtvdi by \l@youtycii
1370 % \end{macrocode}
1371 % Draw the vertical dimensional parameters.
1372 %
1373 % Topmargin. |put(x,voffset){vector(0,-1){topmargin}}|
1374 % \begin{macrocode}
1375 \put(\l@youtxcv,\l@youtycv){\vector(0,-1){\l@youtvpii}}
1376 \put(\l@youtxcv,\l@youtycv){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
1377 \put(\l@youtvdviii,-\l@youtvdviii){\l@ypcmd{topmargin}}
1378 \end{picture}}
1379 % \end{macrocode}
1380 % Headheight. |put(x,voffset-topmargin){vector(0,-1){headheight}}|
1381 % \begin{macrocode}
1382 \put(\l@youtxcv,\l@youtyciv){\line(0,1){\l@youtvpiii}}
1383 \put(\l@youtxcv,\l@youtyciv){\vector(0,-1){0}}
1384 \put(\l@youtxcv,\l@youtyciv){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
1385 \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{headheight}}
1386 \end{picture}}
1387 % \end{macrocode}
1388 % Headsep. |put(x,headref){vector(0,-1){headsep}}|
1389 % \begin{macrocode}
1390 \put(\l@youtxcv,\l@youtyciv){\vector(0,-1){\l@youtvpiv}}
1391 \put(\l@youtxcv,\l@youtyciv){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
1392 \put(\l@youtvdviii,-\l@youtvdviii){\l@ypcmd{headsep}}
1393 \end{picture}}
1394 % \end{macrocode}
1395 % Textheight. |put(x,top_of_text){vector(0,-1){textheight}}|
1396 % \begin{macrocode}
1397 \put(\l@youtxcv,\l@youtycii){\line(0,1){\l@youtvpv}}
1398 \put(\l@youtxcv,\l@youtycii){\vector(0,-1){0}}
1399 \put(\l@youtxcv,\l@youtycii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
1400 \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{textheight}}
1401 \end{picture}}
1402 % \end{macrocode}
1403 % Footskip. |put(x,bodyref){vector(0,-1){footskip}}|
1404 % \begin{macrocode}
1405 \put(\l@youtxcv,\l@youtycii){\vector(0,-1){\l@youtvpvi}}
1406 \put(\l@youtxcv,\l@youtycii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
1407 \put(\l@youtvdviii,-\l@youtvdviii){\l@ypcmd{footskip}}
1408 \end{picture}}
1409 % \end{macrocode}
1410 % Marginparpush. |put(X,noteref){vector(0,-1){marginparpush}}| where \\
1411 % |X = margnoteref + 1/2 notewidth|.
1412 % \begin{macrocode}
1413 \ifdrawmarginpars
1414 \put(\l@youtxcvi,\l@youtyciii){\vector(0,-1){\l@youtvpvii}}
1415 \put(\l@youtxcvi,\l@youtyciii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
1416 \put(\l@youtvdviii,-\l@youtvdviii){\l@ypcmd{marginparpush}}
1417 \end{picture}}
1418 \fi
1419 % \end{macrocode}
1420 %
1421 % Now for all the horizontal dimensions.
1422 %
1423 % Marginparwidth. |put(margnoteref,low){vector(1,0){marginparwidth}|
1424 % \begin{macrocode}
1425 \ifdrawmarginpars
1426 \put(\l@youtxciv,\l@youtycvii){\vector(1,0){\l@youthpvii}}
1427 \put(\l@youtxciv,\l@youtycvii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
1428 \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{marginparwidth}}
1429 \end{picture}}
1430 \fi
1431 % \end{macrocode}
1432 % Different placements for marginwidth depending on the oddness of the page. \\
1433 % Odd page --- |put(hoffref,mid){\vector(1,0){oddsidemargin}| \\
1434 % Even page --- |put(hoffref,mid){\vector(1,0){evensidemargin}|.
1435 % \begin{macrocode}
1436 \ifoddpagelayout
1437 \put(\l@youtxci,\l@youtvdi){\vector(1,0){\l@youthpv}}
1438 \else
1439 \put(\l@youtxci,\l@youtvdi){\vector(1,0){\l@youthpiv}}
1440 \fi
1441 \put(\l@youtxci,\l@youtvdi){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
1442 \ifoddpagelayout
1443 \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{oddsidemargin}}
1444 \else
1445 \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{evensidemargin}}
1446 \fi
1447 \end{picture}}
1448 % \end{macrocode}
1449 % Different placements for marginparsep, depending on the particular margin. \\
1450 % Right margin --- |put(margnoteref-marginparsep,mid){vector(1,0){marginparsep}| \\
1451 % Left margin --- |put(marginref,top){vector(-1,0){marginparsep}|
1452 % \begin{macrocode}
1453 \ifdrawmarginpars
1454 \ifl@yrightmpars
1455 \put(\l@youtxciv,\l@youtycviii){\line(-1,0){\l@youthpvi}}
1456 \put(\l@youtxciv,\l@youtycviii){\vector(1,0){0}}
1457 \put(\l@youtxciv,\l@youtycviii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
1458 \put(-\l@youtvdviii,\l@youtvdviii){\l@ypcmd{marginparsep}}
1459 \end{picture}}
1460 \else
1461 \put(\l@youtxcii,\l@youtycviii){\vector(-1,0){\l@youthpvi}}
1462 \put(\l@youtxcii,\l@youtycviii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
1463 \put(-\l@youtvdviii,\l@youtvdviii){\l@ypcmd{marginparsep}}
1464 \end{picture}}
1465 \fi
1466 \fi
1467 % \end{macrocode}
1468 % Textwidth. |put(marginref,noteref){vector(1,0){textwidth}}|
1469 % \begin{macrocode}
1470 \put(\l@youtxcii,\l@youtyciii){\vector(1,0){\l@youthpii}}
1471 \put(\l@youtxcv,\l@youtyciii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
1472 \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{textwidth}}
1473 \end{picture}}
1474 % \end{macrocode}
1475 % Columnsep. |put(colref-colsep,mid){vector(1,0){colsep}}|
1476 % \begin{macrocode}
1477 \iftwocolumnlayout
1478 \put(\l@youtxciii,\l@youtvdi){\line(-1,0){\l@youthpiii}}
1479 \put(\l@youtxciii,\l@youtvdi){\vector(1,0){0}}
1480 \put(\l@youtxciii,\l@youtvdi){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
1481 \put(-\l@youtvdviii,\l@youtvdviii){\l@ypcmd{columnsep}}
1482 \end{picture}}
1483 \fi
1484 % \end{macrocode}
1485 % Have finished drawing the parameters.
1486 % \begin{macrocode}
1487 \fi
1488 \end{picture}
1489 \end{center}
1490 \setlength{\unitlength}{1pt}
1491 % \end{macrocode}
1492 % Print the actual parameter values.
1493 % \changes{v2.5}{2001/10/21}{Changed test for printing the value table}
1494 % \begin{macrocode}
1495 \testprintparameters
1496 \ifl@ytempif
1497 \begin{center}
1498 \begin{footnotesize}
1499 Lengths are to the nearest pt. \\
1500 \begin{ttfamily}
1501 \begin{tabular}{l@{\hspace{20pt}}l}
1502 \textrm{page height} = \number\l@youtph pt &
1503 \textrm{page width} = \number\l@youtpw pt \\
1504 \l@ycmd{hoffset} = \number\l@youthpi pt &
1505 \l@ycmd{voffset} = \number\l@youtvpi pt \\
1506 \ifoddpagelayout
1507 \l@ycmd{oddsidemargin} = \number\l@youthpv pt
1508 \else
1509 \l@ycmd{evensidemargin} = \number\l@youthpiv pt
1510 \fi
1511 & \l@ycmd{topmargin} = \number\l@youtvpii pt \\
1512 \l@ycmd{headheight} = \number\l@youtvpiii pt &
1513 \l@ycmd{headsep} = \number\l@youtvpiv pt \\
1514 \l@ycmd{textheight} = \number\l@youtvpv pt &
1515 \l@ycmd{textwidth} = \number\l@youthpii pt \\
1516 \l@ycmd{footskip} = \number\l@youtvpvi pt &
1517 \l@ycmd{marginparsep} = \number\l@youthpvi pt \\
1518 \l@ycmd{marginparpush} = \number\l@youtvpvii pt &
1519 \l@ycmd{columnsep} = \number\l@youthpiii pt \\
1520 \l@ycmd{columnseprule} = \the\l@youtlinethick & \\
1521 \end{tabular}
1522 \end{ttfamily}\end{footnotesize}
1523 \end{center}
1524 \fi
1525 % \end{macrocode}
1526 % The end of the definition for |\drawpage|.
1527 % \begin{macrocode}
1528 }
1529
1530 % \end{macrocode}
1531 % \end{macro}
1532 %
1533 % \begin{macro}{\pagediagram}
1534 % \begin{macro}{\pagedesign}
1535 % Shorthands.
1536 % \begin{macrocode}
1537 \newcommand{\pagediagram}{\drawparameterstrue\drawpage}
1538 \newcommand{\pagedesign}{\drawparametersfalse\drawpage}
1539
1540 % \end{macrocode}
1541 % \end{macro}
1542 % \end{macro}
1543 %
1544 % \begin{macro}{\pagevalues}
1545 % This macro produces a table of the current page layout actual values.
1546 % \begin{macrocode}
1547 \newcommand{\pagevalues}{%
1548 %% \begin{center}
1549 \ifprintheadings
1550 Actual page layout values.\\[\baselineskip]
1551 \fi
1552 \begingroup\l@yvalsize
1553 \begin{tabular}{l@{\hspace{20pt}}l}
1554 \l@ycmd{paperheight} = \@ifundefined{paperheight}{??}{\l@yval{\paperheight}} &
1555 \l@ycmd{paperwidth} = \@ifundefined{paperwidth}{??}{\l@yval{\paperwidth}} \\
1556 \l@ycmd{hoffset} = \l@yval{\hoffset} &
1557 \l@ycmd{voffset} = \l@yval{\voffset} \\
1558 \l@ycmd{evensidemargin} = \l@yval{\evensidemargin} &
1559 \l@ycmd{oddsidemargin} = \l@yval{\oddsidemargin} \\
1560 \l@ycmd{topmargin} = \l@yval{\topmargin} &
1561 \l@ycmd{headheight} = \l@yval{\headheight} \\
1562 \l@ycmd{headsep} = \l@yval{\headsep} &
1563 \l@ycmd{textheight} = \l@yval{\textheight} \\
1564 \l@ycmd{textwidth} = \l@yval{\textwidth} &
1565 \l@ycmd{footskip} = \l@yval{\footskip} \\
1566 \l@ycmd{marginparsep} = \l@yval{\marginparsep} &
1567 \l@ycmd{marginparpush} = \l@yval{\marginparpush} \\
1568 \l@ycmd{columnsep} = \l@yval{\columnsep} &
1569 \l@ycmd{columnseprule} = \l@yval{\columnseprule} \\
1570 1em = \l@yval{\l@yonem} & 1ex = \l@yval{\l@yonex} \\
1571 \end{tabular}
1572 \endgroup
1573 %% \end{center}
1574 }
1575
1576 % \end{macrocode}
1577 % \end{macro}
1578 %
1579 % \section{Drawing the layout of a memoir page}
1580 %
1581 % A variety of commands are used to draw the layout of a page
1582 % as defined in the memoir class. We can reuse quite a lot from
1583 % the previous page layout code.
1584 %
1585 % \begin{macrocode}
1586
1587 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1588 %%%% STOCK LAYOUT
1589 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1590
1591 % \end{macrocode}
1592 %
1593 % \begin{macro}{\stockwidth}
1594 % \begin{macro}{\stockwidth}
1595 % \begin{macro}{\trimedge}
1596 % \begin{macro}{\trimtop}
1597 % \begin{macro}{\uppermargin}
1598 % \begin{macro}{\spinemargin}
1599 % The memoir class has some page layout parameters that are not
1600 % in the standard classes. Provide these so the package will at
1601 % least compile with the standard classes but is highly likely to
1602 % die at runtime if this part of the code is used in other than
1603 % the memoir class.
1604 % \begin{macrocode}
1605 \@ifundefined{stockwidth}{\newlength{\stockwidth}}{}
1606 \@ifundefined{stockheight}{\newlength{\stockheight}}{}
1607 \@ifundefined{trimedge}{\newlength{\trimedge}}{}
1608 \@ifundefined{trimtop}{\newlength{\trimtop}}{}
1609 \@ifundefined{uppermargin}{\newlength{\uppermargin}}{}
1610 \@ifundefined{spinemargin}{\newlength{\spinemargin}}{}
1611
1612 % \end{macrocode}
1613 % \end{macro}
1614 % \end{macro}
1615 % \end{macro}
1616 % \end{macro}
1617 % \end{macro}
1618 % \end{macro}
1619 %
1620 % Now some utility commands for setting the layout dimensions.
1621 % \begin{macro}{\trystockwidth}
1622 % Sets the |stockwidth| and stores the result in |\l@youthdo|.
1623 % \begin{macrocode}
1624 \newcommand{\trystockwidth}[1]{\l@yltoc{#1}{\l@youthdo}}
1625 % \end{macrocode}
1626 % \end{macro}
1627 %
1628 % \begin{macro}{\trystockheight}
1629 % Sets the |stockheight| and stores the result in |\l@youtvdo|.
1630 % \begin{macrocode}
1631 \newcommand{\trystockheight}[1]{\l@yltoc{#1}{\l@youtvdo}}
1632 % \end{macrocode}
1633 % \end{macro}
1634 %
1635 % \begin{macro}{\trytrimedge}
1636 % Sets the |trimedge| and stores the result in |\l@youthpi|.
1637 % \begin{macrocode}
1638 \newcommand{\trytrimedge}[1]{\l@yltoc{#1}{\l@youthpi}}
1639 % \end{macrocode}
1640 % \end{macro}
1641 %
1642 % \begin{macro}{\trytrimtop}
1643 % Sets the |trimtop| and stores the result in |\l@youtvpi|.
1644 % \begin{macrocode}
1645 \newcommand{\trytrimtop}[1]{\l@yltoc{#1}{\l@youtvpi}}
1646 % \end{macrocode}
1647 % \end{macro}
1648 %
1649 % \begin{macro}{\tryuppermargin}
1650 % Sets the |uppermargin| and stores the result in |\l@youtvpii|.
1651 % \begin{macrocode}
1652 \newcommand{\tryuppermargin}[1]{\l@yltoc{#1}{\l@youtvpii}}
1653 % \end{macrocode}
1654 % \end{macro}
1655 %
1656 % \begin{macro}{\tryspinemargin}
1657 % Sets the |spinemargin| and stores the result in |\l@youthpv|.
1658 % \begin{macrocode}
1659 \newcommand{\tryspinemargin}[1]{\l@yltoc{#1}{\l@youthpv}}
1660
1661 % \end{macrocode}
1662 % \end{macro}
1663 %
1664 %
1665 %
1666 % \begin{macro}{\currentstock}
1667 % This routine sets the stock layout page parameters to those specified
1668 % for the document.
1669 % \changes{2.5a}{2002/01/06}{Added default footheight to \cs{currentstock}}
1670 % \changes{2.6}{2002/06/09}{Split \cs{currentstock} into two macros
1671 % (plus \cs{commonl@ypage}}
1672 % \begin{macrocode}
1673 \newcommand{\currentstock}{%
1674 \trystockwidth{\stockwidth}% % typically 8.5in
1675 \trystockheight{\stockheight}% % typically 11in
1676 \trypaperwidth{\paperwidth}% % typically 8.5in
1677 \trypaperheight{\paperheight}% % typically 11in
1678 \trytrimedge{\trimedge}% % typically 0pt
1679 \trytrimtop{\trimtop}% % typically 0pt
1680 \tryspinemargin{\spinemargin}% % typically 110pt
1681 \tryuppermargin{\uppermargin}% % typically 125pt
1682 \commonl@ypage
1683 }
1684
1685 % \end{macrocode}
1686 % \end{macro}
1687 %
1688 % \begin{macro}{\drawstock}
1689 % This routine draws a stock page layout.
1690 %
1691 % \begin{macrocode}
1692 \newcommand{\drawstock}{%
1693 % \end{macrocode}
1694 % First set some default vertical and horizontal dimension values.
1695 % \begin{macrocode}
1696 \l@youtvdiii=\l@yteninch\relax
1697 \divide\l@youtvdiii by 24\relax
1698 \l@youthdii=\l@youtvdiii
1699
1700 \ifdrawparameters
1701 % \end{macrocode}
1702 % When |drawparameters| is TRUE, we draw a generic layout showing the
1703 % controlling layout variables.
1704 %
1705 % \begin{macrocode}
1706 \l@youtvdo=\l@yeleveninch\relax % stock height
1707 \l@youthdo=\l@yeighthalfinch\relax % stock width
1708 \l@youtvpi=\z@ % trimtop
1709 \advance\l@youtvpi by \l@youtvdiii
1710 \l@youthpi=\z@ % trimedge
1711 \advance\l@youthpi by \l@youtvdiii
1712 \l@youtph=\l@youtvdo % page height (= stock height)
1713 \advance\l@youtph by -\l@youtvpi % minus trimtop
1714 \advance\l@youtph by -\l@youtvpi % minus trimtop
1715 \advance\l@youtph by -\l@youtvpi % minus trimtop
1716 \l@youtpw=\l@youthdo % page width (= stock width)
1717 \advance\l@youtpw by -\l@youthpi % minus trimedge
1718 \advance\l@youtpw by -\l@youthpi % minus trimedge
1719 \advance\l@youtpw by -\l@youthpi % minus trimedge
1720 \l@youtvpiii=\l@youtvdiii % headheight
1721 \l@youtvpiv=\l@youtvdiii % headsep
1722 \l@youtvpii=\l@youtvdiii % uppermargin
1723 \advance\l@youtvpii by \l@yoneinch % plus 1in
1724 \advance\l@youtvpii by \l@youtvpiii % plus headheight
1725 \advance\l@youtvpii by \l@youtvpiv % plus headsep
1726 \l@youtvpv=\l@yoneinch\relax % textheight
1727 \multiply\l@youtvpv by 6\relax
1728 \l@youtvpvi=\l@youtvdiii % footskip
1729 \multiply\l@youtvpvi by \tw@
1730 \l@youtvdv=\l@youtvdiii % default footboxheight
1731 \l@youtvdvi=\z@ % default footboxdepth
1732 \l@youtvpvii=\l@youtvdiii % marginparpush
1733 \l@youthpii=\l@youthdii % textwidth
1734 \multiply\l@youthpii by 12\relax
1735 \l@youthpv=\l@youthdii % spine margin
1736 \advance\l@youthpv by \l@yoneinch % plus 1in
1737 \multiply\l@youthpv by 7\relax % and take 70%
1738 \divide\l@youthpv by 10\relax
1739 \l@youthpiii=\l@youthdii % columnsep
1740 \l@youthpvi=\l@youthdii % marginparsep
1741 \l@youthpvii=\l@youthdii % marginparwidth
1742 \multiply\l@youthpvii by \tw@
1743 \fi
1744
1745 % \end{macrocode}
1746 % Calculate coordinates for use in the drawing. Some of these X coordinates
1747 % depend on whether the page is odd or even.
1748 % \begin{macrocode}
1749 \ifoddpagelayout
1750 \l@youtxco=\l@youthdo % X coord of page bottom left (= stockwidth)
1751 \advance\l@youtxco by -\l@youthpi % minus trimedge
1752 \advance\l@youtxco by -\l@youtpw % minus page width
1753 \else
1754 \l@youtxco=\l@youthpi % X coord of page bottom left = trimedge
1755 \fi
1756 \l@youtyco=\l@youtvdo % Y coord of page bottom left (= stockheight)
1757 \advance\l@youtyco by -\l@youtvpi % minus trimtop
1758 \advance\l@youtyco by -\l@youtph % minus page height
1759 \l@youtxcii=\l@youtxco % X coord of left of textblock (= left of page)
1760 \ifoddpagelayout
1761 \advance\l@youtxcii by \l@youthpv % plus spinemargin
1762 \else
1763 \advance\l@youtxcii by \l@youtpw % plus pagewidth
1764 \advance\l@youtxcii by -\l@youthpv % minus spinemargin
1765 \advance\l@youtxcii by -\l@youthpii % minus textwidth
1766 \fi
1767 \l@youtxciv=\l@youtxcii % X coord of left of marginnote (= left of textblock)
1768 \l@youtxciv=\l@youtxcii
1769 \@tempcnta\@ne
1770 \ifmarginparswitch
1771 \ifoddpagelayout \else \@tempcnta\m@ne \fi
1772 \fi
1773 \ifreversemarginpar \@tempcnta -\@tempcnta \fi
1774 \ifnum\@tempcnta >\z@
1775 \l@yrightmparstrue
1776 \advance\l@youtxciv by \l@youthpii % plus textwidth
1777 \advance\l@youtxciv by \l@youthpvi % plus marginnotesep
1778 \else
1779 \l@yrightmparsfalse
1780 \advance\l@youtxciv by -\l@youthpvii % minus marginparwidth
1781 \advance\l@youtxciv by -\l@youthpvi % minus marginnotesep
1782 \fi
1783 \l@youtycii=\l@youtvdo % Y coord of bottom of text (= stockheight)
1784 \advance\l@youtycii by -\l@youtvpi % minus trimtop
1785 \advance\l@youtycii by -\l@youtvpii % minus uppermargin
1786 \advance\l@youtycii by -\l@youtvpv % minus textheight
1787 \ifnum\l@youtvdv>\l@youtvpvi
1788 \PackageWarning{layouts}{The footbox is higher than the footskip}
1789 \l@youtvdv=\l@youtvpvi
1790 \fi
1791 \l@youtyci=\l@youtycii % Y coord of bottom of footer (= bottom of text)
1792 \advance\l@youtyci by -\l@youtvpvi % minus footskip
1793 \advance\l@youtyci by -\l@youtvdvi % minus box depth
1794 \l@youtvdvii=\l@youtvdv % box height
1795 \advance\l@youtvdvii by \l@youtvdvi % plus depth
1796 \l@youtyciv=\l@youtycii % Y coord of bottom of header (= bottom of text)
1797 \advance\l@youtyciv by \l@youtvpv % plus textheight
1798 \advance\l@youtyciv by \l@youtvpiv % plus headsep
1799
1800 \l@youtvdii=\l@youtvpv % height of a marginal note
1801 \divide\l@youtvdii by 4\relax
1802 \l@youtyciii=\l@youtycii % Y coord of bottom of top note (= bottom of bottom note)
1803 \advance\l@youtyciii by \l@youtvdii % plus note height
1804 \advance\l@youtyciii by \l@youtvpvii % plus marginparpush
1805 % \end{macrocode}
1806 % Now for column dependent values.
1807 % \begin{macrocode}
1808 \l@youthdi=\l@youthpii % columnwidth = textwidth
1809 \l@youtxciii=\l@youtxcii % X coord of right col
1810 \iftwocolumnlayout
1811 \advance\l@youthdi by -\l@youthpiii % colwidth = textwidth - colsep
1812 \divide\l@youthdi by \tw@ % divided in half
1813 \advance\l@youtxciii by \l@youthdi % X coord of right col X coord of text + col width
1814 \advance\l@youtxciii by \l@youthpiii % plus colsep
1815 \l@youtxcv=\l@youthpiii % centre of gutter
1816 \divide\l@youtxcv by \tw@
1817 \advance\l@youtxcv by \l@youtxcii
1818 \advance\l@youtxcv by \l@youthdi
1819 \fi
1820 % \end{macrocode}
1821 %
1822 % Print the caption for the top of the drawing.
1823 % \begin{macrocode}
1824 \begin{center}
1825 \l@yor{\ifdrawparameters}{\ifprintheadings}
1826 \ifl@ytempif
1827 \begin{small} Dashed lines represent the actual page size after trimming
1828 the stock. \end{small} \\
1829 \medskip
1830 \fi
1831 % \end{macrocode}
1832 %
1833 % Draw the picture!
1834 %
1835 % \begin{macrocode}
1836 \setlength{\unitlength}{\l@youtunitlength}
1837 \begin{picture}(\l@youthdo,\l@youtvdo)
1838 \thicklines
1839 % \end{macrocode}
1840 % Draw the stock, paper, etc.
1841 % \begin{macrocode}
1842 \put(0,0){\framebox(\l@youthdo,\l@youtvdo){}} % the stock
1843 \put(\l@youtxco,\l@youtyco){\dashbox{10}(\l@youtpw,\l@youtph){}} % the page
1844 \put(\l@youtxcii,\l@youtyciv){\framebox(\l@youthpii,\l@youtvpiii)% % the header
1845 {\l@ylabelfont Header}}
1846 % \end{macrocode}
1847 % Draw the body, either one or two columns, then the footer.
1848 % \begin{macrocode}
1849 \iftwocolumnlayout
1850 \put(\l@youtxcii,\l@youtycii){\framebox(\l@youthdi,\l@youtvpv)% % col 1
1851 {\l@ylabelfont Col. 1}}
1852 \put(\l@youtxciii,\l@youtycii){\framebox(\l@youthdi,\l@youtvpv)% % col2
1853 {\l@ylabelfont Col. 2}}
1854 \linethickness{\l@youtscale\l@youtlinethick}
1855 \put(\l@youtxcv,\l@youtycii){\line(0,1){\l@youtvpv}} % rule
1856 \linethickness{1pt}
1857 \else
1858 \put(\l@youtxcii,\l@youtycii){\framebox(\l@youthpii,\l@youtvpv)% % one col
1859 {\l@ylabelfont Body}}
1860 \fi
1861 \put(\l@youtxcii,\l@youtyci){\framebox(\l@youthpii,\l@youtvdvii)% % footer
1862 {\l@ylabelfont Footer}}
1863 % \end{macrocode}
1864 % Marginal notes (two examples), if asked for
1865 % \begin{macrocode}
1866 \ifdrawmarginpars
1867 \ifdrawparameters
1868 \put(\l@youtxciv,\l@youtycii){\framebox(\l@youthpvii,\l@youtvdii){}}
1869 \put(\l@youtxciv,\l@youtyciii){\framebox(\l@youthpvii,\l@youtvdii)%
1870 {\l@ylabelfont\shortstack{Margin\\Note}}}
1871 \else
1872 \put(\l@youtxciv,\l@youtycii){\framebox(\l@youthpvii,\l@youtvdii)%
1873 {\l@ylabelfont Note}}
1874 \put(\l@youtxciv,\l@youtyciii){\framebox(\l@youthpvii,\l@youtvdii)%
1875 {\l@ylabelfont Margin}}
1876 \fi
1877 \fi
1878
1879 % \end{macrocode}
1880 % If the footbox has a depth, draw a dashed line to mark the footskip.
1881 % \begin{macrocode}
1882 \ifnum\l@youtvdvi > \z@
1883 \thinlines
1884 \advance\l@youtyci by \l@youtvdvi
1885 \put(\l@youtxcii,\l@youtyci){\dashbox{10}(\l@youthpii,0){}}
1886 \fi
1887 % \end{macrocode}
1888 % That finishes the general drawing. We may have to now draw the
1889 % parameters
1890 % \begin{macrocode}
1891 \testdrawdimensions
1892 \ifl@ytempif
1893 \thinlines
1894 % \end{macrocode}
1895 % We now draw labelled vectors indicating the layout parameters.
1896 % Life gets tedious as we have to calculate a few more coordinate and
1897 % length values. The code below is fairly incomprehensible as we are
1898 % trying to minimise the number of counters.
1899 % \begin{macrocode}
1900 \l@youtycv=\l@youtyco % Y coord of top of page (= page bottom)
1901 \advance\l@youtycv by \l@youtph % plus pageheight
1902 \l@youtvdviii=\l@youtvdiii % half l@youtvdiii (a small distance)
1903 \divide\l@youtvdviii by \tw@
1904 \l@youtxcv=\l@youtxcii % X coord for vertical dimensions
1905 \advance\l@youtxcv by \l@youthdii % for `standard' vertical vectors
1906 %% do headheight
1907 \put(\l@youtxcv,\l@youtyciv){\vector(0,1){\l@youtvpiii}}
1908 \put(\l@youtxcv,\l@youtyciv){\vector(0,-1){0}}
1909 \put(\l@youtxcv,\l@youtyciv){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
1910 \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{headheight}}
1911 \end{picture}}
1912 %% do headsep
1913 \put(\l@youtxcv,\l@youtyciv){\vector(0,-1){\l@youtvpiv}}
1914 \put(\l@youtxcv,\l@youtyciv){\vector(0,1){0}}
1915 \put(\l@youtxcv,\l@youtyciv){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
1916 \put(\l@youtvdviii,-\l@youtvdviii){\l@ypcmd{headsep}}
1917 \end{picture}}
1918 %% do textheight
1919 \put(\l@youtxcv,\l@youtycii){\vector(0,1){\l@youtvpv}}
1920 \put(\l@youtxcv,\l@youtycii){\vector(0,-1){0}}
1921 \put(\l@youtxcv,\l@youtycii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
1922 \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{textheight}}
1923 \end{picture}}
1924 %% do footskip
1925 \put(\l@youtxcv,\l@youtycii){\vector(0,-1){\l@youtvpvi}}
1926 \put(\l@youtxcv,\l@youtycii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
1927 \put(\l@youtvdviii,-\l@youtvdviii){\l@ypcmd{footskip}}
1928 \end{picture}}
1929 \ifdrawmarginpars
1930 \l@youtxcv=\l@youthpvii % X coord for marginparpush
1931 \divide\l@youtxcv by \tw@
1932 \advance\l@youtxcv by \l@youtxciv
1933 %% do marginparpush
1934 \put(\l@youtxcv,\l@youtyciii){\vector(0,-1){\l@youtvpvii}}
1935 \put(\l@youtxcv,\l@youtyciii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
1936 \put(\l@youtvdviii,-\l@youtvdviii){\l@ypcmd{marginparpush}}
1937 \end{picture}}
1938 \fi
1939 %% calculate X coord for uppermargin/trimtop parameters
1940 \ifoddpagelayout
1941 \ifl@yrightmpars
1942 \l@youtxcv=\l@youtxciv % X coord for uppermargin, etc (= edge of note)
1943 \else
1944 \l@youtxcv=\l@youtxciv
1945 \advance\l@youtxcv by \l@youthpvii % plus marginparwidth
1946 \fi
1947 \else
1948 \ifl@yrightmpars
1949 \l@youtxcv=\l@youtxciv
1950 \else
1951 \l@youtxcv=\l@youtxciv
1952 \advance\l@youtxcv by \l@youthpvii % plus marginparwidth
1953 \fi
1954 \fi
1955 %% do uppermargin
1956 \put(\l@youtxcv,\l@youtycv){\vector(0,-1){\l@youtvpii}}
1957 \put(\l@youtxcv,\l@youtycv){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
1958 \put(\l@youtvdviii,-\l@youtvdviii){\l@ypcmd{uppermargin}}
1959 \end{picture}}
1960 %% do trimtop
1961 \put(\l@youtxcv,\l@youtvdo){\vector(0,-1){\l@youtvpi}}
1962 \put(\l@youtxcv,\l@youtvdo){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
1963 \put(\l@youtvdviii,-\l@youtvdviii){\l@ypcmd{trimtop}}
1964 \end{picture}}
1965 %% X coord for stock height
1966 \ifoddpagelayout
1967 \ifl@yrightmpars
1968 \l@youtxcv=\l@youtxco % X coord for stock height
1969 \divide\l@youtxcv by \tw@ % 1/2 stock/paper left edges
1970 \else
1971 \l@youtxcv=\l@youtxco % X coord for stock height
1972 \advance\l@youtxcv by \l@youtpw % plus page width
1973 \advance\l@youtxcv by \l@youthpi % plus trimedge
1974 \fi
1975 \else
1976 \ifl@yrightmpars
1977 \l@youtxcv=\l@youtxco % X coord for stock height
1978 \divide\l@youtxcv by \tw@ % 1/2 stock/paper left edges
1979 \else
1980 \l@youtxcv=\l@youtxco % X coord for stock height
1981 \advance\l@youtxcv by \l@youtpw % plus page width
1982 \advance\l@youtxcv by \l@youthpi % plus trimedge
1983 \fi
1984 \fi
1985 %% do stockheight
1986 \put(\l@youtxcv,0){\vector(0,1){\l@youtvdo}}
1987 \put(\l@youtxcv,0){\vector(0,-1){0}}
1988 \put(\l@youtxcv,\l@youtvdo){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
1989 \put(\l@youtvdviii,-\l@youtvdviii){\l@ypcmd{stockheight}}
1990 \end{picture}}
1991 %% X coord for paper height
1992 \ifoddpagelayout
1993 \ifl@yrightmpars
1994 \l@youtxcv=\l@youtxco % X coord for paper height
1995 \advance\l@youtxcv by \l@youtxcii % plus left edge of text
1996 \divide\l@youtxcv by \tw@
1997 \else
1998 \l@youtxcv=\l@youtxco % X coord for paper height
1999 \advance\l@youtxcv by \l@youtpw % plus page width
2000 \advance\l@youtxcv by \l@youtxcii % plus left edge of text
2001 \advance\l@youtxcv by \l@youthpii % plus text width
2002 \divide\l@youtxcv by \tw@
2003 \fi
2004 \else
2005 \ifl@yrightmpars
2006 \l@youtxcv=\l@youtxco % X coord for paper height
2007 \advance\l@youtxcv by \l@youtxcii % plus left edge of text
2008 \divide\l@youtxcv by \tw@
2009 \else
2010 \l@youtxcv=\l@youtxco % X coord for paper height
2011 \advance\l@youtxcv by \l@youtpw % plus page width
2012 \advance\l@youtxcv by \l@youtxcii % plus left edge of text
2013 \advance\l@youtxcv by \l@youthpii % plus text width
2014 \divide\l@youtxcv by \tw@
2015 \fi
2016 \fi
2017 %% do paperheight
2018 \put(\l@youtxcv,\l@youtyco){\vector(0,1){\l@youtph}}
2019 \put(\l@youtxcv,\l@youtyco){\vector(0,-1){0}}
2020 \put(\l@youtxcv,\l@youtycv){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
2021 \put(\l@youtvdviii,-\l@youtvdviii){\l@ypcmd{paperheight}}
2022 \end{picture}}
2023
2024 \l@youtvpiii=\l@youtycii % Y coord for low dimensions
2025 \advance\l@youtvpiii by \l@youtvdiii
2026 \l@youtvpiv=\l@youtvpiii % Y coord for mid dimensions
2027 \advance\l@youtvpiv by \l@youtvdiii
2028 \l@youtvdi=\l@youtvpv % Y coord for top dimensions
2029 \multiply\l@youtvdi by \tw@ % 2/3 of text height
2030 \divide\l@youtvdi by 3\relax
2031 \advance\l@youtvdi by \l@youtycii
2032 \ifdrawmarginpars
2033 %% do marginparwidth
2034 \put(\l@youtxciv,\l@youtvpiii){\vector(1,0){\l@youthpvii}}
2035 \put(\l@youtxciv,\l@youtvpiii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
2036 \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{marginparwidth}}
2037 \end{picture}}
2038 \fi
2039 \ifoddpagelayout
2040 %% do spinemargin
2041 \put(\l@youtxco,\l@youtvdi){\vector(1,0){\l@youthpv}}
2042 \put(\l@youtxco,\l@youtvdi){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
2043 \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{spinemargin}}
2044 \end{picture}}
2045 %% do trimedge
2046 \put(\l@youthdo,\l@youtyciv){\vector(-1,0){\l@youthpi}}
2047 \put(\l@youthdo,\l@youtyciv){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
2048 \put(-\l@youtvdviii,\l@youtvdviii){\l@ypcmd{trimedge}}
2049 \end{picture}}
2050 \else
2051 \l@youtxcv=\l@youtxcii % X coord of right edge of text
2052 \advance\l@youtxcv by \l@youthpii
2053 %% do spinemargin
2054 \put(\l@youtxcv,\l@youtvdi){\line(1,0){\l@youthpv}}
2055 \put(\l@youtxcv,\l@youtvdi){\vector(-1,0){0}}
2056 \put(\l@youtxcv,\l@youtvdi){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
2057 \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{spinemargin}}
2058 \end{picture}}
2059 %% do trimedge
2060 \put(0,\l@youtyciv){\vector(1,0){\l@youthpi}}
2061 \put(0,\l@youtyciv){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
2062 \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{trimedge}}
2063 \end{picture}}
2064 \fi
2065 %% marginal elements
2066 \ifdrawmarginpars
2067 %% do marginparsep
2068 \ifl@yrightmpars
2069 \put(\l@youtxciv,\l@youtvpiv){\line(-1,0){\l@youthpvi}}
2070 \put(\l@youtxciv,\l@youtvpiv){\vector(1,0){0}}
2071 \put(\l@youtxciv,\l@youtvpiv){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
2072 \put(-\l@youtvdviii,\l@youtvdviii){\l@ypcmd{marginparsep}}
2073 \end{picture}}
2074 \else
2075 \put(\l@youtxcii,\l@youtvpiv){\vector(-1,0){\l@youthpvi}}
2076 \put(\l@youtxcii,\l@youtvpiv){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
2077 \put(-\l@youtvdviii,\l@youtvdviii){\l@ypcmd{marginparsep}}
2078 \end{picture}}
2079 \fi
2080 \fi
2081
2082 \l@youtxcv=\l@youtxcii % X coord for mid textwidth
2083 \multiply\l@youtxcv by \tw@
2084 \advance\l@youtxcv by \l@youthpii
2085 \divide\l@youtxcv by \tw@
2086 %% do textwidth
2087 \put(\l@youtxcii,\l@youtyciii){\vector(1,0){\l@youthpii}}
2088 \put(\l@youtxcii,\l@youtyciii){\vector(-1,0){0}}
2089 \put(\l@youtxcv,\l@youtyciii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
2090 \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{textwidth}}
2091 \end{picture}}
2092 \iftwocolumnlayout
2093 %% do columnsep
2094 \put(\l@youtxciii,\l@youtvdi){\vector(-1,0){\l@youthpiii}}
2095 \put(\l@youtxciii,\l@youtvdi){\vector(1,0){0}}
2096 \put(\l@youtxciii,\l@youtvdi){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
2097 \put(-\l@youtvdviii,\l@youtvdviii){\l@ypcmd{columnsep}}
2098 \end{picture}}
2099 \fi
2100
2101 \l@youtxcv=\l@youthdo % X coord of middle of picture
2102 \divide\l@youtxcv by \tw@
2103 %% do stockwidth
2104 \l@youtvpiii=\l@youtyco % Y coord for stockwidth
2105 \divide\l@youtvpiii by 3\relax
2106 \put(0,\l@youtvpiii){\vector(1,0){\l@youthdo}}
2107 \put(0,\l@youtvpiii){\vector(-1,0){0}}
2108 \put(\l@youtxcv,\l@youtvpiii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
2109 \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{stockwidth}}
2110 \end{picture}}
2111 %% do paperwidth
2112 \l@youtvpiii=\l@youtyci % Y coord for paperwidth
2113 \advance\l@youtvpiii by -\l@youtyco
2114 \multiply\l@youtvpiii by 3\relax
2115 \divide\l@youtvpiii by 10\relax
2116 \advance\l@youtvpiii by \l@youtyco
2117 \put(\l@youtxco,\l@youtvpiii){\vector(1,0){\l@youtpw}}
2118 \put(\l@youtxco,\l@youtvpiii){\vector(-1,0){0}}
2119 \put(\l@youtxcv,\l@youtvpiii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
2120 \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{paperwidth}}
2121 \end{picture}}
2122 \fi
2123 % \end{macrocode}
2124 % Have finished drawing the parameters.
2125 % \begin{macrocode}
2126 \end{picture}
2127 \end{center}
2128 \setlength{\unitlength}{1pt}
2129
2130 \testprintparameters
2131 \ifl@ytempif
2132 % \end{macrocode}
2133 % Print the actual parameter values.
2134 % \begin{macrocode}
2135 \begin{center}
2136 \begin{footnotesize}
2137 Lengths are to the nearest pt. \\
2138 \begin{ttfamily}
2139 \begin{tabular}{l@{\hspace{20pt}}l}
2140 \l@ycmd{stockheight} = \number\l@youtvdo pt &
2141 \l@ycmd{stockwidth} = \number\l@youthdo pt \\
2142 \l@ycmd{pageheight} = \number\l@youtph pt &
2143 \l@ycmd{pagewidth} = \number\l@youtpw pt \\
2144 \l@ycmd{textheight} = \number\l@youtvpv pt &
2145 \l@ycmd{textwidth} = \number\l@youthpii pt \\
2146 \l@ycmd{trimtop} = \number\l@youtvpi pt &
2147 \l@ycmd{trimedge} = \number\l@youthpi pt \\
2148 \l@ycmd{uppermargin} = \number\l@youtvpii pt &
2149 \l@ycmd{spinemargin} = \number\l@youthpv pt \\
2150 \l@ycmd{headheight} = \number\l@youtvpiii pt &
2151 \l@ycmd{headsep} = \number\l@youtvpiv pt \\
2152 \l@ycmd{footskip} = \number\l@youtvpvi pt &
2153 \l@ycmd{marginparsep} = \number\l@youthpvi pt \\
2154 \l@ycmd{marginparpush} = \number\l@youtvpvii pt &
2155 \l@ycmd{columnsep} = \number\l@youthpiii pt \\
2156 \l@ycmd{columnseprule} = \the\l@youtlinethick & \\
2157 \end{tabular}
2158 \end{ttfamily}\end{footnotesize}
2159 \end{center}
2160 \fi
2161 % \end{macrocode}
2162 % The end of the definition for |\drawstock|.
2163 % \begin{macrocode}
2164 }
2165
2166 % \end{macrocode}
2167 % \end{macro}
2168 %
2169 % \begin{macro}{\stockdiagram}
2170 % \begin{macro}{\stockdesign}
2171 % Shorthands.
2172 % \begin{macrocode}
2173 \newcommand{\stockdiagram}{\drawparameterstrue\drawstock}
2174 \newcommand{\stockdesign}{\drawparametersfalse\drawstock}
2175
2176 % \end{macrocode}
2177 % \end{macro}
2178 % \end{macro}
2179 %
2180 % \begin{macro}{\stockvalues}
2181 % This macro produces a table of the current page layout actual values.
2182 % \begin{macrocode}
2183 \newcommand{\stockvalues}{%
2184 %% \begin{center}
2185 \ifprintheadings
2186 Actual stock page layout values.\\[\baselineskip]
2187 \fi
2188 \begingroup
2189 \l@yvalsize
2190 \begin{tabular}{l@{\hspace{20pt}}l}
2191 \l@ycmd{stockheight} = \l@yval{\stockheight} &
2192 \l@ycmd{stockwidth} = \l@yval{\stockwidth} \\
2193 \l@ycmd{paperheight} = \l@yval{\paperheight} &
2194 \l@ycmd{paperwidth} = \l@yval{\paperwidth} \\
2195 \l@ycmd{textheight} = \l@yval{\textheight} &
2196 \l@ycmd{textwidth} = \l@yval{\textwidth} \\
2197 \l@ycmd{trimtop} = \l@yval{\trimtop} &
2198 \l@ycmd{trimedge} = \l@yval{\trimedge} \\
2199 \l@ycmd{uppermargin} = \l@yval{\uppermargin} &
2200 \l@ycmd{spinemargin} = \l@yval{\spinemargin} \\
2201 \l@ycmd{headheight} = \l@yval{\headheight} &
2202 \l@ycmd{headsep} = \l@yval{\headsep} \\
2203 \l@ycmd{footskip} = \l@yval{\footskip} &
2204 \l@ycmd{marginparsep} = \l@yval{\marginparsep} \\
2205 \l@ycmd{marginparpush} = \l@yval{\marginparpush} &
2206 \l@ycmd{columnsep} = \l@yval{\columnsep} \\
2207 \l@ycmd{columnseprule} = \l@yval{\columnseprule} & \\
2208 1em = \l@yval{\l@yonem} & 1ex = \l@yval{\l@yonex} \\
2209 \end{tabular}
2210 \endgroup
2211 }
2212
2213 % \end{macrocode}
2214 % \end{macro}
2215 %
2216 % \section{Drawing the layout of a list}
2217 %
2218 % We provide a facility for drawing the layout of a \LaTeX{} \Lenv{list}
2219 % environment.
2220 %
2221 % First the |\try...| commands for setting trial list parameters.
2222 %
2223 % \begin{macro}{\tryitemindent}
2224 % Sets a trial value for |itemindent| and stores the result in |\l@youthpi|.
2225 % \begin{macrocode}
2226
2227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2228 %%%% LIST LAYOUT
2229 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2230
2231 \newcommand{\tryitemindent}[1]{\l@yltoc{#1}{\l@youthpi}}
2232 % \end{macrocode}
2233 % \end{macro}
2234 %
2235 % \begin{macro}{\trylabelwidth}
2236 % Sets a trial value for |labelwidth| and stores the result in |\l@youthpii|.
2237 % \begin{macrocode}
2238 \newcommand{\trylabelwidth}[1]{\l@yltoc{#1}{\l@youthpii}}
2239 % \end{macrocode}
2240 % \end{macro}
2241 %
2242 % \begin{macro}{\trylabelsep}
2243 % Sets a trial value for |labelsep| and stores the result in |\l@youthpiii|.
2244 % \begin{macrocode}
2245 \newcommand{\trylabelsep}[1]{\l@yltoc{#1}{\l@youthpiii}}
2246 % \end{macrocode}
2247 % \end{macro}
2248 %
2249 % \begin{macro}{\tryleftmargin}
2250 % Sets a trial value for |leftmargin| and stores the result in |\l@youthpiv|.
2251 % \begin{macrocode}
2252 \newcommand{\tryleftmargin}[1]{\l@yltoc{#1}{\l@youthpiv}
2253 % \end{macrocode}
2254 % But the left margin must not be less than zero.
2255 % \begin{macrocode}
2256 \ifnum\l@youthpiv < \z@
2257 \l@youthpiv = \z@
2258 \fi}
2259 % \end{macrocode}
2260 % \end{macro}
2261 %
2262 % \begin{macro}{\tryrightmargin}
2263 % Sets a trial value for |rightmargin| and stores the result in |\l@youthpv|.
2264 % \begin{macrocode}
2265 \newcommand{\tryrightmargin}[1]{\l@yltoc{#1}{\l@youthpv}}
2266 % \end{macrocode}
2267 % \end{macro}
2268 %
2269 % \begin{macro}{\trylistparindent}
2270 % Sets a trial value for |listparindent| and stores the result in |\l@youthpvi|.
2271 % \begin{macrocode}
2272 \newcommand{\trylistparindent}[1]{\l@yltoc{#1}{\l@youthpvi}}
2273 % \end{macrocode}
2274 % \end{macro}
2275 %
2276 % \begin{macro}{\trytopsep}
2277 % Sets a trial value for |topsep| and stores the result in |\l@youtvpi|.
2278 % \begin{macrocode}
2279 \newcommand{\trytopsep}[1]{\l@yltoc{#1}{\l@youtvpi}}
2280 % \end{macrocode}
2281 % \end{macro}
2282 %
2283 % \begin{macro}{\tryparskip}
2284 % Sets a trial value for |parskip| and stores the result in |\l@youtparskip|.
2285 % \begin{macrocode}
2286 \newcommand{\tryparskip}[1]{\l@yltoc{#1}{\l@youtparskip}}
2287 % \end{macrocode}
2288 % \end{macro}
2289 %
2290 % \begin{macro}{\trypartopsep}
2291 % Sets a trial value for |partopsep| and stores the result in |\l@youtvpiii|.
2292 % \begin{macrocode}
2293 \newcommand{\trypartopsep}[1]{\l@yltoc{#1}{\l@youtvpiii}}
2294 % \end{macrocode}
2295 % \end{macro}
2296 %
2297 % \begin{macro}{\tryparsep}
2298 % Sets a trial value for |parsep| and stores the result in |\l@youtvpiv|.
2299 % \begin{macrocode}
2300 \newcommand{\tryparsep}[1]{\l@yltoc{#1}{\l@youtvpiv}}
2301 % \end{macrocode}
2302 % \end{macro}
2303 %
2304 % \begin{macro}{\tryitemsep}
2305 % Sets a trial value for |itemsep| and stores the result in |\l@youtvpv|.
2306 % \begin{macrocode}
2307 \newcommand{\tryitemsep}[1]{\l@yltoc{#1}{\l@youtvpv}}
2308
2309 % \end{macrocode}
2310 % \end{macro}
2311 %
2312 % \begin{macro}{\currentlist}
2313 % This routine sets the trial list parameters to be those of the current
2314 % list environment.
2315 % \begin{macrocode}
2316 \newcommand{\currentlist}{%
2317 \tryitemindent{\itemindent} % typically 0pt
2318 \trylabelwidth{\labelwidth} % typically pt
2319 \trylabelsep{\labelsep} % typically 0.5em
2320 \tryleftmargin{\leftmargin} % typically pt
2321 \tryrightmargin{\rightmargin} % typically pt
2322 \trylistparindent{\listparindent} % typically 0pt
2323 \trytopsep{\topsep} % typically pt
2324 \tryparskip{\l@ysetupparskip} % typically pt
2325 \trypartopsep{\partopsep} % typically pt
2326 \tryparsep{\parsep} % typically pt
2327 \tryitemsep{\itemsep} % typically pt
2328 }
2329
2330 % \end{macrocode}
2331 % \end{macro}
2332 %
2333 % \begin{macro}{\drawlist}
2334 % This routine draws the layout of a \Lenv{list} environment.
2335 % \begin{macrocode}
2336 \newcommand{\drawlist}{%
2337 % \end{macrocode}
2338 % First set some some default vertical and horizontal dimensions.
2339 % \begin{macrocode}
2340 \l@youthdo=\l@yoneinch\relax
2341 \l@youtvdo=\l@yoneinch\relax
2342 \multiply\l@youtvdo by 12\relax
2343 \divide\l@youtvdo by 10\relax
2344 \l@youthdi=\l@yeighthalfinch\relax % major textwidth
2345 \ifdrawparameters
2346 % \end{macrocode}
2347 % When |drawparameters| is TRUE, we draw a generic layout showing the
2348 % controlling layout variables.
2349 % \begin{macrocode}
2350 \l@youthpi=60\relax % itemindent
2351 \l@youthpii=80\relax % labelwidth
2352 \l@youthpiii=\l@youthpi % labelsep
2353 \divide\l@youthpiii by \tw@
2354 \l@youthpiv=\l@youthpi % leftmargin
2355 \advance\l@youthpiv by \l@youthpii
2356 \advance\l@youthpiv by \l@youthpiii
2357 \l@youthpv=\l@youthpiv % rightmargin
2358 \multiply\l@youthpv by \tw@
2359 \divide\l@youthpv by \thr@@
2360 \l@youthpvi=\l@youthpi % listparindent
2361 \multiply\l@youthpvi by 4\relax
2362 \divide\l@youthpvi by \thr@@
2363 \l@youtvpi=40\relax % topsep
2364 \l@youtparskip=\l@youtvpi % parskip
2365 \l@youtvpiii=\l@youtvpi % partopsep
2366 \l@youtvpiv=\l@youtvpi % parsep
2367 \l@youtvpv=\l@youtvpi % itemsep
2368 \fi
2369 % \end{macrocode}
2370 % Finished with the set up for drawing parameters. Continue calculating
2371 % other dimensions and coordinates.
2372 % \begin{macrocode}
2373 \l@youtvdvii=\l@youtvpi % topsep + parskip (+ partopsep)
2374 \advance\l@youtvdvii by \l@youtparskip
2375 \iflistaspara
2376 \advance\l@youtvdvii by \l@youtvpiii
2377 \fi
2378 \l@youtvdvi=\l@youtvpv % itemsep + parsep
2379 \advance\l@youtvdvi by \l@youtvpiv
2380 \l@youtyci=\l@yoneinch\relax % Y coord of base of item 2
2381 \advance\l@youtyci by \l@youtvdvii
2382 \l@youtxci=\z@ % X coord of LH list text
2383 \advance\l@youtxci by \l@youthpiv
2384 \l@youthdii=\l@youthdi % major width of item text
2385 \advance\l@youthdii by -\l@youthpiv
2386 \advance\l@youthdii by -\l@youthpv
2387 \l@youthdiii=\l@youthpi % inset of labelled list line
2388 \l@youtvdii=\l@youtvdo % vertical dim of short inset line
2389 \divide\l@youtvdii by 4\relax
2390 \l@youthdiv=\l@youthdii % X dim of item 2 box top
2391 \advance\l@youthdiv by -\l@youthdiii
2392 \l@youtvdi=\l@youtvdo % Y dim of RH item box
2393 \advance\l@youtvdi by \l@youtvdii
2394 \l@youtvdiii=\l@youtvdii % height of label box
2395 \multiply\l@youtvdiii by \thr@@
2396 \divide\l@youtvdiii by 4\relax
2397 \l@youtxcii=\l@youthdiii % X coord of BL of label box
2398 \advance\l@youtxcii by -\l@youthpiii
2399 \advance\l@youtxcii by -\l@youthpii
2400 \l@youtycii=\l@youtvdi % Y coord of BL of label box
2401 \advance\l@youtycii by -\l@youtvdiii
2402 \l@youtyciii=\l@youtyci % Y coord of base of para
2403 \advance\l@youtyciii by \l@youtvdi
2404 \advance\l@youtyciii by \l@youtvdvi
2405 \l@youthdv=\l@youthdii % Hor. dim of top of para box
2406 \advance\l@youthdv by -\l@youthpvi
2407 \l@youtyciv=\l@youtyciii % Y coord of base of item 1
2408 \advance\l@youtyciv by \l@youtvdi
2409 \advance\l@youtyciv by \l@youtvpiv
2410 \l@youtycv=\l@youtyciv % Y coord of base of preceding text
2411 \advance\l@youtycv by \l@youtvdi
2412 \advance\l@youtycv by \l@youtvdvii
2413 \l@youtvdiv=\l@youtycv % Height of picture
2414 \advance\l@youtvdiv by \l@yoneinch\relax
2415 \l@youtxciii=\l@youtxci % X coord of vertical lines
2416 \advance\l@youtxciii by \l@youtxci
2417 \advance\l@youtxciii by \l@youthdii
2418 \divide\l@youtxciii by \tw@
2419 \l@youtycvi=\l@youtvdi % Y coord for margin lines
2420 \divide\l@youtycvi by \tw@
2421 \l@youtvdv=\l@youtvpiv % small dimension (1/2 parsep)
2422 \divide\l@youtvdv by \tw@
2423 \l@youtxciv=\l@youtycii % Y coord for labelwidth (note XCIV)
2424 \advance\l@youtxciv by \l@youtvdiii
2425 \advance\l@youtxciv by \l@youtvdv
2426 % \end{macrocode}
2427 %
2428 % Draw the picture!
2429 %
2430 % \begin{macrocode}
2431 \begin{center}
2432 \setlength{\unitlength}{\l@youtunitlength}
2433 \begin{picture}(\l@yeighthalfinch,\l@youtvdiv)
2434 \thinlines
2435 % \end{macrocode}
2436 % Draw a box |(textwidth,height)| representing the page.
2437 % \begin{macrocode}
2438 \put(0,0){\dashbox{10}(\l@youthdi,\l@youtvdiv){}}
2439 \thicklines
2440 % \end{macrocode}
2441 % Draw successor text box 1 inch deep.
2442 % \begin{macrocode}
2443 \put(0,0){\framebox(\l@youthdi,\l@yoneinch){\l@ylabelfont Following Text}}
2444 % \end{macrocode}
2445 %
2446 % Draw item box 2
2447 % \begin{macrocode}
2448 \put(\l@youtxci,\l@youtyci){\begin{picture}(\l@youthdii,\l@youtvdi)
2449 % \end{macrocode}
2450 % The LH horizontal and vertical lines.
2451 % \begin{macrocode}
2452 \put(0,0){\line(1,0){\l@youthdii}}
2453 \put(0,0){\line(0,1){\l@youtvdo}}
2454 % \end{macrocode}
2455 % The lines for the inset (which may be positive or negative).
2456 % \begin{macrocode}
2457 \ifnum\l@youthdiii > \z@
2458 \put(\l@youthdiii,\l@youtvdo){\line(-1,0){\l@youthdiii}}
2459 \else
2460 \put(\l@youthdiii,\l@youtvdo){\line(1,0){-\l@youthdiii}}
2461 \fi
2462 \put(\l@youthdiii,\l@youtvdo){\line(0,1){\l@youtvdii}}
2463 % \end{macrocode}
2464 % The top and RH sides. Also add the text.
2465 % \begin{macrocode}
2466 \put(\l@youthdii,\l@youtvdi){\line(0,-1){\l@youtvdi}}
2467 \put(\l@youthdii,\l@youtvdi){\line(-1,0){\l@youthdiv}}
2468 \put(0,0){\makebox(\l@youthdii,\l@youtvdi){\l@ylabelfont Item 2}}
2469 % \end{macrocode}
2470 % Finish off with the label box.
2471 % \begin{macrocode}
2472 \put(\l@youtxcii,\l@youtycii){\framebox(\l@youthpii,\l@youtvdiii){}}
2473 \put(\l@youtxcii,\l@youtycii){\makebox(\l@youthpii,\l@youtvdiii)[r]%
2474 {\l@ylabelfont Label}}
2475 \end{picture}}
2476 % \end{macrocode}
2477 %
2478 % Draw the paragraph box.
2479 % \begin{macrocode}
2480 \put(\l@youtxci,\l@youtyciii){\begin{picture}(\l@youthdii,\l@youtvdi)
2481 % \end{macrocode}
2482 % The LH horizontal and vertical lines.
2483 % \begin{macrocode}
2484 \put(0,0){\line(1,0){\l@youthdii}}
2485 \put(0,0){\line(0,1){\l@youtvdo}}
2486 % \end{macrocode}
2487 % The inset lines.
2488 % \changes{v2.6a}{2002/12/12}{Added negative test to paragraph box in list layout}
2489 % \begin{macrocode}
2490 \ifnum\l@youthpvi < \z@
2491 \put(\l@youthpvi,\l@youtvdo){\line(1,0){-\l@youthpvi}}
2492 \else
2493 \put(\l@youthpvi,\l@youtvdo){\line(-1,0){\l@youthpvi}}
2494 \fi
2495 \put(\l@youthpvi,\l@youtvdo){\line(0,1){\l@youtvdii}}
2496 % \end{macrocode}
2497 % The top and RH side lines. Also the text.
2498 % \begin{macrocode}
2499 \put(\l@youthdii,\l@youtvdi){\line(0,-1){\l@youtvdi}}
2500 \put(\l@youthdii,\l@youtvdi){\line(-1,0){\l@youthdv}}
2501 \put(0,0){\makebox(\l@youthdii,\l@youtvdi){\l@ylabelfont Item 1, Paragraph 2}}
2502 \testdrawdimensions
2503 \ifl@ytempif
2504 % \end{macrocode}
2505 % Add in the dimensions if asked for. First the |listparindent|.
2506 % \begin{macrocode}
2507 \put(0,\l@youtvdi){\vector(1,0){\l@youthpvi}}
2508 \put(0,\l@youtvdi){\begin{picture}(\l@youtvdv,\l@youtvdv)
2509 \put(0,\l@youtvdv){\l@ypcmd{listparindent}}
2510 \end{picture}}
2511 % \end{macrocode}
2512 % Then the |leftmargin|.
2513 % \begin{macrocode}
2514 \put(-\l@youthpiv,\l@youtycvi){\vector(1,0){\l@youthpiv}}
2515 \put(-\l@youthpiv,\l@youtycvi){\begin{picture}(\l@youtvdv,\l@youtvdv)
2516 \put(\l@youtvdv,\l@youtvdv){\l@ypcmd{leftmargin}}
2517 \end{picture}}
2518 % \end{macrocode}
2519 % And finally the |rightmargin|.
2520 % \begin{macrocode}
2521 \ifnum\l@youthpv < \z@
2522 \put(\l@youthdii,\l@youtycvi){\line(-1,0){-\l@youthpv}}
2523 \else
2524 \put(\l@youthdii,\l@youtycvi){\line(1,0){\l@youthpv}}
2525 \fi
2526 \put(\l@youthdii,\l@youtycvi){\vector(-1,0){0}}
2527 \put(\l@youthdii,\l@youtycvi){\begin{picture}(\l@youtvdv,\l@youtvdv)
2528 \put(\l@youtvdv,\l@youtvdv){\l@ypcmd{rightmargin}}
2529 \end{picture}}
2530 \fi
2531 \end{picture}}
2532 % \end{macrocode}
2533 %
2534 % Draw item box 1. This is very similar to drawing item box 2.
2535 % \begin{macrocode}
2536 \put(\l@youtxci,\l@youtyciv){\begin{picture}(\l@youthdii,\l@youtvdi)
2537 \put(0,0){\line(1,0){\l@youthdii}}
2538 \put(0,0){\line(0,1){\l@youtvdo}}
2539 \ifnum\l@youthdiii > \z@
2540 \put(\l@youthdiii,\l@youtvdo){\line(-1,0){\l@youthdiii}}
2541 \else
2542 \put(\l@youthdiii,\l@youtvdo){\line(1,0){-\l@youthdiii}}
2543 \fi
2544 \put(\l@youthdiii,\l@youtvdo){\line(0,1){\l@youtvdii}}
2545 \put(\l@youthdii,\l@youtvdi){\line(0,-1){\l@youtvdi}}
2546 \put(\l@youthdii,\l@youtvdi){\line(-1,0){\l@youthdiv}}
2547 \put(0,0){\makebox(\l@youthdii,\l@youtvdi){\l@ylabelfont Item 1}}
2548 \put(\l@youtxcii,\l@youtycii){\framebox(\l@youthpii,\l@youtvdiii){}}
2549 \put(\l@youtxcii,\l@youtycii){\makebox(\l@youthpii,\l@youtvdiii)[r]%
2550 {\l@ylabelfont Label}}
2551 %% \ifdrawparameters
2552 \testdrawdimensions
2553 \ifl@ytempif
2554 % \end{macrocode}
2555 %
2556 % Howevever, if requested, dimensions are drawn for item box 1.
2557 % First, for |itemindent|.
2558 % \begin{macrocode}
2559 \ifnum\l@youthpi > \z@
2560 \put(0,\l@youtycvi){\vector(1,0){\l@youthpi}}
2561 \else
2562 \put(0,\l@youtycvi){\vector(-1,0){-\l@youthpi}}
2563 \fi
2564 \put(0,\l@youtycvi){\begin{picture}(\l@youtvdv,\l@youtvdv)
2565 \put(0,-\l@youtvdv){\l@ypcmd{itemindent}}
2566 \end{picture}}
2567 % \end{macrocode}
2568 % Then for |labelsep|.
2569 % \begin{macrocode}
2570 \put(\l@youthdiii,\l@youtvdi){\vector(-1,0){\l@youthpiii}}
2571 \put(\l@youthdiii,\l@youtvdi){\begin{picture}(\l@youtvdv,\l@youtvdv)
2572 \put(0,\l@youtvdv){\l@ypcmd{labelsep}}
2573 \end{picture}}
2574 % \end{macrocode}
2575 % And finish up with |labelwidth|.
2576 % \begin{macrocode}
2577 \put(\l@youtxcii,\l@youtxciv){\line(1,0){\l@youthpii}}
2578 \put(\l@youtxcii,\l@youtxciv){\vector(-1,0){0}}
2579 \put(\l@youtxcii,\l@youtxciv){\begin{picture}(\l@youtvdv,\l@youtvdv)
2580 \put(0,\l@youtvdv){\l@ypcmd{labelwidth}}
2581 \end{picture}}
2582 \fi
2583 \end{picture}}
2584 % \end{macrocode}
2585 %
2586 % Draw the predeccessor text box 1 inch deep.
2587 % \begin{macrocode}
2588 \put(0,\l@youtycv){\framebox(\l@youthdi,\l@yoneinch){\l@ylabelfont Preceding Text}}
2589 %% \ifdrawparameters
2590 \testdrawdimensions
2591 \ifl@ytempif
2592 % \end{macrocode}
2593 %
2594 % We finish off the drawing with any requested vertical spacing parameters.
2595 % First between item2 and the suceeding text.
2596 % \begin{macrocode}
2597 \put(\l@youtxciii,\l@youtyci){\vector(0,-1){\l@youtvdvii}}
2598 \put(\l@youtxciii,\l@youtyci){\begin{picture}(\l@youtvdv,\l@youtvdv)
2599 \put(\l@youtvdv,-\l@youtvdv){%
2600 \l@yparamfont\texttt{\bs topsep + \bs parskip [+ \bs partopsep]}}
2601 \end{picture}}
2602 % \end{macrocode}
2603 % Between item1, paragraph 2 and item 2.
2604 % \begin{macrocode}
2605 \put(\l@youtxciii,\l@youtyciii){\vector(0,-1){\l@youtvdvi}}
2606 \put(\l@youtxciii,\l@youtyciii){\begin{picture}(\l@youtvdv,\l@youtvdv)
2607 \put(\l@youtvdv,-\l@youtvdv){%
2608 \l@yparamfont\texttt{\bs itemsep + \bs parsep}}
2609 \end{picture}}
2610 % \end{macrocode}
2611 % Between the two paragraphs of item 1.
2612 % \begin{macrocode}
2613 \put(\l@youtxciii,\l@youtyciv){\vector(0,-1){\l@youtvpiv}}
2614 \put(\l@youtxciii,\l@youtyciv){\begin{picture}(\l@youtvdv,\l@youtvdv)
2615 \put(\l@youtvdv,-\l@youtvdv){\l@ypcmd{parsep}}
2616 \end{picture}}
2617 % \end{macrocode}
2618 % And finally between the preceding text and item 1.
2619 % \begin{macrocode}
2620 \put(\l@youtxciii,\l@youtycv){\vector(0,-1){\l@youtvdvii}}
2621 \put(\l@youtxciii,\l@youtycv){\begin{picture}(\l@youtvdv,\l@youtvdv)
2622 \put(\l@youtvdv,-\l@youtvdv){%
2623 \l@yparamfont\texttt{\bs topsep + \bs parskip [+ \bs partopsep]}}
2624 \end{picture}}
2625 \fi
2626 \end{picture}
2627 \end{center}
2628 \setlength{\unitlength}{1pt}
2629 % \end{macrocode}
2630 %
2631 % Last of all, we list the values of the parameters if requested.
2632 % \begin{macrocode}
2633 \testprintparameters
2634 \ifl@ytempif
2635 \begin{center}
2636 \begin{footnotesize}
2637 Lengths are to the nearest pt. \\
2638 \begin{ttfamily}
2639 \begin{tabular}{l@{\hspace{20pt}}l}
2640 \l@ycmd{leftmargin} = \number\l@youthpiv pt &
2641 \l@ycmd{rightmargin} = \number\l@youthpv pt \\
2642 \l@ycmd{itemindent} = \number\l@youthpi pt &
2643 \l@ycmd{labelwidth} = \number\l@youthpii pt \\
2644 \l@ycmd{labelsep} = \number\l@youthpiii pt &
2645 \l@ycmd{listparindent} = \number\l@youthpvi pt \\
2646 \l@ycmd{topsep} = \number\l@youtvpi pt &
2647 \l@ycmd{parskip} = \number\l@youtparskip pt \\
2648 \l@ycmd{partopsep} = \number\l@youtvpiii pt &
2649 \l@ycmd{parsep} = \number\l@youtvpiv pt \\
2650 \l@ycmd{itemsep} = \number\l@youtvpv pt & \\
2651 \end{tabular}
2652 \end{ttfamily}\end{footnotesize}
2653 \end{center}
2654 \fi
2655 % \end{macrocode}
2656 % The end of the definition for |\drawlist|.
2657 % \begin{macrocode}
2658 }
2659
2660 % \end{macrocode}
2661 % \end{macro}
2662 %
2663 %
2664 % \begin{macro}{\listdiagram}
2665 % \begin{macro}{\listdesign}
2666 % Shorthands.
2667 % \begin{macrocode}
2668 \newcommand{\listdiagram}{\drawparameterstrue\drawlist}
2669 \newcommand{\listdesign}{\drawparametersfalse\drawlist}
2670
2671 % \end{macrocode}
2672 % \end{macro}
2673 % \end{macro}
2674 %
2675 % \begin{macro}{\listvalues}
2676 % This macro produces a table of the current list layout actual values.
2677 % Be careful to get the external environment's values, not those of
2678 % the centered tabular.
2679 % \begin{macrocode}
2680 \newcommand{\listvalues}{%
2681 \setlength{\l@ylmarg}{\leftmargin}
2682 \setlength{\l@yrmarg}{\rightmargin}
2683 \setlength{\l@yitmindent}{\itemindent}
2684 \setlength{\l@ylblwidth}{\labelwidth}
2685 \setlength{\l@ylblsep}{\labelsep}
2686 \setlength{\l@ylparindent}{\listparindent}
2687 \setlength{\l@ytsep}{\topsep}
2688 \setlength{\l@ypskip}{\parskip}
2689 \setlength{\l@yptsep}{\partopsep}
2690 \setlength{\l@ypsep}{\parsep}
2691 \setlength{\l@yitmsep}{\itemsep}
2692 \ifprintheadings
2693 Actual list layout values.\\[\baselineskip]
2694 \fi
2695 \begingroup\l@yvalsize
2696 \begin{tabular}{l@{\hspace{20pt}}l}
2697 \l@ycmd{leftmargin} = \l@yval{\l@ylmarg} &
2698 \l@ycmd{rightmargin} = \l@yval{\l@yrmarg} \\
2699 \l@ycmd{itemindent} = \l@yval{\l@yitmindent} &
2700 \l@ycmd{labelwidth} = \l@yval{\l@ylblwidth} \\
2701 \l@ycmd{labelsep} = \l@yval{\l@ylblsep} &
2702 \l@ycmd{listparindent} = \l@yval{\l@ylparindent} \\
2703 \l@ycmd{topsep} = \l@yval{\l@ytsep} &
2704 \l@ycmd{parskip} = \l@yval{\l@ypskip} \\
2705 \l@ycmd{partopsep} = \l@yval{\l@yptsep} &
2706 \l@ycmd{parsep} = \l@yval{\l@ypsep} \\
2707 \l@ycmd{itemsep} = \l@yval{\l@yitmsep} & \\
2708 1em = \l@yval{\l@yonem} & 1ex = \l@yval{\l@yonex} \\
2709 \end{tabular}
2710 \endgroup
2711 }
2712
2713 % \end{macrocode}
2714 % \end{macro}
2715 %
2716 %
2717 %
2718 % \section{Drawing the layout of footnotes}
2719 %
2720 % We provide a facility for drawing the layout of footnotes.
2721 %
2722 % First the |\try...| commands for setting trial values of the footnote
2723 % parameters.
2724 %
2725 % \begin{macro}{\tryfootins}
2726 % Sets the trial value for |footins| and stores the result in |\l@youtvpi|.
2727 % \begin{macrocode}
2728
2729 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2730 %%%% FOOTNOTE LAYOUT
2731 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2732
2733 \newcommand{\tryfootins}[1]{\l@yltoc{#1}{\l@youtvpi}}
2734 % \end{macrocode}
2735 % \end{macro}
2736 %
2737 % \begin{macro}{\tryfootnotesep}
2738 % Sets the trial value for |footnotesep| and stores the result in |\l@youtvpii|.
2739 % \begin{macrocode}
2740 \newcommand{\tryfootnotesep}[1]{\l@yltoc{#1}{\l@youtvpii}}
2741 % \end{macrocode}
2742 % \end{macro}
2743 %
2744 % \begin{macro}{\tryfootnotebaseline}
2745 % Sets the trial value for |footnotebaseline| and stores the result in |\l@youtvpiii|.
2746 % \begin{macrocode}
2747 \newcommand{\tryfootnotebaseline}[1]{\l@yltoc{#1}{\l@youtvpiii}}
2748 % \end{macrocode}
2749 % \end{macro}
2750 %
2751 % \begin{macro}{\tryfootruleheight}
2752 % Sets the trial value for |footruleheight| and stores the result in |\l@youtlinethick|.
2753 % \begin{macrocode}
2754 \newcommand{\tryfootruleheight}[1]{\setlength{\l@youtlinethick}{#1}}
2755 % \end{macrocode}
2756 % \end{macro}
2757 %
2758 % \begin{macro}{\tryfootrulefrac}
2759 % Sets the trial value for |footrulefrac| and stores the result in |\l@youthdvii|.
2760 % \begin{macrocode}
2761 \newcommand{\tryfootrulefrac}[1]{\setlength{\l@ylen}{8.5in}
2762 \l@ytok={#1}
2763 \l@ylen = #1\l@ylen
2764 \l@youthdvii=\l@ylen
2765 \divide\l@youthdvii by \l@yonepoint}
2766
2767 % \end{macrocode}
2768 % \end{macro}
2769 %
2770 % \begin{macro}{\currentfootnote}
2771 %
2772 % This routine sets the trial footnote parameters to be those specified
2773 % for the current document. Some parameters have the values embedded as
2774 % numbers in the class/options files; for these we make an educated
2775 % guess at a typical value.
2776 % \begin{macrocode}
2777 \newcommand{\currentfootnote}{%
2778 \tryfootins{\skip\footins}
2779 \tryfootnotesep{\footnotesep}
2780 \tryfootnotebaseline{10pt}
2781 \tryfootruleheight{0.4pt}
2782 \tryfootrulefrac{0.25}
2783 }
2784
2785 % \end{macrocode}
2786 % \end{macro}
2787 %
2788 % \begin{macro}{\drawfootnote}
2789 %
2790 % This routine draws the layout of a footnote.
2791 % \begin{macrocode}
2792 \newcommand{\drawfootnote}{%
2793 % \end{macrocode}
2794 % Set some default values.
2795 % \begin{macrocode}
2796 \l@youtvdo=4\relax % vertical scale factor
2797 \l@youthdi=\l@yeighthalfinch\relax % textwidth
2798 \l@youtvdi=\l@yoneinch\relax % small height of note box
2799 \ifdrawparameters
2800 % \end{macrocode}
2801 % When |drawparameters| is TRUE we use a generic layout. Set the dimensions
2802 % and coordinates.
2803 % \begin{macrocode}
2804 \l@youtvpi=20\relax % \skip\footins
2805 \l@youtvpii=30\relax % footenotesep
2806 \l@youtvpiii=10\relax % footnote baseline
2807 \setlength{\l@youtlinethick}{0.4pt} % rule thickness
2808 \l@youthdvii=\l@yeighthalfinch\relax % rule length
2809 \multiply\l@youthdvii by 4\relax
2810 \divide\l@youthdvii by 10\relax
2811 \l@youtvdii=\l@youtvpiii % vertical box inset
2812 \multiply\l@youtvdii by \l@youtvdo
2813 \else
2814 % \end{macrocode}
2815 % Continue calculating the drawing parameters.
2816 % \begin{macrocode}
2817 \l@youtvdii=\l@youtvpiii % vertical box inset
2818 \multiply\l@youtvdii by \l@youtvdo
2819 \multiply\l@youtvdii by 8\relax
2820 \divide\l@youtvdii by 10\relax
2821 \fi
2822 \multiply\l@youtvdii by 3\relax
2823 \divide\l@youtvdii by 4\relax
2824 \l@youtvdv=\l@youtvpi % Y dim of footins
2825 \multiply\l@youtvdv by \l@youtvdo
2826 \l@youthdii=\l@youtvdii % horizontal box inset
2827 \l@youtvdiii=\l@youtvdi % box height
2828 \advance\l@youtvdiii by \l@youthdii
2829 \l@youthdiii=\l@youthdi % box top length
2830 \advance\l@youthdiii by -\l@youthdii
2831 \l@youtvdiv=\l@youtvpii % vertical note spacing
2832 \ifnum\l@youtvdiv < \l@youtvpiii
2833 \l@youtvdiv=\l@youtvpiii
2834 \fi
2835 \multiply\l@youtvdiv by \l@youtvdo
2836 \l@youtyci=\l@youtvdi % Y coord of 1st box base
2837 \advance\l@youtyci by \l@youtvdiv
2838 \l@youtycii=\l@youtyci % Y coord of rule
2839 \advance\l@youtycii by \l@youtyci
2840 \l@youtyciii=\l@youtycii % Y coord of text base
2841 \advance\l@youtyciii by \l@youtvdv
2842 \l@youtyciv=\l@youtyciii % top of main text box
2843 \advance\l@youtyciv by \l@yoneinch\relax
2844 \l@youthdiv=\l@youthdvii % length of rule
2845 \l@youtvdvi=\l@youtvpiv % height of rule
2846 \multiply\l@youtvdvi by \l@youtvdo
2847 \l@youthdv=\l@youthdii % small value (1/2 box inset)
2848 \divide\l@youthdv by \tw@
2849 \l@youthdvi=\l@youthdv % 1/2 l@youthdv
2850 \divide\l@youthdvi by \tw@
2851 % \end{macrocode}
2852 %
2853 % Draw the picture!
2854 % \begin{macrocode}
2855 \begin{center}
2856 \setlength{\unitlength}{\l@youtunitlength}
2857 \begin{picture}(\l@youthdi,\l@youtyciv)
2858 \thicklines
2859 % \end{macrocode}
2860 % Draw box 2. First the major bottom and LH side lines.
2861 % \begin{macrocode}
2862 \put(0,0){\begin{picture}(\l@youthdi,\l@youtvdiii)
2863 \put(0,0){\line(1,0){\l@youthdi}}
2864 \put(0,0){\line(0,1){\l@youtvdi}}
2865 % \end{macrocode}
2866 % The inset lines
2867 % \begin{macrocode}
2868 \put(\l@youthdii,\l@youtvdi){\line(-1,0){\l@youthdii}}
2869 \put(\l@youthdii,\l@youtvdi){\line(0,1){\l@youtvdii}}
2870 % \end{macrocode}
2871 % The top and RH side lines.
2872 % \begin{macrocode}
2873 \put(\l@youthdi,\l@youtvdiii){\line(-1,0){\l@youthdiii}}
2874 \put(\l@youthdi,\l@youtvdiii){\line(0,-1){\l@youtvdiii}}
2875 % \end{macrocode}
2876 % Finish with the marker.
2877 % \begin{macrocode}
2878 \put(\l@youthdv,\l@youtvdiii){\makebox(0,0)[t]{2}}
2879 \end{picture}}
2880 % \end{macrocode}
2881 % The drawing of box 1 is similar.
2882 % \begin{macrocode}
2883 \put(0,\l@youtyci){\begin{picture}(\l@youthdi,\l@youtvdiii)
2884 \put(0,0){\line(1,0){\l@youthdi}}
2885 \put(0,0){\line(0,1){\l@youtvdi}}
2886 \put(\l@youthdii,\l@youtvdi){\line(-1,0){\l@youthdii}}
2887 \put(\l@youthdii,\l@youtvdi){\line(0,1){\l@youtvdii}}
2888 \put(\l@youthdi,\l@youtvdiii){\line(-1,0){\l@youthdiii}}
2889 \put(\l@youthdi,\l@youtvdiii){\line(0,-1){\l@youtvdiii}}
2890 \put(\l@youthdv,\l@youtvdiii){\makebox(0,0)[t]{1}}
2891 \end{picture}}
2892 % \end{macrocode}
2893 % Draw the rule.
2894 % \begin{macrocode}
2895 \multiply\l@youtlinethick by \l@youtvdo
2896 \linethickness{\l@youtlinethick}
2897 \put(0,\l@youtycii){\line(1,0){\l@youthdvii}}
2898 \thicklines
2899 % \end{macrocode}
2900 % Draw the main text box
2901 % \begin{macrocode}
2902 \put(0,\l@youtyciii){\framebox(\l@youthdi,\l@yoneinch){\l@ylabelfont MAIN TEXT}}
2903 \testdrawdimensions
2904 \ifl@ytempif
2905 \thinlines
2906 % \end{macrocode}
2907 %
2908 % We finish off the drawing with spacing parameters, if requested.
2909 %
2910 % Bottom |footnotesep|.
2911 % \begin{macrocode}
2912 \put(\l@youthdvi,\l@youtyci){\vector(0,-1){\l@youtvdiv}}
2913 \put(\l@youthdvi,\l@youtyci){\begin{picture}(\l@youthdv,\l@youthdv)
2914 \put(\l@youthdvi,-\l@youthdv){\l@ypcmd{footnotesep}}
2915 \end{picture}}
2916 % \end{macrocode}
2917 % Top |footnotesep|.
2918 % \begin{macrocode}
2919 \put(\l@youthdvi,\l@youtycii){\vector(0,-1){\l@youtvdiv}}
2920 \put(\l@youthdvi,\l@youtycii){\begin{picture}(\l@youthdv,\l@youthdv)
2921 \put(\l@youthdvi,-\l@youthdv){\l@ypcmd{footnotesep}}
2922 \end{picture}}
2923 % \end{macrocode}
2924 % The |\skip\footins|.
2925 % \begin{macrocode}
2926 \put(\l@youthdii,\l@youtyciii){\vector(0,-1){\l@youtvdv}}
2927 \put(\l@youthdii,\l@youtyciii){\begin{picture}(\l@youthdv,\l@youthdv)
2928 \put(\l@youthdvi,-\l@youthdv){\l@ypcmd{skip}\l@ypcmd{footins}}
2929 \end{picture}}
2930 % \end{macrocode}
2931 % The rule.
2932 % \begin{macrocode}
2933 \put(\l@youthdiv,\l@youtycii){\begin{picture}(\l@youthdv,\l@youthdv)
2934 \put(\l@youthdv,0){\l@ypcmd{footnoterule}}
2935 \end{picture}}
2936 \fi
2937 % \end{macrocode}
2938 % Finish off the picture.
2939 % \begin{macrocode}
2940 \end{picture}
2941 \end{center}
2942 \setlength{\unitlength}{1pt}
2943 % \end{macrocode}
2944 %
2945 % Print the value table if appropriate.
2946 % \begin{macrocode}
2947 \testprintparameters
2948 \ifl@ytempif
2949 \begin{center}
2950 \begin{footnotesize}
2951 Lengths are to the nearest pt. \\
2952 \begin{ttfamily}
2953 \begin{tabular}{l@{\hspace{20pt}}l}
2954 \l@ycmd{footins} = \number\l@youtvpi pt &
2955 \l@ycmd{footnotesep} = \number\l@youtvpii pt \\
2956 \l@ycmd{baselineskip} = \number\l@youtvpiii pt &
2957 \textrm{note separation} = \number\l@youtvdiv pt \\
2958 \textrm{rule thickness} = \the\l@youtlinethick & \\
2959 \multicolumn{2}{c}{\textrm{rule length} = \the\l@ytok{} times the \bs textwidth} \\
2960 \end{tabular}
2961 \end{ttfamily}\end{footnotesize}
2962 \end{center}
2963 \fi
2964 % \end{macrocode}
2965 % The end of the definition of |\drawfootnote|.
2966 % \begin{macrocode}
2967 }
2968
2969 % \end{macrocode}
2970 % \end{macro}
2971 %
2972 %
2973 % \begin{macro}{\footnotediagram}
2974 % \begin{macro}{\footnotedesign}
2975 % Shorthands.
2976 % \begin{macrocode}
2977 \newcommand{\footnotediagram}{\drawparameterstrue\drawfootnote}
2978 \newcommand{\footnotedesign}{\drawparametersfalse\drawfootnote}
2979
2980 % \end{macrocode}
2981 % \end{macro}
2982 % \end{macro}
2983 %
2984 % \begin{macro}{\footnotevalues}
2985 % This macro produces a table of the current footnote layout actual values.
2986 % \begin{macrocode}
2987 \newcommand{\footnotevalues}{%
2988 \setlength{\l@ylen}{\columnwidth}
2989 \l@ylen = .4\l@ylen
2990 \ifprintheadings
2991 Actual footnote layout values.\\[\baselineskip]
2992 \fi
2993 \begingroup\l@yvalsize
2994 \begin{tabular}{l@{\hspace{20pt}}l}
2995 \l@ycmd{footins} = \l@yval{\skip\footins} &
2996 \l@ycmd{footnotesep} = \l@yval{\footnotesep} \\
2997 rule thickness = ?? &
2998 rule length = ?? \\
2999 1em = \l@yval{\l@yonem} & 1ex = \l@yval{\l@yonex} \\
3000 \end{tabular}
3001 \endgroup
3002 }
3003
3004 % \end{macrocode}
3005 % \end{macro}
3006 %
3007 %
3008 % \section{Drawing the layout of paragraphs}
3009 %
3010 % We provide a facility for drawing the layout of paragraphs.
3011 %
3012 % First the |\try...| commands for setting trial values of the paragraph
3013 % parameters.
3014 %
3015 % \begin{macro}{\tryparindent}
3016 % Sets the trial value for |\parindent| and stores the result in |\l@youthdii|.
3017 % \begin{macrocode}
3018
3019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3020 %%%% PARAGRAPH LAYOUT
3021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3022
3023 \newcommand{\tryparindent}[1]{\l@yltoc{#1}{\l@youthdii}}
3024 % \end{macrocode}
3025 % \end{macro}
3026 %
3027 %
3028 % \begin{macro}{\tryparlinewidth}
3029 % Sets the trial value for |\linewidth| and stores the result in |\l@youthdi|.
3030 % \begin{macrocode}
3031 \newcommand{\tryparlinewidth}[1]{\l@yltoc{#1}{\l@youthdi}}
3032 % \end{macrocode}
3033 % \end{macro}
3034 %
3035 % \begin{macro}{\tryparbaselineskip}
3036 % Sets the trial value for |\baselineskip| and stores the result in |\l@youtvdii|.
3037 % \begin{macrocode}
3038 \newcommand{\tryparbaselineskip}[1]{\l@yltoc{#1}{\l@youtvdii}}
3039
3040 % \end{macrocode}
3041 % \end{macro}
3042 %
3043 % \begin{macro}{\currentparagraph}
3044 %
3045 % This routine sets the trial paragraph parameters to be those specified
3046 % for the current document.
3047 % \begin{macrocode}
3048 \newcommand{\currentparagraph}{%
3049 \tryparindent{\parindent}
3050 \tryparskip{\parskip}
3051 \tryparlinewidth{\linewidth}
3052 \tryparbaselineskip{\baselineskip}
3053 }
3054
3055 % \end{macrocode}
3056 % \end{macro}
3057 %
3058 % \begin{macro}{\drawparagraph}
3059 %
3060 % This routine draws the layout of a paragraph.
3061 % \begin{macrocode}
3062 \newcommand{\drawparagraph}{%
3063 % \end{macrocode}
3064 % Set some default values.
3065 % \begin{macrocode}
3066 \l@youtvdi=\l@yoneinch\relax % height of bottom of inset box
3067 \ifdrawparameters
3068 % \end{macrocode}
3069 % When |drawparameters| is TRUE we use a generic layout. Set the dimensions
3070 % and coordinates.
3071 % \begin{macrocode}
3072 \l@youtvdii=15\relax % \baselineskip
3073 \l@youthdii=40\relax % \parindent
3074 \l@youtparskip=30\relax % \parskip
3075 \l@youthdi=\l@yeighthalfinch\relax % linewidth
3076 \fi
3077 % \end{macrocode}
3078 % Continue calculating the drawing parameters.
3079 % \begin{macrocode}
3080 \l@youtvdiii=\l@youtvdi % total height of para box
3081 \advance\l@youtvdiii by \l@youtvdii
3082 \l@youtvdiv=\l@youtvdiii % bottom of Preceding box
3083 \advance\l@youtvdiv by \l@youtparskip
3084 \l@youtvdv=\l@youtvdiv % total picture height
3085 \advance\l@youtvdv by \l@yoneinch\relax
3086 \l@youthdiii=\l@youthdi % length of top of para box
3087 \advance\l@youthdiii by -\l@youthdii
3088 \l@youtxci=\l@youthdi % x coord of middle of picture
3089 \divide\l@youtxci by \tw@
3090 \l@youthdv=10\relax % small value
3091 \l@youthdvi=5\relax % 1/2 l@youthdv
3092 % \end{macrocode}
3093 %
3094 % Draw the picture!
3095 % \begin{macrocode}
3096 \begin{center}
3097 \setlength{\unitlength}{\l@youtunitlength}
3098 \begin{picture}(\l@youthdi,\l@youtvdv)
3099 \thicklines
3100 % \end{macrocode}
3101 % Draw paragraph box. First the major bottom and LH side lines.
3102 % \begin{macrocode}
3103 \put(0,0){\begin{picture}(\l@youthdi,\l@youtvdiii)
3104 \put(0,0){\line(1,0){\l@youthdi}}
3105 \put(0,0){\line(0,1){\l@youtvdi}}
3106 % \end{macrocode}
3107 % The inset lines
3108 % \begin{macrocode}
3109 \ifnum\l@youthdii < \z@
3110 \l@youthdv=-\l@youthdii
3111 \put(\l@youthdii,\l@youtvdi){\line(1,0){\l@youthdv}}
3112 \else
3113 \put(\l@youthdii,\l@youtvdi){\line(-1,0){\l@youthdii}}
3114 \fi
3115 \put(\l@youthdii,\l@youtvdi){\line(0,1){\l@youtvdii}}
3116 % \end{macrocode}
3117 % The top and RH side lines.
3118 % \begin{macrocode}
3119 \put(\l@youthdi,\l@youtvdiii){\line(-1,0){\l@youthdiii}}
3120 \put(\l@youthdi,\l@youtvdiii){\line(0,-1){\l@youtvdiii}}
3121 \end{picture}}
3122 % \end{macrocode}
3123 % Now for the top box.
3124 % \begin{macrocode}
3125 \put(0,\l@youtvdiv){\framebox(\l@youthdi,\l@yoneinch){\l@ylabelfont Preceding Text}}
3126 % \end{macrocode}
3127 % Finished the main drawing.
3128 % \begin{macrocode}
3129 \testdrawdimensions
3130 \ifl@ytempif
3131 \thinlines
3132 % \end{macrocode}
3133 %
3134 % We finish off the drawing with spacing parameters, if requested.
3135 % \changes{v2.5}{2001/10/21}{Changed test for paragraph dimensions}
3136 % The |\parskip|.
3137 % \begin{macrocode}
3138 \put(\l@youtxci,\l@youtvdiv){\begin{picture}(\l@youthdv,\l@youthdv)
3139 \put(0,0){\vector(0,-1){\l@youtparskip}}
3140 \put(\l@youthdvi,-\l@youthdv){\l@ypcmd{parskip}}
3141 \end{picture}}
3142 % \end{macrocode}
3143 % The |\parindent|.
3144 % \begin{macrocode}
3145 \put(0,\l@youtvdiii){\begin{picture}(\l@youthdv,\l@youthdv)
3146 \ifnum\l@youthdii < \z@
3147 \put(0,0){\vector(-1,0){-\l@youthdii}}
3148 \put(0,0){\vector(1,0){0}}
3149 \else
3150 \put(0,0){\vector(1,0){\l@youthdii}}
3151 \fi
3152 \put(0,\l@youthdv){\l@ypcmd{parindent}}
3153 \end{picture}}
3154 \fi
3155 % \end{macrocode}
3156 % Finish off the picture.
3157 % \begin{macrocode}
3158 \end{picture}
3159 \end{center}
3160 \setlength{\unitlength}{1pt}
3161 % \end{macrocode}
3162 %
3163 % Print the value table if appropriate.
3164 % \changes{v2.5}{2001/10/21}{Changed test for paragraph value table}
3165 % \begin{macrocode}
3166 \testprintparameters
3167 \ifl@ytempif
3168 \begin{center}
3169 \begin{footnotesize}
3170 Lengths are to the nearest pt. \\
3171 \begin{ttfamily}
3172 \begin{tabular}{l@{\hspace{20pt}}l}
3173 \l@ycmd{parindent} = \number\l@youthdii pt &
3174 \l@ycmd{parskip} = \number\l@youtparskip pt \\
3175 \l@ycmd{baselineskip} = \number\l@youtvdii pt &
3176 \l@ycmd{linewidth} = \number\l@youthdi pt \\
3177 \end{tabular}
3178 \end{ttfamily}\end{footnotesize}
3179 \end{center}
3180 \fi
3181 % \end{macrocode}
3182 % The end of the definition of |\drawparagraph|.
3183 % \begin{macrocode}
3184 }
3185
3186 % \end{macrocode}
3187 % \end{macro}
3188 %
3189 %
3190 %
3191 %
3192 % \begin{macro}{\paragraphdiagram}
3193 % \begin{macro}{\paragraphdesign}
3194 % Shorthands.
3195 % \begin{macrocode}
3196 \newcommand{\paragraphdiagram}{\drawparameterstrue\drawparagraph}
3197 \newcommand{\paragraphdesign}{\drawparametersfalse\drawparagraph}
3198
3199 % \end{macrocode}
3200 % \end{macro}
3201 % \end{macro}
3202 %
3203 % \begin{macro}{\paragraphvalues}
3204 % This macro produces a table of the current paragraph layout actual values.
3205 % Be careful to get the global, not local, values.
3206 % \begin{macrocode}
3207 \newcommand{\paragraphvalues}{%
3208 \setlength{\l@ylen}{\parindent}
3209 \ifprintheadings
3210 Actual paragraph layout values.\\[\baselineskip]
3211 \fi
3212 \begingroup\l@yvalsize
3213 \begin{tabular}{l@{\hspace{20pt}}l}
3214 \l@ycmd{parindent} = \l@yval{\l@ylen} &
3215 \l@ycmd{parskip} = \l@yval{\l@ysetupparskip} \\
3216 \l@ycmd{baselineskip} = \l@yval{\l@ysetupbaselineskip} &
3217 \l@ycmd{linewidth} = \l@yval{\linewidth} \\
3218 1em = \l@yval{\l@yonem} & 1ex = \l@yval{\l@yonex} \\
3219 \end{tabular}
3220 \endgroup
3221 }
3222
3223 % \end{macrocode}
3224 % \end{macro}
3225 %
3226 % \section{Drawing the layout of section headings}
3227 %
3228 % We provide a facility for illustrating the layout of sectional headings.
3229 %
3230 % First the |\try...| commands for setting trial values for the heading
3231 % parameters.
3232 %
3233 % \begin{macro}{\trybeforeskip}
3234 % Sets the trial value for |beforeskip| and stores the result in |\l@youtvpi|.
3235 % \begin{macrocode}
3236
3237 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3238 %%%% SECTION HEADING LAYOUT
3239 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3240
3241 \newcommand{\trybeforeskip}[1]{\l@yltoc{#1}{\l@youtvpi}}
3242 % \end{macrocode}
3243 % \end{macro}
3244 %
3245 % \begin{macro}{\tryafterskip}
3246 % Sets the trial value for |afterskip| and stores the result in |\l@youtvpii|.
3247 % \begin{macrocode}
3248 \newcommand{\tryafterskip}[1]{\l@yltoc{#1}{\l@youtvpii}}
3249 % \end{macrocode}
3250 % \end{macro}
3251 %
3252 % \begin{macro}{\tryindent}
3253 % Sets the trial value for |indent| and stores the result in |\l@youthpi|.
3254 % \begin{macrocode}
3255 \newcommand{\tryindent}[1]{\l@yltoc{#1}{\l@youthpi}}
3256
3257 % \end{macrocode}
3258 % \end{macro}
3259 %
3260 % \begin{macro}{\currentheading}
3261 % This routine sets the trial heading parameters to some predefined
3262 % values that, hopefully, are reasonably representative.
3263 % \begin{macrocode}
3264 \newcommand{\currentheading}{%
3265 \trybeforeskip{2\l@ysetupbaselineskip}
3266 \tryafterskip{\l@ysetupbaselineskip}
3267 \tryindent{2\l@ysetupbaselineskip}
3268 \tryparskip{\l@ysetupparskip}
3269 }
3270
3271 % \end{macrocode}
3272 % \end{macro}
3273 %
3274 % \begin{macro}{\drawheading}
3275 % This routine draws the layout of a sectional heading. The command
3276 % takes a single parameter, |\drawheading{|\meta{font style}|}|, which
3277 % specifies the size and style of the heading font. For example, \\
3278 % |\drawheading{\Large\sffamily}|
3279 % \begin{macrocode}
3280 \newcommand{\drawheading}[1]{%
3281 % \end{macrocode}
3282 %
3283 % Some default values first.
3284 % \begin{macrocode}
3285 \l@yltoc{\textwidth}{\l@youthdi} % textwidth
3286 \l@yltoc{\baselineskip}{\l@youtvdi} % baselineskip
3287 \ifdrawparameters
3288 % \end{macrocode}
3289 % When |drawparameters| is TRUE we use a generic layout. Set the dimensions
3290 % and coordinates.
3291 % \begin{macrocode}
3292 \Huge \l@youtvdii=\baselineskip \normalsize % Heading baselineskip
3293 \divide\l@youtvdii by \l@yonepoint
3294 \l@yltoc{40pt}{\l@youtvpi} % beforeskip
3295 \ifruninhead
3296 % \end{macrocode}
3297 % We need different values for the afterskip and indent depending on whether
3298 % we are drawing a run-in heading or an ordinary one.
3299 % \begin{macrocode}
3300 \l@yltoc{-72pt}{\l@youtvpii} % afterskip
3301 \l@yltoc{50pt}{\l@youthpi} % indent
3302 \else
3303 \l@yltoc{45pt}{\l@youtvpii} % afterskip
3304 \l@yltoc{72pt}{\l@youthpi} % indent
3305 \fi
3306 % \end{macrocode}
3307 % Calculate the width of a sample heading title text.
3308 % \begin{macrocode}
3309 \setbox0 = \hbox{{\Huge 3.5 Heading Title }}
3310 \l@yltoc{\wd0}{\l@youthdv} % width of heading text
3311 \else
3312 % \end{macrocode}
3313 % When |drawparameters| is FALSE, we calculate the heading |baselineskip|
3314 % and width of the text in the trial font.
3315 % \begin{macrocode}
3316 {#1 \l@youtvdii=\baselineskip\normalfont\normalsize} % heading baselineskip
3317 \divide\l@youtvdii by \l@yonepoint
3318 \setbox0 = \hbox{{#1 3.5 Heading Title }}
3319 \l@yltoc{\wd0}{\l@youthdv} % width of heading text
3320 \fi
3321 % \end{macrocode}
3322 % Now continue setting all the other drawing lengths and coordinates.
3323 % \begin{macrocode}
3324 \l@youtvdiii=\l@youtvpii % afterskip + parskip + textbaselineskip
3325 \advance\l@youtvdiii by \l@youtparskip
3326 \advance\l@youtvdiii by \l@youtvdi
3327 \l@youtvdiv=\l@youtvpi % beforeskip + parskip + headbaselineskip
3328 \ifnum\l@youtvdiv < \z@
3329 % \end{macrocode}
3330 % A negative value for the |indent| signals no indentation of the first
3331 % line of text after the heading.
3332 % \begin{macrocode}
3333 \l@youtvdiv = -\l@youtvdiv
3334 \fi
3335 \advance\l@youtvdiv by \l@youtparskip
3336 \advance\l@youtvdiv by \l@youtvdii
3337 \l@youtyci=\l@youtvdi % Y coord of base of after text
3338 \l@youtycii=\l@youtyci % Y coord of base of heading text
3339 \advance\l@youtycii by \l@youtvdiii
3340 % \end{macrocode}
3341 % We have to handle the case of a negative |afterskip| indicating a
3342 % run-in heading. |l@youthdiv| is
3343 % set to either zero of the absolute value of the negative |afterskip|.
3344 % \begin{macrocode}
3345 \l@youthdiv=\z@ % 0 or abs(-afterskip)
3346 \ifnum\l@youtvpii < \z@
3347 \l@youthdiv = -\l@youtvpii
3348 \l@youtvdiii=\l@youtvdi % textbaselineskip
3349 \l@youtxci=\l@youthpi % X coord of end of heading text
3350 \advance\l@youtxci by \l@youthdv
3351 \l@youtxcii=\l@youtxci % X coord of start of after text
3352 \advance\l@youtxcii by \l@youthdiv
3353 \l@youtycii=\l@youtvdi % Y coord of base of heading text
3354 \fi
3355 % \end{macrocode}
3356 % Continue.
3357 % \begin{macrocode}
3358 \l@youtyciii=\l@youtycii % Y coord of base of prior text
3359 \advance\l@youtyciii by \l@youtvdiv
3360 \l@youtyciv=\l@youtyciii % Y coord of top of prior text
3361 \advance\l@youtyciv by \l@youtvdi
3362 \l@youtycv=\l@youtyciv % 2*l@youtvdi + l@youtyciv
3363 \advance\l@youtycv by \l@youtvdi
3364 \advance\l@youtycv by \l@youtvdi
3365 \l@youthdii=\l@youtvdi % a small amount
3366 \l@youthdiii=\l@youthdii % half a small amount
3367 \divide\l@youthdiii by \tw@
3368 % \end{macrocode}
3369 %
3370 % Draw the picture!
3371 %
3372 % \begin{macrocode}
3373 \begin{center}
3374 \setlength{\unitlength}{\l@youtunitlength}
3375 \begin{picture}(\l@youthdi,\l@youtycv)
3376 \ifnum\l@youtvpii < \z@
3377 \put(0,\l@youtyci){\begin{picture}(\l@youthdi,\l@youtyciv)
3378 % \end{macrocode}
3379 %
3380 % When the |afterskip| is negative we have a run-in heading.
3381 %
3382 % Draw the bottom text line
3383 % \begin{macrocode}
3384 \put(0,0){\l@ylabelfont second line of text following the heading \ldots}
3385 % \end{macrocode}
3386 % Draw the heading
3387 % \begin{macrocode}
3388 \ifdrawparameters
3389 \put(\l@youthpi,\l@youtycii){{\Huge 3.5 Heading Title}}
3390 \else
3391 \put(\l@youthpi,\l@youtycii){{#1 3.5 Heading Title}}
3392 \fi
3393 % \end{macrocode}
3394 % Draw the first line of text after the heading, and the preceding text line.
3395 % \begin{macrocode}
3396 \put(\l@youtxcii,\l@youtycii){\l@ylabelfont Start of text \ldots}
3397 \put(0,\l@youtyciii){\l@ylabelfont \ldots end of last line of preceding text.}
3398 %% \ifdrawparameters
3399 \testdrawdimensions
3400 \ifl@ytempif
3401 % \end{macrocode}
3402 % Draw the dimensions if required. First the before skips.
3403 % \begin{macrocode}
3404 \put(0,\l@youtyciii){\vector(0,-1){\l@youtvdiv}}
3405 \put(0,\l@youtyciii){\begin{picture}(\l@youthdii,\l@youthdii)
3406 \put(\l@youthdiii,-\l@youthdii){\makebox(0,0)[tl]%
3407 {\l@yparamfont \textit{$\|$beforeskip$\|$} +
3408 \l@ypcmd{parskip} (of text font) + \l@ypcmd{baselineskip}
3409 (of heading font)}}
3410 \end{picture}}
3411 % \end{macrocode}
3412 % The indent.
3413 % \begin{macrocode}
3414 \put(0,\l@youtycii){\vector(1,0){\l@youthpi}}
3415 \put(0,\l@youtycii){\begin{picture}(\l@youthdii,\l@youthdii)
3416 \put(\l@youthdii,\l@youthdiii){\l@yparamfont \textit{indent}}
3417 \end{picture}}
3418 % \end{macrocode}
3419 % And finish with the negative afterskip
3420 % \begin{macrocode}
3421 \put(\l@youtxci,\l@youtycii){\vector(1,0){\l@youthdiv}}
3422 \put(\l@youtxci,\l@youtycii){\begin{picture}(\l@youthdii,\l@youthdii)
3423 \put(\l@youthdiii,\l@youthdii){\l@yparamfont \textit{afterskip} ($< 0$)}
3424 \end{picture}}
3425 \fi
3426 \end{picture}}
3427 \else
3428 \put(0,\l@youtyci){\begin{picture}(\l@youthdi,\l@youtyciv)
3429 % \end{macrocode}
3430 % The aftterskip is positive, so we draw a normal heading.
3431 %
3432 % Draw the two after heading text lines
3433 % \begin{macrocode}
3434 \put(0,0){\l@ylabelfont second line of text following the heading \ldots}
3435 \put(0,\l@youtyci){\l@ylabelfont This is the start of the after-heading text,
3436 which continues on \ldots}
3437 % \end{macrocode}
3438 % Draw the heading
3439 % \begin{macrocode}
3440 \ifdrawparameters
3441 \put(\l@youthpi,\l@youtycii){{\Huge 3.5 Heading Title}}
3442 \else
3443 \put(\l@youthpi,\l@youtycii){{#1 3.5 Heading Title}}
3444 \fi
3445 % \end{macrocode}
3446 % Draw the text line preceding the heading.
3447 % \begin{macrocode}
3448 \put(0,\l@youtyciii){\l@ylabelfont \ldots end of last line of preceding text.}
3449 %% \ifdrawparameters
3450 \testdrawdimensions
3451 \ifl@ytempif
3452 % \end{macrocode}
3453 % Draw the dimensions if required. First the before skips.
3454 % \begin{macrocode}
3455 \put(0,\l@youtyciii){\vector(0,-1){\l@youtvdiv}}
3456 \put(0,\l@youtyciii){\begin{picture}(\l@youthdii,\l@youthdii)
3457 \put(\l@youthdiii,-\l@youthdii){\makebox(0,0)[tl]%
3458 {\l@yparamfont \textit{$\|$beforeskip$\|$} +
3459 \l@ypcmd{parskip} (of text font) + \l@ypcmd{baselineskip}
3460 (of heading font)}}
3461 \end{picture}}
3462 % \end{macrocode}
3463 % The indent.
3464 % \begin{macrocode}
3465 \put(0,\l@youtycii){\vector(1,0){\l@youthpi}}
3466 \put(0,\l@youtycii){\begin{picture}(\l@youthdii,\l@youthdii)
3467 \put(\l@youthdii,\l@youthdiii){\l@yparamfont \textit{indent}}
3468 \end{picture}}
3469 % \end{macrocode}
3470 % And finish with the afterskips
3471 % \begin{macrocode}
3472 \put(0,\l@youtycii){\vector(0,-1){\l@youtvdiii}}
3473 \put(0,\l@youtycii){\begin{picture}(\l@youthdii,\l@youthdii)
3474 \put(\l@youthdiii,-\l@youthdii){\makebox(0,0)[tl]%
3475 {\l@yparamfont \textit{afterskip} +
3476 \l@ypcmd{parskip} (of heading font) + \l@ypcmd{baselineskip}
3477 (of text font)}}
3478 \end{picture}}
3479 \fi
3480 \end{picture}}
3481 \fi
3482 % \end{macrocode}
3483 % Draw rules.
3484 % \begin{macrocode}
3485 \put(0,0){\line(1,0){\l@youthdi}}
3486 \put(0,\l@youtycv){\line(1,0){\l@youthdi}}
3487 \end{picture}
3488 \end{center}
3489 \setlength{\unitlength}{1pt}
3490 %% \ifdrawparameters\else
3491 \testprintparameters
3492 \ifl@ytempif
3493 % \end{macrocode}
3494 % Write out the table of values if required.
3495 % \begin{macrocode}
3496 \begin{center}
3497 \begin{footnotesize}
3498 Lengths are to the nearest pt. \\
3499 \begin{ttfamily}
3500 \begin{tabular}{l@{\hspace{20pt}}l}
3501 \textit{beforeskip} = \number\l@youtvpi pt &
3502 \textit{afterskip} = \number\l@youtvpii pt \\
3503 \textit{indent} = \number\l@youthpi pt &
3504 \textrm{(heading font)}
3505 \l@ycmd{baselineskip} = \number\l@youtvdii pt \\
3506 \l@ycmd{parskip} = \number\l@youtparskip pt &
3507 \textrm{heading font} = \string#1 \\
3508 \end{tabular}
3509 \end{ttfamily}\end{footnotesize}
3510 \end{center}
3511 \fi
3512 % \end{macrocode}
3513 % The end of the definition of |\drawheading|.
3514 % \begin{macrocode}
3515 }
3516
3517 % \end{macrocode}
3518 % \end{macro}
3519 %
3520 %
3521 %
3522 % \begin{macro}{\headingdiagram}
3523 % \begin{macro}{\headingdesign}
3524 % Shorthands.
3525 % \begin{macrocode}
3526 \newcommand{\headingdiagram}[1]{\drawparameterstrue\drawheading{#1}}
3527 \newcommand{\headingdesign}[1]{\drawparametersfalse\drawheading{#1}}
3528
3529 % \end{macrocode}
3530 % \end{macro}
3531 % \end{macro}
3532 %
3533 % \begin{macro}{\headingvalues}
3534 % This doesn't do anything --- it's just provided for symmetry.
3535 % \begin{macrocode}
3536 \newcommand{\headingvalues}{%
3537 \PackageWarning{layouts}{The \protect\headingvalues\space command does nothing}}
3538
3539 % \end{macrocode}
3540 % \end{macro}
3541 %
3542 % \section{Drawing the layouts of floats}
3543 %
3544 % We provide facilities for illustrating the parameters controlling
3545 % the layout of floats. Respectively these show the layout of an
3546 % individual float, and the page layout for floats.
3547 %
3548 % \subsubsection{Individual float layout}
3549 %
3550 % The code in this section enables the illustration of the parameters
3551 % of a single float environment.
3552 %
3553 % Start off with the |\try...| commands for setting trial parameter values.
3554 %
3555 % \begin{macro}{\trytextfloatsep}
3556 % Sets the trial value for |textfloatsep| and stores the result in |\l@youtvpi|.
3557 % \begin{macrocode}
3558
3559 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3560 %%%% INDIVIDUAL FLOAT LAYOUT
3561 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3562
3563 \newcommand{\trytextfloatsep}[1]{\l@yltoc{#1}{\l@youtvpi}}
3564 % \end{macrocode}
3565 % \end{macro}
3566 %
3567 % \begin{macro}{\tryfloatsep}
3568 % Sets the trial value for |floatsep| and stores the result in |\l@youtvpii|.
3569 % \begin{macrocode}
3570 \newcommand{\tryfloatsep}[1]{\l@yltoc{#1}{\l@youtvpii}}
3571 % \end{macrocode}
3572 % \end{macro}
3573 %
3574 % \begin{macro}{\tryintextsep}
3575 % Sets the trial value for |intextsep| and stores the result in |\l@youtvpiii|.
3576 % \begin{macrocode}
3577 \newcommand{\tryintextsep}[1]{\l@yltoc{#1}{\l@youtvpiii}}
3578 % \end{macrocode}
3579 % \end{macro}
3580 %
3581 % \begin{macro}{\trytopfigrule}
3582 % Sets the trial value for |topfigrule| and stores the result in |\l@youtlinethick|.
3583 % \begin{macrocode}
3584 \newcommand{\trytopfigrule}[1]{\setlength{\l@youtlinethick}{#1}}
3585 % \end{macrocode}
3586 % \end{macro}
3587 %
3588 % \begin{macro}{\trybotfigrule}
3589 % Sets the trial value for |botfigrule| and stores the result in |\l@youtlinethickii|.
3590 % \begin{macrocode}
3591 \newcommand{\trybotfigrule}[1]{\setlength{\l@youtlinethickii}{#1}}
3592
3593 % \end{macrocode}
3594 % \end{macro}
3595 %
3596 % \begin{macro}{\currentfloat}
3597 % This sets the trial float parameter values to those currently set in
3598 % the document, or makes a guesstimate where the value is hard-coded.
3599 % \begin{macrocode}
3600 \newcommand{\currentfloat}{%
3601 \trytextfloatsep{\textfloatsep}
3602 \tryfloatsep{\floatsep}
3603 \tryintextsep{\intextsep}
3604 \trytopfigrule{0pt} % guesstimate
3605 \trybotfigrule{0pt} % guesstimate
3606 }
3607
3608 % \end{macrocode}
3609 % \end{macro}
3610 %
3611 % \begin{macro}{\drawfloat}
3612 %
3613 % The command to draw the picture of float parameters.
3614 %
3615 % \begin{macrocode}
3616 \newcommand{\drawfloat}{%
3617 \ifdrawparameters
3618 % \end{macrocode}
3619 % Set up the lengths and coordinates for drawing the parameters.
3620 % \begin{macrocode}
3621 \l@yltoc{40pt}{\l@youtvpi} % textfloatsep
3622 \l@yltoc{40pt}{\l@youtvpii} % floatsep
3623 \l@yltoc{40pt}{\l@youtvpiii} % intextsep
3624 \setlength{\l@youtlinethick}{1pt} % toprule height
3625 \setlength{\l@youtlinethickii}{2pt} % botrule height
3626 \fi
3627 % \end{macrocode}
3628 % And the general drawing coodinates and lengths.
3629 % \begin{macrocode}
3630 % \l@youthdo=\textwidth % textwidth
3631 % \divide\l@youthdo by \l@yonepoint
3632 \l@yltoc{\textwidth}{\l@youthdo}
3633 \multiply\l@youthdo by 8\relax
3634 \divide\l@youthdo by 10\relax
3635 \l@yltoc{\baselineskip}{\l@youtvdvii} % baselineskip
3636 \l@youthdi=\l@youthdo % width of floats
3637 \divide\l@youthdi by \tw@
3638 \l@youtvdi=\l@youthdi % float box height
3639 \divide\l@youtvdi by 4\relax
3640 \l@youtvdii=\l@youtvdvii % text box height
3641 \multiply\l@youtvdii by \thr@@
3642 \l@youtvdvi=\l@youtvdvii % height of top text line
3643 \multiply\l@youtvdvi by \tw@
3644 \l@youtxci=\l@youthdo % X coord of LH of float
3645 \advance\l@youtxci by -\l@youthdi
3646 \divide\l@youtxci by \tw@
3647 \l@youtxcii=\l@youthdo % X coord of vertical dims.
3648 \divide\l@youtxcii by \tw@
3649 \l@youtyci=\l@youtvdi % Y coord of top of BFl-n
3650 \l@youtycii=\l@youtyci % Y coord of bottom of text
3651 \advance\l@youtycii by \l@youtvpi
3652 \l@youtyciii=\l@youtycii % Y coord of bottom of HF box
3653 \advance\l@youtyciii by \l@youtvdii
3654 \advance\l@youtyciii by \l@youtvpiii
3655 \l@youtyciv=\l@youtyciii % Y coord of bottom top text box
3656 \advance\l@youtyciv by \l@youtvdi
3657 \advance\l@youtyciv by \l@youtvpiii
3658 \l@youtycv=\l@youtyciv % Y coord of bottom of TFl-2 box
3659 \advance\l@youtycv by \l@youtvdii
3660 \advance\l@youtycv by \l@youtvpi
3661 \l@youtycvi=\l@youtycv % Y coord of bottom of TFl-1 box
3662 \advance\l@youtycvi by \l@youtvdi
3663 \advance\l@youtycvi by \l@youtvpii
3664 \l@youtvdo=\l@youtycvi % Y dim of text on page
3665 \advance\l@youtvdo by \l@youtvdi
3666 \l@youthdii=\l@youtvpi % a small amount
3667 \divide\l@youthdii by \tw@
3668 \l@youthdiii=\l@youthdii % half a small amount
3669 \divide\l@youthdiii by \tw@
3670 % \end{macrocode}
3671 %
3672 % Draw the picture!
3673 %
3674 % \begin{macrocode}
3675 \begin{center}
3676 %%% \setlayoutscale{1}
3677 \setlength{\unitlength}{\l@youtunitlength}
3678 \begin{picture}(\l@youthdo,\l@youtvdo)
3679 \thicklines
3680 % \end{macrocode}
3681 % A bottom float.
3682 % \begin{macrocode}
3683 \put(\l@youtxci,0){\framebox(\l@youthdi,\l@youtvdi){\l@ylabelfont A BOTTOM FLOAT}}
3684 % \end{macrocode}
3685 % Bottom text.
3686 % \begin{macrocode}
3687 \put(0,\l@youtycii){\begin{picture}(\l@youthdo,\l@youtvdii)
3688 \put(0,0){\makebox(\l@youthdo,0)[br]{\l@ylabelfont \ldots last text line before bottom float.}}
3689 \put(0,\l@youtvdvi){\l@ylabelfont First text line after `here' float \ldots}
3690 \end{picture}}
3691 % \end{macrocode}
3692 % Draw a `here' float.
3693 % \begin{macrocode}
3694 \put(\l@youtxci,\l@youtyciii){\framebox(\l@youthdi,\l@youtvdi){\l@ylabelfont A `HERE' FLOAT}}
3695 % \end{macrocode}
3696 % Top text.
3697 % \begin{macrocode}
3698 \put(0,\l@youtyciv){\begin{picture}(\l@youthdo,\l@youtvdii)
3699 \put(0,0){\makebox(\l@youthdo,0)[br]{\l@ylabelfont \ldots last text line before `here' float.}}
3700 \put(0,\l@youtvdvi){\l@ylabelfont First text line after top float \ldots}
3701 \end{picture}}
3702 % \end{macrocode}
3703 % The lowest top float (TFl-2).
3704 % \begin{macrocode}
3705 \put(\l@youtxci,\l@youtycv){\framebox(\l@youthdi,\l@youtvdi){\l@ylabelfont A TOP FLOAT}}
3706 % \end{macrocode}
3707 % The highest top float (TFl-1).
3708 % \begin{macrocode}
3709 \put(\l@youtxci,\l@youtycvi){\framebox(\l@youthdi,\l@youtvdi){\l@ylabelfont A TOP FLOAT}}
3710 % \end{macrocode}
3711 % Whole page text.
3712 % \begin{macrocode}
3713 \thinlines
3714 \put(0,0){\dashbox{10}(\l@youthdo,\l@youtvdo){}}
3715 % \end{macrocode}
3716 % The top and bottom rules
3717 % \begin{macrocode}
3718 \linethickness{\l@youtlinethick}
3719 \put(0,\l@youtycv){\line(1,0){\l@youthdo}}
3720 \linethickness{\l@youtlinethickii}
3721 \put(0,\l@youtyci){\line(1,0){\l@youthdo}}
3722 \thinlines
3723 \testdrawdimensions
3724 \ifl@ytempif
3725 % \end{macrocode}
3726 % Draw the parameter lines if required. Start with the bottom |textfloatsep|.
3727 % \begin{macrocode}
3728 \put(\l@youtxcii,\l@youtycii){\vector(0,-1){\l@youtvpi}}
3729 \put(\l@youtxcii,\l@youtycii){\begin{picture}(\l@youthdii,\l@youthdii)
3730 \put(\l@youthdiii,-\l@youthdii){\l@ypcmd{textfloatsep}}
3731 \end{picture}}
3732 % \end{macrocode}
3733 % Lower |intextsep|.
3734 % \begin{macrocode}
3735 \put(\l@youtxcii,\l@youtyciii){\vector(0,-1){\l@youtvpiii}}
3736 \put(\l@youtxcii,\l@youtyciii){\begin{picture}(\l@youthdii,\l@youthdii)
3737 \put(\l@youthdiii,-\l@youthdii){\l@ypcmd{intextsep}}
3738 \end{picture}}
3739 % \end{macrocode}
3740 % Upper |intextsep|.
3741 % \begin{macrocode}
3742 \put(\l@youtxcii,\l@youtyciv){\vector(0,-1){\l@youtvpiii}}
3743 \put(\l@youtxcii,\l@youtyciv){\begin{picture}(\l@youthdii,\l@youthdii)
3744 \put(\l@youthdiii,-\l@youthdii){\l@ypcmd{intextsep}}
3745 \end{picture}}
3746 % \end{macrocode}
3747 % Top |textfloatsep|.
3748 % \begin{macrocode}
3749 \put(\l@youtxcii,\l@youtycv){\vector(0,-1){\l@youtvpi}}
3750 \put(\l@youtxcii,\l@youtycv){\begin{picture}(\l@youthdii,\l@youthdii)
3751 \put(\l@youthdiii,-\l@youthdii){\l@ypcmd{textfloatsep}}
3752 \end{picture}}
3753 % \end{macrocode}
3754 % Top |floatsep|.
3755 % \begin{macrocode}
3756 \put(\l@youtxcii,\l@youtycvi){\vector(0,-1){\l@youtvpii}}
3757 \put(\l@youtxcii,\l@youtycvi){\begin{picture}(\l@youthdii,\l@youthdii)
3758 \put(\l@youthdiii,-\l@youthdii){\l@ypcmd{floatsep}}
3759 \end{picture}}
3760 % \end{macrocode}
3761 % Top rule.
3762 % \begin{macrocode}
3763 \put(\l@youthdo,\l@youtycv){\begin{picture}(\l@youthdii,\l@youthdii)
3764 \put(-\l@youthdiii,\l@youthdii){\vector(0,-1){\l@youthdii}}
3765 \put(-\l@youthdii,\l@youthdii){\makebox(0,0)[tr]{\l@ypcmd{topfigrule}}}
3766 \end{picture}}
3767 % \end{macrocode}
3768 % And finally the bottom rule.
3769 % \begin{macrocode}
3770 \put(\l@youthdo,\l@youtyci){\begin{picture}(\l@youthdii,\l@youthdii)
3771 \put(-\l@youthdiii,-\l@youthdii){\vector(0,1){\l@youthdii}}
3772 \put(-\l@youthdii,-\l@youthdii){\makebox(0,0)[br]{\l@ypcmd{botfigrule}}}
3773 \end{picture}}
3774 \fi
3775 \end{picture}
3776 \end{center}
3777 \setlength{\unitlength}{1pt}
3778 \testprintparameters
3779 \ifl@ytempif
3780 % \end{macrocode}
3781 % Print the table of values.
3782 % \begin{macrocode}
3783 \begin{center}
3784 \begin{footnotesize}
3785 Lengths are to the nearest pt. \\
3786 \begin{ttfamily}
3787 \begin{tabular}{l@{\hspace{20pt}}l}
3788 \l@ycmd{floatsep} = \number\l@youtvpii pt &
3789 \l@ycmd{textfloatsep} = \number\l@youtvpi pt \\
3790 \l@ycmd{intextsep} = \number\l@youtvpiii pt &
3791 \textrm{topfigrule thickness} = \the\l@youtlinethick \\
3792 \textrm{botfigrule thickness} = \the\l@youtlinethickii & \\
3793 \end{tabular}
3794 \end{ttfamily}\end{footnotesize}
3795 \end{center}
3796 \fi
3797 % \end{macrocode}
3798 % End of the definition of |\drawfloat|.
3799 % \begin{macrocode}
3800 }
3801
3802 % \end{macrocode}
3803 % \end{macro}
3804 %
3805 %
3806 %
3807 %
3808 % \begin{macro}{\floatdiagram}
3809 % \begin{macro}{\floatdesign}
3810 % Shorthands.
3811 % \begin{macrocode}
3812 \newcommand{\floatdiagram}{\drawparameterstrue\drawfloat}
3813 \newcommand{\floatdesign}{\drawparametersfalse\drawfloat}
3814
3815 % \end{macrocode}
3816 % \end{macro}
3817 % \end{macro}
3818 %
3819 % \begin{macro}{\floatvalues}
3820 % This macro produces a table of the current float layout actual values.
3821 % \changes{v2.5}{2001/10/21}{Fixed counter printing in \cs{floatvalues}}
3822 % \begin{macrocode}
3823 \newcommand{\floatvalues}{%
3824 \ifprintheadings
3825 Actual float layout values.\\[\baselineskip]
3826 \fi
3827 \begingroup\l@yvalsize
3828 \begin{tabular}{l@{\hspace{20pt}}l}
3829 \l@ycmd{floatsep} = \l@yval{\floatsep} &
3830 \l@ycmd{textfloatsep} = \l@yval{\textfloatsep} \\
3831 \l@ycmd{intextsep} = \l@yval{\intextsep} & \\
3832 topfig rule thickness = ?? &
3833 botfig rule thickness = ?? \\
3834 \l@ycmd{topnumber} = \the\c@topnumber & % \l@yval{\c@topnumber} &
3835 \l@ycmd{topfraction} = \topfraction \\
3836 \l@ycmd{bottomnumber} = \the\c@bottomnumber & % \l@yval{\c@bottomnumber} &
3837 \l@ycmd{bottomfraction} = \bottomfraction \\
3838 \l@ycmd{totalnumber} = \the\c@totalnumber & % \l@yval{\c@totalnumber} &
3839 \l@ycmd{textfraction} = \textfraction \\
3840 \l@ycmd{dblfloatsep} = \l@yval{\dblfloatsep} &
3841 \l@ycmd{dbltextfloatsep} = \l@yval{\dbltextfloatsep} \\
3842 \l@ycmd{dbltopnumber} = \the\c@dbltopnumber & % \l@yval{\c@dbltopnumber} &
3843 \l@ycmd{dbltopfraction} = \dbltopfraction \\
3844 \l@ycmd{dblfloatpagefraction} = \dblfloatpagefraction &
3845 \l@ycmd{floatpagefraction} = \floatpagefraction \\
3846 1em = \l@yval{\l@yonem} & 1ex = \l@yval{\l@yonex} \\
3847 \end{tabular}
3848 \endgroup
3849 }
3850
3851 % \end{macrocode}
3852 % \end{macro}
3853 %
3854 % \subsubsection{Floats on a page}
3855 %
3856 % The code in this section illustrates the parameters controlling how
3857 % one or more floats may be apportioned on a page.
3858 %
3859 % Start off with the |\try...| commands for setting trial parameter values.
3860 %
3861 % \begin{macro}{\trytotalnumber}
3862 % Sets the trial value for |totalnumber| and stores the result in |\l@youtvpvi|.
3863 % \begin{macrocode}
3864
3865 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3866 %%%% FLOAT PAGE LAYOUT
3867 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3868
3869 \newcommand{\trytotalnumber}[1]{\l@youtvpvi = #1}
3870 % \end{macrocode}
3871 % \end{macro}
3872 %
3873 % \begin{macro}{\trytopnumber}
3874 % Sets the trial value for |topnumber| and stores the result in |\l@youtvpv|.
3875 % \begin{macrocode}
3876 \newcommand{\trytopnumber}[1]{\l@youtvpv = #1}
3877 % \end{macrocode}
3878 % \end{macro}
3879 %
3880 % \begin{macro}{\trybottomnumber}
3881 % Sets the trial value for |bottomnumber| and stores the result in |\l@youtvpi|.
3882 % \begin{macrocode}
3883 \newcommand{\trybottomnumber}[1]{\l@youtvpi = #1}
3884 % \end{macrocode}
3885 % \end{macro}
3886 %
3887 % \begin{macro}{\trytopfraction}
3888 % Sets the trial value for |topfraction| and stores the results in |\l@youtvpiv|
3889 % and |\l@youthdiv|.
3890 % \begin{macrocode}
3891 \newcommand{\trytopfraction}[1]{\setlength{\l@ylen}{10in}
3892 \l@ylen = #1\l@ylen
3893 \l@youtvpiv=\l@ylen
3894 \divide\l@youtvpiv by \l@yonepoint
3895 \setlength{\l@ylen}{1000sp}
3896 \l@ylen=#1\l@ylen
3897 \l@youthdiv=\l@ylen}
3898 % \end{macrocode}
3899 % \end{macro}
3900 %
3901 % \begin{macro}{\trytextfraction}
3902 % Sets the trial value for |textfraction| and stores the results in |\l@youtvpiii|
3903 % and |\l@youthdv|.
3904 % \begin{macrocode}
3905 \newcommand{\trytextfraction}[1]{\setlength{\l@ylen}{10in}
3906 \l@ylen = #1\l@ylen
3907 \l@youtvpiii=\l@ylen
3908 \divide\l@youtvpiii by \l@yonepoint
3909 \setlength{\l@ylen}{1000sp}
3910 \l@ylen=#1\l@ylen
3911 \l@youthdv=\l@ylen}
3912 % \end{macrocode}
3913 % \end{macro}
3914 %
3915 % \begin{macro}{\trybottomfraction}
3916 % Sets the trial value for |bottomfraction| and stores the results in |\l@youtvpii|
3917 % and |\l@youthdvi|.
3918 % \begin{macrocode}
3919 \newcommand{\trybottomfraction}[1]{\setlength{\l@ylen}{10in}
3920 \l@ylen = #1\l@ylen
3921 \l@youtvpii=\l@ylen
3922 \divide\l@youtvpii by \l@yonepoint
3923 \setlength{\l@ylen}{1000sp}
3924 \l@ylen=#1\l@ylen
3925 \l@youthdvi=\l@ylen}
3926
3927 % \end{macrocode}
3928 % \end{macro}
3929 %
3930 % \begin{macro}{\currentfloatpage}
3931 %
3932 % Sets the floatpage parameter trial values to those in the current
3933 % document, or makes a guesstimate when these are hard-coded.
3934 % \begin{macrocode}
3935 \newcommand{\currentfloatpage}{%
3936 \trytotalnumber{\value{totalnumber}} % typically 3
3937 \trytopnumber{\value{topnumber}} % typically 2
3938 \trytopfraction{0.7} % typically 0.7
3939 \trytextfraction{0.2} % typically 0.2
3940 \trybottomfraction{0.3} % typically 0.3
3941 \trybottomnumber{\value{bottomnumber}} % typically 1
3942 }
3943
3944 % \end{macrocode}
3945 % \end{macro}
3946 %
3947 % \begin{macro}{\drawfloatpage}
3948 %
3949 % The command to draw a picture of the float page layout and
3950 % parameters.
3951 %
3952 % \begin{macrocode}
3953 \newcommand{\drawfloatpage}{%
3954 \ifdrawparameters
3955 % \end{macrocode}
3956 % Calculate values for parameter drawing.
3957 % \begin{macrocode}
3958 \l@youtvpvi=\thr@@ % total number
3959 \l@youtvpv=\tw@ % topnumber
3960 \l@youthdiv=300\relax % 1000 times topfraction
3961 \setlength{\l@ylen}{10in}
3962 \l@ylen=0.3\l@ylen
3963 \l@yltoc{\l@ylen}{\l@youtvpiv} % topfraction
3964 \l@youthdv=200\relax % 1000 times textfraction
3965 \setlength{\l@ylen}{10in}
3966 \l@ylen=0.2\l@ylen
3967 \l@yltoc{\l@ylen}{\l@youtvpiii} % textfraction
3968 \l@youthdvi=300\relax % 1000 times botfraction
3969 \setlength{\l@ylen}{10in}
3970 \l@ylen=0.3\l@ylen
3971 \l@yltoc{\l@ylen}{\l@youtvpii} % bottomfraction
3972 \l@youtvpi=\@ne % bottomnumber
3973 \fi
3974 % \end{macrocode}
3975 % Continue with the general picture coordinates and lengths.
3976 % \begin{macrocode}
3977 \l@youtvdo=\l@yteninch\relax % textheight
3978 \l@youthdo=\l@yeighthalfinch\relax % textwidth
3979 \l@youthdi=\l@youthdo % width of text box
3980 \multiply\l@youthdi by 8\relax
3981 \divide\l@youthdi by 10\relax
3982 \l@youtyci=\l@youtvdo % Y coord of base of textfraction
3983 \advance\l@youtyci by -\l@youtvpiii
3984 \divide\l@youtyci by \tw@
3985 \l@youtycii=\l@youtvpii % Y coord of top of bottomfraction
3986 \l@youtyciii=\l@youtvdo % Y coord of base of topfraction
3987 \advance\l@youtyciii by -\l@youtvpiv
3988 \l@youtyciv=\l@youtyci % Y coord of top of textfraction
3989 \advance\l@youtyciv by \l@youtvpiii
3990 \l@youtycv=\l@youtyci % Y coord of centre of text box
3991 \advance\l@youtycv by \l@youtyciv
3992 \divide\l@youtycv by \tw@
3993 \l@youtxcii=\l@youthdo % X coord of centre dims
3994 \divide\l@youtxcii by \tw@
3995 \l@youtxci=\l@youtxcii % X coord of LH dims
3996 \divide\l@youtxci by \tw@
3997 \l@youtxciii=\l@youtxcii % X coord of RH dims
3998 \advance\l@youtxciii by \l@youtxci
3999 \l@youtxciv=\l@youthdo % X coord of LH of text box
4000 \advance\l@youtxciv by -\l@youthdi
4001 \divide\l@youtxciv by \tw@
4002 \l@youthdii=\l@youtxciv % a small dimension
4003 \l@youthdiii=\l@youthdii % half a small dimension
4004 \divide\l@youthdiii by \tw@
4005 % \end{macrocode}
4006 %
4007 % Draw the picture!
4008 %
4009 % \begin{macrocode}
4010 \begin{center}
4011 \setlength{\unitlength}{\l@youtunitlength}
4012 \begin{picture}(\l@youthdo,\l@youtvdo)
4013 \thicklines
4014 % \end{macrocode}
4015 % Draw the page boundaries.
4016 % \begin{macrocode}
4017 \put(0,0){\framebox(\l@youthdo,\l@youtvdo){}}
4018 % \end{macrocode}
4019 % The bottom fraction.
4020 % \begin{macrocode}
4021 \put(0,\l@youtycii){\dashbox{10}(\l@youthdo,0){}}
4022 %%% \ifdrawparameters
4023 \put(0,0){\makebox(\l@youthdo,\l@youtvpii){\l@ypcmd{bottomnumber}}}
4024 \thinlines
4025 \put(\l@youtxciii,0){\vector(0,1){\l@youtvpii}}
4026 \thicklines
4027 %%% \fi
4028 % \end{macrocode}
4029 % The text fraction.
4030 % \begin{macrocode}
4031 \put(\l@youtxciv,\l@youtyci){\framebox(\l@youthdi,\l@youtvpiii){}}
4032 % \end{macrocode}
4033 % The top fraction.
4034 % \begin{macrocode}
4035 \put(0,\l@youtyciii){\dashbox{10}(\l@youthdo,0){}}
4036 %%% \ifdrawparameters
4037 \put(0,\l@youtyciii){\makebox(\l@youthdo,\l@youtvpiv){\l@ypcmd{topnumber}}}
4038 \thinlines
4039 \put(\l@youtxci,\l@youtvdo){\vector(0,-1){\l@youtvpiv}}
4040 \thicklines
4041 %%% \fi
4042 \thinlines
4043 \testdrawdimensions
4044 \ifl@ytempif
4045 % \end{macrocode}
4046 % Draw the dimensions.
4047 % First the bottom fraction.
4048 % \begin{macrocode}
4049 \put(\l@youtxciii,0){\begin{picture}(\l@youthdii,\l@youthdii)
4050 \put(-\l@youthdiii,\l@youthdiii){%
4051 \makebox(0,0)[br]{\l@ypcmd{bottomfraction}}}
4052 \end{picture}}
4053 % \end{macrocode}
4054 % The text fraction.
4055 % \begin{macrocode}
4056 \put(\l@youtxcii,\l@youtyci){\vector(0,1){\l@youtvpiii}}
4057 \put(\l@youtxcii,\l@youtyci){\vector(0,-1){0}}
4058 \put(\l@youtxcii,\l@youtycv){\begin{picture}(\l@youthdii,\l@youthdii)
4059 \put(\l@youthdiii,0){%
4060 \makebox(0,0)[l]{\l@ypcmd{textfraction}}}
4061 \end{picture}}
4062 % \end{macrocode}
4063 % Finally the top fraction.
4064 % \begin{macrocode}
4065 \put(\l@youtxci,\l@youtvdo){\begin{picture}(\l@youthdii,\l@youthdii)
4066 \put(\l@youthdiii,-\l@youthdiii){%
4067 \makebox(0,0)[tl]{\l@ypcmd{topfraction}}}
4068 \end{picture}}
4069 \fi
4070 \end{picture}
4071 \end{center}
4072 \setlength{\unitlength}{1pt}
4073 \testprintparameters
4074 \ifl@ytempif
4075 % \end{macrocode}
4076 % Print the parameter value table.
4077 % \begin{macrocode}
4078 \begin{center}
4079 \begin{footnotesize}\begin{ttfamily}
4080 \begin{tabular}{l@{\hspace{20pt}}l}
4081 \l@ycmd{topnumber} = \number\l@youtvpv &
4082 \l@ycmd{topfraction} = 0.\number\l@youthdiv \\
4083 \l@ycmd{bottomnumber} = \number\l@youtvpi &
4084 \l@ycmd{bottomfraction} = 0.\number\l@youthdvi \\
4085 \l@ycmd{totalnumber} = \number\l@youtvpvi &
4086 \l@ycmd{textfraction} = 0.\number\l@youthdv \\
4087 \end{tabular}
4088 \end{ttfamily}\end{footnotesize}
4089 \end{center}
4090 \fi
4091 % \end{macrocode}
4092 % End of the definition of |\drawfloatpage|.
4093 % \begin{macrocode}
4094 }
4095
4096 % \end{macrocode}
4097 % \end{macro}
4098 %
4099 %
4100 %
4101 % \begin{macro}{\floatpagediagram}
4102 % \begin{macro}{\floatpagedesign}
4103 % Shorthands.
4104 % \begin{macrocode}
4105 \newcommand{\floatpagediagram}{\drawparameterstrue\drawfloatpage}
4106 \newcommand{\floatpagedesign}{\drawparametersfalse\drawfloatpage}
4107
4108 % \end{macrocode}
4109 % \end{macro}
4110 % \end{macro}
4111 %
4112 % \begin{macro}{\floatpagevalues}
4113 % The same as the |\floatvalues| command.
4114 % \begin{macrocode}
4115 \newcommand{\floatpagevalues}{\floatvalues}
4116
4117 % \end{macrocode}
4118 % \end{macro}
4119 %
4120 % \section{Drawing the layout of a Table of Contents entry}
4121 %
4122 % We provide means of illustrating the layout of a sectional title
4123 % in a Table of Contents.
4124 %
4125 % As usual, start off with the |\try...| commands for setting trial values
4126 % of the parameters.
4127 %
4128 % \begin{macro}{\trytocindent}
4129 % Sets the trial value for |tocindent| and stores the result in |\l@youthpi|.
4130 % \begin{macrocode}
4131
4132 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4133 %%%% TOC LAYOUT
4134 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4135
4136 \newcommand{\trytocindent}[1]{\l@yltoc{#1}{\l@youthpi}}
4137 % \end{macrocode}
4138 % \end{macro}
4139 %
4140 % \begin{macro}{\trytocnumwidth}
4141 % Sets the trial value for |tocnumwidth| and stores the result in |\l@youthpii|.
4142 % \begin{macrocode}
4143 \newcommand{\trytocnumwidth}[1]{\l@yltoc{#1}{\l@youthpii}}
4144 % \end{macrocode}
4145 % \end{macro}
4146 %
4147 % \begin{macro}{\trytoclinewidth}
4148 % Sets the trial value for |toclinewidth| and stores the result in |\l@youthdo|.
4149 % \begin{macrocode}
4150 \newcommand{\trytoclinewidth}[1]{\l@yltoc{#1}{\l@youthdo}}
4151 % \end{macrocode}
4152 % \end{macro}
4153 %
4154 % \begin{macro}{\trytocrmarg}
4155 % Sets the trial value for |tocrmarg| and stores the result in |\l@youthpiii|.
4156 % \begin{macrocode}
4157 \newcommand{\trytocrmarg}[1]{\l@yltoc{#1}{\l@youthpiii}}
4158 % \end{macrocode}
4159 % \end{macro}
4160 %
4161 % \begin{macro}{\trytocpnumwidth}
4162 % Sets the trial value for |tocpnumwidth| and stores the result in |\l@youthpiv|.
4163 % \begin{macrocode}
4164 \newcommand{\trytocpnumwidth}[1]{\l@yltoc{#1}{\l@youthpiv}}
4165 % \end{macrocode}
4166 % \end{macro}
4167 %
4168 % \begin{macro}{\l@ydotsep}
4169 % Stores the actual value for the ToC dotsep.
4170 % \begin{macrocode}
4171 \newcommand{\l@ydotsep}{\@dotsep}
4172 % \end{macrocode}
4173 % \end{macro}
4174 %
4175 % \begin{macro}{\trytocdotsep}
4176 % Sets the trial value for |tocdotsep| and stores the result in |\l@youthpv|.
4177 % \begin{macrocode}
4178 \newcommand{\trytocdotsep}[1]{\renewcommand{\l@ydotsep}{#1}
4179 \setlength{\l@ylen}{1em}
4180 \l@ylen = #1\l@ylen
4181 \divide\l@ylen by 18\relax % 18mu = 1em
4182 \addtolength{\l@ylen}{0.4pt} % small addition for the dot width
4183 \l@yltoc{\l@ylen}{\l@youthpv}}
4184
4185 % \end{macrocode}
4186 % \end{macro}
4187 %
4188 % \begin{macro}{\currenttoc}
4189 %
4190 % This routine sets the trial ToC parameters to those specified for
4191 % the current document. For those values that are hard-coded it guesstimates
4192 % typical values (actually I use the values for |\subsection| entries
4193 % in the \Lpack{article} class).
4194 % \begin{macrocode}
4195 \newcommand{\currenttoc}{%
4196 \trytocindent{1.5em} % guesstimate
4197 \trytocnumwidth{2.3em} % guesstimate
4198 \trytoclinewidth{\textwidth}
4199 \trytocrmarg{\@tocrmarg}
4200 \trytocpnumwidth{\@pnumwidth}
4201 \trytocdotsep{\@dotsep}
4202 }
4203
4204 % \end{macrocode}
4205 % \end{macro}
4206 %
4207 % \begin{macro}{\drawtoc}
4208 %
4209 % The command to draw the layout of a ToC entry.
4210 % \begin{macrocode}
4211 \newcommand{\drawtoc}{%
4212 \ifdrawparameters
4213 % \end{macrocode}
4214 % Calculate drawing lengths and coordinates for picturing the parameters.
4215 % \begin{macrocode}
4216 \l@yltoc{100pt}{\l@youthpi} % indent
4217 \l@yltoc{50pt}{\l@youthpii} % numwidth
4218 \l@yltoc{100pt}{\l@youthpiii} % tocrmarg
4219 \l@yltoc{60pt}{\l@youthpiv} % pnumwidth
4220 \l@yltoc{20pt}{\l@youthpv} % dotsep
4221 \l@yltoc{6.5in}{\l@youthdo} % linewidth
4222 \fi
4223 % \end{macrocode}
4224 % Continue with the general lengths and coordinate values.
4225 % \begin{macrocode}
4226 \l@yltoc{20pt}{\l@youtvdi} % baselineskip
4227 \l@youtvdii=\l@youtvdi % twice baselineskip
4228 \multiply\l@youtvdii by \tw@
4229 \l@youtvdiii=\l@youtvdi % three times baselineskip
4230 \multiply\l@youtvdiii by \thr@@
4231 \l@youtvdiv=\l@youtvdi % four times baselineskip
4232 \multiply\l@youtvdiv by 4\relax
4233 \l@youtxci=\l@youthpi % X coord of start of numwidth
4234 \l@youtxcii=\l@youtxci % X coord of start of text
4235 \advance\l@youtxcii by \l@youthpii
4236 \l@youtxciii=\l@youthdo % X coord of start of pnumwidth
4237 \advance\l@youtxciii by -\l@youthpiv
4238 \l@youtxciv=\l@youthdo % X coord of start of tocrmarg
4239 \advance\l@youtxciv by -\l@youthpiii
4240 \l@youtxcv=\l@youtxciv % X coord of penultimate dot
4241 \advance\l@youtxcv by -\l@youthpv
4242 \l@youtyci=\z@ % Y coord of base of dotsep text
4243 \l@youtycii=\l@youtyci % dotsep vector
4244 \advance\l@youtycii by \l@youtvdii
4245 \l@youtyciii=\l@youtycii % Y coord of base of bottom text
4246 \advance\l@youtyciii by \l@youtvdii
4247 \l@youtyciv=\l@youtyciii % Y coord of base of middle text
4248 \advance\l@youtyciv by \l@youtvdi
4249 \l@youtycv=\l@youtyciv % Y coord of base of top text
4250 \advance\l@youtycv by \l@youtvdi
4251 \l@youtycvi=\l@youtycv % Y coord of top vectors
4252 \advance\l@youtycvi by \l@youtvdi
4253 \advance\l@youtycvi by \l@youtvdi
4254 \l@youtvdo=\l@youtycvi % picture height
4255 \advance\l@youtvdo by \l@youtvdii
4256 \l@youthdii=\l@youtxciv % width of title text
4257 \advance\l@youthdii by -\l@youtxcii
4258 \l@youthdiii=\l@youtvdi % a small amount
4259 \l@youthdiv=\l@youthdiii % half a small amount
4260 \divide\l@youthdiv by \tw@
4261 % \end{macrocode}
4262 %
4263 % Draw the picture!
4264 %
4265 % \begin{macrocode}
4266 \begin{center}
4267 \setlength{\unitlength}{\l@youtunitlength}
4268 \begin{picture}(\l@youthdo,\l@youtvdo)
4269 \thinlines
4270 \put(0,0){\framebox(\l@youthdo,\l@youtvdo){}}
4271 % \end{macrocode}
4272 % The top text line.
4273 % \begin{macrocode}
4274 \put(\l@youtxci,\l@youtycv){\l@ylabelfont \textbf{3.5}}
4275 \put(\l@youtxcii,\l@youtycv){\l@ylabelfont Heading \ldots}
4276 \put(\l@youtxciv,\l@youtycv){\makebox(0,0)[br]{\l@ylabelfont \ldots title}}
4277 % \end{macrocode}
4278 % The middle text line.
4279 % \begin{macrocode}
4280 \put(\l@youtxcii,\l@youtyciv){\l@ylabelfont continue \ldots}
4281 \put(\l@youtxciv,\l@youtyciv){\makebox(0,0)[br]{\l@ylabelfont \ldots title}}
4282 % \end{macrocode}
4283 % The bottom text line.
4284 % \begin{macrocode}
4285 \put(\l@youtxcii,\l@youtyciii){\l@ylabelfont title end} % end of title heading
4286 \put(\l@youthdo,\l@youtyciii){\makebox(0,0)[br]{\l@ylabelfont 487}} % page number
4287 % \end{macrocode}
4288 % Calculate the number of dots required for the dotted leader,
4289 % then draw the leader. The length of the `title end' text is a true
4290 % length so we have to divide it by the drawing scale factor to convert
4291 % it to the picture length.
4292 % \begin{macrocode}
4293 % \settowidth{\l@ylen}{title end\quad}
4294 \settowidth{\l@ylen}{\l@ylabelfont title end\space}
4295 \l@yltoc{\l@ylen}{\l@youthdv} % width of `title end' text
4296 \l@youthpvi=\l@youtunitlength
4297 \multiply\l@youthdv by \l@yonepoint\relax
4298 \divide\l@youthdv by \l@youthpvi\relax
4299 \l@youthdvi=\l@youtxciv % space for dots
4300 \advance\l@youthdvi by -\l@youtxcii
4301 \advance\l@youthdvi by -\l@youthdv
4302 \l@youthdvii=\l@youthdvi % number of dots
4303 \divide\l@youthdvii by \l@youthpv
4304 % \end{macrocode}
4305 % Use |\multiput| for dot drawing if we are drawing the parameters and the
4306 % values calculated above. Otherwise multiply the dotsep by 4 to give a
4307 % more realistic rendition; also make sure that we don't print just one dot.
4308 % \begin{macrocode}
4309 \ifdrawparameters
4310 \multiput(\l@youtxciv,\l@youtyciii)(-\l@youthpv,0){\l@youthdvii}%
4311 {\makebox(0,0)[r]{.}} % draw the dots
4312 \else
4313 \multiply\l@youthpv by 4\relax
4314 \l@youthdvii=\l@youthdvi
4315 \divide\l@youthdvii by \l@youthpv
4316 \advance\l@youthdvii by \@ne
4317 \ifnum\l@youthdvii >\@ne
4318 \multiput(\l@youtxciv,\l@youtyciii)(-\l@youthpv,0){\l@youthdvii}%
4319 {\makebox(0,0)[r]{.}} % draw the dots
4320 \fi
4321 \fi
4322 %% \ifdrawparameters
4323 \testdrawdimensions
4324 \ifl@ytempif
4325 % \end{macrocode}
4326 %
4327 % Draw the parameters if requested.
4328 %
4329 % The top vectors (which we put into their own picture).
4330 % \begin{macrocode}
4331 \put(0,\l@youtycvi){\begin{picture}(\l@youthdo,\l@yoneinch)
4332 % \end{macrocode}
4333 % The indent.
4334 % \begin{macrocode}
4335 \put(0,0){\vector(1,0){\l@youthpi}}
4336 \put(\l@youtxci,0){\line(0,-1){\l@youthdiii}}
4337 \put(0,0){\begin{picture}(\l@youthdiii,\l@youthdiii)
4338 \put(\l@youthdiv,\l@youthdiv){\l@yparamfont\textit{indent}}
4339 \end{picture}}
4340 % \end{macrocode}
4341 % The numwidth.
4342 % \begin{macrocode}
4343 \put(\l@youtxci,0){\vector(1,0){\l@youthpii}}
4344 \put(\l@youtxcii,0){\line(0,-1){\l@youthdiii}}
4345 \put(\l@youtxci,0){\begin{picture}(\l@youthdiii,\l@youthdiii)
4346 \put(\l@youthdiv,\l@youthdiv){\l@yparamfont\textit{numwidth}}
4347 \end{picture}}
4348 % \end{macrocode}
4349 % Lastly, the pnumwidth.
4350 % \begin{macrocode}
4351 \put(\l@youthdo,0){\vector(-1,0){\l@youthpiv}}
4352 \put(\l@youtxciii,0){\line(0,-1){\l@youthdiii}}
4353 \put(\l@youthdo,0){\begin{picture}(\l@youthdiii,\l@youthdiii)
4354 \put(-\l@youthdiv,\l@youthdiv){\makebox(0,0)[br]%
4355 {\l@ypcmd{@pnumwidth}}}
4356 \end{picture}}
4357 \end{picture}}
4358 % \end{macrocode}
4359 % Now do the linewidth.
4360 % \begin{macrocode}
4361 \thicklines
4362 \put(0,\l@youtvdo){\vector(1,0){\l@youthdo}}
4363 \thinlines
4364 \put(0,\l@youtvdo){\begin{picture}(\l@youthdiii,\l@youthdiii)
4365 \put(\l@youtxcii,-\l@youthdiv){\makebox(0,0)[tl]%
4366 { \quad \l@ypcmd{linewidth}}}
4367 \end{picture}}
4368 % \end{macrocode}
4369 % The bottom vectors (which we put into their own picture).
4370 % \begin{macrocode}
4371 \put(0,\l@youtycii){\begin{picture}(\l@youthdo,\l@yoneinch)
4372 % \end{macrocode}
4373 % The tocrmarg.
4374 % \begin{macrocode}
4375 \put(\l@youthdo,0){\vector(-1,0){\l@youthpiii}}
4376 \put(\l@youtxciv,0){\line(0,1){\l@youthdiii}}
4377 \put(\l@youthdo,0){\begin{picture}(\l@youthdiii,\l@youthdiii)
4378 \put(-\l@youthdiv,-\l@youthdiv){\makebox(0,0)[tr]%
4379 {\l@ypcmd{@tocrmarg}}}
4380 \end{picture}}
4381 % \end{macrocode}
4382 % Finish with the dotsep.
4383 % \begin{macrocode}
4384 \put(\l@youtxciv,0){\vector(-1,0){\l@youthpv}}
4385 \put(\l@youtxciv,0){\vector(1,0){0}}
4386 \put(\l@youtxcv,0){\line(0,1){\l@youthdiii}}
4387 \put(\l@youtxciv,0){\begin{picture}(\l@youthdiii,\l@youthdiii)
4388 \put(0,-\l@youthdiv){\makebox(0,0)[tr]%
4389 {\l@ypcmd{@dotsep}}}
4390 \end{picture}}
4391 \end{picture}}
4392 \fi
4393 \end{picture}
4394 \end{center}
4395 \setlength{\unitlength}{1pt}
4396 %% \ifdrawparameters\else
4397 \testprintparameters
4398 \ifl@ytempif
4399 % \end{macrocode}
4400 % Print the table of parameter values.
4401 % \begin{macrocode}
4402 \begin{center}
4403 \begin{footnotesize}
4404 Lengths are to the nearest pt. \\
4405 \begin{ttfamily}
4406 \begin{tabular}{l@{\hspace{20pt}}l}
4407 \textit{indent} = \number\l@youthpi pt &
4408 \textit{numwidth} = \number\l@youthpii pt \\
4409 \l@ycmd{@tocrmarg} = \number\l@youthpiii pt &
4410 \l@ycmd{@pnumwidth} = \number\l@youthpiv pt \\
4411 \l@ycmd{@dotsep} = \l@ydotsep & \\
4412 \end{tabular}
4413 \end{ttfamily}\end{footnotesize}
4414 \end{center}
4415 \fi
4416 % \end{macrocode}
4417 % The end of the definition of |\drawtoc|.
4418 % \begin{macrocode}
4419 }
4420
4421 % \end{macrocode}
4422 % \end{macro}
4423 %
4424 %
4425 %
4426 %
4427 % \begin{macro}{\tocdiagram}
4428 % \begin{macro}{\tocdesign}
4429 % Shorthands.
4430 % \begin{macrocode}
4431 \newcommand{\tocdiagram}{\drawparameterstrue\drawtoc}
4432 \newcommand{\tocdesign}{\drawparametersfalse\drawtoc}
4433
4434 % \end{macrocode}
4435 % \end{macro}
4436 % \end{macro}
4437 %
4438 % \begin{macro}{\tocvalues}
4439 % This macro produces a table of the current ToC layout actual values.
4440 % \begin{macrocode}
4441 \newcommand{\tocvalues}{%
4442 \ifprintheadings
4443 Actual ToC layout values.\\[\baselineskip]
4444 \fi
4445 \begingroup\l@yvalsize
4446 \begin{tabular}{l@{\hspace{20pt}}l}
4447 \l@ycmd{@tocrmarg} = \@tocrmarg &
4448 \l@ycmd{@pnumwidth} = \@pnumwidth \\
4449 \l@ycmd{@dotsep} = \@dotsep &
4450 \textit{indent} = ?? \\
4451 \textit{numwidth} = ?? & \\
4452 1em = \l@yval{\l@yonem} & 1ex = \l@yval{\l@yonex} \\
4453 \end{tabular}
4454 \endgroup
4455 }
4456
4457 % \end{macrocode}
4458 % \end{macro}
4459 %
4460 %
4461 %
4462 % \section{Drawing a spread}
4463 %
4464 % We provide a facility for drawing a simple double page spread.
4465 %
4466 % \begin{macro}{\drawaspread}
4467 %
4468 % This command takes eight (8) parameters. These are:
4469 % \begin{enumerate}
4470 % \item The ratio of the height of the foot to the width of the spine. If
4471 % this is zero then the foot height is calculated from the other
4472 % vertical spacings.
4473 % \item The width of a page (as a length).
4474 % \item The ratio of the height of the page to its width.
4475 % \item The ratio of the height of the text to the width of the text.
4476 % \item The ratio of the width of the spine to the width of the page.
4477 % \item The ratio of the height of the top to the width of the spine.
4478 % \item The ratio of the width of the fore edge to the width of the spine.
4479 % \item The ratio of the width of the gutter to the spine (for a two column
4480 % layout). If this is zero, then a single column layout is drawn.
4481 % \end{enumerate}
4482 %
4483 % \begin{macrocode}
4484
4485 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4486 %%%% SPREAD PAGE LAYOUT
4487 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4488
4489 \newcommand{\drawaspread}[8][0]{%
4490 \begingroup
4491 \setlength{\unitlength}{1pt}
4492 % \end{macrocode}
4493 % Get the pagewidth as all values depend on this. Store it in |\l@youthdo|.
4494 % Also use |\l@youtunitlength| to hold it temporarily.
4495 % \begin{macrocode}
4496 \setlength{\l@youtunitlength}{#2}
4497 \l@yltoc{\l@youtunitlength}{\l@youthdo} % page width
4498 \l@youthdiv=\l@youthdo % total width of double spread
4499 \advance\l@youthdiv by \l@youthdo
4500 % \end{macrocode}
4501 % The height of a page is kept in |\l@youtvdo|.
4502 % \begin{macrocode}
4503 \setlength{\l@ylen}{#3\l@youtunitlength}
4504 \l@yltoc{\l@ylen}{\l@youtvdo} % page height
4505 % \end{macrocode}
4506 % The width of the spine is kept in |\l@youthdiii|. We also use
4507 % |\l@youtunitlength| as a temporary store for the spine width.
4508 % \begin{macrocode}
4509 \setlength{\l@ylen}{#5\l@youtunitlength}
4510 \l@yltoc{\l@ylen}{\l@youthdiii} % spine width
4511 \setlength{\l@youtunitlength}{\l@ylen}
4512 % \end{macrocode}
4513 % The width of the fore edge is kept in |\l@youthdi|.
4514 % \begin{macrocode}
4515 \setlength{\l@ylen}{#7\l@youtunitlength}
4516 \l@yltoc{\l@ylen}{\l@youthdi} % fore edge width
4517 % \end{macrocode}
4518 % Calculate the text width and store it in |\l@youthdii|.
4519 % \begin{macrocode}
4520 \l@youthdii=\l@youthdo % text width
4521 \advance\l@youthdii by -\l@youthdi
4522 \advance\l@youthdii by -\l@youthdiii
4523 % \end{macrocode}
4524 % The X coordinate of the left-hand side of the text box on the right-hand
4525 % page is stored in |\l@youtxci|.
4526 % \begin{macrocode}
4527 \l@youtxci=\l@youthdo
4528 \advance\l@youtxci by \l@youthdiii
4529 % \end{macrocode}
4530 % The height of the top margin is stored in |\l@youtvdiii|
4531 % \begin{macrocode}
4532 \setlength{\l@ylen}{#6\l@youtunitlength}
4533 \l@yltoc{\l@ylen}{\l@youtvdiii} % top margin
4534 % \end{macrocode}
4535 % The height of the bottom margin is stored in |\l@youtvdi|.
4536 % \begin{macrocode}
4537 \setlength{\l@ylen}{#1\l@youtunitlength}
4538 \l@yltoc{\l@ylen}{\l@youtvdi} % bottom margin
4539 % \end{macrocode}
4540 % The text height is stored in |\l@youtvdii|.
4541 % \begin{macrocode}
4542 \setlength{\l@ylen}{\l@youthdii pt}
4543 \setlength{\l@ylen}{#4\l@ylen}
4544 \l@yltoc{\l@ylen}{\l@youtvdii} % text height
4545 % \end{macrocode}
4546 % The height of the bottom margin was stored in |\l@youtvdi|. If the
4547 % value is zero then we calculate the height from the page, text and top
4548 % margin height values already obtained.
4549 % \begin{macrocode}
4550 \ifnum\l@youtvdi=\z@
4551 \l@youtvdi=\l@youtvdo
4552 \advance\l@youtvdi by -\l@youtvdiii
4553 \advance\l@youtvdi by -\l@youtvdii
4554 \fi
4555 % \end{macrocode}
4556 % We store the gutter width in |\l@youthdv|.
4557 % \begin{macrocode}
4558 \setlength{\l@ylen}{#8\l@youtunitlength}
4559 \l@yltoc{\l@ylen}{\l@youthdv} % gutter width
4560 % \end{macrocode}
4561 %
4562 % Now we can draw a single column spread.
4563 % \begin{macrocode}
4564 \ifnum\l@youthdv=\z@
4565 \begin{picture}(\l@youthdiv,\l@youtvdo)
4566 \thicklines
4567 \put(0,0){\framebox(\l@youthdiv,\l@youtvdo){}} % spread pages
4568 \put(\l@youthdo,0){\line(0,1){\l@youtvdo}} % the spine
4569 \thinlines
4570 \put(\l@youthdi,\l@youtvdi){\framebox(\l@youthdii,\l@youtvdii){}} % LH text
4571 \put(\l@youtxci,\l@youtvdi){\framebox(\l@youthdii,\l@youtvdii){}} % RH text
4572 \end{picture}
4573 \else
4574 % \end{macrocode}
4575 % We have two columns. Calculate some additional lengths and coordinates.
4576 %
4577 % Store the column width in |\l@youthdvi|.
4578 % \begin{macrocode}
4579 \l@youthdvi=\l@youthdii % column width
4580 \advance\l@youthdvi by -\l@youthdv
4581 \divide\l@youthdvi by \tw@
4582 % \end{macrocode}
4583 % We also need the positions of the x coordinate of the LH inner column
4584 % (store in |\l@youtxcii|) and of the RH outer column (store in
4585 % |\l@youtxciii|).
4586 % \begin{macrocode}
4587 \l@youtxcii=\l@youthdi % X coord of LH inner column
4588 \advance\l@youtxcii by \l@youthdvi
4589 \advance\l@youtxcii by \l@youthdv
4590 \l@youtxciii=\l@youtxci % X coord of RH outer column
4591 \advance\l@youtxciii by \l@youthdvi
4592 \advance\l@youtxciii by \l@youthdv
4593 % \end{macrocode}
4594 % Now draw the two column spread.
4595 % \begin{macrocode}
4596 \begin{picture}(\l@youthdiv,\l@youtvdo)
4597 \thicklines
4598 \put(0,0){\framebox(\l@youthdiv,\l@youtvdo){}} % spread pages
4599 \put(\l@youthdo,0){\line(0,1){\l@youtvdo}} % the spine
4600 \thinlines
4601 \put(\l@youthdi,\l@youtvdi){\framebox(\l@youthdvi,\l@youtvdii){}} % LH LH col
4602 \put(\l@youtxcii,\l@youtvdi){\framebox(\l@youthdvi,\l@youtvdii){}} % LH RH col
4603 \put(\l@youtxci,\l@youtvdi){\framebox(\l@youthdvi,\l@youtvdii){}} % RH LH col
4604 \put(\l@youtxciii,\l@youtvdi){\framebox(\l@youthdvi,\l@youtvdii){}} % RH RH col
4605 \end{picture}
4606 \fi
4607 % \end{macrocode}
4608 % End of the definition of |\drawaspread|.
4609 % \begin{macrocode}
4610 \endgroup
4611 }
4612
4613 % \end{macrocode}
4614 % \end{macro}
4615 %
4616 % \section{Drawing a font box}
4617 %
4618 % We provide a facility for drawing a box around some text. This can also
4619 % be used in a picture environment as |\put(x,y){\frametext{text}}|.
4620 % The |\unitlength| \emph{must} be 1pt!
4621 %
4622 % \begin{macrocode}
4623
4624 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4625 %%%% FONT LAYOUT
4626 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4627
4628 % \end{macrocode}
4629 %
4630 % \begin{macro}{\drawfontframe}
4631 % Draws a tightly fitting box with the text reference point marked and a
4632 % dotted line along the baseline.
4633 % \begin{macrocode}
4634 \newcommand{\drawfontframe}[1]{%
4635 % \end{macrocode}
4636 % Save the (text) argument.
4637 % \begin{macrocode}
4638 \savebox{\layoutsbox}{#1}%
4639 % \end{macrocode}
4640 % Save the width in |\l@youthdo|, height in |\l@youtvdii| and depth in |\l@youtvdi|.
4641 % \begin{macrocode}
4642 \l@yltoc{\wd\layoutsbox}{\l@youthdo}%
4643 \l@yltoc{\ht\layoutsbox}{\l@youtvdii}%
4644 \l@yltoc{\dp\layoutsbox}{\l@youtvdi}%
4645 % \end{macrocode}
4646 % Save the total height in |\l@youtvdo|.
4647 % \begin{macrocode}
4648 \l@youtvdo=\l@youtvdi
4649 \advance\l@youtvdo by \l@youtvdii
4650 % \end{macrocode}
4651 % Save half the width in |\l@youtxci|.
4652 % \begin{macrocode}
4653 \l@youtxci=\l@youthdo
4654 \divide\l@youtxci by \tw@
4655 % \end{macrocode}
4656 % Draw a picture, with origin at the box's baseline. Use |\qbezier| to draw
4657 % a dotted line with a dot at intervals of 2pt.
4658 % \begin{macrocode}
4659 \begin{picture}(\l@youthdo,\l@youtvdii)
4660 \thinlines
4661 \put(0,0){\usebox{\layoutsbox}}
4662 \put(0,0){\circle*{2}}
4663 \qbezier[\l@youtxci](0,0)(\l@youtxci,0)(\l@youthdo,0)
4664 \put(0,-\l@youtvdi){\framebox(\l@youthdo,\l@youtvdo){}}
4665 \end{picture}%
4666 }
4667
4668 % \end{macrocode}
4669 % \end{macro}
4670 %
4671 % \begin{macro}{\drawfontframelabel}
4672 % Draws a tightly fitting box with the text reference point marked and a
4673 % dotted line along the baseline and marks the width, height and depth.
4674 % \begin{macrocode}
4675 \newcommand{\drawfontframelabel}[1]{%
4676 % \end{macrocode}
4677 % Save the (text) argument.
4678 % \begin{macrocode}
4679 \savebox{\layoutsbox}{#1}%
4680 % \end{macrocode}
4681 % Save the width in |\l@youthdo|, height in |\l@youtvdii| and depth in |\l@youtvdi|.
4682 % \begin{macrocode}
4683 \l@yltoc{\wd\layoutsbox}{\l@youthdo}%
4684 \l@yltoc{\ht\layoutsbox}{\l@youtvdii}%
4685 \l@yltoc{\dp\layoutsbox}{\l@youtvdi}%
4686 % \end{macrocode}
4687 % Save the total height in |\l@youtvdo|.
4688 % \begin{macrocode}
4689 \l@youtvdo=\l@youtvdi
4690 \advance\l@youtvdo by \l@youtvdii
4691 % \end{macrocode}
4692 % Save half the width in |\l@youtxci|.
4693 % \begin{macrocode}
4694 \l@youtxci=\l@youthdo
4695 \divide\l@youtxci by \tw@
4696 % \end{macrocode}
4697 % Set |\l@youtdvi| to be space between dimensions and labels.
4698 % \begin{macrocode}
4699 \l@youthdvi=5\relax
4700 % \end{macrocode}
4701 % Add |2\l@youthdvi| plus 7pt (i.e. 17pt) to the box height to allow for
4702 % width label,
4703 % and add |2\l@youthdvi| plus 25pt (i.e 35pt) to the box width to allow
4704 % for height label.
4705 % \begin{macrocode}
4706 \l@youtycv=\l@youtvdii
4707 \advance\l@youtycv by 17\relax
4708 \l@youtxcii=\l@youthdo
4709 \advance\l@youtxcii by 35\relax
4710 % \end{macrocode}
4711 % Draw a picture, with origin at the box's baseline. Use |\qbezier| to draw
4712 % a dotted line with a dot at intervals of 2pt.
4713 % \begin{macrocode}
4714 \begin{picture}(\l@youtxcii,\l@youtycv)
4715 \thinlines
4716 \put(0,0){\usebox{\layoutsbox}}
4717 \put(0,0){\circle*{2}}
4718 \qbezier[\l@youtxci](0,0)(\l@youtxci,0)(\l@youthdo,0)
4719 \put(0,-\l@youtvdi){\framebox(\l@youthdo,\l@youtvdo){}}
4720 % \end{macrocode}
4721 %
4722 % Add the dimension lines and labels (in tiny print).
4723 % Mark the reference point on the left of the box.
4724 % \begin{macrocode}
4725 \begin{tiny}
4726 \put(-\l@youthdvi,0){\makebox(0,0)[r]{reference}}
4727 % \end{macrocode}
4728 % Draw the width dimension above the box and the label above the dimension.
4729 % \begin{macrocode}
4730 \l@youtycv=\l@youtvdii
4731 \advance\l@youtycv by \l@youthdvi
4732 \ifnum\l@youthdo > 6\relax
4733 \l@yhrda{0}{\l@youtycv}{\l@youthdo}
4734 \else
4735 \l@yhrdia{0}{\l@youtycv}{\l@youthdo}
4736 \fi
4737 \advance\l@youtycv by \l@youthdvi
4738 \put(\l@youtxci,\l@youtycv){\makebox(0,0)[b]{width}}
4739 % \end{macrocode}
4740 % Draw the height dimension and label on the right of the box. |\l@youtxcii|
4741 % is the x coordinate of the dimension line(s) and |\l@youtxciii| is the
4742 % x coordinate of the right side label(s).
4743 % \begin{macrocode}
4744 \l@youtxcii=\l@youthdo
4745 \advance\l@youtxcii by \l@youthdvi
4746 \l@youtxciii=\l@youtxcii
4747 \advance\l@youtxciii by \l@youthdvi
4748 \ifnum\l@youtvdii > \z@
4749 % \end{macrocode}
4750 % The height is positive, so draw it, putting the label at the center of
4751 % the dimension line.
4752 % \begin{macrocode}
4753 \ifnum\l@youtvdii > 6\relax
4754 \l@yvuda{\l@youtxcii}{0}{\l@youtvdii}
4755 \else
4756 \l@yvudia{\l@youtxcii}{0}{\l@youtvdii}
4757 \fi
4758 \divide\l@youtvdii by \tw@
4759 \put(\l@youtxciii,\l@youtvdii){\makebox(0,0)[l]{height}}
4760 \fi
4761 \ifnum\l@youtvdi > \z@
4762 % \end{macrocode}
4763 % The depth is positive, so draw it putting the label at the center of
4764 % the dimension line.
4765 % \begin{macrocode}
4766 \ifnum\l@youtvdi > 6\relax
4767 \l@yvuda{\l@youtxcii}{-\l@youtvdi}{\l@youtvdi}
4768 \else
4769 \l@yvudia{\l@youtxcii}{-\l@youtvdi}{\l@youtvdi}
4770 \fi
4771 \divide\l@youtvdi by \tw@
4772 \put(\l@youtxciii,-\l@youtvdi){\makebox(0,0)[l]{depth}}
4773 \fi
4774 % \end{macrocode}
4775 % This finishes the picture. Print the values if asked for.
4776 % \changes{v2.5}{2001/11/11}{Use \cs{ifprintparameters} for \cs{drawfontframelabel}}
4777 % \begin{macrocode}
4778 \end{tiny}
4779 \end{picture}
4780 \ifprintparameters
4781 \begin{center}\begin{footnotesize}\begin{ttfamily}
4782 \begin{tabular}{lll}
4783 \textrm{width} = \the\wd\layoutsbox &
4784 \textrm{height} = \the\ht\layoutsbox &
4785 \textrm{depth} = \the\dp\layoutsbox \\
4786 \end{tabular}
4787 \end{ttfamily}\end{footnotesize}\end{center}
4788 \fi
4789 % \end{macrocode}
4790 % All done.
4791 % \begin{macrocode}
4792 }
4793
4794 % \end{macrocode}
4795 % \end{macro}
4796 %
4797 % The end of this package.
4798 % \begin{macrocode}
4799 %</lays>
4800 % \end{macrocode}
4801 %
4802 %
4803 % \bibliographystyle{alpha}
4804 %
4805 % \begin{thebibliography}{GMS94}
4806 %
4807 % \bibitem[GMS94]{GOOSSENS94}
4808 % Michel Goossens, Frank Mittelbach, and Alexander Samarin.
4809 % \newblock {\em The LaTeX Companion}.
4810 % \newblock Addison-Wesley Publishing Company, 1994.
4811 %
4812 % \bibitem[Wil96]{PRW96i}
4813 % Peter~R. Wilson.
4814 % \newblock {\em {LaTeX for standards: The LaTeX package files user manual}}.
4815 % \newblock NIST Report NISTIR, June 1996.
4816 %
4817 % \end{thebibliography}
4818 %
4819 %
4820 % \Finale
4821 % \PrintIndex
4822 %
4823 \endinput
4824
4825 %% \CharacterTable
4826 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
4827 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
4828 %% Digits \0\1\2\3\4\5\6\7\8\9
4829 %% Exclamation \! Double quote \" Hash (number) \#
4830 %% Dollar \$ Percent \% Ampersand \&
4831 %% Acute accent \' Left paren \( Right paren \)
4832 %% Asterisk \* Plus \+ Comma \,
4833 %% Minus \- Point \. Solidus \/
4834 %% Colon \: Semicolon \; Less than \<
4835 %% Equals \= Greater than \> Question mark \?
4836 %% Commercial at \@ Left bracket \[ Backslash \\
4837 %% Right bracket \] Circumflex \^ Underscore \_
4838 %% Grave accent \` Left brace \{ Vertical bar \|
4839 %% Right brace \} Tilde \~}
4840
4841