summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/layouts
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/layouts
Initial commit
Diffstat (limited to 'macros/latex/contrib/layouts')
-rw-r--r--macros/latex/contrib/layouts/README98
-rw-r--r--macros/latex/contrib/layouts/layman.pdfbin0 -> 272753 bytes
-rw-r--r--macros/latex/contrib/layouts/layman.tex2534
-rw-r--r--macros/latex/contrib/layouts/layouts.dtx4841
-rw-r--r--macros/latex/contrib/layouts/layouts.ins73
-rw-r--r--macros/latex/contrib/layouts/layouts.pdfbin0 -> 303523 bytes
6 files changed, 7546 insertions, 0 deletions
diff --git a/macros/latex/contrib/layouts/README b/macros/latex/contrib/layouts/README
new file mode 100644
index 0000000000..fa2abbe727
--- /dev/null
+++ b/macros/latex/contrib/layouts/README
@@ -0,0 +1,98 @@
+___________________
+The LAYOUTS package
+
+ The layouts package enables the display of various elements of a
+document's layout including: the general page layout; disposition
+of floats; layout of paragraphs, lists, footnotes, table of contents,
+and sectional headings; font boxes.
+Facilities are provided for a document designer to experiment with
+the layout parameters.
+
+
+______________
+Change History
+
+Version v2.6d (2009/09/02)
+- New maintainer (Will Robertson)
+
+Changes in version v2.6c (2004/10/25)
+- Privatised some internal macro names (no change in functionality)
+
+Changes in version v2.6b (2003/11/25)
+- Fixed some spelling and gramatical errors
+
+Changes in version v2.6a (2002/12/12)
+- Fixed problem with negative length in list layout
+- NO CHANGE TO THE MANUAL
+
+Changes in version v2.6 (2002/06/09)
+- Expanded page layout options
+
+Changes in version v2.5a (2002/03/24)
+- Fixed problem with footer size on page diagrams
+
+Changes in version v2.5 (2001/11/11)
+- Cleaner seperation between generic and designed layouts
+- Added controls over the appearance of pictures
+- Lengths may be printed using any TeX unit (except scaled point)
+
+Changes in version v2.4 (2001/04/30)
+- Added switch for drawing marginal notes
+- Added support for the memoir class page layout
+
+
+Changes in version v2.3 (1999/03/06)
+- Added tabulation of actual layout values.
+- Corrected the ToC layout.
+- Reduced the number of counters used.
+
+-----------------------------------------------------------------
+ Author: Peter Wilson (Herries Press)
+ Maintainer: Will Robertson (will dot robertson at latex-project dot org)
+ Copyright 1998--2004 Peter R. Wilson
+
+ This work may be distributed and/or modified under the
+ conditions of the LaTeX Project Public License, either
+ version 1.3c of this license or (at your option) any
+ later version: <http://www.latex-project.org/lppl.txt>
+
+ This work has the LPPL maintenance status "maintained".
+ The Current Maintainer of this work is Will Robertson.
+
+ This work consists of the files:
+README (this file)
+layouts.dtx
+layouts.ins
+ and the derived files:
+layouts.sty
+
+ The distribution consists of the following files:
+README (this file)
+layouts.ins (Source extractor file)
+layouts.dtx (Package source)
+layman.tex (LaTeX source for the User Manual)
+layman.pdf (User Manual in PDF)
+
+-----------------------------------------------------------------
+
+ To install the package:
+- run: latex layouts.ins (which will generate layouts.sty)
+- Move layouts.sty to a location where LaTeX will find it
+ (typically in a local texmf tree at /tex/latex/layouts)
+ and refresh the file database. See the FAQ on CTAN at
+ /help/uk-tex-faq or http://www.tex.ac.uk/faq for more
+ information on this.
+
+ To process the user manual:
+- run: latex layman (twice) and print for the user manual
+
+ For a printed version of the package source:
+- run: latex layouts.dtx
+ If you want an index run: makeindex -s gind.ist layouts
+- run: latex layouts.dtx
+- Print layouts.dvi for a hardcopy of the package source
+
+2004/10/25
+Peter Wilson
+
+
diff --git a/macros/latex/contrib/layouts/layman.pdf b/macros/latex/contrib/layouts/layman.pdf
new file mode 100644
index 0000000000..ae160b9a7a
--- /dev/null
+++ b/macros/latex/contrib/layouts/layman.pdf
Binary files differ
diff --git a/macros/latex/contrib/layouts/layman.tex b/macros/latex/contrib/layouts/layman.tex
new file mode 100644
index 0000000000..e4cc94906a
--- /dev/null
+++ b/macros/latex/contrib/layouts/layman.tex
@@ -0,0 +1,2534 @@
+% layman.tex User Manual for layouts.sty
+%% Copyright 1998--2004 Peter R. Wilson
+%% All rights reserved
+%%
+
+\documentclass[11pt]{article}
+\usepackage{layouts}
+
+% pdfetex (which might become the base system) defines \pdfoutput
+% Thomas Esser (of teTeX fame) asked for the following to be removed (2004/04/03)
+%\newif\ifpdf
+%\makeatletter
+%\@ifundefined{pdfoutput}{\pdffalse}{\pdftrue}
+%\makeatother
+%\ifpdf
+% \pdfoutput=1
+%\fi
+
+
+\setlength{\textheight}{8.0in}
+\setlength{\textwidth}{6.0in}
+\setlength{\oddsidemargin}{0.25in}
+\setlength{\evensidemargin}{0.25in}
+\setlength{\marginparwidth}{0.6in}
+\setlength{\parskip}{5pt}
+\setcounter{secnumdepth}{4}
+\setcounter{tocdepth}{4}
+
+\setlength{\columnsep}{30pt}
+
+\setcounter{topnumber}{2}
+\setcounter{bottomnumber}{2}
+\setcounter{totalnumber}{4}
+\renewcommand{\topfraction}{0.9}
+\renewcommand{\bottomfraction}{0.6}
+\renewcommand{\textfraction}{0.1}
+
+
+\newlength{\figrulesep}
+\setlength{\figrulesep}{0.5\textfloatsep}
+
+\newcommand{\topfigrule}{\vspace*{-1pt}%
+ \noindent\rule[-\figrulesep]{\columnwidth}{1pt}}
+
+\newcommand{\botfigrule}{\vspace*{-2pt}%
+ \noindent\rule[\figrulesep]{\columnwidth}{2pt}}
+
+\makeatletter
+
+\renewcommand{\subsubsection}{\@startsection%
+ {subsubsection}%
+ {3}%
+ {0mm}%
+ {-\baselineskip}%
+ {0.5\baselineskip}%
+ {\large\itshape}}
+
+
+\newcommand{\fref}[1]{Figure~\ref{#1}}
+\newcommand{\tref}[1]{Table~\ref{#1}}
+\newcommand{\T}{\texttt{true}}
+\newcommand{\F}{\texttt{false}}
+\newcommand{\TF}{\textit{true/false}}
+
+
+%%%% the \meta command
+\begingroup
+\obeyspaces%
+\catcode`\^^M\active%
+\gdef\meta{\begingroup\obeyspaces\catcode`\^^M\active%
+\let^^M\do@space\let \do@space%
+\def\-{\egroup\discretionary{-}{}{}\hbox\bgroup\it}%
+\m@ta}%
+\endgroup
+\def\m@ta#1{\leavevmode\hbox\bgroup$\langle$\it#1\/$\rangle$\egroup
+ \endgroup}
+\def\do@space{\egroup\space
+ \hbox\bgroup\it\futurelet\next\sp@ce}
+\def\sp@ce{\ifx\next\do@space\expandafter\sp@@ce\fi}
+\def\sp@@ce#1{\futurelet\next\sp@ce}
+
+\newcommand{\marg}[1]{\texttt{\{}\meta{#1}\texttt{\}}}
+
+\newcommand{\file}[1]{\textsf{#1}}
+%%%%%% indexing commands
+%\@ifundefined{bs}{\newcommand{\bs}{\textbackslash}}%
+% {\renewcommand{\bs}{\textbackslash}}
+\@ifundefined{bs}{\newcommand{\bs}{\char '134}}%
+ {\renewcommand{\bs}{\char '134}}
+\newcommand{\tat}{@}
+
+\newcommand{\ixcom}[1]{\index{#1/ @\texttt{\protect\bs #1}}} % command
+\newcommand{\pixcom}[1]{\texttt{\bs #1}\index{#1/ @\texttt{\protect\bs #1}}}
+\newcommand{\ixatcom}[1]{\index{?#1/ @\texttt{\protect\bs\protect\tat #1}}}
+\newcommand{\pixatcom}[1]{\texttt{\bs\tat #1}\index{?#1/ @\texttt{\protect\bs\protect\tat #1}}}
+\newcommand{\ixenv}[1]{\index{#1 @\texttt{#1} (environment)}}
+\newcommand{\pixenv}[1]{\texttt{#1}\index{#1 @\texttt{#1} (environment)}}
+\newcommand{\ixpack}[1]{\index{#1 @\file{#1} (package)}}
+\newcommand{\pcom}[1]{\texttt{\bs #1}}
+\newcommand{\pixfile}[1]{\file{#1}\index{#1 @{\file{#1} (file)}}}
+\newcommand{\pixcount}[1]{\texttt{#1}\index{#1 @\texttt{#1} (counter)}}
+\newcommand{\ixsbox}[1]{\index{#1 @\texttt{#1} (save box)}}
+
+\providecommand{\indexfill}{}
+\providecommand{\sindexfill}{}
+\providecommand{\ssindexfill}{}
+\providecommand{\otherindexspace}[1]{}
+\providecommand{\alphaindexspace}[1]{\indexspace{\bfseries #1}}
+
+%%% \setlength{\parindent}{-4em}
+\makeatother
+
+\title{The \file{layouts} package: User manual}
+\author{
+ Author: Peter Wilson, Herries Press \\
+ Maintainer: Will Robertson \\
+ \texttt{will dot robertson at latex-project dot org}
+}
+\date{October 2004\thanks{Previous versions were dated
+ November 2003, July 2002, March 2002, November 2001, July 2001 and January 1999.}}
+
+ \makeindex
+
+\begin{document}
+%%% \setuplayouts
+\bibliographystyle{alpha}
+\pagenumbering{roman}
+\maketitle
+\begin{abstract}
+ The \LaTeX{} \file{layouts} package enables the display of various
+elements of a document's layout. The elements include the positioning
+of text on a page, the disposition of floats on a page, the geometrical
+layout of lists and footnotes, the design of section headers and their
+display in a table of contents. It also enables document designers to
+experiment with potential layout designs.
+\end{abstract}
+\tableofcontents
+\listoftables
+\listoffigures
+\clearpage
+\pagenumbering{arabic}
+
+
+\section{Introduction}
+
+ \LaTeX{} has several pre-defined styles for the layout of typeset
+documents~\cite{LAMPORT94}. Authors using \LaTeX{} sometimes wish to
+understand how these layouts are parameterised (or controlled). The
+\texttt{layouts} package enables the display of certain of these
+parameterised layouts, showing what the parameters control. It also
+provides facilities for experimenting with different values of the
+typesetting parameters, showing the results graphically.
+
+ The \file{layouts} package was developed as an aid to the author
+when he was developing a new \LaTeX{} class for typsetting ISO standards.
+The development of the package has benefitted from
+Kent McPherson's \pixfile{layout.sty}~\cite{MCPHERSON88}.
+
+\subsection{Command types}
+
+ The majority of the commands provided fall into one of several categories.
+\begin{description}
+\item[Drawing] Commands of the form \pcom{draw}\textit{L},
+ \pcom{}\textit{L}\texttt{diagram}, and
+ \pcom{}\textit{L}\texttt{design}
+ generate a \LaTeX{} \texttt{picture} of the layout \textit{L}.
+
+\item[Current layout] Commands of the form \pcom{current}\textit{L} collect,
+ as far as possible, the values of the layout parameters for the current
+ \textit{L} layout environment for use by the corresponding
+ \pcom{draw}\textit{L} command. If a parameter value is not directly
+ accessible, then a typical value is provided.
+
+\item[Layout values] Commands of the form \pcom{}\textit{L}\texttt{values}
+ produce a tabular listing of the current values of the parameters
+ controlling
+ the layout \textit{L}. As far as possible these are the actual values.
+ In some cases the values are hard-wired in the body of a macro, and in these
+ cases reasonable guesstimates are made of a `typical' value.
+ In the printed
+ table, guesstimates are indicated by appending two question marks (??)
+ to the printed value. Note that the tabular listing produced by a
+ \pcom{}\textit{L}\texttt{values} command is not the same as a listing
+ that might be produced by the corresponding \pcom{draw}\textit{L} command.
+ The appearance of the table may be controlled as follows.
+ \begin{itemize}
+ \item The declaration \pixcom{printheadingstrue} will cause a short title
+ to be placed above the tabular; the tabular is untitled when
+ \pixcom{printheadingsfalse} is in effect.
+ \item The font size used for the table is specified via the
+ \pixcom{setvaluestextsize}\marg{fontsize} macro, where
+ \meta{fontsize} is one of LaTeX's font size commands (e.g.,
+ \pixcom{footnotesize}, which is the default value.).
+ \end{itemize}
+
+\item[User-specified parameter values] Commands of the form
+ \pcom{try}\textit{P} can be used to change the value of the layout
+ parameter \textit{P}. Note that these commands do \emph{not} affect the
+ the layout of the document, they only modify the values used in
+ displaying a layout.
+
+\item[Control] Commands of the form \verb|\|\textit{C}\texttt{true} or
+ \verb|\|\textit{C}\texttt{false} control certain aspects of the kinds of
+ layouts pictured.
+
+\end{description}
+
+\subsection{General facilities}
+
+ In order to initialize the \file{layouts} package correctly for your
+document, the command \pixcom{setuplayouts}
+must be issued immediately
+after the \verb|\begin{document}|, or at least before any following command
+that changes font sizes or suchlike. Fortunately you don't have to concern
+youself with this as it is called automatically by the \file{layouts}
+package. However, you may call it yourself at some later point in the
+document to pick up the current value of the \pixcom{baselineskip}
+or \pixcom{parskip} if these have been modified. The \pixcom{setuplayouts}
+command also sets the \pixcom{setlayoutscale} to its default value of
+$0.5$.
+
+\subsubsection{Scaling}
+
+ A few layout pictures are drawn full size. Most are drawn less than
+full size, typically to half-scale. To make the pictures fit your
+document neatly, you may wish to change the scale. The command
+\verb|\setlayoutscale{|\meta{frac}\verb|}|,\ixcom{setlayoutscale}
+where \meta{frac} is a decimal number (e.g., $0.75$) sets the scaling.
+For example, \verb|\setlayoutscale{0.5}| will produce pictures at
+half full size, and \verb|\setlayoutscale{1.0}| will make the pictures
+full size.
+
+\subsubsection{Layout types}
+
+ In general, two kinds of layout pictures can be produced.
+
+\begin{enumerate}
+\item A picture showing a generic layout and its controlling parameters
+ is produced by a command of the form \pcom{}\textit{L}\texttt{diagram}.
+ The same effect may be achieved by using a \pcom{draw}\textit{L} after
+ the declaration \pixcom{drawparameterstrue}.
+\item A picture showing an `actual' layout is produced by a command
+ of the form \pcom{}\textit{L}\texttt{design}.
+ The same effect may be achieved by using a \pcom{draw}\textit{L} after
+ the declaration \\
+ \pixcom{drawparametersfalse}.
+
+\begin{quote}
+\textbf{Warning:} If an actual layout differs too much
+ from a `normal' layout then LaTeX may hiccup a time or two. The
+ typical problem is when a dimension that is expected to be positive
+ is actually negative; LaTeX will respond
+ with an error message like `Bad \pcom{line} or \pcom{vector} argument'.
+\end{quote}
+
+\end{enumerate}
+
+\begin{quote}
+ \textbf{Note:} The \pcom{}\textit{L}\texttt{diagram} and
+\pcom{}\textit{L}\texttt{design} commands were introduced in version 2.5 of
+the package. The previous method of generating pictures (via \pcom{draw}\textit{L}
+and \verb?\drawparameters...?) is mainly retained for compatibility reasons.
+\end{quote}
+
+ Examples of both kinds of layout are shown later.
+
+ Some aspects of the appearance of the pictures can be controlled.
+The following apply to both generic and actual layouts.
+\begin{itemize}
+\item The size of the font used for displaying the parameters is specified
+ via the command: \\
+ \pixcom{setparameterstextsize}\marg{size},
+ where \meta{size} is
+ one of LaTeX's font size commands. \\
+ The initial setting is
+ \verb|\setparameterstextsize{\footnotesize}|.
+
+\item Some parts of the layouts are labelled, for example the footer area
+ in the page layout is labelled `footer'. The macro
+ \pixcom{setlabelfont}\marg{font} can be used to control the font used for
+ typesetting these labels. The default is \verb|\setlabelfont{\normalsize}|,
+ but can be, for example, \verb|\setlabelfont{\large\itshape}| to use
+ a large italic font instead. Note that \meta{font} must be specified as
+ a declaration(s).
+\end{itemize}
+
+ The following controls only apply to actual layouts (i.e.,
+when using \pcom{}\textit{L}\texttt{design}, or the earlier
+ \pixcom{drawparametersfalse} \pcom{draw}\textit{L} pairing is in effect).
+\begin{itemize}
+\item Some layouts have some explanatory header text. Putting
+ \pixcom{printheadingsfalse} prohibits these while
+ \pixcom{printheadingstrue} lets them be printed.
+
+\item In the generic layouts, the lengths controlled by the various
+ parameters are indicated by dimension lines; these are not
+ normally shown in actual layouts. Using \pixcom{drawdimensionstrue}
+ will let these be shown in actual layouts. The default
+ setting is \pixcom{drawdimensionsfalse}.
+
+\begin{quote}
+\textbf{Warning:} If you draw actual layouts with \pixcom{drawdimensionstrue}
+ the drawings may be overburdened and if the layout differs too much
+ from a `normal' layout then LaTeX may hiccup a time or two (typically
+ with an error message like `Bad \pcom{line} or \pcom{vector} argument').
+\end{quote}
+
+\item When \pixcom{printparameterstrue} is in effect, a table of the parameter
+ values will be printed below the layout. Unsurprisingly,
+ \pixcom{printparametersfalse} prohibits the table. The default is
+ \pixcom{printparameterstrue}.
+
+\end{itemize}
+
+\subsubsection{Length units}
+
+ The tabular listings of the parameter length values produced by
+the \pcom{}\textit{L}\texttt{values} macros give the lengths in TeX
+points by default. The length units may be set by the
+\pixcom{printinunitsof}\marg{unit} command. The \meta{unit} argument
+may be any of TeX's length units, except for scaled point. That is, the
+allowable values are \texttt{pt}, \texttt{pc}, \texttt{in}, \texttt{mm},
+\texttt{cm}, \texttt{bp}, \texttt{dd}, or \texttt{cc}; an unkown unit is
+treated as though it were \texttt{pt}. When printing in pt units any
+stretch or shrink values are printed as well; using \texttt{PT} instead
+of \texttt{pt} eliminates these `rubber' values. The initial setting
+is \verb|\printinunitsof{pt}|.
+
+ The macro \pixcom{prntlen}\marg{length} prints the value of
+\meta{length}, where \meta{length} is a LaTeX length, using the units
+specified by \pixcom{printinunitsof}. For example, the following code
+\begin{verbatim}
+The textwidth is \printinunitsof{pt}\prntlen{\textwidth} which is also
+\printinunitsof{in}\prntlen{\textwidth} or
+\printinunitsof{mm}\prntlen{\textwidth}.
+\end{verbatim}
+prints out: \\
+\begingroup
+The textwidth is \printinunitsof{pt}\prntlen{\textwidth} which is also
+\printinunitsof{in}\prntlen{\textwidth} or
+\printinunitsof{mm}\prntlen{\textwidth}.
+\endgroup
+
+\subsection{Usage}
+
+ The drawing commands (i.e., \verb|\...diagram|, \verb|\...design|
+and \verb|\draw...|)
+are typically used within a
+\pixenv{figure} environment, although they can be used in
+running text. Internally they generate a \pixenv{picture}
+and \pixenv{tabular} environment, both enclosed in their
+own \pixenv{center} environments.
+
+ The \pixcom{setlayoutscale} command can be used anywhere in a document
+after the initial \pixcom{setuplayouts} command. Used in running text it
+will alter the scale factor for all succeeding drawing commands.
+However, if \pixcom{setlayoutscale} is called within an environment, such
+as the \pixenv{figure} environment, it will only affect
+the scale factors for succeeding drawing commands in that
+environment.
+
+ The \file{layouts} package uses many \LaTeX{} counters and lengths.
+If it is used with too many other packages, the available number of
+counters and lengths may be exhausted. Essentially, the \file{layouts}
+package is intended to be used in short documents as an exploratory tool
+when designing the typesetting rules to be embodied in a new package or
+class file.
+
+\section{Page spread}
+\suppressfloats[t]
+
+ Book designers often start by determining the proportions of a page,
+the proportions of the text block, and the position of the text block on
+the page. Often the width of a page is taken as the starting point.
+
+ In the following let $w$ be the width of a single page; that is,
+the distance from the
+spine to the outside of the fore edge. I also use the other symbols given in
+\tref{tab:spread}.
+\begin{table}
+\centering
+\caption{Page spread symbols} \label{tab:spread}
+\begin{tabular}{|c|l|} \hline
+Symbol & Meaning \\ \hline
+$w$ & Page width \\
+$P$ & Ratio of page height to width \\
+$T$ & Ratio of text block height to width \\
+$S$ & Ratio of spine width to page width \\
+$H$ & Ratio of top margin height to spine width \\
+$E$ & Ratio of fore edge margin width to spine width \\
+$F$ & Ratio of bottom margin height to spine width \\
+$G$ & Ratio of width of two-column gutter to spine width \\ \hline
+\end{tabular}
+\end{table}
+
+ Given values for $w$, $P$, $T$, $S$, and any two of $H$, $E$ and $F$, it
+is possible to calculate the page size, the text block size and the position
+of the text. The command \\
+\verb|\drawaspread[|\meta{F}\verb|]{|%
+ \meta{w}\verb|}{|%
+ \meta{P}\verb|}{|%
+ \meta{T}\verb|}{|%
+ \meta{S}\verb|}{|%
+ \meta{H}\verb|}{|%
+ \meta{E}\verb|}{|%
+ \meta{G}\verb|}|\ixcom{drawaspread} \\
+where the first parameter is optional, draws a two page spread with the given
+page width and proportions. If the optional \meta{F} is not provided, then the
+bottom margin is calculated from the values of other parameters. If \meta{G}
+is zero or negative, then a single column layout is shown, otherwise a double
+column layout is presented.
+
+\newlength{\pwlayi}
+\setlength{\pwlayi}{0.4375\textwidth}
+\newlength{\pwlayii}
+\setlength{\pwlayii}{0.5\pwlayi}
+
+\begin{figure}
+\centering
+\begin{minipage}[b]{\pwlayi}
+\drawaspread{\pwlayii}{1.294}{1.618}{0.176}{1.037}{1.685}{0}
+\end{minipage}
+\hfill
+\begin{minipage}[b]{\pwlayi}
+\drawaspread{\pwlayii}{1.5}{1.5}{0.111}{1.5}{2.0}{0}
+\end{minipage}
+\caption{(Left) The \LaTeX{} book spread;
+ (Right) Spread for many of Gutenberg's books}
+\label{fig:spread}
+\end{figure}
+
+
+ Figure~\ref{fig:spread} shows two different spreads. This was produced
+from the code below:
+\begin{verbatim}
+\newlength{\pwlayi}
+\setlength{\pwlayi}{0.4375\textwidth}
+\newlength{\pwlayii}
+\setlength{\pwlayii}{0.5\pwlayi}
+
+\begin{figure}
+\centering
+\begin{minipage}[b]{\pwlayi}
+\drawaspread{\pwlayii}{1.294}{1.618}{0.176}{1.037}{1.685}{0}
+\end{minipage}
+\hfill
+\begin{minipage}[b]{\pwlayi}
+\drawaspread{\pwlayii}{1.5}{1.5}{0.111}{1.5}{2.0}{0}
+\end{minipage}
+\caption{(Left) The \LaTeX{} book spread;
+ (Right) Spread for many of Gutenberg's books}
+\label{fig:spread}
+\end{figure}
+\end{verbatim}
+
+ The \pixcom{drawaspread} command does not scale via the
+\pixcom{setlayoutscale} command. The size of the illustration is controlled
+by the value given for the width of the page.
+
+
+%%%%%%%%%%%%%%%
+\clearpage
+\section{Page layout}
+\suppressfloats[t]
+
+%%\drawmarginparsfalse
+
+%%%%%%%%%%%%%%%%%%%%%
+%%\printheadingstrue
+%\printheadingsfalse
+%%\printparameterstrue
+%\printparametersfalse
+%\drawdimensionstrue
+%%\drawdimensionsfalse
+%%%%%%%%%%%%%%%%%%%%%
+
+ The layout of a single page is produced by the
+\pixcom{pagediagram} or \pixcom{pagedesign} (or \pixcom{drawpage}) command.
+The kind of page drawn is
+specified via three control commands\footnote{Remember that all drawing
+commands of the form \pcom{draw...}, except for \pcom{drawaspread}, are also controlled
+by the \pcom{drawparameters...} command.}.
+
+ Right- or left-hand page layouts are specified by the commands
+\pcom{oddpagelayout}\TF{} (\pixcom{oddpagelayouttrue}
+for an odd-numbered (i.e., right-hand) page, or
+\pixcom{oddpagelayoutfalse} for an even-numbered
+(i.e., left-hand or verso) page). The default is
+\pixcom{oddpagelayouttrue}.
+
+ Double or single column layouts are controlled by the commands
+\pcom{twocolumnlayout}\TF.
+Using \pixcom{twocolumnlayouttrue}
+will result in a picture of a double column page layout and
+using \pixcom{twocolumnlayoutfalse}
+will result in a picture of a single column page layout. The default
+is \pixcom{twocolumnlayoutfalse}.
+
+ The display of marginal notes is controlled by the commands
+\pcom{drawmarginpars}\TF.
+Using \pixcom{drawmarginparstrue} rusults in representations of
+marginal notes being drawn and using \pixcom{drawmarginparsfalse}
+hides the marginal notes. The default is
+\pixcom{drawmarginparstrue}.
+
+ Normally \LaTeX{} places any marginal notes in the outside margin;
+the standard \LaTeX{} command \pixcom{reversemarginpar} causes notes
+to be placed in the opposite margin to the default one, and
+\pixcom{normalmarginpar} causes the notes to be put in the default
+margin. The package commands \pcom{reversemarginpar}\TF{} may be used
+to control the marginal note locations in the pictures.
+\pixcom{reversemarginpartrue} corresponds to \pixcom{reversemarginpar}
+and \pixcom{reversemarginparfalse} corresponds to \pixcom{normalmarginpar}.
+The package default is \pixcom{reversemarginparfalse}.
+
+ A \LaTeX{} class may always place marginal notes into the same margin.
+The package command \pcom{marginparswitch}\TF, is supplied to control
+the placement in the diagrams. \pixcom{marginparswitchtrue} will place marginal notes
+according to the class desires, while \pixcom{marginparswitchfalse} will
+always draw marginal notes in one margin.
+
+
+ As an example, \fref{fig:pplt} is produced by the following code.
+\begin{verbatim}
+\begin{figure}
+\oddpagelayoutfalse
+\twocolumnlayouttrue
+\pagediagram
+\caption{Left-hand two-column page layout parameters} \label{fig:pplt}
+\end{figure}
+\end{verbatim}
+
+\begin{figure}
+\oddpagelayoutfalse
+\twocolumnlayouttrue
+%\drawpage
+\pagediagram
+\caption{Left-hand two-column page layout parameters} \label{fig:pplt}
+\end{figure}
+
+ The two lines forming an inverted `L' represent the left-hand and
+top of the printed sheet.
+By default, \LaTeX{} makes all page layout measurements from a point
+located one inch in from the left-hand side of the printed sheet and one
+inch down from the top of the sheet. This point is marked with a circle.
+The dashed lines correspond to the vertical and horizontal offsets from
+this point.
+
+
+ The command \pixcom{currentpage} collects together the page parameter
+settings for the current document for the page on which it is issued.
+For example, it determines whether the current page is odd or even and
+in which margin any marginal notes would be placed.
+\fref{fig:ptrs} shows the odd page
+layout for the document you are now reading. It was produced by the
+following commands:
+\begin{verbatim}
+\begin{figure}
+\currentpage
+\oddpagelayouttrue
+\pagedesign
+\caption{Odd page layout for this document} \label{fig:ptrs}
+\end{figure}
+\end{verbatim}
+The resulting picture is correctly proportioned, both horizontally and
+vertically.
+
+\begin{figure}
+\currentpage
+%\drawparametersfalse \drawpage
+\pagedesign
+\caption{Page layout for this document} \label{fig:ptrs}
+\end{figure}
+
+ When layouts are drawn with \verb|...diagram|\footnote{Or longhandedly
+with \pcom{drawparametersfalse} and \pcom{draw...}.}
+the actual values
+of the parameters used to produce the layout are normally
+listed at the bottom of the
+picture. This can be used, as in \fref{fig:ptrs}, to find out what the
+settings are for the current document.
+
+ Among other parameters that are set by
+\pixcom{currentpage} are values for the page width and
+height. If these have been specified by the
+\pixcom{paperwidth} and \pixcom{paperheight}
+commands, these values are used. Otherwise the width and height are set to
+the size of American letter paper, which is eight by eleven and a half inches.
+
+\begin{table}
+\centering
+\caption{Commands for setting trial page parameters}\label{tab:tpage}
+\begin{tabular}{|l|l|} \hline
+Command & Parameter \\ \hline
+\pixcom{trypaperwidth} & sets the \pixcom{paperwidth} value \\
+\pixcom{trypaperheight} & sets the \pixcom{paperheight} value \\
+\pixcom{tryhoffset} & sets the \pixcom{hoffset} value (usually 0pt) \\
+\pixcom{tryvoffset} & sets the \pixcom{voffset} value (usually 0pt) \\
+\pixcom{tryoddsidemargin} & sets the \pixcom{oddsidemargin} (usually 21--63pt) \\
+\pixcom{tryevensidemargin} & sets the \pixcom{evensidemargin} value (usually 39--82pt) \\
+\pixcom{trymarginparwidth} & sets the \pixcom{marginparwidth} value (usually 68--107pt) \\
+\pixcom{trymarginparsep} & sets the \pixcom{marginparsep} value (usually 10--11pt) \\
+\pixcom{trymarginparpush} & sets the \pixcom{marginparpush} value (usually 5--7pt) \\
+\pixcom{trytopmargin} & sets the \pixcom{topmargin} value (usually 27pt) \\
+\pixcom{tryheadheight} & sets the \pixcom{headheight} value (usually 12pt) \\
+\pixcom{tryheadsep} & sets the \pixcom{headsep} value (usually 25pt) \\
+\pixcom{tryfootskip} & sets the \pixcom{footskip} value (usually 30pt) \\
+\pixcom{trytextheight} & sets the \pixcom{textheight} value (usually 36--43 times the \pixcom{baselineskip}) \\
+\pixcom{trytextwidth} & sets the \pixcom{textwidth} value (usually 345--390pt) \\
+\pixcom{trycolumnsep} & sets the \pixcom{columnsep} value (usually 10pt) \\
+\pixcom{trycolumnseprule} & sets the \pixcom{columnseprule} value (usually 0pt) \\
+\hline
+\end{tabular}
+\end{table}
+
+ There are a set of commands for experimenting with the page layout
+parameters. They are listed in \tref{tab:tpage}. Each of these commands
+takes one argument which is a length value. There is, in addition, an odd
+command,
+\pixcom{setfootbox}\verb|{|\meta{height}\verb|}{|\meta{depth}\verb|}|,
+which may be used
+to specify the expected \meta{height} and \meta{depth} of the footer. Footers
+are typically a single line but may require more space than that. Note that
+there is no way to actually specify the vertical size of the footer in LaTeX,
+which will use as much space as it needs. If a footer is given a \meta{depth}
+then a dashed line is drawn at \pixcom{footskip} below the main text box.
+
+ The following code provides an example of the use of some of these
+commands when trying an experimental page layout. The result is shown
+in \fref{fig:pudf}. Note that
+\pixcom{currentpage} is used to initialize all the appropriate
+parameter values before setting any trial values.
+\begin{verbatim}
+\begin{figure}
+\currentpage
+\trypaperwidth{11in}
+\trypaperheight{8.5in}
+\trytextwidth{500pt}
+\trycolumnsep{40pt}
+\trycolumnseprule{3pt}
+\tryhoffset{-0.5in}
+\tryvoffset{0.5in}
+\printheadingsfalse
+\drawdimensionstrue
+\twocolumnlayouttrue
+\pagedesign
+\caption{An experimental page layout}\label{fig:pudf}
+\end{figure}
+\end{verbatim}
+
+\begin{figure}
+\currentpage
+\trypaperwidth{11in}
+\trypaperheight{8.5in}
+\trytextwidth{500pt}
+\trycolumnsep{40pt}
+\trycolumnseprule{3pt}
+\tryhoffset{-0.5in}
+\tryvoffset{0.5in}
+\printheadingsfalse
+\drawdimensionstrue
+\twocolumnlayouttrue
+%\drawparametersfalse \drawpage
+\pagedesign
+\caption{An experimental page layout}\label{fig:pudf}
+\end{figure}
+
+ As can be seen, the resulting layout runs off the bottom of the
+specified physical page; either because the page dimensions were incorrectly
+set (the designer getting a landscape page when a portrait page was desired),
+or because the text height and width parameters were set incorrectly
+for the physical page (probably
+satisfactory for a portrait page but certainly wrong for the landscape page).
+
+ Note that \pixcom{printheadingsfalse} was used to delete the
+explanatory heading text, and dimensions were drawn because of
+\pixcom{drawdimensionstrue}.
+
+\clearpage
+
+\subsection{Changing the page layout in your document}
+
+ You can only specify the page layout in a document's preamble. That is,
+it is set by the class, or by a package or per document via code you write
+in the preamble. To be on the safe side and avoid strange error messages
+like \texttt{You can't use `\bs spacefactor'\ixcom{spacefactor}
+in vertical mode}, enclose all
+your preamble commands within the command pair \pixcom{makeatletter}
+and \pixcom{makeatother}.
+
+ The page layout parameters can all be changed using the \LaTeX{}
+\pixcom{setlength} command. For example, to set the width of the text to
+3~inches, put this into the preamble:
+\begin{verbatim}
+\makeatletter
+\setlength{\textwidth}{3in}
+\makeatother
+\end{verbatim}
+
+
+ The \pixcom{pagevalues} command can be used to produce a table,
+as shown here, of the values of the current document's page layout
+parameters. This is the default tabulation.
+
+\begin{verbatim}
+\pagevalues
+\end{verbatim}
+
+\pagevalues
+
+\begin{quote}
+\textbf{Note:} Prior to version 2.5 the tabulations were set in a
+\pixenv{center} environment.
+Starting with version 2.5 there is no surrounding environment.
+\end{quote}
+
+%%%%%%%%%%%%%%%
+\clearpage
+\section{The \file{memoir} class page layout}
+\suppressfloats[t]
+
+%%\drawmarginparsfalse
+
+ The \file{memoir} class~\cite{MEMOIR} provides a different set
+of page layout parameters than the standard LaTeX classes.
+
+ The layout of a single page for this class is produced by the
+\pixcom{stockdiagram} and \pixcom{stockdesign} (or \pixcom{drawstock})
+commands. The kind of page drawn is
+specified via the same control commands that are used by
+the page drawing commands. That is: \\
+\pcom{oddpagelayout}\TF, \\
+\pcom{twocolumnlayout}\TF, \\
+\pcom{drawmarginpars}\TF, \\
+\pcom{reversemarginpar}\TF, and \\
+\pcom{marginparswitch}\TF.
+
+ Generally speaking, the commands for displaying and experimenting
+with the layout of a \file{memoir}
+class page are the same as, or analagous to, those for a standard page
+layout.
+
+ As an example, \fref{fig:mempplt} is produced by the following code.
+\begin{verbatim}
+\begin{figure}
+\oddpagelayouttrue
+\twocolumnlayoutfalse
+\stockdiagram
+\caption{Right-hand page major layout parameters for
+ the \file{memoir} class} \label{fig:mempplt}
+\end{figure}
+\end{verbatim}
+
+\begin{figure}
+\oddpagelayouttrue
+\twocolumnlayoutfalse
+%\drawmarginparsfalse \drawstock
+\stockdiagram
+\caption{Right-hand page major layout parameters for
+ the \file{memoir} class} \label{fig:mempplt}
+\end{figure}
+
+
+ Like the \pixcom{currentpage} command, \pixcom{currentstock} collects
+together the page parameter
+settings for the current \file{memoir} class document.
+
+ For information on how to design a page layout the class
+documentation provides all the details~\cite{MEMOIR} (and uses the
+\file{layouts} package to illustrate them).
+
+\begin{table}
+\centering
+\caption{Commands for setting trial \file{memoir} page parameters}\label{tab:tmempage}
+\begin{tabular}{|l|l|} \hline
+Command & Parameter \\ \hline
+\pixcom{trystockwidth} & sets the \pixcom{stockwidth} value \\
+\pixcom{trystockheight} & sets the \pixcom{stockheight} value \\
+\pixcom{trypaperwidth} & sets the \pixcom{paperwidth} value \\
+\pixcom{trypaperheight} & sets the \pixcom{paperheight} value \\
+\pixcom{trytrimedge} & sets the \pixcom{trimedge} value \\
+\pixcom{trytrimtop} & sets the \pixcom{trimtop} value \\
+\pixcom{tryspinemargin} & sets the \pixcom{spinemargin} (usually 21--63pt) \\
+\pixcom{trymarginparwidth} & sets the \pixcom{marginparwidth} value (usually 68--107pt) \\
+\pixcom{trymarginparsep} & sets the \pixcom{marginparsep} value (usually 10--11pt) \\
+\pixcom{trymarginparpush} & sets the \pixcom{marginparpush} value (usually 5--7pt) \\
+\pixcom{tryuppermargin} & sets the \pixcom{uppermargin} value (usually 27pt) \\
+\pixcom{tryheadheight} & sets the \pixcom{headheight} value (usually 12pt) \\
+\pixcom{tryheadsep} & sets the \pixcom{headsep} value (usually 25pt) \\
+\pixcom{tryfootskip} & sets the \pixcom{footskip} value (usually 30pt) \\
+\pixcom{trytextheight} & sets the \pixcom{textheight} value (usually 36--43 times the \pixcom{baselineskip}) \\
+\pixcom{trytextwidth} & sets the \pixcom{textwidth} value (usually 345--390pt) \\
+\pixcom{trycolumnsep} & sets the \pixcom{columnsep} value (usually 10pt) \\
+\pixcom{trycolumnseprule} & sets the \pixcom{columnseprule} value (usually 0pt) \\
+\hline
+\end{tabular}
+\end{table}
+
+ There are a set of commands for experimenting with the page layout
+parameters. They are listed in \tref{tab:tmempage}. Each of these commands
+takes one argument which is a length value. The \pixcom{setfootbox} command
+may be used as well.
+
+ The following code provides an example of the use of some of these
+commands when trying an experimental page layout. The result is shown
+in \fref{fig:pmemudf}.
+\begin{verbatim}
+\begin{figure}
+\currentstock
+\trystockheight{11in}
+\trystockwidth{8.5in}
+\trytrimtop{1in}
+\trytrimedge{1in}
+\trypaperheight{10in}
+\trypaperwidth{7.5in}
+\tryspinemargin{0.75in}
+\tryuppermargin{1.0in}
+\tryheadheight{12pt}
+\tryheadsep{24pt}
+\trytextwidth{5in}
+\trytextheight{7in}
+\tryfootskip{24pt}
+\setfootbox{50pt}{50pt}
+\trymarginparsep{17pt}
+\trymarginparwidth{62pt}
+\trymarginparpush{12pt}
+\setlabelfont{\small}
+\stockdesign
+\caption{An experimental \file{memoir} class page layout}\label{fig:pmemudf}
+\end{figure}
+\end{verbatim}
+
+\begin{figure}
+\currentstock
+\trystockheight{11in}
+\trystockwidth{8.5in}
+\trytrimtop{1in}
+\trytrimedge{1in}
+\trypaperheight{10in}
+\trypaperwidth{7.5in}
+\tryspinemargin{0.75in}
+\tryuppermargin{1.0in}
+\tryheadheight{12pt}
+\tryheadsep{24pt}
+\trytextwidth{5in}
+\trytextheight{7in}
+\tryfootskip{24pt}
+\setfootbox{50pt}{50pt}
+\trymarginparsep{17pt}
+\trymarginparwidth{62pt}
+\trymarginparpush{12pt}
+\printheadingsfalse
+%%\twocolumnlayouttrue
+%%\oddpagelayoutfalse
+\setlabelfont{\small}
+%\drawparametersfalse \drawstock
+\stockdesign
+\caption{An experimental \file{memoir} class page layout}\label{fig:pmemudf}
+\end{figure}
+
+ There is also a \pixcom{stockvalues} command to print a tabulation of the
+current stock specifications.
+% As this manual does not use the \file{memoir}
+% class, calling it would only result in errors.
+
+
+%%%%%%%%%%
+\clearpage
+\section{Paragraph layout}
+\suppressfloats[t]
+
+ The commands \pixcom{paragraphdiagram} and \pixcom{paragraphdesign}
+(or \pixcom{drawparagraph} )
+can be used to visualize the parameters
+that affect paragraphing. This is illustrated in \fref{fig:fpara} which
+was produced by the following code:
+\begin{verbatim}
+\begin{figure}
+\paragraphdiagram
+\caption{Paragraph parameters}\label{fig:fpara}
+\end{figure}
+\end{verbatim}
+
+\begin{figure}
+%\drawparagraph
+\paragraphdiagram
+\caption{Paragraph parameters}\label{fig:fpara}
+\end{figure}
+
+ The command \verb|\currentparagraph|\ixcom{currentparagraph} sets the
+drawing parameters to the settings for the current document. The commands
+listed in \tref{tab:para} can be used to set trial values for the
+relevant parameters. These commands take one argument which must be a length.
+
+\begin{table}
+\centering
+\caption{Commands for setting trial paragraph parameters}\label{tab:para}
+\begin{tabular}{|l|l|} \hline
+Command & Parameter \\ \hline
+\pixcom{tryparindent} & sets the \pixcom{parindent} value \\
+\pixcom{tryparskip} & sets the \pixcom{parskip} value \\
+\pixcom{tryparlinewidth} & sets the \pixcom{linewidth} value \\
+\pixcom{tryparbaselineskip} & sets the \pixcom{baselineskip} value \\ \hline
+\end{tabular}
+\end{table}
+
+ Figure~\ref{fig:dpara} shows the paragraphing as used in this document.
+It was produced with this code:
+\begin{verbatim}
+\currentparagraph
+\begin{figure}
+\paragraphdesign
+\caption{Paragraphs in this document}\label{fig:dpara}
+\end{figure}
+\end{verbatim}
+
+\currentparagraph
+\begin{figure}
+%\drawparametersfalse \drawparagraph
+\paragraphdesign
+\caption{Paragraphs in this document}\label{fig:dpara}
+\end{figure}
+
+\currentparagraph
+\begin{figure}
+\tryparindent{-4em}
+%\drawparametersfalse \drawparagraph
+\paragraphdesign
+\caption{An outset paragraph}\label{fig:mpara}
+\end{figure}
+
+ Interestingly, I found that \LaTeX{} is happy even if \pixcom{parindent}
+is set to a negative value. It isn't demonstrated in this typescript but
+you can see the effect in \fref{fig:mpara} which was produced from:
+\begin{verbatim}
+\currentparagraph
+\begin{figure}
+\tryparindent{-4em}
+\paragraphdesign
+\caption{An outset paragraph}\label{fig:mpara}
+\end{figure}
+\end{verbatim}
+
+ The \pixcom{paragraphvalues} command can be used to produce a table,
+shown below, of the values of the current document's paragraph layout
+parameters (as set at the time that the command is used). The tabulation
+was typeset via
+\begin{verbatim}
+\begin{center}
+\printinunitsof{mm}
+\paragraphvalues
+\end{center}
+\end{verbatim}
+Note the use of \pixcom{printinunitsof} to set millimetres as the unit of
+length.
+
+\begin{center}
+\printinunitsof{mm}
+\paragraphvalues
+\end{center}
+
+
+%%%%%%%%%
+\clearpage
+\section{Float layouts}
+\suppressfloats[t]
+
+ Two sets of commands are provided for displaying the layouts of
+\LaTeX{} floats (e.g., the \pixenv{figure} and \pixenv{table} environments).
+One set is for a macro view of floats and the other is for a more
+detailed view.
+
+\subsection{Float and text page layout}
+
+ This set of commands is for displaying the general parameters for
+the location of floats on a page and proportioning the available space
+between the floats and textual material.
+
+ The commands \pixcom{floatpagediagram} and \pixcom{floatpagedesign}
+(or \pixcom{drawfloatpage}) are used to visualize the general
+parameters. These are illustrated in \fref{fig:fpp} which was produced
+by the following code:
+\begin{verbatim}
+\begin{figure}
+\floatpagediagram
+\caption{Float and text page parameters}\label{fig:fpp}
+\end{figure}
+\end{verbatim}
+
+\begin{figure}
+%\drawfloatpage
+\floatpagediagram
+\caption{Float and text page parameters}\label{fig:fpp}
+\end{figure}
+
+ The command \pixcom{currentfloatpage} sets the drawing parameters to the
+settings for the current document. The `standard' \LaTeX{} settings are
+shown in \fref{fig:fpstd}, produced by the code below.
+\begin{verbatim}
+\begin{figure}
+\currentfloatpage
+\trytotalnumber{3}
+\trytopnumber{2}
+\trytopfraction{0.7}
+\trytextfraction{0.2}
+\trybottomfraction{0.3}
+\trybottomnumber{1}
+\setlayoutscale{0.25}
+\floatpagedesign
+\caption{The standard \LaTeX{} float and text page settings}
+\label{fig:fpstd}
+\end{figure}
+\end{verbatim}
+
+\begin{figure}
+\currentfloatpage
+\trytotalnumber{3}
+\trytopnumber{2}
+\trytopfraction{0.7}
+\trytextfraction{0.2}
+\trybottomfraction{0.3}
+\trybottomnumber{1}
+\setlayoutscale{0.25}
+%\drawparametersfalse \drawfloatpage
+\floatpagedesign
+\caption{The standard \LaTeX{} float and text page settings}
+\label{fig:fpstd}
+\end{figure}
+
+ The commands listed in \tref{tab:tfloatp} can be used to set trial values
+for the relevant parameters. The commands take one argument, which is either
+an integer number or a decimal fraction, depending on the particular command.
+
+\begin{table}
+\centering
+\caption{Commands for setting trial float page parameters}\label{tab:tfloatp}
+\begin{tabular}{|l|l|} \hline
+Command & Parameter \\ \hline
+\pixcom{trytotalnumber} & (integer) sets the \pixcom{totalnumber} (usually 3) \\
+\pixcom{trytopnumber} & (integer) sets the \pixcom{topnumber} (usually 2) \\
+\pixcom{trytopfraction} & (decimal) sets the \pixcom{topfraction} (usually 0.7) \\
+\pixcom{trytextfraction} & (decimal) sets the \pixcom{textfraction} (usually 0.2) \\
+\pixcom{trybottomnumber} & (integer) sets the \pixcom{bottomnumber} (usually 1) \\
+\pixcom{trybottomfraction} & (decimal) sets the \pixcom{bottomfraction} (usually 0.3) \\
+\hline
+\end{tabular}
+\end{table}
+
+\begin{figure}
+\currentfloatpage
+\trytotalnumber{4}
+\trytopnumber{2}
+\trytopfraction{0.9}
+\trytextfraction{0.1}
+\trybottomnumber{2}
+\trybottomfraction{0.6}
+\setlayoutscale{0.25}
+%\drawparametersfalse \drawfloatpage
+\floatpagedesign
+\caption{Float page layout for decreasing likelihood of float-only pages}
+\label{fig:fpudf}
+\end{figure}
+
+ Figure~\ref{fig:fpudf} illustrates float page settings that increase
+the likelihood of a float remaining on a text page without being put on
+a page by itself. The figure was produced from the following code:
+\begin{verbatim}
+\begin{figure}
+\currentfloatpage
+\trytotalnumber{4}
+\trytopnumber{2}
+\trytopfraction{0.9}
+\trytextfraction{0.1}
+\trybottomnumber{2}
+\trybottomfraction{0.6}
+\setlayoutscale{0.25}
+\floatpagedesign
+\caption{Float page layout for decreasing likelihood of float-only pages}
+\label{fig:fpudf}
+\end{figure}
+\end{verbatim}
+
+
+%%%%%%%%%
+%%%%\clearpage
+\subsection{Detailed float layout}
+\suppressfloats[t]
+
+ The other view of floats concentrates on the spacing between text and
+floats on a page. The \pixcom{floatdiagram} and \pixcom{floatdesign}
+(or \pixcom{drawfloat}) commands are used to visualize this
+aspect.
+
+ The relevant parameters are shown in \fref{fig:flp}, produced from the
+following code:
+\begin{verbatim}
+\begin{figure}
+\setlayoutscale{0.9}
+\floatdiagram
+\caption{Float parameters}\label{fig:flp}
+\end{figure}
+\end{verbatim}
+
+\begin{figure}
+\setlayoutscale{0.9}
+%\drawfloat
+\floatdiagram
+\caption{Float parameters}\label{fig:flp}
+\end{figure}
+
+ As usual, the command \pixcom{currentfloat} sets the trial float parameters
+to those in effect for the current document.
+
+\begin{figure}
+\currentfloat
+\tryintextsep{\intextsep}
+\trytopfigrule{0.5pt}
+\trybotfigrule{1pt}
+\setlayoutscale{0.9}
+%\drawparametersfalse \drawfloat
+\floatdesign
+\caption{Float layout with rules}\label{fig:fludf}
+\end{figure}
+
+ The commands listed in \tref{tab:tfloat}, all of which take a length
+argument, set trial values for the float parameters.
+
+\begin{table}
+\centering
+\caption{Commands for setting trial float parameters}\label{tab:tfloat}
+\begin{tabular}{|l|l|} \hline
+Command & Parameter \\ \hline
+\pixcom{trytextfloatsep} & sets the \pixcom{textfloatsep} value (usually 20pt) \\
+\pixcom{tryfloatsep} & sets the \pixcom{floatsep} value (usually 12pt) \\
+\pixcom{tryintextsep} & sets the \pixcom{intextsep} value (usually 12pt) \\
+\pixcom{trytopfigrule} & sets the thickness of a \pixcom{topfigrule} (usually 0pt) \\
+\pixcom{trybotfigrule} & sets the thickness of a \pixcom{botfigrule} (usually 0pt) \\
+\hline
+\end{tabular}
+\end{table}
+
+ The following code, used to produce \fref{fig:fludf}, shows the use of
+some of these commands:
+\begin{verbatim}
+\begin{figure}
+\currentfloat
+\tryintextsep{\intextsep}
+\trytopfigrule{0.5pt}
+\trybotfigrule{1pt}
+\setlayoutscale{0.9}
+\floatdesign
+\caption{Float layout with rules}\label{fig:fludf}
+\end{figure}
+\end{verbatim}
+
+ The \pixcom{topfigrule} and \pixcom{botfigrule} are little known \LaTeX{}
+commands; they are not discussed by Lamport~\cite{LAMPORT94}
+but are described by Goossens \emph{et al}~\cite{GOOSSENS94}. They are
+like the \pixcom{footnoterule} command in that they draw a rule, or other
+decoration, below floats at the top of a page (\pixcom{topfigrule}) and
+above floats at the bottom of a page (\pixcom{botfigrule}). Both these
+commands have been defined in the preamble to this document as:
+\begin{verbatim}
+\makeatletter
+\newlength{\figrulesep}
+\setlength{\figrulesep}{0.5\textfloatsep}
+\newcommand{\topfigrule}{\vspace*{-1pt}%
+ \noindent\rule[-\figrulesep]{\columnwidth}{1pt}}
+\newcommand{\botfigrule}{\vspace*{-2pt}%
+ \noindent\rule[\figrulesep]{\columnwidth}{2pt}}
+\makeatother
+\end{verbatim}
+Their effect can be seen throughout the printed result. The typical thickness
+for a \pixcom{rule} is $0.4$pt; the thickness of these rules has been
+exagerated in order to make them more noticeable. The \pixcom{topfigrule}
+is drawn immediately after the top floats before the \pixcom{textfloatsep}
+spacing is applied. Similarly the \pixcom{botfigrule} is drawn after
+the \pixcom{textfloatsep} is applied for the bottom floats. Whatever is
+drawn as a \texttt{...figrule} should take no vertical space, hence the
+use of negative vertical space in their definitions above. Note that the
+rules have been given either positive or negative vertical offsets to ensure
+some space between a float and the rule.
+
+\subsection{Changing the float layout in your document}
+
+ The \verb|\...number| commands are changed with the \LaTeX{}
+\pixcom{setcounter} command, while the \verb|\...fraction| commands
+have to be changed via the \pixcom{renewcommand}. For example, the preamble
+to this document contains the following (enclosed within
+\pixcom{makeatletter} and \pixcom{makeatother} commands):
+\begin{verbatim}
+\setcounter{topnumber}{2}
+\setcounter{bottomnumber}{2}
+\setcounter{totalnumber}{4}
+\renewcommand{\topfraction}{0.9}
+\renewcommand{\bottomfraction}{0.6}
+\renewcommand{\textfraction}{0.1}
+\end{verbatim}
+
+ Note that there are also the commands:
+\begin{itemize}
+\item \pixcom{dbltopnumber} for setting the maximum number of two-column
+ floats at the top of a two-column page (typically 2);
+\item \pixcom{dbltopfraction} for setting the maximum fraction of a
+ two column page that can be occupied by the top two-column floats
+ (typically 0.7); and
+\item \pixcom{dblfloatpagefraction} for setting the minimum fraction of
+ a page that has to be occupied by two-column floats before a `float
+ only' page is produced (typically 0.5).
+\end{itemize}
+
+ The \verb|\...sep| commands are changed using the \pixcom{setlength}
+command. The separation values should have a little bit of give in them,
+that is, they should be rubber lengths.
+A typical set of values might be specified as:
+\begin{verbatim}
+\setlength{\floatsep}{12pt plus 2pt minus 2pt}
+\setlength{\textfloatsep}{20pt plus 2pt minus 4pt}
+\setlength{\intextsep}{\floatsep}
+\end{verbatim}
+There are corresponding separation commands for two-column floats at the
+top or bottom of a page. These are \pixcom{dblfloatsep} for inter-float
+separation and \pixcom{dbltextfloatsep} for spacing between a two-column
+float and the text area.
+
+
+
+\floatvalues
+
+ The \pixcom{floatvalues} command can be used to produce a table,
+as shown here, of the values of the current document's float layout
+parameters (as set at the time that the command is used).
+
+
+%%%%%%
+\clearpage
+\section{List layout}
+\suppressfloats[t]
+
+ The commands \pixcom{listdiagram} and \pixcom{listdesign}
+(or \pixcom{drawlist}), as their names suggest, display the layout
+of list\ixenv{list} environments.
+The list parameters are shown in \fref{fig:lstp},
+which was produced by the following code:
+\begin{verbatim}
+\begin{figure}
+\listdiagram
+\caption{List parameters} \label{fig:lstp}
+\end{figure}
+\end{verbatim}
+
+ The list layout may be controlled by the \verb|\listaspara|\TF{} commands.
+Use \pixcom{listasparatrue} for displaying the list when it is being
+treated as a paragraph,
+otherwise use \pixcom{listasparafalse}. The default is \pixcom{listasparatrue}.
+
+\begin{figure}
+%\drawlist
+\listdiagram
+\caption{List parameters} \label{fig:lstp}
+\end{figure}
+
+ The command \pixcom{currentlist} extracts the list parameters from the
+current environment for display via \pixcom{drawlist}. Figure~\ref{fig:lstenum}
+graphically illustrates the layout for an \pixenv{enumerate}
+ type list.
+The figure was generated by the following code:
+\begin{verbatim}
+\begin{enumerate}
+\item Figure~\ref{fig:lstenum} illustrates the layout of an
+ \texttt{enumerate} list.
+ \currentlist
+ \begin{figure}
+ \listdesign
+ \caption{Layout of an \texttt{enumerate} list} \label{fig:lstenum}
+ \end{figure}
+\end{enumerate}
+\end{verbatim}
+
+\begin{enumerate}
+\item Figure~\ref{fig:lstenum} illustrates the layout of an
+ \texttt{enumerate} list.
+ \currentlist
+ \begin{figure}
+% \drawparametersfalse \drawlist
+ \listdesign
+ \caption{Layout of an \texttt{enumerate} list} \label{fig:lstenum}
+ \end{figure}
+\end{enumerate}
+ Note that \pixcom{currentlist} was called within the list environment in
+order to pick up the desired parameter values.
+
+ Table~\ref{tab:tlist} gives a listing of the commands that are provided
+for experimenting with the list layout parameters. Each of these commands
+takes a length as its argument.
+
+\begin{table}
+\centering
+\caption{Commands for setting trial list parameters} \label{tab:tlist}
+\begin{tabular}{|l|l|} \hline
+Command & Parameter \\ \hline
+\pixcom{tryitemindent} & sets the \pixcom{itemindent} value \\
+\pixcom{trylabelwidth} & sets the \pixcom{labelwidth} value \\
+\pixcom{trylabelsep} & sets the \pixcom{labelsep} value \\
+\pixcom{tryleftmargin} & sets the \pixcom{leftmargin} value \\
+\pixcom{tryrightmargin} & sets the \pixcom{rightmargin} value \\
+\pixcom{trylistparindent} & sets the \pixcom{listparindent} value \\
+\pixcom{trytopsep} & sets the \pixcom{topsep} value \\
+\pixcom{tryparskip} & sets the \pixcom{parskip} value \\
+\pixcom{trypartopsep} & sets the \pixcom{partopsep} value \\
+\pixcom{tryparsep} & sets the \pixcom{parsep} value \\
+\pixcom{tryitemsep} & sets the \pixcom{itemsep} value \\
+\hline
+\end{tabular}
+\end{table}
+
+\newenvironment{listX}%
+ {\begin{list}{item}%
+ {\setlength{\itemindent}{-30pt}%
+ \setlength{\labelwidth}{80pt}%
+ \setlength{\labelsep}{1em}%
+ \setlength{\leftmargin}{170pt}%
+ \setlength{\rightmargin}{-40pt}%
+ \setlength{\listparindent}{80pt}%
+ \setlength{\topsep}{3ex}%
+ \setlength{\partopsep}{\topsep}%
+ \setlength{\parsep}{\topsep}%
+ \setlength{\itemsep}{\topsep}%
+ }%
+ }%
+ {\end{list}}
+
+ Figure~\ref{fig:lstudf} shows the layout of a user-defined list.
+An example of the list as it would appear in a document is shown by the
+list that follows this paragraph.
+
+\begin{listX}
+\item[ListX, first item:] This is an example of a user-defined list.
+The appearance is somewhat different from that normally seen in \LaTeX{}
+lists. Note that the text extends into the normal right-hand margin.
+Also, the body of the list text is indented from the label.
+
+ No claim is made that there is anything aesthetic about the design
+of the list. In fact, I think that it is pretty awful. It is merely
+provided as an example of a non-standard list and so that the
+\pixcom{drawlist} command can be shown off.
+
+\item[ListX, second item:] Now we will draw the layout of this list from
+within itself (see \fref{fig:lstudf} for the result). The code used is:
+\begin{verbatim}
+\currentlist
+\begin{figure}
+\drawdimensionstrue
+\listdesign
+\caption{The layout of the \texttt{listX} environment}
+\label{fig:lstudf}
+\end{figure}
+\end{verbatim}
+
+\currentlist
+\begin{figure}
+\drawdimensionstrue
+%\drawparametersfalse \drawlist
+\listdesign
+\caption{The layout of the \texttt{listX} environment}
+\label{fig:lstudf}
+\end{figure}
+
+\item[ListX, third item:] The definition of this list environment is:
+\begin{verbatim}
+\newenvironment{listX}%
+ {\begin{list}{item}%
+ {\setlength{\itemindent}{-30pt}%
+ \setlength{\labelwidth}{80pt}%
+ \setlength{\labelsep}{1em}%
+ \setlength{\leftmargin}{170pt}%
+ \setlength{\rightmargin}{-40pt}%
+ \setlength{\listparindent}{80pt}%
+ \setlength{\topsep}{3ex}%
+ \setlength{\partopsep}{\topsep}%
+ \setlength{\parsep}{\topsep}%
+ \setlength{\itemsep}{\topsep}%
+ }%
+ }%
+ {\end{list}}
+\end{verbatim}
+\end{listX}
+
+ In \LaTeX{} many display environments, such as the \pixenv{quotation}
+environment,
+are defined in terms of the generic \pixenv{list} environment, so
+the settings for these may also be explored with \pixcom{currentlist}.
+ For example, the following code shows how to determine the `list'
+settings for the \pixenv{thebibliography}
+environment (with apologies to Leslie Lamport).
+\begin{verbatim}
+\begin{thebibliography}{Dillo 83}
+\bibitem[Knud 66]{kn:gnus} D. E. Knudson. \emph{1996 World Gnus Almanac.}
+\currentlist
+\begin{figure}
+\listdesign
+\caption{Bibliography list}
+\end{figure}
+\end{thebibliography}
+\end{verbatim}
+Running this code is left as an exercise for the reader.
+
+\subsection{Changing lists}
+
+ Many of \LaTeX's environments are defined in terms of lists, most
+noticeably the \pixenv{description}, \pixenv{enumerate} and \pixenv{itemize}
+environments. To change any of LaTeX's predefined list environments
+it is probably best to examine their
+definitions in the appropriate class file (e.g., \pixfile{classes.dtx}) and
+then put your modified definitions into a package file.
+
+\begin{quote}
+\printinunitsof{pc}
+\listvalues
+\end{quote}
+
+ The \pixcom{listvalues} command can be used to produce a table,
+as shown here, of the values of the current document's list layout
+parameters (as set at the time that the command is used).
+This table was produced by:
+\begin{verbatim}
+\begin{quote}
+\printinunitsof{pc}
+\listvalues
+\end{quote}
+\end{verbatim}
+
+
+
+%%%%%%%%%%%%%%%%%%
+\clearpage
+\section{Sectional heading layout}
+\suppressfloats[t]
+
+ In \LaTeX{} a few headings, like \pixcom{part} and \pixcom{chapter}
+are defined using
+special definition code. The majority, though, are defined via the internal
+\LaTeX{} \pixatcom{startsection}
+command. This command takes 6 arguments: \\
+\verb|\@startsection{|\meta{name}\verb|}{|%
+\meta{level}\verb|}{|%
+\meta{indent}\verb|}{|%
+\meta{beforeskip}\verb|}{|%
+\meta{afterskip}\verb|}{|%
+\meta{font style}\verb|}|.
+
+ The commands
+\verb|\headingdiagram{|\meta{font style}\verb|}|\ixcom{headingdiagram} and
+\verb|\headingdesign{|\meta{font style}\verb|}|\ixcom{headingdesign}
+(or \verb|\drawheading{|\meta{font style}\verb|}|\ixcom{drawheading})
+draw a picture of the layout for sectional headings based on the
+\pixatcom{startsection} command. Unlike the other
+drawing commands it takes one parameter, which is the specification
+of the size and/or font of the heading. For example,
+\verb|\drawheading{\large\itshape}|. For \pixcom{headingdiagram} (or
+\pixcom{drawheading} with \pixcom{drawparameterstrue} is
+in effect) the parameter has no effect.
+
+ There are two kinds of headings:
+\begin{enumerate}
+\item Display headings, where the heading is set off from the text body, and
+\item Run-in headings, where the text body starts on the same line as
+the heading.
+\end{enumerate}
+When \pixcom{headingdiagram} is called
+(or \pixcom{drawheading} with \pixcom{drawparameterstrue} in effect)
+ the pair of commands \pixcom{runinheadtrue} and
+\pixcom{runinheadfalse} control whether a run-in head or a display head
+will be illustrated. The default is \pixcom{runinheadfalse}.
+
+%%%%%%%%%%%%%%%%%%%%%%%
+%%\drawdimensionsfalse
+%%%%%%%%%%%%%%%%%%%%%%
+
+ Figures~\ref{fig:hdp} and~\ref{fig:hrp} show the parameters of the two
+kinds of headings. They were produced by the following code:
+\begin{verbatim}
+\begin{figure}
+\setlayoutscale{1}
+\headingdiagram{ }
+\caption{Display heading parameters}\label{fig:hdp}
+\end{figure}
+
+\begin{figure}
+\setlayoutscale{1}
+\runinheadtrue
+\headingdiagram{ }
+\caption{Run-in heading parameters}\label{fig:hrp}
+\end{figure}
+\end{verbatim}
+
+\begin{figure}
+\setlayoutscale{1}
+%\drawheading{ }
+\headingdiagram{ }
+\caption{Display heading parameters}\label{fig:hdp}
+\end{figure}
+
+\begin{figure}
+\setlayoutscale{1}
+\runinheadtrue
+%\drawheading{ }
+\headingdiagram{ }
+\caption{Run-in heading parameters}\label{fig:hrp}
+\end{figure}
+
+
+ The command \pixcom{currentheading} sets up default parameter values for
+the illustration of a heading. These values are based on guesstimates
+of the values of the arguments of the \pixatcom{startsection}
+command. The commands given in \tref{tab:thead}
+can be used to explicitly set heading parameters. Each of these commands
+takes a length for its parameter value.
+
+\begin{table}
+\centering
+\caption{Commands for setting trial heading parameters}\label{tab:thead}
+\begin{tabular}{|l|l|} \hline
+Command & Parameter \\ \hline
+\pixcom{trybeforeskip} & sets the \textit{beforeskip} value \\
+\pixcom{tryafterskip} & sets the \textit{afterskip} value \\
+\pixcom{tryindent} & sets the \textit{indent} value \\
+\hline
+\end{tabular}
+\end{table}
+
+ The regular reader of \LaTeX{} documents will have noticed that the
+\pixcom{subsubsection} headings in this manual do not conform to the
+usual \LaTeX{} style. In fact, the preamble to this document contains
+the following definition:
+\begin{verbatim}
+\makeatletter
+\renewcommand{\subsubsection}{\@startsection%
+ {subsubsection}% name
+ {3}% level
+ {0mm}% indent
+ {-\baselineskip}% beforeskip
+ {0.5\baselineskip}% afterskip
+ {\large\itshape}}% style
+\makeatother
+\end{verbatim}
+Note that the \pixcom{makeatletter} and \pixcom{makeatother} commands
+are required because of the use of the \tat{} character in the
+name of the \pixatcom{startsection} command.
+
+%%%%%%%%%%%%%%%%%%%%%%%%
+%%\drawdimensionsfalse
+%%%%%%%%%%%%%%%%%%%%%%%
+\currentheading
+\trybeforeskip{-\baselineskip}
+\tryafterskip{0.5\baselineskip}
+\tryindent{0mm}
+\begin{figure}
+\setlayoutscale{1}
+%\drawparametersfalse \drawheading{\large\itshape}
+\headingdesign{\large\itshape}
+\caption{Subsubsection heading layout parameters for this document}
+\label{fig:hdudf}
+\end{figure}
+
+ Figure~\ref{fig:hdudf} illustrates the layout for this heading, and was
+produced by the code below.
+\begin{verbatim}
+\currentheading
+\trybeforeskip{-\baselineskip}
+\tryafterskip{0.5\baselineskip}
+\tryindent{0mm}
+\begin{figure}
+\setlayoutscale{1}
+\headingdesign{\large\itshape}
+\caption{Subsubsection layout parameters for this document}
+\label{fig:hdudf}
+\end{figure}
+\end{verbatim}
+
+\currentheading
+\trybeforeskip{-\baselineskip}
+\tryafterskip{-0.5\baselineskip}
+\tryindent{0mm}
+\begin{figure}
+\setlayoutscale{1}
+%\drawparametersfalse \drawheading{\large\itshape}
+\headingdesign{\large\itshape}
+\caption{Subsubsection layout parameters for a run-in heading}
+\label{fig:hrudf}
+\end{figure}
+
+ The same heading, but specified as a run-in heading by making the
+value of \textit{afterskip} negative rather than positive, is illustrated
+in \fref{fig:hrudf}.
+
+
+
+%%%%%%%%%%%%%%%%
+\clearpage
+\section{Footnote layout}
+\suppressfloats[t]
+
+ Footnote layouts are produced by the commands
+\pixcom{footnotediagram} and \pixcom{footnotedesign}
+(or \pixcom{drawfootnote}).
+The relevant footnote parameters are shown in \fref{fig:fp}, which was
+produced by the following code:
+\begin{verbatim}
+\begin{figure}
+\setlayoutscale{0.4}
+\setlabelfont{\huge\itshape}
+\footnotediagram
+\caption{The footnote parameter layout} \label{fig:fp}
+\end{figure}
+\end{verbatim}
+Note the use of \pixcom{setlabelfont} to change the font used for labelling
+(the `MAIN TEXT' in this case).
+
+\begin{figure}
+\setlayoutscale{0.4}
+\setlabelfont{\huge\itshape}
+%\drawfootnote
+\footnotediagram
+\caption{The footnote parameter layout} \label{fig:fp}
+\end{figure}
+
+ Some of the current settings for the footnote parameters are set
+by the \pixcom{currentfootnote} command. Guesstimates are provided
+for the likely value of the \pixcom{baselineskip} that is used within
+a footnote, and also for the dimension of the footnote rule.
+
+ Figure~\ref{fig:ftry} shows the default footnote layout, and was produced
+by the following code:
+\begin{verbatim}
+\begin{figure}
+\currentfootnote
+\setlayoutscale{0.4}
+\footnotedesign
+\caption{The current footnote layout}\label{fig:ftry}
+\end{figure}
+\end{verbatim}
+The resulting picture has all vertical dimensions magnified by a factor
+of 4 with respect to the horizontal dimensions.
+
+\begin{figure}
+\currentfootnote
+\setlayoutscale{0.4}
+%\drawparametersfalse \drawfootnote
+\footnotedesign
+\caption{A footnote layout}\label{fig:ftry}
+\end{figure}
+
+ Commands for individually setting trial values for footnote parameters
+are given in \tref{tab:foot}. Except for \pixcom{tryfootrulefrac}, these all
+take a length as their parameter. The parameter value for
+\pixcom{tryfootrulefrac} is a decimal number representing a fraction of
+the \pixcom{textwidth}. The trial length of the footnote rule is set to
+this fraction of the width of the text block.
+
+\begin{table}
+\centering
+\caption{Commands for setting trial footnote parameter values}\label{tab:foot}
+\begin{tabular}{|l|l|} \hline
+Command & Parameter \\ \hline
+\pixcom{tryfootins} & sets the \pixcom{skip}\pixcom{footins} value (usually 10pt) \\
+\pixcom{tryfootnotesep} & sets the \pixcom{footnotesep} value (usually 7pt) \\
+\pixcom{tryfootnotebaseline} & sets the footnote \pixcom{baselineskip} value \\
+\pixcom{tryfootruleheight} & sets the \pixcom{footnoterule} height value (usually 0.4pt) \\
+\pixcom{tryfootrulefrac} & sets the length of the \pixcom{footnoterule} \\
+\hline
+\end{tabular}
+\end{table}
+
+\begin{figure}
+\currentfootnote
+\tryfootins{10pt}
+\tryfootnotesep{20pt}
+\tryfootnotebaseline{15pt}
+\tryfootruleheight{1pt}
+\tryfootrulefrac{0.8}
+\setlayoutscale{0.4}
+%\drawparametersfalse \drawfootnote
+\footnotedesign
+\caption{A user-specified footnote layout}
+\label{fig:fudf}
+\end{figure}
+
+ Figure~\ref{fig:fudf}, produced from the following code, shows an
+experimental layout for footnotes.
+\begin{verbatim}
+\begin{figure}
+\currentfootnote
+\tryfootins{10pt}
+\tryfootnotesep{20pt}
+\tryfootnotebaseline{15pt}
+\tryfootruleheight{1pt}
+\tryfootrulefrac{0.8}
+\setlayoutscale{0.4}
+\footnotedesign
+\caption{A user-specified footnote layout}
+\label{fig:fudf}
+\end{figure}
+\end{verbatim}
+
+\subsection{Changing the footnote layout}
+
+ The value of \pixcom{footnotesep} is changed via the \pixcom{setlength}
+command. Spacing between the bottom of the text area and the first footnote
+is normally a rubber length. The following is a typical set of values:
+\begin{verbatim}
+\setlength{\footnotesep}{7pt}
+\setlength{\skip\footins}{10pt plus 4pt minus 2pt}
+\end{verbatim}
+
+ For changing other values, see the documented class file
+\pixfile{classes.dtx}.
+
+\footnotevalues
+
+ The \pixcom{footnotevalues} command can be used to produce a table,
+as shown here, of the values of the current document's footnote layout
+parameters (as set at the time that the command is used).
+
+
+
+%%%%%%%%%%%%%%%
+\clearpage
+\section{Table of Contents layout}
+\suppressfloats[t]
+
+ The format of an entry in the Table of Contents (ToC) is usually
+specified by the internal \LaTeX{} \pixatcom{dottedtocline} command: \\
+\verb|\@dottedtocline{|%
+\meta{level}\verb|}{|%
+\meta{indent}\verb|}{|%
+\meta{numwidth}\verb|}| \\
+where \meta{indent} and \meta{numwidth} relate to the formatting, and an
+entry will be typeset only if \meta{level} is less than or equal to the
+value of the \pixcount{tocdepth} counter.
+
+ The \pixcom{tocdiagram} and \pixcom{tocdesign} (or \pixcom{drawtoc})
+ commands are used for visualizing the layout of
+section titles in a \textit{Table of Contents} listing based on the
+\verb|\@dottedtocline| command, as shown in
+\fref{fig:tocp}. This was produced by the following code:
+\begin{verbatim}
+\begin{figure}
+\setlayoutscale{0.8}
+\tocdiagram
+\caption{Table of Contents entry parameters}\label{fig:tocp}
+\end{figure}
+\end{verbatim}
+
+\begin{figure}
+\setlayoutscale{0.8}
+%\drawtoc
+\tocdiagram
+\caption{Table of Contents entry parameters}\label{fig:tocp}
+\end{figure}
+
+\begin{figure}
+\setlayoutscale{0.8}
+\currenttoc
+%\drawparametersfalse \drawtoc
+\tocdesign
+\caption{Typical Table of Contents entry for this document} \label{fig:thistoc}
+\end{figure}
+
+ Figure~\ref{fig:thistoc} was produced by the following
+code:\footnote{The drawing of the dotted leader is not completely accurate
+due to scaling and rounding within the drawing algorithm.}
+\begin{verbatim}
+\begin{figure}
+\setlayoutscale{0.8}
+\currenttoc
+\tocdesign
+\caption{Typical Table of Contents entry for this document} \label{fig:thistoc}
+\end{figure}
+\end{verbatim}
+
+
+ The command \pixcom{currenttoc} sets values for the ToC parameters based
+on those for the current document. The paramaters can all be individually
+adjusted via the commands listed in \tref{tab:toc}. These commands all
+require a length as their parameter, except for the \pixcom{trytocdotsep}
+command which takes a number (integer or decimal) as its parameter value.
+This sets the trial value for the separation between dots in the leader
+between the sectional title and the page number. The parameter is the
+separation value in \emph{mu} (math units).\footnote{There are \emph{18mu}
+units to \emph{1em} unit.}
+
+\begin{table}
+\centering
+\caption{Commands for setting trial values for ToC parameters}\label{tab:toc}
+\begin{tabular}{|l|l|} \hline
+Command & Parameter \\ \hline
+\pixcom{trytocindent} & sets the \textit{indent} value \\
+\pixcom{trytocnumwidth} & sets the \textit{numwidth} value \\
+\pixcom{trytoclinewidth} & sets the \pixcom{linewidth} value \\
+\pixcom{trytocrmarg} & sets the \pixatcom{tocrmarg} value \\
+\pixcom{trytocpnumwidth} & sets the \pixatcom{pnumwidth} value \\
+\pixcom{trytocdotsep} & sets the \pixatcom{dotsep} value \\
+\hline
+\end{tabular}
+\end{table}
+
+\begin{figure}
+\setlayoutscale{0.8}
+\currenttoc
+\trytocdotsep{1000}
+%\drawparametersfalse \drawtoc
+\tocdesign
+\caption{Table of Contents entry with a large value for \texttt{\bs @dotsep}}
+\label{fig:tocudf}
+\end{figure}
+
+ Figure~\ref{fig:tocudf}, which was produced by the following code,
+shows that the effect of having a large value for \pixatcom{dotsep} is to
+eliminate the dotted leader line between the title text and the page number.
+\begin{verbatim}
+\begin{figure}
+\setlayoutscale{0.8}
+\currenttoc
+\trytocdotsep{1000}
+\tocdesign
+\caption{Table of Contents entry with a large value for \texttt{\bs @dotsep}}
+\label{fig:tocudf}
+\end{figure}
+\end{verbatim}
+
+\subsection{Changing the Table of Contents, etc}
+
+ The methods of specifying the typesetting of the various entries in
+a Table of Contents or a List of Figures (or Tables) varies from one kind
+of entry to another. For details consult
+the documented class specification file \pixfile{classes.dtx}.
+
+ However, the \pixatcom{dotsep}, \pixatcom{pnumwidth} and
+\pixatcom{tocrmarg}
+values can all be set with the \pixcom{renewcommand}. For example, in the
+preamble:
+\begin{verbatim}
+\makeatletter
+\renewcommand{\@dotsep}{4.5}
+\renewcommand{\@pnumwidth}{1.55em}
+\renewcommand{\@tocrmarg}{2.55em}
+\makeatother
+\end{verbatim}
+
+ Typically, for figure and table captions, and for sectioning commands
+that are defined using the \pixatcom{startsection} command,
+table entry typesetting is specified via an \verb|\l@X| command, where
+\verb|X| is \verb|figure|, \verb|table|, \verb|subsection|, etc., as
+appropriate. In turn, these commands call the \pixatcom{dottedtocline}
+command. For example, to change the typesetting for a paragraph entry
+in the Table of Contents, and for a table caption you should do something
+like (changing the lengths as appropriate):
+\begin{verbatim}
+\makeatletter
+\renewcommand*{\l@paragraph}{\@dottedtocline{4}{7em}{4em}}
+\renewcommand*{\l@table}{\@dottedtocline{1}{0em}{3.0em}}
+\makeatother
+\end{verbatim}
+
+
+\tocvalues
+
+ The \pixcom{tocvalues} command can be used to produce a table,
+as shown here, of the values of the current document's Table of Contents layout
+parameters (as set at the time that the command is used).
+
+\clearpage
+\section{Font boxing}
+
+\setlength{\unitlength}{1pt}
+
+ Sometimes it is useful to see the size of the box enclosing some text.
+Two commands are provided for this purpose.
+
+ The \verb|\drawfontframe{|\meta{text}\verb|}|\ixcom{drawfontframe}
+ produces a drawing of
+\meta{text} together with its surrounding box drawn. A bullet is placed
+at the position of the reference point and a horizontal dotted line is drawn
+along the baseline. The command can be used in normal mode
+or can
+be \verb|\put| in a picture environment.
+\drawfontframe{\Huge\textbf{g}}
+The framed g was produced by the following code:
+\begin{verbatim}
+\drawfontframe{\Huge\textbf{g}}
+\end{verbatim}
+The command places the box inside a \texttt{picture} environment that is just
+big enough to enclose the box.
+
+ Sometimes it is useful to see the size of the box enclosing some text.
+Two commands are provided for this purpose.
+
+
+
+
+
+ The \verb|\drawfontframelabel{|\meta{text}\verb|}|\ixcom{drawfontframelabel}
+ is similar, except
+that it labels the reference point, and the width height and depth of the
+box. The box is placed inside a picture environment that is just big enough
+to enclose the box. This means that the labels extend beyond the
+\texttt{picture}. If \verb|\printparameterstrue| is set before issuing the
+command, the actual values for the width, height and depth of the box
+are printed in a \texttt{center} environment following the drawing.
+
+ Here is a simple example created by \verb|\drawfontframelabel{\Huge Q}|
+with \verb|\printparametersfalse|.
+\begin{center}
+\printparametersfalse%
+\drawfontframelabel{\Huge Q}
+\end{center}
+
+ This time with \verb|\printparameterstrue| and
+\verb|\drawfontframelabel{\Huge\textbf{tangling}}|
+\begin{center}
+\printparameterstrue%
+\drawfontframelabel{\Huge\textbf{tangling}}
+\end{center}
+
+ If either of the \verb|\drawfont...| commands are used inside a
+\texttt{picture} environment, then the \verb|\unitlength| must be set
+to 1pt, as the drawings are meant to be exact size and the commands
+assume that all
+drawing lengths are in terms of pts.
+
+ Internally, the commands typeset their argument inside a `save box' called
+\verb|\layoutsbox|\ixsbox{layoutsbox} and then perform the size
+measurements on
+\verb|\layoutsbox|. You can use \verb|\layoutsbox| for your own purposes, but if
+you do so any subsequent use of a \verb|\drawfont...| command will
+overwrite anything that you might have saved in \verb|\layoutsbox|.
+
+
+%%\bibliography{refs,prw}
+\begin{thebibliography}{GMS94}
+
+\bibitem[GMS94]{GOOSSENS94}
+Michel Goossens, Frank Mittelbach, and Alexander Samarin.
+\newblock \emph{The LaTeX Companion}.
+\newblock Addison-Wesley Publishing Company, 1994.
+
+\bibitem[Lam94]{LAMPORT94}
+Leslie Lamport.
+\newblock \emph{LaTeX: A Document Preparation System}.
+\newblock Addison-Wesley Publishing Company, second edition, 1994.
+
+\bibitem[McP88]{MCPHERSON88}
+Kent McPherson.
+\newblock `{Page Layout in LaTeX}'.
+\newblock \emph{TUGboat}, 9(1):78--82, April 1988.
+
+\bibitem[Wil02]{MEMOIR}
+Peter Wilson.
+\newblock \emph{The memoir class for configurable book typesetting}.
+\newblock November, 2002.
+\newblock (Available from CTAN in
+ \texttt{macros/latex/contrib/memoir})
+
+\end{thebibliography}
+
+\clearpage
+%%%%%%%% THE INDEX
+%\input{laymanidx}
+%\end{document}
+
+% laymanidx.tex
+% Generated by GenIndex Version 1.1 from layman.idx
+%
+\begin{theindex}
+
+
+
+\otherindexspace{?}
+% ????
+
+
+\item \texttt {\bs \tat dotsep} \indexfill
+ 44--45
+\item \texttt {\bs \tat dottedtocline} \indexfill
+ 43, 46
+\item \texttt {\bs \tat pnumwidth} \indexfill
+ 44--45
+\item \texttt {\bs \tat startsection} \indexfill
+ 35, 37, 46
+\item \texttt {\bs \tat tocrmarg} \indexfill
+ 44--45
+
+\alphaindexspace{B}
+% BBBB
+
+
+\item \texttt {\bs baselineskip} \indexfill
+ 2, 11, 16, 18, 39--40
+\item \texttt {\bs botfigrule} \indexfill
+ 25, 27
+\item \texttt {\bs bottomfraction} \indexfill
+ 22
+\item \texttt {\bs bottomnumber} \indexfill
+ 22
+
+\alphaindexspace{C}
+% CCCC
+
+
+\item \texttt {center} (environment) \indexfill
+ 4, 13
+\item \texttt {\bs chapter} \indexfill
+ 35
+\item {\textsf {classes.dtx} (file)} \indexfill
+ 34, 42, 45
+\item \texttt {\bs columnsep} \indexfill
+ 11, 16
+\item \texttt {\bs columnseprule} \indexfill
+ 11, 16
+\item \texttt {\bs currentfloat} \indexfill
+ 24
+\item \texttt {\bs currentfloatpage} \indexfill
+ 21
+\item \texttt {\bs currentfootnote} \indexfill
+ 39
+\item \texttt {\bs currentheading} \indexfill
+ 35
+\item \texttt {\bs currentlist} \indexfill
+ 29, 34
+\item \texttt {\bs currentpage} \indexfill
+ 9, 14
+\item \texttt {\bs currentparagraph} \indexfill
+ 18
+\item \texttt {\bs currentstock} \indexfill
+ 14
+\item \texttt {\bs currenttoc} \indexfill
+ 44
+
+\alphaindexspace{D}
+% DDDD
+
+
+\item \texttt {\bs dblfloatpagefraction} \indexfill
+ 28
+\item \texttt {\bs dblfloatsep} \indexfill
+ 28
+\item \texttt {\bs dbltextfloatsep} \indexfill
+ 28
+\item \texttt {\bs dbltopfraction} \indexfill
+ 28
+\item \texttt {\bs dbltopnumber} \indexfill
+ 28
+\item \texttt {description} (environment) \indexfill
+ 34
+\item \texttt {\bs drawaspread} \indexfill
+ 4, 6
+\item \texttt {\bs drawdimensionsfalse} \indexfill
+ 3
+\item \texttt {\bs drawdimensionstrue} \indexfill
+ 3, 11
+\item \texttt {\bs drawfloat} \indexfill
+ 24
+\item \texttt {\bs drawfloatpage} \indexfill
+ 21
+\item \texttt {\bs drawfontframe} \indexfill
+ 47
+\item \texttt {\bs drawfontframelabel} \indexfill
+ 47
+\item \texttt {\bs drawfootnote} \indexfill
+ 39
+\item \texttt {\bs drawheading} \indexfill
+ 35
+\item \texttt {\bs drawlist} \indexfill
+ 29, 32
+\item \texttt {\bs drawmarginparsfalse} \indexfill
+ 7
+\item \texttt {\bs drawmarginparstrue} \indexfill
+ 7
+\item \texttt {\bs drawpage} \indexfill
+ 7
+\item \texttt {\bs drawparagraph} \indexfill
+ 18
+\item \texttt {\bs drawparametersfalse} \indexfill
+ 2--3
+\item \texttt {\bs drawparameterstrue} \indexfill
+ 2, 35
+\item \texttt {\bs drawstock} \indexfill
+ 14
+\item \texttt {\bs drawtoc} \indexfill
+ 43
+
+\alphaindexspace{E}
+% EEEE
+
+
+\item \texttt {enumerate} (environment) \indexfill
+ 29, 34
+\item \texttt {\bs evensidemargin} \indexfill
+ 11
+
+\alphaindexspace{F}
+% FFFF
+
+
+\item \texttt {figure} (environment) \indexfill
+ 4, 21
+\item \texttt {\bs floatdesign} \indexfill
+ 24
+\item \texttt {\bs floatdiagram} \indexfill
+ 24
+\item \texttt {\bs floatpagedesign} \indexfill
+ 21
+\item \texttt {\bs floatpagediagram} \indexfill
+ 21
+\item \texttt {\bs floatsep} \indexfill
+ 25
+\item \texttt {\bs floatvalues} \indexfill
+ 28
+\item \texttt {\bs footins} \indexfill
+ 40
+\item \texttt {\bs footnotedesign} \indexfill
+ 39
+\item \texttt {\bs footnotediagram} \indexfill
+ 39
+\item \texttt {\bs footnoterule} \indexfill
+ 27, 40
+\item \texttt {\bs footnotesep} \indexfill
+ 40--41
+\item \texttt {\bs footnotesize} \indexfill
+ 1
+\item \texttt {\bs footnotevalues} \indexfill
+ 42
+\item \texttt {\bs footskip} \indexfill
+ 9, 11, 16
+
+\alphaindexspace{H}
+% HHHH
+
+
+\item \texttt {\bs headheight} \indexfill
+ 11, 16
+\item \texttt {\bs headingdesign} \indexfill
+ 35
+\item \texttt {\bs headingdiagram} \indexfill
+ 35
+\item \texttt {\bs headsep} \indexfill
+ 11, 16
+\item \texttt {\bs hoffset} \indexfill
+ 11
+
+\alphaindexspace{I}
+% IIII
+
+
+\item \texttt {\bs intextsep} \indexfill
+ 25
+\item \texttt {\bs itemindent} \indexfill
+ 31
+\item \texttt {itemize} (environment) \indexfill
+ 34
+\item \texttt {\bs itemsep} \indexfill
+ 31
+
+\alphaindexspace{L}
+% LLLL
+
+
+\item \texttt {\bs labelsep} \indexfill
+ 31
+\item \texttt {\bs labelwidth} \indexfill
+ 31
+\item {\textsf {layout.sty} (file)} \indexfill
+ 1
+\item \texttt {layoutsbox} (save box) \indexfill
+ 47
+\item \texttt {\bs leftmargin} \indexfill
+ 31
+\item \texttt {\bs linewidth} \indexfill
+ 18, 44
+\item \texttt {list} (environment) \indexfill
+ 29, 34
+\item \texttt {\bs listasparafalse} \indexfill
+ 29
+\item \texttt {\bs listasparatrue} \indexfill
+ 29
+\item \texttt {\bs listdesign} \indexfill
+ 29
+\item \texttt {\bs listdiagram} \indexfill
+ 29
+\item \texttt {\bs listparindent} \indexfill
+ 31
+\item \texttt {\bs listvalues} \indexfill
+ 34
+
+\alphaindexspace{M}
+% MMMM
+
+
+\item \texttt {\bs makeatletter} \indexfill
+ 13, 27, 37
+\item \texttt {\bs makeatother} \indexfill
+ 13, 27, 37
+\item \texttt {\bs marginparpush} \indexfill
+ 11, 16
+\item \texttt {\bs marginparsep} \indexfill
+ 11, 16
+\item \texttt {\bs marginparswitchfalse} \indexfill
+ 7
+\item \texttt {\bs marginparswitchtrue} \indexfill
+ 7
+\item \texttt {\bs marginparwidth} \indexfill
+ 11, 16
+
+\alphaindexspace{N}
+% NNNN
+
+
+\item \texttt {\bs normalmarginpar} \indexfill
+ 7
+
+\alphaindexspace{O}
+% OOOO
+
+
+\item \texttt {\bs oddpagelayoutfalse} \indexfill
+ 7
+\item \texttt {\bs oddpagelayouttrue} \indexfill
+ 7
+\item \texttt {\bs oddsidemargin} \indexfill
+ 11
+
+\alphaindexspace{P}
+% PPPP
+
+
+\item \texttt {\bs pagedesign} \indexfill
+ 7
+\item \texttt {\bs pagediagram} \indexfill
+ 7
+\item \texttt {\bs pagevalues} \indexfill
+ 13
+\item \texttt {\bs paperheight} \indexfill
+ 9, 11, 16
+\item \texttt {\bs paperwidth} \indexfill
+ 9, 11, 16
+\item \texttt {\bs paragraphdesign} \indexfill
+ 18
+\item \texttt {\bs paragraphdiagram} \indexfill
+ 18
+\item \texttt {\bs paragraphvalues} \indexfill
+ 20
+\item \texttt {\bs parindent} \indexfill
+ 18, 20
+\item \texttt {\bs parsep} \indexfill
+ 31
+\item \texttt {\bs parskip} \indexfill
+ 2, 18, 31
+\item \texttt {\bs part} \indexfill
+ 35
+\item \texttt {\bs partopsep} \indexfill
+ 31
+\item \texttt {picture} (environment) \indexfill
+ 4
+\item \texttt {\bs printheadingsfalse} \indexfill
+ 1, 3, 11
+\item \texttt {\bs printheadingstrue} \indexfill
+ 1, 3
+\item \texttt {\bs printinunitsof} \indexfill
+ 3, 20
+\item \texttt {\bs printparametersfalse} \indexfill
+ 3
+\item \texttt {\bs printparameterstrue} \indexfill
+ 3
+\item \texttt {\bs prntlen} \indexfill
+ 3
+
+\alphaindexspace{Q}
+% QQQQ
+
+
+\item \texttt {quotation} (environment) \indexfill
+ 34
+
+\alphaindexspace{R}
+% RRRR
+
+
+\item \texttt {\bs renewcommand} \indexfill
+ 27, 45
+\item \texttt {\bs reversemarginpar} \indexfill
+ 7
+\item \texttt {\bs reversemarginparfalse} \indexfill
+ 7
+\item \texttt {\bs reversemarginpartrue} \indexfill
+ 7
+\item \texttt {\bs rightmargin} \indexfill
+ 31
+\item \texttt {\bs rule} \indexfill
+ 27
+\item \texttt {\bs runinheadfalse} \indexfill
+ 35
+\item \texttt {\bs runinheadtrue} \indexfill
+ 35
+
+\alphaindexspace{S}
+% SSSS
+
+
+\item \texttt {\bs setcounter} \indexfill
+ 27
+\item \texttt {\bs setfootbox} \indexfill
+ 9, 14
+\item \texttt {\bs setlabelfont} \indexfill
+ 3, 39
+\item \texttt {\bs setlayoutscale} \indexfill
+ 2, 4, 6
+\item \texttt {\bs setlength} \indexfill
+ 13, 28, 41
+\item \texttt {\bs setparameterstextsize} \indexfill
+ 3
+\item \texttt {\bs setuplayouts} \indexfill
+ 2, 4
+\item \texttt {\bs setvaluestextsize} \indexfill
+ 1
+\item \texttt {\bs skip} \indexfill
+ 40
+\item \texttt {\bs spacefactor} \indexfill
+ 13
+\item \texttt {\bs spinemargin} \indexfill
+ 16
+\item \texttt {\bs stockdesign} \indexfill
+ 14
+\item \texttt {\bs stockdiagram} \indexfill
+ 14
+\item \texttt {\bs stockheight} \indexfill
+ 16
+\item \texttt {\bs stockvalues} \indexfill
+ 16
+\item \texttt {\bs stockwidth} \indexfill
+ 16
+\item \texttt {\bs subsubsection} \indexfill
+ 37
+
+\alphaindexspace{T}
+% TTTT
+
+
+\item \texttt {table} (environment) \indexfill
+ 21
+\item \texttt {tabular} (environment) \indexfill
+ 4
+\item \texttt {\bs textfloatsep} \indexfill
+ 25, 27
+\item \texttt {\bs textfraction} \indexfill
+ 22
+\item \texttt {\bs textheight} \indexfill
+ 11, 16
+\item \texttt {\bs textwidth} \indexfill
+ 11, 16, 40
+\item \texttt {thebibliography} (environment) \indexfill
+ 34
+\item \texttt {tocdepth} (counter) \indexfill
+ 43
+\item \texttt {\bs tocdesign} \indexfill
+ 43
+\item \texttt {\bs tocdiagram} \indexfill
+ 43
+\item \texttt {\bs tocvalues} \indexfill
+ 46
+\item \texttt {\bs topfigrule} \indexfill
+ 25, 27
+\item \texttt {\bs topfraction} \indexfill
+ 22
+\item \texttt {\bs topmargin} \indexfill
+ 11
+\item \texttt {\bs topnumber} \indexfill
+ 22
+\item \texttt {\bs topsep} \indexfill
+ 31
+\item \texttt {\bs totalnumber} \indexfill
+ 22
+\item \texttt {\bs trimedge} \indexfill
+ 16
+\item \texttt {\bs trimtop} \indexfill
+ 16
+\item \texttt {\bs tryafterskip} \indexfill
+ 36
+\item \texttt {\bs trybeforeskip} \indexfill
+ 36
+\item \texttt {\bs trybotfigrule} \indexfill
+ 25
+\item \texttt {\bs trybottomfraction} \indexfill
+ 22
+\item \texttt {\bs trybottomnumber} \indexfill
+ 22
+\item \texttt {\bs trycolumnsep} \indexfill
+ 11, 16
+\item \texttt {\bs trycolumnseprule} \indexfill
+ 11, 16
+\item \texttt {\bs tryevensidemargin} \indexfill
+ 11
+\item \texttt {\bs tryfloatsep} \indexfill
+ 25
+\item \texttt {\bs tryfootins} \indexfill
+ 40
+\item \texttt {\bs tryfootnotebaseline} \indexfill
+ 40
+\item \texttt {\bs tryfootnotesep} \indexfill
+ 40
+\item \texttt {\bs tryfootrulefrac} \indexfill
+ 40
+\item \texttt {\bs tryfootruleheight} \indexfill
+ 40
+\item \texttt {\bs tryfootskip} \indexfill
+ 11, 16
+\item \texttt {\bs tryheadheight} \indexfill
+ 11, 16
+\item \texttt {\bs tryheadsep} \indexfill
+ 11, 16
+\item \texttt {\bs tryhoffset} \indexfill
+ 11
+\item \texttt {\bs tryindent} \indexfill
+ 36
+\item \texttt {\bs tryintextsep} \indexfill
+ 25
+\item \texttt {\bs tryitemindent} \indexfill
+ 31
+\item \texttt {\bs tryitemsep} \indexfill
+ 31
+\item \texttt {\bs trylabelsep} \indexfill
+ 31
+\item \texttt {\bs trylabelwidth} \indexfill
+ 31
+\item \texttt {\bs tryleftmargin} \indexfill
+ 31
+\item \texttt {\bs trylistparindent} \indexfill
+ 31
+\item \texttt {\bs trymarginparpush} \indexfill
+ 11, 16
+\item \texttt {\bs trymarginparsep} \indexfill
+ 11, 16
+\item \texttt {\bs trymarginparwidth} \indexfill
+ 11, 16
+\item \texttt {\bs tryoddsidemargin} \indexfill
+ 11
+\item \texttt {\bs trypaperheight} \indexfill
+ 11, 16
+\item \texttt {\bs trypaperwidth} \indexfill
+ 11, 16
+\item \texttt {\bs tryparbaselineskip} \indexfill
+ 18
+\item \texttt {\bs tryparindent} \indexfill
+ 18
+\item \texttt {\bs tryparlinewidth} \indexfill
+ 18
+\item \texttt {\bs tryparsep} \indexfill
+ 31
+\item \texttt {\bs tryparskip} \indexfill
+ 18, 31
+\item \texttt {\bs trypartopsep} \indexfill
+ 31
+\item \texttt {\bs tryrightmargin} \indexfill
+ 31
+\item \texttt {\bs tryspinemargin} \indexfill
+ 16
+\item \texttt {\bs trystockheight} \indexfill
+ 16
+\item \texttt {\bs trystockwidth} \indexfill
+ 16
+\item \texttt {\bs trytextfloatsep} \indexfill
+ 25
+\item \texttt {\bs trytextfraction} \indexfill
+ 22
+\item \texttt {\bs trytextheight} \indexfill
+ 11, 16
+\item \texttt {\bs trytextwidth} \indexfill
+ 11, 16
+\item \texttt {\bs trytocdotsep} \indexfill
+ 44
+\item \texttt {\bs trytocindent} \indexfill
+ 44
+\item \texttt {\bs trytoclinewidth} \indexfill
+ 44
+\item \texttt {\bs trytocnumwidth} \indexfill
+ 44
+\item \texttt {\bs trytocpnumwidth} \indexfill
+ 44
+\item \texttt {\bs trytocrmarg} \indexfill
+ 44
+\item \texttt {\bs trytopfigrule} \indexfill
+ 25
+\item \texttt {\bs trytopfraction} \indexfill
+ 22
+\item \texttt {\bs trytopmargin} \indexfill
+ 11
+\item \texttt {\bs trytopnumber} \indexfill
+ 22
+\item \texttt {\bs trytopsep} \indexfill
+ 31
+\item \texttt {\bs trytotalnumber} \indexfill
+ 22
+\item \texttt {\bs trytrimedge} \indexfill
+ 16
+\item \texttt {\bs trytrimtop} \indexfill
+ 16
+\item \texttt {\bs tryuppermargin} \indexfill
+ 16
+\item \texttt {\bs tryvoffset} \indexfill
+ 11
+\item \texttt {\bs twocolumnlayoutfalse} \indexfill
+ 7
+\item \texttt {\bs twocolumnlayouttrue} \indexfill
+ 7
+
+\alphaindexspace{U}
+% UUUU
+
+
+\item \texttt {\bs uppermargin} \indexfill
+ 16
+
+\alphaindexspace{V}
+% VVVV
+
+
+\item \texttt {\bs voffset} \indexfill
+ 11
+
+\end{theindex}
+
+
+\end{document}
+
diff --git a/macros/latex/contrib/layouts/layouts.dtx b/macros/latex/contrib/layouts/layouts.dtx
new file mode 100644
index 0000000000..54b8bdb724
--- /dev/null
+++ b/macros/latex/contrib/layouts/layouts.dtx
@@ -0,0 +1,4841 @@
+% \iffalse meta-comment
+%
+% layouts.dtx
+% Author: Peter Wilson (Herries Press))
+% Maintainer: Will Robertson (will dot robertson at latex-project dot org)
+% Copyright 1998--2004 Peter R. Wilson
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either
+% version 1.3c of this license or (at your option) any
+% later version: <http://www.latex-project.org/lppl.txt>
+%
+% This work has the LPPL maintenance status "maintained".
+% The Current Maintainer of this work is Will Robertson.
+%
+% This work consists of the files listed in the README file.
+%
+%
+%<*driver>
+\documentclass[twoside]{ltxdoc}
+\usepackage{url}
+\makeatletter
+ \@mparswitchfalse
+\makeatother
+\EnableCrossrefs
+\CodelineIndex
+\setcounter{StandardModuleDepth}{1}
+\renewcommand{\MakeUppercase}[1]{#1}
+\pagestyle{headings}
+\begin{document}
+ \raggedbottom
+ \DocInput{layouts.dtx}
+\end{document}
+%</driver>
+%
+% \fi
+%
+% \CheckSum{6212}
+%
+% \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath}
+% \DoNotIndex{\@centercr,\@cite}
+% \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue}
+% \DoNotIndex{\@input,\@ixpt,\@m}
+% \DoNotIndex{\@minus,\@mkboth,\@ne,\@nil,\@nomath,\@plus,\@set@topoint}
+% \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb}
+% \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt}
+% \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt}
+% \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace}
+% \DoNotIndex{\advance,\Alph,\alph}
+% \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box}
+% \DoNotIndex{\bullet}
+% \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption}
+% \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass}
+% \DoNotIndex{% \DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist}
+% \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup}
+% \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter}
+% \DoNotIndex{\fbox}
+% \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef}
+% \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule}
+% \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi}
+% \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi}
+% \DoNotIndex{\input}
+% \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark}
+% \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright}
+% \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment}
+% \DoNotIndex{\NeedsTeXFormat,\newdimen}
+% \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number}
+% \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@}
+% \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip}
+% \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions}
+% \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright}
+% \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font}
+% \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily,\roman}
+% \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength}
+% \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space}
+% \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase}
+% \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt}
+% \DoNotIndex{\viipt,\vipt,\vskip,\vspace}
+% \DoNotIndex{\wd,\xiipt,\year,\z@}
+%
+% \DoNotIndex{\put,\vector,\line,\texttt,\multiply}
+%
+% \def\dtxfile{layouts.dtx}
+% \def\fileversion{v2.3b} \def\filedate{1999/03/06}
+% \def\fileversion{v2.4} \def\filedate{2001/04/30}
+% \def\fileversion{v2.5} \def\filedate{2001/11/11}
+% \def\fileversion{v2.5a} \def\filedate{2002/03/24}
+% \def\fileversion{v2.6} \def\filedate{2002/06/09}
+% \def\fileversion{v2.6a} \def\filedate{2002/12/12}
+% \def\fileversion{v2.6b} \def\filedate{2003/11/25}
+% \def\fileversion{v2.6c} \def\filedate{2004/10/25}
+% \def\fileversion{v2.6d} \def\filedate{2009/09/02}
+% \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package
+% \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option
+% \newcommand*{\file}[1]{\texttt {#1}} ^^A typeset a file
+% \newcommand*{\Lcount}[1]{\textsl {\small#1}} ^^A typeset a counter
+% \newcommand*{\pstyle}[1]{\textsl {#1}} ^^A typeset a pagestyle
+% \newcommand*{\Lenv}[1]{\texttt {#1}} ^^A typeset an environment
+%
+% \title{The \Lpack{layouts} package: Code\thanks{This
+% file (\texttt{\dtxfile}) has version number \fileversion, last revised
+% \filedate.}}
+%
+% \author{
+% Author: Peter Wilson, Herries Press \\
+% Maintainer: Will Robertson \\
+% \texttt{will dot robertson at latex-project dot org}
+% }
+% \date{\filedate}
+% \maketitle
+% \begin{abstract}
+% The \Lpack{layouts} package provides facilities for document designers
+% to experiment with various aspects of the layout of \LaTeX ed documents.
+% There is a separate user manual for the package.
+% \end{abstract}
+% \tableofcontents
+%
+% \StopEventually{}
+%
+%
+%
+% \section{Introduction}
+%
+% This document provides the commented source for a \LaTeX{}
+% package file developed as part of a suite designed for the typesetting of
+% documents according to the rules for ISO international
+% standards~\cite{PRW96i}.
+% A separate document provides the user manual.
+%
+% Section~\ref{sec:lays} describes a package to assist in the
+% design of new \LaTeX{} classes and packages by graphically
+% depicting the layout\footnote{With thanks to Frank Mittelbach
+% for noticing some problems with version 2.4 and suggesting additional
+% features.} 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
+% \LaTeX{} \textsc{docstrip} utility which enables the automatic
+% extraction of the \LaTeX{} macro source files~\cite{GOOSSENS94}.
+%
+%
+%
+% \section{The \Lpack{layouts} package} \label{sec:lays}
+%
+% Announce the name and version of the package which requires \LaTeXe.
+% \changes{v2.1}{1998/10/14}{Changed the Title, the Introduction, and other text}
+% \changes{v2.1}{1998/10/14}{Added requirement for LaTeX2e}
+% \changes{v2.2}{1998/11/14}{Tidied a lot of code}
+% \changes{v2.2}{1998/11/14}{Added drawing of font boxes}
+% \changes{v2.3}{1999/01/21}{Eliminated several new counters}
+% \changes{v2.3}{1999/01/21}{Corrected ToC layout}
+% \changes{v2.3}{1999/01/21}{Added ...values commands}
+% \changes{v2.3a}{1999/01/21}{Tweaked the ToC layout for dotted leader}
+% \changes{v2.3b}{1999/03/06}{Undeleted the l@youtscale command}
+% \changes{v2.4}{2001/04/30}{Added \cs{drawstock} for the memoir class}
+% \changes{v2.4}{2001/04/30}{Added control to switch on/off marginpars}
+% \changes{v2.5}{2001/10/22}{Added several booleans}
+% \changes{v2.5}{2001/11/01}{Added diagram and design macros}
+% \changes{v2.5a}{2002/01/06}{Fixed footheight in page diagrams}
+% \changes{v2.6}{2002/06/09}{Added more bells to page layouts}
+% \changes{v2.6}{2002/06/09}{General tidying of page layouts code}
+% \changes{v2.6a}{2002/12/12}{Cater for negative length in list layout}
+% \changes{v2.6b}{2003/11/25}{Corrected spelling and grammatical errors}
+% \changes{v2.6c}{2004/10/25}{Privatised the \cs{*inch}, etc., macros}
+% \begin{macrocode}
+%<*lays>
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{layouts}[2009/09/02 v2.6d graphical depiction of document elements]
+
+% \end{macrocode}
+%
+% The \Lpack{layouts} package provides means of graphically displaying the layout
+% of various logical elements of a document such as section headings,
+% lists, floats, and others.
+%
+%
+% \section{Counters and such}
+%
+% First we define some commands, counters, etc., that will be useful
+% later on.
+%
+% \begin{macro}{\bs}
+% We will be doing a lot of printing of \LaTeX{} commands, so we
+% need a short command to print a backslash.
+% \changes{v2.4}{2001/04/30}{Better definition for the \cs{bs} command}
+% \begin{macrocode}
+\@ifundefined{bs}{\newcommand{\bs}{\texttt{\char`\\}}}%
+ {\renewcommand{\bs}{\texttt{\char`\\}}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\l@yoneinch}
+% \begin{macro}{\l@yeighthalfinch}
+% \begin{macro}{\l@yteninch}
+% \begin{macro}{\l@yeleveninch}
+% \begin{macro}{\l@yonepoint}
+% \changes{v2.3}{1999/01/21}{Made `useful values' commands not counters}
+% Some generally useful values. |\l@yonepoint| is set to 65536 sp and all
+% the others are set to a value in pts.
+% \begin{macrocode}
+\newcommand{\l@yoneinch}{72}
+\newcommand{\l@yeighthalfinch}{615}
+\newcommand{\l@yteninch}{723}
+\newcommand{\l@yeleveninch}{795}
+\newcommand{\l@yonepoint}{65536}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\l@youtscale}
+% Internal command that stores the drawing scale factor. Initialised
+% to half scale.
+% \begin{macrocode}
+\newcommand{\l@youtscale}{0.5}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\l@ylen}
+% A length.
+% \begin{macrocode}
+\newlength{\l@ylen}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\layoutsbox}
+% A box for storing something. There seems to be no reason why the user
+% should not be able to use this.
+% \begin{macrocode}
+\newsavebox{\layoutsbox}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\l@youtunitlength}
+% This will be used for setting the |\unitlength| for a \Lenv{picture}.
+% \begin{macrocode}
+\newlength{\l@youtunitlength}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\l@youtlinethick}
+% \begin{macro}{\l@youtlinethickii}
+% These will be used as parameters to a |\linethickness| command.
+% \begin{macrocode}
+\newlength{\l@youtlinethick}
+\newlength{\l@youtlinethickii}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\l@ysetupparskip}%
+% \begin{macro}{\l@ysetupbaselineskip}
+% Used for storing the document's |\parskip| and |\baselineskip|.
+% \begin{macrocode}
+\newlength{\l@ysetupparskip}
+\newlength{\l@ysetupbaselineskip}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\l@yonem}
+% \begin{macro}{\l@yonex}
+% Used for storing the document's value for 1em and 1ex.
+% \begin{macrocode}
+\newlength{\l@yonem}
+\newlength{\l@yonex}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\l@ylmarg}
+% \begin{macro}{\l@yrmarg}
+% \begin{macro}{\l@yitmindent}
+% \begin{macro}{\l@ylblwidth}
+% \begin{macro}{\l@ylblsep}
+% \begin{macro}{\l@ylparindent}
+% \begin{macro}{\l@ytsep}
+% \begin{macro}{\l@ypskip}
+% \begin{macro}{\l@yptsep}
+% \begin{macro}{\l@ypsep}
+% \begin{macro}{\l@yitmsep}
+% We need to store a list environment's values for use when tabulating
+% the actual list values.
+% \begin{macrocode}
+\newlength{\l@ylmarg}
+\newlength{\l@yrmarg}
+\newlength{\l@yitmindent}
+\newlength{\l@ylblwidth}
+\newlength{\l@ylblsep}
+\newlength{\l@ylparindent}
+\newlength{\l@ytsep}
+\newlength{\l@ypskip}
+\newlength{\l@yptsep}
+\newlength{\l@ypsep}
+\newlength{\l@yitmsep}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\l@ytok}
+% A useful token
+% \begin{macrocode}
+\newtoks\l@ytok
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\l@youtpw}
+% \begin{macro}{\l@youtph}
+% We use these for storing the page width and height.
+% \begin{macrocode}
+\newcount\l@youtpw
+\newcount\l@youtph
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\l@youthpi}
+% \begin{macro}{\l@youthpii}
+% \begin{macro}{\l@youthpiii}
+% \begin{macro}{\l@youthpiv}
+% \begin{macro}{\l@youthpv}
+% \begin{macro}{\l@youthpvi}
+% \begin{macro}{\l@youthpvii}
+% Counters for horizontal drawing parameters.
+%
+% \begin{macrocode}
+\newcount\l@youthpi
+\newcount\l@youthpii
+\newcount\l@youthpiii
+\newcount\l@youthpiv
+\newcount\l@youthpv
+\newcount\l@youthpvi
+\newcount\l@youthpvii
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\l@youtparskip}
+% \begin{macro}{\l@youtvpi}
+% \begin{macro}{\l@youtvpii}
+% \begin{macro}{\l@youtvpiii}
+% \begin{macro}{\l@youtvpiv}
+% \begin{macro}{\l@youtvpv}
+% \begin{macro}{\l@youtvpvi}
+% \begin{macro}{\l@youtvpvii}
+% Counters for vertical drawing parameters.
+%
+% \begin{macrocode}
+\newcount\l@youtparskip
+\newcount\l@youtvpi
+\newcount\l@youtvpii
+\newcount\l@youtvpiii
+\newcount\l@youtvpiv
+\newcount\l@youtvpv
+\newcount\l@youtvpvi
+\newcount\l@youtvpvii
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\l@youthdo}
+% \begin{macro}{\l@youthdi}
+% \begin{macro}{\l@youthdii}
+% \begin{macro}{\l@youthdiii}
+% \begin{macro}{\l@youthdiv}
+% \begin{macro}{\l@youthdv}
+% \begin{macro}{\l@youthdvi}
+% \begin{macro}{\l@youthdvii}
+% Horizontal dimensions.
+%
+% \begin{macrocode}
+\newcount\l@youthdo
+\newcount\l@youthdi
+\newcount\l@youthdii
+\newcount\l@youthdiii
+\newcount\l@youthdiv
+\newcount\l@youthdv
+\newcount\l@youthdvi
+\newcount\l@youthdvii
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\l@youtvdo}
+% \begin{macro}{\l@youtvdi}
+% \begin{macro}{\l@youtvdii}
+% \begin{macro}{\l@youtvdiii}
+% \begin{macro}{\l@youtvdiv}
+% \begin{macro}{\l@youtvdv}
+% \begin{macro}{\l@youtvdvi}
+% \begin{macro}{\l@youtvdvii}
+% \begin{macro}{\l@youtvdviii}
+% Vertical dimensions.
+% \begin{macrocode}
+\newcount\l@youtvdo
+\newcount\l@youtvdi
+\newcount\l@youtvdii
+\newcount\l@youtvdiii
+\newcount\l@youtvdiv
+\newcount\l@youtvdv
+\newcount\l@youtvdvi
+\newcount\l@youtvdvii
+\newcount\l@youtvdviii
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\l@youtxci}
+% \begin{macro}{\l@youtxcii}
+% \begin{macro}{\l@youtxciii}
+% \begin{macro}{\l@youtxciv}
+% \begin{macro}{\l@youtxcv}
+% \begin{macro}{\l@youtxcvi}
+% X coordinates.
+% \begin{macrocode}
+\newcount\l@youtxci
+\newcount\l@youtxcii
+\newcount\l@youtxciii
+\newcount\l@youtxciv
+\newcount\l@youtxcv
+\newcount\l@youtxcvi
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\l@youtyci}
+% \begin{macro}{\l@youtycii}
+% \begin{macro}{\l@youtyciii}
+% \begin{macro}{\l@youtyciv}
+% \begin{macro}{\l@youtycv}
+% \begin{macro}{\l@youtycvi}
+% \begin{macro}{\l@youtycvii}
+% \begin{macro}{\l@youtycviii}
+% Y coordinates.
+% \begin{macrocode}
+\newcount\l@youtyci
+\newcount\l@youtycii
+\newcount\l@youtyciii
+\newcount\l@youtyciv
+\newcount\l@youtycv
+\newcount\l@youtycvi
+\newcount\l@youtycvii
+\newcount\l@youtycviii
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\l@youtxco}
+% \begin{macro}{\l@youtyco}
+% For the (X,Y) coordinates of the bottom left hand corner of the page.
+% \changes{v2.4}{2001/04/30}{Added \cs{l@youtxco} and \cs{l@youtyco}}
+% \begin{macrocode}
+\newcount\l@youtxco
+\newcount\l@youtyco
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \section{Initialisations}
+%
+% The following are used to set up default conditions.
+%
+% \begin{macro}{\ifoddpagelayout}
+% Set TRUE to draw an oddside page.
+% \begin{macrocode}
+\newif\ifoddpagelayout
+ \oddpagelayouttrue
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\iftwocolumnlayout}
+% Set TRUE to draw a two column page.
+% \begin{macrocode}
+\newif\iftwocolumnlayout
+ \twocolumnlayoutfalse
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ifdrawmarginpars}
+% Set TRUE to draw marginpars on a page.
+% \begin{macrocode}
+\newif\ifdrawmarginpars
+ \drawmarginparstrue
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ifdrawparameters}
+% Set TRUE to draw a layout with marked dimension lines.
+% \begin{macrocode}
+\newif\ifdrawparameters
+ \drawparameterstrue
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\iflistaspara}
+% Set TRUE to draw lists as stand-alone paragraph.
+% \begin{macrocode}
+\newif\iflistaspara
+ \listasparatrue
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ifruninhead}
+% Set TRUE to draw a run-in heading.
+% \begin{macrocode}
+\newif\ifruninhead
+ \runinheadfalse
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ifprintparameters}
+% Set TRUE to print table of actual parameter values
+% \changes{v2.5}{2001/10/22}{Added \cs{ifprintparameters}}
+% \begin{macrocode}
+\newif\ifprintparameters
+ \printparameterstrue
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ifdrawdimensions}
+% Set TRUE to draw dimension lines
+% \changes{v2.5}{2001/10/22}{Added \cs{ifdrawdimensions}}
+% \begin{macrocode}
+\newif\ifdrawdimensions
+ \drawdimensionsfalse
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ifprintheadings}
+% Set TRUE to print text about dashed lines.
+% \changes{v2.5}{2001/10/22}{Added \cs{ifprintheadings}}
+% \begin{macrocode}
+\newif\ifprintheadings
+ \printheadingstrue
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ifl@ytempif}
+% A scratch |\if|.
+% \changes{v2.5}{2001/10/22}{Added \cs{ifl@ytempif}}
+% \begin{macrocode}
+\newif\ifl@ytempif
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\l@yor}
+% |\l@yor{|\meta{ifA}|}{|\meta{ifB}|}| sets |\ifl@ytempif| to TRUE
+% unless \meta{ifA} is FALSE and \meta{ifB} is FALSE (i.e.,
+% |\ifl@tempif| = \meta{ifA} OR \meta{ifB}).
+% \changes{v2.5}{2001/10/22}{Added \cs{l@yor}}
+% \begin{macrocode}
+\newcommand{\l@yor}[2]{%
+ \l@ytempiftrue
+ #1
+ \else
+ #2
+ \else
+ \l@ytempiffalse
+ \fi
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\l@ynnand}
+% |\l@ynnand{|\meta{ifA}|}{|\meta{ifB}|}| sets |\ifl@ytempif| to FALSE
+% unless \meta{ifA} is FALSE and \meta{ifB} is TRUE
+% \changes{v2.5}{2001/10/22}{Added \cs{l@ynnand}}
+% \begin{macrocode}
+\newcommand{\l@ynnand}[2]{%
+ \l@ytempiffalse
+ #1
+ \else
+ #2
+ \l@ytempiftrue
+ \fi
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\l@ynox}
+% |\l@ynox{|\meta{ifA}|}{|\meta{ifB}|}| sets |\ifl@ytempif| to TRUE
+% unless \meta{ifA} is TRUE and \meta{ifB} is FALSE.
+% \changes{v2.5}{2001/10/22}{Added \cs{l@ynox}}
+% \begin{macrocode}
+\newcommand{\l@ynox}[2]{%
+ \l@ytempiftrue
+ #1
+ #2
+ \else
+ \l@ytempiffalse
+ \fi
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\testdrawdimensions}
+% \begin{macro}{\testprintparameters}
+% \changes{v2.5}{2001/10/21}{Added \cs{testdrawdimensions} and
+% \cs{testprintparameters}}
+% \changes{v2.5}{2001/10/21}{Use \cs{testdrawdimensions} for check to
+% draw dimensions in actual layouts}
+% \changes{v2.5}{2001/10/21}{Use \cs{testprintparameters} for check to
+% list parameter values in actual layouts}
+% \begin{macrocode}
+\newcommand{\testdrawdimensions}{%
+ \l@yor{\ifdrawparameters}{\ifdrawdimensions}}
+\newcommand{\testprintparameters}{%
+ \l@ynnand{\ifdrawparameters}{\ifprintparameters}}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\setlabelfont}
+% \begin{macro}{\l@ylabelfont}
+% The font for labels in the diagrams.
+% \changes{v2.5}{2001/10/22}{Added \cs{setlabelfont} and \cs{l@ylabelfont}}
+% \begin{macrocode}
+\newcommand{\setlabelfont}[1]{\renewcommand{\l@ylabelfont}{#1}}
+ \newcommand{\l@ylabelfont}{\normalfont}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\setparametertextfont}
+% \begin{macro}{\l@yparamfont}
+% The font size for parameters.
+% \changes{v2.5}{2001/10/22}{Added \cs{setparametertextfont} and \cs{l@yparamfont}}
+% \begin{macrocode}
+\newcommand{\setparametertextfont}[1]{\renewcommand{\l@yparamfont}{#1}}
+ \newcommand{\l@yparamfont}{\footnotesize}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\setvaluestextsize}
+% \begin{macro}{\l@yvalsize}
+% The font size for value tables.
+% \changes{v2.5}{2001/10/22}{Added \cs{setvaluestextsize} and \cs{l@yvalsize}}
+% \begin{macrocode}
+\newcommand{\setvaluestextsize}[1]{\renewcommand{\l@yvalsize}{#1}}
+ \newcommand{\l@yvalsize}{\normalsize}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\setlayoutscale}
+% A user command to set the drawing scale. The scale is initialised
+% to half size.
+% \changes{v2.5a}{2002/01/06}{Added warning to \cs{setlayoutscale}}
+% \begin{macrocode}
+\newcommand{\setlayoutscale}[1]{\setlength{\l@youtunitlength}{1pt}
+ \l@youtunitlength = #1\l@youtunitlength
+ \renewcommand{\l@youtscale}{#1}
+ \PackageWarning{layouts}{Layout scale set to #1}}
+%%%\setlayoutscale{0.5}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\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.
+% \begin{macrocode}
+\newcommand{\setuplayouts}{%
+ \setlength{\l@ysetupparskip}{\parskip}
+ \setlength{\l@ysetupbaselineskip}{\baselineskip}
+ \setlength{\l@yonem}{1em}
+ \setlength{\l@yonex}{1ex}
+ \setlayoutscale{0.5}
+%%% \PackageWarning{layouts}{Layout scale set to 0.5}
+}
+\AtBeginDocument{\setuplayouts}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Utility commands}
+%
+% A variety of utility commands.
+%
+% \begin{macro}{\l@yltoc}
+% |\l@yltoc{|\meta{length}|}{|\meta{counter}|}| converts a length into a
+% counter value. The counter value is to the nearest
+% pt of the length.
+% \begin{macrocode}
+\newcommand{\l@yltoc}[2]{\setlength{\l@ylen}{#1}%
+ \ifdim\l@ylen > \z@ \advance\l@ylen by 0.5\p@ \else
+ \ifdim\l@ylen < \z@ \advance\l@ylen by -0.5\p@
+ \fi
+ \fi
+ #2=\l@ylen
+ \divide #2 by \l@yonepoint\relax}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\l@yvuda}
+% \begin{macro}{\l@yhrda}
+% |\l@yvuda{|\meta{x}|}{|\meta{y}|}{|\meta{distance}|}| draws a line
+% vertically upwards from (\meta{x},\meta{y}) a \meta{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 |<---->|.
+% \begin{macrocode}
+\newcommand{\l@yvuda}[3]{\put(#1,#2){\vector(0,1){#3}}
+ \put(#1,#2){\vector(0,-1){0}}}
+\newcommand{\l@yhrda}[3]{\put(#1,#2){\vector(1,0){#3}}
+ \put(#1,#2){\vector(-1,0){0}}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\l@yvudia}
+% \begin{macro}{\l@yhrdia}
+% |\l@yvudia{|\meta{x}|}{|\meta{y}|}{|\meta{distance}|}| draws two vertical
+% arrowheads pointing to each other. One is at (\meta{x},\meta{y}) and
+% the other is at (\meta{x},\meta{y + distance}). |\l@yhrdia| is
+% similar except that the arrowheads are horizontal.
+% Simplistically, the commands produce something like |> <|.
+% \begin{macrocode}
+\newcommand{\l@yvudia}[3]{\begingroup
+ \l@youthpvii=#1\relax
+ \l@youtvpvii=#2\relax
+ \l@youthdvii=#3\relax
+ \put(\l@youthpvii,\l@youtvpvii){\vector(0,1){0}}
+ \advance\l@youtvpvii by \l@youthdvii
+ \put(\l@youthpvii,\l@youtvpvii){\vector(0,-1){0}}
+ \endgroup}
+\newcommand{\l@yhrdia}[3]{\begingroup
+ \l@youthpvii=#1\relax
+ \l@youtvpvii=#2\relax
+ \l@youthdvii=#3\relax
+ \put(\l@youthpvii,\l@youtvpvii){\vector(1,0){0}}
+ \advance\l@youthpvii by \l@youthdvii
+ \put(\l@youthpvii,\l@youtvpvii){\vector(-1,0){0}}
+ \endgroup}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\l@ypcmd}
+% \begin{macro}{\l@ycmd}
+% |\l@ypcmd{|\meta{cmdname}|}| typesets a command \meta{cmdname} (which does
+% not include the backslash) (in a picture). For example, |\l@ypcmd{fred}|
+% prints |\fred|. The font size is given by |\l@yparamfont|. The
+% |\l@ycmd| macro is similar but does not set the font size.
+% \begin{macrocode}
+\newcommand{\l@ypcmd}[1]{{\l@yparamfont\texttt{\bs #1}}}
+\newcommand{\l@ycmd}[1]{\texttt{\bs #1}}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\printinunitsof}
+% \begin{macro}{\l@yunitperpt}
+% \begin{macro}{\l@yunits}
+% |\printinunitsof{|\meta{unit}|}| sets |\l@yunits| to the value of \meta{unit}
+% and |\l@yunitperpt| to the number of \meta{unit} in 1pt.
+% \changes{v2.5}{2001/10/21}{Added \cs{printinunitsof}, \cs{l@yunitperpt}
+% and \cs{units}}
+% \begin{macrocode}
+\newcommand{\printinunitsof}[1]{%
+ \def\l@yunitperpt{1.0}\def\l@yunits{pt}%
+ \def\l@yta{#1}\def\l@ytb{pt}%
+ \ifx \l@yta\l@ytb
+ \def\l@yunitperpt{1.0}\def\l@yunits{pt}%
+ \else
+ \def\l@ytb{pc}%
+ \ifx \l@yta\l@ytb
+ \def\l@yunitperpt{0.083333}\def\l@yunits{pc}%
+ \else
+ \def\l@ytb{in}%
+ \ifx \l@yta\l@ytb
+ \def\l@yunitperpt{0.013837}\def\l@yunits{in}%
+ \else
+ \def\l@ytb{mm}%
+ \ifx \l@yta\l@ytb
+ \def\l@yunitperpt{0.351459}\def\l@yunits{mm}%
+ \else
+ \def\l@ytb{cm}%
+ \ifx \l@yta\l@ytb
+ \def\l@yunitperpt{0.0351459}\def\l@yunits{cm}%
+ \else
+ \def\l@ytb{bp}%
+ \ifx \l@yta\l@ytb
+ \def\l@yunitperpt{0.996264}\def\l@yunits{bp}%
+ \else
+ \def\l@ytb{dd}%
+ \ifx \l@yta\l@ytb
+ \def\l@yunitperpt{0.9345718}\def\l@yunits{dd}%
+ \else
+ \def\l@ytb{cc}%
+ \ifx \l@yta\l@ytb
+ \def\l@yunitperpt{0.0778809}\def\l@yunits{cc}%
+ \else
+ \def\l@ytb{PT}%
+ \ifx \l@yta\l@ytb
+ \def\l@yunitperpt{1.0}\def\l@yunits{PT}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\printinunitsof{pt}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\l@ytempdima}
+% \begin{macro}{\prntlen}
+% |\l@ytempdima| is a scratch length. |\prntlen{|\meta{length}|}|
+% prints the value of \meta{length} in the units set by |\printinunitsof|.
+% \changes{v2.5}{2001/10/21}{Added \cs{l@ytempdima} and \cs{prntlen}}
+% \begin{macrocode}
+\newlength{\l@ytempdima}
+\newcommand{\prntlen}[1]{%
+ \def\l@yta{pt}\ifx\l@yta\l@yunits\the#1\else
+ \def\l@yta{PT}%
+ \l@ytempdima=\l@yunitperpt #1\relax\strip@pt\l@ytempdima
+ \ifx\l@yta\l@yunits pt\else\l@yunits\fi\fi}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\l@yval}
+% |\l@yval{|\meta{lcmd}|}| prints a value of the (length) command \meta{lcmd}
+% (which includes the backslash); for example |\l@yval{\mylength}|.
+% \changes{v2.5}{2001/10/21}{Changed the definition of \cs{l@yval}}
+% \begin{macrocode}
+%%% \newcommand{\l@yval}[1]{\the#1}
+\newcommand{\l@yval}[1]{\prntlen{#1}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \section{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.
+% \begin{macro}{\trypaperwidth}
+% Sets the |paperwidth| and stores the result in |\l@youtpw|.
+% \begin{macrocode}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%% PAGE LAYOUT
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newcommand{\trypaperwidth}[1]{\l@yltoc{#1}{\l@youtpw}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trypaperheight}
+% Sets the |paperheight| and stores the result in |\l@youtph|.
+% \begin{macrocode}
+\newcommand{\trypaperheight}[1]{\l@yltoc{#1}{\l@youtph}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryhoffset}
+% Sets the |hoffset| and stores the result in |\l@youthpi|.
+% \begin{macrocode}
+\newcommand{\tryhoffset}[1]{\l@yltoc{#1}{\l@youthpi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryvoffset}
+% Sets the |voffset| and stores the result in |\l@youtvpi|.
+% \begin{macrocode}
+\newcommand{\tryvoffset}[1]{\l@yltoc{#1}{\l@youtvpi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trytopmargin}
+% Sets the |topmargin| and stores the result in |\l@youtvpii|.
+% \begin{macrocode}
+\newcommand{\trytopmargin}[1]{\l@yltoc{#1}{\l@youtvpii}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryheadheight}
+% Sets the |headheight| and stores the result in |\l@youtvpiii|.
+% \begin{macrocode}
+\newcommand{\tryheadheight}[1]{\l@yltoc{#1}{\l@youtvpiii}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryheadsep}
+% Sets the |headsep| and stores the result in |\l@youtvpiv|.
+% \begin{macrocode}
+\newcommand{\tryheadsep}[1]{\l@yltoc{#1}{\l@youtvpiv}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trytextheight}
+% Sets the |textheight| and stores the result in |\l@youtvpv|.
+% \begin{macrocode}
+\newcommand{\trytextheight}[1]{\l@yltoc{#1}{\l@youtvpv}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryfootskip}
+% Sets the |footskip| and stores the result in |\l@youtvpvi|.
+% \begin{macrocode}
+\newcommand{\tryfootskip}[1]{\l@yltoc{#1}{\l@youtvpvi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryoddsidemargin}
+% Sets the |oddsidemargin| and stores the result in |\l@youthpv|.
+% \begin{macrocode}
+\newcommand{\tryoddsidemargin}[1]{\l@yltoc{#1}{\l@youthpv}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryevensidemargin}
+% Sets the |evensidemargin| and stores the result in |\l@youthpiv|.
+% \begin{macrocode}
+\newcommand{\tryevensidemargin}[1]{\l@yltoc{#1}{\l@youthpiv}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trytextwidth}
+% Sets the |textwidth| and stores the result in |\l@youthpii|.
+% \begin{macrocode}
+\newcommand{\trytextwidth}[1]{\l@yltoc{#1}{\l@youthpii}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trymarginparsep}
+% Sets the |marginparsep| and stores the result in |\l@youthpvi|.
+% \begin{macrocode}
+\newcommand{\trymarginparsep}[1]{\l@yltoc{#1}{\l@youthpvi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trymarginparwidth}
+% Sets the |marginparwidth| and stores the result in |\l@youthpvii|.
+% \begin{macrocode}
+\newcommand{\trymarginparwidth}[1]{\l@yltoc{#1}{\l@youthpvii}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trymarginparpush}
+% Sets the |marginparpush| and stores the result in |\l@youtvpvii|.
+% \begin{macrocode}
+\newcommand{\trymarginparpush}[1]{\l@yltoc{#1}{\l@youtvpvii}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trycolumnsep}
+% Sets the |columnsep| and stores the result in |\l@youthpiii|.
+% \begin{macrocode}
+\newcommand{\trycolumnsep}[1]{\l@yltoc{#1}{\l@youthpiii}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trycolumnseprule}
+% Sets the |columnseprule| and stores the result in |\l@youtlinethick|.
+% \begin{macrocode}
+\newcommand{\trycolumnseprule}[1]{\setlength{\l@youtlinethick}{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\setfootbox}
+% Sets the height and depth of the footer box and stores the results
+% in |\l@youtvdv| and |\l@youtvdvi|.
+% \changes{v2.5a}{2002/03/05}{Added \cs{setfootbox}}
+% \begin{macrocode}
+\newcommand{\setfootbox}[2]{\l@yltoc{#1}{\l@youtvdv}\l@yltoc{#2}{\l@youtvdvi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ifreversemarginpar}
+% \begin{macro}{\ifmarginparswitch}
+% Flags for where marginpars should go.
+% \begin{macrocode}
+\newif\ifreversemarginpar
+ \reversemarginparfalse
+\newif\ifmarginparswitch
+ \marginparswitchtrue
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\ifl@yrightmpars}
+% Internal flag for marginpar location
+% \begin{macrocode}
+\newif\ifl@yrightmpars
+ \l@yrightmparstrue
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\currentpage}
+% This routine sets the layout page parameters to those specified
+% for the document, specifically as on the current page.
+% \changes{v2.5a}{2002/01/06}{Added footheight to \cs{currentpage}}
+% \changes{v2.6}{2002/06/09}{Added further settings in \cs{currentpage}}
+% \changes{v2.6}{2002/06/09}{Split \cs{currentpage} into two
+% (plus \cs{commonl@ypage}}
+% \begin{macrocode}
+\newcommand{\currentpage}{%
+ \@ifundefined{paperwidth}{\trypaperwidth{8.5in}}%
+ {\trypaperwidth{\paperwidth}}%
+ \@ifundefined{paperheight}{\trypaperheight{11in}}%
+ {\trypaperheight{\paperheight}}%
+ \tryhoffset{\hoffset}% % typically 0pt
+ \tryvoffset{\voffset}% % typically 0pt
+ \tryoddsidemargin{\oddsidemargin}% % typically 21-63pt
+ \tryevensidemargin{\evensidemargin}% % typically 39-82pt
+ \trytopmargin{\topmargin}% % typically 27pt
+ \commonl@ypage%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\commonl@ypage}
+% This routine sets the layout page parameters common to both the
+% standard and memoir classes, to those specified
+% for the document, specifically as on the current page.
+% \changes{v2.6}{2002/06/09}{Added \cs{commonl@ypage}}
+% \begin{macrocode}
+\newcommand{\commonl@ypage}{%
+ \trymarginparwidth{\marginparwidth}% % typically 68-107pt
+ \trymarginparsep{\marginparsep}% % typically 10-11pt
+ \trymarginparpush{\marginparpush}% % typically 5-7pt
+ \tryheadheight{\headheight}% % typically 12pt
+ \tryheadsep{\headsep}% % typically 25pt
+ \tryfootskip{\footskip}% % typically 30pt
+ \trytextheight{\textheight}% % typically 36-43 times baselineskip
+ \trytextwidth{\textwidth}% % typically 345-390pt
+ \trycolumnsep{\columnsep}% % typically 10pt
+ \trycolumnseprule{\columnseprule}% % typically 0pt
+ \setfootbox{\baselineskip}{0pt}% % footheight = 1 line
+ \reversemarginparfalse % reversemargin
+ \if@reversemargin \reversemarginpartrue \fi
+ \marginparswitchfalse % mparswitch
+ \if@mparswitch \marginparswitchtrue \fi
+ \twocolumnlayoutfalse
+ \if@twocolumn \twocolumnlayouttrue \fi
+ \oddpagelayouttrue
+ \if@twoside
+ \ifodd\count\z@
+ \else
+ \oddpagelayoutfalse
+ \fi
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\drawpage}
+% This routine draws a page layout.
+%
+% \begin{macrocode}
+\newcommand{\drawpage}{%
+% \end{macrocode}
+% First set some default vertical and horizontal dimension values.
+% \begin{macrocode}
+ \l@youtvdiii=\l@yteninch\relax
+ \divide\l@youtvdiii by 24\relax
+ \l@youthdii=\l@youtvdiii
+ \ifdrawparameters
+% \end{macrocode}
+% When |drawparameters| is TRUE, we draw a generic layout showing the
+% controlling layout variables.
+% \changes{v2.5a}{2002/01/06}{Added default footheight in \cs{drawpage}}
+%
+% \begin{macrocode}
+ \l@youtph=\l@yeleveninch\relax % page height
+ \l@youtpw=\l@yeighthalfinch\relax % page width
+ \l@youtvpi=\z@ % voffset
+ \l@youtvpii=\l@youtvdiii % topmargin
+ \l@youtvpiii=\l@youtvdiii % headheight
+ \l@youtvpiv=\l@youtvdiii % headsep
+ \l@youtvpv=\l@yoneinch\relax % textheight
+ \multiply\l@youtvpv by 6\relax
+ \l@youtvpvi=\l@youtvdiii % footskip
+ \multiply\l@youtvpvi by \tw@
+ \l@youtvdv=\l@youtvdiii % default footboxheight
+ \l@youtvdvi=\z@ % default footboxdepth
+ \l@youtvpvii=\l@youtvdiii % marginparpush
+ \l@youthpi=\z@ % hoffset
+ \l@youthpii=\l@youthdii % textwidth
+ \multiply\l@youthpii by 13\relax
+ \l@youthpiii=\l@youthdii % columnsep
+ \l@youthpiv=\l@youthdii % evensidemargin
+ \l@youthpv=\l@youthdii % oddsidemargin
+ \l@youthpvi=\l@youthdii % marginparsep
+ \l@youthpvii=\l@youthdii % marginparwidth
+ \multiply\l@youthpvii by \tw@
+ \fi
+% \end{macrocode}
+% Calculate coordinates for use in the drawing.
+% \begin{macrocode}
+ \l@youtycvi=\l@youtph % one inch below top of page
+ \advance\l@youtycvi by -\l@yoneinch\relax
+ \l@youtxci=\l@youthpi % hofref
+ \advance\l@youtxci by \l@yoneinch\relax
+ \l@youtycv=\l@youtycvi % vofref
+ \advance\l@youtycv by -\l@youtvpi
+ \l@youtyciv=\l@youtycv % headref
+ \advance\l@youtyciv by -\l@youtvpii
+ \advance\l@youtyciv by -\l@youtvpiii
+ \l@youtycii=\l@youtyciv % bodyref
+ \advance\l@youtycii by -\l@youtvpiv
+ \advance\l@youtycii by -\l@youtvpv
+ \ifnum\l@youtvdv>\l@youtvpvi
+ \PackageWarning{layouts}{The footbox is higher than the footskip}
+ \l@youtvdv=\l@youtvpvi
+ \fi
+ \l@youtyci=\l@youtycii % footref
+ \advance\l@youtyci by -\l@youtvpvi
+ \advance\l@youtyci by -\l@youtvdvi % box depth
+ \l@youtvdvii=\l@youtvdv % box height
+ \advance\l@youtvdvii by \l@youtvdvi % plus depth
+ \l@youtvdii=\l@youtvpv % noteheight
+ \divide\l@youtvdii by 4\relax
+ \l@youtyciii=\l@youtycii % noteref
+ \advance\l@youtyciii by \l@youtvdii
+ \advance\l@youtyciii by \l@youtvpvii
+ \l@youtxcii=\l@youtxci % marginref
+ \ifoddpagelayout
+% \end{macrocode}
+% Some values are different on odd and even pages
+% \begin{macrocode}
+ \advance\l@youtxcii by \l@youthpv
+ \else
+ \advance\l@youtxcii by \l@youthpiv
+ \fi
+ \l@youtxciv=\l@youtxcii % margnoteref
+% \end{macrocode}
+% The next part of the code was supplied by Frank Mittelbach\footnote{Email
+% dated 2002/05/18.}
+% to add facilities for reversed marginpars. Now find where the marginpars
+% go. |\@tempcnta| = (1 --- right, -1 --- left) corresponds to the
+% treatment in the kernel.
+% \begin{macrocode}
+ \@tempcnta\@ne
+ \ifmarginparswitch
+ \ifoddpagelayout \else \@tempcnta\m@ne \fi
+ \fi
+ \ifreversemarginpar \@tempcnta -\@tempcnta \fi
+% \end{macrocode}
+% Change layout values to suit.
+% \begin{macrocode}
+ \ifnum\@tempcnta > \z@
+ \l@yrightmparstrue
+ \advance\l@youtxciv by \l@youthpii
+ \advance\l@youtxciv by \l@youthpvi
+ \else
+ \l@yrightmparsfalse
+ \advance\l@youtxciv by -\l@youthpvi
+ \advance\l@youtxciv by -\l@youthpvii
+ \fi
+% \end{macrocode}
+% Back to my code. Do column dependent values.
+% \begin{macrocode}
+ \l@youthdi=\l@youthpii % columnwidth
+ \l@youtxciii=\l@youtxcii % colref
+ \iftwocolumnlayout
+ \advance\l@youthdi by -\l@youthpiii
+ \divide\l@youthdi by \tw@
+ \advance\l@youtxciii by \l@youthdi
+ \advance\l@youtxciii by \l@youthpiii
+ \l@youtxcv=\l@youthpiii % centre of gutter
+ \divide\l@youtxcv by \tw@
+ \advance\l@youtxcv by \l@youtxcii
+ \advance\l@youtxcv by \l@youthdi
+ \fi
+% \end{macrocode}
+%
+% Print the caption for the top of the drawing.
+% \changes{v2.5}{2001/10/21}{Don't always print dashed text}
+% \begin{macrocode}
+ \l@yor{\ifdrawparameters}{\ifprintheadings}
+ \begin{center}
+ \ifl@ytempif
+ \begin{small} The circle is at 1 inch from the top and left of the
+ page. Dashed lines represent (\texttt{\bs hoffset + 1 inch}) and
+ (\texttt{\bs voffset + 1 inch}) from the top and left of the
+ page.
+ \end{small} \\
+ \medskip
+ \fi
+% \end{macrocode}
+%
+% Draw the picture!
+%
+% \begin{macrocode}
+ \setlength{\unitlength}{\l@youtunitlength}
+ \begin{picture}(\l@youtpw,\l@youtph)
+ \thicklines
+% \end{macrocode}
+% Either reference lines for the page top and side, or the page.
+% \begin{macrocode}
+ \ifdrawparameters
+ \put(0,0){\line(0,1){\l@youtph}}
+ \put(0,\l@youtph){\line(1,0){\l@youtpw}}
+ \else
+ \put(0,0){\framebox(\l@youtpw,\l@youtph){}}
+ \fi
+% \end{macrocode}
+% Draw the offset lines and a circle 1 inch from the top LH corner
+% of the page.
+% \begin{macrocode}
+ \put(\l@yoneinch,\l@youtycvi){\circle{12}}
+ \put(0,\l@youtycv){\dashbox{10}(\l@youtpw,0){}}
+ \put(\l@youtxci,0){\dashbox{10}(0,\l@youtph){}}
+% \end{macrocode}
+% Draw the header. |put(marginref,headref){framebox(textwidth,headheight)}|
+% \begin{macrocode}
+ \put(\l@youtxcii,\l@youtyciv){\framebox(\l@youthpii,\l@youtvpiii)%
+ {\l@ylabelfont Header}}
+% \end{macrocode}
+% Draw the body.
+% \begin{macrocode}
+ \iftwocolumnlayout
+% \end{macrocode}
+% |put(marginref,bodyref){framebox(columnwidth,textheight)}| and \\
+% |put(colref,bodyref){framebox(columnwidth,textheight)}|.
+% \begin{macrocode}
+ \put(\l@youtxcii,\l@youtycii){\framebox(\l@youthdi,\l@youtvpv)%
+ {\l@ylabelfont Col. 1}}
+ \put(\l@youtxciii,\l@youtycii){\framebox(\l@youthdi,\l@youtvpv)%
+ {\l@ylabelfont Col. 2}}
+ \linethickness{\l@youtscale\l@youtlinethick}
+ \put(\l@youtxcv,\l@youtycii){\line(0,1){\l@youtvpv}}
+ \thicklines
+ \else
+% \end{macrocode}
+% |put(marginref,bodyref){framebox(textwidth,textheight)}|.
+% \begin{macrocode}
+ \put(\l@youtxcii,\l@youtycii){\framebox(\l@youthpii,\l@youtvpv)%
+ {\l@ylabelfont Body}}
+ \fi
+% \end{macrocode}
+% Draw the footer. |put(marginref,footref){framebox(textwidth,footheight)}|
+% Draw this as an open box as there is no defined height for this.
+% \changes{v2.5a}{2002/01/06}{Footer drawn as open box on page diagram}
+% \begin{macrocode}
+ \put(\l@youtxcii,\l@youtyci){\framebox(\l@youthpii,\l@youtvdvii)%
+ {\l@ylabelfont Footer}}
+% \end{macrocode}
+% Marginal notes (two examples), if asked for. \\
+% |put(margnoteref,bodyref){framebox(marginparwidth,noteheight)}| and \\
+% |put(margnoteref,noteref){framebox(marginparwidth,noteheight)}|.
+% \changes{v2.4}{2001/04/30}{Added checks for drawing marginpars to \cs{drawpage}}
+% \begin{macrocode}
+ \ifdrawmarginpars
+ \ifdrawparameters
+ \put(\l@youtxciv,\l@youtycii){\framebox(\l@youthpvii,\l@youtvdii){}}
+ \put(\l@youtxciv,\l@youtyciii){\framebox(\l@youthpvii,\l@youtvdii)%
+ {\l@ylabelfont\shortstack{Margin\\Note}}}
+ \else
+ \put(\l@youtxciv,\l@youtycii){\framebox(\l@youthpvii,\l@youtvdii)%
+ {\l@ylabelfont Note}}
+ \put(\l@youtxciv,\l@youtyciii){\framebox(\l@youthpvii,\l@youtvdii)%
+ {\l@ylabelfont Margin}}
+ \fi
+ \fi
+% \end{macrocode}
+% If the footbox has a depth, draw a dashed line to mark the footskip.
+% \begin{macrocode}
+ \ifnum\l@youtvdvi > \z@
+ \thinlines
+ \advance\l@youtyci by \l@youtvdvi
+ \put(\l@youtxcii,\l@youtyci){\dashbox{10}(\l@youthpii,0){}}
+ \fi
+% \end{macrocode}
+% 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.
+% \changes{v2.5}{2001/10/21}{Changed test for drawing dimensions}
+% \begin{macrocode}
+ \testdrawdimensions
+ \ifl@ytempif
+ \thinlines
+% \end{macrocode}
+% Calculate more coordinates
+% \begin{macrocode}
+ \l@youtxcv=\l@youtxcii % X coord for vertical dimensions
+ \advance\l@youtxcv by \l@youthdii
+ \l@youtxcvi=\l@youthpvii % X coord for marginparpush
+ \divide\l@youtxcvi by \tw@
+ \advance\l@youtxcvi by \l@youtxciv
+ \l@youtvdviii=\l@youtvdiii % half l@youtvdiii
+ \divide\l@youtvdviii by \tw@
+ \l@youtycvii=\l@youtycii % Y coord for low dimensions
+ \advance\l@youtycvii by \l@youtvdiii
+ \l@youtycviii=\l@youtycvii % Y coord for mid dimensions
+ \advance\l@youtycviii by \l@youtvdiii
+ \l@youtvdi=\l@youtvpv % Y coord for top dimensions
+ \multiply\l@youtvdi by \tw@
+ \divide\l@youtvdi by 3\relax
+ \advance\l@youtvdi by \l@youtycii
+% \end{macrocode}
+% Draw the vertical dimensional parameters.
+%
+% Topmargin. |put(x,voffset){vector(0,-1){topmargin}}|
+% \begin{macrocode}
+ \put(\l@youtxcv,\l@youtycv){\vector(0,-1){\l@youtvpii}}
+ \put(\l@youtxcv,\l@youtycv){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,-\l@youtvdviii){\l@ypcmd{topmargin}}
+ \end{picture}}
+% \end{macrocode}
+% Headheight. |put(x,voffset-topmargin){vector(0,-1){headheight}}|
+% \begin{macrocode}
+ \put(\l@youtxcv,\l@youtyciv){\line(0,1){\l@youtvpiii}}
+ \put(\l@youtxcv,\l@youtyciv){\vector(0,-1){0}}
+ \put(\l@youtxcv,\l@youtyciv){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{headheight}}
+ \end{picture}}
+% \end{macrocode}
+% Headsep. |put(x,headref){vector(0,-1){headsep}}|
+% \begin{macrocode}
+ \put(\l@youtxcv,\l@youtyciv){\vector(0,-1){\l@youtvpiv}}
+ \put(\l@youtxcv,\l@youtyciv){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,-\l@youtvdviii){\l@ypcmd{headsep}}
+ \end{picture}}
+% \end{macrocode}
+% Textheight. |put(x,top_of_text){vector(0,-1){textheight}}|
+% \begin{macrocode}
+ \put(\l@youtxcv,\l@youtycii){\line(0,1){\l@youtvpv}}
+ \put(\l@youtxcv,\l@youtycii){\vector(0,-1){0}}
+ \put(\l@youtxcv,\l@youtycii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{textheight}}
+ \end{picture}}
+% \end{macrocode}
+% Footskip. |put(x,bodyref){vector(0,-1){footskip}}|
+% \begin{macrocode}
+ \put(\l@youtxcv,\l@youtycii){\vector(0,-1){\l@youtvpvi}}
+ \put(\l@youtxcv,\l@youtycii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,-\l@youtvdviii){\l@ypcmd{footskip}}
+ \end{picture}}
+% \end{macrocode}
+% Marginparpush. |put(X,noteref){vector(0,-1){marginparpush}}| where \\
+% |X = margnoteref + 1/2 notewidth|.
+% \begin{macrocode}
+ \ifdrawmarginpars
+ \put(\l@youtxcvi,\l@youtyciii){\vector(0,-1){\l@youtvpvii}}
+ \put(\l@youtxcvi,\l@youtyciii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,-\l@youtvdviii){\l@ypcmd{marginparpush}}
+ \end{picture}}
+ \fi
+% \end{macrocode}
+%
+% Now for all the horizontal dimensions.
+%
+% Marginparwidth. |put(margnoteref,low){vector(1,0){marginparwidth}|
+% \begin{macrocode}
+ \ifdrawmarginpars
+ \put(\l@youtxciv,\l@youtycvii){\vector(1,0){\l@youthpvii}}
+ \put(\l@youtxciv,\l@youtycvii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{marginparwidth}}
+ \end{picture}}
+ \fi
+% \end{macrocode}
+% Different placements for marginwidth depending on the oddness of the page. \\
+% Odd page --- |put(hoffref,mid){\vector(1,0){oddsidemargin}| \\
+% Even page --- |put(hoffref,mid){\vector(1,0){evensidemargin}|.
+% \begin{macrocode}
+ \ifoddpagelayout
+ \put(\l@youtxci,\l@youtvdi){\vector(1,0){\l@youthpv}}
+ \else
+ \put(\l@youtxci,\l@youtvdi){\vector(1,0){\l@youthpiv}}
+ \fi
+ \put(\l@youtxci,\l@youtvdi){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \ifoddpagelayout
+ \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{oddsidemargin}}
+ \else
+ \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{evensidemargin}}
+ \fi
+ \end{picture}}
+% \end{macrocode}
+% Different placements for marginparsep, depending on the particular margin. \\
+% Right margin --- |put(margnoteref-marginparsep,mid){vector(1,0){marginparsep}| \\
+% Left margin --- |put(marginref,top){vector(-1,0){marginparsep}|
+% \begin{macrocode}
+ \ifdrawmarginpars
+ \ifl@yrightmpars
+ \put(\l@youtxciv,\l@youtycviii){\line(-1,0){\l@youthpvi}}
+ \put(\l@youtxciv,\l@youtycviii){\vector(1,0){0}}
+ \put(\l@youtxciv,\l@youtycviii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(-\l@youtvdviii,\l@youtvdviii){\l@ypcmd{marginparsep}}
+ \end{picture}}
+ \else
+ \put(\l@youtxcii,\l@youtycviii){\vector(-1,0){\l@youthpvi}}
+ \put(\l@youtxcii,\l@youtycviii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(-\l@youtvdviii,\l@youtvdviii){\l@ypcmd{marginparsep}}
+ \end{picture}}
+ \fi
+ \fi
+% \end{macrocode}
+% Textwidth. |put(marginref,noteref){vector(1,0){textwidth}}|
+% \begin{macrocode}
+ \put(\l@youtxcii,\l@youtyciii){\vector(1,0){\l@youthpii}}
+ \put(\l@youtxcv,\l@youtyciii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{textwidth}}
+ \end{picture}}
+% \end{macrocode}
+% Columnsep. |put(colref-colsep,mid){vector(1,0){colsep}}|
+% \begin{macrocode}
+ \iftwocolumnlayout
+ \put(\l@youtxciii,\l@youtvdi){\line(-1,0){\l@youthpiii}}
+ \put(\l@youtxciii,\l@youtvdi){\vector(1,0){0}}
+ \put(\l@youtxciii,\l@youtvdi){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(-\l@youtvdviii,\l@youtvdviii){\l@ypcmd{columnsep}}
+ \end{picture}}
+ \fi
+% \end{macrocode}
+% Have finished drawing the parameters.
+% \begin{macrocode}
+ \fi
+ \end{picture}
+ \end{center}
+ \setlength{\unitlength}{1pt}
+% \end{macrocode}
+% Print the actual parameter values.
+% \changes{v2.5}{2001/10/21}{Changed test for printing the value table}
+% \begin{macrocode}
+ \testprintparameters
+ \ifl@ytempif
+ \begin{center}
+ \begin{footnotesize}
+ Lengths are to the nearest pt. \\
+ \begin{ttfamily}
+ \begin{tabular}{l@{\hspace{20pt}}l}
+ \textrm{page height} = \number\l@youtph pt &
+ \textrm{page width} = \number\l@youtpw pt \\
+ \l@ycmd{hoffset} = \number\l@youthpi pt &
+ \l@ycmd{voffset} = \number\l@youtvpi pt \\
+ \ifoddpagelayout
+ \l@ycmd{oddsidemargin} = \number\l@youthpv pt
+ \else
+ \l@ycmd{evensidemargin} = \number\l@youthpiv pt
+ \fi
+ & \l@ycmd{topmargin} = \number\l@youtvpii pt \\
+ \l@ycmd{headheight} = \number\l@youtvpiii pt &
+ \l@ycmd{headsep} = \number\l@youtvpiv pt \\
+ \l@ycmd{textheight} = \number\l@youtvpv pt &
+ \l@ycmd{textwidth} = \number\l@youthpii pt \\
+ \l@ycmd{footskip} = \number\l@youtvpvi pt &
+ \l@ycmd{marginparsep} = \number\l@youthpvi pt \\
+ \l@ycmd{marginparpush} = \number\l@youtvpvii pt &
+ \l@ycmd{columnsep} = \number\l@youthpiii pt \\
+ \l@ycmd{columnseprule} = \the\l@youtlinethick & \\
+ \end{tabular}
+ \end{ttfamily}\end{footnotesize}
+ \end{center}
+ \fi
+% \end{macrocode}
+% The end of the definition for |\drawpage|.
+% \begin{macrocode}
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pagediagram}
+% \begin{macro}{\pagedesign}
+% Shorthands.
+% \begin{macrocode}
+\newcommand{\pagediagram}{\drawparameterstrue\drawpage}
+\newcommand{\pagedesign}{\drawparametersfalse\drawpage}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\pagevalues}
+% This macro produces a table of the current page layout actual values.
+% \begin{macrocode}
+\newcommand{\pagevalues}{%
+%% \begin{center}
+ \ifprintheadings
+ Actual page layout values.\\[\baselineskip]
+ \fi
+ \begingroup\l@yvalsize
+ \begin{tabular}{l@{\hspace{20pt}}l}
+ \l@ycmd{paperheight} = \@ifundefined{paperheight}{??}{\l@yval{\paperheight}} &
+ \l@ycmd{paperwidth} = \@ifundefined{paperwidth}{??}{\l@yval{\paperwidth}} \\
+ \l@ycmd{hoffset} = \l@yval{\hoffset} &
+ \l@ycmd{voffset} = \l@yval{\voffset} \\
+ \l@ycmd{evensidemargin} = \l@yval{\evensidemargin} &
+ \l@ycmd{oddsidemargin} = \l@yval{\oddsidemargin} \\
+ \l@ycmd{topmargin} = \l@yval{\topmargin} &
+ \l@ycmd{headheight} = \l@yval{\headheight} \\
+ \l@ycmd{headsep} = \l@yval{\headsep} &
+ \l@ycmd{textheight} = \l@yval{\textheight} \\
+ \l@ycmd{textwidth} = \l@yval{\textwidth} &
+ \l@ycmd{footskip} = \l@yval{\footskip} \\
+ \l@ycmd{marginparsep} = \l@yval{\marginparsep} &
+ \l@ycmd{marginparpush} = \l@yval{\marginparpush} \\
+ \l@ycmd{columnsep} = \l@yval{\columnsep} &
+ \l@ycmd{columnseprule} = \l@yval{\columnseprule} \\
+ 1em = \l@yval{\l@yonem} & 1ex = \l@yval{\l@yonex} \\
+ \end{tabular}
+ \endgroup
+%% \end{center}
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Drawing the layout of a memoir page}
+%
+% A variety of commands are used to draw the layout of a page
+% as defined in the memoir class. We can reuse quite a lot from
+% the previous page layout code.
+%
+% \begin{macrocode}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%% STOCK LAYOUT
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% \end{macrocode}
+%
+% \begin{macro}{\stockwidth}
+% \begin{macro}{\stockwidth}
+% \begin{macro}{\trimedge}
+% \begin{macro}{\trimtop}
+% \begin{macro}{\uppermargin}
+% \begin{macro}{\spinemargin}
+% The memoir class has some page layout parameters that are not
+% in the standard classes. Provide these so the package will at
+% least compile with the standard classes but is highly likely to
+% die at runtime if this part of the code is used in other than
+% the memoir class.
+% \begin{macrocode}
+\@ifundefined{stockwidth}{\newlength{\stockwidth}}{}
+\@ifundefined{stockheight}{\newlength{\stockheight}}{}
+\@ifundefined{trimedge}{\newlength{\trimedge}}{}
+\@ifundefined{trimtop}{\newlength{\trimtop}}{}
+\@ifundefined{uppermargin}{\newlength{\uppermargin}}{}
+\@ifundefined{spinemargin}{\newlength{\spinemargin}}{}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% Now some utility commands for setting the layout dimensions.
+% \begin{macro}{\trystockwidth}
+% Sets the |stockwidth| and stores the result in |\l@youthdo|.
+% \begin{macrocode}
+\newcommand{\trystockwidth}[1]{\l@yltoc{#1}{\l@youthdo}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trystockheight}
+% Sets the |stockheight| and stores the result in |\l@youtvdo|.
+% \begin{macrocode}
+\newcommand{\trystockheight}[1]{\l@yltoc{#1}{\l@youtvdo}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trytrimedge}
+% Sets the |trimedge| and stores the result in |\l@youthpi|.
+% \begin{macrocode}
+\newcommand{\trytrimedge}[1]{\l@yltoc{#1}{\l@youthpi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trytrimtop}
+% Sets the |trimtop| and stores the result in |\l@youtvpi|.
+% \begin{macrocode}
+\newcommand{\trytrimtop}[1]{\l@yltoc{#1}{\l@youtvpi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryuppermargin}
+% Sets the |uppermargin| and stores the result in |\l@youtvpii|.
+% \begin{macrocode}
+\newcommand{\tryuppermargin}[1]{\l@yltoc{#1}{\l@youtvpii}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryspinemargin}
+% Sets the |spinemargin| and stores the result in |\l@youthpv|.
+% \begin{macrocode}
+\newcommand{\tryspinemargin}[1]{\l@yltoc{#1}{\l@youthpv}}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\currentstock}
+% This routine sets the stock layout page parameters to those specified
+% for the document.
+% \changes{2.5a}{2002/01/06}{Added default footheight to \cs{currentstock}}
+% \changes{2.6}{2002/06/09}{Split \cs{currentstock} into two macros
+% (plus \cs{commonl@ypage}}
+% \begin{macrocode}
+\newcommand{\currentstock}{%
+ \trystockwidth{\stockwidth}% % typically 8.5in
+ \trystockheight{\stockheight}% % typically 11in
+ \trypaperwidth{\paperwidth}% % typically 8.5in
+ \trypaperheight{\paperheight}% % typically 11in
+ \trytrimedge{\trimedge}% % typically 0pt
+ \trytrimtop{\trimtop}% % typically 0pt
+ \tryspinemargin{\spinemargin}% % typically 110pt
+ \tryuppermargin{\uppermargin}% % typically 125pt
+ \commonl@ypage
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\drawstock}
+% This routine draws a stock page layout.
+%
+% \begin{macrocode}
+\newcommand{\drawstock}{%
+% \end{macrocode}
+% First set some default vertical and horizontal dimension values.
+% \begin{macrocode}
+ \l@youtvdiii=\l@yteninch\relax
+ \divide\l@youtvdiii by 24\relax
+ \l@youthdii=\l@youtvdiii
+
+ \ifdrawparameters
+% \end{macrocode}
+% When |drawparameters| is TRUE, we draw a generic layout showing the
+% controlling layout variables.
+%
+% \begin{macrocode}
+ \l@youtvdo=\l@yeleveninch\relax % stock height
+ \l@youthdo=\l@yeighthalfinch\relax % stock width
+ \l@youtvpi=\z@ % trimtop
+ \advance\l@youtvpi by \l@youtvdiii
+ \l@youthpi=\z@ % trimedge
+ \advance\l@youthpi by \l@youtvdiii
+ \l@youtph=\l@youtvdo % page height (= stock height)
+ \advance\l@youtph by -\l@youtvpi % minus trimtop
+ \advance\l@youtph by -\l@youtvpi % minus trimtop
+ \advance\l@youtph by -\l@youtvpi % minus trimtop
+ \l@youtpw=\l@youthdo % page width (= stock width)
+ \advance\l@youtpw by -\l@youthpi % minus trimedge
+ \advance\l@youtpw by -\l@youthpi % minus trimedge
+ \advance\l@youtpw by -\l@youthpi % minus trimedge
+ \l@youtvpiii=\l@youtvdiii % headheight
+ \l@youtvpiv=\l@youtvdiii % headsep
+ \l@youtvpii=\l@youtvdiii % uppermargin
+ \advance\l@youtvpii by \l@yoneinch % plus 1in
+ \advance\l@youtvpii by \l@youtvpiii % plus headheight
+ \advance\l@youtvpii by \l@youtvpiv % plus headsep
+ \l@youtvpv=\l@yoneinch\relax % textheight
+ \multiply\l@youtvpv by 6\relax
+ \l@youtvpvi=\l@youtvdiii % footskip
+ \multiply\l@youtvpvi by \tw@
+ \l@youtvdv=\l@youtvdiii % default footboxheight
+ \l@youtvdvi=\z@ % default footboxdepth
+ \l@youtvpvii=\l@youtvdiii % marginparpush
+ \l@youthpii=\l@youthdii % textwidth
+ \multiply\l@youthpii by 12\relax
+ \l@youthpv=\l@youthdii % spine margin
+ \advance\l@youthpv by \l@yoneinch % plus 1in
+ \multiply\l@youthpv by 7\relax % and take 70%
+ \divide\l@youthpv by 10\relax
+ \l@youthpiii=\l@youthdii % columnsep
+ \l@youthpvi=\l@youthdii % marginparsep
+ \l@youthpvii=\l@youthdii % marginparwidth
+ \multiply\l@youthpvii by \tw@
+ \fi
+
+% \end{macrocode}
+% Calculate coordinates for use in the drawing. Some of these X coordinates
+% depend on whether the page is odd or even.
+% \begin{macrocode}
+ \ifoddpagelayout
+ \l@youtxco=\l@youthdo % X coord of page bottom left (= stockwidth)
+ \advance\l@youtxco by -\l@youthpi % minus trimedge
+ \advance\l@youtxco by -\l@youtpw % minus page width
+ \else
+ \l@youtxco=\l@youthpi % X coord of page bottom left = trimedge
+ \fi
+ \l@youtyco=\l@youtvdo % Y coord of page bottom left (= stockheight)
+ \advance\l@youtyco by -\l@youtvpi % minus trimtop
+ \advance\l@youtyco by -\l@youtph % minus page height
+ \l@youtxcii=\l@youtxco % X coord of left of textblock (= left of page)
+ \ifoddpagelayout
+ \advance\l@youtxcii by \l@youthpv % plus spinemargin
+ \else
+ \advance\l@youtxcii by \l@youtpw % plus pagewidth
+ \advance\l@youtxcii by -\l@youthpv % minus spinemargin
+ \advance\l@youtxcii by -\l@youthpii % minus textwidth
+ \fi
+ \l@youtxciv=\l@youtxcii % X coord of left of marginnote (= left of textblock)
+ \l@youtxciv=\l@youtxcii
+ \@tempcnta\@ne
+ \ifmarginparswitch
+ \ifoddpagelayout \else \@tempcnta\m@ne \fi
+ \fi
+ \ifreversemarginpar \@tempcnta -\@tempcnta \fi
+ \ifnum\@tempcnta >\z@
+ \l@yrightmparstrue
+ \advance\l@youtxciv by \l@youthpii % plus textwidth
+ \advance\l@youtxciv by \l@youthpvi % plus marginnotesep
+ \else
+ \l@yrightmparsfalse
+ \advance\l@youtxciv by -\l@youthpvii % minus marginparwidth
+ \advance\l@youtxciv by -\l@youthpvi % minus marginnotesep
+ \fi
+ \l@youtycii=\l@youtvdo % Y coord of bottom of text (= stockheight)
+ \advance\l@youtycii by -\l@youtvpi % minus trimtop
+ \advance\l@youtycii by -\l@youtvpii % minus uppermargin
+ \advance\l@youtycii by -\l@youtvpv % minus textheight
+ \ifnum\l@youtvdv>\l@youtvpvi
+ \PackageWarning{layouts}{The footbox is higher than the footskip}
+ \l@youtvdv=\l@youtvpvi
+ \fi
+ \l@youtyci=\l@youtycii % Y coord of bottom of footer (= bottom of text)
+ \advance\l@youtyci by -\l@youtvpvi % minus footskip
+ \advance\l@youtyci by -\l@youtvdvi % minus box depth
+ \l@youtvdvii=\l@youtvdv % box height
+ \advance\l@youtvdvii by \l@youtvdvi % plus depth
+ \l@youtyciv=\l@youtycii % Y coord of bottom of header (= bottom of text)
+ \advance\l@youtyciv by \l@youtvpv % plus textheight
+ \advance\l@youtyciv by \l@youtvpiv % plus headsep
+
+ \l@youtvdii=\l@youtvpv % height of a marginal note
+ \divide\l@youtvdii by 4\relax
+ \l@youtyciii=\l@youtycii % Y coord of bottom of top note (= bottom of bottom note)
+ \advance\l@youtyciii by \l@youtvdii % plus note height
+ \advance\l@youtyciii by \l@youtvpvii % plus marginparpush
+% \end{macrocode}
+% Now for column dependent values.
+% \begin{macrocode}
+ \l@youthdi=\l@youthpii % columnwidth = textwidth
+ \l@youtxciii=\l@youtxcii % X coord of right col
+ \iftwocolumnlayout
+ \advance\l@youthdi by -\l@youthpiii % colwidth = textwidth - colsep
+ \divide\l@youthdi by \tw@ % divided in half
+ \advance\l@youtxciii by \l@youthdi % X coord of right col X coord of text + col width
+ \advance\l@youtxciii by \l@youthpiii % plus colsep
+ \l@youtxcv=\l@youthpiii % centre of gutter
+ \divide\l@youtxcv by \tw@
+ \advance\l@youtxcv by \l@youtxcii
+ \advance\l@youtxcv by \l@youthdi
+ \fi
+% \end{macrocode}
+%
+% Print the caption for the top of the drawing.
+% \begin{macrocode}
+ \begin{center}
+ \l@yor{\ifdrawparameters}{\ifprintheadings}
+ \ifl@ytempif
+ \begin{small} Dashed lines represent the actual page size after trimming
+ the stock. \end{small} \\
+ \medskip
+ \fi
+% \end{macrocode}
+%
+% Draw the picture!
+%
+% \begin{macrocode}
+ \setlength{\unitlength}{\l@youtunitlength}
+ \begin{picture}(\l@youthdo,\l@youtvdo)
+ \thicklines
+% \end{macrocode}
+% Draw the stock, paper, etc.
+% \begin{macrocode}
+ \put(0,0){\framebox(\l@youthdo,\l@youtvdo){}} % the stock
+ \put(\l@youtxco,\l@youtyco){\dashbox{10}(\l@youtpw,\l@youtph){}} % the page
+ \put(\l@youtxcii,\l@youtyciv){\framebox(\l@youthpii,\l@youtvpiii)% % the header
+ {\l@ylabelfont Header}}
+% \end{macrocode}
+% Draw the body, either one or two columns, then the footer.
+% \begin{macrocode}
+ \iftwocolumnlayout
+ \put(\l@youtxcii,\l@youtycii){\framebox(\l@youthdi,\l@youtvpv)% % col 1
+ {\l@ylabelfont Col. 1}}
+ \put(\l@youtxciii,\l@youtycii){\framebox(\l@youthdi,\l@youtvpv)% % col2
+ {\l@ylabelfont Col. 2}}
+ \linethickness{\l@youtscale\l@youtlinethick}
+ \put(\l@youtxcv,\l@youtycii){\line(0,1){\l@youtvpv}} % rule
+ \linethickness{1pt}
+ \else
+ \put(\l@youtxcii,\l@youtycii){\framebox(\l@youthpii,\l@youtvpv)% % one col
+ {\l@ylabelfont Body}}
+ \fi
+ \put(\l@youtxcii,\l@youtyci){\framebox(\l@youthpii,\l@youtvdvii)% % footer
+ {\l@ylabelfont Footer}}
+% \end{macrocode}
+% Marginal notes (two examples), if asked for
+% \begin{macrocode}
+ \ifdrawmarginpars
+ \ifdrawparameters
+ \put(\l@youtxciv,\l@youtycii){\framebox(\l@youthpvii,\l@youtvdii){}}
+ \put(\l@youtxciv,\l@youtyciii){\framebox(\l@youthpvii,\l@youtvdii)%
+ {\l@ylabelfont\shortstack{Margin\\Note}}}
+ \else
+ \put(\l@youtxciv,\l@youtycii){\framebox(\l@youthpvii,\l@youtvdii)%
+ {\l@ylabelfont Note}}
+ \put(\l@youtxciv,\l@youtyciii){\framebox(\l@youthpvii,\l@youtvdii)%
+ {\l@ylabelfont Margin}}
+ \fi
+ \fi
+
+% \end{macrocode}
+% If the footbox has a depth, draw a dashed line to mark the footskip.
+% \begin{macrocode}
+ \ifnum\l@youtvdvi > \z@
+ \thinlines
+ \advance\l@youtyci by \l@youtvdvi
+ \put(\l@youtxcii,\l@youtyci){\dashbox{10}(\l@youthpii,0){}}
+ \fi
+% \end{macrocode}
+% That finishes the general drawing. We may have to now draw the
+% parameters
+% \begin{macrocode}
+ \testdrawdimensions
+ \ifl@ytempif
+ \thinlines
+% \end{macrocode}
+% 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.
+% \begin{macrocode}
+ \l@youtycv=\l@youtyco % Y coord of top of page (= page bottom)
+ \advance\l@youtycv by \l@youtph % plus pageheight
+ \l@youtvdviii=\l@youtvdiii % half l@youtvdiii (a small distance)
+ \divide\l@youtvdviii by \tw@
+ \l@youtxcv=\l@youtxcii % X coord for vertical dimensions
+ \advance\l@youtxcv by \l@youthdii % for `standard' vertical vectors
+ %% do headheight
+ \put(\l@youtxcv,\l@youtyciv){\vector(0,1){\l@youtvpiii}}
+ \put(\l@youtxcv,\l@youtyciv){\vector(0,-1){0}}
+ \put(\l@youtxcv,\l@youtyciv){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{headheight}}
+ \end{picture}}
+ %% do headsep
+ \put(\l@youtxcv,\l@youtyciv){\vector(0,-1){\l@youtvpiv}}
+ \put(\l@youtxcv,\l@youtyciv){\vector(0,1){0}}
+ \put(\l@youtxcv,\l@youtyciv){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,-\l@youtvdviii){\l@ypcmd{headsep}}
+ \end{picture}}
+ %% do textheight
+ \put(\l@youtxcv,\l@youtycii){\vector(0,1){\l@youtvpv}}
+ \put(\l@youtxcv,\l@youtycii){\vector(0,-1){0}}
+ \put(\l@youtxcv,\l@youtycii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{textheight}}
+ \end{picture}}
+ %% do footskip
+ \put(\l@youtxcv,\l@youtycii){\vector(0,-1){\l@youtvpvi}}
+ \put(\l@youtxcv,\l@youtycii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,-\l@youtvdviii){\l@ypcmd{footskip}}
+ \end{picture}}
+ \ifdrawmarginpars
+ \l@youtxcv=\l@youthpvii % X coord for marginparpush
+ \divide\l@youtxcv by \tw@
+ \advance\l@youtxcv by \l@youtxciv
+ %% do marginparpush
+ \put(\l@youtxcv,\l@youtyciii){\vector(0,-1){\l@youtvpvii}}
+ \put(\l@youtxcv,\l@youtyciii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,-\l@youtvdviii){\l@ypcmd{marginparpush}}
+ \end{picture}}
+ \fi
+%% calculate X coord for uppermargin/trimtop parameters
+ \ifoddpagelayout
+ \ifl@yrightmpars
+ \l@youtxcv=\l@youtxciv % X coord for uppermargin, etc (= edge of note)
+ \else
+ \l@youtxcv=\l@youtxciv
+ \advance\l@youtxcv by \l@youthpvii % plus marginparwidth
+ \fi
+ \else
+ \ifl@yrightmpars
+ \l@youtxcv=\l@youtxciv
+ \else
+ \l@youtxcv=\l@youtxciv
+ \advance\l@youtxcv by \l@youthpvii % plus marginparwidth
+ \fi
+ \fi
+ %% do uppermargin
+ \put(\l@youtxcv,\l@youtycv){\vector(0,-1){\l@youtvpii}}
+ \put(\l@youtxcv,\l@youtycv){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,-\l@youtvdviii){\l@ypcmd{uppermargin}}
+ \end{picture}}
+ %% do trimtop
+ \put(\l@youtxcv,\l@youtvdo){\vector(0,-1){\l@youtvpi}}
+ \put(\l@youtxcv,\l@youtvdo){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,-\l@youtvdviii){\l@ypcmd{trimtop}}
+ \end{picture}}
+%% X coord for stock height
+ \ifoddpagelayout
+ \ifl@yrightmpars
+ \l@youtxcv=\l@youtxco % X coord for stock height
+ \divide\l@youtxcv by \tw@ % 1/2 stock/paper left edges
+ \else
+ \l@youtxcv=\l@youtxco % X coord for stock height
+ \advance\l@youtxcv by \l@youtpw % plus page width
+ \advance\l@youtxcv by \l@youthpi % plus trimedge
+ \fi
+ \else
+ \ifl@yrightmpars
+ \l@youtxcv=\l@youtxco % X coord for stock height
+ \divide\l@youtxcv by \tw@ % 1/2 stock/paper left edges
+ \else
+ \l@youtxcv=\l@youtxco % X coord for stock height
+ \advance\l@youtxcv by \l@youtpw % plus page width
+ \advance\l@youtxcv by \l@youthpi % plus trimedge
+ \fi
+ \fi
+ %% do stockheight
+ \put(\l@youtxcv,0){\vector(0,1){\l@youtvdo}}
+ \put(\l@youtxcv,0){\vector(0,-1){0}}
+ \put(\l@youtxcv,\l@youtvdo){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,-\l@youtvdviii){\l@ypcmd{stockheight}}
+ \end{picture}}
+%% X coord for paper height
+ \ifoddpagelayout
+ \ifl@yrightmpars
+ \l@youtxcv=\l@youtxco % X coord for paper height
+ \advance\l@youtxcv by \l@youtxcii % plus left edge of text
+ \divide\l@youtxcv by \tw@
+ \else
+ \l@youtxcv=\l@youtxco % X coord for paper height
+ \advance\l@youtxcv by \l@youtpw % plus page width
+ \advance\l@youtxcv by \l@youtxcii % plus left edge of text
+ \advance\l@youtxcv by \l@youthpii % plus text width
+ \divide\l@youtxcv by \tw@
+ \fi
+ \else
+ \ifl@yrightmpars
+ \l@youtxcv=\l@youtxco % X coord for paper height
+ \advance\l@youtxcv by \l@youtxcii % plus left edge of text
+ \divide\l@youtxcv by \tw@
+ \else
+ \l@youtxcv=\l@youtxco % X coord for paper height
+ \advance\l@youtxcv by \l@youtpw % plus page width
+ \advance\l@youtxcv by \l@youtxcii % plus left edge of text
+ \advance\l@youtxcv by \l@youthpii % plus text width
+ \divide\l@youtxcv by \tw@
+ \fi
+ \fi
+ %% do paperheight
+ \put(\l@youtxcv,\l@youtyco){\vector(0,1){\l@youtph}}
+ \put(\l@youtxcv,\l@youtyco){\vector(0,-1){0}}
+ \put(\l@youtxcv,\l@youtycv){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,-\l@youtvdviii){\l@ypcmd{paperheight}}
+ \end{picture}}
+
+ \l@youtvpiii=\l@youtycii % Y coord for low dimensions
+ \advance\l@youtvpiii by \l@youtvdiii
+ \l@youtvpiv=\l@youtvpiii % Y coord for mid dimensions
+ \advance\l@youtvpiv by \l@youtvdiii
+ \l@youtvdi=\l@youtvpv % Y coord for top dimensions
+ \multiply\l@youtvdi by \tw@ % 2/3 of text height
+ \divide\l@youtvdi by 3\relax
+ \advance\l@youtvdi by \l@youtycii
+ \ifdrawmarginpars
+ %% do marginparwidth
+ \put(\l@youtxciv,\l@youtvpiii){\vector(1,0){\l@youthpvii}}
+ \put(\l@youtxciv,\l@youtvpiii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{marginparwidth}}
+ \end{picture}}
+ \fi
+ \ifoddpagelayout
+ %% do spinemargin
+ \put(\l@youtxco,\l@youtvdi){\vector(1,0){\l@youthpv}}
+ \put(\l@youtxco,\l@youtvdi){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{spinemargin}}
+ \end{picture}}
+ %% do trimedge
+ \put(\l@youthdo,\l@youtyciv){\vector(-1,0){\l@youthpi}}
+ \put(\l@youthdo,\l@youtyciv){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(-\l@youtvdviii,\l@youtvdviii){\l@ypcmd{trimedge}}
+ \end{picture}}
+ \else
+ \l@youtxcv=\l@youtxcii % X coord of right edge of text
+ \advance\l@youtxcv by \l@youthpii
+ %% do spinemargin
+ \put(\l@youtxcv,\l@youtvdi){\line(1,0){\l@youthpv}}
+ \put(\l@youtxcv,\l@youtvdi){\vector(-1,0){0}}
+ \put(\l@youtxcv,\l@youtvdi){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{spinemargin}}
+ \end{picture}}
+ %% do trimedge
+ \put(0,\l@youtyciv){\vector(1,0){\l@youthpi}}
+ \put(0,\l@youtyciv){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{trimedge}}
+ \end{picture}}
+ \fi
+ %% marginal elements
+ \ifdrawmarginpars
+ %% do marginparsep
+ \ifl@yrightmpars
+ \put(\l@youtxciv,\l@youtvpiv){\line(-1,0){\l@youthpvi}}
+ \put(\l@youtxciv,\l@youtvpiv){\vector(1,0){0}}
+ \put(\l@youtxciv,\l@youtvpiv){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(-\l@youtvdviii,\l@youtvdviii){\l@ypcmd{marginparsep}}
+ \end{picture}}
+ \else
+ \put(\l@youtxcii,\l@youtvpiv){\vector(-1,0){\l@youthpvi}}
+ \put(\l@youtxcii,\l@youtvpiv){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(-\l@youtvdviii,\l@youtvdviii){\l@ypcmd{marginparsep}}
+ \end{picture}}
+ \fi
+ \fi
+
+ \l@youtxcv=\l@youtxcii % X coord for mid textwidth
+ \multiply\l@youtxcv by \tw@
+ \advance\l@youtxcv by \l@youthpii
+ \divide\l@youtxcv by \tw@
+ %% do textwidth
+ \put(\l@youtxcii,\l@youtyciii){\vector(1,0){\l@youthpii}}
+ \put(\l@youtxcii,\l@youtyciii){\vector(-1,0){0}}
+ \put(\l@youtxcv,\l@youtyciii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{textwidth}}
+ \end{picture}}
+ \iftwocolumnlayout
+ %% do columnsep
+ \put(\l@youtxciii,\l@youtvdi){\vector(-1,0){\l@youthpiii}}
+ \put(\l@youtxciii,\l@youtvdi){\vector(1,0){0}}
+ \put(\l@youtxciii,\l@youtvdi){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(-\l@youtvdviii,\l@youtvdviii){\l@ypcmd{columnsep}}
+ \end{picture}}
+ \fi
+
+ \l@youtxcv=\l@youthdo % X coord of middle of picture
+ \divide\l@youtxcv by \tw@
+ %% do stockwidth
+ \l@youtvpiii=\l@youtyco % Y coord for stockwidth
+ \divide\l@youtvpiii by 3\relax
+ \put(0,\l@youtvpiii){\vector(1,0){\l@youthdo}}
+ \put(0,\l@youtvpiii){\vector(-1,0){0}}
+ \put(\l@youtxcv,\l@youtvpiii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{stockwidth}}
+ \end{picture}}
+ %% do paperwidth
+ \l@youtvpiii=\l@youtyci % Y coord for paperwidth
+ \advance\l@youtvpiii by -\l@youtyco
+ \multiply\l@youtvpiii by 3\relax
+ \divide\l@youtvpiii by 10\relax
+ \advance\l@youtvpiii by \l@youtyco
+ \put(\l@youtxco,\l@youtvpiii){\vector(1,0){\l@youtpw}}
+ \put(\l@youtxco,\l@youtvpiii){\vector(-1,0){0}}
+ \put(\l@youtxcv,\l@youtvpiii){\begin{picture}(\l@youtvdviii,\l@youtvdviii)
+ \put(\l@youtvdviii,\l@youtvdviii){\l@ypcmd{paperwidth}}
+ \end{picture}}
+ \fi
+% \end{macrocode}
+% Have finished drawing the parameters.
+% \begin{macrocode}
+ \end{picture}
+ \end{center}
+ \setlength{\unitlength}{1pt}
+
+ \testprintparameters
+ \ifl@ytempif
+% \end{macrocode}
+% Print the actual parameter values.
+% \begin{macrocode}
+ \begin{center}
+ \begin{footnotesize}
+ Lengths are to the nearest pt. \\
+ \begin{ttfamily}
+ \begin{tabular}{l@{\hspace{20pt}}l}
+ \l@ycmd{stockheight} = \number\l@youtvdo pt &
+ \l@ycmd{stockwidth} = \number\l@youthdo pt \\
+ \l@ycmd{pageheight} = \number\l@youtph pt &
+ \l@ycmd{pagewidth} = \number\l@youtpw pt \\
+ \l@ycmd{textheight} = \number\l@youtvpv pt &
+ \l@ycmd{textwidth} = \number\l@youthpii pt \\
+ \l@ycmd{trimtop} = \number\l@youtvpi pt &
+ \l@ycmd{trimedge} = \number\l@youthpi pt \\
+ \l@ycmd{uppermargin} = \number\l@youtvpii pt &
+ \l@ycmd{spinemargin} = \number\l@youthpv pt \\
+ \l@ycmd{headheight} = \number\l@youtvpiii pt &
+ \l@ycmd{headsep} = \number\l@youtvpiv pt \\
+ \l@ycmd{footskip} = \number\l@youtvpvi pt &
+ \l@ycmd{marginparsep} = \number\l@youthpvi pt \\
+ \l@ycmd{marginparpush} = \number\l@youtvpvii pt &
+ \l@ycmd{columnsep} = \number\l@youthpiii pt \\
+ \l@ycmd{columnseprule} = \the\l@youtlinethick & \\
+ \end{tabular}
+ \end{ttfamily}\end{footnotesize}
+ \end{center}
+ \fi
+% \end{macrocode}
+% The end of the definition for |\drawstock|.
+% \begin{macrocode}
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\stockdiagram}
+% \begin{macro}{\stockdesign}
+% Shorthands.
+% \begin{macrocode}
+\newcommand{\stockdiagram}{\drawparameterstrue\drawstock}
+\newcommand{\stockdesign}{\drawparametersfalse\drawstock}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\stockvalues}
+% This macro produces a table of the current page layout actual values.
+% \begin{macrocode}
+\newcommand{\stockvalues}{%
+%% \begin{center}
+ \ifprintheadings
+ Actual stock page layout values.\\[\baselineskip]
+ \fi
+ \begingroup
+ \l@yvalsize
+ \begin{tabular}{l@{\hspace{20pt}}l}
+ \l@ycmd{stockheight} = \l@yval{\stockheight} &
+ \l@ycmd{stockwidth} = \l@yval{\stockwidth} \\
+ \l@ycmd{paperheight} = \l@yval{\paperheight} &
+ \l@ycmd{paperwidth} = \l@yval{\paperwidth} \\
+ \l@ycmd{textheight} = \l@yval{\textheight} &
+ \l@ycmd{textwidth} = \l@yval{\textwidth} \\
+ \l@ycmd{trimtop} = \l@yval{\trimtop} &
+ \l@ycmd{trimedge} = \l@yval{\trimedge} \\
+ \l@ycmd{uppermargin} = \l@yval{\uppermargin} &
+ \l@ycmd{spinemargin} = \l@yval{\spinemargin} \\
+ \l@ycmd{headheight} = \l@yval{\headheight} &
+ \l@ycmd{headsep} = \l@yval{\headsep} \\
+ \l@ycmd{footskip} = \l@yval{\footskip} &
+ \l@ycmd{marginparsep} = \l@yval{\marginparsep} \\
+ \l@ycmd{marginparpush} = \l@yval{\marginparpush} &
+ \l@ycmd{columnsep} = \l@yval{\columnsep} \\
+ \l@ycmd{columnseprule} = \l@yval{\columnseprule} & \\
+ 1em = \l@yval{\l@yonem} & 1ex = \l@yval{\l@yonex} \\
+ \end{tabular}
+ \endgroup
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Drawing the layout of a list}
+%
+% We provide a facility for drawing the layout of a \LaTeX{} \Lenv{list}
+% environment.
+%
+% First the |\try...| commands for setting trial list parameters.
+%
+% \begin{macro}{\tryitemindent}
+% Sets a trial value for |itemindent| and stores the result in |\l@youthpi|.
+% \begin{macrocode}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%% LIST LAYOUT
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newcommand{\tryitemindent}[1]{\l@yltoc{#1}{\l@youthpi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trylabelwidth}
+% Sets a trial value for |labelwidth| and stores the result in |\l@youthpii|.
+% \begin{macrocode}
+\newcommand{\trylabelwidth}[1]{\l@yltoc{#1}{\l@youthpii}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trylabelsep}
+% Sets a trial value for |labelsep| and stores the result in |\l@youthpiii|.
+% \begin{macrocode}
+\newcommand{\trylabelsep}[1]{\l@yltoc{#1}{\l@youthpiii}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryleftmargin}
+% Sets a trial value for |leftmargin| and stores the result in |\l@youthpiv|.
+% \begin{macrocode}
+\newcommand{\tryleftmargin}[1]{\l@yltoc{#1}{\l@youthpiv}
+% \end{macrocode}
+% But the left margin must not be less than zero.
+% \begin{macrocode}
+ \ifnum\l@youthpiv < \z@
+ \l@youthpiv = \z@
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryrightmargin}
+% Sets a trial value for |rightmargin| and stores the result in |\l@youthpv|.
+% \begin{macrocode}
+\newcommand{\tryrightmargin}[1]{\l@yltoc{#1}{\l@youthpv}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trylistparindent}
+% Sets a trial value for |listparindent| and stores the result in |\l@youthpvi|.
+% \begin{macrocode}
+\newcommand{\trylistparindent}[1]{\l@yltoc{#1}{\l@youthpvi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trytopsep}
+% Sets a trial value for |topsep| and stores the result in |\l@youtvpi|.
+% \begin{macrocode}
+\newcommand{\trytopsep}[1]{\l@yltoc{#1}{\l@youtvpi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryparskip}
+% Sets a trial value for |parskip| and stores the result in |\l@youtparskip|.
+% \begin{macrocode}
+\newcommand{\tryparskip}[1]{\l@yltoc{#1}{\l@youtparskip}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trypartopsep}
+% Sets a trial value for |partopsep| and stores the result in |\l@youtvpiii|.
+% \begin{macrocode}
+\newcommand{\trypartopsep}[1]{\l@yltoc{#1}{\l@youtvpiii}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryparsep}
+% Sets a trial value for |parsep| and stores the result in |\l@youtvpiv|.
+% \begin{macrocode}
+\newcommand{\tryparsep}[1]{\l@yltoc{#1}{\l@youtvpiv}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryitemsep}
+% Sets a trial value for |itemsep| and stores the result in |\l@youtvpv|.
+% \begin{macrocode}
+\newcommand{\tryitemsep}[1]{\l@yltoc{#1}{\l@youtvpv}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\currentlist}
+% This routine sets the trial list parameters to be those of the current
+% list environment.
+% \begin{macrocode}
+\newcommand{\currentlist}{%
+ \tryitemindent{\itemindent} % typically 0pt
+ \trylabelwidth{\labelwidth} % typically pt
+ \trylabelsep{\labelsep} % typically 0.5em
+ \tryleftmargin{\leftmargin} % typically pt
+ \tryrightmargin{\rightmargin} % typically pt
+ \trylistparindent{\listparindent} % typically 0pt
+ \trytopsep{\topsep} % typically pt
+ \tryparskip{\l@ysetupparskip} % typically pt
+ \trypartopsep{\partopsep} % typically pt
+ \tryparsep{\parsep} % typically pt
+ \tryitemsep{\itemsep} % typically pt
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\drawlist}
+% This routine draws the layout of a \Lenv{list} environment.
+% \begin{macrocode}
+\newcommand{\drawlist}{%
+% \end{macrocode}
+% First set some some default vertical and horizontal dimensions.
+% \begin{macrocode}
+ \l@youthdo=\l@yoneinch\relax
+ \l@youtvdo=\l@yoneinch\relax
+ \multiply\l@youtvdo by 12\relax
+ \divide\l@youtvdo by 10\relax
+ \l@youthdi=\l@yeighthalfinch\relax % major textwidth
+ \ifdrawparameters
+% \end{macrocode}
+% When |drawparameters| is TRUE, we draw a generic layout showing the
+% controlling layout variables.
+% \begin{macrocode}
+ \l@youthpi=60\relax % itemindent
+ \l@youthpii=80\relax % labelwidth
+ \l@youthpiii=\l@youthpi % labelsep
+ \divide\l@youthpiii by \tw@
+ \l@youthpiv=\l@youthpi % leftmargin
+ \advance\l@youthpiv by \l@youthpii
+ \advance\l@youthpiv by \l@youthpiii
+ \l@youthpv=\l@youthpiv % rightmargin
+ \multiply\l@youthpv by \tw@
+ \divide\l@youthpv by \thr@@
+ \l@youthpvi=\l@youthpi % listparindent
+ \multiply\l@youthpvi by 4\relax
+ \divide\l@youthpvi by \thr@@
+ \l@youtvpi=40\relax % topsep
+ \l@youtparskip=\l@youtvpi % parskip
+ \l@youtvpiii=\l@youtvpi % partopsep
+ \l@youtvpiv=\l@youtvpi % parsep
+ \l@youtvpv=\l@youtvpi % itemsep
+ \fi
+% \end{macrocode}
+% Finished with the set up for drawing parameters. Continue calculating
+% other dimensions and coordinates.
+% \begin{macrocode}
+ \l@youtvdvii=\l@youtvpi % topsep + parskip (+ partopsep)
+ \advance\l@youtvdvii by \l@youtparskip
+ \iflistaspara
+ \advance\l@youtvdvii by \l@youtvpiii
+ \fi
+ \l@youtvdvi=\l@youtvpv % itemsep + parsep
+ \advance\l@youtvdvi by \l@youtvpiv
+ \l@youtyci=\l@yoneinch\relax % Y coord of base of item 2
+ \advance\l@youtyci by \l@youtvdvii
+ \l@youtxci=\z@ % X coord of LH list text
+ \advance\l@youtxci by \l@youthpiv
+ \l@youthdii=\l@youthdi % major width of item text
+ \advance\l@youthdii by -\l@youthpiv
+ \advance\l@youthdii by -\l@youthpv
+ \l@youthdiii=\l@youthpi % inset of labelled list line
+ \l@youtvdii=\l@youtvdo % vertical dim of short inset line
+ \divide\l@youtvdii by 4\relax
+ \l@youthdiv=\l@youthdii % X dim of item 2 box top
+ \advance\l@youthdiv by -\l@youthdiii
+ \l@youtvdi=\l@youtvdo % Y dim of RH item box
+ \advance\l@youtvdi by \l@youtvdii
+ \l@youtvdiii=\l@youtvdii % height of label box
+ \multiply\l@youtvdiii by \thr@@
+ \divide\l@youtvdiii by 4\relax
+ \l@youtxcii=\l@youthdiii % X coord of BL of label box
+ \advance\l@youtxcii by -\l@youthpiii
+ \advance\l@youtxcii by -\l@youthpii
+ \l@youtycii=\l@youtvdi % Y coord of BL of label box
+ \advance\l@youtycii by -\l@youtvdiii
+ \l@youtyciii=\l@youtyci % Y coord of base of para
+ \advance\l@youtyciii by \l@youtvdi
+ \advance\l@youtyciii by \l@youtvdvi
+ \l@youthdv=\l@youthdii % Hor. dim of top of para box
+ \advance\l@youthdv by -\l@youthpvi
+ \l@youtyciv=\l@youtyciii % Y coord of base of item 1
+ \advance\l@youtyciv by \l@youtvdi
+ \advance\l@youtyciv by \l@youtvpiv
+ \l@youtycv=\l@youtyciv % Y coord of base of preceding text
+ \advance\l@youtycv by \l@youtvdi
+ \advance\l@youtycv by \l@youtvdvii
+ \l@youtvdiv=\l@youtycv % Height of picture
+ \advance\l@youtvdiv by \l@yoneinch\relax
+ \l@youtxciii=\l@youtxci % X coord of vertical lines
+ \advance\l@youtxciii by \l@youtxci
+ \advance\l@youtxciii by \l@youthdii
+ \divide\l@youtxciii by \tw@
+ \l@youtycvi=\l@youtvdi % Y coord for margin lines
+ \divide\l@youtycvi by \tw@
+ \l@youtvdv=\l@youtvpiv % small dimension (1/2 parsep)
+ \divide\l@youtvdv by \tw@
+ \l@youtxciv=\l@youtycii % Y coord for labelwidth (note XCIV)
+ \advance\l@youtxciv by \l@youtvdiii
+ \advance\l@youtxciv by \l@youtvdv
+% \end{macrocode}
+%
+% Draw the picture!
+%
+% \begin{macrocode}
+ \begin{center}
+ \setlength{\unitlength}{\l@youtunitlength}
+ \begin{picture}(\l@yeighthalfinch,\l@youtvdiv)
+ \thinlines
+% \end{macrocode}
+% Draw a box |(textwidth,height)| representing the page.
+% \begin{macrocode}
+ \put(0,0){\dashbox{10}(\l@youthdi,\l@youtvdiv){}}
+ \thicklines
+% \end{macrocode}
+% Draw successor text box 1 inch deep.
+% \begin{macrocode}
+ \put(0,0){\framebox(\l@youthdi,\l@yoneinch){\l@ylabelfont Following Text}}
+% \end{macrocode}
+%
+% Draw item box 2
+% \begin{macrocode}
+ \put(\l@youtxci,\l@youtyci){\begin{picture}(\l@youthdii,\l@youtvdi)
+% \end{macrocode}
+% The LH horizontal and vertical lines.
+% \begin{macrocode}
+ \put(0,0){\line(1,0){\l@youthdii}}
+ \put(0,0){\line(0,1){\l@youtvdo}}
+% \end{macrocode}
+% The lines for the inset (which may be positive or negative).
+% \begin{macrocode}
+ \ifnum\l@youthdiii > \z@
+ \put(\l@youthdiii,\l@youtvdo){\line(-1,0){\l@youthdiii}}
+ \else
+ \put(\l@youthdiii,\l@youtvdo){\line(1,0){-\l@youthdiii}}
+ \fi
+ \put(\l@youthdiii,\l@youtvdo){\line(0,1){\l@youtvdii}}
+% \end{macrocode}
+% The top and RH sides. Also add the text.
+% \begin{macrocode}
+ \put(\l@youthdii,\l@youtvdi){\line(0,-1){\l@youtvdi}}
+ \put(\l@youthdii,\l@youtvdi){\line(-1,0){\l@youthdiv}}
+ \put(0,0){\makebox(\l@youthdii,\l@youtvdi){\l@ylabelfont Item 2}}
+% \end{macrocode}
+% Finish off with the label box.
+% \begin{macrocode}
+ \put(\l@youtxcii,\l@youtycii){\framebox(\l@youthpii,\l@youtvdiii){}}
+ \put(\l@youtxcii,\l@youtycii){\makebox(\l@youthpii,\l@youtvdiii)[r]%
+ {\l@ylabelfont Label}}
+ \end{picture}}
+% \end{macrocode}
+%
+% Draw the paragraph box.
+% \begin{macrocode}
+ \put(\l@youtxci,\l@youtyciii){\begin{picture}(\l@youthdii,\l@youtvdi)
+% \end{macrocode}
+% The LH horizontal and vertical lines.
+% \begin{macrocode}
+ \put(0,0){\line(1,0){\l@youthdii}}
+ \put(0,0){\line(0,1){\l@youtvdo}}
+% \end{macrocode}
+% The inset lines.
+% \changes{v2.6a}{2002/12/12}{Added negative test to paragraph box in list layout}
+% \begin{macrocode}
+ \ifnum\l@youthpvi < \z@
+ \put(\l@youthpvi,\l@youtvdo){\line(1,0){-\l@youthpvi}}
+ \else
+ \put(\l@youthpvi,\l@youtvdo){\line(-1,0){\l@youthpvi}}
+ \fi
+ \put(\l@youthpvi,\l@youtvdo){\line(0,1){\l@youtvdii}}
+% \end{macrocode}
+% The top and RH side lines. Also the text.
+% \begin{macrocode}
+ \put(\l@youthdii,\l@youtvdi){\line(0,-1){\l@youtvdi}}
+ \put(\l@youthdii,\l@youtvdi){\line(-1,0){\l@youthdv}}
+ \put(0,0){\makebox(\l@youthdii,\l@youtvdi){\l@ylabelfont Item 1, Paragraph 2}}
+ \testdrawdimensions
+ \ifl@ytempif
+% \end{macrocode}
+% Add in the dimensions if asked for. First the |listparindent|.
+% \begin{macrocode}
+ \put(0,\l@youtvdi){\vector(1,0){\l@youthpvi}}
+ \put(0,\l@youtvdi){\begin{picture}(\l@youtvdv,\l@youtvdv)
+ \put(0,\l@youtvdv){\l@ypcmd{listparindent}}
+ \end{picture}}
+% \end{macrocode}
+% Then the |leftmargin|.
+% \begin{macrocode}
+ \put(-\l@youthpiv,\l@youtycvi){\vector(1,0){\l@youthpiv}}
+ \put(-\l@youthpiv,\l@youtycvi){\begin{picture}(\l@youtvdv,\l@youtvdv)
+ \put(\l@youtvdv,\l@youtvdv){\l@ypcmd{leftmargin}}
+ \end{picture}}
+% \end{macrocode}
+% And finally the |rightmargin|.
+% \begin{macrocode}
+ \ifnum\l@youthpv < \z@
+ \put(\l@youthdii,\l@youtycvi){\line(-1,0){-\l@youthpv}}
+ \else
+ \put(\l@youthdii,\l@youtycvi){\line(1,0){\l@youthpv}}
+ \fi
+ \put(\l@youthdii,\l@youtycvi){\vector(-1,0){0}}
+ \put(\l@youthdii,\l@youtycvi){\begin{picture}(\l@youtvdv,\l@youtvdv)
+ \put(\l@youtvdv,\l@youtvdv){\l@ypcmd{rightmargin}}
+ \end{picture}}
+ \fi
+ \end{picture}}
+% \end{macrocode}
+%
+% Draw item box 1. This is very similar to drawing item box 2.
+% \begin{macrocode}
+ \put(\l@youtxci,\l@youtyciv){\begin{picture}(\l@youthdii,\l@youtvdi)
+ \put(0,0){\line(1,0){\l@youthdii}}
+ \put(0,0){\line(0,1){\l@youtvdo}}
+ \ifnum\l@youthdiii > \z@
+ \put(\l@youthdiii,\l@youtvdo){\line(-1,0){\l@youthdiii}}
+ \else
+ \put(\l@youthdiii,\l@youtvdo){\line(1,0){-\l@youthdiii}}
+ \fi
+ \put(\l@youthdiii,\l@youtvdo){\line(0,1){\l@youtvdii}}
+ \put(\l@youthdii,\l@youtvdi){\line(0,-1){\l@youtvdi}}
+ \put(\l@youthdii,\l@youtvdi){\line(-1,0){\l@youthdiv}}
+ \put(0,0){\makebox(\l@youthdii,\l@youtvdi){\l@ylabelfont Item 1}}
+ \put(\l@youtxcii,\l@youtycii){\framebox(\l@youthpii,\l@youtvdiii){}}
+ \put(\l@youtxcii,\l@youtycii){\makebox(\l@youthpii,\l@youtvdiii)[r]%
+ {\l@ylabelfont Label}}
+%% \ifdrawparameters
+ \testdrawdimensions
+ \ifl@ytempif
+% \end{macrocode}
+%
+% Howevever, if requested, dimensions are drawn for item box 1.
+% First, for |itemindent|.
+% \begin{macrocode}
+ \ifnum\l@youthpi > \z@
+ \put(0,\l@youtycvi){\vector(1,0){\l@youthpi}}
+ \else
+ \put(0,\l@youtycvi){\vector(-1,0){-\l@youthpi}}
+ \fi
+ \put(0,\l@youtycvi){\begin{picture}(\l@youtvdv,\l@youtvdv)
+ \put(0,-\l@youtvdv){\l@ypcmd{itemindent}}
+ \end{picture}}
+% \end{macrocode}
+% Then for |labelsep|.
+% \begin{macrocode}
+ \put(\l@youthdiii,\l@youtvdi){\vector(-1,0){\l@youthpiii}}
+ \put(\l@youthdiii,\l@youtvdi){\begin{picture}(\l@youtvdv,\l@youtvdv)
+ \put(0,\l@youtvdv){\l@ypcmd{labelsep}}
+ \end{picture}}
+% \end{macrocode}
+% And finish up with |labelwidth|.
+% \begin{macrocode}
+ \put(\l@youtxcii,\l@youtxciv){\line(1,0){\l@youthpii}}
+ \put(\l@youtxcii,\l@youtxciv){\vector(-1,0){0}}
+ \put(\l@youtxcii,\l@youtxciv){\begin{picture}(\l@youtvdv,\l@youtvdv)
+ \put(0,\l@youtvdv){\l@ypcmd{labelwidth}}
+ \end{picture}}
+ \fi
+ \end{picture}}
+% \end{macrocode}
+%
+% Draw the predeccessor text box 1 inch deep.
+% \begin{macrocode}
+ \put(0,\l@youtycv){\framebox(\l@youthdi,\l@yoneinch){\l@ylabelfont Preceding Text}}
+%% \ifdrawparameters
+ \testdrawdimensions
+ \ifl@ytempif
+% \end{macrocode}
+%
+% We finish off the drawing with any requested vertical spacing parameters.
+% First between item2 and the suceeding text.
+% \begin{macrocode}
+ \put(\l@youtxciii,\l@youtyci){\vector(0,-1){\l@youtvdvii}}
+ \put(\l@youtxciii,\l@youtyci){\begin{picture}(\l@youtvdv,\l@youtvdv)
+ \put(\l@youtvdv,-\l@youtvdv){%
+ \l@yparamfont\texttt{\bs topsep + \bs parskip [+ \bs partopsep]}}
+ \end{picture}}
+% \end{macrocode}
+% Between item1, paragraph 2 and item 2.
+% \begin{macrocode}
+ \put(\l@youtxciii,\l@youtyciii){\vector(0,-1){\l@youtvdvi}}
+ \put(\l@youtxciii,\l@youtyciii){\begin{picture}(\l@youtvdv,\l@youtvdv)
+ \put(\l@youtvdv,-\l@youtvdv){%
+ \l@yparamfont\texttt{\bs itemsep + \bs parsep}}
+ \end{picture}}
+% \end{macrocode}
+% Between the two paragraphs of item 1.
+% \begin{macrocode}
+ \put(\l@youtxciii,\l@youtyciv){\vector(0,-1){\l@youtvpiv}}
+ \put(\l@youtxciii,\l@youtyciv){\begin{picture}(\l@youtvdv,\l@youtvdv)
+ \put(\l@youtvdv,-\l@youtvdv){\l@ypcmd{parsep}}
+ \end{picture}}
+% \end{macrocode}
+% And finally between the preceding text and item 1.
+% \begin{macrocode}
+ \put(\l@youtxciii,\l@youtycv){\vector(0,-1){\l@youtvdvii}}
+ \put(\l@youtxciii,\l@youtycv){\begin{picture}(\l@youtvdv,\l@youtvdv)
+ \put(\l@youtvdv,-\l@youtvdv){%
+ \l@yparamfont\texttt{\bs topsep + \bs parskip [+ \bs partopsep]}}
+ \end{picture}}
+ \fi
+ \end{picture}
+ \end{center}
+ \setlength{\unitlength}{1pt}
+% \end{macrocode}
+%
+% Last of all, we list the values of the parameters if requested.
+% \begin{macrocode}
+ \testprintparameters
+ \ifl@ytempif
+ \begin{center}
+ \begin{footnotesize}
+ Lengths are to the nearest pt. \\
+ \begin{ttfamily}
+ \begin{tabular}{l@{\hspace{20pt}}l}
+ \l@ycmd{leftmargin} = \number\l@youthpiv pt &
+ \l@ycmd{rightmargin} = \number\l@youthpv pt \\
+ \l@ycmd{itemindent} = \number\l@youthpi pt &
+ \l@ycmd{labelwidth} = \number\l@youthpii pt \\
+ \l@ycmd{labelsep} = \number\l@youthpiii pt &
+ \l@ycmd{listparindent} = \number\l@youthpvi pt \\
+ \l@ycmd{topsep} = \number\l@youtvpi pt &
+ \l@ycmd{parskip} = \number\l@youtparskip pt \\
+ \l@ycmd{partopsep} = \number\l@youtvpiii pt &
+ \l@ycmd{parsep} = \number\l@youtvpiv pt \\
+ \l@ycmd{itemsep} = \number\l@youtvpv pt & \\
+ \end{tabular}
+ \end{ttfamily}\end{footnotesize}
+ \end{center}
+ \fi
+% \end{macrocode}
+% The end of the definition for |\drawlist|.
+% \begin{macrocode}
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\listdiagram}
+% \begin{macro}{\listdesign}
+% Shorthands.
+% \begin{macrocode}
+\newcommand{\listdiagram}{\drawparameterstrue\drawlist}
+\newcommand{\listdesign}{\drawparametersfalse\drawlist}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\listvalues}
+% This macro produces a table of the current list layout actual values.
+% Be careful to get the external environment's values, not those of
+% the centered tabular.
+% \begin{macrocode}
+\newcommand{\listvalues}{%
+ \setlength{\l@ylmarg}{\leftmargin}
+ \setlength{\l@yrmarg}{\rightmargin}
+ \setlength{\l@yitmindent}{\itemindent}
+ \setlength{\l@ylblwidth}{\labelwidth}
+ \setlength{\l@ylblsep}{\labelsep}
+ \setlength{\l@ylparindent}{\listparindent}
+ \setlength{\l@ytsep}{\topsep}
+ \setlength{\l@ypskip}{\parskip}
+ \setlength{\l@yptsep}{\partopsep}
+ \setlength{\l@ypsep}{\parsep}
+ \setlength{\l@yitmsep}{\itemsep}
+ \ifprintheadings
+ Actual list layout values.\\[\baselineskip]
+ \fi
+ \begingroup\l@yvalsize
+ \begin{tabular}{l@{\hspace{20pt}}l}
+ \l@ycmd{leftmargin} = \l@yval{\l@ylmarg} &
+ \l@ycmd{rightmargin} = \l@yval{\l@yrmarg} \\
+ \l@ycmd{itemindent} = \l@yval{\l@yitmindent} &
+ \l@ycmd{labelwidth} = \l@yval{\l@ylblwidth} \\
+ \l@ycmd{labelsep} = \l@yval{\l@ylblsep} &
+ \l@ycmd{listparindent} = \l@yval{\l@ylparindent} \\
+ \l@ycmd{topsep} = \l@yval{\l@ytsep} &
+ \l@ycmd{parskip} = \l@yval{\l@ypskip} \\
+ \l@ycmd{partopsep} = \l@yval{\l@yptsep} &
+ \l@ycmd{parsep} = \l@yval{\l@ypsep} \\
+ \l@ycmd{itemsep} = \l@yval{\l@yitmsep} & \\
+ 1em = \l@yval{\l@yonem} & 1ex = \l@yval{\l@yonex} \\
+ \end{tabular}
+ \endgroup
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \section{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.
+%
+% \begin{macro}{\tryfootins}
+% Sets the trial value for |footins| and stores the result in |\l@youtvpi|.
+% \begin{macrocode}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%% FOOTNOTE LAYOUT
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newcommand{\tryfootins}[1]{\l@yltoc{#1}{\l@youtvpi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryfootnotesep}
+% Sets the trial value for |footnotesep| and stores the result in |\l@youtvpii|.
+% \begin{macrocode}
+\newcommand{\tryfootnotesep}[1]{\l@yltoc{#1}{\l@youtvpii}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryfootnotebaseline}
+% Sets the trial value for |footnotebaseline| and stores the result in |\l@youtvpiii|.
+% \begin{macrocode}
+\newcommand{\tryfootnotebaseline}[1]{\l@yltoc{#1}{\l@youtvpiii}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryfootruleheight}
+% Sets the trial value for |footruleheight| and stores the result in |\l@youtlinethick|.
+% \begin{macrocode}
+\newcommand{\tryfootruleheight}[1]{\setlength{\l@youtlinethick}{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryfootrulefrac}
+% Sets the trial value for |footrulefrac| and stores the result in |\l@youthdvii|.
+% \begin{macrocode}
+\newcommand{\tryfootrulefrac}[1]{\setlength{\l@ylen}{8.5in}
+ \l@ytok={#1}
+ \l@ylen = #1\l@ylen
+ \l@youthdvii=\l@ylen
+ \divide\l@youthdvii by \l@yonepoint}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\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.
+% \begin{macrocode}
+\newcommand{\currentfootnote}{%
+ \tryfootins{\skip\footins}
+ \tryfootnotesep{\footnotesep}
+ \tryfootnotebaseline{10pt}
+ \tryfootruleheight{0.4pt}
+ \tryfootrulefrac{0.25}
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\drawfootnote}
+%
+% This routine draws the layout of a footnote.
+% \begin{macrocode}
+\newcommand{\drawfootnote}{%
+% \end{macrocode}
+% Set some default values.
+% \begin{macrocode}
+ \l@youtvdo=4\relax % vertical scale factor
+ \l@youthdi=\l@yeighthalfinch\relax % textwidth
+ \l@youtvdi=\l@yoneinch\relax % small height of note box
+ \ifdrawparameters
+% \end{macrocode}
+% When |drawparameters| is TRUE we use a generic layout. Set the dimensions
+% and coordinates.
+% \begin{macrocode}
+ \l@youtvpi=20\relax % \skip\footins
+ \l@youtvpii=30\relax % footenotesep
+ \l@youtvpiii=10\relax % footnote baseline
+ \setlength{\l@youtlinethick}{0.4pt} % rule thickness
+ \l@youthdvii=\l@yeighthalfinch\relax % rule length
+ \multiply\l@youthdvii by 4\relax
+ \divide\l@youthdvii by 10\relax
+ \l@youtvdii=\l@youtvpiii % vertical box inset
+ \multiply\l@youtvdii by \l@youtvdo
+ \else
+% \end{macrocode}
+% Continue calculating the drawing parameters.
+% \begin{macrocode}
+ \l@youtvdii=\l@youtvpiii % vertical box inset
+ \multiply\l@youtvdii by \l@youtvdo
+ \multiply\l@youtvdii by 8\relax
+ \divide\l@youtvdii by 10\relax
+ \fi
+ \multiply\l@youtvdii by 3\relax
+ \divide\l@youtvdii by 4\relax
+ \l@youtvdv=\l@youtvpi % Y dim of footins
+ \multiply\l@youtvdv by \l@youtvdo
+ \l@youthdii=\l@youtvdii % horizontal box inset
+ \l@youtvdiii=\l@youtvdi % box height
+ \advance\l@youtvdiii by \l@youthdii
+ \l@youthdiii=\l@youthdi % box top length
+ \advance\l@youthdiii by -\l@youthdii
+ \l@youtvdiv=\l@youtvpii % vertical note spacing
+ \ifnum\l@youtvdiv < \l@youtvpiii
+ \l@youtvdiv=\l@youtvpiii
+ \fi
+ \multiply\l@youtvdiv by \l@youtvdo
+ \l@youtyci=\l@youtvdi % Y coord of 1st box base
+ \advance\l@youtyci by \l@youtvdiv
+ \l@youtycii=\l@youtyci % Y coord of rule
+ \advance\l@youtycii by \l@youtyci
+ \l@youtyciii=\l@youtycii % Y coord of text base
+ \advance\l@youtyciii by \l@youtvdv
+ \l@youtyciv=\l@youtyciii % top of main text box
+ \advance\l@youtyciv by \l@yoneinch\relax
+ \l@youthdiv=\l@youthdvii % length of rule
+ \l@youtvdvi=\l@youtvpiv % height of rule
+ \multiply\l@youtvdvi by \l@youtvdo
+ \l@youthdv=\l@youthdii % small value (1/2 box inset)
+ \divide\l@youthdv by \tw@
+ \l@youthdvi=\l@youthdv % 1/2 l@youthdv
+ \divide\l@youthdvi by \tw@
+% \end{macrocode}
+%
+% Draw the picture!
+% \begin{macrocode}
+ \begin{center}
+ \setlength{\unitlength}{\l@youtunitlength}
+ \begin{picture}(\l@youthdi,\l@youtyciv)
+ \thicklines
+% \end{macrocode}
+% Draw box 2. First the major bottom and LH side lines.
+% \begin{macrocode}
+ \put(0,0){\begin{picture}(\l@youthdi,\l@youtvdiii)
+ \put(0,0){\line(1,0){\l@youthdi}}
+ \put(0,0){\line(0,1){\l@youtvdi}}
+% \end{macrocode}
+% The inset lines
+% \begin{macrocode}
+ \put(\l@youthdii,\l@youtvdi){\line(-1,0){\l@youthdii}}
+ \put(\l@youthdii,\l@youtvdi){\line(0,1){\l@youtvdii}}
+% \end{macrocode}
+% The top and RH side lines.
+% \begin{macrocode}
+ \put(\l@youthdi,\l@youtvdiii){\line(-1,0){\l@youthdiii}}
+ \put(\l@youthdi,\l@youtvdiii){\line(0,-1){\l@youtvdiii}}
+% \end{macrocode}
+% Finish with the marker.
+% \begin{macrocode}
+ \put(\l@youthdv,\l@youtvdiii){\makebox(0,0)[t]{2}}
+ \end{picture}}
+% \end{macrocode}
+% The drawing of box 1 is similar.
+% \begin{macrocode}
+ \put(0,\l@youtyci){\begin{picture}(\l@youthdi,\l@youtvdiii)
+ \put(0,0){\line(1,0){\l@youthdi}}
+ \put(0,0){\line(0,1){\l@youtvdi}}
+ \put(\l@youthdii,\l@youtvdi){\line(-1,0){\l@youthdii}}
+ \put(\l@youthdii,\l@youtvdi){\line(0,1){\l@youtvdii}}
+ \put(\l@youthdi,\l@youtvdiii){\line(-1,0){\l@youthdiii}}
+ \put(\l@youthdi,\l@youtvdiii){\line(0,-1){\l@youtvdiii}}
+ \put(\l@youthdv,\l@youtvdiii){\makebox(0,0)[t]{1}}
+ \end{picture}}
+% \end{macrocode}
+% Draw the rule.
+% \begin{macrocode}
+ \multiply\l@youtlinethick by \l@youtvdo
+ \linethickness{\l@youtlinethick}
+ \put(0,\l@youtycii){\line(1,0){\l@youthdvii}}
+ \thicklines
+% \end{macrocode}
+% Draw the main text box
+% \begin{macrocode}
+ \put(0,\l@youtyciii){\framebox(\l@youthdi,\l@yoneinch){\l@ylabelfont MAIN TEXT}}
+ \testdrawdimensions
+ \ifl@ytempif
+ \thinlines
+% \end{macrocode}
+%
+% We finish off the drawing with spacing parameters, if requested.
+%
+% Bottom |footnotesep|.
+% \begin{macrocode}
+ \put(\l@youthdvi,\l@youtyci){\vector(0,-1){\l@youtvdiv}}
+ \put(\l@youthdvi,\l@youtyci){\begin{picture}(\l@youthdv,\l@youthdv)
+ \put(\l@youthdvi,-\l@youthdv){\l@ypcmd{footnotesep}}
+ \end{picture}}
+% \end{macrocode}
+% Top |footnotesep|.
+% \begin{macrocode}
+ \put(\l@youthdvi,\l@youtycii){\vector(0,-1){\l@youtvdiv}}
+ \put(\l@youthdvi,\l@youtycii){\begin{picture}(\l@youthdv,\l@youthdv)
+ \put(\l@youthdvi,-\l@youthdv){\l@ypcmd{footnotesep}}
+ \end{picture}}
+% \end{macrocode}
+% The |\skip\footins|.
+% \begin{macrocode}
+ \put(\l@youthdii,\l@youtyciii){\vector(0,-1){\l@youtvdv}}
+ \put(\l@youthdii,\l@youtyciii){\begin{picture}(\l@youthdv,\l@youthdv)
+ \put(\l@youthdvi,-\l@youthdv){\l@ypcmd{skip}\l@ypcmd{footins}}
+ \end{picture}}
+% \end{macrocode}
+% The rule.
+% \begin{macrocode}
+ \put(\l@youthdiv,\l@youtycii){\begin{picture}(\l@youthdv,\l@youthdv)
+ \put(\l@youthdv,0){\l@ypcmd{footnoterule}}
+ \end{picture}}
+ \fi
+% \end{macrocode}
+% Finish off the picture.
+% \begin{macrocode}
+ \end{picture}
+ \end{center}
+ \setlength{\unitlength}{1pt}
+% \end{macrocode}
+%
+% Print the value table if appropriate.
+% \begin{macrocode}
+ \testprintparameters
+ \ifl@ytempif
+ \begin{center}
+ \begin{footnotesize}
+ Lengths are to the nearest pt. \\
+ \begin{ttfamily}
+ \begin{tabular}{l@{\hspace{20pt}}l}
+ \l@ycmd{footins} = \number\l@youtvpi pt &
+ \l@ycmd{footnotesep} = \number\l@youtvpii pt \\
+ \l@ycmd{baselineskip} = \number\l@youtvpiii pt &
+ \textrm{note separation} = \number\l@youtvdiv pt \\
+ \textrm{rule thickness} = \the\l@youtlinethick & \\
+ \multicolumn{2}{c}{\textrm{rule length} = \the\l@ytok{} times the \bs textwidth} \\
+ \end{tabular}
+ \end{ttfamily}\end{footnotesize}
+ \end{center}
+ \fi
+% \end{macrocode}
+% The end of the definition of |\drawfootnote|.
+% \begin{macrocode}
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\footnotediagram}
+% \begin{macro}{\footnotedesign}
+% Shorthands.
+% \begin{macrocode}
+\newcommand{\footnotediagram}{\drawparameterstrue\drawfootnote}
+\newcommand{\footnotedesign}{\drawparametersfalse\drawfootnote}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\footnotevalues}
+% This macro produces a table of the current footnote layout actual values.
+% \begin{macrocode}
+\newcommand{\footnotevalues}{%
+ \setlength{\l@ylen}{\columnwidth}
+ \l@ylen = .4\l@ylen
+ \ifprintheadings
+ Actual footnote layout values.\\[\baselineskip]
+ \fi
+ \begingroup\l@yvalsize
+ \begin{tabular}{l@{\hspace{20pt}}l}
+ \l@ycmd{footins} = \l@yval{\skip\footins} &
+ \l@ycmd{footnotesep} = \l@yval{\footnotesep} \\
+ rule thickness = ?? &
+ rule length = ?? \\
+ 1em = \l@yval{\l@yonem} & 1ex = \l@yval{\l@yonex} \\
+ \end{tabular}
+ \endgroup
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \section{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.
+%
+% \begin{macro}{\tryparindent}
+% Sets the trial value for |\parindent| and stores the result in |\l@youthdii|.
+% \begin{macrocode}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%% PARAGRAPH LAYOUT
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newcommand{\tryparindent}[1]{\l@yltoc{#1}{\l@youthdii}}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\tryparlinewidth}
+% Sets the trial value for |\linewidth| and stores the result in |\l@youthdi|.
+% \begin{macrocode}
+\newcommand{\tryparlinewidth}[1]{\l@yltoc{#1}{\l@youthdi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryparbaselineskip}
+% Sets the trial value for |\baselineskip| and stores the result in |\l@youtvdii|.
+% \begin{macrocode}
+\newcommand{\tryparbaselineskip}[1]{\l@yltoc{#1}{\l@youtvdii}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\currentparagraph}
+%
+% This routine sets the trial paragraph parameters to be those specified
+% for the current document.
+% \begin{macrocode}
+\newcommand{\currentparagraph}{%
+ \tryparindent{\parindent}
+ \tryparskip{\parskip}
+ \tryparlinewidth{\linewidth}
+ \tryparbaselineskip{\baselineskip}
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\drawparagraph}
+%
+% This routine draws the layout of a paragraph.
+% \begin{macrocode}
+\newcommand{\drawparagraph}{%
+% \end{macrocode}
+% Set some default values.
+% \begin{macrocode}
+ \l@youtvdi=\l@yoneinch\relax % height of bottom of inset box
+ \ifdrawparameters
+% \end{macrocode}
+% When |drawparameters| is TRUE we use a generic layout. Set the dimensions
+% and coordinates.
+% \begin{macrocode}
+ \l@youtvdii=15\relax % \baselineskip
+ \l@youthdii=40\relax % \parindent
+ \l@youtparskip=30\relax % \parskip
+ \l@youthdi=\l@yeighthalfinch\relax % linewidth
+ \fi
+% \end{macrocode}
+% Continue calculating the drawing parameters.
+% \begin{macrocode}
+ \l@youtvdiii=\l@youtvdi % total height of para box
+ \advance\l@youtvdiii by \l@youtvdii
+ \l@youtvdiv=\l@youtvdiii % bottom of Preceding box
+ \advance\l@youtvdiv by \l@youtparskip
+ \l@youtvdv=\l@youtvdiv % total picture height
+ \advance\l@youtvdv by \l@yoneinch\relax
+ \l@youthdiii=\l@youthdi % length of top of para box
+ \advance\l@youthdiii by -\l@youthdii
+ \l@youtxci=\l@youthdi % x coord of middle of picture
+ \divide\l@youtxci by \tw@
+ \l@youthdv=10\relax % small value
+ \l@youthdvi=5\relax % 1/2 l@youthdv
+% \end{macrocode}
+%
+% Draw the picture!
+% \begin{macrocode}
+ \begin{center}
+ \setlength{\unitlength}{\l@youtunitlength}
+ \begin{picture}(\l@youthdi,\l@youtvdv)
+ \thicklines
+% \end{macrocode}
+% Draw paragraph box. First the major bottom and LH side lines.
+% \begin{macrocode}
+ \put(0,0){\begin{picture}(\l@youthdi,\l@youtvdiii)
+ \put(0,0){\line(1,0){\l@youthdi}}
+ \put(0,0){\line(0,1){\l@youtvdi}}
+% \end{macrocode}
+% The inset lines
+% \begin{macrocode}
+ \ifnum\l@youthdii < \z@
+ \l@youthdv=-\l@youthdii
+ \put(\l@youthdii,\l@youtvdi){\line(1,0){\l@youthdv}}
+ \else
+ \put(\l@youthdii,\l@youtvdi){\line(-1,0){\l@youthdii}}
+ \fi
+ \put(\l@youthdii,\l@youtvdi){\line(0,1){\l@youtvdii}}
+% \end{macrocode}
+% The top and RH side lines.
+% \begin{macrocode}
+ \put(\l@youthdi,\l@youtvdiii){\line(-1,0){\l@youthdiii}}
+ \put(\l@youthdi,\l@youtvdiii){\line(0,-1){\l@youtvdiii}}
+ \end{picture}}
+% \end{macrocode}
+% Now for the top box.
+% \begin{macrocode}
+ \put(0,\l@youtvdiv){\framebox(\l@youthdi,\l@yoneinch){\l@ylabelfont Preceding Text}}
+% \end{macrocode}
+% Finished the main drawing.
+% \begin{macrocode}
+ \testdrawdimensions
+ \ifl@ytempif
+ \thinlines
+% \end{macrocode}
+%
+% We finish off the drawing with spacing parameters, if requested.
+% \changes{v2.5}{2001/10/21}{Changed test for paragraph dimensions}
+% The |\parskip|.
+% \begin{macrocode}
+ \put(\l@youtxci,\l@youtvdiv){\begin{picture}(\l@youthdv,\l@youthdv)
+ \put(0,0){\vector(0,-1){\l@youtparskip}}
+ \put(\l@youthdvi,-\l@youthdv){\l@ypcmd{parskip}}
+ \end{picture}}
+% \end{macrocode}
+% The |\parindent|.
+% \begin{macrocode}
+ \put(0,\l@youtvdiii){\begin{picture}(\l@youthdv,\l@youthdv)
+ \ifnum\l@youthdii < \z@
+ \put(0,0){\vector(-1,0){-\l@youthdii}}
+ \put(0,0){\vector(1,0){0}}
+ \else
+ \put(0,0){\vector(1,0){\l@youthdii}}
+ \fi
+ \put(0,\l@youthdv){\l@ypcmd{parindent}}
+ \end{picture}}
+ \fi
+% \end{macrocode}
+% Finish off the picture.
+% \begin{macrocode}
+ \end{picture}
+ \end{center}
+ \setlength{\unitlength}{1pt}
+% \end{macrocode}
+%
+% Print the value table if appropriate.
+% \changes{v2.5}{2001/10/21}{Changed test for paragraph value table}
+% \begin{macrocode}
+ \testprintparameters
+ \ifl@ytempif
+ \begin{center}
+ \begin{footnotesize}
+ Lengths are to the nearest pt. \\
+ \begin{ttfamily}
+ \begin{tabular}{l@{\hspace{20pt}}l}
+ \l@ycmd{parindent} = \number\l@youthdii pt &
+ \l@ycmd{parskip} = \number\l@youtparskip pt \\
+ \l@ycmd{baselineskip} = \number\l@youtvdii pt &
+ \l@ycmd{linewidth} = \number\l@youthdi pt \\
+ \end{tabular}
+ \end{ttfamily}\end{footnotesize}
+ \end{center}
+ \fi
+% \end{macrocode}
+% The end of the definition of |\drawparagraph|.
+% \begin{macrocode}
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
+% \begin{macro}{\paragraphdiagram}
+% \begin{macro}{\paragraphdesign}
+% Shorthands.
+% \begin{macrocode}
+\newcommand{\paragraphdiagram}{\drawparameterstrue\drawparagraph}
+\newcommand{\paragraphdesign}{\drawparametersfalse\drawparagraph}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\paragraphvalues}
+% This macro produces a table of the current paragraph layout actual values.
+% Be careful to get the global, not local, values.
+% \begin{macrocode}
+\newcommand{\paragraphvalues}{%
+ \setlength{\l@ylen}{\parindent}
+ \ifprintheadings
+ Actual paragraph layout values.\\[\baselineskip]
+ \fi
+ \begingroup\l@yvalsize
+ \begin{tabular}{l@{\hspace{20pt}}l}
+ \l@ycmd{parindent} = \l@yval{\l@ylen} &
+ \l@ycmd{parskip} = \l@yval{\l@ysetupparskip} \\
+ \l@ycmd{baselineskip} = \l@yval{\l@ysetupbaselineskip} &
+ \l@ycmd{linewidth} = \l@yval{\linewidth} \\
+ 1em = \l@yval{\l@yonem} & 1ex = \l@yval{\l@yonex} \\
+ \end{tabular}
+ \endgroup
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \section{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.
+%
+% \begin{macro}{\trybeforeskip}
+% Sets the trial value for |beforeskip| and stores the result in |\l@youtvpi|.
+% \begin{macrocode}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%% SECTION HEADING LAYOUT
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newcommand{\trybeforeskip}[1]{\l@yltoc{#1}{\l@youtvpi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryafterskip}
+% Sets the trial value for |afterskip| and stores the result in |\l@youtvpii|.
+% \begin{macrocode}
+\newcommand{\tryafterskip}[1]{\l@yltoc{#1}{\l@youtvpii}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryindent}
+% Sets the trial value for |indent| and stores the result in |\l@youthpi|.
+% \begin{macrocode}
+\newcommand{\tryindent}[1]{\l@yltoc{#1}{\l@youthpi}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\currentheading}
+% This routine sets the trial heading parameters to some predefined
+% values that, hopefully, are reasonably representative.
+% \begin{macrocode}
+\newcommand{\currentheading}{%
+ \trybeforeskip{2\l@ysetupbaselineskip}
+ \tryafterskip{\l@ysetupbaselineskip}
+ \tryindent{2\l@ysetupbaselineskip}
+ \tryparskip{\l@ysetupparskip}
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\drawheading}
+% This routine draws the layout of a sectional heading. The command
+% takes a single parameter, |\drawheading{|\meta{font style}|}|, which
+% specifies the size and style of the heading font. For example, \\
+% |\drawheading{\Large\sffamily}|
+% \begin{macrocode}
+\newcommand{\drawheading}[1]{%
+% \end{macrocode}
+%
+% Some default values first.
+% \begin{macrocode}
+ \l@yltoc{\textwidth}{\l@youthdi} % textwidth
+ \l@yltoc{\baselineskip}{\l@youtvdi} % baselineskip
+ \ifdrawparameters
+% \end{macrocode}
+% When |drawparameters| is TRUE we use a generic layout. Set the dimensions
+% and coordinates.
+% \begin{macrocode}
+ \Huge \l@youtvdii=\baselineskip \normalsize % Heading baselineskip
+ \divide\l@youtvdii by \l@yonepoint
+ \l@yltoc{40pt}{\l@youtvpi} % beforeskip
+ \ifruninhead
+% \end{macrocode}
+% We need different values for the afterskip and indent depending on whether
+% we are drawing a run-in heading or an ordinary one.
+% \begin{macrocode}
+ \l@yltoc{-72pt}{\l@youtvpii} % afterskip
+ \l@yltoc{50pt}{\l@youthpi} % indent
+ \else
+ \l@yltoc{45pt}{\l@youtvpii} % afterskip
+ \l@yltoc{72pt}{\l@youthpi} % indent
+ \fi
+% \end{macrocode}
+% Calculate the width of a sample heading title text.
+% \begin{macrocode}
+ \setbox0 = \hbox{{\Huge 3.5 Heading Title }}
+ \l@yltoc{\wd0}{\l@youthdv} % width of heading text
+ \else
+% \end{macrocode}
+% When |drawparameters| is FALSE, we calculate the heading |baselineskip|
+% and width of the text in the trial font.
+% \begin{macrocode}
+ {#1 \l@youtvdii=\baselineskip\normalfont\normalsize} % heading baselineskip
+ \divide\l@youtvdii by \l@yonepoint
+ \setbox0 = \hbox{{#1 3.5 Heading Title }}
+ \l@yltoc{\wd0}{\l@youthdv} % width of heading text
+ \fi
+% \end{macrocode}
+% Now continue setting all the other drawing lengths and coordinates.
+% \begin{macrocode}
+ \l@youtvdiii=\l@youtvpii % afterskip + parskip + textbaselineskip
+ \advance\l@youtvdiii by \l@youtparskip
+ \advance\l@youtvdiii by \l@youtvdi
+ \l@youtvdiv=\l@youtvpi % beforeskip + parskip + headbaselineskip
+ \ifnum\l@youtvdiv < \z@
+% \end{macrocode}
+% A negative value for the |indent| signals no indentation of the first
+% line of text after the heading.
+% \begin{macrocode}
+ \l@youtvdiv = -\l@youtvdiv
+ \fi
+ \advance\l@youtvdiv by \l@youtparskip
+ \advance\l@youtvdiv by \l@youtvdii
+ \l@youtyci=\l@youtvdi % Y coord of base of after text
+ \l@youtycii=\l@youtyci % Y coord of base of heading text
+ \advance\l@youtycii by \l@youtvdiii
+% \end{macrocode}
+% 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|.
+% \begin{macrocode}
+ \l@youthdiv=\z@ % 0 or abs(-afterskip)
+ \ifnum\l@youtvpii < \z@
+ \l@youthdiv = -\l@youtvpii
+ \l@youtvdiii=\l@youtvdi % textbaselineskip
+ \l@youtxci=\l@youthpi % X coord of end of heading text
+ \advance\l@youtxci by \l@youthdv
+ \l@youtxcii=\l@youtxci % X coord of start of after text
+ \advance\l@youtxcii by \l@youthdiv
+ \l@youtycii=\l@youtvdi % Y coord of base of heading text
+ \fi
+% \end{macrocode}
+% Continue.
+% \begin{macrocode}
+ \l@youtyciii=\l@youtycii % Y coord of base of prior text
+ \advance\l@youtyciii by \l@youtvdiv
+ \l@youtyciv=\l@youtyciii % Y coord of top of prior text
+ \advance\l@youtyciv by \l@youtvdi
+ \l@youtycv=\l@youtyciv % 2*l@youtvdi + l@youtyciv
+ \advance\l@youtycv by \l@youtvdi
+ \advance\l@youtycv by \l@youtvdi
+ \l@youthdii=\l@youtvdi % a small amount
+ \l@youthdiii=\l@youthdii % half a small amount
+ \divide\l@youthdiii by \tw@
+% \end{macrocode}
+%
+% Draw the picture!
+%
+% \begin{macrocode}
+ \begin{center}
+ \setlength{\unitlength}{\l@youtunitlength}
+ \begin{picture}(\l@youthdi,\l@youtycv)
+ \ifnum\l@youtvpii < \z@
+ \put(0,\l@youtyci){\begin{picture}(\l@youthdi,\l@youtyciv)
+% \end{macrocode}
+%
+% When the |afterskip| is negative we have a run-in heading.
+%
+% Draw the bottom text line
+% \begin{macrocode}
+ \put(0,0){\l@ylabelfont second line of text following the heading \ldots}
+% \end{macrocode}
+% Draw the heading
+% \begin{macrocode}
+ \ifdrawparameters
+ \put(\l@youthpi,\l@youtycii){{\Huge 3.5 Heading Title}}
+ \else
+ \put(\l@youthpi,\l@youtycii){{#1 3.5 Heading Title}}
+ \fi
+% \end{macrocode}
+% Draw the first line of text after the heading, and the preceding text line.
+% \begin{macrocode}
+ \put(\l@youtxcii,\l@youtycii){\l@ylabelfont Start of text \ldots}
+ \put(0,\l@youtyciii){\l@ylabelfont \ldots end of last line of preceding text.}
+%% \ifdrawparameters
+ \testdrawdimensions
+ \ifl@ytempif
+% \end{macrocode}
+% Draw the dimensions if required. First the before skips.
+% \begin{macrocode}
+ \put(0,\l@youtyciii){\vector(0,-1){\l@youtvdiv}}
+ \put(0,\l@youtyciii){\begin{picture}(\l@youthdii,\l@youthdii)
+ \put(\l@youthdiii,-\l@youthdii){\makebox(0,0)[tl]%
+ {\l@yparamfont \textit{$\|$beforeskip$\|$} +
+ \l@ypcmd{parskip} (of text font) + \l@ypcmd{baselineskip}
+ (of heading font)}}
+ \end{picture}}
+% \end{macrocode}
+% The indent.
+% \begin{macrocode}
+ \put(0,\l@youtycii){\vector(1,0){\l@youthpi}}
+ \put(0,\l@youtycii){\begin{picture}(\l@youthdii,\l@youthdii)
+ \put(\l@youthdii,\l@youthdiii){\l@yparamfont \textit{indent}}
+ \end{picture}}
+% \end{macrocode}
+% And finish with the negative afterskip
+% \begin{macrocode}
+ \put(\l@youtxci,\l@youtycii){\vector(1,0){\l@youthdiv}}
+ \put(\l@youtxci,\l@youtycii){\begin{picture}(\l@youthdii,\l@youthdii)
+ \put(\l@youthdiii,\l@youthdii){\l@yparamfont \textit{afterskip} ($< 0$)}
+ \end{picture}}
+ \fi
+ \end{picture}}
+ \else
+ \put(0,\l@youtyci){\begin{picture}(\l@youthdi,\l@youtyciv)
+% \end{macrocode}
+% The aftterskip is positive, so we draw a normal heading.
+%
+% Draw the two after heading text lines
+% \begin{macrocode}
+ \put(0,0){\l@ylabelfont second line of text following the heading \ldots}
+ \put(0,\l@youtyci){\l@ylabelfont This is the start of the after-heading text,
+ which continues on \ldots}
+% \end{macrocode}
+% Draw the heading
+% \begin{macrocode}
+ \ifdrawparameters
+ \put(\l@youthpi,\l@youtycii){{\Huge 3.5 Heading Title}}
+ \else
+ \put(\l@youthpi,\l@youtycii){{#1 3.5 Heading Title}}
+ \fi
+% \end{macrocode}
+% Draw the text line preceding the heading.
+% \begin{macrocode}
+ \put(0,\l@youtyciii){\l@ylabelfont \ldots end of last line of preceding text.}
+%% \ifdrawparameters
+ \testdrawdimensions
+ \ifl@ytempif
+% \end{macrocode}
+% Draw the dimensions if required. First the before skips.
+% \begin{macrocode}
+ \put(0,\l@youtyciii){\vector(0,-1){\l@youtvdiv}}
+ \put(0,\l@youtyciii){\begin{picture}(\l@youthdii,\l@youthdii)
+ \put(\l@youthdiii,-\l@youthdii){\makebox(0,0)[tl]%
+ {\l@yparamfont \textit{$\|$beforeskip$\|$} +
+ \l@ypcmd{parskip} (of text font) + \l@ypcmd{baselineskip}
+ (of heading font)}}
+ \end{picture}}
+% \end{macrocode}
+% The indent.
+% \begin{macrocode}
+ \put(0,\l@youtycii){\vector(1,0){\l@youthpi}}
+ \put(0,\l@youtycii){\begin{picture}(\l@youthdii,\l@youthdii)
+ \put(\l@youthdii,\l@youthdiii){\l@yparamfont \textit{indent}}
+ \end{picture}}
+% \end{macrocode}
+% And finish with the afterskips
+% \begin{macrocode}
+ \put(0,\l@youtycii){\vector(0,-1){\l@youtvdiii}}
+ \put(0,\l@youtycii){\begin{picture}(\l@youthdii,\l@youthdii)
+ \put(\l@youthdiii,-\l@youthdii){\makebox(0,0)[tl]%
+ {\l@yparamfont \textit{afterskip} +
+ \l@ypcmd{parskip} (of heading font) + \l@ypcmd{baselineskip}
+ (of text font)}}
+ \end{picture}}
+ \fi
+ \end{picture}}
+ \fi
+% \end{macrocode}
+% Draw rules.
+% \begin{macrocode}
+ \put(0,0){\line(1,0){\l@youthdi}}
+ \put(0,\l@youtycv){\line(1,0){\l@youthdi}}
+ \end{picture}
+ \end{center}
+ \setlength{\unitlength}{1pt}
+%% \ifdrawparameters\else
+ \testprintparameters
+ \ifl@ytempif
+% \end{macrocode}
+% Write out the table of values if required.
+% \begin{macrocode}
+ \begin{center}
+ \begin{footnotesize}
+ Lengths are to the nearest pt. \\
+ \begin{ttfamily}
+ \begin{tabular}{l@{\hspace{20pt}}l}
+ \textit{beforeskip} = \number\l@youtvpi pt &
+ \textit{afterskip} = \number\l@youtvpii pt \\
+ \textit{indent} = \number\l@youthpi pt &
+ \textrm{(heading font)}
+ \l@ycmd{baselineskip} = \number\l@youtvdii pt \\
+ \l@ycmd{parskip} = \number\l@youtparskip pt &
+ \textrm{heading font} = \string#1 \\
+ \end{tabular}
+ \end{ttfamily}\end{footnotesize}
+ \end{center}
+ \fi
+% \end{macrocode}
+% The end of the definition of |\drawheading|.
+% \begin{macrocode}
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\headingdiagram}
+% \begin{macro}{\headingdesign}
+% Shorthands.
+% \begin{macrocode}
+\newcommand{\headingdiagram}[1]{\drawparameterstrue\drawheading{#1}}
+\newcommand{\headingdesign}[1]{\drawparametersfalse\drawheading{#1}}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\headingvalues}
+% This doesn't do anything --- it's just provided for symmetry.
+% \begin{macrocode}
+\newcommand{\headingvalues}{%
+ \PackageWarning{layouts}{The \protect\headingvalues\space command does nothing}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \section{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.
+%
+% \subsubsection{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.
+%
+% \begin{macro}{\trytextfloatsep}
+% Sets the trial value for |textfloatsep| and stores the result in |\l@youtvpi|.
+% \begin{macrocode}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%% INDIVIDUAL FLOAT LAYOUT
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newcommand{\trytextfloatsep}[1]{\l@yltoc{#1}{\l@youtvpi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryfloatsep}
+% Sets the trial value for |floatsep| and stores the result in |\l@youtvpii|.
+% \begin{macrocode}
+\newcommand{\tryfloatsep}[1]{\l@yltoc{#1}{\l@youtvpii}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tryintextsep}
+% Sets the trial value for |intextsep| and stores the result in |\l@youtvpiii|.
+% \begin{macrocode}
+\newcommand{\tryintextsep}[1]{\l@yltoc{#1}{\l@youtvpiii}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trytopfigrule}
+% Sets the trial value for |topfigrule| and stores the result in |\l@youtlinethick|.
+% \begin{macrocode}
+\newcommand{\trytopfigrule}[1]{\setlength{\l@youtlinethick}{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trybotfigrule}
+% Sets the trial value for |botfigrule| and stores the result in |\l@youtlinethickii|.
+% \begin{macrocode}
+\newcommand{\trybotfigrule}[1]{\setlength{\l@youtlinethickii}{#1}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\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.
+% \begin{macrocode}
+\newcommand{\currentfloat}{%
+ \trytextfloatsep{\textfloatsep}
+ \tryfloatsep{\floatsep}
+ \tryintextsep{\intextsep}
+ \trytopfigrule{0pt} % guesstimate
+ \trybotfigrule{0pt} % guesstimate
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\drawfloat}
+%
+% The command to draw the picture of float parameters.
+%
+% \begin{macrocode}
+\newcommand{\drawfloat}{%
+ \ifdrawparameters
+% \end{macrocode}
+% Set up the lengths and coordinates for drawing the parameters.
+% \begin{macrocode}
+ \l@yltoc{40pt}{\l@youtvpi} % textfloatsep
+ \l@yltoc{40pt}{\l@youtvpii} % floatsep
+ \l@yltoc{40pt}{\l@youtvpiii} % intextsep
+ \setlength{\l@youtlinethick}{1pt} % toprule height
+ \setlength{\l@youtlinethickii}{2pt} % botrule height
+ \fi
+% \end{macrocode}
+% And the general drawing coodinates and lengths.
+% \begin{macrocode}
+% \l@youthdo=\textwidth % textwidth
+% \divide\l@youthdo by \l@yonepoint
+ \l@yltoc{\textwidth}{\l@youthdo}
+ \multiply\l@youthdo by 8\relax
+ \divide\l@youthdo by 10\relax
+ \l@yltoc{\baselineskip}{\l@youtvdvii} % baselineskip
+ \l@youthdi=\l@youthdo % width of floats
+ \divide\l@youthdi by \tw@
+ \l@youtvdi=\l@youthdi % float box height
+ \divide\l@youtvdi by 4\relax
+ \l@youtvdii=\l@youtvdvii % text box height
+ \multiply\l@youtvdii by \thr@@
+ \l@youtvdvi=\l@youtvdvii % height of top text line
+ \multiply\l@youtvdvi by \tw@
+ \l@youtxci=\l@youthdo % X coord of LH of float
+ \advance\l@youtxci by -\l@youthdi
+ \divide\l@youtxci by \tw@
+ \l@youtxcii=\l@youthdo % X coord of vertical dims.
+ \divide\l@youtxcii by \tw@
+ \l@youtyci=\l@youtvdi % Y coord of top of BFl-n
+ \l@youtycii=\l@youtyci % Y coord of bottom of text
+ \advance\l@youtycii by \l@youtvpi
+ \l@youtyciii=\l@youtycii % Y coord of bottom of HF box
+ \advance\l@youtyciii by \l@youtvdii
+ \advance\l@youtyciii by \l@youtvpiii
+ \l@youtyciv=\l@youtyciii % Y coord of bottom top text box
+ \advance\l@youtyciv by \l@youtvdi
+ \advance\l@youtyciv by \l@youtvpiii
+ \l@youtycv=\l@youtyciv % Y coord of bottom of TFl-2 box
+ \advance\l@youtycv by \l@youtvdii
+ \advance\l@youtycv by \l@youtvpi
+ \l@youtycvi=\l@youtycv % Y coord of bottom of TFl-1 box
+ \advance\l@youtycvi by \l@youtvdi
+ \advance\l@youtycvi by \l@youtvpii
+ \l@youtvdo=\l@youtycvi % Y dim of text on page
+ \advance\l@youtvdo by \l@youtvdi
+ \l@youthdii=\l@youtvpi % a small amount
+ \divide\l@youthdii by \tw@
+ \l@youthdiii=\l@youthdii % half a small amount
+ \divide\l@youthdiii by \tw@
+% \end{macrocode}
+%
+% Draw the picture!
+%
+% \begin{macrocode}
+ \begin{center}
+%%% \setlayoutscale{1}
+ \setlength{\unitlength}{\l@youtunitlength}
+ \begin{picture}(\l@youthdo,\l@youtvdo)
+ \thicklines
+% \end{macrocode}
+% A bottom float.
+% \begin{macrocode}
+ \put(\l@youtxci,0){\framebox(\l@youthdi,\l@youtvdi){\l@ylabelfont A BOTTOM FLOAT}}
+% \end{macrocode}
+% Bottom text.
+% \begin{macrocode}
+ \put(0,\l@youtycii){\begin{picture}(\l@youthdo,\l@youtvdii)
+ \put(0,0){\makebox(\l@youthdo,0)[br]{\l@ylabelfont \ldots last text line before bottom float.}}
+ \put(0,\l@youtvdvi){\l@ylabelfont First text line after `here' float \ldots}
+ \end{picture}}
+% \end{macrocode}
+% Draw a `here' float.
+% \begin{macrocode}
+ \put(\l@youtxci,\l@youtyciii){\framebox(\l@youthdi,\l@youtvdi){\l@ylabelfont A `HERE' FLOAT}}
+% \end{macrocode}
+% Top text.
+% \begin{macrocode}
+ \put(0,\l@youtyciv){\begin{picture}(\l@youthdo,\l@youtvdii)
+ \put(0,0){\makebox(\l@youthdo,0)[br]{\l@ylabelfont \ldots last text line before `here' float.}}
+ \put(0,\l@youtvdvi){\l@ylabelfont First text line after top float \ldots}
+ \end{picture}}
+% \end{macrocode}
+% The lowest top float (TFl-2).
+% \begin{macrocode}
+ \put(\l@youtxci,\l@youtycv){\framebox(\l@youthdi,\l@youtvdi){\l@ylabelfont A TOP FLOAT}}
+% \end{macrocode}
+% The highest top float (TFl-1).
+% \begin{macrocode}
+ \put(\l@youtxci,\l@youtycvi){\framebox(\l@youthdi,\l@youtvdi){\l@ylabelfont A TOP FLOAT}}
+% \end{macrocode}
+% Whole page text.
+% \begin{macrocode}
+ \thinlines
+ \put(0,0){\dashbox{10}(\l@youthdo,\l@youtvdo){}}
+% \end{macrocode}
+% The top and bottom rules
+% \begin{macrocode}
+ \linethickness{\l@youtlinethick}
+ \put(0,\l@youtycv){\line(1,0){\l@youthdo}}
+ \linethickness{\l@youtlinethickii}
+ \put(0,\l@youtyci){\line(1,0){\l@youthdo}}
+ \thinlines
+ \testdrawdimensions
+ \ifl@ytempif
+% \end{macrocode}
+% Draw the parameter lines if required. Start with the bottom |textfloatsep|.
+% \begin{macrocode}
+ \put(\l@youtxcii,\l@youtycii){\vector(0,-1){\l@youtvpi}}
+ \put(\l@youtxcii,\l@youtycii){\begin{picture}(\l@youthdii,\l@youthdii)
+ \put(\l@youthdiii,-\l@youthdii){\l@ypcmd{textfloatsep}}
+ \end{picture}}
+% \end{macrocode}
+% Lower |intextsep|.
+% \begin{macrocode}
+ \put(\l@youtxcii,\l@youtyciii){\vector(0,-1){\l@youtvpiii}}
+ \put(\l@youtxcii,\l@youtyciii){\begin{picture}(\l@youthdii,\l@youthdii)
+ \put(\l@youthdiii,-\l@youthdii){\l@ypcmd{intextsep}}
+ \end{picture}}
+% \end{macrocode}
+% Upper |intextsep|.
+% \begin{macrocode}
+ \put(\l@youtxcii,\l@youtyciv){\vector(0,-1){\l@youtvpiii}}
+ \put(\l@youtxcii,\l@youtyciv){\begin{picture}(\l@youthdii,\l@youthdii)
+ \put(\l@youthdiii,-\l@youthdii){\l@ypcmd{intextsep}}
+ \end{picture}}
+% \end{macrocode}
+% Top |textfloatsep|.
+% \begin{macrocode}
+ \put(\l@youtxcii,\l@youtycv){\vector(0,-1){\l@youtvpi}}
+ \put(\l@youtxcii,\l@youtycv){\begin{picture}(\l@youthdii,\l@youthdii)
+ \put(\l@youthdiii,-\l@youthdii){\l@ypcmd{textfloatsep}}
+ \end{picture}}
+% \end{macrocode}
+% Top |floatsep|.
+% \begin{macrocode}
+ \put(\l@youtxcii,\l@youtycvi){\vector(0,-1){\l@youtvpii}}
+ \put(\l@youtxcii,\l@youtycvi){\begin{picture}(\l@youthdii,\l@youthdii)
+ \put(\l@youthdiii,-\l@youthdii){\l@ypcmd{floatsep}}
+ \end{picture}}
+% \end{macrocode}
+% Top rule.
+% \begin{macrocode}
+ \put(\l@youthdo,\l@youtycv){\begin{picture}(\l@youthdii,\l@youthdii)
+ \put(-\l@youthdiii,\l@youthdii){\vector(0,-1){\l@youthdii}}
+ \put(-\l@youthdii,\l@youthdii){\makebox(0,0)[tr]{\l@ypcmd{topfigrule}}}
+ \end{picture}}
+% \end{macrocode}
+% And finally the bottom rule.
+% \begin{macrocode}
+ \put(\l@youthdo,\l@youtyci){\begin{picture}(\l@youthdii,\l@youthdii)
+ \put(-\l@youthdiii,-\l@youthdii){\vector(0,1){\l@youthdii}}
+ \put(-\l@youthdii,-\l@youthdii){\makebox(0,0)[br]{\l@ypcmd{botfigrule}}}
+ \end{picture}}
+ \fi
+ \end{picture}
+ \end{center}
+ \setlength{\unitlength}{1pt}
+ \testprintparameters
+ \ifl@ytempif
+% \end{macrocode}
+% Print the table of values.
+% \begin{macrocode}
+ \begin{center}
+ \begin{footnotesize}
+ Lengths are to the nearest pt. \\
+ \begin{ttfamily}
+ \begin{tabular}{l@{\hspace{20pt}}l}
+ \l@ycmd{floatsep} = \number\l@youtvpii pt &
+ \l@ycmd{textfloatsep} = \number\l@youtvpi pt \\
+ \l@ycmd{intextsep} = \number\l@youtvpiii pt &
+ \textrm{topfigrule thickness} = \the\l@youtlinethick \\
+ \textrm{botfigrule thickness} = \the\l@youtlinethickii & \\
+ \end{tabular}
+ \end{ttfamily}\end{footnotesize}
+ \end{center}
+ \fi
+% \end{macrocode}
+% End of the definition of |\drawfloat|.
+% \begin{macrocode}
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
+% \begin{macro}{\floatdiagram}
+% \begin{macro}{\floatdesign}
+% Shorthands.
+% \begin{macrocode}
+\newcommand{\floatdiagram}{\drawparameterstrue\drawfloat}
+\newcommand{\floatdesign}{\drawparametersfalse\drawfloat}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\floatvalues}
+% This macro produces a table of the current float layout actual values.
+% \changes{v2.5}{2001/10/21}{Fixed counter printing in \cs{floatvalues}}
+% \begin{macrocode}
+\newcommand{\floatvalues}{%
+ \ifprintheadings
+ Actual float layout values.\\[\baselineskip]
+ \fi
+ \begingroup\l@yvalsize
+ \begin{tabular}{l@{\hspace{20pt}}l}
+ \l@ycmd{floatsep} = \l@yval{\floatsep} &
+ \l@ycmd{textfloatsep} = \l@yval{\textfloatsep} \\
+ \l@ycmd{intextsep} = \l@yval{\intextsep} & \\
+ topfig rule thickness = ?? &
+ botfig rule thickness = ?? \\
+ \l@ycmd{topnumber} = \the\c@topnumber & % \l@yval{\c@topnumber} &
+ \l@ycmd{topfraction} = \topfraction \\
+ \l@ycmd{bottomnumber} = \the\c@bottomnumber & % \l@yval{\c@bottomnumber} &
+ \l@ycmd{bottomfraction} = \bottomfraction \\
+ \l@ycmd{totalnumber} = \the\c@totalnumber & % \l@yval{\c@totalnumber} &
+ \l@ycmd{textfraction} = \textfraction \\
+ \l@ycmd{dblfloatsep} = \l@yval{\dblfloatsep} &
+ \l@ycmd{dbltextfloatsep} = \l@yval{\dbltextfloatsep} \\
+ \l@ycmd{dbltopnumber} = \the\c@dbltopnumber & % \l@yval{\c@dbltopnumber} &
+ \l@ycmd{dbltopfraction} = \dbltopfraction \\
+ \l@ycmd{dblfloatpagefraction} = \dblfloatpagefraction &
+ \l@ycmd{floatpagefraction} = \floatpagefraction \\
+ 1em = \l@yval{\l@yonem} & 1ex = \l@yval{\l@yonex} \\
+ \end{tabular}
+ \endgroup
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{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.
+%
+% \begin{macro}{\trytotalnumber}
+% Sets the trial value for |totalnumber| and stores the result in |\l@youtvpvi|.
+% \begin{macrocode}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%% FLOAT PAGE LAYOUT
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newcommand{\trytotalnumber}[1]{\l@youtvpvi = #1}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trytopnumber}
+% Sets the trial value for |topnumber| and stores the result in |\l@youtvpv|.
+% \begin{macrocode}
+\newcommand{\trytopnumber}[1]{\l@youtvpv = #1}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trybottomnumber}
+% Sets the trial value for |bottomnumber| and stores the result in |\l@youtvpi|.
+% \begin{macrocode}
+\newcommand{\trybottomnumber}[1]{\l@youtvpi = #1}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trytopfraction}
+% Sets the trial value for |topfraction| and stores the results in |\l@youtvpiv|
+% and |\l@youthdiv|.
+% \begin{macrocode}
+\newcommand{\trytopfraction}[1]{\setlength{\l@ylen}{10in}
+ \l@ylen = #1\l@ylen
+ \l@youtvpiv=\l@ylen
+ \divide\l@youtvpiv by \l@yonepoint
+ \setlength{\l@ylen}{1000sp}
+ \l@ylen=#1\l@ylen
+ \l@youthdiv=\l@ylen}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trytextfraction}
+% Sets the trial value for |textfraction| and stores the results in |\l@youtvpiii|
+% and |\l@youthdv|.
+% \begin{macrocode}
+\newcommand{\trytextfraction}[1]{\setlength{\l@ylen}{10in}
+ \l@ylen = #1\l@ylen
+ \l@youtvpiii=\l@ylen
+ \divide\l@youtvpiii by \l@yonepoint
+ \setlength{\l@ylen}{1000sp}
+ \l@ylen=#1\l@ylen
+ \l@youthdv=\l@ylen}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trybottomfraction}
+% Sets the trial value for |bottomfraction| and stores the results in |\l@youtvpii|
+% and |\l@youthdvi|.
+% \begin{macrocode}
+\newcommand{\trybottomfraction}[1]{\setlength{\l@ylen}{10in}
+ \l@ylen = #1\l@ylen
+ \l@youtvpii=\l@ylen
+ \divide\l@youtvpii by \l@yonepoint
+ \setlength{\l@ylen}{1000sp}
+ \l@ylen=#1\l@ylen
+ \l@youthdvi=\l@ylen}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\currentfloatpage}
+%
+% Sets the floatpage parameter trial values to those in the current
+% document, or makes a guesstimate when these are hard-coded.
+% \begin{macrocode}
+\newcommand{\currentfloatpage}{%
+ \trytotalnumber{\value{totalnumber}} % typically 3
+ \trytopnumber{\value{topnumber}} % typically 2
+ \trytopfraction{0.7} % typically 0.7
+ \trytextfraction{0.2} % typically 0.2
+ \trybottomfraction{0.3} % typically 0.3
+ \trybottomnumber{\value{bottomnumber}} % typically 1
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\drawfloatpage}
+%
+% The command to draw a picture of the float page layout and
+% parameters.
+%
+% \begin{macrocode}
+\newcommand{\drawfloatpage}{%
+ \ifdrawparameters
+% \end{macrocode}
+% Calculate values for parameter drawing.
+% \begin{macrocode}
+ \l@youtvpvi=\thr@@ % total number
+ \l@youtvpv=\tw@ % topnumber
+ \l@youthdiv=300\relax % 1000 times topfraction
+ \setlength{\l@ylen}{10in}
+ \l@ylen=0.3\l@ylen
+ \l@yltoc{\l@ylen}{\l@youtvpiv} % topfraction
+ \l@youthdv=200\relax % 1000 times textfraction
+ \setlength{\l@ylen}{10in}
+ \l@ylen=0.2\l@ylen
+ \l@yltoc{\l@ylen}{\l@youtvpiii} % textfraction
+ \l@youthdvi=300\relax % 1000 times botfraction
+ \setlength{\l@ylen}{10in}
+ \l@ylen=0.3\l@ylen
+ \l@yltoc{\l@ylen}{\l@youtvpii} % bottomfraction
+ \l@youtvpi=\@ne % bottomnumber
+ \fi
+% \end{macrocode}
+% Continue with the general picture coordinates and lengths.
+% \begin{macrocode}
+ \l@youtvdo=\l@yteninch\relax % textheight
+ \l@youthdo=\l@yeighthalfinch\relax % textwidth
+ \l@youthdi=\l@youthdo % width of text box
+ \multiply\l@youthdi by 8\relax
+ \divide\l@youthdi by 10\relax
+ \l@youtyci=\l@youtvdo % Y coord of base of textfraction
+ \advance\l@youtyci by -\l@youtvpiii
+ \divide\l@youtyci by \tw@
+ \l@youtycii=\l@youtvpii % Y coord of top of bottomfraction
+ \l@youtyciii=\l@youtvdo % Y coord of base of topfraction
+ \advance\l@youtyciii by -\l@youtvpiv
+ \l@youtyciv=\l@youtyci % Y coord of top of textfraction
+ \advance\l@youtyciv by \l@youtvpiii
+ \l@youtycv=\l@youtyci % Y coord of centre of text box
+ \advance\l@youtycv by \l@youtyciv
+ \divide\l@youtycv by \tw@
+ \l@youtxcii=\l@youthdo % X coord of centre dims
+ \divide\l@youtxcii by \tw@
+ \l@youtxci=\l@youtxcii % X coord of LH dims
+ \divide\l@youtxci by \tw@
+ \l@youtxciii=\l@youtxcii % X coord of RH dims
+ \advance\l@youtxciii by \l@youtxci
+ \l@youtxciv=\l@youthdo % X coord of LH of text box
+ \advance\l@youtxciv by -\l@youthdi
+ \divide\l@youtxciv by \tw@
+ \l@youthdii=\l@youtxciv % a small dimension
+ \l@youthdiii=\l@youthdii % half a small dimension
+ \divide\l@youthdiii by \tw@
+% \end{macrocode}
+%
+% Draw the picture!
+%
+% \begin{macrocode}
+ \begin{center}
+ \setlength{\unitlength}{\l@youtunitlength}
+ \begin{picture}(\l@youthdo,\l@youtvdo)
+ \thicklines
+% \end{macrocode}
+% Draw the page boundaries.
+% \begin{macrocode}
+ \put(0,0){\framebox(\l@youthdo,\l@youtvdo){}}
+% \end{macrocode}
+% The bottom fraction.
+% \begin{macrocode}
+ \put(0,\l@youtycii){\dashbox{10}(\l@youthdo,0){}}
+%%% \ifdrawparameters
+ \put(0,0){\makebox(\l@youthdo,\l@youtvpii){\l@ypcmd{bottomnumber}}}
+ \thinlines
+ \put(\l@youtxciii,0){\vector(0,1){\l@youtvpii}}
+ \thicklines
+%%% \fi
+% \end{macrocode}
+% The text fraction.
+% \begin{macrocode}
+ \put(\l@youtxciv,\l@youtyci){\framebox(\l@youthdi,\l@youtvpiii){}}
+% \end{macrocode}
+% The top fraction.
+% \begin{macrocode}
+ \put(0,\l@youtyciii){\dashbox{10}(\l@youthdo,0){}}
+%%% \ifdrawparameters
+ \put(0,\l@youtyciii){\makebox(\l@youthdo,\l@youtvpiv){\l@ypcmd{topnumber}}}
+ \thinlines
+ \put(\l@youtxci,\l@youtvdo){\vector(0,-1){\l@youtvpiv}}
+ \thicklines
+%%% \fi
+ \thinlines
+ \testdrawdimensions
+ \ifl@ytempif
+% \end{macrocode}
+% Draw the dimensions.
+% First the bottom fraction.
+% \begin{macrocode}
+ \put(\l@youtxciii,0){\begin{picture}(\l@youthdii,\l@youthdii)
+ \put(-\l@youthdiii,\l@youthdiii){%
+ \makebox(0,0)[br]{\l@ypcmd{bottomfraction}}}
+ \end{picture}}
+% \end{macrocode}
+% The text fraction.
+% \begin{macrocode}
+ \put(\l@youtxcii,\l@youtyci){\vector(0,1){\l@youtvpiii}}
+ \put(\l@youtxcii,\l@youtyci){\vector(0,-1){0}}
+ \put(\l@youtxcii,\l@youtycv){\begin{picture}(\l@youthdii,\l@youthdii)
+ \put(\l@youthdiii,0){%
+ \makebox(0,0)[l]{\l@ypcmd{textfraction}}}
+ \end{picture}}
+% \end{macrocode}
+% Finally the top fraction.
+% \begin{macrocode}
+ \put(\l@youtxci,\l@youtvdo){\begin{picture}(\l@youthdii,\l@youthdii)
+ \put(\l@youthdiii,-\l@youthdiii){%
+ \makebox(0,0)[tl]{\l@ypcmd{topfraction}}}
+ \end{picture}}
+ \fi
+ \end{picture}
+ \end{center}
+ \setlength{\unitlength}{1pt}
+ \testprintparameters
+ \ifl@ytempif
+% \end{macrocode}
+% Print the parameter value table.
+% \begin{macrocode}
+ \begin{center}
+ \begin{footnotesize}\begin{ttfamily}
+ \begin{tabular}{l@{\hspace{20pt}}l}
+ \l@ycmd{topnumber} = \number\l@youtvpv &
+ \l@ycmd{topfraction} = 0.\number\l@youthdiv \\
+ \l@ycmd{bottomnumber} = \number\l@youtvpi &
+ \l@ycmd{bottomfraction} = 0.\number\l@youthdvi \\
+ \l@ycmd{totalnumber} = \number\l@youtvpvi &
+ \l@ycmd{textfraction} = 0.\number\l@youthdv \\
+ \end{tabular}
+ \end{ttfamily}\end{footnotesize}
+ \end{center}
+ \fi
+% \end{macrocode}
+% End of the definition of |\drawfloatpage|.
+% \begin{macrocode}
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\floatpagediagram}
+% \begin{macro}{\floatpagedesign}
+% Shorthands.
+% \begin{macrocode}
+\newcommand{\floatpagediagram}{\drawparameterstrue\drawfloatpage}
+\newcommand{\floatpagedesign}{\drawparametersfalse\drawfloatpage}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\floatpagevalues}
+% The same as the |\floatvalues| command.
+% \begin{macrocode}
+\newcommand{\floatpagevalues}{\floatvalues}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \section{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.
+%
+% \begin{macro}{\trytocindent}
+% Sets the trial value for |tocindent| and stores the result in |\l@youthpi|.
+% \begin{macrocode}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%% TOC LAYOUT
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newcommand{\trytocindent}[1]{\l@yltoc{#1}{\l@youthpi}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trytocnumwidth}
+% Sets the trial value for |tocnumwidth| and stores the result in |\l@youthpii|.
+% \begin{macrocode}
+\newcommand{\trytocnumwidth}[1]{\l@yltoc{#1}{\l@youthpii}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trytoclinewidth}
+% Sets the trial value for |toclinewidth| and stores the result in |\l@youthdo|.
+% \begin{macrocode}
+\newcommand{\trytoclinewidth}[1]{\l@yltoc{#1}{\l@youthdo}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trytocrmarg}
+% Sets the trial value for |tocrmarg| and stores the result in |\l@youthpiii|.
+% \begin{macrocode}
+\newcommand{\trytocrmarg}[1]{\l@yltoc{#1}{\l@youthpiii}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trytocpnumwidth}
+% Sets the trial value for |tocpnumwidth| and stores the result in |\l@youthpiv|.
+% \begin{macrocode}
+\newcommand{\trytocpnumwidth}[1]{\l@yltoc{#1}{\l@youthpiv}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\l@ydotsep}
+% Stores the actual value for the ToC dotsep.
+% \begin{macrocode}
+\newcommand{\l@ydotsep}{\@dotsep}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\trytocdotsep}
+% Sets the trial value for |tocdotsep| and stores the result in |\l@youthpv|.
+% \begin{macrocode}
+\newcommand{\trytocdotsep}[1]{\renewcommand{\l@ydotsep}{#1}
+ \setlength{\l@ylen}{1em}
+ \l@ylen = #1\l@ylen
+ \divide\l@ylen by 18\relax % 18mu = 1em
+ \addtolength{\l@ylen}{0.4pt} % small addition for the dot width
+ \l@yltoc{\l@ylen}{\l@youthpv}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\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 (actually I use the values for |\subsection| entries
+% in the \Lpack{article} class).
+% \begin{macrocode}
+\newcommand{\currenttoc}{%
+ \trytocindent{1.5em} % guesstimate
+ \trytocnumwidth{2.3em} % guesstimate
+ \trytoclinewidth{\textwidth}
+ \trytocrmarg{\@tocrmarg}
+ \trytocpnumwidth{\@pnumwidth}
+ \trytocdotsep{\@dotsep}
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\drawtoc}
+%
+% The command to draw the layout of a ToC entry.
+% \begin{macrocode}
+\newcommand{\drawtoc}{%
+ \ifdrawparameters
+% \end{macrocode}
+% Calculate drawing lengths and coordinates for picturing the parameters.
+% \begin{macrocode}
+ \l@yltoc{100pt}{\l@youthpi} % indent
+ \l@yltoc{50pt}{\l@youthpii} % numwidth
+ \l@yltoc{100pt}{\l@youthpiii} % tocrmarg
+ \l@yltoc{60pt}{\l@youthpiv} % pnumwidth
+ \l@yltoc{20pt}{\l@youthpv} % dotsep
+ \l@yltoc{6.5in}{\l@youthdo} % linewidth
+ \fi
+% \end{macrocode}
+% Continue with the general lengths and coordinate values.
+% \begin{macrocode}
+ \l@yltoc{20pt}{\l@youtvdi} % baselineskip
+ \l@youtvdii=\l@youtvdi % twice baselineskip
+ \multiply\l@youtvdii by \tw@
+ \l@youtvdiii=\l@youtvdi % three times baselineskip
+ \multiply\l@youtvdiii by \thr@@
+ \l@youtvdiv=\l@youtvdi % four times baselineskip
+ \multiply\l@youtvdiv by 4\relax
+ \l@youtxci=\l@youthpi % X coord of start of numwidth
+ \l@youtxcii=\l@youtxci % X coord of start of text
+ \advance\l@youtxcii by \l@youthpii
+ \l@youtxciii=\l@youthdo % X coord of start of pnumwidth
+ \advance\l@youtxciii by -\l@youthpiv
+ \l@youtxciv=\l@youthdo % X coord of start of tocrmarg
+ \advance\l@youtxciv by -\l@youthpiii
+ \l@youtxcv=\l@youtxciv % X coord of penultimate dot
+ \advance\l@youtxcv by -\l@youthpv
+ \l@youtyci=\z@ % Y coord of base of dotsep text
+ \l@youtycii=\l@youtyci % dotsep vector
+ \advance\l@youtycii by \l@youtvdii
+ \l@youtyciii=\l@youtycii % Y coord of base of bottom text
+ \advance\l@youtyciii by \l@youtvdii
+ \l@youtyciv=\l@youtyciii % Y coord of base of middle text
+ \advance\l@youtyciv by \l@youtvdi
+ \l@youtycv=\l@youtyciv % Y coord of base of top text
+ \advance\l@youtycv by \l@youtvdi
+ \l@youtycvi=\l@youtycv % Y coord of top vectors
+ \advance\l@youtycvi by \l@youtvdi
+ \advance\l@youtycvi by \l@youtvdi
+ \l@youtvdo=\l@youtycvi % picture height
+ \advance\l@youtvdo by \l@youtvdii
+ \l@youthdii=\l@youtxciv % width of title text
+ \advance\l@youthdii by -\l@youtxcii
+ \l@youthdiii=\l@youtvdi % a small amount
+ \l@youthdiv=\l@youthdiii % half a small amount
+ \divide\l@youthdiv by \tw@
+% \end{macrocode}
+%
+% Draw the picture!
+%
+% \begin{macrocode}
+ \begin{center}
+ \setlength{\unitlength}{\l@youtunitlength}
+ \begin{picture}(\l@youthdo,\l@youtvdo)
+ \thinlines
+ \put(0,0){\framebox(\l@youthdo,\l@youtvdo){}}
+% \end{macrocode}
+% The top text line.
+% \begin{macrocode}
+ \put(\l@youtxci,\l@youtycv){\l@ylabelfont \textbf{3.5}}
+ \put(\l@youtxcii,\l@youtycv){\l@ylabelfont Heading \ldots}
+ \put(\l@youtxciv,\l@youtycv){\makebox(0,0)[br]{\l@ylabelfont \ldots title}}
+% \end{macrocode}
+% The middle text line.
+% \begin{macrocode}
+ \put(\l@youtxcii,\l@youtyciv){\l@ylabelfont continue \ldots}
+ \put(\l@youtxciv,\l@youtyciv){\makebox(0,0)[br]{\l@ylabelfont \ldots title}}
+% \end{macrocode}
+% The bottom text line.
+% \begin{macrocode}
+ \put(\l@youtxcii,\l@youtyciii){\l@ylabelfont title end} % end of title heading
+ \put(\l@youthdo,\l@youtyciii){\makebox(0,0)[br]{\l@ylabelfont 487}} % page number
+% \end{macrocode}
+% Calculate the number of dots required for the dotted leader,
+% then draw the leader. The length of the `title end' text is a true
+% length so we have to divide it by the drawing scale factor to convert
+% it to the picture length.
+% \begin{macrocode}
+% \settowidth{\l@ylen}{title end\quad}
+ \settowidth{\l@ylen}{\l@ylabelfont title end\space}
+ \l@yltoc{\l@ylen}{\l@youthdv} % width of `title end' text
+ \l@youthpvi=\l@youtunitlength
+ \multiply\l@youthdv by \l@yonepoint\relax
+ \divide\l@youthdv by \l@youthpvi\relax
+ \l@youthdvi=\l@youtxciv % space for dots
+ \advance\l@youthdvi by -\l@youtxcii
+ \advance\l@youthdvi by -\l@youthdv
+ \l@youthdvii=\l@youthdvi % number of dots
+ \divide\l@youthdvii by \l@youthpv
+% \end{macrocode}
+% Use |\multiput| for dot drawing if we are drawing the parameters and the
+% values calculated above. Otherwise multiply the dotsep by 4 to give a
+% more realistic rendition; also make sure that we don't print just one dot.
+% \begin{macrocode}
+ \ifdrawparameters
+ \multiput(\l@youtxciv,\l@youtyciii)(-\l@youthpv,0){\l@youthdvii}%
+ {\makebox(0,0)[r]{.}} % draw the dots
+ \else
+ \multiply\l@youthpv by 4\relax
+ \l@youthdvii=\l@youthdvi
+ \divide\l@youthdvii by \l@youthpv
+ \advance\l@youthdvii by \@ne
+ \ifnum\l@youthdvii >\@ne
+ \multiput(\l@youtxciv,\l@youtyciii)(-\l@youthpv,0){\l@youthdvii}%
+ {\makebox(0,0)[r]{.}} % draw the dots
+ \fi
+ \fi
+%% \ifdrawparameters
+ \testdrawdimensions
+ \ifl@ytempif
+% \end{macrocode}
+%
+% Draw the parameters if requested.
+%
+% The top vectors (which we put into their own picture).
+% \begin{macrocode}
+ \put(0,\l@youtycvi){\begin{picture}(\l@youthdo,\l@yoneinch)
+% \end{macrocode}
+% The indent.
+% \begin{macrocode}
+ \put(0,0){\vector(1,0){\l@youthpi}}
+ \put(\l@youtxci,0){\line(0,-1){\l@youthdiii}}
+ \put(0,0){\begin{picture}(\l@youthdiii,\l@youthdiii)
+ \put(\l@youthdiv,\l@youthdiv){\l@yparamfont\textit{indent}}
+ \end{picture}}
+% \end{macrocode}
+% The numwidth.
+% \begin{macrocode}
+ \put(\l@youtxci,0){\vector(1,0){\l@youthpii}}
+ \put(\l@youtxcii,0){\line(0,-1){\l@youthdiii}}
+ \put(\l@youtxci,0){\begin{picture}(\l@youthdiii,\l@youthdiii)
+ \put(\l@youthdiv,\l@youthdiv){\l@yparamfont\textit{numwidth}}
+ \end{picture}}
+% \end{macrocode}
+% Lastly, the pnumwidth.
+% \begin{macrocode}
+ \put(\l@youthdo,0){\vector(-1,0){\l@youthpiv}}
+ \put(\l@youtxciii,0){\line(0,-1){\l@youthdiii}}
+ \put(\l@youthdo,0){\begin{picture}(\l@youthdiii,\l@youthdiii)
+ \put(-\l@youthdiv,\l@youthdiv){\makebox(0,0)[br]%
+ {\l@ypcmd{@pnumwidth}}}
+ \end{picture}}
+ \end{picture}}
+% \end{macrocode}
+% Now do the linewidth.
+% \begin{macrocode}
+ \thicklines
+ \put(0,\l@youtvdo){\vector(1,0){\l@youthdo}}
+ \thinlines
+ \put(0,\l@youtvdo){\begin{picture}(\l@youthdiii,\l@youthdiii)
+ \put(\l@youtxcii,-\l@youthdiv){\makebox(0,0)[tl]%
+ { \quad \l@ypcmd{linewidth}}}
+ \end{picture}}
+% \end{macrocode}
+% The bottom vectors (which we put into their own picture).
+% \begin{macrocode}
+ \put(0,\l@youtycii){\begin{picture}(\l@youthdo,\l@yoneinch)
+% \end{macrocode}
+% The tocrmarg.
+% \begin{macrocode}
+ \put(\l@youthdo,0){\vector(-1,0){\l@youthpiii}}
+ \put(\l@youtxciv,0){\line(0,1){\l@youthdiii}}
+ \put(\l@youthdo,0){\begin{picture}(\l@youthdiii,\l@youthdiii)
+ \put(-\l@youthdiv,-\l@youthdiv){\makebox(0,0)[tr]%
+ {\l@ypcmd{@tocrmarg}}}
+ \end{picture}}
+% \end{macrocode}
+% Finish with the dotsep.
+% \begin{macrocode}
+ \put(\l@youtxciv,0){\vector(-1,0){\l@youthpv}}
+ \put(\l@youtxciv,0){\vector(1,0){0}}
+ \put(\l@youtxcv,0){\line(0,1){\l@youthdiii}}
+ \put(\l@youtxciv,0){\begin{picture}(\l@youthdiii,\l@youthdiii)
+ \put(0,-\l@youthdiv){\makebox(0,0)[tr]%
+ {\l@ypcmd{@dotsep}}}
+ \end{picture}}
+ \end{picture}}
+ \fi
+ \end{picture}
+ \end{center}
+ \setlength{\unitlength}{1pt}
+%% \ifdrawparameters\else
+ \testprintparameters
+ \ifl@ytempif
+% \end{macrocode}
+% Print the table of parameter values.
+% \begin{macrocode}
+ \begin{center}
+ \begin{footnotesize}
+ Lengths are to the nearest pt. \\
+ \begin{ttfamily}
+ \begin{tabular}{l@{\hspace{20pt}}l}
+ \textit{indent} = \number\l@youthpi pt &
+ \textit{numwidth} = \number\l@youthpii pt \\
+ \l@ycmd{@tocrmarg} = \number\l@youthpiii pt &
+ \l@ycmd{@pnumwidth} = \number\l@youthpiv pt \\
+ \l@ycmd{@dotsep} = \l@ydotsep & \\
+ \end{tabular}
+ \end{ttfamily}\end{footnotesize}
+ \end{center}
+ \fi
+% \end{macrocode}
+% The end of the definition of |\drawtoc|.
+% \begin{macrocode}
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
+% \begin{macro}{\tocdiagram}
+% \begin{macro}{\tocdesign}
+% Shorthands.
+% \begin{macrocode}
+\newcommand{\tocdiagram}{\drawparameterstrue\drawtoc}
+\newcommand{\tocdesign}{\drawparametersfalse\drawtoc}
+
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\tocvalues}
+% This macro produces a table of the current ToC layout actual values.
+% \begin{macrocode}
+\newcommand{\tocvalues}{%
+ \ifprintheadings
+ Actual ToC layout values.\\[\baselineskip]
+ \fi
+ \begingroup\l@yvalsize
+ \begin{tabular}{l@{\hspace{20pt}}l}
+ \l@ycmd{@tocrmarg} = \@tocrmarg &
+ \l@ycmd{@pnumwidth} = \@pnumwidth \\
+ \l@ycmd{@dotsep} = \@dotsep &
+ \textit{indent} = ?? \\
+ \textit{numwidth} = ?? & \\
+ 1em = \l@yval{\l@yonem} & 1ex = \l@yval{\l@yonex} \\
+ \end{tabular}
+ \endgroup
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \section{Drawing a spread}
+%
+% We provide a facility for drawing a simple double page spread.
+%
+% \begin{macro}{\drawaspread}
+%
+% This command takes eight (8) parameters. These are:
+% \begin{enumerate}
+% \item 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.
+% \item The width of a page (as a length).
+% \item The ratio of the height of the page to its width.
+% \item The ratio of the height of the text to the width of the text.
+% \item The ratio of the width of the spine to the width of the page.
+% \item The ratio of the height of the top to the width of the spine.
+% \item The ratio of the width of the fore edge to the width of the spine.
+% \item 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.
+% \end{enumerate}
+%
+% \begin{macrocode}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%% SPREAD PAGE LAYOUT
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newcommand{\drawaspread}[8][0]{%
+ \begingroup
+ \setlength{\unitlength}{1pt}
+% \end{macrocode}
+% Get the pagewidth as all values depend on this. Store it in |\l@youthdo|.
+% Also use |\l@youtunitlength| to hold it temporarily.
+% \begin{macrocode}
+ \setlength{\l@youtunitlength}{#2}
+ \l@yltoc{\l@youtunitlength}{\l@youthdo} % page width
+ \l@youthdiv=\l@youthdo % total width of double spread
+ \advance\l@youthdiv by \l@youthdo
+% \end{macrocode}
+% The height of a page is kept in |\l@youtvdo|.
+% \begin{macrocode}
+ \setlength{\l@ylen}{#3\l@youtunitlength}
+ \l@yltoc{\l@ylen}{\l@youtvdo} % page height
+% \end{macrocode}
+% The width of the spine is kept in |\l@youthdiii|. We also use
+% |\l@youtunitlength| as a temporary store for the spine width.
+% \begin{macrocode}
+ \setlength{\l@ylen}{#5\l@youtunitlength}
+ \l@yltoc{\l@ylen}{\l@youthdiii} % spine width
+ \setlength{\l@youtunitlength}{\l@ylen}
+% \end{macrocode}
+% The width of the fore edge is kept in |\l@youthdi|.
+% \begin{macrocode}
+ \setlength{\l@ylen}{#7\l@youtunitlength}
+ \l@yltoc{\l@ylen}{\l@youthdi} % fore edge width
+% \end{macrocode}
+% Calculate the text width and store it in |\l@youthdii|.
+% \begin{macrocode}
+ \l@youthdii=\l@youthdo % text width
+ \advance\l@youthdii by -\l@youthdi
+ \advance\l@youthdii by -\l@youthdiii
+% \end{macrocode}
+% The X coordinate of the left-hand side of the text box on the right-hand
+% page is stored in |\l@youtxci|.
+% \begin{macrocode}
+ \l@youtxci=\l@youthdo
+ \advance\l@youtxci by \l@youthdiii
+% \end{macrocode}
+% The height of the top margin is stored in |\l@youtvdiii|
+% \begin{macrocode}
+ \setlength{\l@ylen}{#6\l@youtunitlength}
+ \l@yltoc{\l@ylen}{\l@youtvdiii} % top margin
+% \end{macrocode}
+% The height of the bottom margin is stored in |\l@youtvdi|.
+% \begin{macrocode}
+ \setlength{\l@ylen}{#1\l@youtunitlength}
+ \l@yltoc{\l@ylen}{\l@youtvdi} % bottom margin
+% \end{macrocode}
+% The text height is stored in |\l@youtvdii|.
+% \begin{macrocode}
+ \setlength{\l@ylen}{\l@youthdii pt}
+ \setlength{\l@ylen}{#4\l@ylen}
+ \l@yltoc{\l@ylen}{\l@youtvdii} % text height
+% \end{macrocode}
+% 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.
+% \begin{macrocode}
+ \ifnum\l@youtvdi=\z@
+ \l@youtvdi=\l@youtvdo
+ \advance\l@youtvdi by -\l@youtvdiii
+ \advance\l@youtvdi by -\l@youtvdii
+ \fi
+% \end{macrocode}
+% We store the gutter width in |\l@youthdv|.
+% \begin{macrocode}
+ \setlength{\l@ylen}{#8\l@youtunitlength}
+ \l@yltoc{\l@ylen}{\l@youthdv} % gutter width
+% \end{macrocode}
+%
+% Now we can draw a single column spread.
+% \begin{macrocode}
+ \ifnum\l@youthdv=\z@
+ \begin{picture}(\l@youthdiv,\l@youtvdo)
+ \thicklines
+ \put(0,0){\framebox(\l@youthdiv,\l@youtvdo){}} % spread pages
+ \put(\l@youthdo,0){\line(0,1){\l@youtvdo}} % the spine
+ \thinlines
+ \put(\l@youthdi,\l@youtvdi){\framebox(\l@youthdii,\l@youtvdii){}} % LH text
+ \put(\l@youtxci,\l@youtvdi){\framebox(\l@youthdii,\l@youtvdii){}} % RH text
+ \end{picture}
+ \else
+% \end{macrocode}
+% We have two columns. Calculate some additional lengths and coordinates.
+%
+% Store the column width in |\l@youthdvi|.
+% \begin{macrocode}
+ \l@youthdvi=\l@youthdii % column width
+ \advance\l@youthdvi by -\l@youthdv
+ \divide\l@youthdvi by \tw@
+% \end{macrocode}
+% 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|).
+% \begin{macrocode}
+ \l@youtxcii=\l@youthdi % X coord of LH inner column
+ \advance\l@youtxcii by \l@youthdvi
+ \advance\l@youtxcii by \l@youthdv
+ \l@youtxciii=\l@youtxci % X coord of RH outer column
+ \advance\l@youtxciii by \l@youthdvi
+ \advance\l@youtxciii by \l@youthdv
+% \end{macrocode}
+% Now draw the two column spread.
+% \begin{macrocode}
+ \begin{picture}(\l@youthdiv,\l@youtvdo)
+ \thicklines
+ \put(0,0){\framebox(\l@youthdiv,\l@youtvdo){}} % spread pages
+ \put(\l@youthdo,0){\line(0,1){\l@youtvdo}} % the spine
+ \thinlines
+ \put(\l@youthdi,\l@youtvdi){\framebox(\l@youthdvi,\l@youtvdii){}} % LH LH col
+ \put(\l@youtxcii,\l@youtvdi){\framebox(\l@youthdvi,\l@youtvdii){}} % LH RH col
+ \put(\l@youtxci,\l@youtvdi){\framebox(\l@youthdvi,\l@youtvdii){}} % RH LH col
+ \put(\l@youtxciii,\l@youtvdi){\framebox(\l@youthdvi,\l@youtvdii){}} % RH RH col
+ \end{picture}
+ \fi
+% \end{macrocode}
+% End of the definition of |\drawaspread|.
+% \begin{macrocode}
+\endgroup
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \section{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| \emph{must} be 1pt!
+%
+% \begin{macrocode}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%% FONT LAYOUT
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% \end{macrocode}
+%
+% \begin{macro}{\drawfontframe}
+% Draws a tightly fitting box with the text reference point marked and a
+% dotted line along the baseline.
+% \begin{macrocode}
+\newcommand{\drawfontframe}[1]{%
+% \end{macrocode}
+% Save the (text) argument.
+% \begin{macrocode}
+ \savebox{\layoutsbox}{#1}%
+% \end{macrocode}
+% Save the width in |\l@youthdo|, height in |\l@youtvdii| and depth in |\l@youtvdi|.
+% \begin{macrocode}
+ \l@yltoc{\wd\layoutsbox}{\l@youthdo}%
+ \l@yltoc{\ht\layoutsbox}{\l@youtvdii}%
+ \l@yltoc{\dp\layoutsbox}{\l@youtvdi}%
+% \end{macrocode}
+% Save the total height in |\l@youtvdo|.
+% \begin{macrocode}
+ \l@youtvdo=\l@youtvdi
+ \advance\l@youtvdo by \l@youtvdii
+% \end{macrocode}
+% Save half the width in |\l@youtxci|.
+% \begin{macrocode}
+ \l@youtxci=\l@youthdo
+ \divide\l@youtxci by \tw@
+% \end{macrocode}
+% Draw a picture, with origin at the box's baseline. Use |\qbezier| to draw
+% a dotted line with a dot at intervals of 2pt.
+% \begin{macrocode}
+ \begin{picture}(\l@youthdo,\l@youtvdii)
+ \thinlines
+ \put(0,0){\usebox{\layoutsbox}}
+ \put(0,0){\circle*{2}}
+ \qbezier[\l@youtxci](0,0)(\l@youtxci,0)(\l@youthdo,0)
+ \put(0,-\l@youtvdi){\framebox(\l@youthdo,\l@youtvdo){}}
+ \end{picture}%
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\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.
+% \begin{macrocode}
+\newcommand{\drawfontframelabel}[1]{%
+% \end{macrocode}
+% Save the (text) argument.
+% \begin{macrocode}
+ \savebox{\layoutsbox}{#1}%
+% \end{macrocode}
+% Save the width in |\l@youthdo|, height in |\l@youtvdii| and depth in |\l@youtvdi|.
+% \begin{macrocode}
+ \l@yltoc{\wd\layoutsbox}{\l@youthdo}%
+ \l@yltoc{\ht\layoutsbox}{\l@youtvdii}%
+ \l@yltoc{\dp\layoutsbox}{\l@youtvdi}%
+% \end{macrocode}
+% Save the total height in |\l@youtvdo|.
+% \begin{macrocode}
+ \l@youtvdo=\l@youtvdi
+ \advance\l@youtvdo by \l@youtvdii
+% \end{macrocode}
+% Save half the width in |\l@youtxci|.
+% \begin{macrocode}
+ \l@youtxci=\l@youthdo
+ \divide\l@youtxci by \tw@
+% \end{macrocode}
+% Set |\l@youtdvi| to be space between dimensions and labels.
+% \begin{macrocode}
+ \l@youthdvi=5\relax
+% \end{macrocode}
+% 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.
+% \begin{macrocode}
+ \l@youtycv=\l@youtvdii
+ \advance\l@youtycv by 17\relax
+ \l@youtxcii=\l@youthdo
+ \advance\l@youtxcii by 35\relax
+% \end{macrocode}
+% Draw a picture, with origin at the box's baseline. Use |\qbezier| to draw
+% a dotted line with a dot at intervals of 2pt.
+% \begin{macrocode}
+ \begin{picture}(\l@youtxcii,\l@youtycv)
+ \thinlines
+ \put(0,0){\usebox{\layoutsbox}}
+ \put(0,0){\circle*{2}}
+ \qbezier[\l@youtxci](0,0)(\l@youtxci,0)(\l@youthdo,0)
+ \put(0,-\l@youtvdi){\framebox(\l@youthdo,\l@youtvdo){}}
+% \end{macrocode}
+%
+% Add the dimension lines and labels (in tiny print).
+% Mark the reference point on the left of the box.
+% \begin{macrocode}
+ \begin{tiny}
+ \put(-\l@youthdvi,0){\makebox(0,0)[r]{reference}}
+% \end{macrocode}
+% Draw the width dimension above the box and the label above the dimension.
+% \begin{macrocode}
+ \l@youtycv=\l@youtvdii
+ \advance\l@youtycv by \l@youthdvi
+ \ifnum\l@youthdo > 6\relax
+ \l@yhrda{0}{\l@youtycv}{\l@youthdo}
+ \else
+ \l@yhrdia{0}{\l@youtycv}{\l@youthdo}
+ \fi
+ \advance\l@youtycv by \l@youthdvi
+ \put(\l@youtxci,\l@youtycv){\makebox(0,0)[b]{width}}
+% \end{macrocode}
+% 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).
+% \begin{macrocode}
+ \l@youtxcii=\l@youthdo
+ \advance\l@youtxcii by \l@youthdvi
+ \l@youtxciii=\l@youtxcii
+ \advance\l@youtxciii by \l@youthdvi
+ \ifnum\l@youtvdii > \z@
+% \end{macrocode}
+% The height is positive, so draw it, putting the label at the center of
+% the dimension line.
+% \begin{macrocode}
+ \ifnum\l@youtvdii > 6\relax
+ \l@yvuda{\l@youtxcii}{0}{\l@youtvdii}
+ \else
+ \l@yvudia{\l@youtxcii}{0}{\l@youtvdii}
+ \fi
+ \divide\l@youtvdii by \tw@
+ \put(\l@youtxciii,\l@youtvdii){\makebox(0,0)[l]{height}}
+ \fi
+ \ifnum\l@youtvdi > \z@
+% \end{macrocode}
+% The depth is positive, so draw it putting the label at the center of
+% the dimension line.
+% \begin{macrocode}
+ \ifnum\l@youtvdi > 6\relax
+ \l@yvuda{\l@youtxcii}{-\l@youtvdi}{\l@youtvdi}
+ \else
+ \l@yvudia{\l@youtxcii}{-\l@youtvdi}{\l@youtvdi}
+ \fi
+ \divide\l@youtvdi by \tw@
+ \put(\l@youtxciii,-\l@youtvdi){\makebox(0,0)[l]{depth}}
+ \fi
+% \end{macrocode}
+% This finishes the picture. Print the values if asked for.
+% \changes{v2.5}{2001/11/11}{Use \cs{ifprintparameters} for \cs{drawfontframelabel}}
+% \begin{macrocode}
+ \end{tiny}
+ \end{picture}
+ \ifprintparameters
+ \begin{center}\begin{footnotesize}\begin{ttfamily}
+ \begin{tabular}{lll}
+ \textrm{width} = \the\wd\layoutsbox &
+ \textrm{height} = \the\ht\layoutsbox &
+ \textrm{depth} = \the\dp\layoutsbox \\
+ \end{tabular}
+ \end{ttfamily}\end{footnotesize}\end{center}
+ \fi
+% \end{macrocode}
+% All done.
+% \begin{macrocode}
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% The end of this package.
+% \begin{macrocode}
+%</lays>
+% \end{macrocode}
+%
+%
+% \bibliographystyle{alpha}
+%
+% \begin{thebibliography}{GMS94}
+%
+% \bibitem[GMS94]{GOOSSENS94}
+% Michel Goossens, Frank Mittelbach, and Alexander Samarin.
+% \newblock {\em The LaTeX Companion}.
+% \newblock Addison-Wesley Publishing Company, 1994.
+%
+% \bibitem[Wil96]{PRW96i}
+% Peter~R. Wilson.
+% \newblock {\em {LaTeX for standards: The LaTeX package files user manual}}.
+% \newblock NIST Report NISTIR, June 1996.
+%
+% \end{thebibliography}
+%
+%
+% \Finale
+% \PrintIndex
+%
+\endinput
+
+%% \CharacterTable
+%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+
+
diff --git a/macros/latex/contrib/layouts/layouts.ins b/macros/latex/contrib/layouts/layouts.ins
new file mode 100644
index 0000000000..c5dfd03a87
--- /dev/null
+++ b/macros/latex/contrib/layouts/layouts.ins
@@ -0,0 +1,73 @@
+%% layouts.ins
+%% Author: Peter Wilson (Herries Press)
+%% Maintainer: Will Robertson (will dot robertson at latex-project dot org)
+%% Copyright 1998--2004 Peter R. Wilson
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c of this license or (at your option) any
+%% later version: <http://www.latex-project.org/lppl.txt>
+%%
+%% This work has the LPPL maintenance status "maintained".
+%% The Current Maintainer of this work is Will Robertson.
+%%
+%% This work consists of the files listed in the README file.
+%%
+%% This file will generate fast loadable files and documentation
+%% driver files from the doc files in this work when run through
+%% LaTeX.
+%%
+%%
+%% --------------- start of docstrip commands ------------------
+%%
+\def\batchfile{layouts.ins}
+\input docstrip.tex
+\preamble
+
+-----------------------------------------------------------------
+ Author: Peter Wilson (Herries Press)
+ Maintainer: Will Robertson (will dot robertson at latex-project dot org)
+ Copyright 1998--2004 Peter R. Wilson
+
+ This work may be distributed and/or modified under the
+ conditions of the LaTeX Project Public License, either
+ version 1.3c of this license or (at your option) any
+ later version: <http://www.latex-project.org/lppl.txt>
+
+ This work has the LPPL maintenance status "maintained".
+ The Current Maintainer of this work is Will Robertson.
+
+ This work consists of the files listed in the README file.
+-----------------------------------------------------------------
+
+\endpreamble
+
+\askforoverwritefalse
+\keepsilent
+
+%%% \Msg{*** Generating the driver file ***}
+%%% \generate{\file{layouts.drv}{\from{layouts.dtx}{driver}}}
+
+\Msg{*** Generating the LaTeX2e package files ***}
+
+\generate{\file{layouts.sty}{\from{layouts.dtx}{lays}}}
+
+\Msg{***********************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move the following}
+\Msg{* file(s) into a directory searched by TeX:}
+\Msg{*}
+\Msg{* \space\space layouts.sty}
+\Msg{*}
+\Msg{*}
+\Msg{* To produce the source documentation run the files ending with}
+\Msg{* `.dtx' through LaTeX.}
+\Msg{* Process any layouts.idx file by:}
+\Msg{* \space\space\space\space makeindex -s gind.ist layouts}
+\Msg{* Process any layouts.glo file by:}
+\Msg{* \space\space\space\space makeindex -s gglo.ist -o layouts.gls layouts.glo}
+\Msg{*}
+\Msg{* Happy TeXing}
+\Msg{***********************************************************}
+
+\endinput
diff --git a/macros/latex/contrib/layouts/layouts.pdf b/macros/latex/contrib/layouts/layouts.pdf
new file mode 100644
index 0000000000..e160bb3f12
--- /dev/null
+++ b/macros/latex/contrib/layouts/layouts.pdf
Binary files differ