The layouts package: Code^{∗}

Peter Wilson Catholic University of America^{†}

          Now at peter.r.wilson@boeing.com

1998/11/14

Abstract

The layouts package provides facilities for document designers to experiment with various aspects of the layout of L^{A}TEXed documents. There is a seperate user manual for the package.

Contents

1 Introduction 2

2 The layouts package 2 2.1 Counters and such . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2.2 Initialisations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.3 Utility commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.4 Drawing the layout of a page . . . . . . . . . . . . . . . . . . . . . 6 2.5 Drawing the layout of a list . . . . . . . . . . . . . . . . . . . . . . 14 2.6 Drawing the layout of footnotes . . . . . . . . . . . . . . . . . . . . 20 2.7 Drawing the layout of paragraphs . . . . . . . . . . . . . . . . . . . 24 2.8 Drawing the layout of section headings . . . . . . . . . . . . . . . . 26 2.9 Drawing the layouts of floats . . . . . . . . . . . . . . . . . . . . . 31

2.9.1 Individual float layout . . . . . . . . . . . . . . . . . . . . . 31 2.9.2 Floats on a page . . . . . . . . . . . . . . . . . . . . . . . . 35

2.10 Drawing the layout of a Table of Contents entry . . . . . . . . . . 39 2.11 Drawing a spread . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 2.12 Drawing a font box . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

∗This file has version number v2.2, last revised 1998/11/14.

†This work was originally performed as a Guest Researcher at the National Institute of Standards and Technology.

1 Introduction

This document provides the commented source for a L^{A}TEX package file developed as part of a suite designed for the typesetting of documents according to the rules for ISO international standards [Wil96]. A seperate document provides the user manual.

Section 2 describes a package to assist in the design of new L^{A}TEX classes and packages by graphically depicting the layout of various logical elements of a document. This package has general applicability and is not restricted to typesetting ISO documents.

This manual is typeset according to the conventions of the L^{A}TEX docstrip utility which enables the automatic extraction of the L^{A}TEX macro source files [GMS94].

2 The layouts package

Announce the name and version of the package which requires L^{A}TEX 2ε.

1 ⟨∗lays⟩

 2 \NeedsTeXFormat{LaTeX2e}
 3 \ProvidesPackage{layouts}[1998/10/14 v2.2 graphical depiction of document elements]

The layouts package provides means of graphically displaying the layout of various logical elements of a document such as section headings, lists, floats, and others.

2.1 Counters and such

First we define some commands, counters, etc., that will be useful later on.

\bs We will be doing a lot of printing of L^{A}TEX commands, so we need a short command to print a backslash.

 4 \@ifundefined{bs}{\newcommand{\bs}{\textbackslash}}%
 5 {\renewcommand{\bs}{\textbackslash}}
\oneinch \eighthalfinch \teninch \eleveninch \onepoint Some generally useful counters. \onepoint is set to 65536 sp and all the others

are set to a value in pts.

 6 \newcount\oneinch
 7 \oneinch=72
 8 \newcount\eighthalfinch
 9 \eighthalfinch=615
10 \newcount\teninch
11 \teninch=723
12 \newcount\eleveninch
13 \eleveninch=795
14 \newcount\onepoint
15 \onepoint=65536

\l@youtscale The scale factor for layout drawings

              16 \newcount\l@youtscale

\l@ylen A length.

              17 \newlength{\l@ylen}

\layoutsbox A box for storing something. There seems to be no reason why the user should not be able to use this.

              18 \newsavebox{\layoutsbox}
\l@youtunitlength This will be used for setting the \unitlength for a picture.
              19 \newlength{\l@youtunitlength}
\l@youtlinethick \l@youtlinethickii These will be usedas parameters to a \linethickness command.
              20 \newlength{\l@youtlinethick}
              21 \newlength{\l@youtlinethickii}
\l@ysetupparskip \l@ysetupbaselineskip Used for storing the document’s \parskip and \baselineskip.
              22 \newlength{\l@ysetupparskip}
              23 \newlength{\l@ysetupbaselineskip}

\l@ytok A useful token

              24 \newtoks\l@ytok

\l@youtpw \l@youtph We use these for storing the page width and height.

              25 \newcount\l@youtpw
              26 \newcount\l@youtph
\l@youthpi \l@youthpii \l@youthpiii \l@youthpiv \l@youthpv \l@youthpvi \l@youthpvii Counters for horizontal drawing parameters.
              27 \newcount\l@youthpi
              28 \newcount\l@youthpii
              29 \newcount\l@youthpiii
              30 \newcount\l@youthpiv
              31 \newcount\l@youthpv
              32 \newcount\l@youthpvi
              33 \newcount\l@youthpvii
\l@youtparskip \l@youtvpi \l@youtvpii \l@youtvpiii \l@youtvpiv \l@youtvpv \l@youtvpvi \l@youtvpvii Counters for vertical drawing parameters.
              34 \newcount\l@youtparskip
              35 \newcount\l@youtvpi
              36 \newcount\l@youtvpii
              37 \newcount\l@youtvpiii
              38 \newcount\l@youtvpiv
              39 \newcount\l@youtvpv
              40 \newcount\l@youtvpvi
              41 \newcount\l@youtvpvii

\l@youthdo \l@youthdi \l@youthdii \l@youthdiii \l@youthdiv \l@youthdv \l@youthdvi \l@youthdvii Horizontal dimensions.
42 \newcount\l@youthdo
43 \newcount\l@youthdi
44 \newcount\l@youthdii
45 \newcount\l@youthdiii
46 \newcount\l@youthdiv
47 \newcount\l@youthdv
48 \newcount\l@youthdvi
49 \newcount\l@youthdvii
\l@youtvdo \l@youtvdi \l@youtvdii \l@youtvdiii \l@youtvdiv \l@youtvdv \l@youtvdvi \l@youtvdvii Vertical dimensions.
50 \newcount\l@youtvdo
51 \newcount\l@youtvdi
52 \newcount\l@youtvdii
53 \newcount\l@youtvdiii
54 \newcount\l@youtvdiv
55 \newcount\l@youtvdv
56 \newcount\l@youtvdvi
57 \newcount\l@youtvdvii
\l@youtxci \l@youtxcii \l@youtxciii \l@youtxciv \l@youtxcv \l@youtxcvi \l@youtxcvii X coordinates.
58 \newcount\l@youtxci
59 \newcount\l@youtxcii
60 \newcount\l@youtxciii
61 \newcount\l@youtxciv
62 \newcount\l@youtxcv
63 \newcount\l@youtxcvi
64 \newcount\l@youtxcvii
\l@youtyci \l@youtycii \l@youtyciii \l@youtyciv \l@youtycv \l@youtycvi \l@youtycvii Y coordinates.
65 \newcount\l@youtyci
66 \newcount\l@youtycii
67 \newcount\l@youtyciii
68 \newcount\l@youtyciv
69 \newcount\l@youtycv
70 \newcount\l@youtycvi
71 \newcount\l@youtycvii

2.2 Initialisations

The following are used to set up default conditions.

\ifoddpagelayout Set TRUE to draw an oddside page.

72 \newif\ifoddpagelayout
73 \oddpagelayouttrue

\iftwocolumnlayout Set TRUE to draw a two column page.

74 \newif\iftwocolumnlayout
75 \twocolumnlayoutfalse

\ifdrawparameters Set TRUE to draw a layout with marked dimension lines.

76 \newif\ifdrawparameters
77 \drawparameterstrue

\iflistaspara Set TRUE to draw lists as stand-alone paragraph.

78 \newif\iflistaspara
79 \listasparatrue

\ifruninhead Set TRUE to draw a run-in heading.

80 \newif\ifruninhead
81 \runinheadfalse

\setlayoutscale A user command to set the drawing scale. The scale is initialised to half size.

82 \newcommand{\setlayoutscale}[1]{\setlength{\l@youtunitlength}{1pt}
83 \l@youtunitlength = #1\l@youtunitlength}
84 \setlayoutscale{0.5}
\setuplayouts The \setuplayouts command should be called immediately at the \begin{document}.

It must be called before any command that changes font sizes or makes any change to the document layout. It stores relevant skips.

85 \newcommand{\setuplayouts}{%
86 \setlength{\l@ysetupparskip}{\parskip}
87 \setlength{\l@ysetupbaselineskip}{\baselineskip}
88 \setlayoutscale{0.5}
89 \PackageWarning{layouts}{Layout scale set to 0.5}

90 }

91 \AtBeginDocument{\setuplayouts}

2.3 Utility commands

A variety of utility commands.

\l@yltoc \l@yltoc{⟨length⟩}{⟨counter⟩} converts a length into a counter value. The counter value is to the nearest pt of the length.

92 \newcommand{\l@yltoc}[2]{\setlength{\l@ylen}{#1}
93  \ifdim\l@ylen > \z@ \advance\l@ylen by 0.5\p@ \else
94  \ifdim\l@ylen < \z@ \advance\l@ylen by -0.5\p@
95  \fi
96  \fi
97  #2=\l@ylen
98  \divide #2 by \onepoint}

\l@yvuda \l@yhrda \l@yvuda{⟨x⟩}{⟨y⟩}{⟨distance⟩} draws a line vertically upwards from (⟨x⟩,⟨y⟩) a ⟨distance⟩ with an outward pointing arrowhead at each end of the line. \l@yhrda is similar except that a horizontal line is drawn to the right. Simplistically, the commands produce something like <---->.

99 \newcommand{\l@yvuda}[3]{\put(#1,#2){\vector(0,1){#3}}
100  \put(#1,#2){\vector(0,-1){0}}}

101 \newcommand{\l@yhrda}[3]{\put(#1,#2){\vector(1,0){#3}}
102  \put(#1,#2){\vector(-1,0){0}}}

\l@yvudia \l@yhrdia \l@yvudia{⟨x⟩}{⟨y⟩}{⟨distance⟩} draws two vertical arrowheads pointing to each other. One is at (⟨x⟩,⟨y⟩) and the other is at (⟨x⟩,⟨y + distance⟩). \l@yhrdia is similar except that the arrowheads are horizontal. Simplistically, the commands produce something like > <.

103 \newcommand{\l@yvudia}[3]{\begingroup
104  \l@youthpvii=#1\relax
105  \l@youtvpvii=#2\relax
106  \l@youthdvii=#3\relax
107  \put(\l@youthpvii,\l@youtvpvii){\vector(0,1){0}}
108  \advance\l@youtvpvii by \l@youthdvii
109  \put(\l@youthpvii,\l@youtvpvii){\vector(0,-1){0}}
110  \endgroup}
111 \newcommand{\l@yhrdia}[3]{\begingroup
112  \l@youthpvii=#1\relax
113  \l@youtvpvii=#2\relax
114  \l@youthdvii=#3\relax
115  \put(\l@youthpvii,\l@youtvpvii){\vector(1,0){0}}
116  \advance\l@youthpvii by \l@youthdvii
117  \put(\l@youthpvii,\l@youtvpvii){\vector(-1,0){0}}
118  \endgroup}

2.4 Drawing the layout of a page

A variety of commands are used to draw the layout of a page.

First some utility commands for setting the layout dimensions.

\trypagewidth Sets the pagewidth and stores the result in \l@youtpw.
119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
120 %%%%    PAGE LAYOUT
121 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
122 \newcommand{\trypagewidth}[1]{\l@yltoc{#1}{\l@youtpw}}
\trypageheight Sets the pageheight and stores the result in \l@youtph.
123 \newcommand{\trypageheight}[1]{\l@yltoc{#1}{\l@youtph}}
\tryhoffset Sets the hoffset and stores the result in \l@youthpi.
124 \newcommand{\tryhoffset}[1]{\l@yltoc{#1}{\l@youthpi}}
\tryvoffset Sets the voffset and stores the result in \l@youtvpi.
125 \newcommand{\tryvoffset}[1]{\l@yltoc{#1}{\l@youtvpi}}
\trytopmargin Sets the topmargin and stores the result in \l@youtvpii.
126 \newcommand{\trytopmargin}[1]{\l@yltoc{#1}{\l@youtvpii}}
\tryheadheight Sets the headheight and stores the result in \l@youtvpiii.
127 \newcommand{\tryheadheight}[1]{\l@yltoc{#1}{\l@youtvpiii}}

\tryheadsep Sets the headsep and stores the result in \l@youtvpiv.
128 \newcommand{\tryheadsep}[1]{\l@yltoc{#1}{\l@youtvpiv}}
\trytextheight Sets the textheight and stores the result in \l@youtvpv.
129 \newcommand{\trytextheight}[1]{\l@yltoc{#1}{\l@youtvpv}}
\tryfootskip Sets the footskip and stores the result in \l@youtvpvi.
130 \newcommand{\tryfootskip}[1]{\l@yltoc{#1}{\l@youtvpvi}}
\tryoddsidemargin Sets the oddsidemargin and stores the result in \l@youthpv.
131 \newcommand{\tryoddsidemargin}[1]{\l@yltoc{#1}{\l@youthpv}}
\tryevensidemargin Sets the evensidemargin and stores the result in \l@youthpiv.
132 \newcommand{\tryevensidemargin}[1]{\l@yltoc{#1}{\l@youthpiv}}
\trytextwidth Sets the textwidth and stores the result in \l@youthpii.
133 \newcommand{\trytextwidth}[1]{\l@yltoc{#1}{\l@youthpii}}
\trymarginparsep Sets the marginparsep and stores the result in \l@youthpvi.
134 \newcommand{\trymarginparsep}[1]{\l@yltoc{#1}{\l@youthpvi}}
\trymarginparwidth Sets the marginparwidth and stores the result in \l@youthpvii.
135 \newcommand{\trymarginparwidth}[1]{\l@yltoc{#1}{\l@youthpvii}}
\trymarginparpush Sets the marginparpush and stores the result in \l@youtvpvii.
136 \newcommand{\trymarginparpush}[1]{\l@yltoc{#1}{\l@youtvpvii}}
\trycolumnsep Sets the columnsep and stores the result in \l@youthpiii.
137 \newcommand{\trycolumnsep}[1]{\l@yltoc{#1}{\l@youthpiii}}
\trycolumnseprule Sets the columnseprule and stores the result in \l@youtlinethick.
138 \newcommand{\trycolumnseprule}[1]{\setlength{\l@youtlinethick}{#1}}

\currentpage This routine sets the layout page parameters to those specified for the document.

139 \newcommand{\currentpage}{%
140 \@ifundefined{pagewidth}{\trypagewidth{8.5in}}%
141  {\trypagewidth{\pagewidth}}
142 \@ifundefined{pageheight}{\trypageheight{11in}}%
143  {\trypageheight{\pageheight}}
144 \tryhoffset{\hoffset}               % typically 0pt
145 \tryvoffset{\voffset}               % typically 0pt
146 \tryoddsidemargin{\oddsidemargin}   % typically 21-63pt
147 \tryevensidemargin{\evensidemargin} % typically 39-82pt
148 \trymarginparwidth{\marginparwidth} % typically 68-107pt
149 \trymarginparsep{\marginparsep}     % typically 10-11pt
150 \trymarginparpush{\marginparpush}   % typically 5-7pt
151 \trytopmargin{\topmargin}           % typically 27pt
152 \tryheadheight{\headheight}         % typically 12pt

153 \tryheadsep{\headsep}               % typically 25pt
154 \tryfootskip{\footskip}             % typically 30pt
155 \trytextheight{\textheight}         % typically 36-43 times baselineskip
156 \trytextwidth{\textwidth}           % typically 345-390pt
157 \trycolumnsep{\columnsep}           % typically 10pt
158 \trycolumnseprule{\columnseprule}   % typically 0pt

159 }

\drawpage This routine draws a page layout.

160 \newcommand{\drawpage}{%

First set some default vertical and horizontal dimension values.

161 \l@youtvdiii=\teninch
162  \divide\l@youtvdiii by 24\relax
163 \l@youthdii=\l@youtvdiii
164 \ifdrawparameters

When drawparameters is TRUE, we draw a generic layout showing the controlling layout variables.

165  \l@youtph=\eleveninch     % page height
166  \l@youtpw=\eighthalfinch  % page width
167  \l@youtvpi=\z@            % voffset
168  \l@youtvpii=\l@youtvdiii  % topmargin
169  \l@youtvpiii=\l@youtvdiii % headheight
170  \l@youtvpiv=\l@youtvdiii  % headsep
171  \l@youtvpv=\oneinch       % textheight
172  \multiply\l@youtvpv by 6\relax
173  \l@youtvpvi=\l@youtvdiii  % footskip
174  \multiply\l@youtvpvi by \tw@
175  \l@youtvpvii=\l@youtvdiii % marginparpush
176  \l@youthpi=\z@            % hoffset
177  \l@youthpii=\l@youthdii   % textwidth
178  \multiply\l@youthpii by 13\relax
179  \l@youthpiii=\l@youthdii  % columnsep
180  \l@youthpiv=\l@youthdii   % evensidemargin
181  \l@youthpv=\l@youthdii    % oddsidemargin
182  \l@youthpvi=\l@youthdii   % marginparsep
183  \l@youthpvii=\l@youthdii  % marginparwidth
184  \multiply\l@youthpvii by \tw@
185 \fi

Calculate coordinates for use in the drawing.

186 \l@youtycvi=\l@youtph                  % one inch below top of page
187  \advance\l@youtycvi by -\oneinch
188 \l@youtxci=\l@youthpi                  % hofref
189  \advance\l@youtxci by \oneinch
190 \l@youtycv=\l@youtycvi                 % vofref
191  \advance\l@youtycv by -\l@youtvpi
192 \l@youtyciv=\l@youtycv                 % headref
193  \advance\l@youtyciv by -\l@youtvpii

194  \advance\l@youtyciv by -\l@youtvpiii
195 \l@youtycii=\l@youtyciv                % bodyref
196  \advance\l@youtycii by -\l@youtvpiv
197  \advance\l@youtycii by -\l@youtvpv
198 \l@youtvdi=\l@youtvpvi                 % footheight
199  \divide\l@youtvdi by \tw@
200 \l@youtyci=\l@youtycii                 % footref
201  \advance\l@youtyci by -\l@youtvpvi
202 \l@youtvdii=\l@youtvpv                 % noteheight
203  \divide\l@youtvdii by 4\relax
204 \l@youtyciii=\l@youtycii               % noteref
205  \advance\l@youtyciii by \l@youtvdii
206  \advance\l@youtyciii by \l@youtvpvii
207 \ifoddpagelayout

Some values are different on odd and even pages

208 %    \typeout{Odd page layout.}
209  \l@youtxcii=\l@youtxci               % marginref
210  \advance\l@youtxcii by \l@youthpv
211  \l@youtxciv=\l@youtxcii              % margnoteref
212  \advance\l@youtxciv by \l@youthpii
213  \advance\l@youtxciv by \l@youthpvi
214 \else
215 %    \typeout{Even page layout.}
216  \l@youtxcii=\l@youtxci               % marginref
217  \advance\l@youtxcii by \l@youthpiv
218  \l@youtxciv=\l@youtxcii              % margnoteref
219  \advance\l@youtxciv by -\l@youthpvi
220  \advance\l@youtxciv by -\l@youthpvii
221 \fi

Now for column dependent values.

222 \l@youthdi=\l@youthpii                 % columnwidth
223 \l@youtxciii=\l@youtxcii               % colref
224 \iftwocolumnlayout
225 %    \typeout{Two column layout.}
226  \advance\l@youthdi by -\l@youthpiii
227  \divide\l@youthdi by \tw@
228  \advance\l@youtxciii by \l@youthdi
229  \advance\l@youtxciii by \l@youthpiii
230  \l@youtxcv=\l@youthpiii              % centre of gutter
231  \divide\l@youtxcv by \tw@
232  \advance\l@youtxcv by \l@youtxcii
233  \advance\l@youtxcv by \l@youthdi
234 \fi

Print the caption for the top of the drawing.

235 \begin{center}
236 \begin{small} Dashed lines represent (\texttt{\bs hoffset + 1 inch}) and
237  (\texttt{\bs voffset + 1 inch}) from the top left hand corner of the
238  page. \end{small} \\

239 \medskip

Draw the picture!

240 \setlength{\unitlength}{\l@youtunitlength}
241 \begin{picture}(\l@youtpw,\l@youtph)
242  \thicklines

Either reference lines for the page top and side, or the page.

243  \ifdrawparameters
244  \put(0,0){\line(0,1){\l@youtph}}
245  \put(0,\l@youtph){\line(1,0){\l@youtpw}}
246  \else
247  \put(0,0){\framebox(\l@youtpw,\l@youtph){}}
248  \fi

Draw the offset lines and a circle 1 inch from the top LH corner of the page.

249  \put(\oneinch,\l@youtycvi){\circle{12}}
250  \put(0,\l@youtycv){\dashbox{10}(\l@youtpw,0){}}
251  \put(\l@youtxci,0){\dashbox{10}(0,\l@youtph){}}
 Draw the header. put(marginref,headref){framebox(textwidth,headheight)}
252  \put(\l@youtxcii,\l@youtyciv){\framebox(\l@youthpii,\l@youtvpiii)%
253  {\footnotesize Header}}

Draw the body.

254  \iftwocolumnlayout
 put(marginref,bodyref){framebox(columnwidth,textheight)} and
 put(colref,bodyref){framebox(columnwidth,textheight)}.
255  \put(\l@youtxcii,\l@youtycii){\framebox(\l@youthdi,\l@youtvpv)%
256  {Col. 1}}
257  \put(\l@youtxciii,\l@youtycii){\framebox(\l@youthdi,\l@youtvpv)%
258  {Col. 2}}
259  \linethickness{\l@youtlinethick}
260  \put(\l@youtxcv,\l@youtycii){\line(0,1){\l@youtvpv}}
261  \thicklines
262  \else
 put(marginref,bodyref){framebox(textwidth,textheight)}.
263  \put(\l@youtxcii,\l@youtycii){\framebox(\l@youthpii,\l@youtvpv)%
264  {Body}}
265  \fi
 Draw the footer. put(marginref,footref){framebox(textwidth,footheight)}
266  \put(\l@youtxcii,\l@youtyci){\framebox(\l@youthpii,\l@youtvdi)%
267  {\footnotesize Footer}}

Marginal notes (two examples).

 put(margnoteref,bodyref){framebox(marginparwidth,noteheight)} and
 put(margnoteref,noteref){framebox(marginparwidth,noteheight)}.
268  \ifdrawparameters
269  \put(\l@youtxciv,\l@youtycii){\framebox(\l@youthpvii,\l@youtvdii){}}
270  \put(\l@youtxciv,\l@youtyciii){\framebox(\l@youthpvii,\l@youtvdii)%

271  {\footnotesize\shortstack{Margin\\Note}}}
272  \else
273  \put(\l@youtxciv,\l@youtycii){\framebox(\l@youthpvii,\l@youtvdii)%
274  {\footnotesize Note}}
275  \put(\l@youtxciv,\l@youtyciii){\framebox(\l@youthpvii,\l@youtvdii)%
276  {\footnotesize Margin}}
277  \fi
278  \ifdrawparameters

We now draw labelled vectors indicating the layout parameters. Life gets tedious as we have to calculate a few more coordinate and length values. The code below is fairly incomprehensible as we are trying to minimise the number of counters.

279  \l@youtxcv=\l@youtxcii                % X coord for vertical dimensions
280  \advance\l@youtxcv by \l@youthdii
281  \l@youtvpii=\l@youthpvii              % X coord for marginparpush
282  \divide\l@youtvpii by \tw@
283  \advance\l@youtvpii by \l@youtxciv
284  \l@youtvpvii=\l@youtvdiii             % half l@youtvdiii
285  \divide\l@youtvpvii by \tw@
286  \l@youtvpiii=\l@youtycii              % Y coord for low dimensions
287  \advance\l@youtvpiii by \l@youtvdiii
288  \l@youtvpiv=\l@youtvpiii              % Y coord for mid dimensions
289  \advance\l@youtvpiv by \l@youtvdiii
290  \l@youtvdi=\l@youtyciii               % Y coord for top dimensions
291  \advance\l@youtvdi by \l@youtvdii
292  \advance\l@youtvdi by -\l@youtvdiii

Draw the vertical dimensional parameters.

    Topmargin. put(x,voffset){vector(0,-1){topmargin}}
293  \put(\l@youtxcv,\l@youtycv){\vector(0,-1){\l@youtvdiii}}
294  \put(\l@youtxcv,\l@youtycv){\begin{picture}(\l@youtvpvii,\l@youtvpvii)
295  \put(\l@youtvpvii,-\l@youtvpvii){\footnotesize\texttt{\bs topmargin}}
296  \end{picture}}
 Headheight. put(x,voffset-topmargin){vector(0,-1){headheight}}
297  \put(\l@youtxcv,\l@youtyciv){\line(0,1){\l@youtvdiii}}
298  \put(\l@youtxcv,\l@youtyciv){\vector(0,-1){0}}
299  \put(\l@youtxcv,\l@youtyciv){\begin{picture}(\l@youtvpvii,\l@youtvpvii)
300  \put(\l@youtvpvii,\l@youtvpvii){\footnotesize\texttt{\bs headheight}}
301  \end{picture}}
 Headsep. put(x,headref){vector(0,-1){headsep}}
302  \put(\l@youtxcv,\l@youtyciv){\vector(0,-1){\l@youtvdiii}}
303  \put(\l@youtxcv,\l@youtyciv){\begin{picture}(\l@youtvpvii,\l@youtvpvii)
304  \put(\l@youtvpvii,-\l@youtvpvii){\footnotesize\texttt{\bs headsep}}
305  \end{picture}}
 Textheight. put(x,top_of_text){vector(0,-1){textheight}}
306  \put(\l@youtxcv,\l@youtycii){\line(0,1){\l@youtvpv}}
307  \put(\l@youtxcv,\l@youtycii){\vector(0,-1){0}}
308  \put(\l@youtxcv,\l@youtycii){\begin{picture}(\l@youtvpvii,\l@youtvpvii)

309  \put(\l@youtvpvii,\l@youtvpvii){\footnotesize\texttt{\bs textheight}}
310  \end{picture}}
 Footskip. put(x,bodyref){vector(0,-1){footskip}}
311  \put(\l@youtxcv,\l@youtycii){\vector(0,-1){\l@youtvpvi}}
312  \put(\l@youtxcv,\l@youtycii){\begin{picture}(\l@youtvpvii,\l@youtvpvii)
313  \put(\l@youtvpvii,-\l@youtvpvii){\footnotesize\texttt{\bs footskip}}
314  \end{picture}}
 Marginparpush. put(X,noteref){vector(0,-1){marginparpush}} where
 X = margnoteref + 1/2 notewidth.
315  \put(\l@youtvpii,\l@youtyciii){\vector(0,-1){\l@youtvdiii}}
316  \put(\l@youtvpii,\l@youtyciii){\begin{picture}(\l@youtvpvii,\l@youtvpvii)
317  \put(\l@youtvpvii,-\l@youtvpvii){\footnotesize\texttt{\bs marginparpush}}
318  \end{picture}}

Now for all the horizontal dimensions.

    Marginparwidth. put(margnoteref,low){vector(1,0){marginparwidth}
319  \put(\l@youtxciv,\l@youtvpiii){\vector(1,0){\l@youthpvii}}
320  \put(\l@youtxciv,\l@youtvpiii){\begin{picture}(\l@youtvpvii,\l@youtvpvii)
321  \put(\l@youtvpvii,\l@youtvpvii){\footnotesize\texttt{\bs marginparwidth}}
322  \end{picture}}

Different placements for margins depending on odd or even page.

323  \ifoddpagelayout
 Oddsidemargin — put(hoffref,mid){\vector(1,0){oddsidemargin} and
 Marginparsep —put(margnoteref-marginparsep,mid){vector(1,0){marginparsep}
324  \put(\l@youtxci,\l@youtvpiv){\vector(1,0){\l@youthdii}}
325  \put(\l@youtxci,\l@youtvpiv){\begin{picture}(\l@youtvpvii,\l@youtvpvii)
326  \put(\l@youtvpvii,\l@youtvpvii){\footnotesize\texttt{\bs oddsidemargin}}
327  \end{picture}}
328  \put(\l@youtxciv,\l@youtvpiv){\line(-1,0){\l@youthdii}}
329  \put(\l@youtxciv,\l@youtvpiv){\vector(1,0){0}}
330  \put(\l@youtxciv,\l@youtvpiv){\begin{picture}(\l@youtvpvii,\l@youtvpvii)
331  \put(-\l@youtvpvii,\l@youtvpvii){\footnotesize\texttt{\bs marginparsep}}
332  \end{picture}}
333  \else
 Evensidemargin — put(hoffref,mid){\vector(1,0){evensidemargin} and
 Marginparsep —put(marginref,top){vector(-1,0){marginparsep}
334  \put(\l@youtxci,\l@youtvpiv){\vector(1,0){\l@youthdii}}
335  \put(\l@youtxci,\l@youtvpiv){\begin{picture}(\l@youtvpvii,\l@youtvpvii)
336  \put(\l@youtvpvii,\l@youtvpvii){\footnotesize\texttt{\bs evensidemargin}}
337  \end{picture}}
338  \put(\l@youtxcii,\l@youtvdi){\vector(-1,0){\l@youthdii}}
339  \put(\l@youtxcii,\l@youtvdi){\begin{picture}(\l@youtvpvii,\l@youtvpvii)
340  \put(-\l@youtvpvii,\l@youtvpvii){\footnotesize\texttt{\bs marginparsep}}
341  \end{picture}}
342  \fi

 Textwidth. put(marginref,noteref){vector(1,0){textwidth}}
343  \put(\l@youtxcii,\l@youtyciii){\vector(1,0){\l@youthpii}}
344  \put(\l@youtxcv,\l@youtyciii){\begin{picture}(\l@youtvpvii,\l@youtvpvii)
345  \put(\l@youtvpvii,\l@youtvpvii){\footnotesize\texttt{\bs textwidth}}
346  \end{picture}}
 Columnsep. put(colref-colsep,mid){vector(1,0){colsep}}
347  \iftwocolumnlayout
348  \put(\l@youtxciii,\l@youtvpiv){\line(-1,0){\l@youthpiii}}
349  \put(\l@youtxciii,\l@youtvpiv){\vector(1,0){0}}
350  \put(\l@youtxciii,\l@youtvpiv){\begin{picture}(\l@youtvpvii,\l@youtvpvii)
351  \put(-\l@youtvpvii,\l@youtvpvii){\footnotesize\texttt{\bs columnsep}}
352  \end{picture}}
353  \fi

Have finished drawing the parameters.

354  \fi
355  \end{picture}
356  \end{center}
357  \setlength{\unitlength}{1pt}
358  \ifdrawparameters\else

Print the actual parameter values.

359  \begin{center}
360 %%%      \vspace*{\l@ysetupbaselineskip}
361  \begin{footnotesize}
362  Lengths are to the nearest pt. \\
363  \begin{tt}
364  \begin{tabular}{l@{\hspace{20pt}}l}
365  \textrm{page height} = \number\l@youtph pt &
366  \textrm{page width} = \number\l@youtpw pt  \\
367  \bs hoffset = \number\l@youthpi pt         &
368  \bs voffset = \number\l@youtvpi pt         \\
369  \ifoddpagelayout
370  \bs oddsidemargin = \number\l@youthpv pt
371  \else
372  \bs evensidemargin = \number\l@youthpiv pt
373  \fi
374  & \bs topmargin = \number\l@youtvpii pt    \\
375  \bs headheight = \number\l@youtvpiii pt    &
376  \bs headsep = \number\l@youtvpiv pt        \\
377  \bs textheight = \number\l@youtvpv pt      &
378  \bs textwidth = \number\l@youthpii pt      \\
379  \bs footskip = \number\l@youtvpvi pt       &
380  \bs marginparsep = \number\l@youthpvi pt   \\
381  \bs marginparpush = \number\l@youtvpvii pt &
382  \bs columnsep = \number\l@youthpiii pt     \\
383  \bs columnseprule = \the\l@youtlinethick & \\
384  \end{tabular}
385  \end{tt}\end{footnotesize}
386  \end{center}

387  \fi

The end of the definition for \drawpage.

388 }

2.5 Drawing the layout of a list

We provide a facility for drawing the layout of a L^{A}TEX list environment. First the \try... commands for setting trial list parameters.

\tryitemindent Sets a trial value for itemindent and stores the result in \l@youthpi.

389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
390 %%%%    LIST LAYOUT
391 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
392 \newcommand{\tryitemindent}[1]{\l@yltoc{#1}{\l@youthpi}}

\trylabelwidth Sets a trial value for labelwidth and stores the result in \l@youthpii.

393 \newcommand{\trylabelwidth}[1]{\l@yltoc{#1}{\l@youthpii}}

\trylabelsep Sets a trial value for labelsep and stores the result in \l@youthpiii.

394 \newcommand{\trylabelsep}[1]{\l@yltoc{#1}{\l@youthpiii}}

\tryleftmargin Sets a trial value for leftmargin and stores the result in \l@youthpiv.

395 \newcommand{\tryleftmargin}[1]{\l@yltoc{#1}{\l@youthpiv}

But the left margin must not be less than zero.

396  \ifnum\l@youthpiv < \z@
397  \l@youthpiv = \z@
398  \fi}

\tryrightmargin Sets a trial value for rightmargin and stores the result in \l@youthpv.

399 \newcommand{\tryrightmargin}[1]{\l@yltoc{#1}{\l@youthpv}}
\trylistparindent Sets a trial value for listparindent and stores the result in \l@youthpvi.
400 \newcommand{\trylistparindent}[1]{\l@yltoc{#1}{\l@youthpvi}}

\trytopsep Sets a trial value for topsep and stores the result in \l@youtvpi.

401 \newcommand{\trytopsep}[1]{\l@yltoc{#1}{\l@youtvpi}}

\tryparskip Sets a trial value for parskip and stores the result in \l@youtparskip.

402 \newcommand{\tryparskip}[1]{\l@yltoc{#1}{\l@youtparskip}}

\trypartopsep Sets a trial value for partopsep and stores the result in \l@youtvpiii.

403 \newcommand{\trypartopsep}[1]{\l@yltoc{#1}{\l@youtvpiii}}

\tryparsep Sets a trial value for parsep and stores the result in \l@youtvpiv.

404 \newcommand{\tryparsep}[1]{\l@yltoc{#1}{\l@youtvpiv}}

\tryitemsep Sets a trial value for itemsep and stores the result in \l@youtvpv.

405 \newcommand{\tryitemsep}[1]{\l@yltoc{#1}{\l@youtvpv}}

\currentlist This routine sets the trial list parameters to be those of the current list environment.

406 \newcommand{\currentlist}{%
407 \tryitemindent{\itemindent}       % typically 0pt
408 \trylabelwidth{\labelwidth}       % typically  pt
409 \trylabelsep{\labelsep}           % typically 0.5em
410 \tryleftmargin{\leftmargin}       % typically  pt
411 \tryrightmargin{\rightmargin}     % typically  pt
412 \trylistparindent{\listparindent} % typically 0pt
413 \trytopsep{\topsep}               % typically  pt
414 \tryparskip{\l@ysetupparskip}     % typically  pt
415 \trypartopsep{\partopsep}         % typically  pt
416 \tryparsep{\parsep}               % typically  pt
417 \tryitemsep{\itemsep}             % typically  pt

418 }

\drawlist This routine draws the layout of a list environment.

419 \newcommand{\drawlist}{%

First set some some default vertical and horizontal dimensions.

420 \l@youthdo=\oneinch
421 \l@youtvdo=\oneinch
422  \multiply\l@youtvdo by 12\relax
423  \divide\l@youtvdo by 10\relax
424 \l@youthdi=\eighthalfinch  % major textwidth
425 \ifdrawparameters

When drawparameters is TRUE, we draw a generic layout showing the controlling layout variables.

426  \l@youthpi=60\relax                      % itemindent
427  \l@youthpii=80\relax                     % labelwidth
428  \l@youthpiii=\l@youthpi                  % labelsep
429  \divide\l@youthpiii by \tw@
430  \l@youthpiv=\l@youthpi                   % leftmargin
431  \advance\l@youthpiv by \l@youthpii
432  \advance\l@youthpiv by \l@youthpiii
433  \l@youthpv=\l@youthpiv                   % rightmargin
434  \multiply\l@youthpv by \tw@
435  \divide\l@youthpv by \thr@@
436  \l@youthpvi=\l@youthpi                   % listparindent
437  \multiply\l@youthpvi by 4\relax
438  \divide\l@youthpvi by \thr@@
439  \l@youtvpi=40\relax                      % topsep
440  \l@youtparskip=\l@youtvpi                % parskip
441  \l@youtvpiii=\l@youtvpi                  % partopsep
442  \l@youtvpiv=\l@youtvpi                   % parsep
443  \l@youtvpv=\l@youtvpi                    % itemsep

444 \fi

Finished with the set up for drawing parameters. Continue calculating other dimensions and coordinates.

445 \l@youtvdvii=\l@youtvpi                  % topsep + parskip (+ partopsep)
446  \advance\l@youtvdvii by \l@youtparskip
447  \iflistaspara
448  \advance\l@youtvdvii by \l@youtvpiii
449  \fi
450 \l@youtvdvi=\l@youtvpv                   % itemsep + parsep
451  \advance\l@youtvdvi by \l@youtvpiv
452 \l@youtyci=\oneinch                      % Y coord of base of item 2
453  \advance\l@youtyci by \l@youtvdvii
454 \l@youtxci=\z@                           % X coord of LH list text
455  \advance\l@youtxci by \l@youthpiv
456 \l@youthdii=\l@youthdi                   % major width of item text
457  \advance\l@youthdii by -\l@youthpiv
458  \advance\l@youthdii by -\l@youthpv
459 \l@youthdiii=\l@youthpi                  % inset of labelled list line
460 \l@youtvdii=\l@youtvdo                   % vertical dim of short inset line
461  \divide\l@youtvdii by 4\relax
462 \l@youthdiv=\l@youthdii                  % X dim of item 2 box top
463  \advance\l@youthdiv by -\l@youthdiii
464 \l@youtvdi=\l@youtvdo                    % Y dim of RH item box
465  \advance\l@youtvdi by \l@youtvdii
466 \l@youtvdiii=\l@youtvdii                 % height of label box
467  \multiply\l@youtvdiii by \thr@@
468  \divide\l@youtvdiii by 4\relax
469 \l@youtxcii=\l@youthdiii                 % X coord of BL of label box
470  \advance\l@youtxcii by -\l@youthpiii
471  \advance\l@youtxcii by -\l@youthpii
472 \l@youtycii=\l@youtvdi                   % Y coord of BL of label box
473  \advance\l@youtycii by -\l@youtvdiii
474 \l@youtyciii=\l@youtyci                  % Y coord of base of para
475  \advance\l@youtyciii by \l@youtvdi
476  \advance\l@youtyciii by \l@youtvdvi
477 \l@youthdv=\l@youthdii                   % Hor. dim of top of para box
478  \advance\l@youthdv by -\l@youthpvi
479 \l@youtyciv=\l@youtyciii                 % Y coord of base of item 1
480  \advance\l@youtyciv by \l@youtvdi
481  \advance\l@youtyciv by \l@youtvpiv
482 \l@youtycv=\l@youtyciv                   % Y coord of base of preceeding text
483  \advance\l@youtycv by \l@youtvdi
484  \advance\l@youtycv by \l@youtvdvii
485 \l@youtvdiv=\l@youtycv                   % Height of picture
486  \advance\l@youtvdiv by \oneinch
487 \l@youtxciii=\l@youtxci                  % X coord of vertical lines
488  \advance\l@youtxciii by \l@youtxci
489  \advance\l@youtxciii by \l@youthdii
490  \divide\l@youtxciii by \tw@

491 \l@youtycvi=\l@youtvdi                   % Y coord for margin lines
492  \divide\l@youtycvi by \tw@
493 \l@youtycvii=\l@youtvdi                  % Y coord for indent/sep lines
494 \l@youtvdv=\l@youtvpiv                   % small dimension (1/2 parsep)
495  \divide\l@youtvdv by \tw@
496 \l@youtxcvii=\l@youtycii                 % Y coord for labelwidth
497  \advance\l@youtxcvii by \l@youtvdiii
498  \advance\l@youtxcvii by \l@youtvdv

Draw the picture!

499 \begin{center}
500 \setlength{\unitlength}{\l@youtunitlength}
501 \begin{picture}(\eighthalfinch,\l@youtvdiv)
502  \thinlines

Draw a box (textwidth,height) representing the page.

503  \put(0,0){\dashbox{10}(\l@youthdi,\l@youtvdiv){}}
504  \thicklines

Draw successor text box 1 inch deep.

505  \put(0,0){\framebox(\l@youthdi,\oneinch){Following Text}}

Draw item box 2

506  \put(\l@youtxci,\l@youtyci){\begin{picture}(\l@youthdii,\l@youtvdi)

The LH horizontal and vertical lines.

507  \put(0,0){\line(1,0){\l@youthdii}}
508  \put(0,0){\line(0,1){\l@youtvdo}}

The lines for the inset (which may be positive or negative).

509  \ifnum\l@youthdiii > \z@
510  \put(\l@youthdiii,\l@youtvdo){\line(-1,0){\l@youthdiii}}
511  \else
512  \put(\l@youthdiii,\l@youtvdo){\line(1,0){-\l@youthdiii}}
513  \fi
514  \put(\l@youthdiii,\l@youtvdo){\line(0,1){\l@youtvdii}}

The top and RH sides. Also add the text.

515  \put(\l@youthdii,\l@youtvdi){\line(0,-1){\l@youtvdi}}
516  \put(\l@youthdii,\l@youtvdi){\line(-1,0){\l@youthdiv}}
517  \put(0,0){\makebox(\l@youthdii,\l@youtvdi){Item 2}}

Finish off with the label box.

518  \put(\l@youtxcii,\l@youtycii){\framebox(\l@youthpii,\l@youtvdiii){}}
519  \put(\l@youtxcii,\l@youtycii){\makebox(\l@youthpii,\l@youtvdiii)[r]%
520  {\footnotesize Label}}
521  \end{picture}}

Draw the paragraph box.

522  \put(\l@youtxci,\l@youtyciii){\begin{picture}(\l@youthdii,\l@youtvdi)

The LH horizontal and vertical lines.

523  \put(0,0){\line(1,0){\l@youthdii}}
524  \put(0,0){\line(0,1){\l@youtvdo}}

The inset lines.

525  \put(\l@youthpvi,\l@youtvdo){\line(-1,0){\l@youthpvi}}
526  \put(\l@youthpvi,\l@youtvdo){\line(0,1){\l@youtvdii}}

The top and RH side lines. Also the text.

527  \put(\l@youthdii,\l@youtvdi){\line(0,-1){\l@youtvdi}}
528  \put(\l@youthdii,\l@youtvdi){\line(-1,0){\l@youthdv}}
529  \put(0,0){\makebox(\l@youthdii,\l@youtvdi){Item 1, Paragraph 2}}
530  \ifdrawparameters

Add in the dimensions if asked for. First the listparindent.

531  \put(0,\l@youtvdi){\vector(1,0){\l@youthpvi}}
532  \put(0,\l@youtvdi){\begin{picture}(\l@youtvdv,\l@youtvdv)
533  \put(0,\l@youtvdv){\footnotesize\texttt{\bs listparindent}}
534  \end{picture}}
 Then the leftmargin.
535  \put(-\l@youthpiv,\l@youtycvi){\vector(1,0){\l@youthpiv}}
536  \put(-\l@youthpiv,\l@youtycvi){\begin{picture}(\l@youtvdv,\l@youtvdv)
537  \put(\l@youtvdv,\l@youtvdv){\footnotesize\texttt{\bs leftmargin}}
538  \end{picture}}

And finally the rightmargin.

539  \put(\l@youthdii,\l@youtycvi){\line(1,0){\l@youthpv}}
540  \put(\l@youthdii,\l@youtycvi){\vector(-1,0){0}}
541  \put(\l@youthdii,\l@youtycvi){\begin{picture}(\l@youtvdv,\l@youtvdv)
542  \put(\l@youtvdv,\l@youtvdv){\footnotesize\texttt{\bs rightmargin}}
543  \end{picture}}
544  \fi
545  \end{picture}}

Draw item box 1. This is very similar to drawing item box 2.

546  \put(\l@youtxci,\l@youtyciv){\begin{picture}(\l@youthdii,\l@youtvdi)
547  \put(0,0){\line(1,0){\l@youthdii}}
548  \put(0,0){\line(0,1){\l@youtvdo}}
549  \ifnum\l@youthdiii > \z@
550  \put(\l@youthdiii,\l@youtvdo){\line(-1,0){\l@youthdiii}}
551  \else
552  \put(\l@youthdiii,\l@youtvdo){\line(1,0){-\l@youthdiii}}
553  \fi
554  \put(\l@youthdiii,\l@youtvdo){\line(0,1){\l@youtvdii}}
555  \put(\l@youthdii,\l@youtvdi){\line(0,-1){\l@youtvdi}}
556  \put(\l@youthdii,\l@youtvdi){\line(-1,0){\l@youthdiv}}
557  \put(0,0){\makebox(\l@youthdii,\l@youtvdi){Item 1}}
558  \put(\l@youtxcii,\l@youtycii){\framebox(\l@youthpii,\l@youtvdiii){}}
559  \put(\l@youtxcii,\l@youtycii){\makebox(\l@youthpii,\l@youtvdiii)[r]%
560  {\footnotesize Label}}
561  \ifdrawparameters

Howevever, if requested, dimensions are drawn for item box 1. First, for

 itemindent.
562  \put(0,\l@youtycvi){\vector(1,0){\l@youthpi}}

563  \put(0,\l@youtycvi){\begin{picture}(\l@youtvdv,\l@youtvdv)
564  \put(0,-\l@youtvdv){\footnotesize\texttt{\bs itemindent}}
565  \end{picture}}
 Then for labelsep.
566  \put(\l@youthdiii,\l@youtycvii){\vector(-1,0){\l@youthpiii}}
567  \put(\l@youthdiii,\l@youtycvii){\begin{picture}(\l@youtvdv,\l@youtvdv)
568  \put(0,\l@youtvdv){\footnotesize\texttt{\bs labelsep}}
569  \end{picture}}

And finish up with labelwidth.

570  \put(\l@youtxcii,\l@youtxcvii){\line(1,0){\l@youthpii}}
571  \put(\l@youtxcii,\l@youtxcvii){\vector(-1,0){0}}
572  \put(\l@youtxcii,\l@youtxcvii){\begin{picture}(\l@youtvdv,\l@youtvdv)
573  \put(0,\l@youtvdv){\footnotesize\texttt{\bs labelwidth}}
574  \end{picture}}
575  \fi
576  \end{picture}}

Draw the predeccessor text box 1 inch deep.

577  \put(0,\l@youtycv){\framebox(\l@youthdi,\oneinch){Preceeding Text}}
578  \ifdrawparameters

We finish off the drawing with any requested vertical spacing parameters. First between item2 and the suceeding text.

579  \put(\l@youtxciii,\l@youtyci){\vector(0,-1){\l@youtvdvii}}
580  \put(\l@youtxciii,\l@youtyci){\begin{picture}(\l@youtvdv,\l@youtvdv)
581  \put(\l@youtvdv,-\l@youtvdv){%
582  \footnotesize\texttt{\bs topsep + \bs parskip [+ \bs partopsep]}}
583  \end{picture}}

Between item1, paragraph 2 and item 2.

584  \put(\l@youtxciii,\l@youtyciii){\vector(0,-1){\l@youtvdvi}}
585  \put(\l@youtxciii,\l@youtyciii){\begin{picture}(\l@youtvdv,\l@youtvdv)
586  \put(\l@youtvdv,-\l@youtvdv){%
587  \footnotesize\texttt{\bs itemsep + \bs parsep}}
588  \end{picture}}

Between the two paragraphs of item 1.

589  \put(\l@youtxciii,\l@youtyciv){\vector(0,-1){\l@youtvpiv}}
590  \put(\l@youtxciii,\l@youtyciv){\begin{picture}(\l@youtvdv,\l@youtvdv)
591  \put(\l@youtvdv,-\l@youtvdv){%
592  \footnotesize\texttt{\bs parsep}}
593  \end{picture}}

And finally between the preceeding text and item 1.

594  \put(\l@youtxciii,\l@youtycv){\vector(0,-1){\l@youtvdvii}}
595  \put(\l@youtxciii,\l@youtycv){\begin{picture}(\l@youtvdv,\l@youtvdv)
596  \put(\l@youtvdv,-\l@youtvdv){%
597  \footnotesize\texttt{\bs topsep + \bs parskip [+ \bs partopsep]}}
598  \end{picture}}
599  \fi

600  \end{picture}
601  \end{center}
602  \setlength{\unitlength}{1pt}

Last of all, we list the values of the parameters if requested.

603 \ifdrawparameters\else
604  \begin{center}
605 %%%    \vspace*{\l@ysetupbaselineskip}
606  \begin{footnotesize}
607  Lengths are to the nearest pt. \\
608  \begin{tt}
609  \begin{tabular}{l@{\hspace{20pt}}l}
610  \bs leftmargin = \number\l@youthpiv pt    &
611  \bs rightmargin = \number\l@youthpv pt    \\
612  \bs itemindent = \number\l@youthpi pt     &
613  \bs labelwidth = \number\l@youthpii pt    \\
614  \bs labelsep = \number\l@youthpiii pt     &
615  \bs listparindent = \number\l@youthpvi pt \\
616  \bs topsep = \number\l@youtvpi pt         &
617  \bs parskip = \number\l@youtparskip pt    \\
618  \bs partopsep = \number\l@youtvpiii pt    &
619  \bs parsep = \number\l@youtvpiv pt        \\
620  \bs itemsep = \number\l@youtvpv pt  &     \\
621  \end{tabular}
622  \end{tt}\end{footnotesize}
623  \end{center}
624 \fi

The end of the definition for \drawlist.

625 }

2.6 Drawing the layout of footnotes

We provide a facility for drawing the layout of footnotes. First the \try... commands for setting trial values of the footnote parameters.

\tryfootins Sets the trial value for footins and stores the result in \l@youtvpi.

626 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
627 %%%%    FOOTNOTE LAYOUT
628 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
629 \newcommand{\tryfootins}[1]{\l@yltoc{#1}{\l@youtvpi}}

\tryfootnotesep Sets the trial value for footnotesep and stores the result in \l@youtvpii.

630 \newcommand{\tryfootnotesep}[1]{\l@yltoc{#1}{\l@youtvpii}}
\tryfootnotebaseline Sets the trial value for footnotebaseline and stores the result in \l@youtvpiii.
631 \newcommand{\tryfootnotebaseline}[1]{\l@yltoc{#1}{\l@youtvpiii}}
\tryfootruleheight Sets the trial value for footruleheight and stores the result in \l@youtlinethick.
632 \newcommand{\tryfootruleheight}[1]{\setlength{\l@youtlinethick}{#1}}

\tryfootrulefrac Sets the trial value for footrulefrac and stores the result in \l@youthdvii.

633 \newcommand{\tryfootrulefrac}[1]{\setlength{\l@ylen}{8.5in}
634  \l@ytok={#1}
635  \l@ylen = #1\l@ylen
636  \l@youthdvii=\l@ylen
637  \divide\l@youthdvii by \onepoint}

\currentfootnote This routine sets the trial footnote parameters to be those specified for the current document. Some parameters have the values embedded as numbers in the class/options files; for these we make an educated guess at a typical value.

638 \newcommand{\currentfootnote}{%
639 \tryfootins{\skip\footins}
640 \tryfootnotesep{\footnotesep}
641 \tryfootnotebaseline{10pt}
642 \tryfootruleheight{0.4pt}
643 \tryfootrulefrac{0.25}

644 }

\drawfootnote This routine draws the layout of a footnote.

645 \newcommand{\drawfootnote}{%

Set some default values.

646 \l@youtvdo=4\relax          % vertical scale factor
647 \l@youthdi=\eighthalfinch   % textwidth
648 \l@youtvdi=\oneinch         % small height of note box
649 \ifdrawparameters

When drawparameters is TRUE we use a generic layout. Set the dimensions and coordinates.

650  \l@youtvpi=20\relax                 %  \skip\footins
651  \l@youtvpii=30\relax                 %  footenotesep
652  \l@youtvpiii=10\relax                 %  footnote baseline
653  \setlength{\l@youtlinethick}{0.4pt}                 % rule thickness
654  \l@youthdvii=\eighthalfinch                 % rule length
655  \multiply\l@youthdvii by 4\relax
656  \divide\l@youthdvii by 10\relax
657  \l@youtvdii=\l@youtvpiii                 % vertical box inset
658  \multiply\l@youtvdii by \l@youtvdo
659 \else
660 %    \emd{macrocode}
661 % Continue calculating the drawing parameters.
662 %    \begin{macrocode}
663  \l@youtvdii=\l@youtvpii                 % vertical box inset
664  \multiply\l@youtvdii by \l@youtvdo
665  \multiply\l@youtvdii by 8\relax
666  \divide\l@youtvdii by 10\relax
667 \fi
668 \l@youtvdv=\l@youtvpi                 % Y dim of footins
669  \multiply\l@youtvdv by \l@youtvdo
670 \l@youthdii=\l@youtvdii                 % horizontal box inset

671 \l@youtvdiii=\l@youtvdi                 % box height
672  \advance\l@youtvdiii by \l@youthdii
673 \l@youthdiii=\l@youthdi                 % box top length
674  \advance\l@youthdiii by -\l@youthdii
675 \l@youtvdiv=\l@youtvpii                 % vertical note spacing
676  \ifnum\l@youtvdiv < \l@youtvpiii
677  \l@youtvdiv=\l@youtvpiii
678  \fi
679  \multiply\l@youtvdiv by \l@youtvdo
680 \l@youtyci=\l@youtvdi                 % Y coord of 1st box base
681  \advance\l@youtyci by \l@youtvdiv
682 \l@youtycii=\l@youtyci                 % Y coord of rule
683  \advance\l@youtycii by \l@youtyci
684 \l@youtyciii=\l@youtycii                 %  Y coord of text base
685  \advance\l@youtyciii by \l@youtvdv
686 \l@youtyciv=\l@youtyciii                 % top of main text box
687  \advance\l@youtyciv by \oneinch
688 \l@youthdiv=\l@youthdvii                 % length of rule
689 \l@youtvdvi=\l@youtvpiv                 % height of rule
690  \multiply\l@youtvdvi by \l@youtvdo
691 \l@youthdv=\l@youthdii                 % small value (1/2 box inset)
692  \divide\l@youthdv by \tw@
693 \l@youthdvi=\l@youthdv                 % 1/2 l@youthdv
694  \divide\l@youthdvi by \tw@

Draw the picture!

695 \begin{center}
696 \setlength{\unitlength}{\l@youtunitlength}
697 \begin{picture}(\l@youthdi,\l@youtyciv)
698  \thicklines

Draw box 2. First the major bottom and LH side lines.

699  \put(0,0){\begin{picture}(\l@youthdi,\l@youtvdiii)
700  \put(0,0){\line(1,0){\l@youthdi}}
701  \put(0,0){\line(0,1){\l@youtvdi}}

The inset lines

702  \put(\l@youthdii,\l@youtvdi){\line(-1,0){\l@youthdii}}
703  \put(\l@youthdii,\l@youtvdi){\line(0,1){\l@youtvdii}}

The top and RH side lines.

704  \put(\l@youthdi,\l@youtvdiii){\line(-1,0){\l@youthdiii}}
705  \put(\l@youthdi,\l@youtvdiii){\line(0,-1){\l@youtvdiii}}

Finish with the marker.

706  \put(\l@youthdv,\l@youtvdiii){\makebox(0,0)[t]{2}}
707  \end{picture}}

The drawing of box 1 is similar.

708  \put(0,\l@youtyci){\begin{picture}(\l@youthdi,\l@youtvdiii)
709  \put(0,0){\line(1,0){\l@youthdi}}
710  \put(0,0){\line(0,1){\l@youtvdi}}

711  \put(\l@youthdii,\l@youtvdi){\line(-1,0){\l@youthdii}}
712  \put(\l@youthdii,\l@youtvdi){\line(0,1){\l@youtvdii}}
713  \put(\l@youthdi,\l@youtvdiii){\line(-1,0){\l@youthdiii}}
714  \put(\l@youthdi,\l@youtvdiii){\line(0,-1){\l@youtvdiii}}
715  \put(\l@youthdv,\l@youtvdiii){\makebox(0,0)[t]{1}}
716  \end{picture}}

Draw the rule.

717  \multiply\l@youtlinethick by \l@youtvdo
718  \linethickness{\l@youtlinethick}
719  \put(0,\l@youtycii){\line(1,0){\l@youthdvii}}
720  \thicklines

Draw the main text box

721  \put(0,\l@youtyciii){\framebox(\l@youthdi,\oneinch){MAIN TEXT}}
722  \ifdrawparameters
723  \thinlines

We finish off the drawing with spacing parameters, if requested.

    Bottom footnotesep.
724  \put(\l@youthdvi,\l@youtyci){\vector(0,-1){\l@youtvdiv}}
725  \put(\l@youthdvi,\l@youtyci){\begin{picture}(\l@youthdv,\l@youthdv)
726  \put(\l@youthdvi,-\l@youthdv){\footnotesize\texttt{\bs footnotesep}}
727  \end{picture}}
 Top footnotesep.
728  \put(\l@youthdvi,\l@youtycii){\vector(0,-1){\l@youtvdiv}}
729  \put(\l@youthdvi,\l@youtycii){\begin{picture}(\l@youthdv,\l@youthdv)
730  \put(\l@youthdvi,-\l@youthdv){\footnotesize\texttt{\bs footnotesep}}
731  \end{picture}}
 The \skip\footins.
732  \put(\l@youthdii,\l@youtyciii){\vector(0,-1){\l@youtvdv}}
733  \put(\l@youthdii,\l@youtyciii){\begin{picture}(\l@youthdv,\l@youthdv)
734  \put(\l@youthdvi,-\l@youthdv){\footnotesize\texttt{\bs skip\bs footins}}
735  \end{picture}}

The rule.

736  \put(\l@youthdiv,\l@youtycii){\begin{picture}(\l@youthdv,\l@youthdv)
737  \put(\l@youthdv,0){\footnotesize\texttt{\bs footnoterule}}
738  \end{picture}}
739  \fi

Finish off the picture.

740  \end{picture}
741 \end{center}
742 \setlength{\unitlength}{1pt}

Print the value table if appropriate.

743 \ifdrawparameters\else
744  \begin{center}
745 %%%    \vspace*{\l@ysetupbaselineskip}
746  \begin{footnotesize}

747  Lengths are to the nearest pt. \\
748  \begin{tt}
749  \begin{tabular}{l@{\hspace{20pt}}l}
750  \bs footins = \number\l@youtvpi pt &
751  \bs footnotesep = \number\l@youtvpii pt \\
752  \bs baselineskip = \number\l@youtvpiii pt &
753  \textrm{note seperation} = \number\l@youtvdiv pt \\
754  \textrm{rule thickness} = \the\l@youtlinethick & \\
755  \multicolumn{2}{c}{\textrm{rule length} = \the\l@ytok{} times the \bs textwidth} \\
756  \end{tabular}
757  \end{tt}\end{footnotesize}
758  \end{center}
759 \fi

The end of the definition of \drawfootnote.

760 }

2.7 Drawing the layout of paragraphs

We provide a facility for drawing the layout of paragraphs.

First the \try... commands for setting trial values of the paragraph parameters.

\tryparindent Sets the trial value for \parindent and stores the result in \l@youthdii.

761 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
762 %%%%    PARAGRAPH LAYOUT
763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
764 \newcommand{\tryparindent}[1]{\l@yltoc{#1}{\l@youthdii}}

\tryparlinewidth Sets the trial value for \linewidth and stores the result in \l@youthdi.

765 \newcommand{\tryparlinewidth}[1]{\l@yltoc{#1}{\l@youthdi}}
\tryparbaselineskip Sets the trial value for \baselineskip and stores the result in \l@youtvdii.
766 \newcommand{\tryparbaselineskip}[1]{\l@yltoc{#1}{\l@youtvdii}}

\currentparagraph This routine sets the trial paragraph parameters to be those specified for the current document.

767 \newcommand{\currentparagraph}{%
768 \tryparindent{\parindent}
769 \tryparskip{\parskip}
770 \tryparlinewidth{\linewidth}
771 \tryparbaselineskip{\baselineskip}

772 }

\drawparagraph This routine draws the layout of a paragraph.

773 \newcommand{\drawparagraph}{%

Set some default values.

774 \l@youtvdi=\oneinch                 % height of bottom of inset box
775 \ifdrawparameters

When drawparameters is TRUE we use a generic layout. Set the dimensions and coordinates.

776  \l@youtvdii=15\relax                %  \baselineskip
777  \l@youthdii=40\relax                 %  \parindent
778  \l@youtparskip=30\relax              %  \parskip
779  \l@youthdi=\eighthalfinch            % linewidth
780 \fi

Continue calculating the drawing parameters.

781  \l@youtvdiii=\l@youtvdi              % total height of para box
782  \advance\l@youtvdiii by \l@youtvdii
783  \l@youtvdiv=\l@youtvdiii             % bottom of Preceeding box
784  \advance\l@youtvdiv by \l@youtparskip
785  \l@youtvdv=\l@youtvdiv               % total picture height
786  \advance\l@youtvdv by \oneinch
787  \l@youthdiii=\l@youthdi               % length of top of para box
788  \advance\l@youthdiii by -\l@youthdii
789  \l@youtxci=\l@youthdi                % x coord of middle of picture
790  \divide\l@youtxci by \tw@
791 \l@youthdv=10\relax                    % small value
792 \l@youthdvi=5\relax                    % 1/2 l@youthdv

Draw the picture!

793 \begin{center}
794 \setlength{\unitlength}{\l@youtunitlength}
795 \begin{picture}(\l@youthdi,\l@youtvdv)
796  \thicklines

Draw paragraph box. First the major bottom and LH side lines.

797  \put(0,0){\begin{picture}(\l@youthdi,\l@youtvdiii)
798  \put(0,0){\line(1,0){\l@youthdi}}
799  \put(0,0){\line(0,1){\l@youtvdi}}

The inset lines

800  \ifnum\l@youthdii < \z@
801  \l@youthdv=-\l@youthdii
802  \put(\l@youthdii,\l@youtvdi){\line(1,0){\l@youthdv}}
803  \else
804  \put(\l@youthdii,\l@youtvdi){\line(-1,0){\l@youthdii}}
805  \fi
806  \put(\l@youthdii,\l@youtvdi){\line(0,1){\l@youtvdii}}

The top and RH side lines.

807  \put(\l@youthdi,\l@youtvdiii){\line(-1,0){\l@youthdiii}}
808  \put(\l@youthdi,\l@youtvdiii){\line(0,-1){\l@youtvdiii}}
809  \end{picture}}

Now for the top box.

810  \put(0,\l@youtvdiv){\framebox(\l@youthdi,\oneinch){Preceeding Text}}

Finished the main drawing.

811  \ifdrawparameters
812  \thinlines

We finish off the drawing with spacing parameters, if requested.

    The \parskip.
813  \put(\l@youtxci,\l@youtvdiv){\begin{picture}(\l@youthdv,\l@youthdv)
814  \put(0,0){\vector(0,-1){\l@youtparskip}}
815  \put(\l@youthdvi,-\l@youthdv){\footnotesize\texttt{\bs parskip}}
816  \end{picture}}
 The \parindent.
817  \put(0,\l@youtvdiii){\begin{picture}(\l@youthdv,\l@youthdv)
818  \put(0,0){\vector(1,0){\l@youthdii}}
819  \put(0,\l@youthdv){\footnotesize\texttt{\bs parindent}}
820  \end{picture}}
821  \fi

Finish off the picture.

822  \end{picture}
823 \end{center}
824 \setlength{\unitlength}{1pt}

Print the value table if appropriate.

825 \ifdrawparameters\else
826  \begin{center}
827 %%%    \vspace*{\l@ysetupbaselineskip}
828  \begin{footnotesize}
829  Lengths are to the nearest pt. \\
830  \begin{tt}
831  \begin{tabular}{l@{\hspace{20pt}}l}
832  \bs parindent = \number\l@youthdii pt &
833  \bs parskip = \number\l@youtparskip pt \\
834  \bs baselineskip = \number\l@youtvdii pt &
835  \bs linewidth = \number\l@youthdi pt \\
836  \end{tabular}
837  \end{tt}\end{footnotesize}
838  \end{center}
839 \fi

The end of the definition of \drawparagraph.

840 }

2.8 Drawing the layout of section headings

We provide a facility for illustrating the layout of sectional headings. First the \try... commands for setting trial values for the heading parameters.

\trybeforeskip Sets the trial value for beforeskip and stores the result in \l@youtvpi.

841 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
842 %%%%    SECTION HEADING LAYOUT
843 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
844 \newcommand{\trybeforeskip}[1]{\l@yltoc{#1}{\l@youtvpi}}

\tryafterskip Sets the trial value for afterskip and stores the result in \l@youtvpii.

845 \newcommand{\tryafterskip}[1]{\l@yltoc{#1}{\l@youtvpii}}

\tryindent Sets the trial value for indent and stores the result in \l@youthpi.

846 \newcommand{\tryindent}[1]{\l@yltoc{#1}{\l@youthpi}}

\currentheading This routine sets the trial heading parameters to some predefined values that, hopefully, are reasonably representative.

847 \newcommand{\currentheading}{%
848 \trybeforeskip{2\l@ysetupbaselineskip}
849 \tryafterskip{\l@ysetupbaselineskip}
850 \tryindent{2\l@ysetupbaselineskip}
851 \tryparskip{\l@ysetupparskip}

852 }

\drawheading This routine draws the layout of a sectional heading. The command takes a single parameter, \drawheading{⟨font style⟩}, which specifies the size and style of the heading font. For example,

 \drawheading{\Large\sffamily}
853 \newcommand{\drawheading}[1]{%

Some default values first.

854 \l@youthdi=\textwidth                         % textwidth
855  \divide\l@youthdi by \onepoint
856 \l@youtvdi=\baselineskip                      % baselineskip
857  \divide\l@youtvdi by \onepoint
858 \ifdrawparameters

When drawparameters is TRUE we use a generic layout. Set the dimensions and coordinates.

859  \Huge \l@youtvdii=\baselineskip \normalsize  % Heading baselineskip
860  \divide\l@youtvdii by \onepoint
861  \setlength{\l@ylen}{40pt}
862  \l@youtvpi=\l@ylen                           % beforeskip
863  \divide\l@youtvpi by \onepoint
864  \ifruninhead

We need different values for the afterskip and indent depending on whether we are drawing a run-in heading or an ordinary one.

865  \setlength{\l@ylen}{-72pt}
866  \l@youtvpii=\l@ylen                        % afterskip
867  \divide\l@youtvpii by \onepoint
868  \setlength{\l@ylen}{50pt}
869  \l@youthpi=\l@ylen                         % indent
870  \divide\l@youthpi by \onepoint
871  \else
872  \setlength{\l@ylen}{45pt}
873  \l@youtvpii=\l@ylen                        % afterskip
874  \divide\l@youtvpii by \onepoint
875  \setlength{\l@ylen}{72pt}

876  \l@youthpi=\l@ylen                         % indent
877  \divide\l@youthpi by \onepoint
878  \fi

Calculate the width of a sample heading title text.

879  \setbox0 = \hbox{{\Huge 3.5 Heading Title }}
880  \l@youthdv=\wd0          % width of heading text
881  \divide\l@youthdv by \onepoint
882 \else

When drawparameters is FALSE, we calculate the heading baselineskip and width of the text in the trial font.

883  {#1 \l@youtvdii=\baselineskip\normalfont\normalsize} % heading baselineskip
884  \divide\l@youtvdii by \onepoint
885  \setbox0 = \hbox{{#1 3.5 Heading Title }}
886  \l@youthdv=\wd0          % width of heading text
887  \divide\l@youthdv by \onepoint
888 \fi

Now continue setting all the other drawing lengths and coordinates.

889 \l@youtvdiii=\l@youtvpii            % afterskip + parskip + textbaselineskip
890  \advance\l@youtvdiii by \l@youtparskip
891  \advance\l@youtvdiii by \l@youtvdi
892 \l@youtvdiv=\l@youtvpi              % beforeskip + parskip + headbaselineskip
893  \ifnum\l@youtvdiv < \z@

A negative value for the indent signals no indentation of the first line of text after the heading.

894  \l@youtvdiv = -\l@youtvdiv
895  \fi
896  \advance\l@youtvdiv by \l@youtparskip
897  \advance\l@youtvdiv by \l@youtvdii
898 \l@youtyci=\l@youtvdi                  % Y coord of base of after text
899 \l@youtycii=\l@youtyci                 % Y coord of base of heading text
900  \advance\l@youtycii by \l@youtvdiii

We have to handle the case of a negative afterskip indicating a run-in heading. l@youthdiv is set to either zero of the absolute value of the negative afterskip.

901 \l@youthdiv=\z@                        % 0 or abs(-afterskip)
902 \ifnum\l@youtvpii < \z@
903  \l@youthdiv = -\l@youtvpii
904  \l@youtvdiii=\l@youtvdi              %  textbaselineskip
905  \l@youtxci=\l@youthpi                % X coord of end of heading text
906  \advance\l@youtxci by \l@youthdv
907  \l@youtxcii=\l@youtxci               % X coord of start of after text
908  \advance\l@youtxcii by \l@youthdiv
909  \l@youtycii=\l@youtvdi               % Y coord of base of heading text
910 \fi

Continue.

911 \l@youtyciii=\l@youtycii               % Y coord of base of prior text
912  \advance\l@youtyciii by \l@youtvdiv

913 \l@youtyciv=\l@youtyciii               % Y coord of top of prior text
914  \advance\l@youtyciv by \l@youtvdi
915 \l@youtycv=\l@youtyciv                 % 2*l@youtvdi + l@youtyciv
916  \advance\l@youtycv by \l@youtvdi
917  \advance\l@youtycv by \l@youtvdi
918 \l@youthdii=\l@youtvdi                 % a small amount
919 \l@youthdiii=\l@youthdii               % half a small amount
920  \divide\l@youthdiii by \tw@

Draw the picture!

921 \begin{center}
922 \setlength{\unitlength}{\l@youtunitlength}
923 \begin{picture}(\l@youthdi,\l@youtycv)
924  \ifnum\l@youtvpii < \z@
925  \put(0,\l@youtyci){\begin{picture}(\l@youthdi,\l@youtyciv)

When the afterskip is negative we have a run-in heading.

Draw the bottom text line

926  \put(0,0){second line of text following the heading \ldots}

Draw the heading

927  \ifdrawparameters
928  \put(\l@youthpi,\l@youtycii){{\Huge 3.5 Heading Title}}
929  \else
930  \put(\l@youthpi,\l@youtycii){{#1 3.5 Heading Title}}
931  \fi

Draw the first line of text after the heading, and the preceeding text line.

932  \put(\l@youtxcii,\l@youtycii){Start of text \ldots}
933  \put(0,\l@youtyciii){\ldots end of last line of preceeding text.}
934  \ifdrawparameters

Draw the dimensions if required. First the before skips.

935  \put(0,\l@youtyciii){\vector(0,-1){\l@youtvdiv}}
936  \put(0,\l@youtyciii){\begin{picture}(\l@youthdii,\l@youthdii)
937  \put(\l@youthdiii,-\l@youthdii){\makebox(0,0)[tl]%
938  {\footnotesize \textit{$\|$beforeskip$\|$} +
939  \texttt{\bs parskip} (of text font) + \texttt{\bs baselineskip}
940  (of heading font)}}
941  \end{picture}}

The indent.

942  \put(0,\l@youtycii){\vector(1,0){\l@youthpi}}
943  \put(0,\l@youtycii){\begin{picture}(\l@youthdii,\l@youthdii)
944  \put(\l@youthdii,\l@youthdiii){\footnotesize \textit{indent}}
945  \end{picture}}

And finish with the negative afterskip

946  \put(\l@youtxci,\l@youtycii){\vector(1,0){\l@youthdiv}}
947  \put(\l@youtxci,\l@youtycii){\begin{picture}(\l@youthdii,\l@youthdii)
948  \put(\l@youthdiii,\l@youthdii){\footnotesize \textit{afterskipt} ($< 0$)}
949  \end{picture}}

950  \fi
951  \end{picture}}
952  \else
953  \put(0,\l@youtyci){\begin{picture}(\l@youthdi,\l@youtyciv)

The aftterskip is positive, so we draw a normal heading.

Draw the two after heading text lines

954  \put(0,0){second line of text following the heading \ldots}
955  \put(0,\l@youtyci){This is the start of the after-heading text
956  which continues on \ldots}

Draw the heading

957  \ifdrawparameters
958  \put(\l@youthpi,\l@youtycii){{\Huge 3.5 Heading Title}}
959  \else
960  \put(\l@youthpi,\l@youtycii){{#1 3.5 Heading Title}}
961  \fi

Draw the text line preceeding the heading.

962  \put(0,\l@youtyciii){\ldots end of last line of preceeding text.}
963  \ifdrawparameters

Draw the dimensions if required. First the before skips.

964  \put(0,\l@youtyciii){\vector(0,-1){\l@youtvdiv}}
965  \put(0,\l@youtyciii){\begin{picture}(\l@youthdii,\l@youthdii)
966  \put(\l@youthdiii,-\l@youthdii){\makebox(0,0)[tl]%
967  {\footnotesize \textit{$\|$beforeskip$\|$} +
968  \texttt{\bs parskip} (of text font) + \texttt{\bs baselineskip}
969  (of heading font)}}
970  \end{picture}}

The indent.

971  \put(0,\l@youtycii){\vector(1,0){\l@youthpi}}
972  \put(0,\l@youtycii){\begin{picture}(\l@youthdii,\l@youthdii)
973  \put(\l@youthdii,\l@youthdiii){\footnotesize \textit{indent}}
974  \end{picture}}

And finish with the afterskips

975  \put(0,\l@youtycii){\vector(0,-1){\l@youtvdiii}}
976  \put(0,\l@youtycii){\begin{picture}(\l@youthdii,\l@youthdii)
977  \put(\l@youthdiii,-\l@youthdii){\makebox(0,0)[tl]%
978  {\footnotesize \textit{afterskip} +
979  \texttt{\bs parskip} (of heading font) + \texttt{\bs baselineskip}
980  (of text font)}}
981  \end{picture}}
982  \fi
983  \end{picture}}
984  \fi

Draw rules.

985  \put(0,0){\line(1,0){\l@youthdi}}
986  \put(0,\l@youtycv){\line(1,0){\l@youthdi}}

 987  \end{picture}
 988  \end{center}
 989  \setlength{\unitlength}{1pt}
 990  \ifdrawparameters\else

Write out the table of values if required.

 991  \begin{center}
 992 %%%      \vspace*{\l@ysetupbaselineskip}
 993  \begin{footnotesize}
 994  Lengths are to the nearest pt. \\
 995  \begin{tt}
 996  \begin{tabular}{l@{\hspace{20pt}}l}
 997  \textit{beforeskip} = \number\l@youtvpi pt &
 998  \textit{afterskip} = \number\l@youtvpii pt \\
 999  \textit{indent} = \number\l@youthpi pt &
1000  \textrm{(heading font)} \bs baselineskip = \number\l@youtvdii pt \\
1001  \bs parskip = \number\l@youtparskip pt &
1002  \textrm{heading font} = \string#1 \\
1003  \end{tabular}
1004  \end{tt}\end{footnotesize}
1005  \end{center}

1006 \fi

The end of the definition of \drawheading.

1007 }

2.9 Drawing the layouts of floats

We provide facilities for illustrating the parameters controlling the layout of floats. Respectively these show the layout of an individual float, and the page layout for floats.

2.9.1 Individual float layout

The code in this section enables the illustration of the parameters of a single float environment.

Start off with the \try... commands for setting trial parameter values.

\trytextfloatsep Sets the trial value for textfloatsep and stores the result in \l@youtvpi.

1008 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1009 %%%%    INDIVIDUAL FLOAT LAYOUT
1010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1011 \newcommand{\trytextfloatsep}[1]{\l@yltoc{#1}{\l@youtvpi}}

\tryfloatsep Sets the trial value for floatsep and stores the result in \l@youtvpii.

1012 \newcommand{\tryfloatsep}[1]{\l@yltoc{#1}{\l@youtvpii}}

\tryintextsep Sets the trial value for intextsep and stores the result in \l@youtvpiii.

1013 \newcommand{\tryintextsep}[1]{\l@yltoc{#1}{\l@youtvpiii}}

\trytopfigrule Sets the trial value for topfigrule and stores the result in \l@youtlinethick.

1014 \newcommand{\trytopfigrule}[1]{\setlength{\l@youtlinethick}{#1}}
\trybotfigrule Sets the trial value for botfigrule and stores the result in \l@youtlinethickii.
1015 \newcommand{\trybotfigrule}[1]{\setlength{\l@youtlinethickii}{#1}}

\currentfloat This sets the trial float parameter values to those currently set in the document, or makes a guesstimate where the value is hard-coded.

1016 \newcommand{\currentfloat}{%
1017 \trytextfloatsep{\textfloatsep}
1018 \tryfloatsep{\floatsep}
1019 \tryintextsep{\intextsep}
1020 \trytopfigrule{0pt}        % guesstimate
1021 \trybotfigrule{0pt}        % guesstimate

1022 }

\drawfloat The command to draw the picture of float parameters.

1023 \newcommand{\drawfloat}{%
1024 \ifdrawparameters

Set up the lengths and coordinates for drawing the parameters.

1025  \setlength{\l@ylen}{40pt}
1026  \l@youtvpi=\l@ylen                    % textfloatsep
1027  \divide\l@youtvpi by \onepoint
1028  \setlength{\l@ylen}{40pt}
1029  \l@youtvpii=\l@ylen                   % floatsep
1030  \divide\l@youtvpii by \onepoint
1031  \setlength{\l@ylen}{40pt}
1032  \l@youtvpiii=\l@ylen                  % intextsep
1033  \divide\l@youtvpiii by \onepoint
1034  \setlength{\l@youtlinethick}{1pt}     % toprule height
1035  \setlength{\l@youtlinethickii}{2pt}   % botrule height

1036 \fi

And the general drawing coodinates and lengths.

1037 \l@youthdo=\textwidth                  % textwidth
1038  \divide\l@youthdo by \onepoint
1039  \multiply\l@youthdo by 8\relax
1040  \divide\l@youthdo by 10\relax
1041 \l@youtvdvii=\baselineskip             % baselineskip
1042  \divide\l@youtvdvii by \onepoint
1043 \l@youthdi=\l@youthdo                  % width of floats
1044  \divide\l@youthdi by \tw@
1045 \l@youtvdi=\l@youthdi                  % float box height
1046  \divide\l@youtvdi by 4\relax
1047 \l@youtvdii=\l@youtvdvii               % text box height
1048  \multiply\l@youtvdii by \thr@@
1049 \l@youtvdvi=\l@youtvdvii               % height of top text line
1050  \multiply\l@youtvdvi by \tw@

1051 \l@youtxci=\l@youthdo                  % X coord of LH of float
1052  \advance\l@youtxci by -\l@youthdi
1053  \divide\l@youtxci by \tw@
1054 \l@youtxcii=\l@youthdo                 % X coord of vertical dims.
1055  \divide\l@youtxcii by \tw@
1056 \l@youtyci=\l@youtvdi                  % Y coord of top of BFl-n
1057 \l@youtycii=\l@youtyci                 % Y coord of bottom of text
1058  \advance\l@youtycii by \l@youtvpi
1059 \l@youtyciii=\l@youtycii               % Y coord of bottom of HF box
1060  \advance\l@youtyciii by \l@youtvdii
1061  \advance\l@youtyciii by \l@youtvpiii
1062 \l@youtyciv=\l@youtyciii               % Y coord of bottom top text box
1063  \advance\l@youtyciv by \l@youtvdi
1064  \advance\l@youtyciv by \l@youtvpiii
1065 \l@youtycv=\l@youtyciv                 % Y coord of bottom of TFl-2 box
1066  \advance\l@youtycv by \l@youtvdii
1067  \advance\l@youtycv by \l@youtvpi
1068 \l@youtycvi=\l@youtycv                 % Y coord of bottom of TFl-1 box
1069  \advance\l@youtycvi by \l@youtvdi
1070  \advance\l@youtycvi by \l@youtvpii
1071 \l@youtvdo=\l@youtycvi                 % Y dim of text on page
1072  \advance\l@youtvdo by \l@youtvdi
1073 \l@youthdii=\l@youtvpi                 % a small amount
1074  \divide\l@youthdii by \tw@
1075 \l@youthdiii=\l@youthdii               % half a small amount
1076  \divide\l@youthdiii by \tw@

Draw the picture!

1077 \begin{center}
1078 %%%  \setlayoutscale{1}
1079 \setlength{\unitlength}{\l@youtunitlength}
1080 \begin{picture}(\l@youthdo,\l@youtvdo)
1081  \thicklines

A bottom float.

1082  \put(\l@youtxci,0){\framebox(\l@youthdi,\l@youtvdi){A BOTTOM FLOAT}}

Bottom text.

1083  \put(0,\l@youtycii){\begin{picture}(\l@youthdo,\l@youtvdii)
1084  \put(0,0){\makebox(\l@youthdo,0)[br]{\ldots last text line before bottom float.}}
1085  \put(0,\l@youtvdvi){First text line after `here' float \ldots}
1086  \end{picture}}

Draw a ‘here’ float.

1087  \put(\l@youtxci,\l@youtyciii){\framebox(\l@youthdi,\l@youtvdi){A `HERE' FLOAT}}

Top text.

1088  \put(0,\l@youtyciv){\begin{picture}(\l@youthdo,\l@youtvdii)
1089  \put(0,0){\makebox(\l@youthdo,0)[br]{\ldots last text line before `here' float.}}
1090  \put(0,\l@youtvdvi){First text line after top float \ldots}
1091  \end{picture}}

The lowest top float (TFl-2).

1092  \put(\l@youtxci,\l@youtycv){\framebox(\l@youthdi,\l@youtvdi){A TOP FLOAT}}

The highest top float (TFl-1).

1093  \put(\l@youtxci,\l@youtycvi){\framebox(\l@youthdi,\l@youtvdi){A TOP FLOAT}}

Whole page text.

1094  \thinlines
1095  \put(0,0){\dashbox{10}(\l@youthdo,\l@youtvdo){}}

The top and bottom rules

1096  \linethickness{\l@youtlinethick}
1097  \put(0,\l@youtycv){\line(1,0){\l@youthdo}}
1098  \linethickness{\l@youtlinethickii}
1099  \put(0,\l@youtyci){\line(1,0){\l@youthdo}}
1100  \thinlines
1101  \ifdrawparameters

Draw the parameter lines if required. Start with the bottom textfloatsep.

1102  \put(\l@youtxcii,\l@youtycii){\vector(0,-1){\l@youtvpi}}
1103  \put(\l@youtxcii,\l@youtycii){\begin{picture}(\l@youthdii,\l@youthdii)
1104  \put(\l@youthdiii,-\l@youthdii){\footnotesize\texttt{\bs textfloatsep}}
1105  \end{picture}}
  Lower intextsep.
1106  \put(\l@youtxcii,\l@youtyciii){\vector(0,-1){\l@youtvpiii}}
1107  \put(\l@youtxcii,\l@youtyciii){\begin{picture}(\l@youthdii,\l@youthdii)
1108  \put(\l@youthdiii,-\l@youthdii){\footnotesize\texttt{\bs intextsep}}
1109  \end{picture}}
  Upper intextsep.
1110  \put(\l@youtxcii,\l@youtyciv){\vector(0,-1){\l@youtvpiii}}
1111  \put(\l@youtxcii,\l@youtyciv){\begin{picture}(\l@youthdii,\l@youthdii)
1112  \put(\l@youthdiii,-\l@youthdii){\footnotesize\texttt{\bs intextsep}}
1113  \end{picture}}
  Top textfloatsep.
1114  \put(\l@youtxcii,\l@youtycv){\vector(0,-1){\l@youtvpi}}
1115  \put(\l@youtxcii,\l@youtycv){\begin{picture}(\l@youthdii,\l@youthdii)
1116  \put(\l@youthdiii,-\l@youthdii){\footnotesize\texttt{\bs textfloatsep}}
1117  \end{picture}}
  Top floatsep.
1118  \put(\l@youtxcii,\l@youtycvi){\vector(0,-1){\l@youtvpii}}
1119  \put(\l@youtxcii,\l@youtycvi){\begin{picture}(\l@youthdii,\l@youthdii)
1120  \put(\l@youthdiii,-\l@youthdii){\footnotesize\texttt{\bs floatsep}}
1121  \end{picture}}

Top rule.

1122  \put(\l@youthdo,\l@youtycv){\begin{picture}(\l@youthdii,\l@youthdii)
1123  \put(-\l@youthdiii,\l@youthdii){\vector(0,-1){\l@youthdii}}
1124  \put(-\l@youthdii,\l@youthdii){\makebox(0,0)[tr]%
1125  {\footnotesize\texttt{\bs topfigrule}}}
1126  \end{picture}}

And finally the bottom rule.

1127  \put(\l@youthdo,\l@youtyci){\begin{picture}(\l@youthdii,\l@youthdii)
1128  \put(-\l@youthdiii,-\l@youthdii){\vector(0,1){\l@youthdii}}
1129  \put(-\l@youthdii,-\l@youthdii){\makebox(0,0)[br]%
1130  {\footnotesize\texttt{\bs botfigrule}}}
1131  \end{picture}}

1132 \fi

1133  \end{picture}
1134 \end{center}
1135 \setlength{\unitlength}{1pt}
1136 \ifdrawparameters\else

Print the table of values.

1137  \begin{center}
1138 %%%    \vspace*{\l@ysetupbaselineskip}
1139  \begin{footnotesize}
1140  Lengths are to the nearest pt. \\
1141  \begin{tt}
1142  \begin{tabular}{l@{\hspace{20pt}}l}
1143  \bs floatsep = \number\l@youtvpii pt    &
1144  \bs textfloatsep = \number\l@youtvpi pt \\
1145  \bs intextsep = \number\l@youtvpiii pt  &
1146  \textrm{topfigrule thickness} = \the\l@youtlinethick \\
1147  \textrm{botfigrule thickness} = \the\l@youtlinethickii &  \\
1148  \end{tabular}
1149  \end{tt}\end{footnotesize}
1150  \end{center}

1151 \fi

End of the definition of \drawfloat.

1152 }

2.9.2 Floats on a page

The code in this section illustrates the parameters controlling how one or more floats may be apportioned on a page.

Start off with the \try... commands for setting trial parameter values.

\trytotalnumber Sets the trial value for totalnumber and stores the result in \l@youtvpvi.

1153 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1154 %%%%    FLOAT PAGE LAYOUT
1155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1156 \newcommand{\trytotalnumber}[1]{\l@youtvpvi = #1}

\trytopnumber Sets the trial value for topnumber and stores the result in \l@youtvpv.

1157 \newcommand{\trytopnumber}[1]{\l@youtvpv = #1}

\trybottomnumber Sets the trial value for bottomnumber and stores the result in \l@youtvpi.

1158 \newcommand{\trybottomnumber}[1]{\l@youtvpi = #1}

\trytopfraction Sets the trial value for topfraction and stores the results in \l@youtvpiv and

  \l@youthdiv.
1159 \newcommand{\trytopfraction}[1]{\setlength{\l@ylen}{10in}
1160  \l@ylen = #1\l@ylen
1161  \l@youtvpiv=\l@ylen
1162  \divide\l@youtvpiv by \onepoint
1163  \setlength{\l@ylen}{1000sp}
1164  \l@ylen=#1\l@ylen
1165  \l@youthdiv=\l@ylen}

\trytextfraction Sets the trial value for textfraction and stores the results in \l@youtvpiii and

  \l@youthdv.
1166 \newcommand{\trytextfraction}[1]{\setlength{\l@ylen}{10in}
1167  \l@ylen = #1\l@ylen
1168  \l@youtvpiii=\l@ylen
1169  \divide\l@youtvpiii by \onepoint
1170  \setlength{\l@ylen}{1000sp}
1171  \l@ylen=#1\l@ylen
1172  \l@youthdv=\l@ylen}
\trybottomfraction Sets the trial value for bottomfraction and stores the results in \l@youtvpii
  and \l@youthdvi.
1173 \newcommand{\trybottomfraction}[1]{\setlength{\l@ylen}{10in}
1174  \l@ylen = #1\l@ylen
1175  \l@youtvpii=\l@ylen
1176  \divide\l@youtvpii by \onepoint
1177  \setlength{\l@ylen}{1000sp}
1178  \l@ylen=#1\l@ylen
1179  \l@youthdvi=\l@ylen}

\currentfloatpage Sets the floatpage parameter trial values to those in the current document, or makes a guesstimate when these are hard-coded.

1180 \newcommand{\currentfloatpage}{%
1181 \trytotalnumber{\value{totalnumber}}   % typically 3
1182 \trytopnumber{\value{topnumber}}       % typically 2
1183 \trytopfraction{0.7}                   % typically 0.7
1184 \trytextfraction{0.2}                  % typically 0.2
1185 \trybottomfraction{0.3}                % typically 0.3
1186 \trybottomnumber{\value{bottomnumber}} % typically 1

1187 }

\drawfloatpage The command to draw a picture of the float page layout and parameters.

1188 \newcommand{\drawfloatpage}{%
1189 \ifdrawparameters

Calculate values for parameter drawing.

1190  \l@youtvpvi=\thr@@          % total number
1191  \l@youtvpv=\tw@             % topnumber
1192  \l@youthdiv=300\relax       % 1000 times topfraction

1193  \setlength{\l@ylen}{10in}
1194  \l@ylen=0.3\l@ylen
1195  \l@youtvpiv=\l@ylen         % topfraction
1196  \divide\l@youtvpiv by \onepoint
1197  \l@youthdv=200\relax        % 1000 times textfraction
1198  \setlength{\l@ylen}{10in}
1199  \l@ylen=0.2\l@ylen
1200  \l@youtvpiii=\l@ylen        % textfraction
1201  \divide\l@youtvpiii by \onepoint
1202  \l@youthdvi=300\relax       % 1000 times botfraction
1203  \setlength{\l@ylen}{10in}
1204  \l@ylen=0.3\l@ylen
1205  \l@youtvpii=\l@ylen         % botfraction
1206  \divide\l@youtvpii by \onepoint
1207  \l@youtvpi=\@ne             % bottomnumber

1208 \fi

Continue with the general picture coordinates and lengths.

1209 \l@youtvdo=\teninch                    % textheight
1210 \l@youthdo=\eighthalfinch              % textwidth
1211 \l@youthdi=\l@youthdo                  % width of text box
1212  \multiply\l@youthdi by 8\relax
1213  \divide\l@youthdi by 10\relax
1214 \l@youtyci=\l@youtvdo                  % Y coord of base of textfraction
1215  \advance\l@youtyci by -\l@youtvpiii
1216  \divide\l@youtyci by \tw@
1217 \l@youtycii=\l@youtvpii                % Y coord of top of bottomfraction
1218 \l@youtyciii=\l@youtvdo                % Y coord of base of topfraction
1219  \advance\l@youtyciii by -\l@youtvpiv
1220 \l@youtyciv=\l@youtyci                 % Y coord of top of textfraction
1221  \advance\l@youtyciv by \l@youtvpiii
1222 \l@youtycv=\l@youtyci                  % Y coord of centre of text box
1223  \advance\l@youtycv by \l@youtyciv
1224  \divide\l@youtycv by \tw@
1225 \l@youtxcii=\l@youthdo                 % X coord of centre dims
1226  \divide\l@youtxcii by \tw@
1227 \l@youtxci=\l@youtxcii                 % X coord of LH dims
1228  \divide\l@youtxci by \tw@
1229 \l@youtxciii=\l@youtxcii               % X coord of RH dims
1230  \advance\l@youtxciii by \l@youtxci
1231 \l@youtxciv=\l@youthdo                 % X coord of LH of text box
1232  \advance\l@youtxciv by -\l@youthdi
1233  \divide\l@youtxciv by \tw@
1234 \l@youthdii=\l@youtxciv                % a small dimension
1235 \l@youthdiii=\l@youthdii               % half a small dimension
1236  \divide\l@youthdiii by \tw@

Draw the picture!

1237 \begin{center}
1238 \setlength{\unitlength}{\l@youtunitlength}

1239 \begin{picture}(\l@youthdo,\l@youtvdo)
1240  \thicklines

Draw the page boundaries.

1241  \put(0,0){\framebox(\l@youthdo,\l@youtvdo){}}

The bottom fraction.

1242  \put(0,\l@youtycii){\dashbox{10}(\l@youthdo,0){}}
1243 %%%    \ifdrawparameters
1244  \put(0,0){\makebox(\l@youthdo,\l@youtvpii){%
1245  \footnotesize\texttt{\bs bottomnumber}}}
1246  \thinlines
1247  \put(\l@youtxciii,0){\vector(0,1){\l@youtvpii}}
1248  \thicklines
1249 %%%    \fi

The text fraction.

1250  \put(\l@youtxciv,\l@youtyci){\framebox(\l@youthdi,\l@youtvpiii){}}

The top fraction.

1251  \put(0,\l@youtyciii){\dashbox{10}(\l@youthdo,0){}}
1252 %%%    \ifdrawparameters
1253  \put(0,\l@youtyciii){\makebox(\l@youthdo,\l@youtvpiv){%
1254  \footnotesize\texttt{\bs topnumber}}}
1255  \thinlines
1256  \put(\l@youtxci,\l@youtvdo){\vector(0,-1){\l@youtvpiv}}
1257  \thicklines
1258 %%%    \fi
1259  \thinlines
1260  \ifdrawparameters

Draw the dimensions. First the bottom fraction.

1261  \put(\l@youtxciii,0){\begin{picture}(\l@youthdii,\l@youthdii)
1262  \put(-\l@youthdiii,\l@youthdiii){%
1263  \makebox(0,0)[br]{\footnotesize\texttt{\bs bottomfraction}}}
1264  \end{picture}}

The text fraction.

1265  \put(\l@youtxcii,\l@youtyci){\vector(0,1){\l@youtvpiii}}
1266  \put(\l@youtxcii,\l@youtyci){\vector(0,-1){0}}
1267  \put(\l@youtxcii,\l@youtycv){\begin{picture}(\l@youthdii,\l@youthdii)
1268  \put(\l@youthdiii,0){%
1269  \makebox(0,0)[l]{\footnotesize\texttt{\bs textfraction}}}
1270  \end{picture}}

Finally the top fraction.

1271  \put(\l@youtxci,\l@youtvdo){\begin{picture}(\l@youthdii,\l@youthdii)
1272  \put(\l@youthdiii,-\l@youthdiii){%
1273  \makebox(0,0)[tl]{\footnotesize\texttt{\bs topfraction}}}
1274  \end{picture}}

1275 \fi

1276  \end{picture}

1277 \end{center}
1278 \setlength{\unitlength}{1pt}
1279 \ifdrawparameters\else

Print the parameter value table.

1280  \begin{center}
1281 %%%    \vspace*{\l@ysetupbaselineskip}
1282  \begin{footnotesize}\begin{tt}
1283  \begin{tabular}{l@{\hspace{20pt}}l}
1284  \bs topnumber = \number\l@youtvpv &
1285  \bs topfraction = 0.\number\l@youthdiv \\
1286  \bs bottomnumber = \number\l@youtvpi &
1287  \bs bottomfraction = 0.\number\l@youthdvi \\
1288  \bs totalnumber = \number\l@youtvpvi &
1289  \bs textfraction = 0.\number\l@youthdv \\
1290  \end{tabular}
1291  \end{tt}\end{footnotesize}
1292  \end{center}

1293 \fi

End of the definition of \drawfloatpage.

1294 }

2.10 Drawing the layout of a Table of Contents entry

We provide means of illustrating the layout of a sectional title in a Table of Contents.

As usual, start off with the \try... commands for setting trial values of the parameters.

\trytocindent Sets the trial value for tocindent and stores the result in \l@youthpi.

1295 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1296 %%%%    TOC LAYOUT
1297 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1298 \newcommand{\trytocindent}[1]{\l@yltoc{#1}{\l@youthpi}}

\trytocnumwidth Sets the trial value for tocnumwidth and stores the result in \l@youthpii.

1299 \newcommand{\trytocnumwidth}[1]{\l@yltoc{#1}{\l@youthpii}}

\trytoclinewidth Sets the trial value for toclinewidth and stores the result in \l@youthdo.

1300 \newcommand{\trytoclinewidth}[1]{\l@yltoc{#1}{\l@youthdo}}

\trytocrmarg Sets the trial value for tocrmarg and stores the result in \l@youthpiii.

1301 \newcommand{\trytocrmarg}[1]{\l@yltoc{#1}{\l@youthpiii}}

\trytocpnumwidth Sets the trial value for tocpnumwidth and stores the result in \l@youthpiv.

1302 \newcommand{\trytocpnumwidth}[1]{\l@yltoc{#1}{\l@youthpiv}}

\trytocdotsep Sets the trial value for tocdotsep and stores the result in \l@youthpv.

1303 \newcommand{\trytocdotsep}[1]{\setlength{\l@ylen}{1em}
1304  \l@ylen = #1\l@ylen
1305  \l@youthpv=\l@ylen
1306  \divide\l@youthpv by 18\relax  % 18mu = 1em
1307  \divide\l@youthpv by \onepoint}

\currenttoc This routine sets the trial ToC parameters to those specified for the current document. For those values that are hard-coded it guesstimates typical values.

1308 \newcommand{\currenttoc}{%
1309 \trytocindent{10em}           % guesstimate
1310 \trytocnumwidth{5em}          % guesstimate
1311 \trytoclinewidth{\textwidth}
1312 \trytocrmarg{6em}             % guesstimate
1313 \trytocpnumwidth{10em}        % guesstimate
1314 \trytocdotsep{36}             % guesstimate

1315 }

\drawtoc The command to draw the layout of a ToC entry.

1316 \newcommand{\drawtoc}{%
1317 \ifdrawparameters

Calculate drawing lengths and coordinates for picturing the parameters.

1318  \setlength{\l@ylen}{100pt}
1319  \l@youthpi=\l@ylen                   % indent
1320  \divide\l@youthpi by \onepoint
1321  \setlength{\l@ylen}{50pt}
1322  \l@youthpii=\l@ylen                  % numwidth
1323  \divide\l@youthpii by \onepoint
1324  \setlength{\l@ylen}{60pt}
1325  \l@youthpiii=\l@ylen                 % tocrmarg
1326  \divide\l@youthpiii by \onepoint
1327  \setlength{\l@ylen}{100pt}
1328  \l@youthpiv=\l@ylen                  % pnumwidth
1329  \divide\l@youthpiv by \onepoint
1330  \setlength{\l@ylen}{20pt}
1331  \l@youthpv=\l@ylen                   % dotsep
1332  \divide\l@youthpv by \onepoint
1333  \setlength{\l@ylen}{6.5in}
1334  \l@youthdo=\l@ylen                   % linewidth
1335  \divide\l@youthdo by \onepoint

1336 \fi

Continue with the general lengths and coordinate values.

1337 \setlength{\l@ylen}{20pt}
1338 \l@youtvdi=\l@ylen                 % baselineskip
1339  \divide\l@youtvdi by \onepoint
1340 \l@youtvdii=\l@youtvdi                    % twice baselineskip
1341  \multiply\l@youtvdii by \tw@
1342 \l@youtvdiii=\l@youtvdi                    % three times baselineskip

1343  \multiply\l@youtvdiii by \thr@@
1344 \l@youtvdiv=\l@youtvdi                    % four times baselineskip
1345  \multiply\l@youtvdiv by 4\relax
1346 \l@youtxci=\l@youthpi                    % X coord of start of numwidth
1347 \l@youtxcii=\l@youtxci                    % X coord of start of text
1348  \advance\l@youtxcii by \l@youthpii
1349 \l@youtxciii=\l@youthdo                    % X coord of start of pnumwidth
1350  \advance\l@youtxciii by -\l@youthpiv
1351 \l@youtxciv=\l@youthdo                    % X coord of start of tocrmarg
1352  \advance\l@youtxciv by -\l@youthpiii
1353 \l@youtxcv=\l@youtxciii                    % X coord of penultimate dot
1354  \advance\l@youtxcv by -\l@youthpv
1355 \l@youtxcvi=\l@youthdo                    % X ccord of picture centre
1356  \divide\l@youtxcvi by \tw@
1357 \l@youtyci=\z@                    % Y coord of base of dotsep text
1358 \l@youtycii=\l@youtyci                    % dotsep vector
1359  \advance\l@youtycii by \l@youtvdii
1360 \l@youtyciii=\l@youtycii                    % Y coord of base of bottom text
1361  \advance\l@youtyciii by \l@youtvdii
1362 \l@youtyciv=\l@youtyciii                    % Y coord of base of middle text
1363  \advance\l@youtyciv by \l@youtvdi
1364 \l@youtycv=\l@youtyciv                    % Y coord of base of top text
1365  \advance\l@youtycv by \l@youtvdi
1366 \l@youtycvi=\l@youtycv                    % Y coord of top vectors
1367  \advance\l@youtycvi by \l@youtvdi
1368  \advance\l@youtycvi by \l@youtvdi
1369 \l@youtvdo=\l@youtycvi                    % picture height
1370  \advance\l@youtvdo by \l@youtvdii
1371 \l@youthdii=\l@youtxciv                    % width of title text
1372  \advance\l@youthdii by -\l@youtxcii
1373 \l@youthdiii=\l@youtvdi                    % a small amount
1374 \l@youthdiv=\l@youthdiii                    % half a small amount
1375  \divide\l@youthdiv by \tw@

Calculate values for leader dots

1376 \settowidth{\l@ylen}{title end}
1377 \l@youthdv=\l@ylen                    % width of `title end' text
1378  \divide\l@youthdv by \onepoint
1379 \l@youthdvi=\l@youtxciii                    % space for dots
1380  \advance\l@youthdvi by -\l@youtxcii
1381  \advance\l@youthdvi by -\l@youthdv
1382 \l@youthdvii=\l@youthdvi                    % number of dots
1383  \divide\l@youthdvii by \l@youthpv

Draw the picture!

1384 \begin{center}
1385 \setlength{\unitlength}{\l@youtunitlength}
1386 \begin{picture}(\l@youthdo,\l@youtvdo)
1387  \thinlines
1388  \put(0,0){\framebox(\l@youthdo,\l@youtvdo){}}

The top text line.

1389  \put(\l@youtxci,\l@youtycv){\textbf{3.5}}
1390  \put(\l@youtxcii,\l@youtycv){Heading \ldots}
1391  \put(\l@youtxciv,\l@youtycv){\makebox(0,0)[br]{\ldots title}}

The middle text line.

1392  \put(\l@youtxcii,\l@youtyciv){continue \ldots}
1393  \put(\l@youtxciv,\l@youtyciv){\makebox(0,0)[br]{\ldots title}}

The bottom text line.

1394  \put(\l@youtxcii,\l@youtyciii){title end}             % end of title heading
1395  \put(\l@youthdo,\l@youtyciii){\makebox(0,0)[br]{487}} % page number
1396  \multiput(\l@youtxciii,\l@youtyciii)(-\l@youthpv,0){\l@youthdvii}{.} % dots
1397  \ifdrawparameters

Draw the parameters if requested.

The top vectors (which we put into their own picture).

1398  \put(0,\l@youtycvi){\begin{picture}(\l@youthdo,\oneinch)

The indent.

1399  \put(0,0){\vector(1,0){\l@youthpi}}
1400  \put(\l@youtxci,0){\line(0,-1){\l@youthdiii}}
1401  \put(0,0){\begin{picture}(\l@youthdiii,\l@youthdiii)
1402  \put(\l@youthdiv,\l@youthdiv){\footnotesize\textit{indent}}
1403  \end{picture}}

The numwidth.

1404  \put(\l@youtxci,0){\vector(1,0){\l@youthpii}}
1405  \put(\l@youtxcii,0){\line(0,-1){\l@youthdiii}}
1406  \put(\l@youtxci,0){\begin{picture}(\l@youthdiii,\l@youthdiii)
1407  \put(\l@youthdiv,\l@youthdiv){\footnotesize\textit{numwidth}}
1408  \end{picture}}

Lastly, the tocrmarg.

1409  \put(\l@youthdo,0){\vector(-1,0){\l@youthpiii}}
1410  \put(\l@youtxciv,0){\line(0,-1){\l@youthdiii}}
1411  \put(\l@youthdo,0){\begin{picture}(\l@youthdiii,\l@youthdiii)
1412  \put(-\l@youthdiv,\l@youthdiv){\makebox(0,0)[br]%
1413  {\footnotesize\texttt{\bs @tocrmarg}}}
1414  \end{picture}}
1415  \end{picture}}

Now do the linewidth.

1416  \thicklines
1417  \put(0,\l@youtvdo){\vector(1,0){\l@youthdo}}
1418  \thinlines
1419  \put(0,\l@youtvdo){\begin{picture}(\l@youthdiii,\l@youthdiii)
1420  \put(\l@youtxcvi,-\l@youthdiv){\makebox(0,0)[t]%
1421  {\footnotesize\texttt{\bs linewidth}}}
1422  \end{picture}}

The bottom vectors (which we put into their own picture).

1423  \put(0,\l@youtycii){\begin{picture}(\l@youthdo,\oneinch)

The pnumwidth.

1424  \put(\l@youthdo,0){\vector(-1,0){\l@youthpiv}}
1425  \put(\l@youtxciii,0){\line(0,1){\l@youthdiii}}
1426  \put(\l@youthdo,0){\begin{picture}(\l@youthdiii,\l@youthdiii)
1427  \put(-\l@youthdiv,\l@youthdiv){\makebox(0,0)[br]%
1428  {\footnotesize\texttt{\bs @pnumwidth}}}
1429  \end{picture}}

Finish with the dotsep.

1430  \put(\l@youtxciii,0){\vector(-1,0){\l@youthpv}}
1431  \put(\l@youtxciii,0){\vector(1,0){0}}
1432  \put(\l@youtxcv,0){\line(0,1){\l@youthdiii}}
1433  \put(\l@youtxciii,0){\begin{picture}(\l@youthdiii,\l@youthdiii)
1434  \put(0,-\l@youthdiv){\makebox(0,0)[tr]%
1435  {\footnotesize\texttt{\bs @dotsep}}}
1436  \end{picture}}
1437  \end{picture}}

1438 \fi

1439  \end{picture}
1440 \end{center}
1441 \setlength{\unitlength}{1pt}
1442 \ifdrawparameters\else

Print the table of parameter values.

1443  \begin{center}
1444 %%%    \vspace*{\l@ysetupbaselineskip}
1445  \begin{footnotesize}
1446  Lengths are to the nearest pt. \\
1447  \begin{tt}
1448  \begin{tabular}{l@{\hspace{20pt}}l}
1449  \textit{indent} = \number\l@youthpi pt &
1450  \textit{numwidth} = \number\l@youthpii pt \\
1451  \bs @tocrmarg = \number\l@youthpiii pt &
1452  \bs @pnumwidth = \number\l@youthpiv pt \\
1453  \bs @dotsep = \number\l@youthpv pt &   \\
1454 %%    \textit{dotspace} = \number\l@youthdvi pt &
1455 %%    \textit{num. of dots} = \number\l@youthdvii \\
1456  \end{tabular}
1457  \end{tt}\end{footnotesize}
1458  \end{center}

1459 \fi

The end of the definition of \drawtoc.

1460 }

2.11 Drawing a spread

We provide a facility for drawing a simple double page spread.

\drawaspread This command takes eight (8) parameters. These are:

1. The ratio of the height of the foot to the width of the spine. If this is zero then the foot height is calculated from the other vertical spacings.

2. The width of a page (as a length).

3. The ratio of the height of the page to its width.

4. The ratio of the height of the text to the width of the text.

5. The ratio of the width of the spine to the width of the page.

6. The ratio of the height of the top to the width of the spine.

7. The ratio of the width of the fore edge to the width of the spine.

8. The ratio of the width of the gutter to the spine (for a two column layout). If this is zero, then a single column layout is drawn.

1461 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1462 %%%%    SPREAD PAGE LAYOUT
1463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1464 \newcommand{\drawaspread}[8][0]{%
1465 \begingroup
1466 \setlength{\unitlength}{1pt}

Get the pagewidth as all values depend on this. Store it in \l@youthdo. Also use \l@youtunitlength to hold it temporarily.

1467 \setlength{\l@youtunitlength}{#2}
1468 \l@youthdo=\l@youtunitlength           % page width
1469  \divide\l@youthdo by \onepoint
1470 \l@youthdiv=\l@youthdo                 % total width of double spread
1471  \advance\l@youthdiv by \l@youthdo

The height of a page is kept in \l@youtvdo.

1472 \setlength{\l@ylen}{#3\l@youtunitlength}
1473 \l@youtvdo=\l@ylen                     % page height
1474  \divide\l@youtvdo by \onepoint

The width of the spine is kept in \l@youthdiii. We also use \l@youtunitlength as a temporary store for the spine width.

1475 \setlength{\l@ylen}{#5\l@youtunitlength}
1476 \l@youthdiii=\l@ylen                     % spine width
1477  \divide\l@youthdiii by \onepoint
1478 \setlength{\l@youtunitlength}{\l@ylen}

The width of the fore edge is kept in \l@youthdi.

1479 \setlength{\l@ylen}{#7\l@youtunitlength}
1480 \l@youthdi=\l@ylen                       % fore edge width
1481  \divide\l@youthdi by \onepoint

Calculate the text width and store it in \l@youthdii.

1482 \l@youthdii=\l@youthdo                  % text width
1483  \advance\l@youthdii by -\l@youthdi
1484  \advance\l@youthdii by -\l@youthdiii

The X coordinate of the left-hand side of the text box on the right-hand page is

  stored in \l@youtxci.
1485 \l@youtxci=\l@youthdo
1486  \advance\l@youtxci by \l@youthdiii

The height of the top margin is stored in \l@youtvdiii

1487 \setlength{\l@ylen}{#6\l@youtunitlength}
1488 \l@youtvdiii=\l@ylen                   % top margin
1489  \divide\l@youtvdiii by \onepoint

The height of the bottom margin is stored in \l@youtvdi.

1490 \setlength{\l@ylen}{#1\l@youtunitlength}
1491 \l@youtvdi=\l@ylen
1492  \divide\l@youtvdi by \onepoint

The text height is stored in \l@youtvdii.

1493 \setlength{\l@ylen}{\l@youthdii pt}
1494 \setlength{\l@ylen}{#4\l@ylen}
1495 \l@youtvdii=\l@ylen                    % text height
1496  \divide\l@youtvdii by \onepoint

The height of the bottom margin was stored in \l@youtvdi. If the value is zero then we calculate the height from the page, text and top margin height values already obtained.

1497 \ifnum\l@youtvdi=\z@
1498  \l@youtvdi=\l@youtvdo
1499  \advance\l@youtvdi by -\l@youtvdiii
1500  \advance\l@youtvdi by -\l@youtvdii

1501 \fi

We store the gutter width in \l@youthdv.

1502 \setlength{\l@ylen}{#8\l@youtunitlength}
1503 \l@youthdv=\l@ylen                     % gutter width
1504  \divide\l@youthdv by \onepoint

Now we can draw a single column spread.

1505 \ifnum\l@youthdv=\z@
1506  \begin{picture}(\l@youthdiv,\l@youtvdo)
1507  \thicklines
1508  \put(0,0){\framebox(\l@youthdiv,\l@youtvdo){}} % spread pages
1509  \put(\l@youthdo,0){\line(0,1){\l@youtvdo}}     % the spine
1510  \thinlines
1511  \put(\l@youthdi,\l@youtvdi){\framebox(\l@youthdii,\l@youtvdii){}} % LH text
1512  \put(\l@youtxci,\l@youtvdi){\framebox(\l@youthdii,\l@youtvdii){}} % RH text
1513  \end{picture}
1514 \else

We have two columns. Calculate some additional lengths and coordinates.

Store the column width in \l@youthdvi.

1515  \l@youthdvi=\l@youthdii      % column width
1516  \advance\l@youthdvi by -\l@youthdv
1517  \divide\l@youthdvi by \tw@

We also need the positions of the x coordinate of the LH inner column (store in \l@youtxcii) and of the RH outer column (store in \l@youtxciii).

1518  \l@youtxcii=\l@youthdi          % X coord of LH inner column
1519  \advance\l@youtxcii by \l@youthdvi
1520  \advance\l@youtxcii by \l@youthdv
1521  \l@youtxciii=\l@youtxci          % X coord of RH outer column
1522  \advance\l@youtxciii by \l@youthdvi
1523  \advance\l@youtxciii by \l@youthdv

Now draw the two column spread.

1524  \begin{picture}(\l@youthdiv,\l@youtvdo)
1525  \thicklines
1526  \put(0,0){\framebox(\l@youthdiv,\l@youtvdo){}} % spread pages
1527  \put(\l@youthdo,0){\line(0,1){\l@youtvdo}}     % the spine
1528  \thinlines
1529  \put(\l@youthdi,\l@youtvdi){\framebox(\l@youthdvi,\l@youtvdii){}} % LH LH col
1530  \put(\l@youtxcii,\l@youtvdi){\framebox(\l@youthdvi,\l@youtvdii){}} % LH RH col
1531  \put(\l@youtxci,\l@youtvdi){\framebox(\l@youthdvi,\l@youtvdii){}} % RH LH col
1532  \put(\l@youtxciii,\l@youtvdi){\framebox(\l@youthdvi,\l@youtvdii){}} % RH RH col
1533  \end{picture}

1534 \fi

End of the definition of \drawaspread.

1535 \endgroup

1536 }

2.12 Drawing a font box

We provide a facility for drawing a box around some text. This can also be used

  in a picture environment as \put(x,y){\frametext{text}}. The \unitlength

must be 1pt!

\drawfontframe Draws a tightly fitting box with the text reference point marked and a dotted line along the baseline.

1537 \newcommand{\drawfontframe}[1]{%

Save the (text) argument.

1538 \savebox{\layoutsbox}{#1}%

Save the width in \l@youthdo, height in \l@youtvdii and depth in \l@youtvdi.

1539 \l@yltoc{\wd\layoutsbox}{\l@youthdo}
1540 \l@yltoc{\ht\layoutsbox}{\l@youtvdii}
1541 \l@yltoc{\dp\layoutsbox}{\l@youtvdi}

Save the total height in \l@youtvdo.

1542 \l@youtvdo=\l@youtvdi
1543 \advance\l@youtvdo by \l@youtvdii

Save half the width in \l@youtxci.

1544 \l@youtxci=\l@youthdo
1545 \divide\l@youtxci by \tw@

Draw a picture, with origin at the box’s baseline. Use \qbezier to draw a dotted line with a dot at intervals of 2pt.

1546 \begin{picture}(\l@youthdo,\l@youtvdii)
1547  \thinlines
1548  \put(0,0){\usebox{\layoutsbox}}
1549  \put(0,0){\circle*{2}}
1550  \qbezier[\l@youtxci](0,0)(\l@youtxci,0)(\l@youthdo,0)
1551  \put(0,-\l@youtvdi){\framebox(\l@youthdo,\l@youtvdo){}}
1552 \end{picture}

1553 }

\drawfontframelabel Draws a tightly fitting box with the text reference point marked and a dotted line along the baseline and marks the width, height and depth.

1554 \newcommand{\drawfontframelabel}[1]{%

Save the (text) argument.

1555 \savebox{\layoutsbox}{#1}%

Save the width in \l@youthdo, height in \l@youtvdii and depth in \l@youtvdi.

1556 \l@yltoc{\wd\layoutsbox}{\l@youthdo}%
1557 \l@yltoc{\ht\layoutsbox}{\l@youtvdii}%
1558 \l@yltoc{\dp\layoutsbox}{\l@youtvdi}%

Save the total height in \l@youtvdo.

1559 \l@youtvdo=\l@youtvdi
1560 \advance\l@youtvdo by \l@youtvdii

Save half the width in \l@youtxci.

1561 \l@youtxci=\l@youthdo
1562 \divide\l@youtxci by \tw@

Set \l@youtdvi to be space between dimensions and labels.

1563 \l@youthdvi=5\relax

Add 2\l@youthdvi plus 7pt (i.e. 17pt) to the box height to allow for width label, and add 2\l@youthdvi plus 25pt (i.e 35pt) to the box width to allow for height label.

1564 \l@youtycv=\l@youtvdii
1565 \advance\l@youtycv by 17\relax
1566 \l@youtxcii=\l@youthdo
1567 \advance\l@youtxcii by 35\relax

Draw a picture, with origin at the box’s baseline. Use \qbezier to draw a dotted line with a dot at intervals of 2pt.

1568 \begin{picture}(\l@youtxcii,\l@youtycv)
1569  \thinlines
1570  \put(0,0){\usebox{\layoutsbox}}
1571  \put(0,0){\circle*{2}}
1572  \qbezier[\l@youtxci](0,0)(\l@youtxci,0)(\l@youthdo,0)
1573  \put(0,-\l@youtvdi){\framebox(\l@youthdo,\l@youtvdo){}}

Add the dimension lines and labels (in tiny print). Mark the reference point on the left of the box.

1574  \begin{tiny}
1575  \put(-\l@youthdvi,0){\makebox(0,0)[r]{reference}}

Draw the width dimension above the box and the label above the dimension.

1576  \l@youtycv=\l@youtvdii
1577  \advance\l@youtycv by \l@youthdvi
1578  \ifnum\l@youthdo > 6\relax
1579  \l@yhrda{0}{\l@youtycv}{\l@youthdo}
1580  \else
1581  \l@yhrdia{0}{\l@youtycv}{\l@youthdo}

1582 \fi

1583  \advance\l@youtycv by \l@youthdvi
1584  \put(\l@youtxci,\l@youtycv){\makebox(0,0)[b]{width}}

Draw the height dimension and label on the right of the box. \l@youtxcii is the x coordinate of the dimension line(s) and \l@youtxciii is the x coordinate of the right side label(s).

1585  \l@youtxcii=\l@youthdo
1586  \advance\l@youtxcii by \l@youthdvi
1587  \l@youtxciii=\l@youtxcii
1588  \advance\l@youtxciii by \l@youthdvi
1589  \ifnum\l@youtvdii > \z@

The height is positive, so draw it, putting the label at the center of the dimension line.

1590  \ifnum\l@youtvdii > 6\relax
1591  \l@yvuda{\l@youtxcii}{0}{\l@youtvdii}
1592  \else
1593  \l@yvudia{\l@youtxcii}{0}{\l@youtvdii}

1594 \fi

1595  \divide\l@youtvdii by \tw@
1596  \put(\l@youtxciii,\l@youtvdii){\makebox(0,0)[l]{height}}

1597 \fi

1598  \ifnum\l@youtvdi > \z@

The depth is positive, so draw it putting the label at the center of the dimension line.

1599  \ifnum\l@youtvdi > 6\relax
1600  \l@yvuda{\l@youtxcii}{-\l@youtvdi}{\l@youtvdi}
1601  \else
1602  \l@yvudia{\l@youtxcii}{-\l@youtvdi}{\l@youtvdi}

1603 \fi

1604  \divide\l@youtvdi by \tw@
1605  \put(\l@youtxciii,-\l@youtvdi){\makebox(0,0)[l]{depth}}

1606 \fi

This finishes the picture. Print the values if asked for.

1607  \end{tiny}
1608 \end{picture}

1609 \ifdrawparameters
1610  \begin{center}\begin{footnotesize}\begin{tt}
1611  \begin{tabular}{lll}
1612  \textrm{width} = \the\wd\layoutsbox &
1613  \textrm{height} = \the\ht\layoutsbox &
1614  \textrm{depth} = \the\dp\layoutsbox \\
1615  \end{tabular}
1616  \end{tt}\end{footnotesize}\end{center}

1617 \fi

All done.

1618 }

The end of this package.

1619 ⟨/lays⟩

References

[GMS94] Michel Goossens, Frank Mittelbach, and Alexander Samarin. The LaTeX Companion. Addison-Wesley Publishing Company, 1994.

[Wil96] Peter R. Wilson. LaTeX for standards: The LaTeX package files user manual. NIST Report NISTIR, June 1996.