Debian Codegraph @

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

raw
1 % \iffalse meta-comment
2 %
3 % ledmac.dtx
4 % Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net
5 % Maintainer:Maïeul Rouquette maieul at maieul dot net
6 % Copyright 2003 -- 2005 Peter R. Wilson / 2011-.. Maïeul Rouquette
7 %
8 % This work may be distributed and/or modified under the
9 % conditions of the LaTeX Project Public License, either
10 % version 1.3 of this license or (at your option) any
11 % later version.
12 % The latest version of the license is in
13 % http://www.latex-project.org/lppl.txt
14 % and version 1.3 or later is part of all distributions of
15 % LaTeX version 2003/06/01 or later.
16 %
17 % This work has the LPPL maintenance status "unmaintained".
18 %
19 % This work consists of the files listed in the README file.
20 %
21 %
22 %<*driver>
23 \documentclass[twoside]{ltxdoc}
24 \usepackage{url}
25 \usepackage[draft=false,
26 plainpages=false,
27 pdfpagelabels,
28 bookmarksnumbered,
29 % hyperindex=true
30 hyperindex=false
31 ]{hyperref}
32 \providecommand{\phantomsection}{} % just in case hyperref is not used
33 \usepackage{graphicx}
34 \makeatletter
35 \@mparswitchfalse
36 \makeatother
37 \EnableCrossrefs
38 \RecordChanges
39 \usepackage[noeledmac]{ledmac}
40 \CodelineIndex
41 %%\OnlyDescription
42 \renewcommand{\MakeUppercase}[1]{#1}
43 \pagestyle{headings}
44 \setcounter{StandardModuleDepth}{1}
45 \setcounter{IndexColumns}{2}
46 \begin{document}
47 \raggedbottom
48 \DocInput{ledmac.dtx}
49 \end{document}
50 %</driver>
51 %
52 % \fi
53 %
54 % \CheckSum{9342}
55 %
56 % \makeatletter
57 % \newcommand*{\DescribeIt}{\leavevmode\@bsphack\begingroup\MakePrivateLetters
58 % \Describe@It}
59 % \newcommand*{\Describe@It}[1]{\endgroup
60 % \marginpar{\raggedleft\PrintDescribeEnv{#1}}%
61 % \SpecialItIndex{#1}\@esphack\ignorespaces}
62 % \newcommand*{\SpecialItIndex}[1]{\@bsphack
63 % \index{#1\actualchar{\protect\ttfamily#1}\encapchar usage}\@esphack}
64 %
65 % \DoNotIndex{\@,\@@par,\@beginparpenalty,\@empty}
66 % \DoNotIndex{\@flushglue,\@input}
67 % \DoNotIndex{\@makefnmark,\@makeother,\@maketitle}
68 % \DoNotIndex{\@namedef,\@ne,\@spaces,\@tempa}
69 % \DoNotIndex{\@tempb,\@tempswafalse,\@tempswatrue}
70 % \DoNotIndex{\@thanks,\@thefnmark,\@topnum}
71 % \DoNotIndex{\@@,\@elt,\@forloop,\@fortmp,\@gtempa,\@totalleftmargin}
72 % \DoNotIndex{\",\/,\@ifundefined,\@nil,\@verbatim,\@vobeyspaces}
73 % \DoNotIndex{\|,\~,\ ,\active,\advance,\aftergroup,\begingroup,\bgroup}
74 % \DoNotIndex{\mathcal,\csname,\def,\documentstyle,\dospecials,\edef}
75 % \DoNotIndex{\egroup}
76 % \DoNotIndex{\else,\endcsname,\endgroup,\endinput,\endtrivlist}
77 % \DoNotIndex{\expandafter,\fi,\fnsymbol,\futurelet,\gdef,\global}
78 % \DoNotIndex{\hbox,\hss,\if,\if@inlabel,\if@tempswa,\if@twocolumn}
79 % \DoNotIndex{\ifcase}
80 % \DoNotIndex{\ifcat,\iffalse,\ifx,\ignorespaces,\index,\input,\item}
81 % \DoNotIndex{\jobname,\kern,\leavevmode,\leftskip,\let,\llap,\lower}
82 % \DoNotIndex{\m@ne,\next,\newpage,\nobreak,\noexpand,\nonfrenchspacing}
83 % \DoNotIndex{\obeylines,\or,\protect,\raggedleft,\rightskip,\rm,\sc}
84 % \DoNotIndex{\setbox,\setcounter,\small,\space,\string,\strut}
85 % \DoNotIndex{\strutbox}
86 % \DoNotIndex{\thefootnote,\thispagestyle,\topmargin,\trivlist,\tt}
87 % \DoNotIndex{\twocolumn,\typeout,\vss,\vtop,\xdef,\z@}
88 % \DoNotIndex{\,,\@bsphack,\@esphack,\@noligs,\@vobeyspaces,\@xverbatim}
89 % \DoNotIndex{\`,\catcode,\end,\escapechar,\frenchspacing,\glossary}
90 % \DoNotIndex{\hangindent,\hfil,\hfill,\hskip,\hspace,\ht,\it,\langle}
91 % \DoNotIndex{\leaders,\long,\makelabel,\marginpar,\markboth,\mathcode}
92 % \DoNotIndex{\mathsurround,\mbox,\newcount,\newdimen,\newskip}
93 % \DoNotIndex{\nopagebreak}
94 % \DoNotIndex{\parfillskip,\parindent,\parskip,\penalty,\raise,\rangle}
95 % \DoNotIndex{\section,\setlength,\TeX,\topsep,\underline,\unskip,\verb}
96 % \DoNotIndex{\vskip,\vspace,\widetilde,\\,\%,\@date,\@defpar}
97 % \DoNotIndex{\[,\{,\},\]}
98 % \DoNotIndex{\count@,\ifnum,\loop,\today,\uppercase,\uccode}
99 % \DoNotIndex{\baselineskip,\begin,\tw@}
100 % \DoNotIndex{\a,\b,\c,\d,\e,\f,\g,\h,\i,\j,\k,\l,\m,\n,\o,\p,\q}
101 % \DoNotIndex{\r,\s,\t,\u,\v,\w,\x,\y,\z,\A,\B,\C,\D,\E,\F,\G,\H}
102 % \DoNotIndex{\I,\J,\K,\L,\M,\N,\O,\P,\Q,\R,\S,\T,\U,\V,\W,\X,\Y,\Z}
103 % \DoNotIndex{\1,\2,\3,\4,\5,\6,\7,\8,\9,\0}
104 % \DoNotIndex{\!,\#,\$,\&,\',\(,\),\+,\.,\:,\;,\<,\=,\>,\?,\_}
105 % \DoNotIndex{\discretionary,\immediate,\makeatletter,\makeatother}
106 % \DoNotIndex{\meaning,\newenvironment,\par,\relax,\renewenvironment}
107 % \DoNotIndex{\repeat,\scriptsize,\selectfont,\the,\undefined}
108 % \DoNotIndex{\arabic,\do,\makeindex,\null,\number,\show,\write,\@ehc}
109 % \DoNotIndex{\@author,\@ehc,\@ifstar,\@sanitize,\@title,\everypar}
110 % \DoNotIndex{\if@minipage,\if@restonecol,\ifeof,\ifmmode}
111 % \DoNotIndex{\lccode,\newtoks,\onecolumn,\openin,\p@,\SelfDocumenting}
112 % \DoNotIndex{\settowidth,\@resetonecoltrue,\@resetonecolfalse,\bf}
113 % \DoNotIndex{\clearpage,\closein,\lowercase,\@inlabelfalse}
114 % \DoNotIndex{\selectfont,\mathcode,\newmathalphabet,\rmdefault}
115 % \DoNotIndex{\bfdefault}
116 % \DoNotIndex{\newcommand,\renewcommand,\providecommand}
117 % \DoNotIndex{\ ,\to,\hsize,\multiply,\textit}
118 %
119 % \GetFileInfo{ledmac.sty}
120 % \newcommand{\dtxfilename}{\texttt{ledmac.dtx}}
121 % \changes{v0.1}{2003/03/25}{First public release}
122 % \changes{v0.2}{2003/08/16}{Added tabmac code, and extended indexing}
123 % \changes{v0.2.1}{2003/09/13}{Bug fixes and match with mempatch v1.8}
124 % \changes{v0.2.2}{2003/11/09}{Improved paragraph footnotes}
125 % \changes{v0.2.2}{2003/11/09}{New Dekker example}
126 % \changes{v0.3}{2004/02/14}{Includes edstanza and more}
127 % \changes{v0.3.1}{2004/02/18}{Not released. Added remarks about the parallel package}
128 % \changes{v0.4}{2004/02/29}{Added minipage, etc., support}
129 % \changes{v0.4.1}{2004/03/28}{Not released. Minor editorial improvements and code tweaks}
130 % \changes{v0.5}{2004/04/04}{Added sidenotes, familiar footnotes in numbered text}
131 % \changes{v0.5.1}{2004/04/10}{Fixed right line numbers killed in v0.5}
132 % \changes{v0.6}{2004/11/16}{Fixed long paragraphs looping}
133 % \changes{v0.6}{2004/11/16}{Prepared for ledpar package}
134 % \changes{v0.6}{2004/12/10}{Fixed minor typos}
135 % \changes{v0.7}{2005/02/18}{Tidying up for ledpar and ledarab packages}
136 % \changes{v0.7}{2005/02/18}{Replaced all \cs{interAfootnotelinepenalty}, etc.,
137 % by just \cs{interfootnotelinepenalty}}
138 % \changes{v0.7}{2005/03/02}{ledmac having been available for 2 years,
139 % deleted the commented out original edmac texts}
140 % \changes{v0.7}{2011/06/17}{Ma\"ieul Rouquette new maintainer}
141 % \changes{v0.8}{2011/17/06}{Bug on endnotes fixed : in a // text, all endnotes will print and be placed at the ends of columns (!)}
142 % \changes{v0.8.1}{2011/07/14}{Bug on \cs{edtext} ; \cs{critex} ; \cs{lemma} fixed : we can now us non switching commands}
143 % \changes{v0.9}{2011/08/03}{No more ledpatch. All patches are now in the main file.}
144 % \changes{v0.9.1}{2011/08/08}{Fix some bugs linked to integrating ledpatch on the main file.}
145 % \changes{v0.10}{2011/08/22}{Corrections to \cs{section} and other titles in numbered sections}
146 % \changes{v0.11}{2011/09/16}{Makes it possible to add a symbol on each verse's hanging, as in French typography. Redefines the command \cs{hangingsymbol} to define the character.}
147 % \changes{v0.12}{2011/10/01}{Possibility to number the pstart with the commands \cs{numberpstarttrue}.}
148 % \changes{v0.12}{2011/10/01}{For compatibilty with ledpar, possibility to use \cs{autopar} on the right side.}
149 % \changes{v0.12.1}{2011/10/02}{The numbering of \cs{pstarts} restarts on each \cs{beginnumbering}.}
150 % \changes{v0.12.1}{2011/10/02}{Don't number \cs{pstarts} of stanza.}
151 %\changes{v0.13}{2011/11/08}{New stanzaindentsrepetition counter to repeat stanza indents every \emph{n} verses.}
152 % \changes{v0.13.1}{2011/11/18}{\cs{thepstartL} and \cs{thepstartR} use now \cs{bfseries} and not \cs{bf}, which is deprecated and makes conflicts with memoir class.}
153 % \changes{v0.14}{2012/04/04}{Tweaked \cs{edlabel} to get correct line number if the command is first element of a paragraph.}
154 % \changes{v0.19.2a}{2015/07/19}{Reledmac is released.}
155 % \changes{v0.19.3}{2015/10/14}{Fix bug with bidi v17.9 and following.}
156 % \changes{v0.19.4}{2016/08/06}{Fix bug with nested \cs{edtext} added by v.0.8.1 !}
157 %
158 % \hyphenation{man-u-script man-u-scripts}
159 %
160 % \newcommand{\Lpack}[1]{\textsf{#1}}
161 % \newcommand{\Lclass}[1]{\textsf{#1}}
162 % \newcommand{\file}[1]{\texttt{#1}}
163 % \newcommand{\ledmac}{ledmac}
164 % \newcommand{\Ledmac}{\Lpack{\ledmac}}
165 % \newcommand{\edmac}{\texttt{EDMAC}}
166 % \newcommand{\tabmac}{\texttt{TABMAC}}
167 % \newcommand{\edstanza}{\texttt{EDSTANZA}}
168 % \newcommand{\PWcomment}[1]{}
169 % \newenvironment{PW}{\itshape}{}
170 % \renewenvironment{PW}{\sffamily}{}
171 % \newcommand{\texbook}{\textit{TeXbook}}
172 % \newcommand{\thetexbook}{\textit{The TeXbook}}
173 %
174 % ^^A PW added following as the definitions are at some unknown elsewhere
175 % \newcommand{\egstart}{}
176 % \newcommand{\egmid}{}
177 % \newcommand{\egend}{}
178 %
179 % \renewcommand{\egstart}{%
180 % \par
181 % \begingroup
182 % \centering
183 % \begin{minipage}{0.45\textwidth}}
184 % \renewcommand{\egmid}{%
185 % \end{minipage}\hfill\begin{minipage}{0.45\textwidth}}
186 % \renewcommand{\egend}{%
187 % \end{minipage}\par\endgroup}
188 %
189 % \title{\Lpack{\ledmac} (deprecated)\\
190 % A presumptuous attempt to port \\
191 % \edmac, \tabmac{} and \edstanza{} to LaTeX\thanks{This file (\dtxfilename)
192 % has version number \fileversion, last revised \filedate.}}
193 %
194 % \author{%
195 % Peter Wilson \\
196 % Herries Press\thanks{%
197 % \texttt{herries dot press at earthlink dot net}} \\
198 % Ma\"ieul Rouquette\thanks{\texttt{maieul at maieul dot net}} \\
199 % {\small based on the original work by} \\
200 % John Lavagnino, Dominik Wujastyk, Herbert Breger and Wayne Sullivan
201 % }
202 %
203 % \date{}
204 %
205 % \iffalse This is a METACOMMENT
206 % This METACOMMENT is part of the original EDMAC
207 % Everything up to the next `\ fi' (without a blank) will
208 % be ignored. This is necessary because `%' may no longer
209 % be a comment mark when this file is read in.
210 %
211 % The original EDMAC was written by:
212 % \author{John Lavagnino\thanks{%
213 % Department of English and American Literature,
214 % Brandeis University,
215 % 415 South Street,
216 % Waltham, MA 02254--9110, USA.
217 % Internet: {\tt [email protected]},
218 % Bitnet: {\tt lav@brandeis}.}
219 % \and Dominik Wujastyk\thanks{%
220 % Wellcome Institute for the History of Medicine,
221 % 183 Euston Road,
222 % London NW1 2BE, UK.
223 % Internet: {\tt [email protected]},
224 % Bitnet: {\tt dow@harvunxw}.}}
225 % \date{}
226 %
227 %
228 % Macro file `EDMAC' for use with Plain TeX.
229 % Copyright (C) 1990, 1991, 1992, 1993, 1994 John Lavagnino and Dominik
230 % Wujastyk, all rights reserved.
231 %
232 % Copying of this file is authorized only if either
233 % (1) you make absolutely no changes to your copy, including name, or
234 % (2) if you do make changes, you name it something other than
235 % edmac.tex or edmac.doc
236 % This restriction helps to ensure that the macro development is orderly.
237 %
238 % \fi
239 %
240 % \maketitle
241 %
242 %
243 % {\large\bfseries This is documentation of deprecated ledmac package. If you are beginning a new project, we suggest that you use reledmac instead. If for old projects you can't migrate to reledmac, you can continue to use this documentation and the ledmac package. You should add noeledmac option when loading package, to disable message about eledmac.}
244 % \begin{abstract}
245 % \begin{PW}
246 % For over ten years \edmac, a set of \PlainTeX\ macros, has been
247 % available for typesetting critical editions in the traditional
248 % way, i.e., similar to the Oxford Classical Texts, Teubner, Arden
249 % Shakespeare and other series. A separate set of \PlainTeX\ macros,
250 % \tabmac, provides for tabular material. Another set of \PlainTeX\
251 % macros, \edstanza, assists in typesetting verse.
252 %
253 % The \Ledmac{} package makes the
254 % \edmac, \tabmac{} and \edstanza{} facilities available to authors
255 % who would prefer
256 % to use LaTeX. The principal functions provided by the package
257 % are marginal line numbering and multiple series of
258 % footnotes and endnotes keyed to line numbers.
259 %
260 % In addition to the \edmac, \tabmac{} and \edstanza{} functions the package
261 % also provides for index entries keyed to both page and line numbers.
262 % Multiple series of the familiar numbered footnotes are also available.
263 %
264 % Other LaTeX packages for critical editions include EDNOTES, and
265 % \Lpack{poemscol} for poetical works.
266 % \end{PW}
267 %
268 % To report bugs, please go to ledmac's GitHub page and click "New Issue": \url{https://github.com/maieul/ledmac/issues/}. You must open an account with github.com to access my page (maieul/ledmac). GitHub accounts are free for open-source users.
269 %
270 % You can subscribe to the eledmac email list in:\\ \url{https://lists.berlios.de/pipermail/ledmac-users/}
271 % \end{abstract}
272 %
273 % \tableofcontents
274 %
275 % \listoffigures
276 %
277 %
278 % \section{Introduction}
279 %
280 % \begin{PW}
281 % The \edmac{} macros \cite{EDMACTUG} for typesetting critical editions of texts
282 % have been available for use with TeX for some years. Since \edmac{}
283 % was introduced there has been a small but constant demand for a
284 % version of \edmac{} that could be used with LaTeX. The \Lpack{ledmac}
285 % package is an attempt to satisfy that request.
286 %
287 %
288 % \Ledmac{} would not have been possible without the amazing work by
289 % John Lavagnino\index{Lavagnino, John}
290 % and Dominik Wujastyk\index{Wujastyk, Dominik},
291 % the original authors of \edmac.
292 % I am very grateful for their encouragement and permission to use
293 % \edmac{} as a base.
294 % The majority of both the code and this manual are by these two.
295 % The tabular material is based on the
296 % \tabmac{} code~\cite{TABMAC}, by permission of its author,
297 % Herbert Breger\index{Breger, Herbert}.
298 % The verse-related code is by courtesy of Wayne Sullivan, the author
299 % of \edstanza~\cite{EDSTANZA}, who has kindly supplied more than
300 % his original macros.
301 %
302 % I have altered their code and documentation as little as possible.
303 % In order to more easily show the debt that I owe, my few
304 % contributions are in the font you are now reading. I have not
305 % noted minor editorial changes such as replacing `TeX' with `LaTeX'
306 % or replacing `\edmac' with `\Ledmac' or `package'. The original
307 % work is in the normal roman font.
308 %
309 % There are places where I have not supplied some of the original
310 % \edmac{} facilities, either because they are natively provided by
311 % LaTeX (such as font handling), or are available from other LaTeX
312 % packages (such as crop marks).
313 %
314 %
315 %
316 % \end{PW}
317 %
318 % \subsection{Overview}
319 %
320 % \begin{PW}
321 %
322 % The \Ledmac{} package, together with LaTeX, provides several
323 % important facilities for formatting critical editions of texts in
324 % a traditional manner. Major features include:
325 % \begin{itemize}\addtolength{\itemsep}{-1ex}
326 % \item automatic stepped line numbering, by page or by section;
327 % \item sub-lineation within the main series of line numbers;
328 % \item variant readings automatically keyed to line numbers;
329 % \item caters for both prose and verse;
330 % \item multiple series of footnotes and endnotes;
331 % \item block or columnar formatting of footnotes;
332 % \item simple tabular material may be line numbered;
333 % \item indexing keyed to page and line numbers.
334 % \end{itemize}
335 %
336 % \end{PW}
337 %
338 % \Ledmac{} allows the scholar engaged in preparing a critical
339 % edition to focus attention wholly on the task of creating the
340 % critical text and evaluating the variant readings, text-critical
341 % notes and testimonia. LaTeX and \Ledmac{} will take care of
342 % the formatting and visual correlation of all the disparate types
343 % of information.
344 %
345 %
346 % \begin{itshape}
347 % While \Ledmac{} can be used `out of the box', with little or
348 % no customization, you may also go to the other extreme and view
349 % it as a collection of tools. Critical editions are amongst the
350 % most idiosyncratic of books (like their authors), so we have made
351 % \Ledmac{} deliberately bland in some ways, while also trying to
352 % document it reasonably well so that you can find out how to make
353 % it do what you want.\par
354 % \end{itshape}
355 %
356 %
357 % \begin{PW}
358 %
359 % The original \edmac{} can be used as a `stand alone' processor
360 % or as part of a process. One example is its use as the formatting
361 % engine or `back end' for the output of an automatic manuscript
362 % collation program. \texttt{COLLATE}, written by
363 % Peter\index{Robinson, Peter} Robinson,
364 % runs on the Apple Macintosh, can collate simultaneously up to a
365 % hundred manuscripts of any length, and provides facilities for
366 % the scholar to tailor the collation interactively. For further
367 % details of this and other related work, visit the \edmac{} home page
368 % at \url{http://www.homepages.ucl.ac.uk/~ucgadkw/edmac/index.html}.
369 %
370 % Apart from \Ledmac{} there are some other LaTeX packages for
371 % critical edition typesetting. As I am not an author, or even a
372 % prospective one, of any critical
373 % edition work I cannot provide any opinions on what authors in this
374 % area might feel comfortable with or how well any of the packages
375 % meet their needs.
376 %
377 % \texttt{EDNOTES}~\cite{EDNOTES}, by Uwe L\"{u}ck\index{L\"uck, Uwe} and
378 % Christian Tapp\index{Tapp, Christian}, is another
379 % LaTeX package being developed for critical editions. Unlike \Ledmac{}
380 % which is based on \edmac, \texttt{EDNOTES} takes a different (internal)
381 % approach and provides a different set of features. For example it
382 % provides additional facilities for overlapping lemmas and for
383 % handling tables. For more information there is a web site at
384 % \url{http://ednotes.sty.de.vu} or
385 % email to \url{[email protected]}.
386 %
387 % The \Lpack{poemscol} package~\cite{POEMSCOLTUG} by John Burt\index{Burt, John}
388 % is designed for typesetting
389 % critical editions of collections of poems. I do not know how, or whether,
390 % \Lpack{poemscol} and \Ledmac{} will work together.
391 %
392 % Critical authors may find it useful
393 % to look at \edmac, \texttt{EDNOTES}, \Ledmac, and \Lpack{poemscol} to
394 % see which best meets their needs.
395 %
396 % At the time of writing I know of two web sites, apart from the \edmac{}
397 % home page, that have information on \Ledmac, and other programs.
398 % \begin{itemize}
399 % \item Jer\'{o}nimo Leal\index{Leal, Jeronimo@Leal, Jer\'{o}nimo}
400 % pointed me to \url{http://www.guit.sssup.it/latex/critical.html}. This
401 % also mentions another package for critical editions called
402 % \Lpack{MauroTeX} (\url{http://www.maurolico.unipi.it/mtex/mtex.htm}).
403 % These sites are both in Italian.
404 % \item Dirk-Jan Dekker\index{Dekker, Dirk-Jan} maintains
405 % \url{http://www.djdekker.net/ledmac}
406 % which is a FAQ for typesetting critical editions and \Ledmac.
407 % \end{itemize}
408 %
409 % \end{PW}
410 %
411 % This manual contains a general description of how to use
412 % \begin{PW}the LaTeX version of \edmac, namely \Ledmac,\end{PW}
413 % (in sections~\ref{howto} through~\ref{sec:lastuser});
414 % the complete source code for the package,
415 % with extensive documentation (in sections~\ref{overview}
416 % through \ref{end}); a series of examples (in
417 % Appendix~\ref{examples}); and an Index to the
418 % source code. We do not suggest that you need to
419 % read the source code for this package in order to use it; we
420 % provide this code primarily for reference, and many of our
421 % comments on it repeat material that is also found in
422 % the earlier sections. But no documentation, however
423 % thorough, can cover every question that comes up, and many can be
424 % answered quickly by consultation of the code. On a first reading,
425 % we suggest that you should skip from the general documentation in
426 % sections~\ref{howto} through~\ref{sec:lastuser} to the examples
427 % in Appendix~\ref{examples},
428 % unless you are particularly interested in the innards of \Ledmac.
429 %
430 % \subsection{History}
431 %
432 % \subsubsection{EDMAC}
433 %
434 % The original version of \edmac{} was \texttt{TEXTED.TEX}, written
435 % by John Lavagnino\index{Lavagnino, John}
436 % in late 1987 and early 1988 for formatting
437 % critical editions of English plays.
438 %
439 % John passed these macros on to Dominik Wujastyk\index{Wujastyk, Dominik}
440 % who, in
441 % September--October 1988, added the footnote paragraphing mechanism,
442 % margin swapping and other changes to suit his own purposes, making the
443 % style more like that traditionally used for classical texts in Latin and
444 % Greek (e.g., the Oxford Classical Texts series). He also wrote some
445 % extra documentation and sent the files out to several people. This
446 % version of the macros was the first to be called \edmac.
447 %
448 % The present version was developed in the summer of 1990, with the
449 % intent of adding necessary features, streamlining and documenting
450 % the code, and further generalizing it to make it easily adaptable
451 % to the needs of editors in different disciplines. John did most
452 % of the general reworking and documentation, with the financial
453 % assistance of the Division of the Humanities and Social Sciences,
454 % California Institute of Technology. Dominik adapted the code to
455 % the conventions of Frank Mittelbach's\index{Mittelbach, Frank}
456 % \verb"doc" option, and added some documentation, multiple-column
457 % footnotes, cross-references, and crop marks.\footnote{This version of
458 % the macros was used to format the Sanskrit text in volume I of {\em
459 % Metarules of P\=a\d ninian Grammar\/} by Dominik Wujastyk (Groningen:
460 % Forsten, 1993).} A description by John and Dominik of this version of
461 % \edmac{} was published as `An overview of \edmac: a \PlainTeX\
462 % format for critical editions', \emph{TUGboat} \textit{11} (1990),
463 % pp.\,623--643.
464 %
465 % From 1991 through 1994, the macros continued
466 % to evolve, and were tested at a
467 % number of sites. We are very grateful to all the members of the
468 % (now defunct)
469 % \verb"[email protected]" discussion group who helped us with
470 % smoothing out bugs and infelicities in the macros.
471 % Ron Whitney\index{Whitney, Ron} and our anonymous reviewer at
472 % the TUG were both of great help in ironing out last-minute
473 % wrinkles, while Ron made some important suggestions which may help
474 % to make future versions of \edmac{} even more efficient.
475 % Wayne
476 % Sullivan,\index{Sullivan, Wayne} in particular, provided several
477 % important fixes and contributions, including adapting the
478 % Mittelbach\slash
479 % Sch\"opf\index{Sch\"opf, Rainer}\index{Mittelbach, Frank} `New
480 % Font Selection Scheme' for use with \PlainTeX\ and \edmac.
481 % Another project Wayne has worked
482 % on is a \verb"DVI" post-processor which works with an \edmac{}
483 % that has been slightly modified to output \cs{special}s. This
484 % combination enables you to recover to some extent the text of
485 % each line, as {\sc ascii} code, facilitating the creation of
486 % concordances, an {\em index verborum}, etc.
487 %
488 % At the time of writing (1994), we are pleased to be able to say that \edmac{} is
489 % being used for real-life book production of several interesting
490 % editions, such as the Latin texts of Euclid's {\sl
491 % Elements},\footnote{Gerhard Brey\index{Brey, Gerhard} used \edmac{} in
492 % the production of Hubert L. L. Busard\index{Busard, Hubert L. L.} and
493 % Menso Folkerts,\index{Folkerts, Menso} {\em Robert of Chester's
494 % (?)\index{Chester, Robert of} Redaction of Euclid's\index{Euclid} {\em
495 % Elements}, the so-called Adelard II\index{Adelard II} Version}, 2 vols.,
496 % (Basel, Boston, Berlin: Birkh\"auser, 1992).} an edition of the letters
497 % of Nicolaus Copernicus,\footnote{Being prepared at the German Copernicus
498 % Research Institute, Munich.}\index{Copernicus, Nicolaus} Simon
499 % Bredon's\index{Bredon, Simon} {\em Arithmetica},\footnote{Being prepared
500 % by Menso Folkerts {\em et al.}, at the Institut f\"ur Geschichte der
501 % Naturwissenschaften in Munich.} a Latin translation by Plato of
502 % Tivoli\index{Plato of Tivoli} of an Arabic astrolabe
503 % text,\footnote{Richard Lorch,\index{Lorch, Richard} Gerhard
504 % Brey\index{Brey, Gerhard} {\em et al.}, at the same Institute.} a Latin
505 % translation of part II of the Arabic {\em Algebra\/} by Ab\=u K\=amil
506 % Shuj\=a' b. Aslam,\index{Abu Kamil Shuja' b. Aslam}\footnote{Richard
507 % Lorch, `Ab\=u K\=amil on the Pentagon and Decagon' in {\em Vestigia
508 % Mathematica}, ed.\ M. Folkerts and J. P. Hogendijk (Amsterdam, Atlanta:
509 % Rodopi, 1993).} the Latin {\em Rithmachia\/} of Werinher von
510 % Tegernsee,\footnote{Menso Folkerts, `Die {\em Rithmachia\/} des Werinher
511 % von Tegernsee', ibid.} a middle-Dutch romance epic on the
512 % Crusades,\footnote{Geert H. M. Claassens,\index{Claassens, Geert H. M.}
513 % {\em De Middelnederlandse Kruisvaartromans}, (Amsterdam: Schiphower en
514 % Brinkman, 1993).} a seventeenth-century Hungarian politico-philosophical
515 % tract,\footnote{Emil Hargittay, {\em Cs\'aky Istv\'an: Politica
516 % philosophiai Okoskod\'as-szerint val\'o rendes \'eletnek p\'eld\'aja
517 % (1664--1674)\/} (Budapest: Argumentum Kiad\'o, 1992).} an anonymous
518 % Latin compilation from Hungary entitled {\em Sermones Compilati in
519 % Studio Gererali Quinqeecclesiensi in Regno Ungarie},\footnote{Being
520 % produced, as was the previous book, by Gyula Mayer\index{Mayer, Gyula}
521 % in Budapest.} the collected letters and papers of
522 % Leibniz,\index{Leibniz}\footnote{Leibniz, {\em S\"amtliche Schriften und
523 % Briefe}, series {\sc I, III, VII,} being edited by Dr.\ H.
524 % Breger\index{Breger, Herbert}, Dr. N. G\"adeke\index{G\"adeke, Nora} and
525 % others,
526 % at the Leibniz-Archiv, Nieders\"achsische Landesbibliothek, Hannover.
527 % (see \url{http://www.nlb-hannover.de/Leibniz})}
528 % Theodosius's\index{Theodosius} {\em Spherics}, the German {\em
529 % Algorismus} of Sacrobosco,\index{Sacrobosco} the Sanskrit text of the
530 % {\em K\={a}\'{s}ik\={a}\-v\d{r}tti\/} of V\={a}mana\index{Vamana} and
531 % Jay\={a}ditya\index{Jayaditya},\footnote{Being prepared at Poona and
532 % Lausanne Universities.} and the English texts of Thomas
533 % Middleton's\index{Middleton, Thomas} collected works, as well as the
534 % editions illustrated in Appendix~\ref{examples}.
535 %
536 % \subsubsection{ledmac}
537 %
538 %
539 % \begin{PW}
540 %
541 % Version 1.0 of \tabmac{} was released by
542 % Herbert Breger\index{Breger, Herbert} in October
543 % 1996. This added the capability for typesetting tabular material.
544 %
545 % Version 0.01 of \edstanza{} was released by
546 % Wayne Sullivan~\index{Sullivan, Wayne}
547 % in June 1992, to help a colleague with typesetting Irish verse.
548 %
549 % In March 2003 Peter Wilson started an attempt to port \edmac{}
550 % from TeX to LaTeX. The starting point was \edmac{} version 3.16
551 % as documented on 19 July 1994 (available from CTAN). In August 2003
552 % the \tabmac{} functions were added; the starting point for these
553 % being version 1.0 of Ocober 1996. The \edstanza{} (v0.01) functions were
554 % added in February 2004. Sidenotes and regular footnotes in numbered
555 % text were added in April 2004.
556 % \end{PW}
557 %
558 %
559 % \section{The \Ledmac{} package}\label{howto}
560 %
561 %
562 % \Ledmac{} is a three-pass package like
563 % LaTeX itself.
564 % Although your textual apparatus and line
565 % numbers will be printed even on the first run, it takes two more
566 % passes through LaTeX to be sure that everything gets to its right
567 % place. Any changes you make to the input file may similarly
568 % require three passes to get everything to the right place, if the
569 % changes alter the number of lines or notes. \Ledmac{} will tell
570 % you that you need to make more runs, when it notices, but it does
571 % not expend the labor to check this thoroughly. If you have
572 % problems with a line or two misnumbered at the top of a page, try
573 % running LaTeX once or twice more.
574 %
575 % A file may mix \emph{numbered} and \emph{unnumbered} text.
576 % Numbered text is printed with marginal line numbers and can include
577 % footnotes and endnotes that are referenced to those line numbers:
578 % this is how you'll want to print the text that you're editing.
579 % Unnumbered text is not printed with line numbers, and you can't
580 % use \Ledmac's note commands with it: this is appropriate for
581 % introductions and other material added by the editor around the
582 % edited text.
583 %
584 %
585 % \section{Numbering text lines and paragraphs}
586 %
587 % \DescribeMacro{\beginnumbering}
588 % \DescribeMacro{\endnumbering}
589 % Each section of numbered text must be preceded by
590 % \cs{beginnumbering} and followed by \cs{endnumbering}, like: \\
591 % \cs{beginnumbering} \\
592 % \meta{text} \\
593 % \cs{endnumbering}
594 %
595 % The \cs{beginnumbering} macro resets the line number to zero,
596 % reads an auxiliary file called \meta{jobname}.\file{nn} (where
597 % \meta{jobname} is the name of the main input file for this job,
598 % and \file{nn} is 1 for the first numbered section, 2 for
599 % the second section, and so on), and then creates a new version of
600 % this auxiliary file to collect information during this run. The
601 % first instance of \cs{beginnumbering} also opens a file called
602 % \meta{jobname}\file{.end} to receive the text of the endnotes.
603 % \cs{endnumbering} closes the \meta{jobname}.\file{nn} file.
604 %
605 % If the line numbering of a text is to be continuous from start to end,
606 % then the whole text will be typed between one pair of
607 % \cs{beginnumbering} and \cs{endnumbering} commands. But your text
608 % will most often contain chapter or other divisions marking sections
609 % that should be independently numbered, and these will be appropriate
610 % places to begin new numbered sections. \Ledmac{} has to read and store
611 % in memory
612 % a certain amount of information about the entire section when it
613 % encounters a \cs{beginnumbering} command, so it speeds up the
614 % processing and reduces memory use when a text is divided into a larger
615 % number of sections (at the expense of multiplying the number of
616 % external files that are generated).
617 %
618 % \DescribeMacro{\pstart}
619 % \DescribeMacro{\pend}
620 % Within a numbered section, each paragraph of numbered text must
621 % be marked using the \cs{pstart} and \cs{pend} commands: \\
622 % \cs{pstart} \\
623 % \meta{paragraph of text} \\
624 % \cs{pend}
625 %
626 % Text that appears within a numbered section but isn't marked with
627 % \cs{pstart} and \cs{pend} will not be numbered.
628 %
629 % The following example shows the proper section and paragraph
630 % markup, and the kind of output that would typically be generated:
631 % \egstart
632 % \begin{verbatim}
633 % \beginnumbering
634 % \pstart
635 % This is a sample paragraph, with
636 % lines numbered automatically.
637 % \pend
638 %
639 % \pstart
640 % This paragraph too has its
641 % lines automatically numbered.
642 % \pend
643 %
644 % The lines of this paragraph are
645 % not numbered.
646 %
647 % \pstart
648 % And here the numbering begins
649 % again.
650 % \pend
651 % \endnumbering
652 % \end{verbatim}
653 % \egmid
654 % {\parskip0pt \count255=0
655 % \everypar={\advance \count255 by 1 \hbox to 1.5em{\the\count255\hfil}}
656 % This is a sample paragraph\par
657 % with lines numbered\par
658 % automatically.\smallskip
659 %
660 % This paragraph too\par
661 % has its lines automatically\par
662 % numbered.\smallskip
663 %
664 % \everypar={\hbox to 1.5em{\hfil}}
665 % The lines of this paragraph\par
666 % are not numbered.\smallskip
667 %
668 % \everypar={\advance \count255 by 1 \hbox to 1.5em{\the\count255\hfil}}
669 % And here the numbering\par
670 % begins again.\par}
671 % \egend
672 %
673 % \DescribeMacro{\autopar}
674 % You can use \cs{autopar} to avoid the nuisance of this paragraph markup
675 % and still have every paragraph automatically numbered. The scope of the
676 % \cs{autopar} command needs to be limited by keeping it within a group, as
677 % follows:
678 % \egstart
679 % \begin{verbatim}
680 % \begingroup
681 % \beginnumbering
682 % \autopar
683 %
684 % A paragraph of numbered text.
685 %
686 % Another paragraph of numbered
687 % text.
688 %
689 % \endnumbering
690 % \endgroup
691 % \end{verbatim}
692 % \egmid
693 % {\parskip0pt \count255=0
694 % \everypar={\advance \count255 by 1 \hbox to 1.5em{\the\count255\hfil}}
695 % A paragraph of numbered\par
696 % text.\smallskip
697 %
698 % Another paragraph of\par
699 % numbered text.\par}
700 % \egend
701 %
702 % \cs{autopar} fails, however, on paragraphs that start with a
703 % \verb"{" or with any other command that starts a new group before it
704 % generates any text. Such paragraphs need to be started explicitly,
705 % before the new group is opened,
706 % using \cs{indent}, \cs{noindent}, or \cs{leavevmode}, or using
707 % \cs{pstart} itself.\footnote{For a detailed study of the
708 % reasons for this restriction, see Barbara Beeton, `Initiation
709 % rites', \textit{TUGboat} \textbf{12} (1991),
710 % pp.\,257--258.\protect\index{Beeton, Barbara Ann Neuhaus Friend}}
711 %
712 % \begin{PW}
713 % \DescribeMacro{\firstlinenum}
714 % \DescribeMacro{\linenumincrement}
715 % By default, \Ledmac{} numbers every 5th line. There are two counters,
716 % \verb?firstlinenum? and \verb?linenumincrement?, that control this
717 % behaviour; they can be changed using \cs{firstlinenum}\marg{num} and
718 % \cs{linenumincrement}\marg{num}. \cs{firstlinenum} specifies the first
719 % line that will have a printed number, and \cs{linenumincrement} is
720 % the difference between succesive
721 % numbered lines. For example, to start printing numbers at the first line
722 % and to have every other line numbered: \\
723 % \verb?\firstlinenum{1} \linenumincrement{2}?
724 %
725 % \DescribeMacro{\firstsublinenum}
726 % \DescribeMacro{\sublinenumincrement}
727 % There are similar commands, \cs{firstsublinenum}\marg{num} and
728 % \cs{sublinenumincrement}\marg{num} for controlling sub-line numbering.
729 %
730 % \end{PW}
731 %
732 % \DescribeMacro{\pausenumbering}
733 % \DescribeMacro{\resumenumbering}
734 % \phantomsection\label{pause}\relax
735 % \Ledmac{} stores a lot of information about line numbers and
736 % footnotes in memory as it goes through a numbered section. But
737 % at the end of such a section, it empties its memory out, so to
738 % speak. If your text has a very long numbered section it is
739 % possible that your LaTeX may reach its memory limit. There are
740 % two solutions to this. The first is to get a larger LaTeX with
741 % increased memory.
742 % The second solution is to
743 % split your long section into several smaller ones. The trouble
744 % with this is that your line numbering will start again at zero
745 % with each new section. To avoid this problem, we provide
746 % \cs{pausenumbering} and \cs{resumenumbering} which are just
747 % like \cs{endnumbering} \ldots \cs{beginnumbering}, except that
748 % they arrange for your line numbering to continue across the break.
749 % Use \cs{pausenumbering} only between numbered paragraphs:
750 % \egstart
751 % \begin{verbatim}
752 % \beginnumbering
753 % \pstart
754 % Paragraph of text.
755 % \pend
756 % \pausenumbering
757 %
758 % \resumenumbering
759 % \pstart
760 % Another paragraph.
761 % \pend
762 % \endnumbering
763 % \end{verbatim}
764 % \egmid
765 % {\parskip0pt \count255=0
766 % \everypar={\advance \count255 by 1 \hbox to 1.5em{\the\count255\hfil}}
767 % Paragraph of\par
768 % text.\medskip
769 %
770 % Another paragraph.\par}
771 % \egend
772 %
773 % We have
774 % defined these commands as two macros, in case you find it necessary
775 % to insert text between numbered sections without disturbing the
776 % line numbering. But if you are really just using these macros to
777 % save memory, you might as well say
778 % \begin{verbatim}
779 % \newcommand{\memorybreak}{\pausenumbering\resumenumbering}
780 % \end{verbatim}
781 % and say \cs{memorybreak} between the relevant \cs{pend} and
782 % \cs{pstart}.
783 %
784 %\changes{v0.12}{2011/10/01}{Possibilty to number \cs{pstart}.}
785 % It's possible to insert a number at every \cs{pstart} command. You must use the \DescribeMacro{\numberpstarttrue}\cs{numberpstarttrue} command to have it. You can stop the numbering with \DescribeMacro{\numberpstartfalse}\cs{numberpstartfalse}. You can redefine the command \DescribeMacro{\thepstart}\cs{thepstart} to change style. On each \cs{beginnumbering} the numbering restarts.
786 % \changes{v0.15}{2012/06/11}{Possibilty to print \cs{pstart} number in side.}
787 % With the \cs{sidepstartnumtrue} command, the number of \cs{pstart} will be printed in side. In this case, the line number will be not printed.
788 % \subsection{Lineation commands}
789 % \DescribeMacro{\numberlinefalse} \DescribeMacro{\numberlinetrue}
790 % Line numbering can be disabled with \cs{numberlinefalse}. It can be enabled again with \cs{numberlinetrue}.
791 % \DescribeMacro{\lineation}
792 % Lines can be numbered either by page, by pstart or by section; you specify
793 % this using the \cs{lineation}\marg{arg}
794 % macro, where \meta{arg} is either
795 % \texttt{page}, \texttt{pstart} or \texttt{section}. You may only use this command at places
796 % where numbering is not in effect; you can't change the lineation system
797 % within a section. You can change it between sections: they don't all
798 % have to use the same lineation system.
799 % The package's standard setting is \verb"\lineation{section}". If the lineation is by pstart, the pstart number will be printed before the line number in the notes.
800 %
801 % \DescribeMacro{\linenummargin}
802 % The command \cs{linenummargin}\meta{location} specifies the margin
803 % where the line numbers will be printed. The permissable value
804 % for \meta{location} is one out of the list \texttt{left}, \texttt{right},
805 % \texttt{inner}, or \texttt{outer},
806 % for example \verb"\linenummargin{inner}".
807 % The package's default setting is \\
808 % \verb"\linenummargin{left}" \\
809 % to typeset the numbers in the left hand margin.
810 % You can change this whenever you're not in the middle of
811 % making a paragraph.
812 %
813 % \begin{PW}
814 % More precisely, the value of
815 % \cs{linenummargin} used is that in effect at the \cs{pend}
816 % of a numbered paragraph. Apart from an initial setting for
817 % \cs{linenummargin}, only change it after a \cs{pend}, whereupon
818 % it will apply to all following numbered paragraphs, until
819 % changed again (changing it between a \cs{pstart} and \cs{pend}
820 % pair will apply the change to all the current paragraph).
821 %
822 % \end{PW}
823 %
824 %
825 % \DescribeMacro{\firstlinenum}
826 % \DescribeMacro{\linenumincrement}
827 % \DescribeMacro{\firstsublinenum}
828 % \DescribeMacro{\sublinenumincrement}
829 % In most cases, you will not want a number printed for every
830 % single line of the text. Four LaTeX \verb"counters" control
831 % the printing of marginal numbers and they can be set by the
832 % macros \cs{firstlinenum}\marg{num}, etc.
833 % \cs{firstlinenum} specifies the number of the first line in a
834 % section to number, and \cs{linenumincrement} is the increment
835 % between numbered lines. \cs{firstsublinenum} and
836 % \cs{sublinenumincrement} do the same for
837 % sub-lines. Initially, all these are set to $5$ (e.g.,
838 % \verb?\firstlinenum{5}?.
839 %
840 % \begin{PW}
841 % \DescribeMacro{\linenumberlist}
842 % You can define \cs{linenumberlist} to specify a non-uniform distribution
843 % of printed line numbers. For example: \\
844 % \verb?\def\linenumberlist{1,2,3,5,7,11,13,17,19,23,29}? \\
845 % to have numbers printed on prime-numbered lines only. There must be
846 % no spaces within the definition which consists of comma-separated decimal
847 % numbers. The numbers can be in any order but it is easier to read if you
848 % put them in numerical order. Either omitting the definition of
849 % \cs{linenumberlist} or following the vacuous definition \\
850 % \verb?\def\linenumberlist{}? \\
851 % the standard numbering sequence is applied. The standard sequence
852 % is that specified by the combination of the \texttt{firstlinenum},
853 % \texttt{linenumincrement}, \texttt{firstsublinenum} and
854 % \texttt{linenumincrement} counter values.
855 % \end{PW}
856 %
857 % \DescribeMacro{\leftlinenum}
858 % \DescribeMacro{\rightlinenum}
859 % \DescribeMacro{\linenumsep}
860 % When a marginal line number is to be printed, there are a
861 % lot of ways to display it.
862 % You can redefine \cs{leftlinenum} and \cs{rightlinenum} to
863 % change the way marginal line numbers are printed in the
864 % left and right margins respectively; the initial
865 % versions print the number in font \cs{numlabfont} (described
866 % below) at a distance \cs{linenumsep} (initially set to one pica)
867 % from the text.
868 %
869 % \subsection{Changing the line numbers}
870 %
871 % Normally the line numbering starts at 1 for the first line of
872 % a section and steps up by one for each line thereafter. There
873 % are various common modifications of this system, however; the
874 % commands described here allow you to put such modifications
875 % into effect.
876 %
877 % \DescribeMacro{\startsub}
878 % \DescribeMacro{\endsub}
879 % You insert the \cs{startsub} and \cs{endsub} commands in your text
880 % to turn sub-lineation on and off. In plays, for
881 % example, stage directions are often numbered with sub-line
882 % numbers: as line $10.1$, $10.2$,
883 % $10.3$, rather than as $11$, $12$, and $13$.
884 % Titles and headings are sometimes numbered with sub-line numbers
885 % as well.
886 %
887 % When sub-lineation is in effect, the line number counter is
888 % frozen and the sub-line counter advances instead. If one of these
889 % commands appears in the middle of a line, it doesn't take effect
890 % until the next line; in other words, a line is counted as a line
891 % or sub-line depending on what it started out as, even if that
892 % changes in the middle.
893 %
894 % \DescribeMacro{\startlock}
895 % \DescribeMacro{\endlock}
896 % The \cs{startlock} command, used in running text, locks the
897 % line number at its current value, until you say \cs{endlock}.
898 % It can tell for itself whether you are in a patch of line or
899 % sub-line numbering. One use for line-number locking is in printing
900 % poetry: there the line numbers should be those of verse lines
901 % rather than of printed lines, even when a verse line requires several
902 % printed lines.
903 %
904 % \DescribeMacro{\lockdisp}
905 % When line-number locking is used,
906 % several printed lines may have the same line number, and you have to
907 % specify whether you want the number attached to the first printed
908 % line or the last, or whether you just want the number printed by
909 % them all. (This assumes that, on the basis of the settings of
910 % the previous parameters, it is necessary to display a line number for
911 % this line.) You specify your preference using \cs{lockdisp}\marg{arg}; its
912 % argument is a word, either \texttt{first}, \texttt{last}, or \texttt{all}.
913 % The package initially sets this as \verb"\lockdisp{first}".
914 %
915 % \DescribeMacro{\setline}
916 % \DescribeMacro{\advanceline}
917 % In some cases you may want to modify the line numbers that are
918 % automatically calculated: if you are printing only fragments
919 % of a work but want to print line numbers appropriate to a complete
920 % version, for example. The \cs{setline}\marg{num} and
921 % \cs{advanceline}\marg{num} commands
922 % may be used to change the current line's number (or the sub-line
923 % number, if sub-lineation is currently on). They change both the
924 % marginal line numbers and the line numbers passed to the notes.
925 % \cs{setline} takes one argument, the value to which you want
926 % the line number set; it must be $0$ or greater. \cs{advanceline}
927 % takes one argument, an amount that should be added to the current
928 % line number; it may be positive or negative.
929 %
930 % \begin{PW}
931 % \DescribeMacro{\setlinenum}
932 % The \verb?\setline? and \verb?\advanceline? macros should only be used
933 % within a \verb?\pstart...\pend? group. The \cs{setlinenum}\marg{num}
934 % command can be used outside such a group, for example between
935 % a \verb?pend? and a \verb?\pstart?. It sets the line number
936 % to \meta{num}.
937 % It has no effect if used within a \verb?\pstart...\pend? group
938 % \end{PW}
939 %
940 % \begin{PW}
941 % \DescribeMacro{\linenumberstyle}
942 % \DescribeMacro{\sublinenumberstyle}
943 % Line numbers are nomally printed as arabic numbers. You can
944 % use \cs{linenumberstyle}\marg{style} to change the numbering style.
945 % \meta{style} must be one of:
946 % \begin{itemize}
947 % \item[\texttt{Alph}] Uppercase letters (A\ldots Z).
948 % \item[\texttt{alph}] Lowercase letters (a\ldots z).
949 % \item[\texttt{arabic}] Arabic numerals (1, 2, \ldots)
950 % \item[\texttt{Roman}] Uppercase Roman numerals (I, II, \ldots)
951 % \item[\texttt{roman}] Lowercase Roman numerals (i, ii, \ldots)
952 % \end{itemize}
953 % Note that with the \texttt{Alph} or \texttt{alph} styles, `numbers'
954 % must be between 1 and 26 inclusive.
955 %
956 % Similarly \cs{sublinenumberstyle}\marg{style} can be used to change
957 % the numbering style of sub-line numbers, which is normally arabic numerals.
958 % \end{PW}
959 %
960 % \begin{PW}
961 % \DescribeMacro{\skipnumbering}
962 % When inserted into a numbered line the macro \cs{skipnumbering} causes
963 % the numbering of that particular line to be skipped; that is, the line
964 % number is unchanged and no line number will be printed.
965 %
966 % \end{PW}
967 %
968 % \section{The apparatus}
969 %
970 % \begin{PW}
971 % \DescribeMacro{\edtext}
972 % Within numbered paragraphs, all footnotes and endnotes are generated
973 % by the \cs{edtext} macro:
974 % \begin{verse}
975 % \cs{edtext}\marg{lemma}\marg{commands}
976 % \end{verse}
977 % \end{PW}
978 %
979 %
980 % The \meta{lemma} argument is the lemma in the main text: \cs{edtext}
981 % both prints this as part of the text, and makes it available to the
982 % \meta{commands} you specify to generate notes.
983 %
984 % For example:
985 % \egstart
986 % \begin{verbatim}
987 % I saw my friend \edtext{Smith}{
988 % \Afootnote{Jones C, D.}}
989 % on Tuesday.
990 % \end{verbatim}
991 % \egmid
992 % 1\enspace I saw my friend\\
993 % 2\enspace Smith on Tuesday.\smallskip
994 % \hrule width 1.5cm
995 % \strut {\bf 2} Smith] Jones C, D.
996 % \egend
997 %
998 % The lemma \verb?Smith? is printed as part of this sentence in
999 % the text, and is also made available to the footnote
1000 % that specifies a variant, \verb?Jones C, D?. The footnote macro
1001 % is supplied with the line number at which the lemma appears
1002 % in the main text.
1003 %
1004 % The \meta{lemma} may contain further \cs{edtext} commands.
1005 % Nesting makes
1006 % it possible to print an explanatory note on a long passage together with
1007 % notes on variants for individual words within the passage. For
1008 % example:
1009 % \egstart
1010 % \begin{verbatim}
1011 % \edtext{I saw my friend
1012 % \edtext{Smith}{\Afootnote{Jones
1013 % C, D.}} on Tuesday.}{
1014 % \Bfootnote{The date was
1015 % July 16, 1954.}
1016 % }
1017 % \end{verbatim}
1018 % \egmid
1019 % 1\enspace I saw my friend\\
1020 % 2\enspace Smith on Tuesday.\smallskip
1021 % \hrule width 1.5cm
1022 % \strut {\bf 2} Smith] Jones C, D.\smallskip
1023 % \hrule width 1.5cm
1024 % \strut {\bf 1--2} I saw my friend \\
1025 % Smith on Tuesday.] The\\ date was
1026 % July 16, 1954.
1027 % \egend
1028 %
1029 % However, \cs{edtext} cannot handle overlapping but unnested
1030 % notes---for example, one note covering lines 10--15, and another
1031 % covering 12--18; a \cs{edtext} that starts in the \meta{lemma}
1032 % argument of another \cs{edtext} must end there, too. (The
1033 % \cs{lemma} and \cs{linenum} commands may be used to
1034 % generate overlapping notes if necessary.)
1035 %
1036 % \paragraph{Commands used in {\tt\protect\bslash edtext}'s second argument}
1037 %
1038 % The second argument of the \cs{edtext} macro, \meta{commands},
1039 % may contain a series of subsidiary commands that generate
1040 % various kinds of notes.
1041 %
1042 % \DescribeMacro{\Afootnote}
1043 % \DescribeMacro{\Bfootnote}
1044 % \DescribeMacro{\Cfootnote}
1045 % \DescribeMacro{\Dfootnote}
1046 % \DescribeMacro{\Efootnote}
1047 % Five separate series of footnotes are maintained; each macro
1048 % taking one argument like \cs{Afootnote}\marg{text}. When all five
1049 % are used, the \texttt{A} notes appear in a layer just below the main
1050 % text, followed by the rest in turn, down to the \texttt{E} notes at
1051 % the bottom. These are the main macros that you will use to construct
1052 % the critical apparatus of your text. The package provides five
1053 % layers of notes in the belief that this will be adequate for
1054 % the most demanding editions. But it is not hard to add further
1055 % layers of notes should they be required.
1056 %
1057 % \DescribeMacro{\Aendnote}
1058 % \DescribeMacro{\Bendnote}
1059 % \DescribeMacro{\Cendnote}
1060 % \DescribeMacro{\Dendnote}
1061 % \DescribeMacro{\Eendnote}
1062 % The package also maintains five separate series of endnotes.
1063 % Like footnotes each macro takes a single argument like
1064 % \cs{Aendnote}\marg{text}.
1065 % Normally, none of them is printed: you must use the
1066 % \cs{doendnotes} macro described below
1067 % (p.\,\pageref{doendnotes}) to call for their
1068 % output at the appropriate point in your document.
1069 %
1070 % \DescribeMacro{\lemma}
1071 % Sometimes you want to change the lemma that gets passed to the notes.
1072 % You can do this by using \cs{lemma}\marg{alternative} within the
1073 % second argument to \cs{edtext}, before the note commands.
1074 % The most common use of this command is to abbreviate the lemma that's
1075 % printed in the notes. For example:
1076 % \egstart
1077 % \begin{verbatim}
1078 % \edtext{I saw my friend
1079 % \edtext{Smith}{\Afootnote{Jones
1080 % C, D.}} on Tuesday.}
1081 % {\lemma{I \dots\ Tuesday.}
1082 % \Bfootnote{The date was
1083 % July 16, 1954.}
1084 % }
1085 % \end{verbatim}
1086 % \egmid
1087 % 1\enspace I saw my friend\\
1088 % 2\enspace Smith on Tuesday.\smallskip
1089 % \hrule width 1.5cm
1090 % \strut {\bf 2} Smith] Jones C, D.\smallskip
1091 % \hrule width 1.5cm
1092 % \strut {\bf 1--2} I \dots\ Tuesday.] \\
1093 % The date was July 16, 1954.
1094 % \egend
1095 %
1096 % \DescribeMacro{\linenum}
1097 % \phantomsection\label{linenum}\relax
1098 % You can use \cs{linenum}\marg{arg} to change the line numbers passed to
1099 % the notes. The notes are actually given seven parameters: the page,
1100 % line, and sub-line number for the start of the lemma; the same
1101 % three numbers for the end of the lemma; and the font specifier
1102 % for the lemma. As the argument to \cs{linenum}, you specify
1103 % those seven parameters in that order, separated by vertical bars
1104 % (the \verb"|" character). However, you can retain the value
1105 % computed by \Ledmac{} for any number by simply omitting it; and
1106 % you can omit a sequence of vertical bars at the end of the
1107 % argument. For example, \verb"\linenum{|||23}" changes one number,
1108 % the ending page number of the current lemma.
1109 %
1110 % This command doesn't change the marginal line numbers in any way;
1111 % it just changes the numbers passed to the footnotes. Its use comes in
1112 % situations that \cs{edtext} has trouble dealing with for
1113 % whatever reason. If you need notes for overlapping passages that
1114 % aren't nested, for instance, you can use \cs{lemma} and
1115 % \cs{linenum} to generate such notes despite the limitations of
1116 % \cs{edtext}. If the \meta{lemma} argument to \cs{edtext} is
1117 % extremely long, you may run out of memory; here again you can
1118 % specify a note with an abbreviated lemma using \cs{lemma} and
1119 % \cs{linenum}. The numbers used in \cs{linenum} need not be
1120 % entered manually; you can use the `\texttt{x-}' symbolic cross-referencing
1121 % commands below (p.\,\pageref{crossref}) to compute them
1122 % automatically.
1123 %
1124 % Similarly, being able to manually change the lemma's font specifier
1125 % in the notes might be important if you were using multiple scripts or
1126 % languages. The form of the font specifier is three
1127 % separate codes separated by \verb"/" characters, giving the family,
1128 % series, and shape codes as defined within NFSS.
1129 %
1130 % \paragraph{Changing the names of these commands}
1131 %
1132 % The commands for generating the apparatus have been given
1133 % rather bland names, because editors in different fields have
1134 % widely divergent notions of what sort of notes are required, where
1135 % they should be printed, and what they should be called. But this
1136 % doesn't mean you have to type \cs{Afootnote} when you'd rather
1137 % say something you find more meaningful, like \cs{variant}. We
1138 % recommend that you create a series of such aliases and use them
1139 % instead of the names chosen here; all you have to do is put commands
1140 % of this form at the start of your file:
1141 % \begin{verbatim}
1142 % \let\variant=\Afootnote
1143 % \let\explanatory=\Bfootnote
1144 % \let\trivial=\Aendnote
1145 % \let\testimonia=\Cfootnote
1146 % \end{verbatim}
1147 %
1148 %
1149 % \subsection{Alternate footnote formatting}
1150 % If you just launch into \Ledmac{} using the commands outlined
1151 % above, you will get a standard layout for your text and notes. You
1152 % may be happy to accept this at the very beginning, while you
1153 % get the hang of things, but the standard layout is not particularly
1154 % pretty, and you will certainly want to modify it in due course.
1155 % The package provides ways of changing the fonts and layout of
1156 % your text, but these are not aimed at being totally comprehensive.
1157 % They are enough to deal with simple variations from the norm, and
1158 % to exemplify how you might go on to make more swingeing changes.
1159 %
1160 % \DescribeMacro{\footparagraph}
1161 % \DescribeMacro{\foottwocol}
1162 % \DescribeMacro{\footthreecol}
1163 % All footnotes will normally be formatted as a series of separate
1164 % paragraphs in one column. But there are three other formats
1165 % available for notes, and using these macros you can select a
1166 % different format for a series of notes.
1167 % \begin{itemize}
1168 % \item \cs{footparagraph} formats
1169 % all the footnotes of a series as a single paragraph (see
1170 % figs.~\ref{iocasta-out} and \ref{periphyseon-out},
1171 % pp.\,\pageref{iocasta-out} and \pageref{periphyseon-out});
1172 % \item \cs{foottwocol} formats them as separate paragraphs,
1173 % but in two columns (see bottom notes in fig.~\ref{arden-out},
1174 % p.\,\pageref{arden-out});
1175 % \item \cs{footthreecol}, in three columns (see second layer of notes in
1176 % fig.\ref{features-out}, p.\,\pageref{features-out}).
1177 % \end{itemize}
1178 % Each of these macros
1179 % takes one argument: a letter (between \verb"A" and \verb"E") for
1180 % the series of notes you want changed.
1181 % So a text with three layers of notes might begin thus:
1182 % \begin{verbatim}
1183 % \footnormal{A}
1184 % \footthreecol{B}
1185 % \footparagraph{C}
1186 % \end{verbatim}
1187 % This would make the A-notes ordinary, B-notes would be in three
1188 % columns, and the bottom layer of notes would be formed into
1189 % a paragraph on each page.
1190 %
1191 % \DescribeMacro{\interparanoteglue}
1192 % If you use paragraphed footnotes, the macro \cs{interparanoteglue}
1193 % defines the glue appearing in between footnotes in the paragraph.
1194 % It is a macro whose argument is the glue you want, and its
1195 % initial setting is (see p.\,\pageref{interparanoteglue}):
1196 % \begin{verbatim}
1197 % \interparanoteglue{1em plus .4em minus .4em}
1198 % \end{verbatim}
1199 %
1200 %
1201 % \begin{PW}
1202 % You should set up the page layout parameters, and in particular the
1203 % \cs{baselineskip} of the footnotes (this is done for you if you
1204 % use the standard \cs{notefontsetup}), before you call any
1205 % of these macros because their action depends on these;\end{PW}
1206 % too much or too little space will be allotted for the notes on
1207 % the page if these macros use the wrong
1208 % values.\footnote{\phantomsection\label{nobreaks}There
1209 % is one tiny proviso about using paragraphed notes: you shouldn't
1210 % force any explicit line-breaks inside such notes: do not use
1211 % {\tt \bslash par},
1212 % {\tt \bslash break}, or {\tt \bslash penalty=-10000}. If
1213 % you must have a line-break for some obscure reason, just suggest
1214 % the break very strongly: {\tt \bslash penalty=-9999} will do
1215 % the trick. Page \pageref{nobreak} explains why this restriction
1216 % is necessary.}
1217 %
1218 % \begin{PW}
1219 % \subsection{Creating a new series}
1220 %
1221 % If you need more than 5 series of critical footnotes you can
1222 % readily create extra series. For example to create a G series
1223 % you have to put the following code into either a \file{.sty}
1224 % package file, or into the preamble sandwiched between
1225 % \verb?\makeatletter? and \verb?\makeatother? declarations.
1226 % \begin{verbatim}
1227 % \newcommand*{\Gfootnote}[1]{%
1228 % \ifnumberedpar@
1229 % \xright@appenditem{\noexpand\vGfootnote{G}%
1230 % {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list
1231 % \global\advance\insert@count by \@ne
1232 % \else
1233 % \vGfootnote{G}{{0|0|0|0|0|0|0}{}{#1}}%
1234 % \fi\ignorespaces}
1235 % \newinsert\Gfootins
1236 %
1237 % \newcommand*{\mpGfootnote}[1]{%
1238 % \ifnumberedpar@
1239 % \xright@appenditem{\noexpand\mpvGfootnote{G}%
1240 % {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list
1241 % \global\advance\insert@count by \@ne
1242 % \else
1243 % \mpvGfootnote{G}{{0|0|0|0|0|0|0}{}{#1}}%
1244 % \fi\ignorespaces}
1245 % \newinsert\mpGfootins
1246 %
1247 % \addfootins{G}
1248 % \footnormal{G}
1249 % \end{verbatim}
1250 %
1251 % \end{PW}
1252 %
1253 % \section{Fonts}\label{fonts}
1254 % One of the most important features of the appearance of the notes,
1255 % and indeed of your whole document, will be the fonts used. We will
1256 % first describe the commands that give you control over the
1257 % use of fonts in the different structural elements of the document,
1258 % especially within the notes, and then in
1259 % subsequent sections specify how these commands are used.
1260 %
1261 % For those who are setting up for a large job, here is
1262 % a list of the complete set of \Ledmac{} macros relating to fonts that
1263 % are intended for manipulation by the user:
1264 % \cs{endashchar},
1265 % \cs{fullstop},
1266 % \cs{notefontsetup},
1267 % \cs{notenumfont},
1268 % \cs{numlabfont}, and
1269 % \cs{rbracket}.
1270 %
1271 % \DescribeMacro{\notefontsetup}
1272 % \phantomsection\label{notefonts}\relax
1273 % The \cs{notefontsetup} macro defines the standard size of the
1274 % fonts for all your footnotes; \Ledmac{} initially defines
1275 % this as: \\
1276 % \verb"\newcommand*{\notefontsetup}{\footnotesize}"
1277 %
1278 % \DescribeMacro{\notenumfont}
1279 % The \cs{notenumfont} macro specifies the font used for the line
1280 % numbers printed in notes. This will typically be a command like
1281 % \cs{bfseries} that selects a distinctive style for the
1282 % note numbers, but leaves the choice of a size up to
1283 % \cs{notefontsetup}.
1284 % \Ledmac{} initially defines: \\
1285 % \verb"\newcommand{\notenumfont}{\normalfont}" \\
1286 % thus using the main document font.
1287 %
1288 %
1289 % \DescribeMacro{\numlabfont}
1290 % Line numbers for the main text
1291 % are usually printed in a smaller font in the margin.
1292 % The \cs{numlabfont} macro is provided as a standard name for
1293 % that font: it is initially defined as \\
1294 % \verb"\newcommand{\numlabfont}{\normalfont\scriptsize}" \\
1295 % You might wish to use a different font if, for example,
1296 % you preferred to have these line numbers printed using
1297 % old-style numerals.
1298 %
1299 % \PWcomment{Deleted subsections dealing with the NFSS and Plain
1300 % font selection as only NFSS is used.}
1301 %
1302 %
1303 % Here are some examples of how you might redefine some of the font
1304 % macros.
1305 % \begin{verbatim}
1306 % \renewcommand*{\notefontsetup}{\small}
1307 % \renewcommand*{\notenumfont}{\sffamily}
1308 % \end{verbatim}
1309 % These commands select \cs{small} fonts for the notes, and choose a
1310 % sans font for the line numbers within notes.
1311 %
1312 %
1313 %
1314 % \DescribeMacro{\endashchar}
1315 % \DescribeMacro{\fullstop}
1316 % \DescribeMacro{\rbracket}
1317 % \font\teni=cmmi10
1318 % A relatively trivial matter relates to punctuation. In your
1319 % footnotes, there will sometimes be spans of line numbers like
1320 % this: 12--34, or lines with sub-line numbers like this: 55.6. The
1321 % en-dash and the full stop are taken from the same font as the
1322 % numbers, and it all works nicely. But what if you wanted to use
1323 % old-style numbers, like {\teni12} and {\teni34}? These look nice
1324 % in an edition, but when you use the fonts provided by \PlainTeX\
1325 % they are taken from a math font which does not
1326 % have the en-dash or full stop in the same places as a text font.
1327 % If you (or your macros) just typed \verb"$\oldstyle 12--34$" or
1328 % \verb"$\oldstyle 55.6$" you would get `{\teni12--34}'and
1329 % `{\teni55.6}'. So we define \cs{endashchar} and
1330 % \cs{fullstop}, which produce an en-dash and a full stop
1331 % respectively from the normal document font, whatever font you are using
1332 % for the numbers. These two macros are used in the
1333 % macros which format the line numbers in the margins and
1334 % footnotes, instead of explicit punctuation.
1335 % We also define an \cs{rbracket} macro for the
1336 % right square bracket printed at the end of the lemma in many
1337 % styles of textual notes (including \Ledmac's standard style).
1338 %
1339 %
1340 %
1341 % \DescribeMacro{\select@lemmafont}
1342 % We will briefly discuss \cs{select@lemmafont}
1343 % here because it is important to know about
1344 % it now, although it is not one of the macros you would expect to
1345 % change in the course of a simple job. Hence it is `protected'
1346 % by having the @-sign in its name.
1347 %
1348 % When you use the \cs{edtext} macro to mark a word in your text
1349 % as a lemma, that word will normally be printed again in your
1350 % apparatus. If the word in the text happens to be in a font such
1351 % as italic or bold you would probably expect it to appear in the
1352 % apparatus in the same font. This becomes an absolute necessity
1353 % if the font is actually a different script, such as Arabic or
1354 % Cyrillic. \cs{select@lemmafont} does the work of
1355 % decoding \Ledmac's data about the fonts used to print the lemma in
1356 % the main text and calling up those fonts for printing the lemma in
1357 % the note.
1358 %
1359 % \cs{select@lemmafont} is a macro that takes one long
1360 % argument---the cluster of line numbers passed to the note
1361 % commands. This cluster ends with a code indicating what
1362 % fonts were in use at the start of the lemma.
1363 % \cs{select@lemmafont} selects the appropriate font for the
1364 % note using that font specifier.
1365 %
1366 % \Ledmac{} uses \cs{select@lemmafont} in a standard footnote
1367 % format macro called \cs{normalfootfmt}. The footnote formats
1368 % for each of the layers \texttt{A} to \texttt{E} are \cs{let} equal
1369 % to \cs{normalfootfmt}. So all the layers of footnotes are
1370 % formatted in the same way.
1371 %
1372 % But it is also likely that you might want to have different fonts
1373 % for just, say, the note numbers in layers \texttt{A} and \texttt{B} of
1374 % your apparatus. To do this, make two copies of the
1375 % \cs{normalfootfmt} macro (see p.\,\pageref{normalfootfmt})---or
1376 % \cs{twocolfootfmt}, or the other appropriate macro ending in
1377 % \verb"-footfmt", depending on what footnote format you have
1378 % selected---and give these macros the names \cs{Afootfmt} and
1379 % \cs{Bfootfmt}. Then, in these new macros, change the font
1380 % specifications (and spacing, or whatever) to your liking.
1381 %
1382 % \begin{PW}
1383 % As an example, in some texts the lemma in a footnote ends with a
1384 % right bracket except where the lemma is an abbreviation (often
1385 % typeset in italics). This requirement can be met as follows,
1386 % assuming that the `A' series footnote will be used.
1387 %
1388 % First, define \cs{Afootfmt} as a modified version of the original
1389 % \cs{normalfootfmt}
1390 % (all the following should be enclosed in \cs{makeatletter} and
1391 % \cs{makeatother} if it is in the preamble). The change is
1392 % modifying |...#2}\rbracket\enskip...| to read
1393 % |...#2\rbracket}\enskip...|, so that \cs{rbracket} is inside the group
1394 % that includes the lemma argument.
1395 % \begin{verbatim}
1396 % \renewcommand{\Afootfmt}[3]{%
1397 % \ledsetnormalparstuff
1398 % {\notenumfont\printlines#1|}\strut\enspace
1399 % {\select@lemmafont#1|#2\rbracket}\enskip#3\strut\par}
1400 % \end{verbatim}
1401 % Define an `abbreviation' macro that kills the definition of \cs{rbracket}.
1402 % \begin{verbatim}
1403 % \newcommand*{\nobrak}{}
1404 % \newcommand{\abb}[1]{\textit{#1}\let\rbracket\nobrak\relax}
1405 % \end{verbatim}
1406 % Finally, make sure that \cs{abb} is not expanded during the first
1407 % processing of a line.
1408 % \begin{verbatim}
1409 % \newcommand{\morenoexpands}{%
1410 % \let\abb=0%
1411 % }
1412 % \end{verbatim}
1413 %
1414 % Now code like the following can be used, and `lemma' will be footnoted
1415 % with a `]' and `abbrv' will have no `]'.
1416 % \begin{verbatim}
1417 % A sentence with a \edtext{lemma}{\Afootnote{ordinary}} in it.
1418 % A sentence with an \edtext{\abb{abbrv}}{\Afootnote{abbreviated}} in it.
1419 % \end{verbatim}
1420 %
1421 % \end{PW}
1422 %
1423 % \section{Verse}
1424 %
1425 % \begin{PW}
1426 %
1427 % In 1992 Wayne Sullivan\footnote{Department of Mathematics,
1428 % University College,
1429 % Dublin 4, Ireland}
1430 % wrote the \edstanza{} macros~\cite{EDSTANZA}
1431 % for typesetting verse in a critical edition. More specifically
1432 % they were for handling poetry stanzas which use indentation to
1433 % indicate rhyme or metre.
1434 %
1435 % With Wayne Sullivan's\index{Sullivan, Wayne} permission the majority
1436 % of this section has
1437 % been taken from~\cite{EDSTANZA}. I have made a few changes to enable his
1438 % macros to be used in the LaTeX \Lpack{ledmac}
1439 % package.
1440 %
1441 % \end{PW}
1442 %
1443 % \DescribeMacro{\stanza}
1444 % \DescribeMacro{\&}
1445 % Use \verb?\stanza? at the start of a stanza. Each line in a stanza
1446 % is ended by an ampersand (\&), and the stanza itself is ended
1447 % by putting \verb?\&? at the end of the last line.
1448 %
1449 % \DescribeMacro{\stanzaindentbase}
1450 % Lines within a stanza may be indented. The indents are integer multiples
1451 % of the length \verb?\stanzaindentbase?, whose default value is 20pt.
1452 %
1453 % \DescribeMacro{\setstanzaindents}
1454 % In order to use the stanza macros, one must set the indentation values.
1455 % First the value of \verb+\stanzaindentbase+ should be set,
1456 % unless the default value 20pt is desired.
1457 % Every stanza line indentation is a multiple of this.
1458 %
1459 % \begin{PW}
1460 % To specify these
1461 % multiples one invokes, for example \\
1462 % \verb+\setstanzaindents{3,1,2,1,2}+. \\
1463 % \end{PW}
1464 %
1465 % The numerical entries must be whole numbers, 0 or greater, separated by
1466 % commas without embedded spaces. The first entry
1467 % gives the hanging indentation to be used if the stanza line requires more
1468 % than one print line. If it is known that each stanza line will fit on
1469 % a single print line, then this first entry should be 0; \TeX\ does less
1470 % work in this case, but no harm ensues if the hanging indentation is not
1471 % 0 but is never used. Enumeration is by stanza lines, not by print lines.
1472 % In the above example the lines are indented one unit, two units, one unit,
1473 % two units, with 3 units of hanging indentation in case a stanza line is too
1474 % long to fit on one print line.
1475 %
1476 %\changes{v0.13}{2011/11/08}{New stanzaindentsrepetition counter to repeat stanza indents every \emph{n} verses.}
1477 % Since version 0.13, if the indentation is repeated every \emph{n} verses of the stanza, you can define only the \emph{n} first indentations, and say they are repeated, defining the value of the \verb+stanzaindentsrepetition+ counter at \emph{n}. For example :
1478 %\begin{verbatim}
1479 %\setstanzaindents{0,1,0}
1480 %\setcounter{stanzaindentsrepetition}{2}
1481 % \end{verbatim}
1482 %
1483 % is like
1484 %\begin{verbatim}
1485 %\setstanzaindents{0,1,0,1,0,1,0,1,0,1,0…}
1486 % \end{verbatim}
1487 %
1488 %If you don't use the \verb+stanzaindentsrepetition+ counter,make sure you have at least one more numerical
1489 % entry in \verb+\setstanzavalues+ than the number of lines in the stanza.
1490 % The macros make no restriction on the number of lines in a stanza.
1491 % Stanza indentation values (and penalty values) obey \TeX's grouping
1492 % conventions, so if one stanza among several has a different structure,
1493 % its indentations (penalties) may be set within a group; the prior values
1494 % will be restored when the group ends.
1495 %
1496 % \DescribeMacro{\setstanzapenalties}
1497 % When the stanzas run over several pages, often it is
1498 % desirable that page breaks should arise between certain lines in the
1499 % stanza, so a facility for including penalties after stanza lines is
1500 % provided. If you are satisfied with the page breaks, you need not set the
1501 % penalty values.
1502 %
1503 % \begin{PW}
1504 % The command \\
1505 % \verb+\setstanzapenalties{1,5000,10100,5000,0}+ \\
1506 % results in a penalty of
1507 % 5000 being placed after the first and third lines of the stanza, and a
1508 % penalty of ${-100}$ after the second.
1509 % \end{PW}
1510 %
1511 % The first entry ``1'' is a control
1512 % value. If it is zero, then no penalties are passed on to \TeX,
1513 % which is the default. Values between 0 and 10000 are penalty
1514 % values; values between 10001 and 20000 have 10000 subtracted and the result
1515 % is given as a negative penalty. The mechanism used for indentations and
1516 % penalties requires unsigned values less than 32768. No penalty is placed
1517 % after the last line, so the final \verb+,0+ in then example above could
1518 % be omitted. The control sequence \verb+\endstanzaextra+ can be defined to
1519 % include a penalty. A penalty of 10000 will prevent a page break; such a
1520 % penalty is included automatically where there is stanza hanging indentation.
1521 % A penalty of ${-10000}$ (corresponding to the entry value 20000 in this
1522 % context) forces a page break. Values in between act as suggestions as to the
1523 % desirability of a page break at a given line. There is a subtle interaction
1524 % between penalties and \textit{glue}, so it may take some adjustment of skips
1525 % and penalties to achieve the best results.
1526 %
1527 % \DescribeMacro{\ampersand}
1528 % If you need to print an \& symbol in a stanza, use the \verb?\ampersand?
1529 % macro, not \verb?\&? which will end the stanza.
1530 %
1531 % \DescribeMacro{\endstanzaextra}
1532 % The macro \verb?\endstanzaextra?, if it is defined, is
1533 % called at the end of a stanza. You could define this, for example,
1534 % to add extra space between stanzas (by default there is no extra
1535 % space between stanzas); if you are using the \Lpack{memoir} class,
1536 % it provides a length \verb?\stanzaskip? which may come in handy.
1537 %
1538 % \begin{PW}
1539 % \DescribeMacro{\startstanzahook}
1540 % Similarly, if \verb?\startstanzahook? is defined, it is called by
1541 % \verb?\stanza? at the
1542 % start. This can be defined to do something.
1543 % \end{PW}
1544 %
1545 % \begin{PW}
1546 % \DescribeMacro{\flagstanza}
1547 % Putting \cs{flagstanza}\oarg{len}\marg{text} at the start of a line
1548 % in a stanza (or elsewhere) will typeset \meta{text} at a
1549 % distance \meta{len} before
1550 % the line. The default \meta{len} is \verb?\stanzaindentbase?.
1551 %
1552 % For example, to put a verse number before the first line of a stanza
1553 % you could proceed along the lines:
1554 % \begin{verbatim}
1555 % \newcounter{stanzanum}
1556 % \setcounter{stanzanum}{0}
1557 % \newcommand*{\startstanzahook}{\refstepcounter{stanzanum}}
1558 % \newcommand{\numberit}{\flagstanza{\thestanzanum}}
1559 % ...
1560 % \stanza
1561 % \numberit First line...&
1562 % rest of stanza\&
1563 %
1564 % \stanza
1565 % \numberit First line, second stanza...
1566 % \end{verbatim}
1567 % \end{PW}
1568 %\begin{PW}
1569 %It's possible to insert a symbol on each line of verse's hanging, as in French typography for `['. To insert in ledmac, redefine macro \DescribeMacro{\hangingsymbol}\cmd{\hangingsymbol} with this code :
1570 %\begin{verbatim}
1571 %\renewcommand{\hangingsymbol}{[\,}
1572 %\end{verbatim}
1573 %\end{PW}
1574 % \section{Grouping}
1575 % \begin{PW}
1576 % In a \verb?minipage? environment LaTeX changes \verb?\footnote? numbering from
1577 % arabic to alphabetic and puts the footnotes at the end of the minipage.
1578 %
1579 % \DescribeEnv{minipage}
1580 % You can put numbered text with critical footnotes in a minipage and
1581 % the footnotes are set at the end of the minipage.
1582 %
1583 % You can also put familiar footnotes (see section~\ref{sec:desc:familiar})
1584 % in a minipage but unlike with \verb?\footnote? the numbering scheme is
1585 % unaltered.
1586 %
1587 % \DescribeEnv{ledgroup}
1588 % Minipages, of course, aren't broken across pages. Footnotes in a \verb?ledgroup?
1589 % environment are typeset at the end of the environment, as with minipages,
1590 % but the environment includes normal page breaks. The environment makes no
1591 % change to the textwidth so it appears as normal text; it just might be that
1592 % footnotes appear in the middle of a page, with text above and below.
1593 %
1594 % \DescribeEnv{ledgroupsized}
1595 % The \verb?ledgroupsized? environment is similar to \verb?ledroup? except that
1596 % you must specify a width for the environment, as with a minipage. \\
1597 % \verb?\begin{ledgroupsized}?\oarg{pos}\marg{width}.
1598 %
1599 % The required \meta{width} argument is the text width for the environment. The
1600 % optional \meta{pos} argument is for positioning numbered text within
1601 % the normal textwidth. It may be one of the characters:
1602 % \begin{itemize}
1603 % \item[l] (left) numbered text is flush left with respect to the normal
1604 % textwidth. This is the default.
1605 % \item[c] (center) numbered text is in the center of the textwidth.
1606 % \item[r] (right) numbered text is flush right with respect to the
1607 % normal textwidth.
1608 % \end{itemize}
1609 % Note that normal text, footnotes, and so forth are all flush left.
1610 %
1611 % \verb?\begin{ledgroupsized}{\textwidth}? is effectively the same as
1612 % \verb?\begin{ledgroup}?
1613 %
1614 %
1615 % \end{PW}
1616 %
1617 % \section{Crop marks}
1618 %
1619 % \PWcomment{I deleted crop marks.}
1620 % The \Lpack{\ledmac} package does not provide crop marks. These are
1621 % available with either the \Lclass{memoir} class~\cite{MEMOIR} or the \Lpack{crop}
1622 % package.
1623 %
1624 %
1625 % \section{Endnotes}
1626 %
1627 % \DescribeMacro{\doendnotes}
1628 % \DescribeMacro{\endprint}
1629 % \DescribeMacro{\printnpnum}
1630 % \phantomsection\label{doendnotes}\relax
1631 % \cs{doendnotes}\marg{letter} closes the \file{.end} file that contains
1632 % the text of the endnotes, if it's open, and
1633 % prints one series of endnotes, as specifed by a series-letter
1634 % argument, e.g., \verb"\doendnotes{A}". \cs{endprint} is the
1635 % macro that's called to print each note. It uses
1636 % \cs{notenumfont}, \cs{select@lemmafont}, and
1637 % \cs{notefontsetup} to select fonts, just as the footnote
1638 % macros do (see p.\,\pageref{notefonts} above).
1639 %
1640 % \begin{PW}
1641 % As endnotes may be printed at any point in the document they always
1642 % start with the page number of where they were specified. The
1643 % macro \cs{printnpnum}\marg{num} is used to print these numbers.
1644 % Its default definition is: \\
1645 % \verb?\newcommand*{\printnpnum}[1]{p.#1) }?
1646 % \end{PW}
1647 %
1648 % \DescribeMacro{\noendnotes}
1649 % If you aren't going to have any endnotes, you can say \cs{noendnotes}
1650 % in your file, before the first \cs{beginnumbering}, to suppress the
1651 % generation of an unneeded \file{.end} file.
1652 %
1653 % \section{Cross referencing}
1654 % \label{crossref}\relax
1655 % The package provides a simple cross-referencing facility that allows
1656 % you to mark places in the text with labels, and generate page and
1657 % line number references to those places elsewhere
1658 % using those labels.
1659 %
1660 %
1661 % \PWcomment{label and pageref changed to edlabel and edpageref respectively.}
1662 %
1663 % \DescribeMacro{\edlabel}
1664 % First you place a label in the text using the command
1665 % \cs{edlabel}\marg{lab}. \meta{lab} can be almost anything you like, including
1666 % letters, numbers, punctuation, or a combination---anything but spaces;
1667 % you might say \verb"\edlabel{toves-3}", for example.\footnote{More precisely,
1668 % you should stick to characters in the \TeX\ categories of `letter'
1669 % and `other'.}
1670 %
1671 % \DescribeMacro{\edpageref}
1672 % \DescribeMacro{\lineref}
1673 % \DescribeMacro{\sublineref}
1674 % Elsewhere in the text, either before or after the \cs{edlabel},
1675 % you can refer to its location via \cs{edpageref}\marg{lab}, or
1676 % \cs{lineref}\marg{lab}, or \cs{sublineref}\marg{lab}. These commands
1677 % will produce, respectively, the page, line and sub-line on which
1678 % the \cs{edlabel}\marg{lab} command occurred.
1679 %
1680 % An \cs{edlabel} command may appear in the main text, or in the
1681 % first argument of \cs{edtext}, but not in the apparatus itself. But
1682 % \cs{edpageref}, \cs{lineref} and \cs{sublineref} commands can also be used in
1683 % the apparatus to refer to \cs{edlabel}'s in the text.
1684 %
1685 % The \cs{edlabel} command works by writing macros to the LaTeX
1686 % \file{.aux} file. You will need to process
1687 % your document through LaTeX twice in order for the references to
1688 % be resolved.
1689 %
1690 % You will be warned if you say \verb"\edlabel{foo}" and \verb"foo"
1691 % has been used as a label before. The \verb"ref" commands will
1692 % return references to the last place in the file marked with this
1693 % label. You will also be warned if a reference is made to an
1694 % undefined label. (This will also happen the first time you
1695 % process a document after adding a new \cs{edlabel} command: the
1696 % auxiliary file will not have been updated yet.)
1697 %
1698 % If you want to refer to a word inside an
1699 % \verb"\edtext{...}{...}" command, the \cs{edlabel} should be defined inside
1700 % the first argument, e.g.,
1701 % \begin{verbatim}
1702 % The \edtext{creature\edlabel{elephant} was quite
1703 % unafraid}{\Afootnote{Of the mouse, that is.}}
1704 % \end{verbatim}
1705 %
1706 % \DescribeMacro{\xpageref}
1707 % \DescribeMacro{\xlineref}
1708 % \DescribeMacro{\xsublineref}
1709 % However, there are situations in which you'll want \Ledmac{} to
1710 % return a number without displaying any
1711 % warning messages about undefined labels or the like: if you want to
1712 % use the reference in a context where LaTeX is looking for a
1713 % number, such a warning will lead to a complaint that the number
1714 % is missing. This is the case for references used within the
1715 % argument to \cs{linenum}, for example. For this situation,
1716 % three variants of the reference commands, with the \verb"x"
1717 % prefix, are supplied: \cs{xpageref}, \cs{xlineref}, and \cs{xsublineref}.
1718 % They have these limitations:
1719 % they will not tell you if the label is undefined, and they must
1720 % be preceded in the file by at least one of the four other
1721 % cross-reference commands---e.g., a \verb"\edlabel{foo}" command,
1722 % even if you never refer to that label---since those commands can all
1723 % do the necessary processing of the \file{.aux} file, and the \cs{x...}
1724 % ones cannot.
1725 %
1726 % \DescribeMacro{\xxref}
1727 % The macros \cs{xxref} and
1728 % \cs{edmakelabel} let you manipulate numbers
1729 % and labels in ways which you may find helpful in tricky
1730 % situations.
1731 %
1732 % The \cs{xxref}\marg{lab1}\marg{lab2} command generates a reference to a sequence of
1733 % lines, for use in the second argument of \cs{edtext}.
1734 % It takes two arguments, both of which are
1735 % labels: e.g., \verb"\xxref{mouse}{elephant}". It calls \cs{linenum}
1736 % (q.v., p.\,\pageref{linenum} above) and sets the beginning page,
1737 % line, and sub-line numbers to those of the place where
1738 % \verb"\edlabel{mouse}" was placed, and the ending numbers to those where
1739 % \verb"\edlabel{elephant}" occurs.
1740 %
1741 % \DescribeMacro{\edmakelabel}
1742 % Sometimes the \cs{edlabel} command cannot be used to specify exactly
1743 % the page and line desired---for example, if you want to refer to a
1744 % page and line number in another volume of your edition. In such
1745 % cases, you can use the \cs{edmakelabel}\marg{lab}\marg{numbers}
1746 % macro so that you can `roll your own' label.
1747 % For example, if you say `\verb"\edmakelabel{elephant}{10|25|0}"'
1748 % you will create a new
1749 % label, and a later call to \verb"\edpageref{elephant}" would print
1750 % `10' and \verb"\lineref{elephant}" would print `25'. The sub-line
1751 % number here is zero. It is usually best to collect your
1752 % \cs{edmakelabel} statements near the top of your document, so that
1753 % you can see them at a glance.
1754 %
1755 % \begin{PW}
1756 % \DescribeMacro{\label}
1757 % \DescribeMacro{\ref}
1758 % \DescribeMacro{\pageref}
1759 % \changes{v0.2.1}{2003/08/25}{Added text about normal labeling}
1760 % The normal \cs{label}, \cs{ref} and \cs{pageref} macros may be used
1761 % within numbered text, and operate in the familiar fashion. As an example,
1762 % here is one way of numbering paragraphs in numbered text, and then being
1763 % able to refer to the paragraph numbers, in addition to line and page numbers.
1764 % \begin{verbatim}
1765 % \newcounter{para} \setcounter{para}{0}
1766 % \newcommand{\newpara}{%
1767 % \refstepcounter{para}%
1768 % \noindent\llap{\thepar. }\quad}
1769 % \newcommand{\oldpara}[1]{%
1770 % \noindent\llap{\ref{#1}. }\quad}
1771 % \end{verbatim}
1772 % The definitions of \cs{newpara} and \cs{oldpara} put the numbers in the left
1773 % margin and the first line of the paragraph is indented. You can now
1774 % write things like:
1775 % \begin{verbatim}
1776 % \linenummargin{right}
1777 % \beginnumbering
1778 % \pstart
1779 % \newpara\label{P1} A paragraph about \ldots
1780 % \pend
1781 % In paragraph~\ref{P1} the author \ldots
1782 % \pstart
1783 % \oldpara{P1} This has the same
1784 % \edtext{number}{\Afootnote{\ref{P1} is the paragraph, not line}}
1785 % as the first paragraph.
1786 % \pend
1787 % \endnumbering
1788 % \end{verbatim}
1789 %
1790 % \end{PW}
1791 %
1792 % \section{Side notes}
1793 %
1794 % \begin{PW}
1795 % The \cs{marginpar} command does not work in numbered text. Instead
1796 % the package provides for non-floating sidenotes in either margin.
1797 %
1798 % \DescribeMacro{\ledleftnote}
1799 % \DescribeMacro{\ledrightnote}
1800 % \cs{ledleftnote}\marg{text} will put \meta{text} into the left margin level
1801 % with where the command was issued. Similarly, \cs{ledrightnote}\marg{text}
1802 % puts \meta{text} in the right margin.
1803 %
1804 % \DescribeMacro{\ledsidenote}
1805 % \DescribeMacro{\sidenotemargin}
1806 % \cs{ledsidenote}\marg{text} will put \meta{text} into the margin specified
1807 % by the current setting of \cs{sidenotemargin}\marg{location}. The
1808 % permissable value for \meta{location} is one out of the list
1809 % \texttt{left}, \texttt{right}, \texttt{inner}, or \texttt{outer}, for
1810 % example \verb?\sidenotemargin{outer}?. The package's default setting
1811 % is \\
1812 % \verb?\sidenotemargin{right}? \\
1813 % to typeset \cs{ledsidenote}s in the right hand margin. This is the opposite
1814 % to the default margin for line numbers. The style for a \cs{ledsidenote}
1815 % follows that for a \cs{ledleftnote} or a \cs{ledrightnote} depending
1816 % on the margin it is put in.
1817 %
1818 % If two, say, \cs{ledleftnote}, commands are called in the same line the
1819 % second \meta{text} will obliterate the first. There is no problem though with
1820 % having both a left and a right sidenote on the same line.
1821 %
1822 % \DescribeMacro{\ledlsnotewidth}
1823 % \DescribeMacro{\ledrsnotewidth}
1824 % The left sidenote text is put into a box of width \cs{ledlsnotewidth}
1825 % and the right text into a box of width \cs{ledrsnotewidth}. These
1826 % are initially set to the value of \cs{marginparwidth}.
1827 %
1828 % \DescribeMacro{\ledlsnotesep}
1829 % \DescribeMacro{\ledrsnotesep}
1830 % The texts are put a distance \cs{ledlsnotesep} (or \cs{ledrsnotesep})
1831 % into the left (or right) margin. These lengths are initially set to
1832 % the value of \cs{linenumsep}.
1833 %
1834 % \DescribeMacro{\ledlsnotefontsetup}
1835 % \DescribeMacro{\ledrsnotefontsetup}
1836 % These macros specify how the sidenote texts are to be typeset. The
1837 % initial definitions are:
1838 % \begin{verbatim}
1839 % \newcommand*{\ledlsnotefontsetup}{\raggedleft\footnotesize}% left
1840 % \newcommand*{\ledrsnotefontsetup}{\raggedright\footnotesize}% right
1841 % \end{verbatim}
1842 % These can of course be changed to suit.
1843 %
1844 % \end{PW}
1845 %
1846 % \section{Familiar footnotes} \label{sec:desc:familiar}
1847 %
1848 % \begin{PW}
1849 %
1850 % The \Lpack{footmisc} package~\cite{FOOTMISC} by Robin
1851 % Fairbairns\index{Fairbairns, Robin} has an option whereby
1852 % sequential footnote
1853 % marks in the text can be separated by
1854 % commas\textsuperscript{3,4} like so.
1855 % As a convenience \Ledmac{} provides this automatically.
1856 %
1857 % \DescribeMacro{\multfootsep}
1858 % \cs{multfootsep} is used as the separator between footnote markers.
1859 % Its default definition is: \\
1860 % \verb?\providecommand*{\multfootsep}{\textsuperscript{\normalfont,}}? \\
1861 % and can be changed if necessary.
1862 %
1863 % \DescribeMacro{\footnoteA}
1864 % \DescribeMacro{\footnoteB}
1865 % \DescribeMacro{\footnoteC}
1866 % As well as the standard LaTeX footnotes generated via \cs{footnote},
1867 % the package also provides
1868 % three series of additional footnotes called \cs{footnoteA} through
1869 % \cs{footnoteC}. These have the familiar marker in the text, and
1870 % the marked text at the foot of the page can be formated using
1871 % any of the styles described for the critical footnotes. Note that
1872 % the `regular' footnotes have the series letter at the end of the macro
1873 % name whereas the critical footnotes have the series letter at the start
1874 % of the name.
1875 %
1876 % \DescribeMacro{\footnormalX}
1877 % \DescribeMacro{\footparagraphX}
1878 % \DescribeMacro{\foottwocolX}
1879 % \DescribeMacro{\footthreecolX}
1880 % Each of the \verb?\foot...X? macros takes one argument which is the
1881 % series letter (e.g., \texttt{B}). \cs{footnormalX} is the typical
1882 % footnote format. With \cs{footparagraphX} the series is typeset a one
1883 % paragraph, with \cs{foottwocolX} the notes are in two columns, and are in
1884 % three columns with \cs{foothreecolX}.
1885 %
1886 % \DescribeMacro{\thefootnoteA}
1887 % \DescribeMacro{\bodyfootmarkA}
1888 % \DescribeMacro{\footfootmarkA}
1889 % As well as using the \verb?\foot...X? macros to specify the general
1890 % footnote arrangement for a series, each series uses a set of macros for
1891 % styling the marks. The mark numbering scheme is defined by the
1892 % \cs{thefootnoteA} macro; the default is: \\
1893 % \verb?\renewcommand*{\thefootnoteA}{\arabic{footnoteA}}?\\
1894 % The appearance of the mark in the text is controlled by \cs{bodyfootmarkA}
1895 % which is defined as: \\
1896 % \verb?\newcommand*{\bodyfootmarkA}{%? \\
1897 % \verb? \hbox{\textsuperscript{\normalfont\thefootnoteA}}}? \\
1898 % The command \cs{footfootmarkA} controls the appearance of the mark at the
1899 % start of the footnote text. It is defined as: \\
1900 % \verb?\newcommand*{\footfootmarkA}{\textsuperscript{\thefootnoteA}}?
1901 %
1902 % There are similar command triples for the other series.
1903 %
1904 % Additional footnote series can be easily defined. For example, to
1905 % specify a \texttt{D} series you have to specify the following code,
1906 % either in a \file{.sty} package file or in the preamble sandwiched
1907 % between \cs{makeatletter} and \cs{makeatother} commands.
1908 % \begin{verbatim}
1909 % \newcommand{\footnoteD}[1]{%
1910 % \refstepcounter{footnoteD}%
1911 % \@footnotemarkD
1912 % \vfootnoteD{D}{#1}\m@mmf@prepare}
1913 % \newcounter{footnoteD}
1914 % \renewcommand{\thefootnoteD}{\arabic{footnoteD}}
1915 % \newinsert\footinsD
1916 %
1917 % \newcommand{\mpfootnoteD}[1]{%
1918 % \refstepcounter{footnoteD}%
1919 % \@footnotemarkD
1920 % \mpvfootnoteD{D}{#1}\m@mmf@prepare}
1921 % \newinsert\footins\mpfootinsD
1922 %
1923 % \addfootinsX{D}
1924 % \footnormalX{D}
1925 % \end{verbatim}
1926 %
1927 % The above creates the \texttt{D} series with the default layout,
1928 % and perhaps that
1929 % is all that is required. If not, then you can now start to specialise
1930 % it. For instance, to have the marks in the main text as lowercase
1931 % roman numerals in parentheses, the marks in the foot on the baseline
1932 % with a single closing parenthesis, and using the paragraph style:
1933 % \begin{verbatim}
1934 % \renewcommand*{\thefootnoteD}{\roman{footnoteD}}
1935 % \renewcommand*{\bodyfootmarkD}{\hbox{\textsuperscript{(\thefootnoteD)}}}
1936 % \renewcommand*{\footfootmarkD}{\thefootnoteD) }
1937 % \footparagraphX{D}
1938 % \end{verbatim}
1939 %
1940 % \section{Indexing}
1941 %
1942 % \DescribeMacro{\edindex}
1943 % LaTeX provides the |\index|\marg{item} command for specifying that \meta{item}
1944 % and the current page number should be added to the raw index (\file{idx}) file.
1945 % The |\edindex|\marg{item} macro can be used in numbered text to specify
1946 % that \meta{item} and the current page \& linenumber should be added to
1947 % the raw index file.
1948 %
1949 % If the \Lclass{memoir} class is used then the macro takes an optional
1950 % argument, which is the name of a raw index file. For example
1951 % |\edindex[line]{item}| will use |line.idx| as the raw file instead of
1952 % |\jobname.idx|.
1953 %
1954 % \DescribeMacro{\pagelinesep}
1955 % The page \& linenumber combination is written as |page\pagelinesep line|,
1956 % where the default definition is |\newcommand{\pagelinesep}{-}| so that
1957 % an item on page 3, line 5 will be noted as being at |3-5|. You can
1958 % renew |\pagelinesep| to get a different separator (but it just so happens
1959 % that |-| is the default
1960 % separator used by the \textsc{MakeIndex} program).
1961 %
1962 % \DescribeMacro{\edindexlab}
1963 % The |\edindex| process uses a |\label|/|\ref| mechanism to get
1964 % the correct line number. It automatically generates labels
1965 % of the form |\label{\edindexlab N}|, where N is a number, and
1966 % the default definition of |\edindexlab| is: \\
1967 % |\newcommand*{\edindexlab}{$&}| \\
1968 % in the hopes that this will not be used by any other labels
1969 % (|\edindex|'s labels are like |\label{$&27}|).
1970 % You can change |\edindexlab| to something else if you need to.
1971 %
1972 % \section{Tabular material}
1973 %
1974 % LaTeX's normal |tabular| and |array| environments cannot be used where
1975 % line numbering is being done; more precisely, they can be used but with
1976 % odd results, so don't use them. However, \ledmac{} provides some simple
1977 % tabulation environments that can be line numbered. The environments
1978 % can also be used in normal unnumbered text.
1979 %
1980 % \DescribeEnv{edarrayl}
1981 % \DescribeEnv{edarrayc}
1982 % \DescribeEnv{edarrayr}
1983 % \DescribeEnv{edtabularl}
1984 % \DescribeEnv{edtabularc}
1985 % \DescribeEnv{edtabularr}
1986 % There are six environments; the |edarray*| environments are for math
1987 % and |edtabular*| for text entries. The final |l|, |c|, or |r|
1988 % in the environment names indicate that the entries will be flushleft (|l|),
1989 % centered (|c|) or flushright (|r|). There is no means of specifying
1990 % different formats for each column, nor for specifying a fixed width for
1991 % a column. The environments are centered with respect to the surrounding text.
1992 %
1993 % \egstart
1994 % \begin{verbatim}
1995 % \begin{edtabularc}
1996 % 1 & 2 & 3 \\
1997 % a & bb & ccc \\
1998 % AAA & BB & C
1999 % \end{edtabularc}
2000 % \end{verbatim}
2001 % \egmid
2002 % \centering
2003 % \begin{tabular}{ccc}
2004 % 1 & 2 & 3 \\
2005 % a & bb & ccc \\
2006 % AAA & BB & C
2007 % \end{tabular}\par
2008 % \egend
2009 %
2010 % Entries in the environments are the same as for the normal
2011 % |array| and |tabular| environments but there must be no ending
2012 % \verb?\\? at the end of the last row.
2013 % \emph{There must be the same number of column designators (the \&)
2014 % in each row.} There is no equivalent
2015 % to any line drawing commands (such as \cs{hline}).
2016 % However, unlike the normal environments, the |ed...| environments
2017 % can cross page breaks.
2018 %
2019 % Macros like \cs{edtext} can be used as part of an entry.
2020 %
2021 % For example:
2022 % \begin{verbatim}
2023 % \beginnumbering
2024 % \pstart
2025 % \begin{edtabularl}
2026 % \textbf{\Large I} & wish I was a little bug\edindex{bug} &
2027 % \textbf{\Large I} & eat my peas with honey\edindex{honey} \\
2028 % & With whiskers \edtext{round}{\Afootnote{around}} my tummy &
2029 % & I've done it all my life. \\
2030 % & I'd climb into a honey\edindex{honey} pot &
2031 % & It makes the peas taste funny \\
2032 % & And get my tummy gummy.\edindex{gummy} &
2033 % & But it keeps them on the knife.
2034 % \end{edtabularr}
2035 % \pend
2036 % \endnumbering
2037 % \end{verbatim}
2038 % produces the following parallel pair of verses.
2039 %
2040 % \begin{center}
2041 % \setlength{\tabcolsep}{2pt}
2042 % \begin{tabular}{p{4em}rlrl}
2043 % {\footnotesize 1} & \textbf{\Large I} & wish I was a little bug &
2044 % \textbf{\Large I} & eat my peas with honey \\
2045 % {\footnotesize 2} & & With whiskers round my tummy &
2046 % & I've done it all my life. \\
2047 % {\footnotesize 3} & & I'd climb into a honey pot &
2048 % & It makes the peas taste funny \\
2049 % {\footnotesize 4} & & And get my tummy gummy. &
2050 % & But it keeps them on the knife.
2051 % \end{tabular}
2052 % \end{center}
2053 %
2054 %
2055 %
2056 %
2057 %
2058 % \DescribeMacro{\edtabcolsep}
2059 % The distance between the columns is controlled by the length |\edtabcolsep|.
2060 %
2061 % \DescribeMacro{\spreadmath}
2062 % \DescribeMacro{\spreadtext}
2063 % |\spreadmath|\marg{math} typesets \marg{math} but the \marg{math} has
2064 % no effect on the calculation of column widths.
2065 % |\spreadtext|\marg{text} is the analagous command for use in |edtabular|
2066 % environments.
2067 %
2068 % \egstart
2069 % \begin{verbatim}
2070 % \begin{edarrayl}
2071 % 1 & 2 & 3 & 4 \\
2072 % & \spreadmath{F+G+C} & & \\
2073 % a & bb & ccc & dddd
2074 % \end{edarrayl}
2075 % \end{verbatim}
2076 % \egmid
2077 % \begin{displaymath}
2078 % \begin{array}{llll}
2079 % 1 & 2 & 3 & 4 \\
2080 % & \multicolumn{3}{l}{F+G+C} \\
2081 % a & bb & ccc & dddd
2082 % \end{array}
2083 % \end{displaymath}
2084 % \egend
2085 %
2086 % \DescribeMacro{\edrowfill}
2087 % The macro |\edrowfill|\marg{start}\marg{end}\marg{fill}
2088 % fills columns number \meta{start} to \meta{end} inclusive with
2089 % \meta{fill}. The \meta{fill} argument can be any horizontal `fill'.
2090 % For example |\hrulefill| or |\upbracefill|.
2091 %
2092 % Note that every row must have the same number of columns, even if
2093 % some would not appear to be necessary.
2094 %
2095 % The |\edrowfill| macro can be used in both tabular and array environments.
2096 % The typeset appearance of the following code is shown below.
2097 % \begin{verbatim}
2098 % \begin{edtabularr}
2099 % 1 & 2 & 3 & 4 & 5 \\
2100 % Q & & fd & h & qwertziohg \\
2101 % v & wptz & x & y & vb \\
2102 % g & nnn & \edrowfill{3}{5}{\upbracefill} & & \\
2103 % \edrowfill{1}{3}{\downbracefill} & & & pq & dgh \\
2104 % k & & l & co & ghweropjklmnbvcxys \\
2105 % 1 & 2 & 3 & \edrowfill{4}{5}{\hrulefill} &
2106 % \end{tabularr}
2107 % \end{verbatim}
2108 %
2109 % \begin{center}
2110 % \begin{tabular}{rrrrr}
2111 % 1 & 2 & 3 & 4 & 5 \\
2112 % Q & & fd & h & qwertziohg \\
2113 % v & wptz & x & y & vb \\
2114 % g & nnn & \multicolumn{3}{c}{\upbracefill} \\
2115 % \multicolumn{3}{c}{\downbracefill} & pq & dgh \\
2116 % k & & l & co & ghweropjklmnbvcxys \\
2117 % 1 & 2 & 3 & \multicolumn{2}{c}{\hrulefill}
2118 % \end{tabular}
2119 % \end{center}
2120 %
2121 % You can also define your own `fill'. For example:
2122 % \begin{verbatim}
2123 % \newcommand*{\upbracketfill}{%
2124 % \vrule height 4pt depth 0pt\hrulefill\vrule height 4pt depth 0pt}
2125 % \end{verbatim}
2126 % is a fill like |\upbracefill| except it has the appearance of a
2127 % (horizontal) bracket instead of a brace. It can be used like
2128 % this:
2129 %
2130 % \newcommand*{\upbracketfill}{%
2131 % \vrule height 4pt depth 0pt\hrulefill\vrule height 4pt depth 0pt}
2132 %
2133 % \begin{verbatim}
2134 % \begin{edarrayc}
2135 % 1 & 2 & 3 & 4 \\
2136 % a & \edrowfill{2}{3}{\upbracketfill} & & d \\
2137 % A & B & C & D
2138 % \end{edarrayc}
2139 % \end{verbatim}
2140 %
2141 % \begin{displaymath}
2142 % \begin{array}{cccc}
2143 % 1 & 2 & 3 & 4 \\
2144 % a & \multicolumn{2}{c}{\upbracketfill} & d \\
2145 % A & B & C & D
2146 % \end{array}
2147 % \end{displaymath}
2148 %
2149 %
2150 %
2151 % \DescribeMacro{\edatleft}
2152 % \DescribeMacro{\edatright}
2153 % |\edatleft|\oarg{math}\marg{symbol}\marg{halfheight} typesets the math
2154 % \meta{symbol} as |\left<symbol>|
2155 % with the optional \meta{math} centered before it. The \meta{symbol} is
2156 % twice \meta{halfheight} tall. The |\edatright| macro is similar
2157 % and it typesets |\right<symbol>| with \meta{math} centered after it.
2158 %
2159 % \begin{verbatim}
2160 % \begin{edarrayc}
2161 % & 1 & 2 & 3 & \\
2162 % & 4 & 5 & 6 & \\
2163 % \edatleft[left =]{\{}{1.5\baselineskip}
2164 % & 7 & 8 & 9 &
2165 % \edatright[= right]{)}{1.5\baselineskip}
2166 % \end{edarrayc}
2167 % \end{verbatim}
2168 %
2169 % \begin{displaymath}
2170 % left = \left\{
2171 % \begin{array}{ccc}
2172 % 1 & 2 & 3 \\
2173 % 4 & 5 & 6 \\
2174 % 7 & 8 & 9
2175 % \end{array}
2176 % \right) = right
2177 % \end{displaymath}
2178 %
2179 %
2180 %
2181 % \DescribeMacro{\edbeforetab}
2182 % \DescribeMacro{\edaftertab}
2183 % |\edbeforetab|\marg{text}\marg{entry}, where \meta{entry} is an entry in the
2184 % leftmost column, typesets \meta{text} left justified before the \meta{entry}.
2185 % Similarly |\edaftertab|\marg{entry}\marg{text}, where \meta{entry} is an entry
2186 % in the rightmost column, typesets \meta{text} right justified after the
2187 % \meta{entry}.
2188 %
2189 % For example:
2190 % \begin{verbatim}
2191 % \begin{edarrayl}
2192 % A & 1 & 2 & 3 \\
2193 % \edbeforetab{Before}{B} & 1 & 3 & 6 \\
2194 % C & 1 & 4 & \edaftertab{8}{After} \\
2195 % D & 1 & 5 & 0
2196 % \end{edarrayl}
2197 % \end{verbatim}
2198 %
2199 %
2200 % \begin{displaymath}
2201 % \begin{array}{p{0.4\textwidth}llp{0.4\textwidth}}
2202 % \mbox{} \hfill $A$ & 1 & 2 & $3$ \\
2203 % Before \hfill $B$ & 1 & 3 & $6$ \\
2204 % \mbox{} \hfill $C$ & 1 & 4 & $8$ \hfill After \\
2205 % \mbox{} \hfill $D$ & 1 & 5 & $0$
2206 % \end{array}
2207 % \end{displaymath}
2208 %
2209 % \DescribeMacro{\edvertline}
2210 % \DescribeMacro{\edvertdots}
2211 % The macro |\edvertline|\marg{height} draws a vertical line \meta{height} high
2212 % (contrast this with |\edatright| where the size argument is half the desired
2213 % height).
2214 % \begin{verbatim}
2215 % \begin{edarrayr}
2216 % a & b & C & d & \\
2217 % v & w & x & y & \\
2218 % m & n & o & p & \\
2219 % k & & L & cvb & \edvertline{4pc}
2220 % \end{edarrayr}
2221 % \end{verbatim}
2222 %
2223 % \DeleteShortVerb{\|}
2224 % \begin{displaymath}
2225 % \left.
2226 % \begin{array}{rrrr}
2227 % a & b & C & d \\
2228 % v & w & x & y \\
2229 % m & n & o & p \\
2230 % k & & L & cvb
2231 % \end{array}
2232 % \right|
2233 % \end{displaymath}
2234 % \MakeShortVerb{\|}
2235 %
2236 % The |\edvertdots| macro is similar to |\edvertline| except that it
2237 % produces a vertical dotted instead of a solid line.
2238 %
2239 % \end{PW}
2240 %
2241 % \section{Miscellaneous}
2242 %
2243 %
2244 % \DescribeMacro{\extensionchars}
2245 % When the package assembles the name of the auxiliary file for a
2246 % section, it prefixes \cs{extensionchars} to the section number.
2247 % This is initially defined to be empty, but you can add some characters to
2248 % help distinguish these files if you like; what you use is likely
2249 % to be system-dependent. If, for example, you said
2250 % \verb"\renewcommand{\extensionchars}{!}", then you would get temporary
2251 % files called \file{jobname.!1}, \file{jobname.!2}, etc.
2252 %
2253 % \begin{PW}
2254 % \DescribeMacro{\ifledfinal}
2255 % The package can take options. The option `final', which is the default
2256 % is for final typesetting; this sets \verb?\ifledfinal? to TRUE. The other
2257 % option, `draft', may be useful during earlier stages and sets
2258 % \verb?\ifledfinal? to FALSE.
2259 %
2260 % \DescribeMacro{\showlemma}
2261 % The lemma within the text is printed via \verb?\showlemma{lemma}?.
2262 % Normally, or with the `final' option, the definition of \verb?\showlemma?
2263 % is: \\
2264 % \verb?\newcommand*{\showlemma}[1]{#1}? \\
2265 % so it just produces its argument.
2266 % With the `draft' option it is defined as \\
2267 % \verb?\newcommand*{\showlemma}[1]{\textit{#1}}? \\
2268 % so that its argument is typeset in an italic font, which may make it
2269 % easier to check that all lemmas have been treated.
2270 %
2271 % If you would prefer some other style, you could put something like this
2272 % in the preamble:
2273 % \begin{verbatim}
2274 % \ifledfinal\else
2275 % \renewcommand{\showlemma}[1]{\textbf{#1}}% or simply ...[1]{#1}
2276 % \fi
2277 % \end{verbatim}
2278 % \end{PW}
2279 %
2280 % \begin{PW}
2281 % \DescribeMacro{\ledplinenumtrue}
2282 % \DescribeMacro{\ledplinenumfalse}
2283 % \DescribeMacro{\symplinenum}
2284 % Following the declaration \cs{ledplinenumtrue} critical footnotes will be
2285 % marked with their line number. After \cs{ledplinenumfalse} the footnotes
2286 % will be marked by \cs{symplinenum}, whose default definition is \\
2287 % \verb?\newcommand*{\symplinenum}{}?
2288 %
2289 % \subsection{Hints}
2290 %
2291 % By doing a little work it is possible, for example,
2292 % to set things up so that a particular footnote series only prints
2293 % the linenumber for the first footnote on a
2294 % line.\footnote{This was requested by Dirk-Jan Dekker\index{Dekker, Dirk-Jan}
2295 % (\texttt{[email protected]}).} You may wish to skip
2296 % the following but if not read it in conjunction with the code definitions
2297 % from section~\ref{sec:nfootformat}. Suppose that we only want this to
2298 % apply to the \texttt{B} series
2299 % of normal footnotes. To accomplish this goal we have to modify the definition
2300 % of \cs{normalvfootnote} as follows:
2301 %
2302 % \begin{verbatim}
2303 % \makeatletter
2304 % \newcommand*{\previous@B@number}{-1}
2305 % \newcommand*{\previous@page}{-1}
2306 % \renewcommand*{\normalvfootnote}[2]{
2307 % \insert\csname #1footins\endcsname\bgroup
2308 % \notefontsetup
2309 % \footsplitskips
2310 % \spaceskip=\z@skip \xspaceskip=\z@skip
2311 % \l@dparsefootspec #2\ledplinenumtrue% % NEW FROM HERE
2312 % \ifnum\@nameuse{previous@#1@number} = \l@dparsedstartline\relax
2313 % \ledplinenumfalse
2314 % \fi
2315 % \ifnum\previous@page=\l@dparsedstartpage\relax
2316 % \else \ledplinenumtrue \fi
2317 % \ifnum\l@dparsedstartline=\l@dparsedendline\relax
2318 % \else \ledplinenumtrue \fi
2319 % \expandafter\xdef\csname previous@#1@number\endcsname{\l@dparsedstartline}%
2320 % \xdef\previous@page{\l@dparsedstartpage}% % TO HERE
2321 % \csname #1footfmt\endcsname #2\egroup}
2322 % \footnormal{B}
2323 % \makeatother
2324 % \end{verbatim}
2325 % The additional code uses \cs{l@dparsefootspec} to get the footnote's line
2326 % number as \cs{l@dparsedstartline} and the page number as
2327 % \cs{l@dparsedstartpage}. It then sets \cs{ledplinenum} according
2328 % to whether or not \cs{l@dparsedstartline} is the same as the
2329 % previous (\cs{previous@B@number}) number. If the page number has changed
2330 % then the line number must be printed. If the starting line number
2331 % is not the same as the ending line number then the line number
2332 % must be printed. After \cs{ledplinenum}
2333 % has been set the two previous values are updated to the current
2334 % line and page numbers.
2335 %
2336 % After the redefinition of \cs{normalvfootnote} the \texttt{B}
2337 % series has to be
2338 % respecified as normal for the changes to take effect. The \texttt{A} series
2339 % will still be in the traditional style of printing every line number.
2340 % To eliminate duplicate printing from the normal \texttt{A} series, you
2341 % simply need to define \cs{previous@A@number} and respecify the series.
2342 %
2343 % Similar techniques can be used for the other footnote styles.
2344 %
2345 % \changes{v0.3}{2004/02/14}{Two more Dekker examples}
2346 % Dirk-Jan Dekker\index{Dekker, Dirk-Jan} felt that there was too much
2347 % empty space if the starting line number was ommited in a footnote. He
2348 % proposed\footnote{Posted to \texttt{comp.text.tex} on 24 January 2004.}
2349 % this solution, here applied to a paragraphed footnote.
2350 % \begin{verbatim}
2351 % \renewcommand*{\Bparafootfmt}[3]{%
2352 % \ledsetnormalparstuff
2353 % \scriptsize
2354 % \notenumfont\printlines#1|% % NEW FROM HERE
2355 % \ifledplinenum
2356 % \enspace
2357 % \else
2358 % {\hskip 0em plus 0em minus .4em}%
2359 % \fi% % TO HERE
2360 % {\select@lemmafont#1|#2}\rbracket\enskip
2361 % #3\penalty-10}
2362 % \end{verbatim}
2363 %
2364 % Another question has been how to control the printing, or not,
2365 % of line numbers in the footnote from the |\edtext| command. Here
2366 % is an awful hack to do this. The example is an extension of the
2367 % code just above.
2368 % \begin{verbatim}
2369 % \newcounter{killnum}
2370 % \setcounter{killnum}{0}
2371 % \newcommand*{\killnumbers}{\setcounter{killnum}{-1}}
2372 % \newcommand*{\restorenumbers}{\setcounter{killnum}{0}}
2373 % \renewcommand*{\Bparafootfmt}[3]{%
2374 % \ledsetnormalparstuff
2375 % \scriptsize
2376 % \ifnum\c@killnum<\z@\ledplinenumfalse\fi% %% NEW
2377 % \notenumfont\printlines#1|%
2378 % \ifledplinenum
2379 % \enspace
2380 % \else
2381 % {\hskip 0em plus 0em minus .4em}%
2382 % \fi%
2383 % {\select@lemmafont#1|#2}\rbracket\enskip
2384 % #3\penalty-10}
2385 % \end{verbatim}
2386 % In the text it is used like:
2387 % \begin{verbatim}
2388 % ...
2389 % \edtext{text}{\Bfootnote{TEXT\killnumbers}}% later B line numbers not printed
2390 % ...
2391 % \edtext{textual}{\Bfootnote{TEXTUAL\restorenumbers}}% later B numbers printed
2392 % ...
2393 % \end{verbatim}
2394 % That is, |\killnumbers| and |\restorenumbers| only take effect for the next
2395 % and later |\edtext|s, not the one they are in. You have to kill/restore
2396 % numbers in the note \emph{before} you want the change.
2397 %
2398 % Dirk-Jan Dekker\index{Dekker, Dirk-Jan}
2399 % suggested\footnote{Private communication, 17 February 2004.} the following
2400 % \verb?\killnumber? macro if you want to occasionaly kill a number. \\
2401 % \verb?\newcommand*{\killnumber}{\linenum{|-1|||-1||}}? \\
2402 % Then insert \\
2403 % \verb?\ifnum#2=-1 \ledplinenumfalse\fi? \\
2404 % near the start of the definition of \verb?\printlines? so it reads
2405 % \begin{verbatim}
2406 % \def\printlines#1|#2|#3|#4|#5|#6|#7|{\begingroup
2407 % \ifnum#2=-1 \ledplinenumfalse\fi% %% NEW
2408 % \setprintlines{#1}{#2}{#3}{#4}{#5}{#6}%
2409 % ...
2410 % \end{verbatim}
2411 % It is used like this: \\
2412 % \verb?\edtext{critical}{\killnumber\Afootnote{criticism}}? \\
2413 % The \verb?\killnumber? command will kill the line number for the one
2414 % note, unlike \verb?\killnumbers? which kills numbers for subsequent notes.
2415 %
2416 %
2417 % ^^A
2418 % ^^A From D-J D email 17 Feb 04:
2419 % ^^A In preamble \verb?\newcommand*{\killnumber}{\linenum{|-1|||-1||}}?
2420 % ^^A Into \verb?\def\printlines#1|#2|#3|#4|#5|#6|#7|?
2421 % ^^A \verb?\ifnum#2=-1 \ledplinenumfalse \fi
2422 % ^^A Use it as
2423 % ^^A \verb?\edtext{critical}{\killnumber\Afootnote{criticism}}?
2424 % ^^A Which kills the number for the one footnote only (taking effect
2425 % ^^A immediately, not delayed like \killnumbers)
2426 % ^^A
2427 %
2428 % Perhaps, though, you just want a footnote series with no numbers at
2429 % all (and maybe no lemma either).
2430 % \begin{verbatim}
2431 % \footparagraph{A}
2432 % \makeatletter
2433 % \def\zparafootfmt#1#2#3{%
2434 % \ledsetnormalparstuff
2435 % \notetextfont #3\penalty-10 }
2436 % \makeatother
2437 % \let\Afootfmt=\zparafootfmt
2438 % ...
2439 % \beginnumbering
2440 % \edtext{}{\Afootnote{numberless and lemmaless}}
2441 % ...
2442 % \end{verbatim}
2443 %
2444 % At least one user has wanted a big space between the text and footnotes
2445 % but a smaller space between each series. That is, the first printed series
2446 % on a page must have a big skip and all later ones a small skip. Of course,
2447 % there is no telling which will be the first on any given page; on one
2448 % page there might be A, C and E series and on the next D and E.
2449 %
2450 % Here is the start of a solution.
2451 % \begin{verbatim}
2452 % \newskip\prefootskip % the big initial skip
2453 % \prefootskip=3.3em plus .6em minus .6em
2454 % \newif\ifskipped \skippedfalse
2455 % \renewcommand*{\normalfootstart}[1]{%
2456 % \ifskipped
2457 % \vskip\skip\csname #1footins\endcsname% normal skip
2458 % \else
2459 % \skip\prefootskip% first note so big skip
2460 % \skippedtrue
2461 % \fi
2462 % \leftskip0pt\rightskip0pt
2463 % \csname #1footnoterule\endcsname}
2464 % \footnormal{A}% make sure the new \normalfootstart is used
2465 % \footnormal{B}
2466 % ...
2467 % \end{verbatim}
2468 % In addition similar changes would be required for paragraphed footnotes,
2469 % footnotes in minipages, and the familiar footnotes.
2470 %
2471 % Another user has had a wider ranging set of requirements:
2472 % \begin{itemize}
2473 % \item Number paragraphs and use the number in the notes for that paragraph;
2474 % \item Duplicate a paragraph number later in the document and use it for
2475 % that paragraph's notes;
2476 % \item In any series of notes only use the paragraph number for the first
2477 % in the paragraph
2478 % \item Have some series use line nummbers in the notes and in other series
2479 % have neither lemmas nor line numbers in the notes.
2480 % \item Perhaps eliminate all paragraph numbers in the notes.
2481 % \end{itemize}
2482 % Here is some code that enables these requirements to be met. This should
2483 % be in an environment where \texttt{@} is treated as a letter.
2484 % First, here is a version of \cs{ref} that returns a number even if the
2485 % corresponding \cs{label} has not been defined.
2486 % \begin{verbatim}
2487 % \newcommand*{\saferef}[1]{%
2488 % \expandafter\ifx\csname r@#1\endcsname\relax 0\else
2489 % \ref{#1}\fi}
2490 % \end{verbatim}
2491 % Now for some code for the paragraph numbering. Use \cs{newpara} at the start
2492 % of a numbered paragraph and \cs{oldpara}\marg{lab} at the start of
2493 % a `re-numbered' one, where \cs{label}\marg{lab} has been used in the
2494 % original numbered one.
2495 % \begin{verbatim}
2496 % \newcounter{para}\setcounter{para}{0}
2497 % \newcounter{thispara}\setcounter{thispara}{0}
2498 % \newcommand*{\newpara}{%
2499 % \refstepcounter{para}%
2500 % \setcounter{thispara}{\value{para}}%
2501 % \noindent\textbf{\thepara. }}
2502 % \newcommand{\oldpara}[1]{%
2503 % \noindent\setcounter{thispara}{\saferef{#1}}\textbf{\saferef{#1}. }}
2504 % \end{verbatim}
2505 % Set up the \texttt{A} note series for lemmas, line numbers and non-repeated
2506 % paragraph numbers, assuming paragraphed notes.
2507 % \begin{verbatim}
2508 % \newif\ifparnumfoot
2509 % \parnumfoottrue% false to eliminate paragraph numbers in notes
2510 % \newcommand*{\previous@Aparnum}{-1}
2511 % \def\printlinesA#1|#2|#3|#4|#5|#6|#7|{\begingroup
2512 % \setprintlines{#1}{#2}{#3}{#4}{#5}{#6}%
2513 % \ifnum\previous@Aparnum=\the\c@thispara% not a new paragraph
2514 % \else% new paragraph, print, and update the check
2515 % \ifparnumfoot \textbf{\thethispara.}\fi
2516 % \xdef\previous@Aparnum{\the\c@thispara}%
2517 % \fi
2518 % \ifledplinenum \linenumr@p{#2}\else \symplinenum\fi
2519 % \ifl@d@ssub \fullstop \sublinenumr@p{#3}\fi
2520 % \ifl@d@dash \endashchar\fi
2521 % \ifl@d@pnum #4\fullstop\fi
2522 % \ifl@d@elin \linenumr@p{#5}\fi
2523 % \ifl@d@esl \ifl@d@elin \fullstop\fi \sublinenumr@p{#6}\fi
2524 % \endgroup}
2525 % \renewcommand*{\Afootfmt}[3]{%
2526 % \ledsetnormalparstuff
2527 % {\notenumfont\printlinesA#1|}\enspace
2528 % {\select@lemmafont#1|#2}\rbracket\enskip
2529 % #3\penalty-10 }
2530 % \end{verbatim}
2531 % Set up the \texttt{B} series notes for no line numbers or lemmas, just
2532 % non-repeated paragraph numbers, assuming normal notes.
2533 % \begin{verbatim}
2534 % \newcommand*{\previous@Bparnum}{-1}
2535 % \def\printlinesB#1|#2|#3|#4|#5|#6|#7|{\begingroup
2536 % \setprintlines{#1}{#2}{#3}{#4}{#5}{#6}%
2537 % \ifnum\previous@Bparnumm=\the\c@thispara% not a new paragraph
2538 % \else% new paragraph, print, and update the check
2539 % \ifparnumfoot \textbf{\thethispara.}\fi
2540 % \xdef\previous@Aparnum{\the\c@thispara}%
2541 % \fi
2542 % \endgroup}
2543 % \renewcommand*{\Bfootfmt}[3]{%
2544 % \ledsetnormalparstuff
2545 % {\notenumfont\printlinesB#1|}%\enspace
2546 % {\select@lemmafont#1|#2}%\enskip
2547 % #3\strut\par}
2548 % \end{verbatim}
2549 %
2550 % You can use the above like:
2551 % \begin{verbatim}
2552 % ...
2553 % \newpara\label{fpara} A numbered\edtext{}{\Bfootnote{lemma-less
2554 % and linenumber-less}} \edtext{paragraph}{\Afootnote{chunk}} ...
2555 % ...
2556 % \oldpara{fpara} \edtext{Repeated}{\Afootnote{Again}}
2557 % paragraph\edtext{}{\Bfootnote{Just a comment}} ...
2558 % ...
2559 % \end{verbatim}
2560 %
2561 % \end{PW}
2562 %
2563 % \subsection{Known and suspected limitations}
2564 %
2565 % In general, \Ledmac's system for adding marginal line numbers
2566 % breaks anything that makes direct use of the LaTeX insert system,
2567 % which includes marginpars, footnotes and floats.
2568 %
2569 % \begin{PW}
2570 % However, you can use both \cs{footnote} and the familiar footnote
2571 % series notes in numbered text. A \cs{marginpar} in numbered text
2572 % will throw away its contents and send a warning message to the terminal
2573 % and log file, but will do no harm.
2574 % \end{PW}
2575 %
2576 % \cs{parshape} cannot be used within numbered text, except in a
2577 % very restricted way (see p.\,\pageref{parshape}).
2578 %
2579 % \DescribeMacro{\ballast}
2580 % \phantomsection\label{ballastdesc}\relax
2581 % LaTeX is a three-pass system, but even after a document has
2582 % been processed three times, there are some tricky situations in
2583 % which the page breaks decided by \TeX\ never settle down. At
2584 % each successive run, \Ledmac{} may oscillate between two
2585 % different sets of page decisions. To stop this happening, should
2586 % it arise, Wayne Sullivan\index{Sullivan, Wayne} suggested the
2587 % inclusion of the quantity \cs{ballast}. The amount of \cs{ballast}
2588 % will be subtracted from the penalties which apply to the page
2589 % breaks calculated on the \emph{previous} run through \TeX, thus
2590 % reinforcing these breaks. So if you find your page breaks
2591 % oscillating, say \\
2592 % \verb"\setcounter{ballast}{100}" \\
2593 % or some such figure, and with any
2594 % luck the page breaks will settle down. Luckily, this problem
2595 % doesn't crop up at all often.
2596 %
2597 % The restriction on explicit line-breaking in paragraphed footnotes,
2598 % mentioned in footnote \ref{nobreaks}, p.\,\pageref{nobreaks}, and
2599 % described in more detail on p.\,\pageref{nobreaks-detail}, really is a
2600 % nuisance if that's something you need to do. There are some possible
2601 % solutions, described by Michael Downes\index{Downes, Michael},
2602 % but this area remains unsatisfactory.
2603 %
2604 % \begin{PW}
2605 %
2606 % LaTeX has a reputation for putting things in the wrong margin after
2607 % a page break. The \Ledmac{} package does nothing to improve the situation
2608 % --- in fact it just makes it more obvious if numbered text crosses a
2609 % page (or column) boundary and the numbers are meant to flip from side
2610 % to side. Try and keep the numbers in the same margin all the time.
2611 % Another aspect of TeX's page breaking mechanism is that when numbering
2612 % lines by the page, the first few numbers after a page break may continue
2613 % as though the lines were still on the previous page.
2614 %
2615 % \DescribeMacro{\pageparbreak}
2616 % If you can't resist flipping the numbers or numbering by the page,
2617 % then you might find that
2618 % judicious use of \cs{pageparbreak} may help if numbering goes awry
2619 % across a page (or column) break. It tries to force TeX into partitioning
2620 % the current paragraph into two invisibly joined paragraphs with a page
2621 % break between them. Insert the command between the last word on one page
2622 % and the first word on the next page. If later you change something earlier
2623 % in the document the natural page break may be in a different place, and you
2624 % will have to adjust the location of \cs{pageparbreak} accordingly.
2625 %
2626 % \DescribeMacro{\footfudgefiddle}
2627 % For paragraphed footnotes \TeX{} has to estimate the amount of space
2628 % required. If it underestimates this then the notes may get too long and
2629 % run off the bottom of the text block. \cs{footfudgefiddle} can be increased
2630 % from its default 64 (say to 68) to increase the estimate. You have to use
2631 % \cs{renewcommand} for this, like: \\
2632 % \verb?\renewcommand{\footfudgefiddle}{68}?
2633 %
2634 %
2635 % \end{PW}
2636 %
2637 % Help, suggestions and corrections will be gratefully received.
2638 %
2639 % \subsection{Use with other packages}
2640 %
2641 % \begin{PW}
2642 %
2643 % Because of \Ledmac's complexity it may not play well with other
2644 % packages. In particular \Ledmac{} is sensitive to commands in the
2645 % arguments to the \cs{edtext} and \cs{*footnote} macros (this is
2646 % discussed in more detail in section~\ref{text}, and in particular
2647 % the discussion about \cs{no@expands} and \cs{morenoexpands}). You
2648 % will have to see what works or doesn't work in your particular case.
2649 %
2650 %
2651 % It is possible that \Ledmac{} and the \Lpack{hyperref} package may
2652 % work together. I have not tried this combination but past experience
2653 % with \Lpack{hyperref} suggests that cooperation is unlikely; \Lpack{hyperref}
2654 % changes many LaTeX internals and \Lpack{ledmac} does things that are
2655 % not normaly seen in LaTeX.
2656 %
2657 % \DescribeMacro{\morenoexpands}
2658 % You can define the macro \cs{morenoexpands} to modify macros that you
2659 % call within \cs{edtext}. Because of the way \Ledmac{} numbers the lines
2660 % the arguments to \cs{edtext} can be processed more than once and in some
2661 % cases a macro should only be processed once. One example is the \cs{colorbox}
2662 % macro from the \Lpack{color} package, which you might use like this:
2663 % \begin{verbatim}
2664 % ... \edtext{\colorbox{mycolor}{lemma}}{\Afootnote{...\colorbox...}}
2665 % \end{verbatim}
2666 % If you actally try
2667 % this\footnote{Reported by Dirk-Jan Dekker\index{Dekker, Dirk-Jan}
2668 % in the CTT thread `Incompatibility
2669 % of ``color'' package' on 2003/08/28.}
2670 % you will find LaTeX whinging
2671 % `\texttt{Missing \{ inserted}', and then things start to fall apart.
2672 % The trick in this case is to specify either:
2673 % \begin{verbatim}
2674 % \newcommand{\morenoexpands}{\let\colorbox=0}
2675 % \end{verbatim}
2676 % or
2677 % \begin{verbatim}
2678 % \makeatletter
2679 % \newcommand{\morenoexpands}{\let\colorbox\@secondoftwo}
2680 % \makeatother
2681 % \end{verbatim}
2682 % (\cs{@secondoftwo} is an internal LaTeX macro that takes two arguments and
2683 % thows away the first one.)
2684 % The first incantation lets color show in both the main text and footnotes
2685 % whereas the second one shows color in the main text but kills it
2686 % in the lemma and footnotes. On the other hand if you use
2687 % \cs{textcolor} instead, like
2688 % \begin{verbatim}
2689 % ... \edtext{\textcolor{mycolor}{lemma}}{\Afootnote{...\textcolor...}}
2690 % \end{verbatim}
2691 % there is no need to fiddle with \cs{morenoexpands} as the color will
2692 % naturally be displayed in both the text and footnotes. To kill the color
2693 % in the lemma and footnotes, though, you can do:
2694 % \begin{verbatim}
2695 % \makeatletter
2696 % \newcommand{\morenoexpands}{\let\textcolor\@secondoftwo}
2697 % \makeatother
2698 % \end{verbatim}
2699 % It took me a little while to discover all this. If you run into this sort
2700 % of problem you may have to spend some time experimenting before hitting
2701 % on a solution.
2702 %
2703 % \end{PW}
2704 %
2705 % \subsection{Parallel typesetting}
2706 %
2707 % \begin{PW}
2708 %
2709 % \changes{v0.31}{2004/12/1}{Added remarks about ledmac/parallel package incompatability}
2710 % \changes{v0.7}{2005/02/20}{Added bits about ledpar package}
2711 %
2712 % \Ledmac{} and the \Lpack{parallel} package~\cite{PARALLEL}
2713 % do not work together --- they have very different ideas about
2714 % footnoting --- and I do not have the skills to try and get them
2715 % to cooperate. If you are
2716 % trying to typeset short pieces in parallel on the same page you can
2717 % try using the \verb?edtabular? environment.
2718 %
2719 % More likely you are wanting to typeset in parallel on opposite
2720 % pages (e.g., original on the left (even numbered) pages and a translation
2721 % on the right (odd numbered) pages). Essentially you will have to do
2722 % all the page breaking yourself. Here's some example code that might help,
2723 % though.
2724 % \begin{verbatim}
2725 % \makeatletter
2726 % \providecommand{\cleartoevenpage}{% defined in the memoir class
2727 % \clearpage%
2728 % \ifodd\c@page\hbox{}\clearpage\fi}
2729 % \providecommand{\cleartooddpage}{% defined in the memoir class
2730 % \clearpage%
2731 % \ifodd\c@page\else\hbox{}\clearpage\fi}
2732 % \makeatother
2733 % \newenvironment{parallelpages}{\cleartoevenpage}{}
2734 % \newcommand{\leftpage}{\cleartoevenpage}
2735 % \newcommand{\rightpage}{\cleartooddpage}
2736 % ...
2737 % \begin{parallelpages}
2738 % \leftpage{first left page text}
2739 % \rightpage{first right page text}
2740 % \leftpage{second left page text}
2741 % ...
2742 % \end{parallelpages}
2743 % \end{verbatim}
2744 % Notes:
2745 % \begin{itemize}
2746 % \item The \verb?\(left|right)page? declarations are guaranteed to
2747 % start a new page of the specified kind.
2748 % \item You are responsible for ensuring that each text (plus any footnotes)
2749 % is not more than a page long.
2750 % \item I used braces above so that would be possible to do, say, \\
2751 % \verb?\renewcommand{\rightpage}[1]{}? \\
2752 % to comment out all the texts on the righthand pages.
2753 % \item However,
2754 % in general it's probably not a good idea for these macros
2755 % to take the text as an argument as that would prohibit
2756 % the use of any verbatim text.
2757 % \item You could do things like \\
2758 % \verb?\renewcommand{\rightpage}{\cleartooddpage\normalfont\itshape}? \\
2759 % \verb?\renewcommand{\leftpage}{\cleartoevenpage\normalfont\sfseries}? \\
2760 % to have different fonts for the two texts.
2761 % \end{itemize}
2762 % I realise that the above does not eliminate the need for hand massaging
2763 % but it might help in other ways.
2764 %
2765 % Since the above was written I have developed the \Lpack{ledpar}
2766 % package~\cite{LEDPAR}
2767 % as an adjunct to \Ledmac{} specifically for parallel typesetting
2768 % of critical texts. This also cooperates with the \Lpack{babel}
2769 % package for typesetting in multiple languages. An even more
2770 % recent extension is the \Lpack{ledarab} package~\cite{LEDARAB} for
2771 % handling parallel arabic text in critical editions.
2772 %
2773 % \end{PW}
2774 %
2775 %
2776 %
2777 % \subsection{Notes for EDMAC users} \label{sec:lastuser}
2778 %
2779 % \begin{PW}
2780 % If you have never used \edmac, ignore this section. If you have used
2781 % \edmac{} and are starting on a completely new document, ignore this section.
2782 % Only read this section if you are converting an original \edmac{}
2783 % document to use \ledmac.
2784 %
2785 % The package still provides the original \cs{text} command, but it is
2786 % (a) deprecated, and
2787 % (b) its name has been changed\footnote{A name like \cs{text} is likely to be defined by
2788 % other LaTeX packages (it certainly is by the AMS packages) and it
2789 % seems sensible to try and avoid clashes with other definitions.}
2790 % to \cs{critext};
2791 % use the \cs{edtext} macro instead. However, if you do
2792 % use \cs{critext} (the new name for \cs{text}), the following is a reminder.
2793 %
2794 % \end{PW}
2795 %
2796 % \DescribeMacro{\critext}
2797 % Within numbered paragraphs, footnotes and endnotes are generated
2798 % by forms of the \cs{critext} macro:
2799 % \begin{verse}
2800 % \cs{critext}\marg{lemma}\meta{commands}\verb"/"
2801 % \end{verse}
2802 %
2803 %
2804 % The \meta{lemma} argument is the lemma in the main text: \cs{critext}
2805 % both prints this as part of the text, and makes it available to the
2806 % \meta{commands} you specify to generate notes. The \verb"/" at the
2807 % end terminates the command; it is part of the macro's definition so
2808 % that spaces after the macro will be treated as significant.
2809 %
2810 % For example:
2811 % \egstart
2812 % \begin{verbatim}
2813 % I saw my friend \critext{Smith}
2814 % \Afootnote{Jones C, D.}/
2815 % on Tuesday.
2816 % \end{verbatim}
2817 % \egmid
2818 % 1\enspace I saw my friend\\
2819 % 2\enspace Smith on Tuesday.\smallskip
2820 % \hrule width 1.5cm
2821 % \strut {\bf 2} Smith] Jones C, D.
2822 % \egend
2823 %
2824 % The lemma \verb"Smith" is printed as part of this sentence in
2825 % the text, and is also made available to the footnote
2826 % that specifies a variant, \verb"Jones C, D". The footnote macro
2827 % is supplied with the line number at which the lemma appears
2828 % in the main text.
2829 %
2830 % The \meta{lemma} may contain further \cs{critext} commands.
2831 % Nesting makes
2832 % it possible to print an explanatory note on a long passage together with
2833 % notes on variants for individual words within the passage. For
2834 % example:
2835 % \egstart
2836 % \begin{verbatim}
2837 % \critext{I saw my friend
2838 % \critext{Smith}{\Afootnote{Jones
2839 % C, D.}/ on Tuesday.}
2840 % \Bfootnote{The date was
2841 % July 16, 1954.}
2842 % /
2843 % \end{verbatim}
2844 % \egmid
2845 % 1\enspace I saw my friend\\
2846 % 2\enspace Smith on Tuesday.\smallskip
2847 % \hrule width 1.5cm
2848 % \strut {\bf 2} Smith] Jones C, D.\smallskip
2849 % \hrule width 1.5cm
2850 % \strut {\bf 1--2} I saw my friend \\
2851 % Smith on Tuesday.] The\\ date was
2852 % July 16, 1954.
2853 % \egend
2854 %
2855 % However, \cs{critext} cannot handle overlapping but unnested
2856 % notes---for example, one note covering lines 10--15, and another
2857 % covering 12--18; a \cs{critext} that starts in the \meta{lemma}
2858 % argument of another \cs{critext} must end there, too. (The
2859 % \cs{lemma} and \cs{linenum} commands may be used to
2860 % generate overlapping notes if necessary.)
2861 %
2862 % \begin{PW}
2863 % The second argument of the \cs{critext} macro, \meta{commands},
2864 % is the same as the second argument to the \cs{edtext} macro.
2865 % \end{PW}
2866 %
2867 %
2868 % It is possible to define aliases for \cs{critext}, which
2869 % can be easier to type. You can make a single character substitute
2870 % for \cs{critext} by saying this:
2871 % \begin{verbatim}
2872 % \catcode`\<=\active
2873 % \let<=\critext
2874 % \end{verbatim}
2875 %
2876 % Then you might say \verb"<{Smith}\variant{Jones}/". This of course
2877 % destroys the ability to use \verb"<" in any new macro definitions, so
2878 % long as it remains in effect; hence it should be used with care.
2879 %
2880 % Changing the character at the end of the command requires more work:
2881 % \begin{verbatim}
2882 % \catcode`\<=\active
2883 % \def\xtext#1#2>{\critext{#1}{#2}/}
2884 % \let<=\xtext
2885 % \end{verbatim}
2886 % This allows you to say \verb"<{Smith}\Afootnote{Jones}>".
2887 %
2888 % Aliases for \cs{critext}
2889 % of the first kind shown here also can't be nested---that is,
2890 % you can't use the alias in the text that forms the first argument
2891 % to \cs{critext}. (See section~\ref{text} to find out why.) Aliases of
2892 % the second kind may be nested without any problem.
2893 %
2894 % \begin{PW}
2895 %
2896 % If you really have to use |\critext| in any of the tabular or
2897 % array environments, then |\edtext| must not be used in the same
2898 % environment. If you use |\critext| in one of these environments
2899 % then you have to issue the declaration |\usingcritext| beforehand.
2900 % The declaration |\usingedtext| must be issued to revert to the
2901 % default assumption that |\edtext| will be used.
2902 %
2903 % \end{PW}
2904 %
2905 % \StopEventually{}
2906 %
2907 % \clearpage
2908 % \section{Implementation overview}\label{overview}
2909 %
2910 %
2911 % We present the \Ledmac{} code in roughly the order in which it's used
2912 % during a run of \TeX. The order is \emph{exactly} that in which
2913 % it's read when you load the \Ledmac{} package, because the same file
2914 % is used to generate this manual and to generate the LaTeX package file.
2915 % Most of what follows consists of macro definitions, but there
2916 % are some commands that are executed immediately---especially
2917 % at the start of the code. The documentation generally describes the
2918 % code from the point of view of what happens when the macros are
2919 % executed, though. As each macro is introduced, its name is printed
2920 % in the margin.
2921 %
2922 % We begin with the commands you use to start and
2923 % stop line numbering in a section of text (Section~\ref{preliminaries}).
2924 % Next comes the machinery for writing and reading the auxiliary file for
2925 % each section that helps us count lines, and for creating list macros
2926 % encoding the information from that file (Section~\ref{lineation}); this
2927 % auxiliary file will be read at the start of each section, to create
2928 % those list macros, and a new version of the file will be started to
2929 % collect information from the body of the section.
2930 %
2931 % Next are commands for marking sections of
2932 % the text for footnotes (Section~\ref{text}), followed by the macros
2933 % that take each paragraph apart, attach the line numbers and insertions,
2934 % and send the result to the vertical list (Section~\ref{paragraph}). The
2935 % footnote commands (Section~\ref{footnotes}) and output routine
2936 % (Section~\ref{output}) finish the main part of the processing;
2937 % cross-referencing (Section~\ref{xref}) and endnotes
2938 % (Section~\ref{endnotes}) complete the story.
2939 %
2940 % In what follows, macros with an @ in their name are more internal
2941 % to the workings of \Ledmac{} than those made up just of
2942 % ordinary letters, just as in \PlainTeX\ (see \thetexbook,
2943 % p.\,344). You are meant to be able to make free with
2944 % ordinary macros, but the `@' ones should be treated with more
2945 % respect, and changed only if you are pretty sure of what you are
2946 % doing.
2947 %
2948 %
2949 % \section{Preliminaries}
2950 % \label{preliminaries}\relax
2951 %
2952 % \begin{PW}
2953 % I'll try and use \texttt{l@d} in macro names to help avoid
2954 % name clashes, but this is not a hard and fast rule. For example,
2955 % if an original \edmac{} macro includes \texttt{edmac} I'll simply
2956 % change that to \texttt{ledmac}.
2957 % \end{PW}
2958 %
2959 % \begin{PW}
2960 % Announce the name and version of the package, which is
2961 % targetted for LaTeX2e.
2962 % \end{PW}
2963 %
2964 % \begin{macrocode}
2965 %<*code>
2966 \NeedsTeXFormat{LaTeX2e}
2967 \ProvidesPackage{ledmac}[2016/08/06 v0.19.4 LaTeX port of EDMAC]
2968
2969 % \end{macrocode}
2970 %
2971 % \begin{PW}
2972 % In general I have made the following modifications to the original
2973 % \edmac{} code:
2974 % \begin{itemize}
2975 % \item Replace as many \cs{def}'s by \cs{newcommand}'s as possible
2976 % to avoid overwriting LaTeX macros.
2977 %
2978 % \item Replace user-level TeX counts by LaTeX counters.
2979 %
2980 % \item Use the LaTeX font handling mechanisms.
2981 %
2982 % \item Use LaTeX messaging and file facilities.
2983 %
2984 % \end{itemize}
2985 % \end{PW}
2986 %
2987 % \begin{PW}
2988 % I'm adding final/draft options which I hope may be useful.
2989 %
2990 % \begin{macro}{\ifledfinal}
2991 % Use this to remember which option is used, set and execute the options
2992 % with final as the default.
2993 % \changes{v0.4}{2004/02/29}{Added final/draft options}
2994 % \begin{macrocode}
2995 \newif\ifledfinal
2996 \newif\ifnoeledmac
2997 \DeclareOption{final}{\ledfinaltrue}
2998 \DeclareOption{draft}{\ledfinalfalse}
2999 \DeclareOption{noeledmac}{\noeledmactrue}
3000 \ExecuteOptions{final}
3001 % \end{macrocode}
3002 % Use the starred form of \verb?\ProcessOptions? which executes options in
3003 % the order listed in the source file: class options, then listed package
3004 % options, so a package option can override a class option with the same name.
3005 % This was suggested by Dan Luecking\index{Luecking, Dan} in the \texttt{ctt}
3006 % thread \textit{Class/package option processing}, on 27 February 2004.
3007 % \begin{macrocode}
3008 \ProcessOptions*\relax
3009
3010 % \end{macrocode
3011 % \end{macro}
3012 %
3013 % \begin{macro}{\showlemma}
3014 % \verb?\showlemma?\marg{lemma} typesets the lemma text in the body.
3015 % It depends on the option.
3016 % \changes{v0.4}{2004/02/29}{Added \cs{showlemma}}
3017 % \begin{macrocode}
3018 \ifledfinal
3019 \newcommand*{\showlemma}[1]{#1}
3020 \else
3021 \newcommand*{\showlemma}[1]{\textit{#1}}
3022 \fi
3023
3024 % \end{macrocode}
3025 % \end{macro}
3026 % \end{PW}
3027 %
3028 % \begin{PW}
3029 % \begin{macro}{\linenumberlist}
3030 % The code for the \verb?\linenumberlist? mechanism was given to me by Wayne
3031 % Sullivan\index{Sullivan, Wayne} on 2004/02/11.
3032 %
3033 % Initialize it as \verb?\empty?
3034 % \changes{v0.3}{2004/02/14}{Added \cs{linenumberlist} mechanism}
3035 % \begin{macrocode}
3036 \let\linenumberlist=\empty
3037
3038 % \end{macrocode}
3039 % \end{macro}
3040 % \end{PW}
3041 %
3042 % \begin{macro}{\@l@dtempcnta}
3043 % \begin{macro}{\@l@dtempcntb}
3044 % In imitation of \LaTeX, we create a couple of scratch counters.
3045 %
3046 % \begin{PW}
3047 % LaTeX already defines \cs{@tempcnta} and \cs{@tempcntb} but I have
3048 % found in the past that it can be dangerous to use these (for example
3049 % one of the AMS packages did something nasty to the \Lpack{ccaption}
3050 % package's use of one of these).
3051 % \end{PW}
3052 % \begin{macrocode}
3053 \newcount\@l@dtempcnta \newcount\@l@dtempcntb
3054 % \end{macrocode}
3055 % \end{macro}
3056 % \end{macro}
3057 %
3058 %
3059 % \begin{PW}
3060 % \begin{macro}{\ifl@dmemoir}
3061 % Define a flag for if the \Lpack{memoir} class has been used.
3062 % \changes{v0.2}{2003/07/25}{Added \cs{ifl@dmemoir} for memoir class having been used}
3063 % \begin{macrocode}
3064 \newif\ifl@dmemoir
3065 \@ifclassloaded{memoir}{\l@dmemoirtrue}{\l@dmemoirfalse}
3066
3067 % \end{macrocode}
3068 % \end{macro}
3069 % \end{PW}
3070 %
3071 %
3072 % \subsection{Messages}
3073 %
3074 % \begin{PW}
3075 % All the messages are grouped here as macros. This saves TeX's memory
3076 % when the same message is repeated and also lets them be edited easily.
3077 % \changes{v0.7}{2005/02/21}{Made macros of all messages}
3078 % \end{PW}
3079 %
3080 % \begin{macro}{\ledmac@warning}
3081 % Write a warning message.
3082 % \begin{PW}Changed to use LaTeX capabilities.\end{PW}
3083 % \begin{macrocode}
3084 \newcommand{\ledmac@warning}[1]{\PackageWarning{ledmac}{#1}}
3085 % \end{macrocode}
3086 % \end{macro}
3087 %
3088 % \begin{PW}
3089 % \begin{macro}{\ledmac@error}
3090 % Write an error message.
3091 % \changes{v0.2}{2003/07/25}{Added \cs{ledmac@error} and replaced error messages}
3092 % \begin{macrocode}
3093 \newcommand{\ledmac@error}[2]{\PackageError{ledmac}{#1}{#2}}
3094 % \end{macrocode}
3095 % \end{macro}
3096 % \end{PW}
3097 %
3098 % \changes{v0.19}{2012/09/14}{Add an optional message to suggest to migrate to eledmac.}
3099 % \changes{v0.19.2a}{2015/07/19}{Suggest now to migrate to reledmac.}
3100 % \begin{macrocode}
3101 \ifnoeledmac
3102 \else
3103 \ledmac@error{Using package `ledmac' is deprecated. We suggest\MessageBreak using `reledmac' instead. If you want to continue\MessageBreak with `ledmac', you can disable this message by\MessageBreak adding the option `noeledmac' when loading `ledmac'}{\@ehc}
3104 \fi
3105 % \end{macrocode}
3106 % \begin{PW}
3107 % \begin{macro}{\led@err@NumberingStarted}
3108 % \begin{macro}{\led@err@NumberingNotStarted}
3109 % \begin{macro}{\led@err@NumberingShouldHaveStarted}
3110 % \begin{macrocode}
3111 \newcommand*{\led@err@NumberingStarted}{%
3112 \ledmac@error{Numbering has already been started}{\@ehc}}
3113 \newcommand*{\led@err@NumberingNotStarted}{%
3114 \ledmac@error{Numbering was not started}{\@ehc}}
3115 \newcommand*{\led@err@NumberingShouldHaveStarted}{%
3116 \ledmac@error{Numbering should already have been started}{\@ehc}}
3117 % \end{macrocode}
3118 % \end{macro}
3119 % \end{macro}
3120 % \end{macro}
3121 %
3122 % \begin{macro}{\led@mess@NotesChanged}
3123 % \begin{macrocode}
3124 \newcommand*{\led@mess@NotesChanged}{%
3125 \typeout{ledmac reminder: }%
3126 \typeout{ The number of footnotes in this section
3127 has changed since the last run.}%
3128 \typeout{ You will need to run LaTeX two more times
3129 before the footnote placement}%
3130 \typeout{ and line numbering in this section are
3131 correct.}}
3132 % \end{macrocode}
3133 % \end{macro}
3134 %
3135 % \begin{macro}{\led@mess@SectionContinued}
3136 % \begin{macrocode}
3137 \newcommand*{\led@mess@SectionContinued}[1]{%
3138 \message{Section #1 (continuing the previous section)}}
3139 % \end{macrocode}
3140 % \end{macro}
3141 %
3142 % \begin{macro}{\led@err@LineationInNumbered}
3143 % \begin{macrocode}
3144 \newcommand*{\led@err@LineationInNumbered}{%
3145 \ledmac@error{You can't use \string\lineation\space within
3146 a numbered section}{\@ehc}}
3147 % \end{macrocode}
3148 % \end{macro}
3149 %
3150 %
3151 % \begin{macro}{\led@warn@BadLineation}
3152 % \begin{macro}{\led@warn@BadLinenummargin}
3153 % \begin{macro}{\led@warn@BadLockdisp}
3154 % \begin{macro}{\led@warn@BadSublockdisp}
3155 % \begin{macrocode}
3156 \newcommand*{\led@warn@BadLineation}{%
3157 \ledmac@warning{Bad \string\lineation\space argument}}
3158 \newcommand*{\led@warn@BadLinenummargin}{%
3159 \ledmac@warning{Bad \string\linenummargin\space argument}}
3160 \newcommand*{\led@warn@BadLockdisp}{%
3161 \ledmac@warning{Bad \string\lockdisp\space argument}}
3162 \newcommand*{\led@warn@BadSublockdisp}{%
3163 \ledmac@warning{Bad \string\sublockdisp\space argument}}
3164 % \end{macrocode}
3165 % \end{macro}
3166 % \end{macro}
3167 % \end{macro}
3168 % \end{macro}
3169 %
3170 % \begin{macro}{\led@warn@NoLineFile}
3171 % \begin{macrocode}
3172 \newcommand*{\led@warn@NoLineFile}[1]{%
3173 \ledmac@warning{Can't find line-list file #1}}
3174 % \end{macrocode}
3175 % \end{macro}
3176 %
3177 % \begin{macro}{\led@warn@BadAdvancelineSubline}
3178 % \begin{macro}{\led@warn@BadAdvancelineLine}
3179 % \begin{macrocode}
3180 \newcommand*{\led@warn@BadAdvancelineSubline}{%
3181 \ledmac@warning{\string\advanceline\space produced a sub-line
3182 number less than zero.}}
3183 \newcommand*{\led@warn@BadAdvancelineLine}{%
3184 \ledmac@warning{\string\advanceline\space produced a line
3185 number less than zero.}}
3186 % \end{macrocode}
3187 % \end{macro}
3188 % \end{macro}
3189 %
3190 % \begin{macro}{\led@warn@BadSetline}
3191 % \begin{macro}{\led@warn@BadSetlinenum}
3192 % \begin{macrocode}
3193 \newcommand*{\led@warn@BadSetline}{%
3194 \ledmac@warning{Bad \string\setline\space argument}}
3195 \newcommand*{\led@warn@BadSetlinenum}{%
3196 \ledmac@warning{Bad \string\setlinenum\space argument}}
3197 % \end{macrocode}
3198 % \end{macro}
3199 % \end{macro}
3200 %
3201 % \begin{macro}{\led@err@PstartNotNumbered}
3202 % \begin{macro}{\led@err@PstartInPstart}
3203 % \begin{macro}{\led@err@PendNotNumbered}
3204 % \begin{macro}{\led@err@PendNoPstart}
3205 % \begin{macro}{\led@err@AutoparNotNumbered}
3206 % \begin{macrocode}
3207 \newcommand*{\led@err@PstartNotNumbered}{%
3208 \ledmac@error{\string\pstart\space must be used within a
3209 numbered section}{\@ehc}}
3210 \newcommand*{\led@err@PstartInPstart}{%
3211 \ledmac@error{\string\pstart\space encountered while another
3212 \string\pstart\space was in effect}{\@ehc}}
3213 \newcommand*{\led@err@PendNotNumbered}{%
3214 \ledmac@error{\string\pend\space must be used within a
3215 numbered section}{\@ehc}}
3216 \newcommand*{\led@err@PendNoPstart}{%
3217 \ledmac@error{\string\pend\space must follow a \string\pstart}{\@ehc}}
3218 \newcommand*{\led@err@AutoparNotNumbered}{%
3219 \ledmac@error{\string\autopar\space must be used within a
3220 numbered section}{\@ehc}}
3221 % \end{macrocode}
3222 % \end{macro}
3223 % \end{macro}
3224 % \end{macro}
3225 % \end{macro}
3226 % \end{macro}
3227 %
3228 % \begin{macro}{\led@warn@BadAction}
3229 % \begin{macrocode}
3230 \newcommand*{\led@warn@BadAction}{%
3231 \ledmac@warning{Bad action code, value \next@action.}}
3232 % \end{macrocode}
3233 % \end{macro}
3234 %
3235 % \begin{macro}{\led@warn@DuplicateLabel}
3236 % \begin{macro}{\led@warn@RefUndefined}
3237 % \begin{macrocode}
3238 \newcommand*{\led@warn@DuplicateLabel}[1]{%
3239 \ledmac@warning{Duplicate definition of label `#1' on page \the\pageno.}}
3240 \newcommand*{\led@warn@RefUndefined}[1]{%
3241 \ledmac@warning{Reference `#1' on page \the\pageno\space undefined.
3242 Using `000'.}}
3243 % \end{macrocode}
3244 % \end{macro}
3245 % \end{macro}
3246 %
3247 % \begin{macro}{\led@warn@NoMarginpars}
3248 % \begin{macrocode}
3249 \newcommand*{\led@warn@NoMarginpars}{%
3250 \ledmac@warning{You can't use \string\marginpar\space in numbered text}}
3251 % \end{macrocode}
3252 % \end{macro}
3253 %
3254 % \begin{macro}{\led@warn@BadSidenotemargin}
3255 % \begin{macrocode}
3256 \newcommand*{\led@warn@BadSidenotemargin}{%
3257 \ledmac@warning{Bad \string\sidenotemmargin\space argument}}
3258 % \end{macrocode}
3259 % \end{macro}
3260 %
3261 % \begin{macro}{\led@warn@NoIndexFile}
3262 % \begin{macrocode}
3263 \newcommand*{\led@warn@NoIndexFile}[1]{%
3264 \ledmac@warning{Undefined index file #1}}
3265 % \end{macrocode}
3266 % \end{macro}
3267 %
3268 % \begin{macro}{\led@err@TooManyColumns}
3269 % \begin{macro}{\led@err@UnequalColumns}
3270 % \begin{macro}{\led@err@LowStartColumn}
3271 % \begin{macro}{\led@err@HighEndColumn}
3272 % \begin{macro}{\led@err@ReverseColumns}
3273 % \begin{macrocode}
3274 \newcommand*{\led@err@TooManyColumns}{%
3275 \ledmac@error{Too many columns}{\@ehc}}
3276 \newcommand*{\led@err@UnequalColumns}{%
3277 \ledmac@error{Number of columns is not equal to the number
3278 in the previous row (or \protect\\ \space forgotten?)}{\@ehc}}
3279 \newcommand*{\led@err@LowStartColumn}{%
3280 \ledmac@error{Start column is too low}{\@ehc}}
3281 \newcommand*{\led@err@HighEndColumn}{%
3282 \ledmac@error{End column is too high}{\@ehc}}
3283 \newcommand*{\led@err@ReverseColumns}{%
3284 \ledmac@error{Start column is greater than end column}{\@ehc}}
3285 % \end{macrocode}
3286 % \end{macro}
3287 % \end{macro}
3288 % \end{macro}
3289 % \end{macro}
3290 % \end{macro}
3291 %
3292 % \end{PW}
3293 %
3294 %
3295 % \section{Sectioning commands}
3296 %
3297 % \begin{macro}{\section@num}
3298 % You use \cs{beginnumbering} and \cs{endnumbering} to begin
3299 % and end a line-numbered section of the text; the pair of commands may
3300 % be used as many times as you like within one document to start
3301 % and end multiple, separately line-numbered sections. LaTeX will
3302 % maintain and display
3303 % a `section number' as a count named
3304 % \cs{section@num} that counts how many
3305 % \cs{beginnumbering} and \cs{resumenumbering}
3306 % commands have appeared; it needn't be
3307 % related to the logical divisions of your text.
3308 %
3309 % \begin{macro}{\extensionchars}
3310 % Each section will read and write an associated `line-list
3311 % file', containing information used to do the numbering; the file
3312 % will be called \meta{jobname}\file{.nn}, where \file{nn} is the
3313 % section number. However, you may direct that
3314 % an extra string be added before the
3315 % \file{nn} in that filename, in order to distinguish these
3316 % temporary files from others: that string is called
3317 % \cs{extensionchars}. Initially it's empty, since different
3318 % operating systems have greatly varying ideas about what
3319 % characters are permitted in file names. So
3320 % \verb"\renewcommand{\extensionchars}{-}" gives temporary files called
3321 % \file{jobname.-1}, \file{jobname.-2}, etc.
3322 % \begin{macrocode}
3323 \newcount\section@num
3324 \section@num=0
3325 \let\extensionchars=\empty
3326 % \end{macrocode}
3327 % \end{macro}
3328 % \end{macro}
3329 %
3330 % \begin{macro}{\ifnumbering}
3331 % \begin{macro}{\numberingtrue}
3332 % \begin{macro}{\numberingfalse}
3333 % The \cs{ifnumbering} flag is
3334 % set to \verb"true" if we're within a numbered section (that is, between
3335 % \cs{beginnumbering} and \cs{endnumbering}). You can use \cs{ifnumbering}
3336 % in your own code to check whether you're in a numbered section, but
3337 % don't change the flag's value.
3338 % \begin{macrocode}
3339 \newif\ifnumbering
3340 % \end{macrocode}
3341 % \end{macro}
3342 % \end{macro}
3343 % \end{macro}
3344 %
3345 % \begin{macro}{\ifnumberingR}
3346 % \begin{macro}{\ifl@dpairing}
3347 % \begin{macro}{\l@dpairingtrue}
3348 % \begin{macro}{\l@dpairingfalse}
3349 % \begin{macro}{\ifpst@rtedL}
3350 % \begin{macro}{\pst@rtedLtrue}
3351 % \begin{macro}{\pst@rtedLfalse}
3352 % \begin{macro}{\l@dnumpstartsL}
3353 % \begin{macro}{\ifledRcol}
3354 % In preparation for the \Lpack{ledpar} package, these are related to
3355 % the `left' text of parallel texts (when \cs{ifl@dpairing} is TRUE).
3356 % They are explained in the \Lpack{ledpar}
3357 % manual.
3358 % \changes{v0.7}{2005/02/24}{Added \cs{l@dnumpstartsL}, \cs{ifl@dpairing}
3359 % and \cs{ifpst@rted} for/from ledpar}
3360 % \changes{v0.12}{2005/10/01}{Added \cs{ifledRcol} and \cs{ifnumberingR} for/from ledpar}
3361 % \begin{macrocode}
3362 \newif\ifl@dpairing
3363 \l@dpairingfalse
3364 \newif\ifpst@rtedL
3365 \pst@rtedLfalse
3366 \newcount\l@dnumpstartsL
3367 \newif\ifledRcol
3368 % \end{macrocode}
3369 % The \cs{ifnumberingR} flag is
3370 % set to \verb"true" if we're within a right text numbered section.
3371 % \begin{macrocode}
3372 \newif\ifnumberingR
3373 % \end{macrocode}
3374 % \end{macro}
3375 % \end{macro}
3376 % \end{macro}
3377 % \end{macro}
3378 % \end{macro}
3379 % \end{macro}
3380 % \end{macro}
3381 % \end{macro}
3382 % \end{macro}
3383 % \begin{macro}{\beginnumbering}
3384 % \begin{macro}{\initnumbering@reg}
3385 % \cs{beginnumbering} begins a section of numbered text.
3386 % When it's executed we increment the section number,
3387 % initialize our counters, send a message to your terminal, and
3388 % call macros to start the lineation machinery and endnote files.
3389 %
3390 % The initializations here are trickier than they look.
3391 % \cs{line@list@stuff} will use all of the counters
3392 % that are zeroed here when it assembles
3393 % the line-list and other lists of information about the lineation.
3394 % But it will do all of this locally and
3395 % within a group, and when it's done the
3396 % lists will remain but the counters will return to zero. Those same
3397 % counters will then be used as we process the text of this section,
3398 % but the assignments will be made globally. These initializations
3399 % actually apply to both uses, though in all other respects there
3400 % should be no direct interaction between the use of these counters
3401 % and variables in the two processing steps.
3402 % \changes{v0.7}{2005/02/24}{Added \cs{initnumbering@reg}}
3403 % \begin{macrocode}
3404 \newcommand*{\beginnumbering}{%
3405 \ifnumbering
3406 \led@err@NumberingStarted
3407 \endnumbering
3408 \fi
3409 \global\numberingtrue
3410 \global\advance\section@num \@ne
3411 \initnumbering@reg
3412 \message{Section \the\section@num }%
3413 \line@list@stuff{\jobname.\extensionchars\the\section@num}%
3414 \l@dend@stuff
3415 \setcounter{pstart}{1}
3416 }
3417 \newcommand*{\initnumbering@reg}{%
3418 \global\pst@rtedLfalse
3419 \global\l@dnumpstartsL \z@
3420 \global\absline@num \z@
3421 \global\line@num \z@
3422 \global\subline@num \z@
3423 \global\@lock \z@
3424 \global\sub@lock \z@
3425 \global\sublines@false
3426 \global\let\next@page@num=\relax
3427 \global\let\sub@change=\relax}
3428
3429 % \end{macrocode}
3430 % \end{macro}
3431 % \end{macro}
3432 %
3433 % \begin{macro}{\endnumbering}
3434 % \cs{endnumbering} must follow the last text for a numbered section.
3435 % It takes care of notifying you when changes have been noted in the
3436 % input that require running the file through again to move everything
3437 % to the right place.
3438 % \PWcomment{Using LaTeX typeout rather than TeX write below.}
3439 % \changes{v0.7}{2005/02/24}{Changed \cs{endnumbering} for ledpar}
3440 % \begin{macrocode}
3441 \def\endnumbering{%
3442 \ifnumbering
3443 \global\numberingfalse
3444 \normal@pars
3445 \ifl@dpairing
3446 \global\pst@rtedLfalse
3447 \else
3448 \ifx\insertlines@list\empty\else
3449 \global\noteschanged@true
3450 \fi
3451 \ifx\line@list\empty\else
3452 \global\noteschanged@true
3453 \fi
3454 \fi
3455 \ifnoteschanged@
3456 \led@mess@NotesChanged
3457 \fi
3458 \else
3459 \led@err@NumberingNotStarted
3460 \fi
3461 \autoparfalse}
3462 % \end{macrocode}
3463 % \end{macro}
3464 %
3465 % \begin{macro}{\pausenumbering}
3466 % \begin{macro}{\resumenumbering}
3467 % The \cs{pausenumbering} macro is just the same as
3468 % \cs{endnumbering}, but with the \cs{ifnumbering} flag set to \verb"true", to
3469 % show that numbering continues across the gap.\footnote{Our thanks
3470 % to Wayne Sullivan,\index{Sullivan, Wayne} who suggested the idea
3471 % behind these macros.}
3472 % \begin{macrocode}
3473 \newcommand{\pausenumbering}{%
3474 \endnumbering\global\numberingtrue}
3475 % \end{macrocode}
3476 % The \cs{resumenumbering} macro is a bit more involved, but not much.
3477 % It does most of the same things as \cs{beginnumbering}, but
3478 % without resetting the various counters. Note that no check is made
3479 % by \cs{resumenumbering} to ensure that \cs{pausenumbering} was actually
3480 % invoked.
3481 % \changes{v0.7}{2005/02/24}{Changed \cs{resumenumbering} for ledpar}
3482 % \begin{macrocode}
3483 \newcommand*{\resumenumbering}{%
3484 \ifnumbering
3485 \global\pst@rtedLtrue
3486 \global\advance\section@num \@ne
3487 \led@mess@SectionContinued{\the\section@num}%
3488 \line@list@stuff{\jobname.\extensionchars\the\section@num}%
3489 \l@dend@stuff
3490 \else
3491 \led@err@NumberingShouldHaveStarted
3492 \endnumbering
3493 \beginnumbering
3494 \fi}
3495
3496 % \end{macrocode}
3497 % \end{macro}
3498 % \end{macro}
3499 %
3500 %
3501 % \section{Line counting}
3502 % \label{lineation}\relax
3503 %
3504 % \subsection{Choosing the system of lineation}
3505 % \changes{v0.15}{2012/06/11}{Line numbering can be reset at each pstart.}
3506 % \changes{v0.18}{2012/09/14}{Debug \cs{lineation} command.}
3507 % Sometimes you want line numbers that start at $1$ at the top of each
3508 % page; sometimes you want line numbers that start at $1$ at each \cs{pstart}; other times you want line numbers that start at $1$ at the start
3509 % of each section and increase regardless of page breaks.
3510 % \Ledmac{} can do it either way, and you can switch from one to the
3511 % other within one work.
3512 % But you have to choose one or the other for all line numbers and
3513 % line references within each section. Here we will define
3514 % internal codes for these systems and the macros you use to select them.
3515 %
3516 % \begin{macro}{\ifbypstart@}
3517 % \begin{macro}{\bypstart@true}
3518 % \begin{macro}{\bypstart@false}
3519 % \begin{macro}{\ifbypage@}
3520 % \begin{macro}{\bypage@true}
3521 % \begin{macro}{\bypage@false}
3522 % The \cs{ifbypage@} and \cs{ifbypstart@} flag specifie the current lineation
3523 % system: \begin{itemize}
3524 % \item line-of-page : \verb|bypstart@ = false| and \verb|bypage@ = true|.
3525 % \item line-of-pstart : \verb|bypstart@ = true| and \verb|bypage@ = false|.
3526 % \end{itemize}
3527 % \Ledmac{} will use the line-of-section system unless instructed otherwise.
3528 % \begin{macrocode}
3529 \newif\ifbypage@
3530 \newif\ifbypstart@
3531 % \end{macrocode}
3532 % \end{macro}
3533 % \end{macro}
3534 % \end{macro}
3535 % \end{macro}
3536 % \end{macro}
3537 % \end{macro}
3538 %
3539 % \begin{macro}{\lineation}
3540 % \cs{lineation}\marg{word} is the macro you use to select the
3541 % lineation system.
3542 % Its argument is a string: either \texttt{page} or \texttt{section} or \texttt{pstart}.
3543 % \begin{macrocode}
3544 \newcommand*{\lineation}[1]{{%
3545 \ifnumbering
3546 \led@err@LineationInNumbered
3547 \else
3548 \def\@tempa{#1}\def\@tempb{page}%
3549 \ifx\@tempa\@tempb
3550 \global\bypage@true
3551 \global\bypstart@false
3552 \else
3553 \def\@tempb{pstart}%
3554 \ifx\@tempa\@tempb
3555 \global\bypage@false
3556 \global\bypstart@true
3557 \else
3558 \def\@tempb{section}
3559 \ifx\@tempa\@tempb
3560 \global\bypage@false
3561 \global\bypstart@false
3562 \else
3563 \led@warn@BadLineation
3564 \fi
3565 \fi
3566 \fi
3567 \fi}}
3568 % \end{macrocode}
3569 % \end{macro}
3570 %
3571 % \begin{macro}{\linenummargin}
3572 % \begin{macro}{\line@margin}
3573 % \begin{macro}{\l@dgetline@margin}
3574 % You call \cs{linenummargin}\marg{word} to specify which margin you want your
3575 % line numbers in; it takes one argument, a string.
3576 % You can put the line numbers in the same margin on every page using
3577 % \texttt{left} or \texttt{right}; or you can use \texttt{inner} or
3578 % \texttt{outer} to get them in the inner or outer margins. (These last
3579 % two options assume that even-numbered pages will be on the
3580 % left-hand side of every opening in your book.)
3581 % You can change this within a numbered section, but the
3582 % change may not take effect just when you'd like; if it's done between
3583 % paragraphs nothing surprising should happen.
3584 %
3585 % The selection is recorded in the count \cs{line@margin}:
3586 % $0$ for left, $1$ for right, $2$ for outer, and $3$ for inner.
3587 % \changes{v0.7}{2005/02/23}{Added \cs{l@dgetline@margin}}
3588 % \begin{macrocode}
3589 \newcount\line@margin
3590 \newcommand*{\linenummargin}[1]{{%
3591 \l@dgetline@margin{#1}%
3592 \ifnum\@l@dtempcntb>\m@ne
3593 \global\line@margin=\@l@dtempcntb
3594 \fi}}
3595 \newcommand*{\l@dgetline@margin}[1]{%
3596 \def\@tempa{#1}\def\@tempb{left}%
3597 \ifx\@tempa\@tempb
3598 \@l@dtempcntb \z@
3599 \else
3600 \def\@tempb{right}%
3601 \ifx\@tempa\@tempb
3602 \@l@dtempcntb \@ne
3603 \else
3604 \def\@tempb{outer}%
3605 \ifx\@tempa\@tempb
3606 \@l@dtempcntb \tw@
3607 \else
3608 \def\@tempb{inner}%
3609 \ifx\@tempa\@tempb
3610 \@l@dtempcntb \thr@@
3611 \else
3612 \led@warn@BadLinenummargin
3613 \@l@dtempcntb \m@ne
3614 \fi
3615 \fi
3616 \fi
3617 \fi}
3618
3619 % \end{macrocode}
3620 % \end{macro}
3621 % \end{macro}
3622 % \end{macro}
3623 %
3624 % \begin{macro}{\c@firstlinenum}
3625 % \begin{macro}{\c@linenumincrement}
3626 % The following counters tell \Ledmac{} which lines should be
3627 % printed with line numbers. \texttt{firstlinenum} is the number of the
3628 % first line in each section that gets a number;
3629 % \texttt{linenumincrement}
3630 % is the difference between successive numbered lines. The initial
3631 % values of these counters produce labels on lines $5$, $10$, $15$, etc.
3632 % \texttt{linenumincrement} must be at least $1$.
3633 % \PWcomment{I have changed the original counts into LaTeX counters.}
3634 %
3635 % \begin{macrocode}
3636 \newcounter{firstlinenum}
3637 \setcounter{firstlinenum}{5}
3638 \newcounter{linenumincrement}
3639 \setcounter{linenumincrement}{5}
3640 % \end{macrocode}
3641 % \end{macro}
3642 % \end{macro}
3643 %
3644 % \begin{macro}{\c@firstsublinenum}
3645 % \begin{macro}{\c@sublinenumincrement}
3646 % The following parameters are just like \texttt{firstlinenum} and
3647 % \texttt{linenumincrement}, but for sub-line numbers.
3648 % \texttt{sublinenumincrement} must be at least $1$.
3649 % \PWcomment{I have changed the original counts into LaTeX counters.}
3650 %
3651 % \begin{macrocode}
3652 \newcounter{firstsublinenum}
3653 \setcounter{firstsublinenum}{5}
3654 \newcounter{sublinenumincrement}
3655 \setcounter{sublinenumincrement}{5}
3656
3657 % \end{macrocode}
3658 % \end{macro}
3659 % \end{macro}
3660 %
3661 % \begin{macro}{\firstlinenum}
3662 % \begin{macro}{\linenumincrement}
3663 % \begin{macro}{\firstsublinenum}
3664 % \begin{macro}{\sublinenumincrement}
3665 % \begin{PW}
3666 % These macros can be used to set the corresponding counters.
3667 % \end{PW}
3668 % \changes{v0.7}{2005/02/18}{Added \cs{firstlinenum}, \cs{linenumincrement},
3669 % \cs{firstsublinenum} and \cs{linenumincrement}}
3670 % \begin{macrocode}
3671 \newcommand*{\firstlinenum}[1]{\setcounter{firstlinenum}{#1}}
3672 \newcommand*{\linenumincrement}[1]{\setcounter{linenumincrement}{#1}}
3673 \newcommand*{\firstsublinenum}[1]{\setcounter{firstsublinenum}{#1}}
3674 \newcommand*{\sublinenumincrement}[1]{\setcounter{sublinenumincrement}{#1}}
3675
3676 % \end{macrocode}
3677 % \end{macro}
3678 % \end{macro}
3679 % \end{macro}
3680 % \end{macro}
3681 %
3682 % \begin{macro}{\lockdisp}
3683 % \begin{macro}{\lock@disp}
3684 % \begin{macro}{\l@dgetlock@disp}
3685 % When line locking is being used, the \cs{lockdisp}\marg{word} macro
3686 % specifies whether a line number---if one is due to
3687 % appear---should be printed on the first printed line or on the
3688 % last, or by all of them. Its argument is a word, either
3689 % \texttt{first}, \texttt{last}, or \texttt{all}.
3690 % Initially, it is set to \texttt{first}.
3691 %
3692 % \cs{lock@disp} encodes the selection: $0$ for first, $1$ for last,
3693 % $2$ for all.
3694 % \changes{v0.7}{2005/02/23}{Added \cs{l@dgetlock@disp}}
3695 % \begin{macrocode}
3696 \newcount\lock@disp
3697 \newcommand{\lockdisp}[1]{{%
3698 \l@dgetlock@disp{#1}%
3699 \ifnum\@l@dtempcntb>\m@ne
3700 \global\lock@disp=\@l@dtempcntb
3701 \else
3702 \led@warn@BadLockdisp
3703 \fi}}
3704 \newcommand*{\l@dgetlock@disp}[1]{
3705 \def\@tempa{#1}\def\@tempb{first}%
3706 \ifx\@tempa\@tempb
3707 \@l@dtempcntb \z@
3708 \else
3709 \def\@tempb{last}%
3710 \ifx\@tempa\@tempb
3711 \@l@dtempcntb \@ne
3712 \else
3713 \def\@tempb{all}%
3714 \ifx\@tempa\@tempb
3715 \@l@dtempcntb \tw@
3716 \else
3717 \@l@dtempcntb \m@ne
3718 \fi
3719 \fi
3720 \fi}
3721
3722 % \end{macrocode}
3723 % \end{macro}
3724 % \end{macro}
3725 % \end{macro}
3726 %
3727 % \begin{macro}{\sublockdisp}
3728 % \begin{macro}{\sublock@disp}
3729 % The same questions about where to print the line number apply to
3730 % sub-lines, and these are the analogous macros for dealing with
3731 % the problem.
3732 % \begin{macrocode}
3733 \newcount\sublock@disp
3734 \newcommand{\sublockdisp}[1]{{%
3735 \l@dgetlock@disp{#1}%
3736 \ifnum\@l@dtempcntb>\m@ne
3737 \global\sublock@disp=\@l@dtempcntb
3738 \else
3739 \led@warn@BadSublockdisp
3740 \fi}}
3741
3742 % \end{macrocode}
3743 % \end{macro}
3744 % \end{macro}
3745 %
3746 % \begin{PW}
3747 % \begin{macro}{\linenumberstyle}
3748 % \begin{macro}{\linenumrep}
3749 % \begin{macro}{\linenumr@p}
3750 % \begin{macro}{\sublinenumberstyle}
3751 % \begin{macro}{\sublinenumrep}
3752 % \begin{macro}{\sublinenumr@p}
3753 % We provide a mechanism for using different representations of the
3754 % line numbers, not just the normal arabic.
3755 %
3756 % NOTE: In v0.7 \cs{linenumrep} and \cs{sublinenumrep} replaced
3757 % the internal \cs{linenumr@p} and \cs{sublinenumr@p}.
3758 %
3759 % \verb?\linenumberstyle? and \verb?\sublinenumberstyle? are user level
3760 % macros for setting the number represention (\verb?\linenumrep?
3761 % and \verb?\sublinenumrep?) for line and sub-line numbers.
3762 % \changes{v0.3}{2004/02/14}{Added \cs{linenumberstyle} and \cs{sublinenumberstyle}}
3763 % \changes{v0.7}{2005/02/18}{Using \cs{linenumrep} instead of \cs{linenumr@p}}
3764 % \changes{v0.7}{2005/02/18}{Using \cs{sublinenumrep} instead of \cs{sublinenumr@p}}
3765 % \begin{macrocode}
3766 \newcommand*{\linenumberstyle}[1]{%
3767 \def\linenumrep##1{\@nameuse{@#1}{##1}}}
3768 \newcommand*{\sublinenumberstyle}[1]{%
3769 \def\sublinenumrep##1{\@nameuse{@#1}{##1}}}
3770 % \end{macrocode}
3771 % Initialise the number styles to arabic.
3772 % \begin{macrocode}
3773 \linenumberstyle{arabic}
3774 \let\linenumr@p\linenumrep
3775 \sublinenumberstyle{arabic}
3776 \let\sublinenumr@p\sublinenumrep
3777
3778 % \end{macrocode}
3779 % \end{macro}
3780 % \end{macro}
3781 % \end{macro}
3782 % \end{macro}
3783 % \end{macro}
3784 % \end{macro}
3785 % \end{PW}
3786 %
3787 % \begin{macro}{\leftlinenum}
3788 % \begin{macro}{\rightlinenum}
3789 % \begin{macro}{\linenumsep}
3790 % \begin{macro}{\numlabfont}
3791 % \begin{macro}{\ledlinenum}
3792 % \cs{leftlinenum} and \cs{rightlinenum} are the macros that are
3793 % called to print marginal line numbers on
3794 % a page, for left- and right-hand margins respectively.
3795 % They're made easy to access and change, since you may
3796 % often want to change the styling in some way. These standard versions
3797 % illustrate the general sort of thing that will be needed; they're
3798 % based on the \cs{leftheadline} macro in \thetexbook, p.\,416.
3799 %
3800 % Whatever these macros output gets printed in a box that will be
3801 % put into the appropriate margin without any space between it and the
3802 % line of text. You'll generally want a kern between a line number and
3803 % the text, and \cs{linenumsep} is provided as a standard way of
3804 % storing its size. Line numbers are usually printed in a smaller
3805 % font, and \cs{numlabfont} is provided as a standard name for that
3806 % font. When called, these macros
3807 % will be executed within a group, so font changes and the like will
3808 % remain local.
3809 %
3810 % \cs{ledlinenum} typesets the line (and subline) number.
3811 %
3812 % \begin{PW}
3813 % The original \cs{numlabfont} specification is equivalent to
3814 % the LaTeX \cs{scriptsize} for a 10pt document.
3815 % \end{PW}
3816 % \changes{v0.3}{2004/02/14}{Added \cs{linenumr@p} and \cs{sublinenum@rep}
3817 % to \cs{leftlinenum} and \cs{rightlinenum}}
3818 % \changes{v0.7}{2005/02/18}{Added \cs{ledlinenum} for use by
3819 % \cs{leftlinenum} and \cs{rightlinenum}}
3820 % \begin{macrocode}
3821 \newlength{\linenumsep}
3822 \setlength{\linenumsep}{1pc}
3823 \newcommand*{\numlabfont}{\normalfont\scriptsize}
3824 \newcommand*{\ledlinenum}{%
3825 \numlabfont\linenumrep{\line@num}%
3826 \ifsublines@
3827 \ifnum\subline@num>0\relax
3828 \unskip\fullstop\sublinenumrep{\subline@num}%
3829 \fi
3830 \fi}
3831 \newcommand*{\leftlinenum}{%
3832 \ledlinenum
3833 \kern\linenumsep}
3834 \newcommand*{\rightlinenum}{%
3835 \kern\linenumsep
3836 \ledlinenum}
3837
3838 % \end{macrocode}
3839 % \end{macro}
3840 % \end{macro}
3841 % \end{macro}
3842 % \end{macro}
3843 % \end{macro}
3844 %
3845 % \subsection{List macros}
3846 %
3847 % \begin{PW}
3848 % Reminder: compare these with the LaTeX list macros in case they
3849 % would be suitable instead.
3850 % \end{PW}
3851 %
3852 % We will make heavy use of lists of information, which will be built
3853 % up and taken apart by the following macros; they are
3854 % adapted from \thetexbook, pp.\,378--379, which discusses
3855 % their use in more detail.
3856 %
3857 % These macros consume a large amount of the run-time of this code.
3858 % We intend to replace them in a future version, and in anticipation
3859 % of doing so have defined their interface in such a way that it is
3860 % not sensitive to details of the underlying code.
3861 %
3862 % \begin{macro}{\list@create}
3863 % The \cs{list@create} macro creates a new list. In this version of
3864 % \Ledmac{} this macro doesn't do anything beyond initializing an empty
3865 % list macro, but in future versions it may do more.
3866 % \begin{macrocode}
3867 \newcommand*{\list@create}[1]{\global\let#1=\empty}
3868 % \end{macrocode}
3869 % \end{macro}
3870 %
3871 % \begin{macro}{\list@clear}
3872 % The \cs{list@clear} macro just initializes a list to the empty list;
3873 % in this version of \Ledmac{} it is no different from
3874 % \cs{list@create}.
3875 % \begin{macrocode}
3876 \newcommand*{\list@clear}[1]{\global\let#1=\empty}
3877 % \end{macrocode}
3878 % \end{macro}
3879 %
3880 % \begin{macro}{\xright@appenditem}
3881 % \begin{macro}{\@toksa}
3882 % \begin{macro}{\@toksb}
3883 % \cs{xright@appenditem} expands an item and appends it to the right
3884 % end of a list macro. We want the expansion because we'll often
3885 % be using this to store the current value of a counter.
3886 % It creates global control sequences, like \cs{xdef}, and uses two
3887 % temporary token-list registers, \cs{@toksa} and \cs{@toksb}.
3888 % \begin{macrocode}
3889 \newtoks\@toksa \newtoks\@toksb
3890 \global\@toksa={\\}
3891 \long\def\xright@appenditem#1\to#2{%
3892 \global\@toksb=\expandafter{#2}%
3893 \xdef#2{\the\@toksb\the\@toksa\expandafter{#1}}%
3894 \global\@toksb={}}
3895 % \end{macrocode}
3896 % \end{macro}
3897 % \end{macro}
3898 % \end{macro}
3899 %
3900 % \begin{macro}{\xleft@appenditem}
3901 % \cs{xleft@appenditem} expands an item and appends it to the left
3902 % end of a list macro; it is otherwise identical to
3903 % \cs{xright@appenditem}.
3904 % \begin{macrocode}
3905 \long\def\xleft@appenditem#1\to#2{%
3906 \global\@toksb=\expandafter{#2}%
3907 \xdef#2{\the\@toksa\expandafter{#1}\the\@toksb}%
3908 \global\@toksb={}}
3909 % \end{macrocode}
3910 % \end{macro}
3911 %
3912 % \begin{macro}{\gl@p}
3913 % The \cs{gl@p} macro removes the leftmost
3914 % item from a list and places it in a
3915 % control sequence. You say \verb"\gl@p\l\to\z"
3916 % (where \verb"\l" is the list macro, and
3917 % \verb"\z" receives the left item). \verb"\l" is assumed nonempty: say
3918 % \verb"\ifx\l\empty" to test for an empty \verb"\l". The control
3919 % sequences created by \cs{gl@p} are all global.
3920 % \begin{macrocode}
3921 \def\gl@p#1\to#2{\expandafter\gl@poff#1\gl@poff#1#2}
3922 \long\def\gl@poff\\#1#2\gl@poff#3#4{\gdef#4{#1}\gdef#3{#2}}
3923
3924 % \end{macrocode}
3925 % \end{macro}
3926 %
3927 % \subsection{Line-number counters and lists}
3928 %
3929 % Footnote references using line numbers rather than symbols can't be
3930 % generated in one pass, because we don't know the line numbers till we
3931 % ship out the pages. It would be possible if footnotes were never keyed
3932 % to more than one line; but some footnotes gloss passages that may run
3933 % for several lines, and they must be tied to the first line of the
3934 % passage glossed. And even one-line passages require two passes if we
3935 % want line-per-page numbering rather than line-per-section numbering.
3936 %
3937 % So we run LaTeX over the text several times, and each time save
3938 % information about page and line numbers in a `line-list file' to
3939 % be used during the next pass. At the start of each section---whenever
3940 % \cs{beginnumbering} is executed---the line-list file
3941 % for that section
3942 % is read, and the information from it is encoded into a few list
3943 % macros.
3944 %
3945 % We need first to define the different line numbers that are involved
3946 % in these macros, and the associated counters.
3947 %
3948 % \begin{macro}{\line@num}
3949 % The count \cs{line@num} stores the line number that's used in
3950 % marginal line numbering and in notes: counting either from the start of
3951 % the page or from the start of the section, depending on your
3952 % choice for this section. This may be qualified by \cs{subline@num}.
3953 % \begin{macrocode}
3954 \newcount\line@num
3955 % \end{macrocode}
3956 % \end{macro}
3957 %
3958 % \begin{macro}{\subline@num}
3959 % The count \cs{subline@num} stores
3960 % a sub-line number that qualifies \cs{line@num}. For example,
3961 % line $10$ might have sub-line numbers $1$, $2$ and $3$, which might be
3962 % printed as lines $10.1$, $10.2$, $10.3$.
3963 % \begin{macrocode}
3964 \newcount\subline@num
3965 % \end{macrocode}
3966 % \end{macro}
3967 %
3968 % \begin{macro}{\ifsublines@}
3969 % \begin{macro}{\sublines@true}
3970 % \begin{macro}{\sublines@false}
3971 % We maintain an associated flag, \cs{ifsublines@},
3972 % to tell us whether we're within
3973 % a sub-line range or not.
3974 %
3975 % You may wonder why we don't just use the value of \cs{subline@num}
3976 % to determine this---treating anything greater than $0$ as an
3977 % indication that sub-lineation is on. We need a separate flag because
3978 % sub-lineation can be used together with line-number locking in odd
3979 % ways: several pieces of a logical line might be interrupted by
3980 % pieces of sub-lineated text, and those sub-line numbers should not
3981 % return to zero until the next change in the major line number. This
3982 % is common in the typesetting of English Renaissance verse
3983 % drama\index{Middleton, Thomas}, in which stage directions are
3984 % given sub-line numbers: a single line of verse may be
3985 % interrupted by several stage directions.
3986 % \begin{macrocode}
3987 \newif\ifsublines@
3988 % \end{macrocode}
3989 % \end{macro}
3990 % \end{macro}
3991 % \end{macro}
3992 %
3993 % \begin{macro}{\absline@num}
3994 % The count \cs{absline@num} stores the
3995 % absolute number of lines since the start
3996 % of the section: that is, the number we've actually printed, no matter
3997 % what numbers we attached to them.
3998 % This value is never printed on an output page, though
3999 % \cs{line@num} will often be equal to it. It is used internally to
4000 % keep track of where notes are to appear and where new
4001 % pages start: using this value rather than \cs{line@num} is a lot
4002 % simpler, because it doesn't depend on the lineation system in use.
4003 % \begin{macrocode}
4004 \newcount\absline@num
4005 % \end{macrocode}
4006 % \end{macro}
4007 %
4008 % We'll be calling \cs{absline@num} numbers `absolute' numbers, and
4009 % \cs{line@num} and \cs{subline@num} numbers `visible' numbers.
4010 %
4011 % \begin{macro}{\@lock}
4012 % \begin{macro}{\sub@lock}
4013 % The counts \cs{@lock} and \cs{sub@lock}
4014 % tell us the state of line-number
4015 % and sub-line-number locking. $0$ means we're not within a locked set of
4016 % lines; $1$ means we're at the first line in the set; $2$, at some
4017 % intermediate line; and $3$, at the last line.
4018 % \begin{macrocode}
4019 \newcount\@lock
4020 \newcount\sub@lock
4021 % \end{macrocode}
4022 % \end{macro}
4023 % \end{macro}
4024 %
4025 % \begin{macro}{\line@list}
4026 % \begin{macro}{\insertlines@list}
4027 % \begin{macro}{\actionlines@list}
4028 % \begin{macro}{\actions@list}
4029 % Now we can define the list macros that will be created from the
4030 % line-list file. We will maintain the following lists:
4031 % \begin{itemize}\addtolength{\itemsep}{-1ex}
4032 % \item \cs{line@list}: the page and line numbers for every
4033 % lemma marked by \cs{edtext}.
4034 % There are seven pieces of information, separated by vertical bars:
4035 % \phantomsection\label{linenumbers}
4036 % \begin{enumerate}\addtolength{\itemsep}{-1ex}
4037 % \item the starting page,
4038 % \item line, and
4039 % \item sub-line numbers, followed by the
4040 % \item ending page,
4041 % \item line, and
4042 % \item sub-line numbers, and then the
4043 % \item font specifier for the lemma.
4044 % \end{enumerate}
4045 %
4046 %
4047 % These line numbers are all visible numbers.
4048 % The font specifier is a set of four codes for font encoding,
4049 % family, series, and shape, separated by \verb"/" characters.
4050 % Thus a lemma that
4051 % started on page $23$, line $35$ and
4052 % went on until page $24$, line $3$
4053 % (with no sub-line numbering), and was typeset in a normal roman font
4054 % would have a line list entry like this: \\
4055 % \verb"23|35|0|24|3|0|OT1/cmr/m/n".
4056 %
4057 % There is one item in this list for every lemma marked by
4058 % \cs{edtext}, even if there are several notes to that lemma, or no
4059 % notes at all. \cs{edtext} reads the data in this list, making it
4060 % available for use in the text of notes.
4061 %
4062 % \item \cs{insertlines@list}: the line numbers of lines that have
4063 % footnotes or other insertions.
4064 % These are the absolute numbers where the corresponding
4065 % lemmas begin. This list contains one entry for every footnote in the
4066 % section; one lemma may contribute no footnotes or many footnotes.
4067 % This list is used by \cs{add@inserts} within \cs{do@line}, to tell
4068 % it where to insert notes.
4069 %
4070 % \item \cs{actionlines@list}: a list of absolute line numbers at
4071 % which we are to perform special
4072 % actions; these actions are specified by the \cs{actions@list} list
4073 % defined below.
4074 %
4075 % \item \cs{actions@list}: action codes corresponding to the line
4076 % numbers in \cs{actionlines@list}. These codes tell \Ledmac{} what action
4077 % it's supposed to take at each of these lines. One action, the
4078 % page-start action, is generated behind the scenes by \Ledmac{} itself;
4079 % the others, for specifying sub-lineation, line-number locking, and
4080 % line-number alteration, are generated only by explicit commands in
4081 % your input file. The page-start and line-number-alteration actions
4082 % require arguments, to specify the new values for the page or line
4083 % numbers; instead of storing those arguments in another list, we have
4084 % chosen the action-code values so that they can encode both the action
4085 % and the argument in these cases. Action codes greater than $-1000$
4086 % are page-start actions, and the code value is the page number; action
4087 % codes less than $-5000$ specify line numbers, and the code value is
4088 % a transformed version of the line number; action codes between these
4089 % two values specify other actions which require no argument.
4090 %
4091 % Here is the full list of action codes and their meanings:
4092 %
4093 % Any number greater than $-1000$ is a page-start action: the line number
4094 % associated with it is the first line on a page, and the action number is
4095 % the page number. (The cutoff of $-1000$ is chosen because negative
4096 % page-number values are used by some macro packages; we assume that
4097 % page-number values less than $-1000$ are not common.)
4098 % Page-start action codes are added to the list by
4099 % the \cs{page@action} macro, which is (indirectly) triggered by the
4100 % workings of the \cs{page@start} macro; that macro should always be
4101 % called in the output routine, just before the page contents are
4102 % assembled. \Ledmac{} calls it in \cs{pagecontents}.
4103 %
4104 % The action code $-1001$ specifies the start of sub-lineation: meaning
4105 % that, starting with the next line, we should be advancing
4106 % \cs{subline@num} at each start-of-line command, rather than
4107 % \cs{line@num}.
4108 %
4109 % The action code $-1002$ specifies the end of sub-lineation. At the
4110 % next start-of-line, we should clear the sub-line counter and start
4111 % advancing the line number. The action codes for starting and ending
4112 % sub-lineation are added to the list by the \cs{sub@action} macro, as
4113 % called to implement the \cs{startsub} and \cs{endsub} macros.
4114 %
4115 % The action code $-1003$ specifies the start of line number locking.
4116 % After the number for the current line is computed, it will remain
4117 % at that value through the next line that has an action code to end
4118 % locking.
4119 %
4120 % The action code $-1004$ specifies the end of line number locking.
4121 %
4122 % The action code $-1005$ specifies the start of sub-line number locking.
4123 % After the number for the current sub-line is computed, it will remain
4124 % at that value through the next sub-line that has an action code to end
4125 % locking.
4126 %
4127 % The action code $-1006$ specifies the end of sub-line number locking.
4128 %
4129 % The four action codes for line and sub-line number locking are added
4130 % to the list by the \cs{do@lockon} and \cs{do@lockoff} macros, as called
4131 % to implement the \cs{startlock} and \cs{endlock} macros.
4132 %
4133 % An action code of $-5000$ or less sets the current visible line
4134 % number (either the line number or the sub-line number, whichever is
4135 % currently being advanced) to a specific positive value. The value of
4136 % the code is $-(5000+n)$, where $n$ is the value (always $\ge 0$)
4137 % assigned to the current line number. Action codes of this type are
4138 % added to the list by the \cs{set@line@action} macro, as called to
4139 % implement the \cs{advanceline} and \cs{setline} macros: this action only
4140 % occurs when the user has specified some change to the line numbers
4141 % using those macros. Normally \Ledmac{} computes the visible line numbers
4142 % from the absolute line numbers with reference to the other
4143 % action codes and the settings they invoke; it doesn't require an
4144 % entry in the action-code list for every line.
4145 %
4146 % Here are the commands to create these lists:
4147 %
4148 % \begin{macrocode}
4149 \list@create{\line@list}
4150 \list@create{\insertlines@list}
4151 \list@create{\actionlines@list}
4152 \list@create{\actions@list}
4153
4154 % \end{macrocode}
4155 %
4156 % \end{itemize}
4157 % \end{macro}
4158 % \end{macro}
4159 % \end{macro}
4160 % \end{macro}
4161 %
4162 % \begin{macro}{\page@num}
4163 % \begin{macro}{\endpage@num}
4164 % \begin{macro}{\endline@num}
4165 % \begin{macro}{\endsubline@num}
4166 % We'll need some counts while we read the line-list,
4167 % for the page number and the ending page, line, and sub-line numbers.
4168 % Some of these will be used again later on, when we are acting on the
4169 % data in our list macros.
4170 % \begin{macrocode}
4171 \newcount\page@num
4172 \newcount\endpage@num
4173 \newcount\endline@num
4174 \newcount\endsubline@num
4175 % \end{macrocode}
4176 % \end{macro}
4177 % \end{macro}
4178 % \end{macro}
4179 % \end{macro}
4180 %
4181 % \begin{macro}{\ifnoteschanged@}
4182 % \begin{macro}{\noteschanged@true}
4183 % \begin{macro}{\noteschanged@false}
4184 % If the number of footnotes in a section is different from what it was
4185 % during the last run, or if this is the very first time you've run
4186 % LaTeX,
4187 % on this file, the information from the line-list used to place the
4188 % notes will be wrong, and some notes will probably be misplaced.
4189 % When this happens, we prefer
4190 % to give a single error message for the whole section rather than
4191 % messages at every point where we notice the problem, because
4192 % we don't really know where in the section notes were added or removed,
4193 % and the solution in any case is simply to run LaTeX two more times;
4194 % there's no fix needed to the document. The
4195 % \cs{ifnoteschanged@} flag is set if such
4196 % a change in the number of notes is discovered at any point.
4197 % \begin{macrocode}
4198 \newif\ifnoteschanged@
4199 % \end{macrocode}
4200 % \end{macro}
4201 % \end{macro}
4202 % \end{macro}
4203 %
4204 % \subsection{Reading the line-list file}
4205 %
4206 %
4207 % \begin{macro}{\read@linelist}
4208 % \cs{read@linelist}\marg{file} is the control sequence
4209 % that's called by \cs{beginnumbering}
4210 % (via \cs{line@list@stuff}) to open and process a
4211 % line-list file; its argument is the name of the file.
4212 % \phantomsection\label{readlinelist}
4213 % \begin{macrocode}
4214 \newread\@inputcheck
4215 \newcommand*{\read@linelist}[1]{%
4216 \list@clearing@reg
4217 % \end{macrocode}
4218 %
4219 % When the file is there we start a new group and make some special
4220 % definitions we'll need to process it: it's a sequence of \TeX\
4221 % commands, but they require a few special settings. We make [ and
4222 % ] become grouping characters: they're used that way in the
4223 % line-list file, because we need to write them out one at a time
4224 % rather than in balanced pairs, and it's easier to just use
4225 % something other than real braces. @ must become a letter, since
4226 % this is run in the ordinary LaTeX context. We ignore carriage
4227 % returns, since if we're in horizontal mode they can get
4228 % interpreted as spaces to be printed.
4229 %
4230 %
4231 % Our line, page, and line-locking counters were already zeroed
4232 % by \cs{line@list@stuff} if this is being called from within
4233 % \cs{beginnumbering}; sub-lineation will be turned off as well
4234 % in that case. On the other hand,
4235 % if this is being called from \cs{resumenumbering}, those things
4236 % should still have the values they had when \cs{pausenumbering}
4237 % was executed.
4238 %
4239 % If the file is not there, we print an informative message.
4240 %
4241 % Now, after these preliminaries, we start interpreting the file.
4242 %
4243 %
4244 % \begin{macrocode}
4245 \get@linelistfile{#1}%
4246 \endgroup
4247
4248 % \end{macrocode}
4249 %
4250 % When the reading is done, we're all through with the
4251 % line-list file. All the information we needed
4252 % from it will now be encoded in our list macros.
4253 %
4254 % Finally, we
4255 % initialize the \cs{next@actionline} and \cs{next@action} macros,
4256 % which specify where and what the next action to be taken is.
4257 % \begin{macrocode}
4258 \global\page@num=\m@ne
4259 \ifx\actionlines@list\empty
4260 \gdef\next@actionline{1000000}%
4261 \else
4262 \gl@p\actionlines@list\to\next@actionline
4263 \gl@p\actions@list\to\next@action
4264 \fi}
4265
4266 % \end{macrocode}
4267 % \end{macro}
4268 %
4269 % \begin{PW}
4270 % \begin{macro}{\list@clearing@reg}
4271 % Clears the lists for \cs{read@linelist}
4272 % \changes{v0.7}{2005/02/22}{Added \cs{list@clearing@reg}}
4273 % \begin{macrocode}
4274 \newcommand*{\list@clearing@reg}{%
4275 \list@clear{\line@list}%
4276 \list@clear{\insertlines@list}%
4277 \list@clear{\actionlines@list}%
4278 \list@clear{\actions@list}}
4279 % \end{macrocode}
4280 % \end{macro}
4281 %
4282 % \begin{macro}{\get@linelistfile}
4283 % \Ledmac{} can take advantage of the LaTeX `safe file input' macros
4284 % to get the line-list file.
4285 % \changes{v0.7}{2005/02/22}{Added \cs{get@linelistfile}}
4286 % \begin{macrocode}
4287 \newcommand*{\get@linelistfile}[1]{%
4288 \InputIfFileExists{#1}{%
4289 \global\noteschanged@false
4290 \begingroup
4291 \catcode`\[=1 \catcode`\]=2
4292 \makeatletter \catcode`\^^M=9}{%
4293 \led@warn@NoLineFile{#1}%
4294 \global\noteschanged@true
4295 \begingroup}%
4296 }
4297
4298 % \end{macrocode}
4299 % \end{macro}
4300 % \end{PW}
4301 %
4302 % This version of \cs{read@linelist} creates list macros
4303 % containing data for the entire section, so they could get rather
4304 % large. It would be no more difficult to read the line-list file
4305 % incrementally rather than all at once: we could read, at the
4306 % start of each paragraph, only the commands relating to that
4307 % paragraph. But this would require that we
4308 % have two line-lists open at once, one for reading, one for
4309 % writing, and on systems without version numbers we'd have to do
4310 % some file renaming outside of LaTeX for that to work. We've
4311 % retained this slower approach to avoid that sort of hacking
4312 % about, but have provided the \cs{pausenumbering} and
4313 % \cs{resumenumbering} macros to help you if you run into
4314 % macro memory limitations (see p.\,\pageref{pause} above).
4315 %
4316 % \subsection{Commands within the line-list file}
4317 %
4318 % This section defines the commands that can appear within a
4319 % line-list file. They all have very short names because we are
4320 % likely to be writing very large numbers of them out. One macro,
4321 % \cs{@l}, is especially short, since it will be written to the
4322 % line-list file once for every line of text in a numbered section.
4323 % (Another of these commands, \cs{@lab}, will be introduced in a
4324 % later section, among the cross-referencing commands it is
4325 % associated with.)
4326 %
4327 % When these commands modify the various page and line counters,
4328 % they deliberately do not say \cs{global}. This is because we
4329 % want them to affect only the counter values within the current
4330 % group when nested calls of \cs{@ref} occur. (The code assumes
4331 % throughout that the value of \cs{globaldefs} is zero.)
4332 %
4333 % The macros with \verb"action" in their names contain all the code
4334 % that modifies the action-code list: again, this is so that they
4335 % can be turned off easily for nested calls of \cs{@ref}.
4336 %
4337 % \begin{macro}{\@l}
4338 % \begin{macro}{\@l@reg}
4339 % \cs{@l} does everything related to the start of a
4340 % new line of numbered text.
4341 %
4342 % \begin{PW}
4343 % In order to get the \verb?\setlinenum? to work I had to slip in some new
4344 % code at the start of the macro, to get the timing of the actions
4345 % correct. The problem was that my original naive implementation
4346 % of \verb?\setlinenum? had a unfortunate tendency to change the
4347 % number of the last line of the \emph{preceding} paragraph.
4348 % The new code is sort of based on the page number handling and
4349 % \verb?\setline? It seems
4350 % that a lot of fiddling with the line number internals is required.
4351 %
4352 % In November 2004 in order to accurately determine page numbers I added
4353 % these to the macro. It is now: \\
4354 % \cs{@l}\marg{page counter number}\marg{printed page number} \\
4355 % I don't (yet) use the printed number (i.e., the \verb?\thepage?) but
4356 % it may come in handy later. The macro \cs{fix@page} checks if a new
4357 % page has started.
4358 %
4359 % \end{PW}
4360 % \changes{v0.3}{2004/02/14}{Added a bunch of code to \cs{@l} for handling
4361 % \cs{setlinenum}}
4362 % \changes{v0.6}{2004/11/16}{Extended \cs{@l} to include the page number}
4363 % \changes{v0.6}{2004/11/16}{Added \cs{fix@page} to \cs{@l}}
4364 % \changes{v0.7}{2005/02/22}{Added \cs{@l@reg}}
4365 % \begin{macrocode}
4366 \newcommand{\@l}[2]{%
4367 \fix@page{#1}%
4368 \@l@reg}
4369 \newcommand*{\@l@reg}{%
4370 \ifx\l@dchset@num\relax \else
4371 \advance\absline@num \@ne
4372 \set@line@action
4373 \let\l@dchset@num=\relax
4374 \advance\absline@num \m@ne
4375 \advance\line@num \m@ne
4376 \fi
4377 % \end{macrocode}
4378 % \begin{PW}
4379 % Now we are back to the original code.
4380 % \end{PW}
4381 %
4382 % First increment the absolute line-number, and perform
4383 % deferred actions relating to page starts and sub-lines.
4384 % \begin{macrocode}
4385 \advance\absline@num \@ne
4386 \ifx\next@page@num\relax \else
4387 \page@action
4388 \let\next@page@num=\relax
4389 \fi
4390 \ifx\sub@change\relax \else
4391 \ifnum\sub@change>\z@
4392 \sublines@true
4393 \else
4394 \sublines@false
4395 \fi
4396 \sub@action
4397 \let\sub@change=\relax
4398 \fi
4399 % \end{macrocode}
4400 %
4401 % Fix the lock counters, if necessary. A value of $1$ is advanced to
4402 % $2$; $3$ advances to $0$; other values are unchanged.
4403 % \begin{macrocode}
4404 \ifcase\@lock
4405 \or
4406 \@lock \tw@
4407 \or \or
4408 \@lock \z@
4409 \fi
4410 \ifcase\sub@lock
4411 \or
4412 \sub@lock \tw@
4413 \or \or
4414 \sub@lock \z@
4415 \fi
4416 % \end{macrocode}
4417 %
4418 % Now advance the visible line number, unless it's been locked.
4419 % \begin{macrocode}
4420 \ifsublines@
4421 \ifnum\sub@lock<\tw@
4422 \advance\subline@num \@ne
4423 \fi
4424 \else
4425 \ifnum\@lock<\tw@
4426 \advance\line@num \@ne \subline@num \z@
4427 \fi
4428 \fi}
4429
4430 % \end{macrocode}
4431 % \end{macro}
4432 % \end{macro}
4433 %
4434 % \begin{macro}{\@page}
4435 % \cs{@page}\marg{num} marks the start of a new output page; its argument is
4436 % the number of that page.
4437 %
4438 % First we reset the visible line numbers, if we're numbering by page,
4439 % and store the page number itself in a count.
4440 % \begin{macrocode}
4441 \newcommand*{\@page}[1]{%
4442 \ifbypage@
4443 \line@num \z@ \subline@num \z@
4444 \fi
4445 \page@num=#1\relax
4446 % \end{macrocode}
4447 %
4448 % And we set a flag that tells \cs{@l} that a new page number is
4449 % to be set, because other associated actions shouldn't occur until the
4450 % next line-start occurs.
4451 % \begin{macrocode}
4452 \def\next@page@num{#1}}
4453
4454 % \end{macrocode}
4455 % \end{macro}
4456 %
4457 % \begin{macro}{\last@page@num}
4458 % \begin{macro}{\fix@page}
4459 % \begin{PW}
4460 % \cs{fix@page} basically replaces \cs{@page}. It determines whether or not
4461 % a new page has been started, based on the page values held by \cs{@l}.
4462 % \end{PW}
4463 % \changes{v0.6}{2004/11/16}{Added \cs{last@page@num} and \cs{fix@page}}
4464 % \begin{macrocode}
4465 \newcount\last@page@num
4466 \last@page@num=-10000
4467 \newcommand*{\fix@page}[1]{%
4468 \ifnum #1=\last@page@num
4469 \else
4470 \ifbypage@
4471 \line@num=\z@ \subline@num=\z@
4472 \fi
4473 \page@num=#1\relax
4474 \last@page@num=#1\relax
4475 \def\next@page@num{#1}%
4476 \fi}
4477
4478 % \end{macrocode}
4479 % \end{macro}
4480 % \end{macro}
4481 %
4482 % \begin{macro}{\@pend}
4483 % \begin{macro}{\@pendR}
4484 % \begin{macro}{\@lopL}
4485 % \begin{macro}{\@lopR}
4486 % \begin{PW}
4487 % These don't do anything at this point, but will have been added to the
4488 % auxiliary file(s) if the \Lpack{ledpar} package has been used. They
4489 % are just here to stop \Lpack{\ledmac} from moaning if the \Lpack{ledpar}
4490 % is used for one run and then not for the following one.
4491 % \end{PW}
4492 % \changes{v0.6}{2004/11/16}{Added \cs{@pend},\cs{@pendR}, \cs{@lopL} and
4493 % \cs{@lopR} in anticipation of parallel processing}
4494 % \begin{macrocode}
4495 \newcommand*{\@pend}[1]{}
4496 \newcommand*{\@pendR}[1]{}
4497 \newcommand*{\@lopL}[1]{}
4498 \newcommand*{\@lopR}[1]{}
4499
4500 % \end{macrocode}
4501 % \end{macro}
4502 % \end{macro}
4503 % \end{macro}
4504 % \end{macro}
4505 %
4506 % \begin{macro}{\sub@on}
4507 % \begin{macro}{\sub@off}
4508 % The \cs{sub@on} and \cs{sub@off} macros
4509 % turn sub-lineation on and off\/: but not directly, since such changes
4510 % don't really take effect until the next line of text. Instead
4511 % they set a flag that notifies \cs{@l} of the necessary action.
4512 % \begin{macrocode}
4513 \newcommand*{\sub@on}{\ifsublines@
4514 \let\sub@change=\relax
4515 \else
4516 \def\sub@change{1}%
4517 \fi}
4518 \newcommand*{\sub@off}{\ifsublines@
4519 \def\sub@change{-1}%
4520 \else
4521 \let\sub@change=\relax
4522 \fi}
4523
4524 % \end{macrocode}
4525 % \end{macro}
4526 % \end{macro}
4527 %
4528 % \begin{macro}{\@adv}
4529 % The \cs{@adv}\marg{num} macro advances
4530 % the current visible line number by the amount specified as
4531 % its argument. This is used to implement \cs{advanceline}.
4532 % \begin{macrocode}
4533 \newcommand*{\@adv}[1]{\ifsublines@
4534 \advance\subline@num by #1\relax
4535 \ifnum\subline@num<\z@
4536 \led@warn@BadAdvancelineSubline
4537 \subline@num \z@
4538 \fi
4539 \else
4540 \advance\line@num by #1\relax
4541 \ifnum\line@num<\z@
4542 \led@warn@BadAdvancelineLine
4543 \line@num \z@
4544 \fi
4545 \fi
4546 \set@line@action}
4547
4548 % \end{macrocode}
4549 % \end{macro}
4550 %
4551 % \begin{macro}{\@set}
4552 % The \cs{@set}\marg{num} macro sets
4553 % the current visible line number to the value specified as
4554 % its argument. This is used to implement \cs{setline}.
4555 % \begin{macrocode}
4556 \newcommand*{\@set}[1]{\ifsublines@
4557 \subline@num=#1\relax
4558 \else
4559 \line@num=#1\relax
4560 \fi
4561 \set@line@action}
4562
4563 % \end{macrocode}
4564 % \end{macro}
4565 %
4566 % \begin{PW}
4567 % \begin{macro}{\l@d@set}
4568 % \begin{macro}{\l@dchset@num}
4569 % The \cs{l@d@set}\marg{num} macro sets
4570 % the line number for the next \verb?\pstart...? to the value specified as
4571 % its argument. This is used to implement \cs{setlinenum}.
4572 %
4573 % \verb?\l@dchset@num? is a flag to the \verb?\@l? macro. If it is not
4574 % \verb?\relax? then a linenumber change is to be done.
4575 % \begin{macrocode}
4576 \newcommand*{\l@d@set}[1]{%
4577 \line@num=#1\relax
4578 \advance\line@num \@ne
4579 \def\l@dchset@num{#1}}
4580 \let\l@dchset@num\relax
4581
4582 % \end{macrocode}
4583 % \end{macro}
4584 % \end{macro}
4585 % \end{PW}
4586 %
4587 % \begin{macro}{\page@action}
4588 % \cs{page@action}
4589 % adds an entry to the action-code list to change the page number.
4590 % \begin{macrocode}
4591 \newcommand*{\page@action}{%
4592 \xright@appenditem{\the\absline@num}\to\actionlines@list
4593 \xright@appenditem{\next@page@num}\to\actions@list}
4594 % \end{macrocode}
4595 % \end{macro}
4596 %
4597 % \begin{macro}{\set@line@action}
4598 % \cs{set@line@action} adds an entry to the action-code
4599 % list to change the visible line number.
4600 % \begin{macrocode}
4601 \newcommand*{\set@line@action}{%
4602 \xright@appenditem{\the\absline@num}\to\actionlines@list
4603 \ifsublines@
4604 \@l@dtempcnta=-\subline@num
4605 \else
4606 \@l@dtempcnta=-\line@num
4607 \fi
4608 \advance\@l@dtempcnta by -5000
4609 \xright@appenditem{\the\@l@dtempcnta}\to\actions@list}
4610 % \end{macrocode}
4611 % \end{macro}
4612 %
4613 % \begin{macro}{\sub@action}
4614 % \cs{sub@action}
4615 % adds an entry to the action-code list to turn sub-lineation on or
4616 % off, according to the current value of the \cs{ifsublines@} flag.
4617 % \begin{macrocode}
4618 \newcommand*{\sub@action}{%
4619 \xright@appenditem{\the\absline@num}\to\actionlines@list
4620 \ifsublines@
4621 \xright@appenditem{-1001}\to\actions@list
4622 \else
4623 \xright@appenditem{-1002}\to\actions@list
4624 \fi}
4625 % \end{macrocode}
4626 % \end{macro}
4627 %
4628 % \begin{macro}{\lock@on}
4629 % \begin{macro}{\do@lockon}
4630 % \begin{macro}{\do@lockonL}
4631 % \cs{lock@on}
4632 % adds an entry to the action-code list to turn line number
4633 % locking on. The current setting of the sub-lineation flag tells us
4634 % whether this applies to line numbers or sub-line numbers.
4635 %
4636 % Adding commands to the action list is slow, and it's very often the
4637 % case that a lock-on command is immediately followed by a lock-off
4638 % command in the line-list file, and therefore really does nothing.
4639 % We use a look-ahead scheme here to detect such pairs, and add nothing
4640 % to the line-list in those cases.
4641 % \begin{macrocode}
4642 \newcommand*{\lock@on}{\futurelet\next\do@lockon}
4643 \newcommand*{\do@lockon}{%
4644 \ifx\next\lock@off
4645 \global\let\lock@off=\skip@lockoff
4646 \else
4647 \do@lockonL
4648 \fi}
4649 \newcommand*{\do@lockonL}{%
4650 \xright@appenditem{\the\absline@num}\to\actionlines@list
4651 \ifsublines@
4652 \xright@appenditem{-1005}\to\actions@list
4653 \ifnum\sub@lock=\z@
4654 \sub@lock \@ne
4655 \else
4656 \ifnum\sub@lock=\thr@@
4657 \sub@lock \@ne
4658 \fi
4659 \fi
4660 \else
4661 \xright@appenditem{-1003}\to\actions@list
4662 \ifnum\@lock=\z@
4663 \@lock \@ne
4664 \else
4665 \ifnum\@lock=\thr@@
4666 \@lock \@ne
4667 \fi
4668 \fi
4669 \fi}
4670
4671 % \end{macrocode}
4672 % \end{macro}
4673 % \end{macro}
4674 % \end{macro}
4675 %
4676 % \begin{macro}{\lock@off}
4677 % \begin{macro}{\do@lockoff}
4678 % \begin{macro}{\do@lockoffL}
4679 % \begin{macro}{\skip@lockoff}
4680 % \cs{lock@off} adds an entry to the action-code list
4681 % to turn line number locking off.
4682 % \begin{macrocode}
4683 \newcommand*{\do@lockoffL}{%
4684 \xright@appenditem{\the\absline@num}\to\actionlines@list
4685 \ifsublines@
4686 \xright@appenditem{-1006}\to\actions@list
4687 \ifnum\sub@lock=\tw@
4688 \sub@lock \thr@@
4689 \else
4690 \sub@lock \z@
4691 \fi
4692 \else
4693 \xright@appenditem{-1004}\to\actions@list
4694 \ifnum\@lock=\tw@
4695 \@lock \thr@@
4696 \else
4697 \@lock \z@
4698 \fi
4699 \fi}
4700 \newcommand*{\do@lockoff}{\do@lockoffL}
4701 \newcommand*{\skip@lockoff}{\global\let\lock@off=\do@lockoff}
4702 \global\let\lock@off=\do@lockoff
4703
4704 % \end{macrocode}
4705 % \end{macro}
4706 % \end{macro}
4707 % \end{macro}
4708 % \end{macro}
4709 %
4710 % \begin{PW}
4711 % \begin{macro}{\n@num}
4712 % \begin{macro}{\n@num@reg}
4713 % This macro implements the \cs{skipnumbering} command. It uses
4714 % a new action code, namely 1007.
4715 % \changes{v0.7}{2005/02/22}{Added \cs{n@num}}
4716 % \begin{macrocode}
4717 \newcommand*{\n@num}{\n@num@reg}
4718 \newcommand*{\n@num@reg}{%
4719 \xright@appenditem{\the\absline@num}\to\actionlines@list
4720 \xright@appenditem{-1007}\to\actions@list}
4721
4722 % \end{macrocode}
4723 % \end{macro}
4724 % \end{macro}
4725 % \end{PW}
4726 %
4727 % \begin{macro}{\@ref}
4728 % \begin{macro}{\insert@count}
4729 % \cs{@ref}
4730 % marks the start of a passage, for creation of a footnote reference.
4731 % It takes two arguments:
4732 % \begin{itemize}\addtolength{\itemsep}{-1ex}
4733 % \item \verb"#1", the number of entries to add to \cs{insertlines@list}
4734 % for this reference. \SpecialMainIndex{\insert@count}
4735 % This value, here and within \cs{edtext},
4736 % which computes it and writes it to the line-list file,
4737 % will be stored in the count \cs{insert@count}.
4738 % \begin{macrocode}
4739 \newcount\insert@count
4740 % \end{macrocode}
4741 %
4742 % \item \verb"#2", a sequence of other line-list-file commands, executed to
4743 % determine the ending line-number. (This may also include other
4744 % \cs{@ref} commands, corresponding to uses of \cs{edtext}
4745 % within the first argument of another instance of \cs{edtext}.)
4746 % \end{itemize}
4747 %
4748 % \begin{macro}{\dummy@ref}
4749 % When nesting of \cs{@ref} commands does occur, it's necessary to
4750 % temporarily redefine \cs{@ref} within \cs{@ref}, so that we're only
4751 % doing one of these at a time.
4752 % \begin{macrocode}
4753 \newcommand*{\dummy@ref}[2]{#2}
4754 % \end{macrocode}
4755 % \end{macro}
4756 %
4757 % \begin{macro}{\@ref@reg}
4758 % The first thing \cs{@ref} (i.e. \cs{@ref@reg}) itself does is to add
4759 % the specified number
4760 % of items to the \cs{insertlines@list} list.
4761 % \changes{v0.7}{2005/02/22}{Added \cs{@ref@reg}}
4762 % \begin{macrocode}
4763 \newcommand*{\@ref}[2]{%
4764 \@ref@reg{#1}{#2}}
4765 \newcommand*{\@ref@reg}[2]{%
4766 \global\insert@count=#1\relax
4767 \loop\ifnum\insert@count>\z@
4768 \xright@appenditem{\the\absline@num}\to\insertlines@list
4769 \global\advance\insert@count \m@ne
4770 \repeat
4771 % \end{macrocode}
4772 %
4773 % Next, process the second argument to determine the page
4774 % and line numbers for the end of this lemma.
4775 % We temporarily equate \cs{@ref} to a different macro that just executes
4776 % its argument, so that nested \cs{@ref} commands are just skipped
4777 % this time. Some other macros need to be temporarily redefined to
4778 % suppress their action.
4779 % \begin{macrocode}
4780 \begingroup
4781 \let\@ref=\dummy@ref
4782 \let\page@action=\relax
4783 \let\sub@action=\relax
4784 \let\set@line@action=\relax
4785 \let\@lab=\relax
4786 #2
4787 \global\endpage@num=\page@num
4788 \global\endline@num=\line@num
4789 \global\endsubline@num=\subline@num
4790 \endgroup
4791 % \end{macrocode}
4792 %
4793 % Now store all the information about the location of the lemma's
4794 % start and end in \cs{line@list}.
4795 % \begin{macrocode}
4796 \xright@appenditem%
4797 {\the\page@num|\the\line@num|%
4798 \ifsublines@ \the\subline@num \else 0\fi|%
4799 \the\endpage@num|\the\endline@num|%
4800 \ifsublines@ \the\endsubline@num \else 0\fi}\to\line@list
4801 % \end{macrocode}
4802 %
4803 % Finally, execute the second argument of \cs{@ref} again,
4804 % to perform for real all the commands within it.
4805 % \begin{macrocode}
4806 #2}
4807
4808 % \end{macrocode}
4809 % \end{macro}
4810 % \end{macro}
4811 % \end{macro}
4812 %
4813 % \subsection{Writing to the line-list file}
4814 %
4815 % We've now defined all the counters, lists, and commands involved in
4816 % reading the line-list file at the start of a section. Now we'll
4817 % cover the commands that \Ledmac{} uses within the text of a
4818 % section to write commands out to the line-list.
4819 %
4820 % \begin{macro}{\linenum@out}
4821 % The file will be opened on output stream \cs{linenum@out}.
4822 % \begin{macrocode}
4823 \newwrite\linenum@out
4824 % \end{macrocode}
4825 % \end{macro}
4826 %
4827 % \begin{macro}{\iffirst@linenum@out@}
4828 % \begin{macro}{\first@linenum@out@true}
4829 % \begin{macro}{\first@linenum@out@false}
4830 % Once any file is opened on this stream, we keep it open forever, or
4831 % else switch to another file that we keep open. The reason is that
4832 % we want the output routine to write the page number for every page
4833 % to this file; otherwise we'd have to write it at the start of
4834 % every line.
4835 % But it's not very easy for the output routine to tell whether an
4836 % output stream is open or not. There's no way to test the status of
4837 % a particular output stream directly, and
4838 % the asynchronous nature of output routines makes the
4839 % status hard to determine by other means.
4840 %
4841 % We can manage pretty well by means of the \cs{iffirst@linenum@out@}
4842 % flag; its inelegant name suggests the nature of the problem that
4843 % made its creation necessary. It's set
4844 % to be \verb"true" before any \cs{linenum@out} file is opened. When such a file
4845 % is opened for the first time, it's done using \cs{immediate}, so that
4846 % it will at once be safe for the output routine to write to it; we then
4847 % set this flag to \verb"false".
4848 % \begin{macrocode}
4849 \newif\iffirst@linenum@out@
4850 \first@linenum@out@true
4851 % \end{macrocode}
4852 % \end{macro}
4853 % \end{macro}
4854 % \end{macro}
4855 %
4856 % \begin{macro}{\line@list@stuff}
4857 % The \cs{line@list@stuff}\marg{file} macro, which
4858 % is called by \cs{beginnumbering}, performs
4859 % all the line-list operations needed at the start of a section.
4860 % Its argument is the name of the line-list file.
4861 % \begin{macrocode}
4862 \newcommand*{\line@list@stuff}[1]{%
4863 % \end{macrocode}
4864 %
4865 % First, use the commands of the previous section to interpret the
4866 % line-list file from the last run.
4867 % \begin{macrocode}
4868 \read@linelist{#1}%
4869 % \end{macrocode}
4870 %
4871 % Now close the current output line-list file, if any, and open a new one.
4872 % The first time we open a line-list file for output, we do it using
4873 % \cs{immediate}, and clear the \cs{iffirst@linenum@out@} flag.
4874 % \changes{v0.2.2}{2003/11/09}{Added initial write of page number in
4875 % \cs{line@list@stuff}}
4876 % \changes{v0.7}{2005/02/25}{Deleted \cs{page@start} from \cs{line@list@stuff}}
4877 % \begin{macrocode}
4878 \iffirst@linenum@out@
4879 \immediate\closeout\linenum@out
4880 \global\first@linenum@out@false
4881 \immediate\openout\linenum@out=#1\relax
4882 \else
4883 % \end{macrocode}
4884 % If we get here, then this is
4885 % not the first line-list we've seen, so we
4886 % don't open or close the files immediately.
4887 % \begin{macrocode}
4888 \closeout\linenum@out
4889 \openout\linenum@out=#1\relax
4890 \fi}
4891
4892 % \end{macrocode}
4893 % \end{macro}
4894 %
4895 % \begin{macro}{\new@line}
4896 % The \cs{new@line} macro sends the \cs{@l} command to the line-list
4897 % file, to mark the start of a new text line, and its page number.
4898 % \changes{v0.6}{2004/11/16}{Extended \cs{new@line} to output page numbers}
4899 % \begin{macrocode}
4900 \newcommand*{\new@line}{\write\linenum@out{\string\@l[\the\c@page][\thepage]}}
4901 % \end{macrocode}
4902 % \end{macro}
4903 %
4904 % \begin{macro}{\flag@start}
4905 % \begin{macro}{\flag@end}
4906 % We enclose a lemma marked by \cs{edtext} in
4907 % \cs{flag@start} and \cs{flag@end}: these send the \cs{@ref}
4908 % command to the line-list file. \cs{edtext} is responsible for
4909 % setting the value of \cs{insert@count} appropriately; it
4910 % actually gets done by the various footnote macros.
4911 % \begin{macrocode}
4912 \newcommand*{\flag@start}{%
4913 \edef\next{\write\linenum@out{%
4914 \string\@ref[\the\insert@count][}}%
4915 \next}
4916 \newcommand*{\flag@end}{\write\linenum@out{]}}
4917 % \end{macrocode}
4918 % \end{macro}
4919 % \end{macro}
4920 %
4921 % \begin{macro}{\page@start}
4922 % \begin{PW}
4923 % Originally the commentary was: \cs{page@start} writes a command to the line-list
4924 % file noting the current page number;
4925 % when used within an output routine, this should be called so as to place
4926 % its \cs{write} within the box that gets shipped out, and as close to
4927 % the top of that box as possible.
4928 %
4929 % However, in October 2004 Alexej Krukov\index{Krukov, Alexej} discovered that
4930 % when processing long paragraphs that included Russian, Greek and Latin texts
4931 % \Ledmac{} would go into an infinite loop, emitting thousands of blank pages.
4932 % This was caused by being unable to find an appropriate place in the
4933 % output routine. A different algorithm is now used for getting page numbers.
4934 % \changes{v0.6}{2004/11/16}{Made \cs{page@start} a no-op}
4935 % \end{PW}
4936 % \begin{macrocode}
4937 \newcommand*{\page@start}{}
4938
4939 % \end{macrocode}
4940 % \end{macro}
4941 %
4942 % \begin{macro}{\startsub}
4943 % \begin{macro}{\endsub}
4944 % \cs{startsub} and \cs{endsub}
4945 % turn sub-lineation on and off, by writing
4946 % appropriate instructions to the line-list file. When
4947 % sub-lineation is in effect, the line number counter is frozen and
4948 % the sub-line counter advances instead. If one of these commands
4949 % appears in the middle of a line, it doesn't take effect until the
4950 % next line; in other words, a line is counted as a line or
4951 % sub-line depending on what it started out as, even if that
4952 % changes in the middle.
4953 %
4954 % We tinker with \cs{lastskip} because a command of either sort
4955 % really needs to be attached to the last word preceding the change, not
4956 % the first word that follows the change. This is because sub-lineation
4957 % will often turn on and off in mid-line---stage directions, for example,
4958 % often are mixed with dialogue in that way---and when a line is mixed
4959 % we want to label it using the system that was in effect at its start.
4960 % But when sub-lineation begins at the very start of a line we have a
4961 % problem, if we don't put in this code.
4962 % \begin{macrocode}
4963 \newcommand*{\startsub}{\dimen0\lastskip
4964 \ifdim\dimen0>0pt \unskip \fi
4965 \write\linenum@out{\string\sub@on}%
4966 \ifdim\dimen0>0pt \hskip\dimen0 \fi}
4967 \def\endsub{\dimen0\lastskip
4968 \ifdim\dimen0>0pt \unskip \fi
4969 \write\linenum@out{\string\sub@off}%
4970 \ifdim\dimen0>0pt \hskip\dimen0 \fi}
4971
4972 % \end{macrocode}
4973 % \end{macro}
4974 % \end{macro}
4975 %
4976 % \begin{macro}{\advanceline}
4977 % You can use \cs{advanceline}\marg{num}
4978 % in running text to advance the current visible
4979 % line-number by a specified value, positive or negative.
4980 % \begin{macrocode}
4981 \newcommand*{\advanceline}[1]{\write\linenum@out{\string\@adv[#1]}}
4982 % \end{macrocode}
4983 % \end{macro}
4984 %
4985 % \begin{macro}{\setline}
4986 % You can use \cs{setline}\marg{num}
4987 % in running text (i.e., within \verb?\pstart...\pend?) to set the
4988 % current visible
4989 % line-number to a specified positive value.
4990 % \begin{macrocode}
4991 \newcommand*{\setline}[1]{%
4992 \ifnum#1<\z@
4993 \led@warn@BadSetline
4994 \else
4995 \write\linenum@out{\string\@set[#1]}%
4996 \fi}
4997
4998 % \end{macrocode}
4999 % \end{macro}
5000 %
5001 % \begin{PW}
5002 % \begin{macro}{\setlinenum}
5003 % You can use \cs{setlinenum}\marg{num}
5004 % before a \verb?\pstart? to set the visible line-number to a specified
5005 % positive value. It writes a \verb?\l@d@set? command to the line-list file.
5006 % \begin{macrocode}
5007 \newcommand*{\setlinenum}[1]{%
5008 \ifnum#1<\z@
5009 \led@warn@BadSetlinenum
5010 \else
5011 \write\linenum@out{\string\l@d@set[#1]}%
5012 \fi}
5013
5014 % \end{macrocode}
5015 % \end{macro}
5016 % \end{PW}
5017 %
5018 % \begin{macro}{\startlock}
5019 % \begin{macro}{\endlock}
5020 % You can use \cs{startlock} or \cs{endlock}
5021 % in running text to start or end line number locking at
5022 % the current line. They decide whether line numbers or sub-line numbers
5023 % are affected, depending on the current state of the sub-lineation flags.
5024 % \begin{macrocode}
5025 \newcommand*{\startlock}{\write\linenum@out{\string\lock@on}}
5026 \def\endlock{\write\linenum@out{\string\lock@off}}
5027
5028 % \end{macrocode}
5029 % \end{macro}
5030 % \end{macro}
5031 %
5032 % \begin{PW}
5033 % \begin{macro}{\ifl@dskipnumber}
5034 % \begin{macro}{\l@dskipnumbertrue}
5035 % \begin{macro}{\l@dskipnumberfalse}
5036 % \begin{macro}{\skipnumbering}
5037 % \begin{macro}{\skipnumbering@reg}
5038 % In numbered text \cs{skipnumbering} will suspend the numbering
5039 % for that particular line.
5040 % \changes{v0.7}{2005/02/22}{Added \cs{skipnumbering} and supports}
5041 % \begin{macrocode}
5042 \newif\ifl@dskipnumber
5043 \l@dskipnumberfalse
5044 \newcommand*{\skipnumbering}{\skipnumbering@reg}
5045 \newcommand*{\skipnumbering@reg}{%
5046 \write\linenum@out{\string\n@num}%
5047 \advanceline{-1}}
5048
5049 % \end{macrocode}
5050 % \end{macro}
5051 % \end{macro}
5052 % \end{macro}
5053 % \end{macro}
5054 % \end{macro}
5055 % \end{PW}
5056 %
5057 % \section{Marking text for notes}
5058 % \label{text}\relax
5059 %
5060 % The \cs{edtext} (or \cs{critext}) macro is used to create all
5061 % footnotes and endnotes,
5062 % as well as to print the portion of the main text to which a given note
5063 % or notes is keyed. The idea is to have that lemma appear only once in
5064 % the \file{.tex} file: all instances of it in the main text and in the
5065 % notes are copied from that one appearance.
5066 %
5067 % \begin{PW}
5068 % For convenience, I will use \cs{*text} when I do not need to distinguish
5069 % between \cs{edtext} and \cs{critext}.
5070 % The \cs{*text} macros take two arguments, the only difference between
5071 % \cs{edtext} and \cs{critext} is how the second argument is delineated.
5072 % \end{PW}
5073 %
5074 % \cs{critext} requires two arguments. At any point within numbered
5075 % text, you use it by saying:
5076 % \begin{verbatim}
5077 % \critext{#1}#2/
5078 % \end{verbatim}
5079 % \begin{PW} Similarly \cs{edtext} requires the same two arguments
5080 % but you use it by saying:
5081 % \begin{verbatim}
5082 % \edtext{#1}{#2}
5083 % \end{verbatim}
5084 % \end{PW}
5085 %
5086 % \begin{itemize}\addtolength{\itemsep}{-1ex}
5087 % \item \verb"#1" is the piece of the main text being glossed;
5088 % it gets added to the
5089 % main text, and is also used as a lemma for notes to it.
5090 %
5091 % \item \verb"#2" is a series of subsidiary macros that generate
5092 % various kinds of notes. With \cs{critext} the \verb"/" after \verb"#2" \emph{must} appear:
5093 % it marks the end of the macro. (\thetexbook,
5094 % p.\,204, points out that when
5095 % additional text to be matched follows the arguments like this, spaces
5096 % following the macro are not skipped, which is very desirable since
5097 % this macro will never be used except within text. Having an
5098 % explicit terminator also helps keep things straight when nested
5099 % calls to \cs{critext} are used.) Braces around
5100 % \verb"#2" are optional with \cs{critext} and required for \cs{edtext}.
5101 % \end{itemize}
5102 %
5103 % The \cs{*text} macro may be used (somewhat) recursively; that
5104 % is, \cs{*text} may be used within its own first argument. The
5105 % code would be much simpler without this feature, but nested notes
5106 % will commonly be necessary: it's quite likely that we'll have an
5107 % explanatory note for a long passage and notes on variants for
5108 % individual words within that passage. The situation we can't
5109 % handle is overlapping notes that aren't nested: for example, one
5110 % note covering lines 10--15, and another covering 12--18. You can
5111 % handle such cases by using the \cs{lemma} and \cs{linenum}
5112 % macros within \verb"#2": they alter the copy of the lemma and the
5113 % line numbers that are passed to the notes, and hence allow you to
5114 % overcome any limitations of this system, albeit with extra
5115 % effort.
5116 %
5117 % The recursive operation of \cs{*text} will fail if you try to use a copy
5118 % that is called something other than \cs{*text}. In order to handle
5119 % recursion, \cs{*text} needs to redefine its own definition temporarily
5120 % at one point, and that doesn't work if the macro you are calling is
5121 % not actually named \cs{*text}. There's no problem as long as \cs{*text}
5122 % is not invoked in the first argument. If you want to call \cs{*text}
5123 % something else, it is best to create instead a macro that expands
5124 % to an invocation of \cs{*text}, rather than copying \cs{*text} and giving
5125 % it a new name; otherwise you will need to add an appropriate
5126 % definition for your new macro to \cs{morenoexpands}.
5127 %
5128 % Side effects of our line-numbering code make it impossible to use
5129 % the usual footnote macros directly within a paragraph whose lines are
5130 % numbered (see comments to
5131 % \cs{do@line}, p.\,\pageref{doline}).
5132 % Instead, the appropriate note-generating command
5133 % is appended to the list macro \cs{inserts@list}, and when \cs{pend}
5134 % completes the paragraph it inserts all the notes at the proper places.
5135 %
5136 % Note that we don't provide previous-note information, although it's
5137 % often wanted; your own macros must handle that. We can't do it
5138 % correctly without keeping track of what kind of notes have gone past:
5139 % it's not just a matter of remembering the line numbers associated with
5140 % the previous invocation of \cs{*text}, because that might have been for
5141 % a different kind of note. It is preferable for your footnote macros
5142 % to store and recall this kind of information if they need it.
5143 %
5144 % \phantomsection\label{parallel}An example where some `memory' of line numbers
5145 % might be required is where there are several variant readings
5146 % per line of text, and you do not wish the line number to be repeated
5147 % for each lemma in the notes. After the first occurrence of the line
5148 % number, you might want the symbol `$\parallel$' instead of further
5149 % occurrences, for instance. This can easily be done by a macro like
5150 % \cs{printlines}, if it saves the last value of \cs{l@d@nums} that \emph{it}
5151 % saw, and then performs a simple conditional test to see whether to print
5152 % a number or a~`$\parallel$'.
5153 %
5154 % \subsection{{\tt \protect\bslash edtext} and {\tt \protect\bslash critext}
5155 % themselves}
5156 %
5157 % The various note-generating macros might want to request that
5158 % commands be executed not at once, but in close connection with the
5159 % start or end of the lemma. For example, footnote numbers in the text
5160 % should be connected to the end of the lemma; or, instead of a single
5161 % macro to create a note listing variants, you might want to use
5162 % several macros in series to create individual variants, which would
5163 % each add information to a private macro or token register, which in
5164 % turn would be formatted and output when all of \verb"#2" for the lemma
5165 % has been read.
5166 %
5167 % \begin{macro}{\end@lemmas}
5168 % To accomodate this, we provide a list macro
5169 % to which macros may add commands that should subsequently
5170 % be executed at the end of the lemma when that lemma is added
5171 % to the text of the paragraph. A macro should add its contribution to
5172 % \cs{end@lemmas} by using \cs{xleft@appenditem}.
5173 % (Anything that needs to be done at
5174 % the \emph{start} of the lemma may be handled using \cs{aftergroup}, since
5175 % the commands specified within \cs{critext}'s second argument are
5176 % executed within a group that ends just before the lemma is added to
5177 % the main text.)
5178 %
5179 % \cs{end@lemmas} is intended for the few things that need to be
5180 % associated with the end of the lemma, like footnote numbers. Such
5181 % numbers are not implemented in the current version, and indeed
5182 % no use is currently made of \cs{end@lemmas} or of the \cs{aftergroup}
5183 % trick. The general
5184 % approach would be to define a macro to be used within the second
5185 % argument of \cs{critext} that would add the appropriate command to
5186 % \cs{end@lemmas}.
5187 %
5188 % Commands that are added to this list should always take care
5189 % not to do anything that adds possible line-breaks to the output;
5190 % otherwise line numbering could be thrown off.
5191 % \begin{macrocode}
5192 \list@create{\end@lemmas}
5193 % \end{macrocode}
5194 % \end{macro}
5195 %
5196 % \begin{macro}{\dummy@text}
5197 % We now need to define a number of macros that allow us to weed out
5198 % nested instances of \cs{critext}, and other problematic macros, from
5199 % our lemma. This is similar to what we did in reading the line-list
5200 % file using \cs{dummy@ref} and various redefinitions---and that's
5201 % because nested \cs{critext} macros create nested \cs{@ref} entries
5202 % in the line-list file.
5203 %
5204 % Here's a macro that takes the same arguments as
5205 % \cs{critext} but merely returns the first argument and ignores
5206 % the second.
5207 % \begin{macrocode}
5208 \long\def\dummy@text#1#2/{#1}
5209 % \end{macrocode}
5210 % \end{macro}
5211 %
5212 % \begin{PW}
5213 % \begin{macro}{\dummy@edtext}
5214 % LaTeX users are not used to delimited arguments, so I provide
5215 % a \cs{edtext} macro as well.
5216 % \begin{macrocode}
5217 \newcommand{\dummy@edtext}[2]{#1}
5218 % \end{macrocode}
5219 % \end{macro}
5220 %
5221 % \end{PW}
5222 %
5223 % We're going to need another macro that takes one argument and ignores
5224 % it entirely. This is supplied by the LaTeX \cs{@gobble}\marg{arg}.
5225 %
5226 % \begin{macro}{\no@expands}
5227 % \begin{macro}{\morenoexpands}
5228 % We need to turn off macro expansion for certain sorts of macros we're
5229 % likely to see within the lemma and within the notes.
5230 %
5231 % The first class is font-changing macros. We suppress expansion for
5232 % them by letting them become equal to zero.\footnote{Since `control
5233 % sequences equivalent to characters are not expandable'---\thetexbook,
5234 % answer to Exercise 20.14.} This is done because we want to
5235 % pass into our notes the generic commands to change to roman or
5236 % whatever, and not their expansions that will ask for a particular style at
5237 % a specified size. The notes may well be in a smaller font, so the
5238 % command should be expanded later, when the note's environment is in
5239 % effect.
5240 %
5241 % A second sort to turn off includes a few of the accent macros.
5242 % Most are not a problem: an accent that's expanded to an \cs{accent}
5243 % command may be harder to read but it works just the same. The
5244 % ones that cause problems are: those that use alignments---\TeX\
5245 % seems to get confused about the difference between alignment
5246 % parameters and macro parameters; those that use temporary control
5247 % sequences; and those that look carefully at what the current font
5248 % is.
5249 %
5250 % (The \cs{copyright} macro defined in \PlainTeX\ has this sort of
5251 % problem as well, but isn't used enough to bother with. That macro,
5252 % and any other that causes trouble, will get by all right if you put
5253 % a \cs{protect} in front of it in your file.)
5254 %
5255 % We also need to eliminate all \Ledmac{} macros like \cs{edlabel} and
5256 % \cs{setline} that write things to auxiliary files: that writing
5257 % should be done only once. And we make
5258 % \cs{critext} itself, if it appears within its own
5259 % argument, do nothing but copy its first argument.
5260 %
5261 % Finally, we execute \cs{morenoexpands}. The version of
5262 % \cs{morenoexpands} defined here does nothing; but you may define
5263 % a version of your own when you need to add more expansion
5264 % suppressions as needed with your macros. That makes it possible
5265 % to make such additions without needing to copy or modify the
5266 % standard \Ledmac{} code. If you define your own
5267 % \cs{morenoexpands}, you must be very careful about spaces: if the
5268 % macro adds any spaces to the text when it runs, extra space
5269 % will appear in the main text when \cs{critext} is used.
5270 %
5271 % (A related problem, not addressed by these two macros,
5272 % is that of characters whose category code is changed by any
5273 % the macros used in the arguments to \cs{critext}. Since the
5274 % category codes are set when the arguments are scanned, macros
5275 % that depend on changing them will not work. We have most often
5276 % encountered this with characters that are made `active' within
5277 % text in some, but not all, of the languages used within the document.
5278 % One way around the problem, if it takes this form,
5279 % is to ensure that those characters are \emph{always} active; within
5280 % languages that make no special use of them, their associated
5281 % control sequences should simply return the proper character.)
5282 % \changes{v0.2}{2003/07/25}{Added \cs{l@dtabnoexpands} to \cs{no@expands}}
5283 % \changes{v0.2.1}{203/08/25}{Removed some \cs{let}s from \cs{no@expands}.
5284 % These were in \edmac{} but I feel that they should not have been as they
5285 % disabled page/line refs in footnotes}
5286 % \begin{macrocode}
5287 \newcommand*{\no@expands}{\let\rm=0\let\it=0\let\sl=0\let\bf=0\let\tt=0%
5288 \let\b=0\let\c=0\let\d=0\let\t=0%
5289 \let\select@@lemmafont=0%
5290 \def\protect{\noexpand\protect\noexpand}%
5291 \let\startsub=\relax \let\endsub=\relax
5292 \let\startlock=\relax \let\endlock=\relax
5293 \let\edlabel=\@gobble
5294 % \let\edpageref=\@gobble
5295 % \let\lineref=\@gobble
5296 % \let\sublineref=\@gobble
5297 \let\setline=\@gobble \let\advanceline=\@gobble
5298 \let\critext=\dummy@text
5299 \let\edtext=\dummy@edtext
5300 \l@dtabnoexpands
5301 \morenoexpands}
5302 \let\morenoexpands=\relax
5303
5304 % \end{macrocode}
5305 % \end{macro}
5306 % \end{macro}
5307 %
5308 % \begin{macro}{\critext}
5309 % Now we begin \cs{critext} itself. The definition requires a \verb"/" after
5310 % the arguments: this eliminates the possibility of problems about
5311 % knowing where \verb"#2" ends. This also changes the handling of spaces
5312 % following an invocation of the macro: normally such spaces are
5313 % skipped, but in this case they're significant because \verb"#2" is
5314 % a `delimited parameter'. Since \cs{critext} is always used in running
5315 % text, it seems more appropriate to pay attention to spaces than to
5316 % skip them.
5317 %
5318 % When executed, \cs{critext} first ensures that we're in
5319 % horizontal mode.
5320 % \begin{macrocode}
5321 \long\def\critext#1#2/{\leavevmode
5322 % \end{macrocode}
5323 %
5324 % \begin{macro}{\@tag}
5325 % Our normal lemma is just argument \verb"#1"; but that argument could have
5326 % further invocations of \cs{critext} within it. We get a copy of the
5327 % lemma without any \cs{critext} macros within it by temporarily redefining
5328 % \cs{critext} to just copy its first argument and ignore the other,
5329 % and then expand \verb"#1" into \cs{@tag}, our lemma.
5330 %
5331 % This is done within a group that starts here, in order to get the
5332 % original \cs{critext} restored; within this group we've also turned
5333 % off the expansion of those control sequences commonly found within text
5334 % that can cause trouble for us.
5335 % \begin{macrocode}
5336 \begingroup
5337 \no@expands
5338 \gdef\@tag{#1}%
5339 % \end{macrocode}
5340 % \end{macro}
5341 %
5342 % \begin{macro}{\l@d@nums}
5343 % \phantomsection\label{nums}
5344 % Prepare more data for the benefit of note-generating macros: the line
5345 % references and font specifier for this lemma go to \cs{l@d@nums}.
5346 % \begin{macrocode}
5347 \set@line
5348 % \end{macrocode}
5349 % \end{macro}
5350 %
5351 % \cs{insert@count} will be altered by the note-generating macros:
5352 % it counts the number of deferred footnotes or other insertions
5353 % generated by this instance of \cs{critext}.
5354 % \begin{macrocode}
5355 \global\insert@count=0
5356 % \end{macrocode}
5357 %
5358 % Now process the note-generating macros in argument \verb"#2"
5359 % (i.e., \cs{Afootnote}, \cs{lemma}, etc.). \cs{ignorespaces} is here to
5360 % skip over any spaces that might appear at the start of \verb"#2";
5361 % otherwise they wind up in the main text. Footnote and other
5362 % macros that are used within \verb"#2" should all end with
5363 % \cs{ignorespaces} as well, to skip any spaces between macros when
5364 % several are used in series.
5365 % \begin{macrocode}
5366 \ignorespaces #2\relax
5367 % \end{macrocode}
5368 %
5369 % Finally, we're ready to admit the first argument into the current
5370 % paragraph.
5371 %
5372 % It's important that we generate and output all the notes for this
5373 % chunk of text \emph{before} putting the text into the paragraph: notes
5374 % that are referenced by line number should generally be tied to the
5375 % start of the passage they gloss, not the end. That should all be done
5376 % within the expansion of \verb"#2" above, or in \cs{aftergroup}
5377 % commands within that expansion.
5378 % \begin{macrocode}
5379 \flag@start
5380 \endgroup
5381 \showlemma{#1}%
5382 % \end{macrocode}
5383 %
5384 % Finally, we add any insertions that are
5385 % associated with the \emph{end} of
5386 % the lemma. Footnotes that are identified by symbols rather than by
5387 % where the lemma begins in the main text need to be done here, and
5388 % not above.
5389 %
5390 % \begin{macrocode}
5391 \ifx\end@lemmas\empty \else
5392 \gl@p\end@lemmas\to\x@lemma
5393 \x@lemma
5394 \global\let\x@lemma=\relax
5395 \fi
5396 \flag@end}
5397 % \end{macrocode}
5398 % \end{macro}
5399 %
5400 % \begin{PW} Here's the promised undelimited LaTeX version of \cs{critext}.
5401 % \changes{v0.4}{2004/02/29}{Added \cs{showlemma} to \cs{edtext} (and \cs{critext})}
5402 % \begin{macro}{\edtext}
5403 % \begin{macrocode}
5404 \newcommand{\edtext}[2]{\leavevmode
5405 \begingroup
5406 \no@expands
5407 \gdef\@tag{#1}%
5408 \set@line
5409 \global\insert@count=0
5410 \ignorespaces #2\relax
5411 \flag@start
5412 \endgroup
5413 \showlemma{#1}%
5414 \ifx\end@lemmas\empty \else
5415 \gl@p\end@lemmas\to\x@lemma
5416 \x@lemma
5417 \global\let\x@lemma=\relax
5418 \fi
5419 \flag@end}
5420
5421 % \end{macrocode}
5422 % \end{macro}
5423 %
5424 % \end{PW}
5425 %
5426 % \begin{macro}{\ifnumberline}
5427 % The \cs{ifnumberline} option can be set to FALSE to disable line numbering.
5428 % \begin{macrocode}
5429 \newif\ifnumberline
5430 \numberlinetrue
5431 % \end{macrocode}
5432 % \end{macro}
5433 % \begin{macro}{\set@line}
5434 % The \cs{set@line} macro
5435 % is called by \cs{critext} to put the line-reference field and
5436 % font specifier for the current block of text into \cs{l@d@nums}.
5437 %
5438 % One instance of \cs{critext} may generate several notes, or it
5439 % may generate none---it's legitimate for argument \verb"#2" to \cs{critext} to
5440 % be empty. But \cs{flag@start} and \cs{flag@end} induce the generation of
5441 % a single entry in \cs{line@list} during the next run, and it's vital
5442 % to also remove one and only one \cs{line@list} entry here.
5443 % \begin{macrocode}
5444 \newcommand*{\set@line}{%
5445 % \end{macrocode}
5446 %
5447 % If no more lines are listed in \cs{line@list}, something's
5448 % wrong---probably just some change in the input. We set all the numbers
5449 % to zeros, following an old publishing convention for numerical
5450 % references that haven't yet been resolved.
5451 % \begin{macrocode}
5452 \ifx\line@list\empty
5453 \global\noteschanged@true
5454 \xdef\l@d@nums{000|000|000|000|000|000|\edfont@info}%
5455 \else
5456 \gl@p\line@list\to\@tempb
5457 \xdef\l@d@nums{\@tempb|\edfont@info}%
5458 \global\let\@tempb=\undefined
5459 \fi}
5460
5461 % \end{macrocode}
5462 % \end{macro}
5463 %
5464 % \begin{macro}{\edfont@info}
5465 % The macro \cs{edfont@info} returns coded information about the
5466 % current font.
5467 %
5468 % \begin{macrocode}
5469 \newcommand*{\edfont@info}{\f@encoding/\f@family/\f@series/\f@shape}
5470
5471 % \end{macrocode}
5472 % \end{macro}
5473 %
5474 % \subsection{Substitute lemma}
5475 %
5476 % \begin{macro}{\lemma}
5477 % The \cs{lemma}\marg{text} macro allows you to change the lemma
5478 % that's passed on to the notes.
5479 % \begin{macrocode}
5480 \newcommand*{\lemma}[1]{\gdef\@tag{#1}\ignorespaces}
5481 % \end{macrocode}
5482 % \end{macro}
5483 %
5484 % \subsection{Substitute line numbers}
5485 %
5486 % \begin{macro}{\linenum}
5487 % \phantomsection\label{linenumdef}\relax
5488 % The \cs{linenum} macro can change any or all of
5489 % the page and line numbers that are
5490 % passed on to the notes.
5491 %
5492 % As argument \cs{linenum} takes a set of seven parameters
5493 % separated by vertical bars, in the format used internally for
5494 % \cs{l@d@nums} (see p.\,\pageref{linenumbers}): the starting page,
5495 % line, and sub-line numbers, followed by the ending page, line, and
5496 % sub-line numbers, and then the font specifier for the lemma.
5497 % However, you can omit any parameters you don't want to change, and
5498 % you can omit a string of vertical bars at the end of the
5499 % argument. Hence \verb"\linenum{18|4|0|18|7|1|0}" is an invocation
5500 % that changes all the parameters, but \verb"\linenum{|3}" only
5501 % changes the starting line number, and leaves the rest unaltered.
5502 %
5503 % We use \verb"\\" as an internal separator for the macro parameters.
5504 % \begin{macrocode}
5505 \newcommand*{\linenum}[1]{%
5506 \xdef\@tempa{#1|||||||\noexpand\\\l@d@nums}%
5507 \global\let\l@d@nums=\empty
5508 \expandafter\line@set\@tempa|\\\ignorespaces}
5509 % \end{macrocode}
5510 %
5511 % \begin{macro}{\line@set}
5512 % \cs{linenum} calls \cs{line@set} to do the actual work; it
5513 % looks at the first number in the argument to \cs{linenum},
5514 % sets the corresponding value in \cs{l@d@nums}, and then calls
5515 % itself to process the next number in the \cs{linenum}
5516 % argument, if there are more numbers in \cs{l@d@nums} to process.
5517 % \begin{macrocode}
5518 \def\line@set#1|#2\\#3|#4\\{%
5519 \gdef\@tempb{#1}%
5520 \ifx\@tempb\empty
5521 \l@d@add{#3}%
5522 \else
5523 \l@d@add{#1}%
5524 \fi
5525 \gdef\@tempb{#4}%
5526 \ifx\@tempb\empty\else
5527 \l@d@add{|}\line@set#2\\#4\\%
5528 \fi}
5529 % \end{macrocode}
5530 % \end{macro}
5531 %
5532 % \begin{macro}{\l@d@add}
5533 % \cs{line@set} uses \cs{l@d@add} to tack numbers or vertical bars
5534 % onto the right hand end of \cs{l@d@nums}.
5535 % \begin{macrocode}
5536 \newcommand{\l@d@add}[1]{\xdef\l@d@nums{\l@d@nums#1}}
5537
5538 % \end{macrocode}
5539 % \end{macro}
5540 % \end{macro}
5541 %
5542 % \section{Paragraph decomposition and reassembly}
5543 % \label{paragraph}\relax
5544 %
5545 % In order to be able to count the lines of text and affix line
5546 % numbers, we add an extra stage of processing for each paragraph.
5547 % We send the paragraph into a box
5548 % register, rather than straight onto the vertical list, and when
5549 % the paragraph ends we
5550 % slice the paragraph into its component lines; to each line we
5551 % add any notes or line numbers, add a command to write to the
5552 % line-list, and then at last send the line to the vertical list.
5553 % This section contains all the code for this processing.
5554 %
5555 % \subsection{Boxes, counters, {\tt\protect\bslash pstart}
5556 % and {\tt\protect\bslash pend}}
5557 %
5558 % \begin{macro}{\raw@text}
5559 % \begin{macro}{\ifnumberedpar@}
5560 % \begin{macro}{\numberedpar@true}
5561 % \begin{macro}{\numberedpar@false}
5562 % \begin{macro}{\num@lines}
5563 % \begin{macro}{\one@line}
5564 % \begin{macro}{\par@line}
5565 % Here are numbers and flags that are used internally in the course
5566 % of the paragraph decomposition.
5567 %
5568 % When we first form the paragraph, it goes into a box register,
5569 % \cs{raw@text}, instead of onto the current vertical list.
5570 % The \cs{ifnumberedpar@} flag will be \verb"true" while a paragraph is
5571 % being processed in that way.
5572 % \cs{num@lines} will store the number of lines in the paragraph
5573 % when it's complete. When we chop it up into lines, each line
5574 % in turn goes into the
5575 % \cs{one@line} register, and \cs{par@line} will be the number
5576 % of that line within the paragraph.
5577 % \begin{macrocode}
5578 \newbox\raw@text
5579 \newif\ifnumberedpar@
5580 \newcount\num@lines
5581 \newbox\one@line
5582 \newcount\par@line
5583 % \end{macrocode}
5584 % \end{macro}
5585 % \end{macro}
5586 % \end{macro}
5587 % \end{macro}
5588 % \end{macro}
5589 % \end{macro}
5590 % \end{macro}
5591 %
5592 % \begin{macro}{\pstart}
5593 % \begin{macro}{numberpstarttrue}
5594 % \begin{macro}{numberpstartfalse}
5595 % \begin{macro}{thepstart}
5596 % \cs{pstart} starts the paragraph by
5597 % clearing the \cs{inserts@list} list and other
5598 % relevant variables, and then arranges for the
5599 % subsequent text to go into the
5600 % \cs{raw@text} box. \cs{pstart} needs to appear at the start of
5601 % every paragraph that's to be numbered; the \cs{autopar} command below
5602 % may be used to insert these commands automatically.
5603 %
5604 % Beware: everything that occurs between \cs{pstart} and \cs{pend}
5605 % is happening within a group; definitions must be global if you want
5606 % them to survive past the end of the paragraph.
5607 %
5608 %You can use the command \cs{numberpstarttrue} to insert a number on every \cs{pstart}. To stop the numbering, you must use \cs{numberpstartfalse}. To reset the numebering of \cs{pstarts}, insert
5609 % \begin{verbatim}
5610 %\setcounter{pstart}{0}
5611 % \end{verbatim}
5612 %
5613 % \begin{macrocode}
5614
5615 \newcounter{pstart}
5616 \renewcommand{\thepstart}{{\bfseries\@arabic\c@pstart}. }
5617 \newif\ifnumberpstart
5618 \numberpstartfalse
5619 \newcommand*{\pstart}{
5620 \if@nobreak
5621 \let\@oldnobreak\@nobreaktrue
5622 \else
5623 \let\@oldnobreak\@nobreakfalse
5624 \fi
5625 \@nobreaktrue
5626 \ifnumbering \else
5627 \led@err@PstartNotNumbered
5628 \beginnumbering
5629 \fi
5630 \ifnumberedpar@
5631 \led@err@PstartInPstart
5632 \pend
5633 \fi
5634 \list@clear{\inserts@list}%
5635 \global\let\next@insert=\empty
5636 \begingroup\normal@pars
5637 \global\setbox\raw@text=\vbox\bgroup\ifautopar\else\ifnumberpstart\ifinstanza\else\ifsidepstartnum\else\thepstart\fi\fi\fi\fi
5638 \numberedpar@true}
5639 % \end{macrocode}
5640 % \end{macro}
5641 % \end{macro}
5642 % \end{macro}
5643 % \end{macro}
5644 % \begin{macro}{\pend}
5645 % \cs{pend} must be used to end a numbered paragraph.
5646 %
5647 % \begin{macrocode}
5648 \newcommand*{\pend}{\ifnumbering \else
5649 \led@err@PendNotNumbered
5650 \fi
5651 \ifnumberedpar@ \else
5652 \led@err@PendNoPstart
5653 \fi
5654 % \end{macrocode}
5655 % We set all the usual interline penalties to zero and then immediately
5656 % call \cs{endgraf} to end the paragraph; this ensures that there'll
5657 % be no large interline penalties to prevent us from slicing the
5658 % paragraph into pieces. These penalties revert to the values
5659 % that you set when the group for the \cs{vbox} ends. Then we call
5660 % \cs{do@line} to slice a line off the top of the
5661 % paragraph, add a line number and footnotes, and restore it to the page;
5662 % we keep doing this until there aren't any more lines left.
5663 % \begin{macrocode}
5664 \l@dzeropenalties
5665 \endgraf\global\num@lines=\prevgraf\egroup
5666 % \end{macrocode}
5667 % We check if lineation is by pstart : in this case, we reset line number,
5668 % but only in the second line of the pstart, to prevent some trouble.
5669 % We can't reset line number at the begining of \cs{pstart} \cs{setline}
5670 % is parsed at the end of previous \cs{pend},
5671 % and so, we must do it at the end of first line of pstart.
5672 % \begin{macrocode}
5673 \newcount\pstartline%
5674 \pstartline=0\relax%
5675 \loop\ifvbox\raw@text%
5676 \advance\pstartline 1%
5677 \do@line%
5678 \ifbypstart@%
5679 \ifnum\pstartline=1%
5680 \setline{1}%
5681 \fi%
5682 \fi%
5683 \repeat
5684 % \end{macrocode}
5685 % Deal with any leftover notes, and then end the group that was begun
5686 % in the \cs{pstart}.
5687 % \begin{macrocode}
5688 \flush@notes
5689 \endgroup
5690 \ignorespaces
5691 \ifnumberpstart
5692 \pstartnumtrue
5693 \fi
5694 \@oldnobreak
5695 \addtocounter{pstart}{1}}
5696
5697 % \end{macrocode}
5698 % \end{macro}
5699 %
5700 % \begin{PW}
5701 % \begin{macro}{\l@dzeropenalties}
5702 % A macro to zero penalties for \cs{pend}.
5703 % \changes{v0.7}{2005/02/22}{Added \cs{l@dzeropenalties}}
5704 % \begin{macrocode}
5705 \newcommand*{\l@dzeropenalties}{%
5706 \brokenpenalty \z@ \clubpenalty \z@
5707 \displaywidowpenalty \z@ \interlinepenalty \z@ \predisplaypenalty \z@
5708 \postdisplaypenalty \z@ \widowpenalty \z@}
5709
5710 % \end{macrocode}
5711 % \end{macro}
5712 % \end{PW}
5713 %
5714 % \begin{macro}{\autopar}
5715 % In most cases it's only an annoyance to have to label the paragraphs
5716 % to be numbered with \cs{pstart} and \cs{pend}. \cs{autopar} will
5717 % do that automatically, allowing you to start a paragraph with its
5718 % first word and no other preliminaries, and to end it with a blank line
5719 % or a \verb"\par" command. The command should be issued within a
5720 % group, after \cs{beginnumbering} has been used to start the
5721 % numbering; all paragraphs within the group will be affected.
5722 %
5723 % A few situations can cause problems. One is a paragraph that begins with
5724 % a begin-group character or command: \cs{pstart} will not get invoked
5725 % until after such a group beginning is processed; as a result the
5726 % character that ends the group will be mistaken for the end of the
5727 % \cs{vbox} that \cs{pstart} creates, and the rest of the paragraph
5728 % will not be numbered. Such paragraphs need to be started explicitly
5729 % using \cs{indent}, \cs{noindent}, or \cs{leavevmode}---or \cs{pstart}, since
5730 % you can still include your own \cs{pstart} and \cs{pend}
5731 % commands even with \cs{autopar} on.
5732 %
5733 % Prematurely ending the group within which \cs{autopar} is in
5734 % effect will cause a similar problem. You must either leave a
5735 % blank line or use \verb"\par" to end the last paragraph before
5736 % you end the group.
5737 %
5738 % The functioning of this macro is more tricky than the usual
5739 % \cs{everypar}: we don't want anything to go onto the vertical
5740 % list at all, so we have to end the paragraph, erase any evidence
5741 % that it ever existed, and start it again using \cs{pstart}.
5742 % We remove the paragraph-indentation box using \cs{lastbox} and
5743 % save the width, and then skip backwards over the \cs{parskip}
5744 % that's been added for this paragraph. Then we start again with
5745 % \cs{pstart}, restoring the indentation that we saved, and
5746 % locally change \verb"\par" so that it'll do our \cs{pend} for us.
5747 % \begin{macrocode}
5748 \newif\ifautopar
5749 \autoparfalse
5750 \newcommand*{\autopar}{
5751 \ifledRcol
5752 \ifnumberingR \else
5753 \led@err@AutoparNotNumbered
5754 \beginnumberingR
5755 \fi
5756 \else
5757 \ifnumbering \else
5758 \led@err@AutoparNotNumbered
5759 \beginnumbering
5760 \fi
5761 \fi
5762 \autopartrue
5763 \everypar={\setbox0=\lastbox
5764 \endgraf \vskip-\parskip
5765 \pstart \noindent \kern\wd0 \ifnumberpstart\ifinstanza\else\thepstart\fi\fi
5766 \let\par=\pend}%
5767 \ignorespaces}
5768 % \end{macrocode}
5769 % \end{macro}
5770 %
5771 % \begin{macro}{\normal@pars}
5772 % We also define a macro which we can rely on to turn off the
5773 % \cs{autopar} definitions at various important places, if they
5774 % are in force. We'll want to do this within footnotes, for
5775 % example.
5776 % \begin{macrocode}
5777 \newcommand*{\normal@pars}{\everypar={}\let\par\endgraf}
5778
5779 % \end{macrocode}
5780 % \end{macro}
5781 %
5782 % \subsection{Processing one line}
5783 %
5784 % \begin{macro}{\do@line}
5785 % \changes{v.0.19.2}{2014/09/25}{Coming back of add@penalties, deleted by version 0.17!}
5786 % \begin{macro}{\l@dunhbox@line}
5787 % The \cs{do@line} macro is called by \cs{pend} to
5788 % do all the processing for a single line of text.
5789 % \begin{macrocode}
5790 \newcommand*{\l@dunhbox@line}[1]{\unhbox #1}
5791 \newcommand*{\do@line}{%
5792 {\vbadness=10000
5793 \splittopskip=\z@
5794 \do@linehook
5795 \l@demptyd@ta
5796 \global\setbox\one@line=\vsplit\raw@text to\baselineskip}%
5797 \unvbox\one@line \global\setbox\one@line=\lastbox
5798 \getline@num
5799 \ifnum\@lock>\@ne
5800 \inserthangingsymboltrue
5801 \else
5802 \inserthangingsymbolfalse
5803 \fi
5804 \affixline@num
5805 \affixpstart@num
5806 \hb@xt@ \linewidth{\inserthangingsymbol\l@dld@ta\add@inserts\affixside@note
5807 \l@dlsn@te
5808 {\ledllfill\hb@xt@ \wd\one@line{\new@line\l@dunhbox@line{\one@line}}\ledrlfill\l@drd@ta%
5809 \l@drsn@te
5810 }}%
5811 \add@penalties%
5812 }%
5813 % \end{macrocode}
5814 % \end{macro}
5815 % \end{macro}
5816 %
5817 % \begin{PW}
5818 % \begin{macro}{\do@linehook}
5819 % A hook into \cs{do@line}.
5820 % \changes{v0.7}{2005/02/18}{Added \cs{do@linehook} for use in \cs{do@line}}
5821 % \begin{macrocode}
5822 \newcommand*{\do@linehook}{}
5823 % \end{macrocode}
5824 % \end{macro}
5825 %
5826 % \begin{macro}{\l@demptyd@ta}
5827 % \begin{macro}{\l@dld@ta}
5828 % \begin{macro}{\l@drd@ta}
5829 % \begin{macro}{\l@dcsnotetext}
5830 % Nulls the \cs{...d@ta}, which may later hold line numbers.
5831 % Similarly for \cs{l@dcsnotetext} for the text of a sidenote.
5832 % \changes{v0.7}{2005/02/18}{Added \cs{l@demptyd@ta}}
5833 % \begin{macrocode}
5834 \newcommand*{\l@demptyd@ta}{%
5835 \gdef\l@dld@ta{}%
5836 \gdef\l@drd@ta{}%
5837 \gdef\l@dcsnotetext{}}
5838
5839 % \end{macrocode}
5840 % \end{macro}
5841 % \end{macro}
5842 % \end{macro}
5843 % \end{macro}
5844 %
5845 % \begin{macro}{\l@dlsn@te}
5846 % \begin{macro}{\l@drsn@te}
5847 % Zero width boxes of the left and right side notes, together with their kerns.
5848 % \changes{v0.7}{2005/02/18}{Added \cs{l@dlsn@te} and \cs{l@drsn@te}
5849 % for use in \cs{do@line}}
5850 % \begin{macrocode}
5851 \newcommand{\l@dlsn@te}{%
5852 \hb@xt@ \z@{\hss\box\l@dlp@rbox\kern\ledlsnotesep}}
5853 \newcommand{\l@drsn@te}{%
5854 \hb@xt@ \z@{\kern\ledrsnotesep\box\l@drp@rbox\hss}}
5855
5856 % \end{macrocode}
5857 % \end{macro}
5858 % \end{macro}
5859 % \end{PW}
5860 %
5861 %
5862 % \begin{PW}
5863 % \begin{macro}{\ledllfill}
5864 % \begin{macro}{\ledrlfill}
5865 % These macros are called at the left (\verb?\ledllfill?) and the right
5866 % (\verb?\ledllfill?) of each numbered line. The initial definitions
5867 % correspond to the original code for \verb?\do@line?.
5868 % \begin{macrocode}
5869 \newcommand*{\ledllfill}{\hfil}
5870 \newcommand*{\ledrlfill}{}
5871
5872 % \end{macrocode}
5873 % \end{macro}
5874 % \end{macro}
5875 % \end{PW}
5876 %
5877 % \subsection{Line and page number computation}
5878 %
5879 % \begin{macro}{\getline@num}
5880 % The \cs{getline@num} macro
5881 % determines the page and line numbers for the line we're about to
5882 % send to the vertical list.
5883 % \begin{macrocode}
5884 \newcommand*{\getline@num}{%
5885 \ifnumberline
5886 \global\advance\absline@num \@ne
5887 \fi
5888 \do@actions
5889 \do@ballast
5890 \ifnumberline
5891 \ifsublines@
5892 \ifnum\sub@lock<\tw@
5893 \global\advance\subline@num \@ne
5894 \fi
5895 \else
5896 \ifnum\@lock<\tw@
5897 \global\advance\line@num \@ne
5898 \global\subline@num \z@
5899 \fi
5900 \fi
5901 \fi
5902 }
5903 % \end{macrocode}
5904 % \end{macro}
5905 %
5906 % \begin{macro}{\do@ballast}
5907 % \phantomsection\label{do@ballast}\relax
5908 % The real work in the macro above is done in \cs{do@actions}, but
5909 % before we plunge into that, let's get \cs{do@ballast} out of the
5910 % way. This macro looks to see if there is an action to be
5911 % performed on the \emph{next} line, and if it is going to be a
5912 % page break action, \cs{do@ballast} decreases the count \cs{ballast@count}
5913 % counter
5914 % by the amount of \verb"ballast". This means, in practice, that when
5915 % \cs{add@penalties} assigns penalties at this point, \TeX\ will be
5916 % given extra encouragement to break the page here (see
5917 % p.\,\pageref{add@penalties}).
5918 %
5919 % \begin{macro}{\ballast@count}
5920 % \begin{macro}{\c@ballast}
5921 % First we set up the required counters; they are initially
5922 % set to zero, and will remain so unless you say
5923 % \verb"\setcounter{ballast}"\marg{some figure} in your document.
5924 % \begin{macrocode}
5925 \newcount\ballast@count
5926 \newcounter{ballast}
5927 \setcounter{ballast}{0}
5928 % \end{macrocode}
5929 % \end{macro}
5930 % \end{macro}
5931 % And here is \cs{do@ballast} itself. It advances \cs{absline@num}
5932 % within the protection of a group to make its check for what
5933 % happens on the next line.
5934 % \begin{macrocode}
5935 \newcommand*{\do@ballast}{\global\ballast@count \z@
5936 \begingroup
5937 \advance\absline@num \@ne
5938 \ifnum\next@actionline=\absline@num
5939 \ifnum\next@action>-1001\relax
5940 \global\advance\ballast@count by -\c@ballast
5941 \fi
5942 \fi
5943 \endgroup}
5944 % \end{macrocode}
5945 % \end{macro}
5946 %
5947 % \begin{macro}{\do@actions}
5948 % \begin{macro}{\do@actions@next}
5949 %
5950 % The \cs{do@actions} macro
5951 % looks at the list of actions to take at particular absolute line
5952 % numbers, and does everything that's specified for the current line.
5953 %
5954 % It may call itself recursively, and to do this efficiently (using
5955 % \TeX's optimization for tail recursion), we define a control-sequence
5956 % called \cs{do@actions@next} that is always the last thing that
5957 % \cs{do@actions} does. If there could be more actions to process for
5958 % this line, \cs{do@actions@next} is set equal to \cs{do@actions};
5959 % otherwise it's just \cs{relax}.
5960 % \changes{v0.7}{2005/02/22}{Added number skipping to \cs{do@actions}}
5961 % \begin{macrocode}
5962 \newcommand*{\do@actions}{%
5963 \global\let\do@actions@next=\relax
5964 \ifnum\absline@num<\next@actionline\else
5965 % \end{macrocode}
5966 %
5967 % First, page number changes, which will generally be the most common
5968 % actions. If we're restarting lineation on each page, this is where it
5969 % happens.
5970 % \begin{macrocode}
5971 \ifnum\next@action>-1001
5972 \global\page@num=\next@action
5973 \ifbypage@
5974 \global\line@num=\z@ \global\subline@num=\z@
5975 \fi
5976 % \end{macrocode}
5977 %
5978 % Next, we handle
5979 % commands that change the line-number values. (We subtract $5001$ rather
5980 % than $5000$ here because the line number is going to be incremented
5981 % automatically in \cs{getline@num}.)
5982 % \begin{macrocode}
5983 \else
5984 \ifnum\next@action<-4999
5985 \@l@dtempcnta=-\next@action
5986 \advance\@l@dtempcnta by -5001
5987 \ifsublines@
5988 \global\subline@num=\@l@dtempcnta
5989 \else
5990 \global\line@num=\@l@dtempcnta
5991 \fi
5992 % \end{macrocode}
5993 %
5994 % It's one of the fixed codes. We rescale the value in
5995 % \cs{@l@dtempcnta} so that we can use a case statement.
5996 % \begin{macrocode}
5997 \else
5998 \@l@dtempcnta=-\next@action
5999 \advance\@l@dtempcnta by -1000
6000 \do@actions@fixedcode
6001 \fi
6002 \fi
6003 % \end{macrocode}
6004 %
6005 % Now we get information about the next action off the list,
6006 % and then set \cs{do@actions@next} so that we'll
6007 % call ourself recursively: the next action might also be for this
6008 % line.
6009 %
6010 % There's no warning if we find \cs{actionlines@list} empty,
6011 % since that will always happen near the end of the section.
6012 %
6013 % \begin{macrocode}
6014 \ifx\actionlines@list\empty
6015 \gdef\next@actionline{1000000}%
6016 \else
6017 \gl@p\actionlines@list\to\next@actionline
6018 \gl@p\actions@list\to\next@action
6019 \global\let\do@actions@next=\do@actions
6020 \fi
6021 \fi
6022 % \end{macrocode}
6023 %
6024 % Make the recursive call, if necessary.
6025 %
6026 % \begin{macrocode}
6027 \do@actions@next}
6028
6029 % \end{macrocode}
6030 % \end{macro}
6031 % \end{macro}
6032 % \begin{macro}{\do@actions@fixedcode}
6033 % This macro handles the fixed codes for \cs{do@actions}. It is
6034 % one big case statement.
6035 % \changes{v0.7}{2005/02/24}{Added \cs{do@actions@fixedcode}}
6036 % \begin{macrocode}
6037 \newcommand*{\do@actions@fixedcode}{%
6038 \ifcase\@l@dtempcnta
6039 \or% % 1001
6040 \global\sublines@true
6041 \or% % 1002
6042 \global\sublines@false
6043 \or% % 1003
6044 \global\@lock=\@ne
6045 \or% % 1004
6046 \ifnum\@lock=\tw@
6047 \global\@lock=\thr@@
6048 \else
6049 \global\@lock=\z@
6050 \fi
6051 \or% % 1005
6052 \global\sub@lock=\@ne
6053 \or% % 1006
6054 \ifnum\sub@lock=\tw@
6055 \global\sub@lock=\thr@@
6056 \else
6057 \global\sub@lock=\z@
6058 \fi
6059 \or% % 1007
6060 \l@dskipnumbertrue
6061 \else
6062 \led@warn@BadAction
6063 \fi}
6064
6065
6066 % \end{macrocode}
6067 % \end{macro}
6068 % \subsection{Line number printing}
6069 %
6070 % \begin{macro}{\affixline@num}
6071 % \begin{PW}
6072 % \cs{affixline@num} originally took a single argument, a series of
6073 % commands for printing the line just split off by \cs{do@line}; it
6074 % put that line back on the vertical list, and added a line number if
6075 % necessary. It now just puts a left line number into \cs{l@dld@ta}
6076 % or a right line number into \cs{l@drd@ta} if required.
6077 % \end{PW}
6078 %
6079 % To determine whether we need to affix a line number to this line,
6080 % we compute the following:
6081 % \begin{tabbing}
6082 % \quad $m$ \= \kill
6083 % $n$ \> $= \mbox{\it int\/} ( ( \mbox{\it linenum\/} -
6084 % \mbox{\it firstlinenum\/} ) /
6085 % \mbox{\it linenumincrement\/} )$ \\
6086 % $m$ \> $= \mbox{\it firstlinenum\/} +
6087 % ( n \times \mbox{\it linenumincrement\/})$
6088 % \end{tabbing}
6089 % (where {\it int\/} truncates a real number to an integer).
6090 % $m$ will be equal to {\it linenum\/} only
6091 % if we're to paste a number on here.
6092 % However, the formula breaks down for the first line to number (and any
6093 % before that), so we check that case separately: if \cs{line@num} $\le$
6094 % \cs{firstlinenum}, we compare the two directly instead of making these
6095 % calculations.
6096 %
6097 % We compute, in the scratch counter \cs{@l@dtempcnta}, the number
6098 % of the next line that should be printed with a number ($m$ in the
6099 % above discussion), and move the current line number into the
6100 % counter \cs{@l@dtempcntb} for comparison.
6101 %
6102 % \begin{PW}
6103 % Remember that some counts are now counters!
6104 % \end{PW}
6105 %
6106 % First, the case when we're within a sub-line range.
6107 % \changes{v0.5.1}{2004/04/10}{Changed \cs{affixline@num} to cater for sidenotes}
6108 % \changes{v0.7}{2005/02/22}{Added skipnumering to \cs{affixline@num}}
6109 % \begin{macrocode}
6110 \newcommand*{\affixline@num}{%
6111 % \end{macrocode}
6112 % No number is attached if \cs{ifl@dskipnumber} is TRUE (and then it
6113 % is set to its normal FALSE value).
6114 % No number is attached if \cs{ifnumberline} is FALSE (the normal value is TRUE).
6115 % \changes{v0.15}{2012/06/11}{Line numbering can be disabled.}
6116 % \begin{macrocode}
6117 \ifnumberline
6118 \ifl@dskipnumber
6119 \global\l@dskipnumberfalse
6120 \else
6121 \ifsublines@
6122 \@l@dtempcntb=\subline@num
6123 \ifnum\subline@num>\c@firstsublinenum
6124 \@l@dtempcnta=\subline@num
6125 \advance\@l@dtempcnta by-\c@firstsublinenum
6126 \divide\@l@dtempcnta by\c@sublinenumincrement
6127 \multiply\@l@dtempcnta by\c@sublinenumincrement
6128 \advance\@l@dtempcnta by\c@firstsublinenum
6129 \else
6130 \@l@dtempcnta=\c@firstsublinenum
6131 \fi
6132 % \end{macrocode}
6133 %
6134 % That takes care of computing the values for comparison, but if line
6135 % number locking is in effect we have to make a further check. If this
6136 % check fails, then we disable the line-number display by setting the
6137 % counters to arbitrary but unequal values.
6138 % \begin{macrocode}
6139 \ch@cksub@l@ck
6140 % \end{macrocode}
6141 %
6142 % Now the line number case, which works the same way.
6143 % \begin{macrocode}
6144 \else
6145 \@l@dtempcntb=\line@num
6146 % \end{macrocode}
6147 % \begin{PW}
6148 % Check on the \verb?\linenumberlist? If it's \verb?\empty? use the standard
6149 % algorithm.
6150 % \end{PW}
6151 % \begin{macrocode}
6152 \ifx\linenumberlist\empty
6153 \ifnum\line@num>\c@firstlinenum
6154 \@l@dtempcnta=\line@num
6155 \advance\@l@dtempcnta by-\c@firstlinenum
6156 \divide\@l@dtempcnta by\c@linenumincrement
6157 \multiply\@l@dtempcnta by\c@linenumincrement
6158 \advance\@l@dtempcnta by\c@firstlinenum
6159 \else
6160 \@l@dtempcnta=\c@firstlinenum
6161 \fi
6162 \else
6163 % \end{macrocode}
6164 % \begin{PW}
6165 % The \verb?\linenumberlist? wasn't \verb?\empty?, so here's Wayne's
6166 % numbering mechanism. This takes place in TeX's mouth.
6167 % \end{PW}
6168 % \begin{macrocode}
6169 \@l@dtempcnta=\line@num
6170 \edef\rem@inder{,\linenumberlist,\number\line@num,}%
6171 \edef\sc@n@list{\def\noexpand\sc@n@list
6172 ####1,\number\@l@dtempcnta,####2|{\def\noexpand\rem@inder{####2}}}%
6173 \sc@n@list\expandafter\sc@n@list\rem@inder|%
6174 \ifx\rem@inder\empty\advance\@l@dtempcnta\@ne\fi
6175 \fi
6176 % \end{macrocode}
6177 %
6178 %
6179 % A locking check for lines, just like the version for sub-line
6180 % numbers above.
6181 % \begin{macrocode}
6182 \ch@ck@l@ck
6183 \fi
6184 % \end{macrocode}
6185 %
6186 % The following test is true if we need to print a line number.
6187 % \begin{macrocode}
6188 \ifnum\@l@dtempcnta=\@l@dtempcntb
6189 % \end{macrocode}
6190 %
6191 % If we got here,
6192 % we're going to print a line number; so now we need to
6193 % calculate a number that will tell us which side of the page will get
6194 % the line number. We start from \cs{line@margin}, which asks for
6195 % one side always if it's less than $2$; and then if the side does
6196 % depend on the page number, we simply add the page number to this
6197 % side code---because the values of \cs{line@margin} have been devised so
6198 % that this produces a number that's even for left-margin numbers and
6199 % odd for right-margin numbers.
6200 %
6201 % \begin{PW}
6202 % For LaTeX we have to consider two column documents as well. In this case
6203 % I think we need to put the numbers at the outside of the column ---
6204 % the left of the first column and the right of the second. Do the twocolumn
6205 % stuff before going on with the original code.
6206 % \end{PW}
6207 % \begin{macro}{\l@dld@ta}
6208 % \begin{macro}{\l@drd@ta}
6209 % \begin{PW}
6210 % A left line number is stored in \cs{l@dld@ta} and a right one in
6211 % \cs{l@drd@ta}.
6212 % \end{PW}
6213 %
6214 % \begin{macrocode}
6215 \if@twocolumn
6216 \if@firstcolumn
6217 \gdef\l@dld@ta{\llap{{\leftlinenum}}}%
6218 \else
6219 \gdef\l@drd@ta{\rlap{{\rightlinenum}}}%
6220 \fi
6221 \else
6222 % \end{macrocode}
6223 % Continuing the original code \ldots
6224 % \begin{macrocode}
6225 \@l@dtempcntb=\line@margin
6226 \ifnum\@l@dtempcntb>\@ne
6227 \advance\@l@dtempcntb \page@num
6228 \fi
6229 % \end{macrocode}
6230 %
6231 % Now print the line (\verb"#1") with its page number.
6232 % \begin{macrocode}
6233 \ifodd\@l@dtempcntb
6234 \gdef\l@drd@ta{\rlap{{\rightlinenum}}}%
6235 \else
6236 \gdef\l@dld@ta{\llap{{\leftlinenum}}}%
6237 \fi
6238 \fi
6239 \else
6240 % \end{macrocode}
6241 %
6242 % As no line number is to be appended, we just print the line as is.
6243 % \begin{macrocode}
6244 %% #1%
6245 \fi
6246 % \end{macrocode}
6247 % \end{macro}
6248 % \end{macro}
6249 %
6250 % Now fix the lock counters, if necessary.
6251 % A value of $1$ is advanced to
6252 % $2$; $3$ advances to $0$; other values are unchanged.
6253 % \begin{macrocode}
6254 \f@x@l@cks
6255 \fi
6256 \fi
6257 }
6258
6259 % \end{macrocode}
6260 % \end{macro}
6261 %
6262 % \begin{macro}{\ch@cksub@l@ck}
6263 % \begin{macro}{\ch@ck@l@ck}
6264 % \begin{macro}{\f@x@l@cks}
6265 % These macros handle line number locking for \cs{affixline@num}.
6266 % \changes{v0.7}{2005/02/24}{Added \cs{ch@cksub@l@ck}, \cs{ch@ck@l@ck}
6267 % and \cs{f@x@l@cks}}
6268 % \cs{ch@cksub@l@ck} checks subline locking. If it fails, then we disable
6269 % the line-number display by setting the counters to arbitrary but unequal
6270 % values.
6271 % \begin{macrocode}
6272 \newcommand*{\ch@cksub@l@ck}{%
6273 \ifcase\sub@lock
6274 \or
6275 \ifnum\sublock@disp=\@ne
6276 \@l@dtempcntb=\z@ \@l@dtempcnta=\@ne
6277 \fi
6278 \or
6279 \ifnum\sublock@disp=\tw@ \else
6280 \@l@dtempcntb=\z@ \@l@dtempcnta=\@ne
6281 \fi
6282 \or
6283 \ifnum\sublock@disp=\z@
6284 \@l@dtempcntb=\z@ \@l@dtempcnta=\@ne
6285 \fi
6286 \fi}
6287 % \end{macrocode}
6288 % Similarly for line numbers.
6289 % \begin{macrocode}
6290 \newcommand*{\ch@ck@l@ck}{%
6291 \ifcase\@lock
6292 \or
6293 \ifnum\lock@disp=\@ne
6294 \@l@dtempcntb=\z@ \@l@dtempcnta=\@ne
6295 \fi
6296 \or
6297 \ifnum\lock@disp=\tw@ \else
6298 \@l@dtempcntb=\z@ \@l@dtempcnta=\@ne
6299 \fi
6300 \or
6301 \ifnum\lock@disp=\z@
6302 \@l@dtempcntb=\z@ \@l@dtempcnta=\@ne
6303 \fi
6304 \fi}
6305 % \end{macrocode}
6306 % Fix the lock counters.
6307 % A value of $1$ is advanced to
6308 % $2$; $3$ advances to $0$; other values are unchanged.
6309 % \begin{macrocode}
6310 \newcommand*{\f@x@l@cks}{%
6311 \ifcase\@lock
6312 \or
6313 \global\@lock=\tw@
6314 \or \or
6315 \global\@lock=\z@
6316 \fi
6317 \ifcase\sub@lock
6318 \or
6319 \global\sub@lock=\tw@
6320 \or \or
6321 \global\sub@lock=\z@
6322 \fi}
6323
6324 % \end{macrocode}
6325 % \end{macro}
6326 % \end{macro}
6327 % \end{macro}
6328 %
6329 %
6330 %
6331 %
6332 % \begin{PW}
6333 % \begin{macro}{\pageparbreak}
6334 % Because of TeX's asynchronous page breaking mechanism we can never be
6335 % sure juust where it will make a break and, naturally, it has already decided
6336 % exactly how it will typeset any remainder of a paragraph that crosses
6337 % the break. This is disconcerting when trying to number lines by the page
6338 % or put line numbers in different margins. This macro tries to force an invisible
6339 % paragraph break and a page break.
6340 % \begin{macrocode}
6341 \newcommand{\pageparbreak}{\pend\newpage\pstart\noindent}
6342
6343 % \end{macrocode}
6344 % \end{macro}
6345 % \end{PW}
6346 %
6347 % \subsection{Pstart number printing in side}
6348 % In side, the printing of pstart number is running like the printing of line number. There is only some differences :
6349 % \begin{macro}{\affixpstart@num}
6350 % \begin{macro}{\pstartnum}
6351 % \begin{itemize}
6352 % \item The pstarts counter is upgrade in the \cs{pend} command. Consequently, the \cs{affixpstart@num} command has not to upgrade it, unlike the \cs{affixline@num} which upgrades the lines counter.
6353 % \item To print the pstart number only at the begining of a pstart, and not in every line, a boolean test is made. The \cs{pstartnum} boolean is set to TRUE at every \cs{pend}. It's tried in the \cs{leftpstartnum} and \cs{rightstartnum} commands. After the try, it is set to FALSE.
6354 % \end{itemize}
6355 % \begin{macro}{\leftpstartnum}
6356 % \begin{macro}{\rightstartnum}
6357 % \begin{macro}{\ifsidepstartnum}
6358 % \begin{macrocode}
6359
6360 \newif\ifsidepstartnum
6361 \newcommand*{\affixpstart@num}{%
6362 \ifsidepstartnum
6363 \if@twocolumn
6364 \if@firstcolumn
6365 \gdef\l@dld@ta{\llap{{\leftpstartnum}}}%
6366 \else
6367 \gdef\l@drd@ta{\rlap{{\rightpstartnum}}}%
6368 \fi
6369 \else
6370 \@l@dtempcntb=\line@margin
6371 \ifnum\@l@dtempcntb>\@ne
6372 \advance\@l@dtempcntb \page@num
6373 \fi
6374 \ifodd\@l@dtempcntb
6375 \gdef\l@drd@ta{\rlap{{\rightpstartnum}}}%
6376 \else
6377 \gdef\l@dld@ta{\llap{{\leftpstartnum}}}%
6378 \fi
6379 \fi
6380 \fi
6381
6382 }
6383 %
6384
6385 \newif\ifpstartnum
6386 \pstartnumtrue
6387 \newcommand*{\leftpstartnum}{
6388 \ifpstartnum\thepstart
6389 \kern\linenumsep\fi
6390 \global\pstartnumfalse
6391 }
6392 \newcommand*{\rightpstartnum}{
6393 \ifpstartnum
6394 \kern\linenumsep
6395 \thepstart
6396 \fi
6397 \global\pstartnumfalse
6398 }
6399 % \end{macrocode}
6400 % \end{macro}
6401 % \end{macro}
6402 % \end{macro}
6403 % \end{macro}
6404 % \end{macro}
6405 % \subsection{Add insertions to the vertical list}
6406 %
6407 % \begin{macro}{\inserts@list}
6408 % \cs{inserts@list} is the list macro that contains the inserts that
6409 % we save up for one paragraph.
6410 %
6411 % \begin{macrocode}
6412 \list@create{\inserts@list}
6413 % \end{macrocode}
6414 % \end{macro}
6415 %
6416 % \begin{macro}{\add@inserts}
6417 % \begin{macro}{\add@inserts@next}
6418 % \cs{add@inserts}
6419 % is the penultimate macro used by \cs{do@line}; it takes
6420 % insertions saved in a list macro and sends them onto the vertical list.
6421 %
6422 % It may call itself recursively, and to do this efficiently (using
6423 % \TeX's optimization for tail recursion), we define a control-sequence
6424 % called \cs{add@inserts@next} that is always the last thing that
6425 % \cs{add@inserts} does. If there could be more inserts to process for
6426 % this line, \cs{add@inserts@next} is set equal to \cs{add@inserts};
6427 % otherwise it's just \cs{relax}.
6428 %
6429 % \begin{macrocode}
6430 \newcommand*{\add@inserts}{%
6431 \global\let\add@inserts@next=\relax
6432 % \end{macrocode}
6433 %
6434 % If \cs{inserts@list} is empty, there aren't any more notes or insertions
6435 % for this paragraph, and we needn't waste our time.
6436 % \begin{macrocode}
6437 \ifx\inserts@list\empty \else
6438 % \end{macrocode}
6439 %
6440 % The \cs{next@insert} macro records the number of the line that
6441 % receives the next footnote or other insert; it's empty when we start
6442 % out, and just after we've affixed a note or insert.
6443 % \begin{macrocode}
6444 \ifx\next@insert\empty
6445 \ifx\insertlines@list\empty
6446 \global\noteschanged@true
6447 \gdef\next@insert{100000}%
6448 \else
6449 \gl@p\insertlines@list\to\next@insert
6450 \fi
6451 \fi
6452 % \end{macrocode}
6453 %
6454 % If the next insert's for this line, tack it on (and then erase the
6455 % contents of the insert macro, as it could be quite large).
6456 % In that case, we also set \cs{add@inserts@next} so that we'll
6457 % call ourself recursively: there might be another insert for this same
6458 % line.
6459 %
6460 % \begin{macrocode}
6461 \ifnum\next@insert=\absline@num
6462 \gl@p\inserts@list\to\@insert
6463 \@insert
6464 \global\let\@insert=\undefined
6465 \global\let\next@insert=\empty
6466 \global\let\add@inserts@next=\add@inserts
6467 \fi
6468 \fi
6469 % \end{macrocode}
6470 %
6471 % Make the recursive call, if necessary.
6472 %
6473 % \begin{macrocode}
6474 \add@inserts@next}
6475
6476 % \end{macrocode}
6477 % \end{macro}
6478 % \end{macro}
6479 %
6480 % \subsection{Penalties}
6481 %
6482 % \begin{macro}{\add@penalties}
6483 % \cs{add@penalties} is
6484 % the last macro used by \cs{do@line}. It adds up the club,
6485 % widow, and interline penalties, and puts a single penalty
6486 % of the appropriate size
6487 % back into the paragraph; these penalties get
6488 % removed by the \cs{vsplit} operation. \cs{displaywidowpenalty} and
6489 % \cs{brokenpenalty} are not restored, since we have no easy way to
6490 % find out where we should insert them.
6491 %
6492 % \phantomsection\label{add@penalties}
6493 % In this code, \cs{num@lines} is the number of lines in the whole
6494 % paragraph, and \cs{par@line} is the line we're working on at the
6495 % moment. The count \cs{@l@dtempcnta} is used to calculate and
6496 % accumulate the penalty; it is initially set to the value of
6497 % \cs{ballast@count}, which has been worked out in \cs{do@ballast}
6498 % above (p.\,\pageref{do@ballast}). Finally, the penalty is
6499 % checked to see that it doesn't go below $-10000$.
6500 % \begin{macrocode}
6501 \newcommand*{\add@penalties}{\@l@dtempcnta=\ballast@count
6502 \ifnum\num@lines>\@ne
6503 \global\advance\par@line \@ne
6504 \ifnum\par@line=\@ne
6505 \advance\@l@dtempcnta \clubpenalty
6506 \fi
6507 \@l@dtempcntb=\par@line \advance\@l@dtempcntb \@ne
6508 \ifnum\@l@dtempcntb=\num@lines
6509 \advance\@l@dtempcnta \widowpenalty
6510 \fi
6511 \ifnum\par@line<\num@lines
6512 \advance\@l@dtempcnta \interlinepenalty
6513 \fi
6514 \fi
6515 \ifnum\@l@dtempcnta=\z@
6516 \relax
6517 \else
6518 \ifnum\@l@dtempcnta>-10000
6519 \penalty\@l@dtempcnta
6520 \else
6521 \penalty -10000
6522 \fi
6523 \fi}
6524
6525 % \end{macrocode}
6526 % \end{macro}
6527 %
6528 % \subsection{Printing leftover notes}
6529 %
6530 % \begin{macro}{\flush@notes}
6531 % The \cs{flush@notes}
6532 % macro is called after the entire paragraph has been sliced up
6533 % and sent on to the vertical list.
6534 % If the number of notes to this paragraph has increased since the last
6535 % run of \TeX, then there can be leftover notes that haven't yet been
6536 % printed. An appropriate error message will be printed elsewhere; but
6537 % it's best to go ahead and
6538 % print these notes somewhere, even if it's not in quite the
6539 % right place. What we do is dump them all out here, so that they should
6540 % be printed on the same page as the last line
6541 % of the paragraph. We can hope that's not
6542 % too far from the proper location, to which they'll move on the next
6543 % run.
6544 % \begin{macrocode}
6545 \newcommand*{\flush@notes}{%
6546 \@xloop
6547 \ifx\inserts@list\empty \else
6548 \gl@p\inserts@list\to\@insert
6549 \@insert
6550 \global\let\@insert=\undefined
6551 \repeat}
6552
6553 % \end{macrocode}
6554 % \end{macro}
6555 %
6556 % \begin{macro}{\@xloop}
6557 % \cs{@xloop} is
6558 % a variant of the \PlainTeX\ \cs{loop} macro, useful when it's
6559 % hard to construct a positive test using the \TeX\ \verb"\if" commands---as
6560 % in \cs{flush@notes} above. One says \cs{@xloop} \verb"..." \verb"\if" \verb"..." \verb"\else"
6561 % \verb"..." \verb"\repeat", and the action following \verb"\else" is repeated as long
6562 % as the \verb"\if" test fails. (This macro will work wherever the \PlainTeX\
6563 % \cs{loop} is used, too, so we could just call it \cs{loop};
6564 % but it seems preferable not to change the definitions of any of
6565 % the standard macros.)
6566 %
6567 % This variant of \cs{loop} was introduced by
6568 % Alois Kabelschacht\index{Kabelschacht, Alois} in
6569 % \textit{TUGboat} \textbf{8} (1987), pp.\,184--5.
6570 %
6571 % \begin{macrocode}
6572 \def\@xloop#1\repeat{%
6573 \def\body{#1\expandafter\body\fi}%
6574 \body}
6575
6576 % \end{macrocode}
6577 % \end{macro}
6578 %
6579 % \section{Footnotes}
6580 % \label{footnotes}\relax
6581 %
6582 % The footnote macros are adapted from those in \PlainTeX, but they
6583 % differ in these respects: the outer-level commands must add other
6584 % commands to a list macro rather than doing insertions immediately;
6585 % there are five separate levels of footnotes, not just one; and there
6586 % are options to reformat footnotes into paragraphs or into multiple
6587 % columns.
6588 %
6589 % \subsection{Fonts}
6590 % \label{fontcode}\relax
6591 % Before getting into the details of formatting the notes, we set
6592 % up some font macros. It is the notes that present the greatest
6593 % challenge for our font-handling mechanism, because we need to be
6594 % able to take fragments of our main text and print them in
6595 % different forms: it is common to reduce the size,
6596 % for example, without otherwise changing the fonts used.
6597 %
6598 % \begin{PW}I have deleted all Plain Font-related code and just keept
6599 % the code for NFSS font handling.\end{PW}
6600 %
6601 % \begin{macro}{\notefontsetup}
6602 % The font setup defined in \cs{notefontsetup} defines the standard
6603 % fonts for the text of the footnotes. Parts of the footnote, such
6604 % as the line number references and the lemma, are enclosed in
6605 % groups, with their own font macros, so a note in plain roman can
6606 % still have line numbers in bold, say, and the lemma in the same
6607 % font encoding, family, series, and shape
6608 % of font as in the main text. Typically this definition should
6609 % specify only a size.
6610 %
6611 % \begin{PW}
6612 % The original font for \cs{notefontsetup} effectively maps to LaTeX
6613 % \cs{footnotesize} for a 10pt document.
6614 % \end{PW}
6615 %
6616 % \begin{macrocode}
6617 \newcommand*{\notefontsetup}{\footnotesize}
6618 % \end{macrocode}
6619 % \end{macro}
6620 %
6621 % \begin{macro}{\notenumfont}
6622 % The line numbers will be printed using the font selected by
6623 % executing \cs{notenumfont}.
6624 %
6625 % \begin{PW}
6626 % The original font for \cs{notenumfont} maps to LaTeX \cs{scriptsize}
6627 % for a 10pt document. However, the description in the user guide does
6628 % not seem to match the definition (the usage guide says that the
6629 % size is \cs{notefontsetup}).
6630 % \end{PW}
6631 % \begin{macrocode}
6632 \newcommand*{\notenumfont}{\normalfont}
6633 % \end{macrocode}
6634 % \end{macro}
6635 %
6636 % \begin{macro}{\select@lemmafont}
6637 % \begin{macro}{\select@@lemmafont}
6638 % \cs{select@lemmafont} is provided to set the right font for
6639 % the lemma in a note. This macro extracts the font specifier
6640 % from the line and page number cluster, and issues the associated
6641 % font-changing command, so that the lemma is printed in its
6642 % original font.
6643 % \begin{macrocode}
6644 \def\select@lemmafont#1|#2|#3|#4|#5|#6|#7|{\select@@lemmafont#7|}
6645 \def\select@@lemmafont#1/#2/#3/#4|%
6646 {\fontencoding{#1}\fontfamily{#2}\fontseries{#3}\fontshape{#4}%
6647 \selectfont}
6648
6649 % \end{macrocode}
6650 % \end{macro}
6651 % \end{macro}
6652 %
6653 %
6654 % \subsection{Outer-level footnote commands}
6655 % \begin{macro}{\Afootnote}
6656 % The outer-level footnote commands will look familiar: they're
6657 % just called \cs{Afootnote}, \cs{Bfootnote}, etc., instead of
6658 % plain \cs{footnote}. What they do, however, is quite different,
6659 % since they have to operate in conjunction with \cs{critext} when
6660 % numbering is in effect.
6661 %
6662 % If we're within a line-numbered paragraph, then, we tack this note onto
6663 % the \cs{inserts@list} list, and increment the deferred-page-bottom-note
6664 % counter.
6665 % \begin{macrocode}
6666 \newcommand*{\Afootnote}[1]{%
6667 \ifnumberedpar@
6668 \xright@appenditem{\noexpand\vAfootnote{A}%
6669 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list
6670 \global\advance\insert@count \@ne
6671 % \end{macrocode}
6672 %
6673 % Within free text, there's no need to put off making the insertion
6674 % for this note. No line numbers are available, so this isn't generally
6675 % that useful; but you might want to use it to get around some
6676 % limitation of \Ledmac.
6677 % \begin{macrocode}
6678 \else
6679 \vAfootnote{A}{{0|0|0|0|0|0|0}{}{#1}}%
6680 \fi\ignorespaces}
6681 % \end{macrocode}
6682 % \end{macro}
6683 %
6684 % \begin{macro}{\Bfootnote}
6685 % \begin{macro}{\Cfootnote}
6686 % \begin{macro}{\Dfootnote}
6687 % \begin{macro}{\Efootnote}
6688 % We need similar commands for the other footnote series.
6689 % \begin{macrocode}
6690 \newcommand*{\Bfootnote}[1]{%
6691 \ifnumberedpar@
6692 \xright@appenditem{\noexpand\vBfootnote{B}%
6693 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list
6694 \global\advance\insert@count \@ne
6695 \else
6696 \vBfootnote{B}{{0|0|0|0|0|0|0}{}{#1}}%
6697 \fi\ignorespaces}
6698 % \end{macrocode}
6699 % \begin{macrocode}
6700 \newcommand*{\Cfootnote}[1]{%
6701 \ifnumberedpar@
6702 \xright@appenditem{\noexpand\vCfootnote{C}%
6703 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list
6704 \global\advance\insert@count \@ne
6705 \else
6706 \vCfootnote{C}{{0|0|0|0|0|0|0}{}{#1}}%
6707 \fi\ignorespaces}
6708 % \end{macrocode}
6709 % \begin{macrocode}
6710 \newcommand*{\Dfootnote}[1]{%
6711 \ifnumberedpar@
6712 \xright@appenditem{\noexpand\vDfootnote{D}%
6713 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list
6714 \global\advance\insert@count \@ne
6715 \else
6716 \vDfootnote{D}{{0|0|0|0|0|0|0}{}{#1}}%
6717 \fi\ignorespaces}
6718 % \end{macrocode}
6719 % \begin{macrocode}
6720 \newcommand*{\Efootnote}[1]{%
6721 \ifnumberedpar@
6722 \xright@appenditem{\noexpand\vEfootnote{E}%
6723 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list
6724 \global\advance\insert@count \@ne
6725 \else
6726 \vEfootnote{E}{{0|0|0|0|0|0|0}{}{#1}}%
6727 \fi\ignorespaces}
6728
6729 % \end{macrocode}
6730 % \end{macro}
6731 % \end{macro}
6732 % \end{macro}
6733 % \end{macro}
6734 %
6735 % \begin{PW}
6736 % \begin{macro}{\mpAfootins}
6737 % \begin{macro}{\mpBfootins}
6738 % \begin{macro}{\mpCfootins}
6739 % \begin{macro}{\mpDfootins}
6740 % \begin{macro}{\mpEfootins}
6741 % For footnotes in minipages and the like, we need a new set of inserts.
6742 % \changes{v0.4}{2004/02/29}{Added \cs{mpAfootins} and friends}
6743 % \begin{macrocode}
6744 \newinsert\mpAfootins
6745 \newinsert\mpBfootins
6746 \newinsert\mpCfootins
6747 \newinsert\mpDfootins
6748 \newinsert\mpEfootins
6749
6750 % \end{macrocode}
6751 % \end{macro}
6752 % \end{macro}
6753 % \end{macro}
6754 % \end{macro}
6755 % \end{macro}
6756 %
6757 % \begin{macro}{\mpAfootnote}
6758 % \begin{macro}{\mpBfootnote}
6759 % \begin{macro}{\mpCfootnote}
6760 % \begin{macro}{\mpDfootnote}
6761 % \begin{macro}{\mpEfootnote}
6762 % For footnotes in minipages and the like, we need a similar series of commands.
6763 % \changes{v0.4}{2004/02/29}{Added \cs{mpAfootnote} and friends}
6764 % \begin{macrocode}
6765 \newcommand*{\mpAfootnote}[1]{%
6766 \ifnumberedpar@
6767 \xright@appenditem{\noexpand\mpvAfootnote{A}%
6768 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list
6769 \global\advance\insert@count \@ne
6770 \else
6771 \mpvAfootnote{A}{{0|0|0|0|0|0|0}{}{#1}}%
6772 \fi\ignorespaces}
6773 % \end{macrocode}
6774 % \begin{macrocode}
6775 \newcommand*{\mpBfootnote}[1]{%
6776 \ifnumberedpar@
6777 \xright@appenditem{\noexpand\mpvBfootnote{B}%
6778 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list
6779 \global\advance\insert@count \@ne
6780 \else
6781 \mpvBfootnote{B}{{0|0|0|0|0|0|0}{}{#1}}%
6782 \fi\ignorespaces}
6783 % \end{macrocode}
6784 % \begin{macrocode}
6785 \newcommand*{\mpCfootnote}[1]{%
6786 \ifnumberedpar@
6787 \xright@appenditem{\noexpand\mpvCfootnote{C}%
6788 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list
6789 \global\advance\insert@count \@ne
6790 \else
6791 \mpvCfootnote{C}{{0|0|0|0|0|0|0}{}{#1}}%
6792 \fi\ignorespaces}
6793 % \end{macrocode}
6794 % \begin{macrocode}
6795 \newcommand*{\mpDfootnote}[1]{%
6796 \ifnumberedpar@
6797 \xright@appenditem{\noexpand\mpvDfootnote{D}%
6798 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list
6799 \global\advance\insert@count \@ne
6800 \else
6801 \mpvDfootnote{D}{{0|0|0|0|0|0|0}{}{#1}}%
6802 \fi\ignorespaces}
6803 % \end{macrocode}
6804 % \begin{macrocode}
6805 \newcommand*{\mpEfootnote}[1]{%
6806 \ifnumberedpar@
6807 \xright@appenditem{\noexpand\mpvEfootnote{E}%
6808 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list
6809 \global\advance\insert@count \@ne
6810 \else
6811 \mpvEfootnote{E}{{0|0|0|0|0|0|0}{}{#1}}%
6812 \fi\ignorespaces}
6813 % \end{macrocode}
6814 % \end{macro}
6815 % \end{macro}
6816 % \end{macro}
6817 % \end{macro}
6818 % \end{macro}
6819 %
6820 %
6821 % \end{PW}
6822 %
6823 % \subsection{Normal footnote formatting} \label{sec:nfootformat}
6824 %
6825 % The processing of each note is done
6826 % by four principal macros: the \cs{vfootnote} macro takes the text
6827 % of the footnote and does the \cs{insert}; it calls on the
6828 % \cs{footfmt} macro to select the right fonts, print the line
6829 % number and lemma, and do any other formatting needed for that individual
6830 % note. Within the output routine, the two other macros, \cs{footstart}
6831 % and \cs{footgroup}, are called; the first prints extra vertical
6832 % space and a footnote rule, if desired; the second does any reformatting
6833 % of the whole set of footnotes in this series for this page---such
6834 % as paragraphing or division into columns---and then sends them to the
6835 % page.
6836 %
6837 % These four macros, and the other macros and parameters shown
6838 % here, are distinguished by the `series letter'
6839 % that indicates which set of footnotes
6840 % we're dealing with---\texttt{A}, \texttt{B}, \texttt{C}, \texttt{D}, or \texttt{E}.
6841 % The series letter always precedes the string \verb"foot" in macro
6842 % and parameter names. Hence, for the \texttt{A} series, the four macros
6843 % are called \cs{vAfootnote}, \cs{Afootfmt}, \cs{Afootstart},
6844 % and \cs{Afootgroup}.
6845 %
6846 % \begin{macro}{\normalvfootnote}
6847 % We now begin a series of commands that do `normal' footnote
6848 % formatting: a format much like that implemented
6849 % in \PlainTeX{}, in which each footnote
6850 % is a separate paragraph.
6851 %
6852 % \cs{normalvfootnote} takes the series letter as \verb"#1",
6853 % and the entire text of the footnote is \verb"#2". It does the
6854 % \cs{insert} for this note, calling on the \cs{footfmt} macro for
6855 % this note series to format the text of the note.
6856 % \begin{macrocode}
6857 \newcommand*{\normalvfootnote}[2]{%
6858 \insert\csname #1footins\endcsname\bgroup
6859 \notefontsetup
6860 \footsplitskips
6861 \spaceskip=\z@skip \xspaceskip=\z@skip
6862 \csname #1footfmt\endcsname #2\egroup}
6863 % \end{macrocode}
6864 % \end{macro}
6865 %
6866 % \begin{PW}
6867 % \begin{macro}{\footsplitskips}
6868 % Some setup code that is common for a variety of footnotes.
6869 % \changes{v0.7}{2005/02/18}{Added \cs{footsplitskips} for use in many
6870 % footnote styles}
6871 % \begin{macrocode}
6872 \newcommand*{\footsplitskips}{%
6873 \interlinepenalty=\interfootnotelinepenalty
6874 \floatingpenalty=\@MM
6875 \splittopskip=\ht\strutbox \splitmaxdepth=\dp\strutbox
6876 \leftskip=\z@skip \rightskip=\z@skip}
6877
6878 % \end{macrocode}
6879 % \end{macro}
6880 % \end{PW}
6881 %
6882 % \begin{PW}
6883 % \begin{macro}{\mpnormalvfootnote}
6884 % And a somewhat different version for minipages.
6885 % \changes{v0.4}{2004/02/29}{Added \cs{mpnormalvfootnote}}
6886 % \begin{macrocode}
6887 \newcommand*{\mpnormalvfootnote}[2]{%
6888 \global\setbox\@nameuse{mp#1footins}\vbox{%
6889 \unvbox\@nameuse{mp#1footins}
6890 \notefontsetup
6891 \hsize\columnwidth
6892 \@parboxrestore
6893 \color@begingroup
6894 \csname #1footfmt\endcsname #2\color@endgroup}}
6895
6896 % \end{macrocode}
6897 % \end{macro}
6898 % \end{PW}
6899 %
6900 % \begin{macro}{\ledsetnormalparstuff}
6901 % \begin{macro}{\normalfootfmt}
6902 % \phantomsection\label{normalfootfmt}\relax
6903 % \cs{normalfootfmt} is a `normal' macro
6904 % to take the footnote line and page
6905 % number information (see p.\,\pageref{linenumbers}), and the
6906 % desired text, and output what's to be printed.
6907 % Argument \verb"#1" contains the line and page number information
6908 % and lemma font specifier;
6909 % \verb"#2" is the lemma;
6910 % \verb"#3" is the note's text. This version is very
6911 % rudimentary---it uses \cs{printlines}
6912 % to print just the range of line numbers,
6913 % followed by a square bracket, the lemma, and the note text;
6914 % it's intended to be copied and modified as necessary.
6915 %
6916 % \verb"\par" should always be redefined to \verb"\endgraf" within
6917 % the format macro (this is what \cs{normal@pars} does),
6918 % to override any tricky stuff which might be done in the main text
6919 % to get the lines numbered automatically (as set up by
6920 % \cs{autopar}, for example).
6921 % \begin{macrocode}
6922 \newcommand*{\ledsetnormalparstuff}{%
6923 \normal@pars
6924 \parindent \z@ \parfillskip \z@ \@plus 1fil}
6925 \newcommand*{\normalfootfmt}[3]{%
6926 \ledsetnormalparstuff
6927 {\notenumfont\printlines#1|}\strut\enspace
6928 {\select@lemmafont#1|#2}\rbracket\enskip#3\strut\par}
6929
6930 % \end{macrocode}
6931 % \end{macro}
6932 % \end{macro}
6933 %
6934 % \begin{macro}{\endashchar}
6935 % \begin{macro}{\fullstop}
6936 % \begin{macro}{\rbracket}
6937 % The fonts that are used for printing notes might not have the
6938 % character mapping we expect: for example, the Computer Modern font
6939 % that contains old-style numerals does not contain an en-dash or
6940 % square brackets, and its period and comma are in odd locations.
6941 % To allow use of the standard footnote macros with such fonts, we use
6942 % the following macros for certain characters.
6943 %
6944 % The \cs{endashchar} macro is simply an en-dash from the
6945 % normal font and is immune to changes in the surrounding
6946 % font. The same goes for the full stop. These two are used in
6947 % \cs{printlines}. The right bracket macro is the same again;
6948 % it crops up in \cs{normalfootfmt} and the other footnote
6949 % macros for controlling the format of footnotes.
6950 % \begin{macrocode}
6951 \def\endashchar{\textnormal{--}}
6952 \newcommand*{\fullstop}{\textnormal{.}}
6953 \newcommand*{\rbracket}{\textnormal{\thinspace]}}
6954
6955 % \end{macrocode}
6956 % \end{macro}
6957 % \end{macro}
6958 % \end{macro}
6959 %
6960 % The \cs{printlines} macro prints the line
6961 % numbers for a note---which, in the
6962 % general case, is a rather complicated task.
6963 % The seven parameters of the
6964 % argument are the line numbers as stored in \cs{l@d@nums}, in the
6965 % form described on page \pageref{linenumbers}: the starting
6966 % page, line, and sub-line numbers, followed by the ending page,
6967 % line, and sub-line numbers, and then the font specifier for
6968 % the lemma.
6969 %
6970 % \begin{PW}
6971 % The original \edmac{} code used several counters at this point,
6972 % saying:
6973 % \begin{quote}
6974 % To simplify the logic, we use a lot of counters to tell us which
6975 % numbers need to get printed (using $1$ for yes, $0$ for no, so
6976 % that \verb"\ifodd" tests for `yes'). The counter assignments are:
6977 % \begin{itemize}\addtolength{\itemsep}{-1ex}
6978 % \item \cs{@pnum} for page numbers;
6979 % \item \cs{@ssub} for starting sub-line;
6980 % \item \cs{@elin} for ending line;
6981 % \item \cs{@esl} for ending sub-line; and
6982 % \item \cs{@dash} for the dash between the starting and ending groups.
6983 % \end{itemize}
6984 % There's no counter for the line number because it's always printed.
6985 % \end{quote}
6986 % LaTeX tends to use a lot of counters and packages should try and
6987 % minimise the number of new ones they create. In line with this
6988 % I have reverted to traditional booleans.
6989 % \end{PW}
6990 %
6991 % \begin{macro}{\ifl@d@pnum}
6992 % \begin{macro}{\ifl@d@ssub}
6993 % \begin{macro}{\ifl@d@elin}
6994 % \begin{macro}{\ifl@d@esl}
6995 % \begin{macro}{\ifl@d@dash}
6996 % \begin{macrocode}
6997 \newif\ifl@d@pnum
6998 \l@d@pnumfalse
6999 \newif\ifl@d@ssub
7000 \l@d@ssubfalse
7001 \newif\ifl@d@elin
7002 \l@d@elinfalse
7003 \newif\ifl@d@esl
7004 \l@d@eslfalse
7005 \newif\ifl@d@dash
7006 \l@d@dashfalse
7007 % \end{macrocode}
7008 % \end{macro}
7009 % \end{macro}
7010 % \end{macro}
7011 % \end{macro}
7012 % \end{macro}
7013 %
7014 % \begin{macro}{\ifledplinenum}
7015 % \begin{macro}{\symplinenum}
7016 % \begin{PW}
7017 % Sometimes it could be useful not to print the line number, or give
7018 % it a symbolic value (perhaps if there are several notes from the same line).
7019 % \end{PW}
7020 % \changes{v0.2.2}{2003/11/04}{Added \cs{symplinenum}}
7021 % \begin{macrocode}
7022 \newif\ifledplinenum
7023 \ledplinenumtrue
7024 \newcommand*{\symplinenum}{}
7025
7026 % \end{macrocode}
7027 % \end{macro}
7028 % \end{macro}
7029 %
7030 % \begin{macro}{\l@dparsefootspec}
7031 % \begin{macro}{\l@dp@rsefootspec}
7032 % \begin{macro}{\l@dparsedstartpage}
7033 % \begin{macro}{\l@dparsedstartline}
7034 % \begin{macro}{\l@dparsedstartsub}
7035 % \begin{macro}{\l@dparsedendpage}
7036 % \begin{macro}{\l@dparsedendline}
7037 % \begin{macro}{\l@dparsedendsub}
7038 % \cs{l@dparsefootspec}\marg{spec}\marg{lemma}\marg{text} parses a footnote
7039 % specification. \meta{lemma} and \meta{text} are the lemma and text
7040 % respectively. \meta{spec} is the line and page number and lemma font
7041 % specifier in \cs{l@d@nums} style format. The real work is done
7042 % by \cs{l@dp@rsefootspec} which defines macros holding the numeric values.
7043 % \begin{macrocode}
7044 \newcommand*{\l@dparsefootspec}[3]{\l@dp@rsefootspec#1|}
7045 \def\l@dp@rsefootspec#1|#2|#3|#4|#5|#6|#7|{%
7046 \gdef\l@dparsedstartpage{#1}%
7047 \gdef\l@dparsedstartline{#2}%
7048 \gdef\l@dparsedstartsub{#3}%
7049 \gdef\l@dparsedendpage{#4}%
7050 \gdef\l@dparsedendline{#5}%
7051 \gdef\l@dparsedendsub{#6}%
7052 }
7053 % \end{macrocode}
7054 % Initialise the several number value macros.
7055 % \begin{macrocode}
7056 \def\l@dparsedstartpage{0}%
7057 \def\l@dparsedstartline{0}%
7058 \def\l@dparsedstartsub{0}%
7059 \def\l@dparsedendpage{0}%
7060 \def\l@dparsedendline{0}%
7061 \def\l@dparsedendsub{0}%
7062
7063 % \end{macrocode}
7064 % \end{macro}
7065 % \end{macro}
7066 % \end{macro}
7067 % \end{macro}
7068 % \end{macro}
7069 % \end{macro}
7070 % \end{macro}
7071 % \end{macro}
7072 %
7073 % \begin{macro}{\setprintlines}
7074 % First of all, we print the page numbers only if\/: 1)~we're doing
7075 % the lineation by page, and 2)~the ending page number is different
7076 % from the starting page number.\phantomsection\label{printlines}
7077 %
7078 % Just a reminder of the arguments: \\
7079 % \verb?\printlines #1 | #2 | #3 | #4 | #5 | #6 | #7? \\
7080 % \verb?\printlines start-page | line | subline | end-page | line | subline | font ?
7081 %
7082 % \begin{PW}
7083 % The macro \cs{setprintlines} does the work of deciding what numbers should
7084 % be printed. Its arguments are the same as the first 6 of \cs{printlines}.
7085 % \end{PW}
7086 % \changes{v0.7}{2005/02/18}{Added \cs{setprintlines} for use by \cs{printlines}}
7087 % \begin{macrocode}
7088 \newcommand*{\setprintlines}[6]{%
7089 \l@d@pnumfalse \l@d@dashfalse
7090 \ifbypage@
7091 \ifnum#4=#1 \else
7092 \l@d@pnumtrue
7093 \l@d@dashtrue
7094 \fi
7095 \fi
7096 % \end{macrocode}
7097 %
7098 % We print the ending line number if\/: (1)~we're printing the ending
7099 % page number, or (2)~it's different from the starting line number.
7100 % \begin{macrocode}
7101 \ifl@d@pnum \l@d@elintrue \else \l@d@elinfalse \fi
7102 \ifnum#2=#5 \else
7103 \l@d@elintrue
7104 \l@d@dashtrue
7105 \fi
7106 % \end{macrocode}
7107 %
7108 % We print the starting sub-line if it's nonzero.
7109 % \begin{macrocode}
7110 \l@d@ssubfalse
7111 \ifnum#3=0 \else
7112 \l@d@ssubtrue
7113 \fi
7114 % \end{macrocode}
7115 %
7116 % We print the ending sub-line if it's nonzero and: (1)~it's different
7117 % from the starting sub-line number, or (2)~the ending line number is
7118 % being printed.
7119 % \begin{macrocode}
7120 \l@d@eslfalse
7121 \ifnum#6=0 \else
7122 \ifnum#6=#3
7123 \ifl@d@elin \l@d@esltrue \else \l@d@eslfalse \fi
7124 \else
7125 \l@d@esltrue
7126 \l@d@dashtrue
7127 \fi
7128 \fi}
7129 % \end{macrocode}
7130 % \end{macro}
7131 %
7132 % \begin{macro}{\printlines}
7133 % Now we're ready to print it all. If the lineation is by pstart, we print the pstart.
7134 % \changes{v0.15}{2012/06/11}{Line numbering can be reset at each pstart.}
7135 % \begin{macrocode}
7136 \def\printlines#1|#2|#3|#4|#5|#6|#7|{\begingroup
7137 \ifbypstart@%
7138 \ifl@dpairing%
7139 \ifledRcol%
7140 \thepstartR%
7141 \else%
7142 \thepstartL%
7143 \fi%
7144 \else%
7145 \thepstart%
7146 \fi%
7147 \fi%
7148 \setprintlines{#1}{#2}{#3}{#4}{#5}{#6}%
7149 % \end{macrocode}
7150 % One subtlety left here is when to print a period between
7151 % numbers. But the only instance in which this is tricky is for the
7152 % ending sub-line number: it could be coming after the starting
7153 % sub-line number (in which case we want only the dash) or after an
7154 % ending line number (in which case we need to insert a period).
7155 % \begin{macrocode}
7156 \ifl@d@pnum #1\fullstop\fi
7157 % \end{macrocode}
7158 % \begin{PW}
7159 % The other thing is whether to print the real starting line number or a
7160 % symbolic value.
7161 % \changes{v0.3}{2004/02/14}{Added \cs{linenumr@p} and \cs{sublinenumr@p}
7162 % to \cs{printlines}}
7163 % \end{PW}
7164 % \begin{macrocode}
7165 \ifledplinenum \linenumrep{#2}\else \symplinenum\fi
7166 \ifl@d@ssub \fullstop \sublinenumrep{#3}\fi
7167 \ifl@d@dash \endashchar\fi
7168 \ifl@d@pnum #4\fullstop\fi
7169 \ifl@d@elin \linenumrep{#5}\fi
7170 \ifl@d@esl \ifl@d@elin \fullstop\fi \sublinenumrep{#6}\fi
7171 \endgroup}
7172
7173 % \end{macrocode}
7174 % \end{macro}
7175 %
7176 % \begin{macro}{\normalfootstart}
7177 % \phantomsection\label{normalvalues}\relax
7178 % \cs{normalfootstart}
7179 % is a standard footnote-starting macro, called in the output
7180 % routine whenever there are footnotes of this series to be
7181 % printed: it skips a bit and then draws a rule.
7182 %
7183 % Any \verb"footstart" macro must put onto the page something that
7184 % takes up space exactly equal to the \verb"\skip\footins" value for
7185 % the associated series of notes. \TeX\ makes page computations based
7186 % on that \cs{skip} value, and the output pages will suffer from
7187 % spacing problems if what you add takes up a different amount of
7188 % space.
7189 %
7190 % The \cs{leftskip} and \cs{rightskip} values
7191 % are both zeroed here.\phantomsection\label{footskips}
7192 % Similarly, these skips are cancelled in the \verb"vfootnote" macros
7193 % for the various types of notes. Strictly speaking,
7194 % this is necessary only
7195 % if you are using paragraphed footnotes, but we have put it here
7196 % and in the other \verb"vfootnote" macros too so that the behavior of
7197 % \Ledmac{} in this respect is general across all footnote types
7198 % (you can change this). What this means is that any \cs{leftskip}
7199 % and \cs{rightskip} you specify applies to the main text, but not
7200 % the footnotes. The footnotes continue to be of width \cs{hsize}.
7201 % \begin{macrocode}
7202 \newcommand*{\normalfootstart}[1]{%
7203 \vskip\skip\csname #1footins\endcsname
7204 \leftskip0pt \rightskip0pt
7205 \csname #1footnoterule\endcsname}
7206 % \end{macrocode}
7207 % \end{macro}
7208 %
7209 % \begin{macro}{\normalfootnoterule}
7210 % \cs{norrmalfootnoterule} is
7211 % a standard footnote-rule macro, for use by a \verb"footstart"
7212 % macro: just the same as the \PlainTeX\ footnote rule.
7213 % \begin{macrocode}
7214 \let\normalfootnoterule=\footnoterule
7215 % \end{macrocode}
7216 % \end{macro}
7217 %
7218 % \begin{macro}{\normalfootgroup}
7219 % \cs{normalfootgroup} is
7220 % a standard footnote-grouping macro: it sends the
7221 % contents of the footnote-insert box to the output page without
7222 % alteration.
7223 % \begin{macrocode}
7224 \newcommand*{\normalfootgroup}[1]{\unvbox\csname #1footins\endcsname}
7225
7226 % \end{macrocode}
7227 % \end{macro}
7228 %
7229 % \begin{PW}
7230 % \begin{macro}{\mpnormalfootgroup}
7231 % A somewhat different version for minipages.
7232 % \changes{v0.4}{2004/02/29}{Added \cs{mpnormalfootgroup}}
7233 % \begin{macrocode}
7234 \newcommand*{\mpnormalfootgroup}[1]{{
7235 \vskip\skip\@nameuse{mp#1footins}
7236 \normalcolor
7237 \@nameuse{#1footnoterule}
7238 \unvbox\csname mp#1footins\endcsname}}
7239
7240 % \end{macrocode}
7241 % \end{macro}
7242 % \end{PW}
7243 %
7244 % \subsection{Standard footnote definitions}
7245 %
7246 % \begin{macro}{\footnormal}
7247 % We can now define all the parameters for the five series of
7248 % footnotes; initially they use the `normal' footnote formatting,
7249 % which is set up by calling \cs{footnormal}.
7250 % You can switch to another type of formatting by using
7251 % \cs{footparagraph}, \cs{foottwocol}, or \cs{footthreecol}.
7252 %
7253 % Switching to a variation of `normal'
7254 % formatting requires changing the
7255 % quantities defined in \cs{footnormal}. The best way to
7256 % proceed would be to make a copy of this macro, with a different
7257 % name, make your desired changes in that copy, and then invoke it,
7258 % giving it the letter of the footnote series you wish to control.
7259 %
7260 % (We have not defined baseline skip values like
7261 % \cs{abaselineskip}, since this is one of the quantities set in
7262 % \cs{notefontsetup}.)
7263 %
7264 % What we want to do here is to say something like the following
7265 % for each footnote series. (This is an example, not part of the
7266 % actual \Ledmac{} code.)
7267 % \begin{verbatim}
7268 % \newinsert\Afootins
7269 % \skip\Afootins=12pt plus5pt minus5pt
7270 % \count\Afootins=1000
7271 % \dimen\Afootins=0.8\vsize
7272 % \let\vAfootnote=\normalvfootnote \let\Afootfmt=\normalfootfmt
7273 % \let\Afootstart=\normalfootstart \let\Afootgroup=\normalfootgroup
7274 % \let\Afootnoterule=\normalfootnoterule
7275 % \end{verbatim}
7276 % Instead of repeating ourselves, we define a \cs{footnormal}
7277 % macro that makes all these assignments for us, for any given
7278 % series letter. This also makes it easy to change from any
7279 % different system of formatting back to the \verb"normal" setting.
7280 %
7281 % \begin{PW}
7282 % \begin{macro}{\ledfootinsdim}
7283 % Have a constant value for the \verb?\dimen\footins?
7284 % \changes{v0.4.1}{2004/03/25}{Added \cs{ledfootinsdim}}
7285 % \begin{macrocode}
7286 \newcommand*{\ledfootinsdim}{0.8\vsize}
7287
7288 % \end{macrocode}
7289 % \end{macro}
7290 % \end{PW}
7291 %
7292 % We begin by defining the five new insertion classes, and some
7293 % \verb"count" registers; these are \cs{outer} operations that
7294 % can't be done inside \cs{footnormal}.
7295 % \begin{macrocode}
7296 \newinsert\Afootins \newinsert\Bfootins
7297 \newinsert\Cfootins \newinsert\Dfootins
7298 \newinsert\Efootins
7299 % \end{macrocode}
7300 % Now we set up the \cs{footnormal} macro itself. It takes
7301 % one argument: the footnote series letter.
7302 % \begin{macrocode}
7303 \newcommand*{\footnormal}[1]{%
7304 \expandafter\let\csname #1footstart\endcsname=\normalfootstart
7305 \expandafter\let\csname v#1footnote\endcsname=\normalvfootnote
7306 \expandafter\let\csname #1footfmt\endcsname=\normalfootfmt
7307 \expandafter\let\csname #1footgroup\endcsname=\normalfootgroup
7308 \expandafter\let\csname #1footnoterule\endcsname=%
7309 \normalfootnoterule
7310 \count\csname #1footins\endcsname=1000
7311 \dimen\csname #1footins\endcsname=\ledfootinsdim
7312 \skip\csname #1footins\endcsname=1.2em \@plus .6em \@minus .6em
7313 % \end{macrocode}
7314 % \begin{PW}
7315 % Now do the setup for minipage footnotes. We use as much as possible of the
7316 % normal setup as we can (so the notes will have a similar layout).
7317 % \changes{v0.4}{2004/02/29}{Added minpage footnote setup to \cs{footnormal}}
7318 % \end{PW}
7319 % \begin{macrocode}
7320 \expandafter\let\csname mpv#1footnote\endcsname=\mpnormalvfootnote
7321 \expandafter\let\csname mp#1footgroup\endcsname=\mpnormalfootgroup
7322 \count\csname mp#1footins\endcsname=1000
7323 \dimen\csname mp#1footins\endcsname=\ledfootinsdim
7324 \skip\csname mp#1footins\endcsname=1.2em \@plus .6em \@minus .6em
7325 }
7326
7327 % \end{macrocode}
7328 % \end{macro}
7329 % Some of these values deserve comment: the \cs{dimen}
7330 % setting allows 80\% of the page to be occupied by notes; the
7331 % \cs{skip} setting is deliberately flexible, since pages with
7332 % lots of notes attached to many of the lines can be a bit hard
7333 % for \TeX\ to make.
7334 %
7335 % And finally, we initialize the formatting for all the footnote series
7336 % to be normal.
7337 % \begin{macrocode}
7338 \footnormal{A}
7339 \footnormal{B}
7340 \footnormal{C}
7341 \footnormal{D}
7342 \footnormal{E}
7343
7344 % \end{macrocode}
7345 %
7346 %
7347 % \subsection{Paragraphed footnotes}
7348 %
7349 % The paragraphed-footnote option
7350 % reformats all the footnotes of one series for a page into
7351 % a single paragraph; this is especially appropriate when the notes are
7352 % numerous and brief. The code is based
7353 % on \thetexbook, pp.\,398--400, with
7354 % alterations for our environment. This algorithm uses a considerable
7355 % amount of save-stack space: a \TeX\ of ordinary size may not be able
7356 % to handle more than about $100$ notes of this kind on a page.
7357 %
7358 % \begin{macro}{\footparagraph}
7359 % The \cs{footparagraph} macro
7360 % sets up everything for one series of footnotes so that
7361 % they'll be paragraphed; it takes the series letter as argument.
7362 % We include the setting of \verb"\count\footins" to $1000$ for the
7363 % footnote series just in case you are switching to paragraphed
7364 % footnotes after having columnar ones, since they change this
7365 % value (see below).
7366 %
7367 % It is important to call \cs{footparagraph} only after
7368 % \cs{hsize} has been set for the pages that use
7369 % this series of notes; otherwise \TeX\ will try to put too
7370 % many or too few of these notes on each page. If you need to
7371 % change the \cs{hsize} within the document, call
7372 % \cs{footparagraph} again afterwards to take account of the new
7373 % value. The argument of \cs{footparagraph} is the letter
7374 % (\texttt{A}--\texttt{E}) denoting the series of notes to be paragraphed.
7375 % \begin{macrocode}
7376 \newcommand*{\footparagraph}[1]{%
7377 \expandafter\let\csname #1footstart\endcsname=\parafootstart
7378 \expandafter\let\csname v#1footnote\endcsname=\para@vfootnote
7379 \expandafter\let\csname #1footfmt\endcsname=\parafootfmt
7380 \expandafter\let\csname #1footgroup\endcsname=\para@footgroup
7381 \count\csname #1footins\endcsname=1000
7382 \para@footsetup{#1}
7383 % \end{macrocode}
7384 % \begin{PW}
7385 % And the extra setup for minipages.
7386 % \end{PW}
7387 % \begin{macrocode}
7388 \expandafter\let\csname mpv#1footnote\endcsname=\mppara@vfootnote
7389 \expandafter\let\csname mp#1footgroup\endcsname=\mppara@footgroup
7390 \count\csname mp#1footins\endcsname=1000
7391 }
7392
7393 % \end{macrocode}
7394 % \end{macro}
7395 % \changes{v0.16}{2012/06/21}{\cs{parafootftmsep} command is printed between each paragraphed footnote}
7396 % You can redefine the \cs{parafootftmsep} command to print a separator between each paragraphed footnote (on the same page). A usual separator is a double pipe ($||$). To add double-pipe separators:
7397 % \begin{verbatim}
7398 % \renewcommand{\parafootftmsep}{\thinspace$||$\enspace}
7399 % \end{verbatim}
7400 % \begin{macro}{\footfudgefiddle}
7401 % \begin{PW}
7402 % For paragraphed footnotes \TeX{} has to estimate the amount of space
7403 % required. If it underestimates this then the notes may get too long and
7404 % run off the bottom of the text block. \cs{footfudgefiddle} can be increased
7405 % from its default 64 (say to 70) to increase the estimate.
7406 % \end{PW}
7407 % \changes{v0.2.2}{2003/11/04}{Added \cs{footfudgefiddle}}
7408 % \begin{macrocode}
7409 \providecommand{\footfudgefiddle}{64}
7410 % \end{macrocode}
7411 % \end{macro}
7412 % \begin{macro}{\para@footsetup}
7413 % \cs{footparagraph} calls the
7414 % \cs{para@footsetup} macro to calculate a special
7415 % fudge factor, which is the ratio of the \cs{baselineskip}
7416 % to the \cs{hsize}. We assume that the proper value of
7417 % \cs{baselineskip} for the footnotes (normally 9\,pt) has been set
7418 % already, in \cs{notefontsetup}. The argument of the macro is
7419 % again the note series letter.
7420 %
7421 % \begin{PW}
7422 % I think that \cs{columnwidth} should be used here for LaTeX, not \cs{hsize}.
7423 % I've also included \cs{footfudgefiddle}.
7424 % \end{PW}
7425 % \changes{v0.2.2}{2003/11/04}{Added \cs{footfudgefiddle} to \cs{para@footsetup}}
7426 % \begin{macrocode}
7427 \newcommand*{\para@footsetup}[1]{{\notefontsetup
7428 \dimen0=\baselineskip
7429 \multiply\dimen0 by 1024
7430 \divide \dimen0 by \columnwidth \multiply\dimen0 by \footfudgefiddle\relax
7431 \expandafter
7432 \xdef\csname #1footfudgefactor\endcsname{%
7433 \expandafter\strip@pt\dimen0 }}}
7434
7435 % \end{macrocode}
7436 % \end{macro}
7437 %
7438 % \begin{PW}
7439 % \edmac{} defines \cs{en@number} which does the same as the LaTeX kernel
7440 % \cs{strip@pt}, namely strip the characters \verb"pt" from a dimen value.
7441 % I'll use \cs{strip@pt}.
7442 % \end{PW}
7443 %
7444 % \begin{macro}{\parafootstart}
7445 % \cs{parafootstart} is the same as \cs{normalfootstart}, but we give it
7446 % again to ensure that \cs{rightskip} and \cs{leftskip} are
7447 % zeroed (this needs to be done before \cs{para@footgroup} in the
7448 % output routine). You might have decided to change this for other
7449 % kinds of note, but here it should stay as it is. The size of
7450 % paragraphed notes is calculated using a fudge factor which in
7451 % turn is based on \cs{hsize}. So the paragraph of notes needs to be
7452 % that wide.
7453 %
7454 % The argument of the macro is again the note series letter.
7455 % \begin{macrocode}
7456 \newcommand*{\parafootstart}[1]{%
7457 \rightskip=0pt \leftskip=0pt \parindent=0pt
7458 \vskip\skip\csname #1footins\endcsname
7459 \csname #1footnoterule\endcsname}
7460 % \end{macrocode}
7461 % \end{macro}
7462 %
7463 % \begin{macro}{\para@vfootnote}
7464 % \cs{para@vfootnote}
7465 % is a version of the \cs{vfootnote} command that's used for
7466 % paragraphed notes. It gets appended to the \cs{inserts@list} list
7467 % by an outer-level footnote command like \cs{Afootnote}. The first
7468 % argument is the note series letter; the second is the full text
7469 % of the printed note itself, including line numbers, lemmata, and
7470 % footnote text.
7471 %
7472 % The initial model for this insertion is, of course, the
7473 % \verb"\insert\footins" definition in \thetexbook, p.\,398.
7474 % There, the footnotes are first collected up in hboxes, and these
7475 % hboxes are later unpacked and stuck together into a paragraph.
7476 %
7477 % However, Michael Downes\index{Downes, Michael} has pointed out
7478 % that because text in hboxes gets typeset in restricted horizontal
7479 % mode, there are some undesirable side-effects if you later want
7480 % to break such text across lines. In restricted horizontal mode,
7481 % where \TeX\ does not expect to have to break lines, it does not
7482 % insert certain items like \cs{discretionary}s. If you later unbox
7483 % these hboxes and stick them together, as the \texbook{}
7484 % macros do to make these footnotes, you lose the ability to
7485 % hyphenate after an explicit hyphen. This can lead to overfull
7486 % \cs{hbox}es when you would not expect to find them, and to the
7487 % uninitiated it might be very hard to see why the problem had
7488 % arisen.\footnote{Michael Downes, `Line Breaking in \cs{unhbox}ed
7489 % Text', \textit{TUGboat} \textbf{11} (1990), pp.\,605--612.}
7490 %
7491 % Wayne Sullivan\index{Sullivan, Wayne} pointed out to us another
7492 % subtle problem that arises from the same cause: \TeX\ also leaves
7493 % the \cs{language} whatsit nodes out of the horizontal
7494 % list.\footnote{See \thetexbook, p.\,455 (editions after
7495 % January 1990).} So changes from one language to another will not
7496 % invoke the proper hyphenation rules in such footnotes. Since
7497 % critical editions often do deal with several languages,
7498 % especially in footnotes, we really ought to get this bit of code
7499 % right.
7500 %
7501 % To get around these problems, Wayne suggested emendations to the
7502 % \texbook{} versions of these macros which are broadly the
7503 % same as those described by Michael: the central idea (also
7504 % suggested by Donald Knuth in a letter to Michael) is to avoid collecting
7505 % the text in an \cs{hbox} in the first place, but instead to collect
7506 % it in a \cs{vbox} whose width is (virtually)
7507 % infinite.\phantomsection\label{hboxproblem} The text is therefore typeset in
7508 % unrestricted horizontal mode, as a paragraph consisting of a
7509 % single long line. Later, there is an extra level of unboxing to
7510 % be done: we have to unpack the \cs{vbox}, as well as the hboxes
7511 % inside it, but that's not too hard. For details, we refer you to
7512 % Michael's article, where the issues are clearly
7513 % explained.\footnote{Wayne supplied his own macros to do this, but
7514 % since they were almost identical to Michael's, we have used the
7515 % latter's \cs{unvxh} macro since it is publicly
7516 % documented.} Michael's unboxing macro is called \cs{unvxh}: unvbox,
7517 % extract the last line, and unhbox it.
7518 %
7519 % Doing things this way has an important
7520 % consequence:\phantomsection\label{nobreaks-detail} as Michael
7521 % pointed out, you really can't put an explicit line-break into a
7522 % note built in a \cs{vbox} the way we are doing.\footnote{`Line
7523 % Breaking', p.\,610.} In other words, be very careful not to say
7524 % \cs{break}, or \verb"\penalty-10000", or any equivalent inside your
7525 % para-footnote.\phantomsection\label{nobreak} If you do, most of the note will
7526 % probably disappear. You \emph{are} allowed to make strong
7527 % suggestions; in fact \verb"\penalty-9999" will be quite okay. Just
7528 % don't make the break mandatory. We haven't applied any of
7529 % Michael's solutions here, since we feel that the problem is
7530 % exiguous, and \Ledmac{} is quite baroque enough already. If
7531 % you think you are having this problem, look up Michael's
7532 % solutions.
7533 %
7534 % One more thing; we set \cs{leftskip} and \cs{rightskip} to zero.
7535 % This has the effect of neutralizing any such skips which may
7536 % apply to the main text (cf.\ p.\,\pageref{footskips} above).
7537 % We need to do this, since \verb"footfudgefactor" is calculated on
7538 % the assumption that the notes are \cs{hsize} wide.
7539 %
7540 % So, finally, here is the modified foot-paragraph code, which
7541 % sets the footnote in vertical mode so that language and
7542 % discretionary nodes are included.
7543 %
7544 % \begin{macrocode}
7545 \newcommand*{\para@vfootnote}[2]{%
7546 \insert\csname #1footins\endcsname
7547 \bgroup
7548 \notefontsetup
7549 \footsplitskips
7550 \setbox0=\vbox{\hsize=\maxdimen%
7551 \let\bidi@RTL@everypar\@empty%
7552 \noindent\csname #1footfmt\endcsname#2}%
7553 \setbox0=\hbox{\unvxh0}%
7554 \dp0=0pt
7555 \ht0=\csname #1footfudgefactor\endcsname\wd0
7556 % \end{macrocode}
7557 % Here we produce the contents of the footnote from box $0$, and
7558 % add a penalty of $0$ between boxes in this insert.
7559 % \begin{macrocode}
7560 \box0
7561 \penalty0
7562 \egroup}
7563
7564 % \end{macrocode}
7565 % The final penalty of $0$
7566 % was added here at Wayne's\index{Sullivan, Wayne}
7567 % suggestion to avoid a weird page-breaking problem, which occurs on
7568 % those occasions when \TeX\ attempts to split foot paragraphs.
7569 % After trying out such a split (see \thetexbook, p.\,124),
7570 % \TeX\ inserts a penalty of $-10000$ here, which
7571 % nearly always forces the break at the end of the whole footnote
7572 % paragraph (since individual notes can't be split) even when this
7573 % leads to an overfull vbox. The change above results in a penalty
7574 % of $0$ instead which allows, but doesn't force, such breaks. This
7575 % penalty of $0$ is later removed, after page breaks have been
7576 % decided, by the \cs{unpenalty} macro in \cs{makehboxofhboxes}. So it
7577 % does not affect how the footnote paragraphs are typeset (the
7578 % notes still have a penalty of $-10$ between them, which is added
7579 % by \cs{parafootfmt}).
7580 % \end{macro}
7581 %
7582 % \begin{PW}
7583 % \begin{macro}{\mppara@vfootnote}
7584 % This version is for minipages.
7585 % \begin{macrocode}
7586 \newcommand*{\mppara@vfootnote}[2]{%
7587 \global\setbox\@nameuse{mp#1footins}\vbox{%
7588 \unvbox\@nameuse{mp#1footins}%
7589 \notefontsetup
7590 \footsplitskips
7591 \setbox0=\vbox{\hsize=\maxdimen%
7592 \let\bidi@RTL@everypar\@empty%
7593 \noindent\color@begingroup\csname #1footfmt\endcsname #2\color@endgroup}%
7594 \setbox0=\hbox{\unvxh0}%
7595 \dp0=\z@
7596 \ht0=\csname #1footfudgefactor\endcsname\wd0
7597 \box0
7598 \penalty0
7599 }}
7600
7601 % \end{macrocode}
7602 % \end{macro}
7603 % \end{PW}
7604 %
7605 % \begin{macro}{\unvxh}
7606 % Here is Michael's\index{Downes, Michael} definition of \cs{unvxh},
7607 % used above. Michael's macro also takes care to remove some
7608 % unwanted penalties and glue that \TeX\ automatically attaches to
7609 % the end of paragraphs. When \TeX\ finishes a paragraph, it
7610 % throws away any remaining glue, and then tacks on the following
7611 % items: a \cs{penalty} of $10000$, a \cs{parfillskip} and a
7612 % \cs{rightskip} (\thetexbook, pp.\,99--100). \cs{unvxh}
7613 % cancels these unwanted paragraph-final items using \cs{unskip} and
7614 % \cs{unpenalty}.
7615 % \begin{macrocode}
7616 \newcommand*{\unvxh}[1]{%
7617 \setbox0=\vbox{\unvbox#1%
7618 \global\setbox1=\lastbox}%
7619 \unhbox1
7620 \unskip % remove \rightskip,
7621 \unskip % remove \parfillskip,
7622 \unpenalty % remove \penalty of 10000,
7623 \hskip\ipn@skip} % but add the glue to go between the notes
7624
7625 % \end{macrocode}
7626 % \end{macro}
7627 %
7628 % \begin{macro}{\interparanoteglue}
7629 % \begin{macro}{\ipn@skip}
7630 % \phantomsection
7631 % \label{interparanoteglue}\relax
7632 % Close observers will notice that we snuck some glue called
7633 % \cs{ipn@skip} onto the end of the hbox produced by \cs{unvxh} in the
7634 % above macro.
7635 %
7636 % We want to be able to have some glue between our paragraphed
7637 % footnotes. But since we are initially setting our notes in
7638 % internal vertical mode, as little paragraphs, any paragraph-final
7639 % glue will get discarded. Since \cs{unvxh} is already busy fiddling
7640 % with glue and penalties at the end of these paragraphs, we take
7641 % advantage of the opportunity to provide our inter-note spacing.
7642 %
7643 % We collect the value of the inter-parafootnote glue value as the
7644 % parameter of a macro called---wait for it---\cs{interparanoteglue}.
7645 % We put this value into the value of a glue register
7646 % \cs{ipn@skip} (inter-para-note-skip) making sure first to set the
7647 % current font to the value normally used in footnotes so that the value of an
7648 % \verb"em" will be taken from the right font.
7649 % \begin{macrocode}
7650 \newskip\ipn@skip
7651 \newcommand*{\interparanoteglue}[1]{%
7652 {\notefontsetup\global\ipn@skip=#1 \relax}}
7653 \interparanoteglue{1em plus.4em minus.4em}
7654
7655 % \end{macrocode}
7656 % There is a point to be careful about regarding the
7657 % \cs{interparanoteglue}. Remember that in \cs{para@vfootnote} we do
7658 % some measurements on the footnote box, and use the resulting size
7659 % to make an estimate of how much the note will contribute to the
7660 % height of our final footnote paragraph. This information is used
7661 % by the output routine to allocate the right amount of vertical
7662 % space on the page for the notes (\thetexbook, pp.\,398--399).
7663 %
7664 % The length of the footnote includes the natural size of the glue
7665 % specified by \cs{interparanoteglue}, but not its stretch or shrink
7666 % components, since at this point the note has no need to stretch
7667 % or shrink. Later, when the paragraph is actually composed by
7668 % \cs{parafootgroup} in the output routine, \TeX\ will almost
7669 % certainly do some stretching and shrinking of this glue in order
7670 % to make the paragraph look nice. Probably the stretching and
7671 % shrinking over the whole paragraph will cancel each other out.
7672 % But if not, the actual vertical size of the paragraph may not
7673 % match the size the output routine had been told to expect, and
7674 % you may get an overfull/underfull \cs{vbox} message from the output
7675 % routine. To minimize the risk of this, you can do two things:
7676 % keep the \verb"plus" and \verb"minus" components of \cs{interparanoteglue}
7677 % small compared with its natural glue, and keep them the same as
7678 % each other. As a general precaution, keep the size and
7679 % flexibility of the \verb"\skip\footins" glue on the high side too:
7680 % because the reckoning is approximate, footnote blocks may be up
7681 % to a line bigger or smaller than the output routine allows for,
7682 % so keep some flexible space between the text and the notes.
7683 % \end{macro}
7684 % \end{macro}
7685 %
7686 %
7687 % \begin{macro}{\parafootfmt}
7688 % \cs{parafootfmt} is
7689 % \cs{normalfootfmt} adapted to do the special stuff
7690 % needed for paragraphed notes---leaving out the \verb"\endgraf" at the
7691 % end, sticking in special penalties and kern, and leaving out the
7692 % \cs{footstrut}. The first argument is the line and page
7693 % number information, the second is the lemma, and the third is the
7694 % text of the footnote.
7695 % \begin{macrocode}
7696 \newcommand*{\parafootfmt}[3]{%
7697 \insertparafootftmsep%
7698 \ledsetnormalparstuff
7699 {\notenumfont\printlines#1|}\enspace
7700 {\select@lemmafont#1|#2}\rbracket\enskip
7701 #3\penalty-10 }
7702 % \end{macrocode}
7703 % Note that in the above definition, the penalty of $-10$
7704 % encourages a line break between notes, so that notes have a
7705 % slight tendency to begin on new lines.
7706 % The \cs{insertparafootftmsep} command is used to insert the \cs{parafootftmsep} between each note in the \emph{same} page.
7707 % \end{macro}
7708 %
7709 % \begin{macro}{\para@footgroup}
7710 % This \verb"footgroup" code is modelled on the macros in
7711 % \thetexbook, p.\,399. The only difference is the \cs{unpenalty}
7712 % in \cs{makehboxofhboxes}, which is there to remove the penalty of
7713 % $0$ which was added to the end of each footnote by
7714 % \cs{para@vfootnote}.
7715 %
7716 % The call to \cs{notefontsetup} is to ensure that the correct
7717 % \cs{baselineskip} for the footnotes is used. The argument is the
7718 % note series letter.
7719 % \begin{macrocode}
7720 \newcommand*{\para@footgroup}[1]{%
7721 \unvbox\csname #1footins\endcsname
7722 \makehboxofhboxes
7723 \setbox0=\hbox{\unhbox0 \removehboxes}%
7724 \notefontsetup
7725 \noindent\unhbox0\par}
7726
7727 % \end{macrocode}
7728 % \end{macro}
7729 %
7730 % \begin{PW}
7731 % \begin{macro}{\mppara@footgroup}
7732 % The minipage version.
7733 % \begin{macrocode}
7734 \newcommand*{\mppara@footgroup}[1]{{%
7735 \vskip\skip\@nameuse{mp#1footins}
7736 \normalcolor
7737 \@nameuse{#1footnoterule}%
7738 \unvbox\csname mp#1footins\endcsname
7739 \makehboxofhboxes
7740 \setbox0=\hbox{\unhbox0 \removehboxes}%
7741 \notefontsetup
7742 \noindent\unhbox0\par}}
7743
7744 % \end{macrocode}
7745 % \end{macro}
7746 % \end{PW}
7747 %
7748 % \begin{macro}{\makehboxofhboxes}
7749 % \begin{macro}{\removehboxes}
7750 % \begin{macrocode}
7751 \newcommand*{\makehboxofhboxes}{\setbox0=\hbox{}%
7752 \loop
7753 \unpenalty
7754 \setbox2=\lastbox
7755 \ifhbox2
7756 \setbox0=\hbox{\box2\unhbox0}%
7757 \repeat}
7758
7759 \newcommand*{\removehboxes}{\setbox0=\lastbox
7760 \ifhbox0{\removehboxes}\unhbox0 \fi}
7761
7762 % \end{macrocode}
7763 % \end{macro}
7764 % \end{macro}
7765 %
7766 % \subsubsection{Insertion of footnotes separator}
7767 % \begin{macro}{\parafootftmsep}
7768 % The \cs{parafootftmsep} macro is inserted between each paragraphed footnote. The default value is empty, but the user can redefine it via \cs{renewcommand}.
7769 % \begin{macrocode}
7770 \newcommand{\parafootftmsep}{}
7771 % \end{macrocode}
7772 % \end{macro}
7773 %The command \cs{insertparafootftmsep} must be called at the begining of \cs{parafootftm} (and like commands). \cs{insertparafootftmsep} checks to see if the page number has changed since the previous note. If not, \cs{insertparafootftmsep} calls \cs{parafootftmsep}.
7774 % \begin{macro}{\prevpage@num}
7775 % \begin{macro}{\insertparafootftmsep}
7776 % \begin{macrocode}
7777 \newcount\prevpage@num
7778 \newcommand{\insertparafootftmsep}{%
7779 \ifnum\prevpage@num=\page@num%
7780 \parafootftmsep%
7781 \fi%
7782 \global\prevpage@num=\page@num%
7783 }
7784 % \end{macrocode}
7785 % \end{macro}
7786 % \end{macro}
7787 % \subsection{Columnar footnotes}
7788 %
7789 % \begin{macro}{\rigidbalance}
7790 % \begin{macro}{\dosplits}
7791 % \begin{macro}{\splitoff}
7792 % \begin{macro}{\@h}
7793 % \begin{macro}{\@k}
7794 % We will now define macros for three-column notes and two-column
7795 % notes. Both sets of macros will use \cs{rigidbalance}, which splits a
7796 % box (\verb"#1") into into a number (\verb"#2") of columns, each
7797 % with a space (\verb"#3") between the top baseline and the top of
7798 % the \cs{vbox}. The \cs{rigidbalance} macro is taken from
7799 % \thetexbook, p.\,397, with a slight change to the syntax of
7800 % the arguments so that they don't depend on white space. Note also
7801 % the extra unboxing in \cs{splitoff}, which allows the new \cs{vbox} to
7802 % have its natural height as it goes into the alignment.
7803 %
7804 % \begin{PW}
7805 % The LaTeX \cs{line} macro has no relationship to the
7806 % TeX \cs{line}. The LaTeX equivalent is \cs{@@line}.
7807 % \end{PW}
7808 % \begin{macrocode}
7809 \newcount\@k \newdimen\@h
7810 \newcommand*{\rigidbalance}[3]{\setbox0=\box#1 \@k=#2 \@h=#3
7811 \@@line{\splittopskip=\@h \vbadness=\@M \hfilneg
7812 \valign{##\vfil\cr\dosplits}}}
7813
7814 \newcommand*{\dosplits}{\ifnum\@k>0 \noalign{\hfil}\splitoff
7815 \global\advance\@k-1\cr\dosplits\fi}
7816
7817 \newcommand*{\splitoff}{\dimen0=\ht0
7818 \divide\dimen0 by\@k \advance\dimen0 by\@h
7819 \setbox2 \vsplit0 to \dimen0
7820 \unvbox2 }
7821
7822 % \end{macrocode}
7823 % \end{macro}
7824 % \end{macro}
7825 % \end{macro}
7826 % \end{macro}
7827 % \end{macro}
7828 %
7829 % \paragraph{Three columns}
7830 %
7831 % \begin{macro}{\footthreecol}
7832 % You say \verb"\footthreecol{A}" to have the \texttt{A} series of footnotes
7833 % typeset in three columns. It is important to call this only after
7834 % \cs{hsize} has been set for the document.
7835 % \begin{macrocode}
7836 \newcommand*{\footthreecol}[1]{%
7837 \expandafter\let\csname v#1footnote\endcsname=\threecolvfootnote
7838 \expandafter\let\csname #1footfmt\endcsname=\threecolfootfmt
7839 \expandafter\let\csname #1footgroup\endcsname=\threecolfootgroup
7840 \threecolfootsetup{#1}
7841 % \end{macrocode}
7842 % \begin{PW}
7843 % The additional setup for minipages.
7844 % \end{PW}
7845 % \begin{macrocode}
7846 \expandafter\let\csname mpv#1footnote\endcsname=\mpnormalvfootnote
7847 \expandafter\let\csname mp#1footgroup\endcsname=\mpthreecolfootgroup
7848 \mpthreecolfootsetup{#1}
7849 }
7850
7851 % \end{macrocode}
7852 % The \cs{footstart} and \cs{footnoterule} macros for these notes assume
7853 % the normal values (p.\,\pageref{normalvalues} above).
7854 % \end{macro}
7855 %
7856 % \begin{macro}{\threecolfootsetup}
7857 % The \cs{threecolfootsetup} macro calculates and sets some numbers
7858 % for three-column footnotes.
7859 %
7860 % We set the \cs{count} of the foot insert to $333$.
7861 % Each footnote can be thought of as contributing only one third of
7862 % its height to the page, since the footnote insertion has been
7863 % made as a long narrow column, which then gets trisected by the
7864 % \cs{rigidbalance} routine (inside \cs{threecolfootgroup}).
7865 % These new, shorter columns are saved in a box, and then that box
7866 % is \emph{put back} into the footnote insert, replacing the
7867 % original collection of footnotes. This new box is, therefore,
7868 % only about a third of the height of the original one.
7869 %
7870 % The \cs{dimen} value for this note series has to change in the
7871 % inverse way: it needs to be three times
7872 % the actual limit on the amount of space these notes are allowed to
7873 % fill on the page, because when \TeX\ is
7874 % accumulating material for the page
7875 % and checking that limit, it doesn't apply the \cs{count} scaling.
7876 % \begin{macrocode}
7877 \newcommand*{\threecolfootsetup}[1]{%
7878 \count\csname #1footins\endcsname 333
7879 \multiply\dimen\csname #1footins\endcsname \thr@@}
7880 % \end{macrocode}
7881 % \end{macro}
7882 %
7883 % \begin{PW}
7884 % \begin{macro}{\mpthreecolfootsetup}
7885 % The setup for minipages.
7886 % \begin{macrocode}
7887 \newcommand*{\mpthreecolfootsetup}[1]{%
7888 \count\csname mp#1footins\endcsname 333
7889 \multiply\dimen\csname mp#1footins\endcsname \thr@@}
7890
7891 % \end{macrocode}
7892 % \end{macro}
7893 % \end{PW}
7894 %
7895 % \begin{macro}{\threecolvfootnote}
7896 % \cs{threecolvfootnote}
7897 % is the \cs{vfootnote} command for three-column notes. The
7898 % call to \cs{notefontsetup} ensures that the
7899 % \cs{splittopskip} and \cs{splitmaxdepth} take their values
7900 % from the right \cs{strutbox}: the one used in footnotes.
7901 % Note especially the importance of temporarily reducing the
7902 % \cs{hsize} to $0.3$ of its normal value. This determines the
7903 % widths of the individual columns. So if the normal \cs{hsize}
7904 % is, say, 10\,cm, then each column will be $0.3\times10=3$\,cm
7905 % wide, leaving a gap of 1\,cm spread equally between columns
7906 % (i.e., .5\,cm between each).
7907 %
7908 % The arguments are 1)~the note series letter and 2)~the full text
7909 % of the note (including numbers, lemma and text).
7910 % \begin{macrocode}
7911 \newcommand*{\threecolvfootnote}[2]{%
7912 \insert\csname #1footins\endcsname\bgroup
7913 \notefontsetup
7914 \footsplitskips
7915 \csname #1footfmt\endcsname #2\egroup}
7916 % \end{macrocode}
7917 % \end{macro}
7918 %
7919 %
7920 % \begin{macro}{\threecolfootfmt}
7921 % \cs{threecolfootfmt}
7922 % is the command that formats one note.
7923 % It uses \cs{raggedright}, which will usually be
7924 % preferable with such short lines. Setting the \cs{parindent}
7925 % to zero means that, within each individual note, the lines begin
7926 % flush left.
7927 %
7928 % The arguments are 1)~the line numbers, 2)~the lemma and 3)~the
7929 % text of the \verb"-footnote" command.
7930 %
7931 % \begin{macrocode}
7932 \newcommand*{\threecolfootfmt}[3]{%
7933 \normal@pars
7934 \hsize .3\hsize
7935 \parindent=0pt
7936 \tolerance=5000
7937 \raggedright
7938 \leavevmode
7939 \strut{\notenumfont\printlines#1|}\enspace
7940 {\select@lemmafont#1|#2}\rbracket\enskip
7941 #3\strut\par\allowbreak}
7942 % \end{macrocode}
7943 % \end{macro}
7944 %
7945 % \begin{macro}{\threecolfootgroup}
7946 % And here is the \verb"footgroup" macro that's called within the
7947 % output routine to regroup the notes into three columns. Once
7948 % again, the call to \cs{notefontsetup} is there to ensure that
7949 % it is the right \cs{splittopskip}---the one used in
7950 % footnotes---which is used to provide the third argument for
7951 % \cs{rigidbalance}. This third argument (\cs{@h}) is the
7952 % \verb"topskip" for the box containing the text of the
7953 % footnotes, and does the job of making sure the top lines of the
7954 % columns line up horizontally. In \thetexbook, p.\,398,
7955 % Donald Knuth suggests retrieving the ouput of \cs{rigidbalance},
7956 % putting it back into the insertion box, and then printing the
7957 % box. Here, we just print the \cs{line} which comes out of
7958 % \cs{rigidbalance} directly, without any re-boxing.
7959 % \begin{macrocode}
7960 \newcommand*{\threecolfootgroup}[1]{{\notefontsetup
7961 \splittopskip=\ht\strutbox
7962 \expandafter
7963 \rigidbalance\csname #1footins\endcsname \thr@@ \splittopskip}}
7964 % \end{macrocode}
7965 % \end{macro}
7966 %
7967 % \begin{PW}
7968 % \begin{macro}{\mpthreecolfootgroup}
7969 % The setup for minipages.
7970 % \begin{macrocode}
7971 \newcommand*{\mpthreecolfootgroup}[1]{{%
7972 \vskip\skip\@nameuse{mp#1footins}
7973 \normalcolor
7974 \@nameuse{#1footnoterule}
7975 \splittopskip=\ht\strutbox
7976 \expandafter
7977 \rigidbalance\csname mp#1footins\endcsname \thr@@ \splittopskip}}
7978
7979 % \end{macrocode}
7980 % \end{macro}
7981 % \end{PW}
7982 %
7983 % \paragraph{Two columns}
7984 %
7985 % \begin{macro}{\foottwocol}
7986 % You say \verb"\foottwocol{A}" to have the \texttt{A} series of footnotes
7987 % typeset in two columns. It is important to call this only after
7988 % \cs{hsize} has been set for the document.
7989 % \begin{macrocode}
7990 \newcommand*{\foottwocol}[1]{%
7991 \expandafter\let\csname v#1footnote\endcsname=\twocolvfootnote
7992 \expandafter\let\csname #1footfmt\endcsname=\twocolfootfmt
7993 \expandafter\let\csname #1footgroup\endcsname=\twocolfootgroup
7994 \twocolfootsetup{#1}
7995 % \end{macrocode}
7996 % \begin{PW}
7997 % The additional setup for minipages.
7998 % \end{PW}
7999 % \begin{macrocode}
8000 \expandafter\let\csname mpv#1footnote\endcsname=\mpnormalvfootnote
8001 \expandafter\let\csname mp#1footgroup\endcsname=\mptwocolfootgroup
8002 \mptwocolfootsetup{#1}
8003 }
8004
8005 % \end{macrocode}
8006 % \end{macro}
8007 %
8008 % \begin{macro}{\twocolfootsetup}
8009 % \begin{macro}{\twocolvfootnote}
8010 % \begin{macro}{\twocolfootfmt}
8011 % \begin{macro}{\twocolfootgroup}
8012 % Here is a series of macros which are very similar to their
8013 % three-column counterparts. In this case,
8014 % each note is assumed to contribute only a half a line of text.
8015 % And the notes are set in columns
8016 % \verb"0.45\hsize" wide, giving a gap between them of one tenth
8017 % of the \cs{hsize}.
8018 % \begin{macrocode}
8019 \newcommand*{\twocolfootsetup}[1]{%
8020 \count\csname #1footins\endcsname 500
8021 \multiply\dimen\csname #1footins\endcsname \tw@}
8022 % \end{macrocode}
8023 % \begin{macrocode}
8024 \newcommand*{\twocolvfootnote}[2]{\insert\csname #1footins\endcsname\bgroup
8025 \notefontsetup
8026 \footsplitskips
8027 \csname #1footfmt\endcsname #2\egroup}
8028 % \end{macrocode}
8029 % \begin{macrocode}
8030 \newcommand*{\twocolfootfmt}[3]{%
8031 \normal@pars
8032 \hsize .45\hsize
8033 \parindent=0pt
8034 \tolerance=5000
8035 \raggedright
8036 \leavevmode
8037 \strut{\notenumfont\printlines#1|}\enspace
8038 {\select@lemmafont#1|#2}\rbracket\enskip
8039 #3\strut\par\allowbreak}
8040 % \end{macrocode}
8041 % \begin{macrocode}
8042 \newcommand*{\twocolfootgroup}[1]{{\notefontsetup
8043 \splittopskip=\ht\strutbox
8044 \expandafter
8045 \rigidbalance\csname #1footins\endcsname \tw@ \splittopskip}}
8046
8047 % \end{macrocode}
8048 % \end{macro}
8049 % \end{macro}
8050 % \end{macro}
8051 % \end{macro}
8052 %
8053 % \begin{PW}
8054 % \begin{macro}{\mptwocolfootsetup}
8055 % \begin{macro}{\mptwocolfootgroup}
8056 % The versions for minipages.
8057 % \begin{macrocode}
8058 \newcommand*{\mptwocolfootsetup}[1]{%
8059 \count\csname mp#1footins\endcsname 500
8060 \multiply\dimen\csname mp#1footins\endcsname \tw@}
8061 % \end{macrocode}
8062 % \begin{macrocode}
8063 \newcommand*{\mptwocolfootgroup}[1]{{%
8064 \vskip\skip\@nameuse{mp#1footins}
8065 \normalcolor
8066 \@nameuse{#1footnoterule}
8067 \splittopskip=\ht\strutbox
8068 \expandafter
8069 \rigidbalance\csname mp#1footins\endcsname \tw@ \splittopskip}}
8070
8071 % \end{macrocode}
8072 % \end{macro}
8073 % \end{macro}
8074 % \end{PW}
8075 %
8076 % \section{Output routine}
8077 % \label{output}\relax
8078 %
8079 % Now we begin the output routine and associated things.
8080 %
8081 % \begin{PW}I have deleted all the crop mark code.\end{PW}
8082 %
8083 % \begin{PW} There are a couple of macros from plain TeX that we need
8084 % (at least for now).
8085 %
8086 % \begin{macro}{\pageno}
8087 % \begin{macro}{\advancepageno}
8088 % \cs{pageno} is a page number, starting at 1, and \cs{advancepageno}
8089 % increments the number.
8090 % \begin{macrocode}
8091 \countdef\pageno=0 \pageno=1
8092 \newcommand*{\advancepageno}{\ifnum\pageno<\z@ \global\advance\pageno\m@ne
8093 \else\global\advance\pageno\@ne\fi}
8094
8095 % \end{macrocode}
8096 % \end{macro}
8097 % \end{macro}
8098 %
8099 % \end{PW}
8100 %
8101 %
8102 % \begin{PW} The next portion is probably the trickiest part of moving from
8103 % TeX to LaTeX. The original code is below, but we need
8104 % something very different. \end{PW}
8105 %
8106 % This is a new output routine, with changes to handle printing all our
8107 % footnotes. Those changes have not been added directly, but are in macros
8108 % that get called here: that should make it easier to see what would need
8109 % to be taken over to a different output routine. We continue to use the
8110 % \cs{pagebody}, \cs{makeheadline}, \cs{makefootline}, and \cs{dosupereject}
8111 % macros of \PlainTeX; for those macros, and the original version of
8112 % \cs{output}, see \thetexbook, p.\,364.
8113 % \begin{verbatim}
8114 % \output{\edmac@output}
8115 % \def\edmac@output{\shipout\vbox{\normal@pars
8116 % \vbox{\makeheadline\pagebody\makefootline}%
8117 % }%
8118 % \advancepageno
8119 % \ifnum\outputpenalty>-\@MM\else\dosupereject\fi}
8120 %
8121 % \def\pagecontents{\page@start
8122 % \ifvoid\topins\else\unvbox\topins\fi
8123 % \dimen@=\dp\@cclv \unvbox\@cclv % open up \box255
8124 % \do@feet
8125 % \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
8126 % \end{verbatim}
8127 %
8128 % \cs{do@feet} ships out all the footnotes. Standard \edmac{} has only
8129 % five feet, but there is nothing in principal to prevent you
8130 % from creating an arachnoid or centipedal edition; straightforward
8131 % modifications of \edmac{} are all that's required. However, the
8132 % myria\-pedal edition is ruled out by \TeX's limitations: the number
8133 % of insertion classes is limited to $255$.
8134 % \begin{verbatim}
8135 % \def\do@feet{%
8136 % \ifvoid\footins\else
8137 % \vskip\skip\footins
8138 % \footnoterule
8139 % \unvbox\footins
8140 % \fi
8141 % \ifvoid\Afootins\else
8142 % \Afootstart{A}\Afootgroup{A}%
8143 % \fi
8144 % \ifvoid\Bfootins\else
8145 % \Bfootstart{B}\Bfootgroup{B}%
8146 % \fi
8147 % \ifvoid\Cfootins\else
8148 % \Cfootstart{C}\Cfootgroup{C}%
8149 % \fi
8150 % \ifvoid\Dfootins\else
8151 % \Dfootstart{D}\Dfootgroup{D}%
8152 % \fi
8153 % \ifvoid\Efootins\else
8154 % \Efootstart{E}\Efootgroup{E}%
8155 % \fi}
8156 % \end{verbatim}
8157 %
8158 % \begin{PW} For information (and so that I don't forget it), the code that
8159 % now follows is part of the
8160 % standard LaTeX output routine.
8161 %
8162 % With luck we might only have to change \cs{@makecol} and
8163 % \cs{@reinserts}. The kernel
8164 % definition of these, and perhaps some other things, is:
8165 % \begin{verbatim}
8166 % \gdef \@makecol {%
8167 % \ifvoid\footins
8168 % \setbox\@outputbox \box\@cclv
8169 % \else
8170 % \setbox\@outputbox \vbox {%
8171 % \boxmaxdepth \@maxdepth
8172 % \@tempdima\dp\@cclv
8173 % \unvbox \@cclv
8174 % \vskip \skip\footins
8175 % \color@begingroup
8176 % \normalcolor
8177 % \footnoterule
8178 % \unvbox \footins
8179 % \color@endgroup
8180 % }%
8181 % \fi
8182 % \xdef\@freelist{\@freelist\@midlist}%
8183 % \global \let \@midlist \@empty
8184 % \@combinefloats
8185 % \ifvbox\@kludgeins
8186 % \@makespecialcolbox
8187 % \else
8188 % \setbox\@outputbox \vbox to\@colht {%
8189 % \@texttop
8190 % \dimen@ \dp\@outputbox
8191 % \unvbox\@outputbox
8192 % \vskip -\dimen@
8193 % \@textbottom
8194 % }%
8195 % \fi
8196 % \global \maxdepth \@maxdepth
8197 % }
8198 %
8199 % \gdef \@reinserts{%
8200 % \ifvoid\footins\else\insert\footins{\unvbox\footins}\fi
8201 % \ifvbox\@kludgeins\insert\@kludgeins{\unvbox\@kludgeins}\fi
8202 % }
8203 % \end{verbatim}
8204 %
8205 % Now we start actually changing things.
8206 %
8207 % \begin{macro}{\m@m@makecolfloats}
8208 % \begin{macro}{\m@m@makecoltext}
8209 % \begin{macro}{\m@m@makecolintro}
8210 % These macros are defined in the \Lclass{memoir} class and form part
8211 % of the definition of \verb?\@makecol?.
8212 % \changes{v0.2.1}{2003/09/13}{Added \cs{m@m@makecolfloats}, \cs{m@m@makecoltext}
8213 % and \cs{m@m@makecolintro}}
8214 % \begin{macrocode}
8215 \providecommand{\m@m@makecolfloats}{%
8216 \xdef\@freelist{\@freelist\@midlist}%
8217 \global \let \@midlist \@empty
8218 \@combinefloats}
8219 \providecommand{\m@m@makecoltext}{%
8220 \ifvbox\@kludgeins
8221 \@makespecialcolbox
8222 \else
8223 \setbox\@outputbox \vbox to\@colht {%
8224 \@texttop
8225 \dimen@ \dp\@outputbox
8226 \unvbox\@outputbox
8227 \vskip -\dimen@
8228 \@textbottom}%
8229 \fi}
8230 \providecommand{\m@m@makecolintro}{}
8231
8232 % \end{macrocode}
8233 % \end{macro}
8234 % \end{macro}
8235 % \end{macro}
8236 %
8237 % \begin{macro}{\l@d@makecol}
8238 % This is a partitioned version of the `standard' \cs{@makecol},
8239 % with the initial code put into another macro.
8240 % \changes{v0.2.1}{2003/09/13}{Rewrote \cs{@makecol}, calling it \cs{l@d@makecol}}
8241 % \begin{macrocode}
8242 \gdef\l@d@makecol{%
8243 \l@ddofootinsert
8244 \m@m@makecolfloats
8245 \m@m@makecoltext
8246 \global \maxdepth \@maxdepth}
8247
8248 % \end{macrocode}
8249 % \end{macro}
8250 %
8251 % \begin{macro}{\l@ddofootinsert}
8252 % This macro essentially holds the initial portion of the kernel
8253 % \cs{@makecol} code.
8254 % \changes{v0.2.1}{2003/09/13}{Renamed \cs{dofootinsert} as \cs{l@ddofootinsert}}
8255 % \changes{v0.7}{2005/02/25}{Deleted \cs{page@start} from \cs{l@ddofootinsert}}
8256 % \begin{macrocode}
8257 \newcommand*{\l@ddofootinsert}{%
8258 %%% \page@start
8259 \ifvoid\footins
8260 \setbox\@outputbox \box\@cclv
8261 \else
8262 \setbox\@outputbox \vbox {%
8263 \boxmaxdepth \@maxdepth
8264 \@tempdima\dp\@cclv
8265 \unvbox \@cclv
8266 \vskip \skip\footins
8267 \color@begingroup
8268 \normalcolor
8269 \footnoterule
8270 \unvbox \footins
8271 \color@endgroup
8272 }%
8273 \fi
8274 % \end{macrocode}
8275 % That's the end of the copy of the kernel code. We finally call a macro
8276 % to handle all the additional \edmac{} feet.
8277 % \begin{macrocode}
8278 \l@ddoxtrafeet
8279 }
8280
8281 % \end{macrocode}
8282 % \end{macro}
8283 %
8284 % \begin{macro}{\doxtrafeet}
8285 % \cs{doxtrafeet} is the code extending \cs{@makecol} to cater for
8286 % the extra \Ledmac{} feet. We have two classes of extra footnotes.
8287 % We order the footnote inserts so that the regular footnotes are first,
8288 % then class 1\index{class 1 feet} (familiar footnotes) and finally
8289 % class 2\index{class 2 feet} (critical footnotes).
8290 % \changes{v0.2.1}{2003/09/13}{Renamed \cs{doxtrafeet} to \cs{l@ddoxtrafeet}}
8291 % \begin{macrocode}
8292 \newcommand*{\l@ddoxtrafeet}{%
8293 \doxtrafeeti
8294 \doxtrafeetii}
8295
8296 % \end{macrocode}
8297 % \end{macro}
8298 %
8299 % \begin{macro}{\doxtrafeetii}
8300 % \cs{doxtrafeetii} is the code extending \cs{@makecol} to cater for
8301 % the extra critical feet (class 2 feet\index{class 2 feet}).
8302 % NOTE: the code is likely to be
8303 % `featurefull'.
8304 % \changes{v0.4.1}{2004/03/06}{Changed \cs{doxtrafeetii} code for easier extensions}
8305 % \begin{macrocode}
8306 \newcommand*{\doxtrafeetii}{%
8307 \setbox\@outputbox \vbox{%
8308 \unvbox\@outputbox
8309 \@opxtrafeetii}}
8310 % \end{macrocode}
8311 % \end{macro}
8312 %
8313 % \begin{macro}{\@opxtrafeetii}
8314 % The extra critical feet to be aded to the output.
8315 % \changes{v0.4.1}{2004/03/06}{Added \cs{@opxtrafeetii}}
8316 % \begin{macrocode}
8317 \newcommand*{\@opxtrafeetii}{%
8318 \ifvoid\Afootins\else\Afootstart{A}\Afootgroup{A}\fi
8319 \ifvoid\Bfootins\else\Bfootstart{B}\Bfootgroup{B}\fi
8320 \ifvoid\Cfootins\else\Cfootstart{C}\Cfootgroup{C}\fi
8321 \ifvoid\Dfootins\else\Dfootstart{D}\Dfootgroup{D}\fi
8322 \ifvoid\Efootins\else\Efootstart{E}\Efootgroup{E}\fi}
8323
8324 % \end{macrocode}
8325 % \end{macro}
8326 %
8327 %
8328 % \begin{macro}{\l@ddodoreinxtrafeet}
8329 % \cs{l@ddodoreinxtrafeet} is the code for catering for the extra footnotes
8330 % within \cs{@reinserts}. The implementation may well have to change.
8331 % We use the same classes and ordering as in \cs{l@ddoxtrafeet}.
8332 % \changes{v0.2.1}{203/09/13}{Renamed \cs{dodoreinxtrafeet} to \cs{l@ddodoreinxtrafeet}}
8333 % \begin{macrocode}
8334 \newcommand*{\l@ddodoreinxtrafeet}{%
8335 \doreinxtrafeeti
8336 \doreinxtrafeetii}
8337
8338 % \end{macrocode}
8339 % \end{macro}
8340 %
8341 % \begin{macro}{\doreinxtrafeetii}
8342 % \cs{doreinxtrafeetii} is the code for catering for the
8343 % class 2\index{class 2 feet} extra critical footnotes
8344 % within \cs{@reinserts}. The implementation may well have to change.
8345 % \begin{macrocode}
8346 \newcommand*{\doreinxtrafeetii}{%
8347 \ifvoid\Afootins\else\insert\Afootins{\unvbox\Afootins}\fi
8348 \ifvoid\Bfootins\else\insert\Bfootins{\unvbox\Bfootins}\fi
8349 \ifvoid\Cfootins\else\insert\Cfootins{\unvbox\Cfootins}\fi
8350 \ifvoid\Dfootins\else\insert\Dfootins{\unvbox\Dfootins}\fi
8351 \ifvoid\Efootins\else\insert\Efootins{\unvbox\Efootins}\fi
8352 }
8353
8354 % \end{macrocode}
8355 % \end{macro}
8356 %
8357 % \begin{macro}{\l@d@reinserts}
8358 % And here is the modified version of \cs{@reinserts}.
8359 % \begin{macrocode}
8360 \gdef \l@d@reinserts{%
8361 \ifvoid\footins\else\insert\footins{\unvbox\footins}\fi
8362 \l@ddodoreinxtrafeet
8363 \ifvbox\@kludgeins\insert\@kludgeins{\unvbox\@kludgeins}\fi
8364 }
8365
8366 % \end{macrocode}
8367 % \end{macro}
8368 %
8369 % The \Lclass{memoir} class does not use the `standard' versions of
8370 % \cs{@makecol} and \cs{@reinserts}, due to its sidebar insert.
8371 % We had better add that code if \Lclass{memoir} is used. (It can
8372 % be awkward dealing with |\if| code within |\if| code, so don't use
8373 % |\ifl@dmemoir| here.)
8374 % \changes{v0.2.1}{2003/09/13}{Major changes to insert code when memoir is loaded}
8375 % \begin{macrocode}
8376 \@ifclassloaded{memoir}{%
8377 % \end{macrocode}
8378 % \Lclass{memoir} is loaded so we use \Lclass{memoir}'s built in hooks.
8379 % \begin{macrocode}
8380 \g@addto@macro{\m@mdoextrafeet}{\l@ddoxtrafeet}%
8381 \g@addto@macro{\m@mdodoreinextrafeet}{\l@ddodoreinxtrafeet}%
8382 }{%
8383 % \end{macrocode}
8384 % \Lclass{memoir} has not been loaded, so redefine \verb?@makecol? and
8385 % \verb?@reinserts?.
8386 % \begin{macrocode}
8387 \gdef\@makecol{\l@d@makecol}%
8388 \gdef\@reinserts{\l@d@reinserts}%
8389 }
8390
8391 % \end{macrocode}
8392 %
8393 % \end{PW}
8394 %
8395 % \begin{PW}
8396 % \begin{macro}{\addfootins}
8397 % Let's make it easier for an author to create a new series by providing
8398 % this macro, \verb?\addfootins?\marg{letter}, to add the series to
8399 % the several lists.
8400 % \changes{v0.4.1}{2004/03/06}{Added \cs{addfootins}}
8401 % \begin{macrocode}
8402 \newcommand*{\addfootins}[1]{%
8403 \footnormal{#1}
8404 % \end{macrocode}
8405 % Add it to the output.
8406 % \begin{macrocode}
8407 \g@addto@macro{\@opxtrafeetii}{%
8408 \ifvoid\@nameuse{#1footins}\else
8409 \@nameuse{#1footstart{#1}}\@nameuse{#1footgroup}{#1}\fi}
8410 % \end{macrocode}
8411 % Add it to the reinsertions.
8412 % \begin{macrocode}
8413 \g@addto@macro{\doreinxtrafeetii}{%
8414 \ifvoid\@nameuse{#1footins}\else
8415 \insert\@nameuse{#1footins}{\unvbox\@nameuse{#1footins}}\fi}
8416 % \end{macrocode}
8417 % Add it to minipages.
8418 % \begin{macrocode}
8419 \g@addto@macro{\l@dedbeginmini}{%
8420 \expandafter\let\csname #1footnote\endcsname = \@nameuse{mp#1footnote}}
8421 % \end{macrocode}
8422 % And at the end of a minipage.
8423 % \begin{macrocode}
8424 \g@addto@macro{\l@dedendmini}{%
8425 \ifvoid\@nameuse{mp#1footins}\else\@nameuse{mpfootgroup#1{#1}}\fi}
8426 }
8427
8428 % \end{macrocode}
8429 % \end{macro}
8430 %
8431 % It turns out that \verb?\@doclearpage? also needs modifying.
8432 % \changes{v0.4.1}{2004/03/25}{Added code for changing \cs{@doclearpage}}
8433 % \begin{macro}{\if@led@nofoot}
8434 % \begin{macro}{\@led@extranofeet}
8435 % We have to check if there are any leftover feet. \verb?\@led@extranofeet?
8436 % is a hook for handling further footnotes.
8437 % \begin{macrocode}
8438 \newif\if@led@nofoot
8439 \newcommand*{\@led@extranofeet}{}
8440
8441 % \end{macrocode}
8442 % \end{macro}
8443 % \end{macro}
8444 %
8445 % \begin{macrocode}
8446 \@ifclassloaded{memoir}{%
8447 % \end{macrocode}
8448 % If the \Lclass{memoir} class is loaded we hook into its modified
8449 % \verb?\@doclearpage?.
8450 % \begin{macro}{\@mem@extranofeet}
8451 % \begin{macrocode}
8452 \g@addto@macro{\@mem@extranofeet}{%
8453 \ifvoid\Afootins\else\@mem@nofootfalse\fi
8454 \ifvoid\Bfootins\else\@mem@nofootfalse\fi
8455 \ifvoid\Cfootins\else\@mem@nofootfalse\fi
8456 \ifvoid\Dfootins\else\@mem@nofootfalse\fi
8457 \ifvoid\Efootins\else\@mem@nofootfalse\fi
8458 \ifvoid\footinsA\else\@mem@nofootfalse\fi
8459 \ifvoid\footinsB\else\@mem@nofootfalse\fi
8460 \ifvoid\footinsC\else\@mem@nofootfalse\fi
8461 \@led@extranofeet}
8462 }{%
8463 % \end{macrocode}
8464 % \end{macro}
8465 % As \Lclass{memoir} is not loaded we have to do it all here.
8466 % \begin{macro}{\@led@testifnofoot}
8467 % \begin{macro}{\@doclearpage}
8468 % \begin{macrocode}
8469 \newcommand*{\@led@testifnofoot}{%
8470 \@led@nofoottrue
8471 \ifvoid\footins\else\@led@nofootfalse\fi
8472 \ifvoid\Afootins\else\@led@nofootfalse\fi
8473 \ifvoid\Bfootins\else\@led@nofootfalse\fi
8474 \ifvoid\Cfootins\else\@led@nofootfalse\fi
8475 \ifvoid\Dfootins\else\@led@nofootfalse\fi
8476 \ifvoid\Efootins\else\@led@nofootfalse\fi
8477 \ifvoid\footinsA\else\@led@nofootfalse\fi
8478 \ifvoid\footinsB\else\@led@nofootfalse\fi
8479 \ifvoid\footinsC\else\@led@nofootfalse\fi
8480 \@led@extranofeet}
8481
8482 \renewcommand{\@doclearpage}{%
8483 \@led@testifnofoot
8484 \if@led@nofoot
8485 \setbox\@tempboxa\vsplit\@cclv to\z@ \unvbox\@tempboxa
8486 \setbox\@tempboxa\box\@cclv
8487 \xdef\@deferlist{\@toplist\@botlist\@deferlist}%
8488 \global \let \@toplist \@empty
8489 \global \let \@botlist \@empty
8490 \global \@colroom \@colht
8491 \ifx \@currlist\@empty
8492 \else
8493 \@latexerr{Float(s) lost}\@ehb
8494 \global \let \@currlist \@empty
8495 \fi
8496 \@makefcolumn\@deferlist
8497 \@whilesw\if@fcolmade \fi{\@opcol\@makefcolumn\@deferlist}%
8498 \if@twocolumn
8499 \if@firstcolumn
8500 \xdef\@dbldeferlist{\@dbltoplist\@dbldeferlist}%
8501 \global \let \@dbltoplist \@empty
8502 \global \@colht \textheight
8503 \begingroup
8504 \@dblfloatplacement
8505 \@makefcolumn\@dbldeferlist
8506 \@whilesw\if@fcolmade \fi{\@outputpage
8507 \@makefcolumn\@dbldeferlist}%
8508 \endgroup
8509 \else
8510 \vbox{}\clearpage
8511 \fi
8512 \fi
8513 \else
8514 \setbox\@cclv\vbox{\box\@cclv\vfil}%
8515 \l@d@makecol\@opcol
8516 \clearpage
8517 \fi}
8518 }
8519
8520 % \end{macrocode}
8521 % \end{macro}
8522 % \end{macro}
8523 %
8524 % \end{PW}
8525 %
8526 % \section{Cross referencing}
8527 % \label{xref}\relax
8528 %
8529 % \begin{PW}
8530 % I have rewritten portions of the code in this section so that
8531 % the LaTeX \file{.aux} file is used. This will also handle \cs{include}d
8532 % files.
8533 %
8534 % Further, I have renamed some of the original \edmac{} macros so that
8535 % they do not clash with the LaTeX label/ref commands (\edmac{} and LaTeX
8536 % use very different mechanisms). In particular,
8537 % the original \edmac{} \cs{label} and \cs{pageref} have been renamed
8538 % as \cs{edlabel} and \cs{edpageref} respectively.
8539 % \end{PW}
8540 %
8541 %
8542 % You can mark a place in the text using a command of the form
8543 % \verb"\edlabel{foo}", and later refer to it using the label
8544 % \verb"foo" by saying \verb"\edpageref{foo}", or \verb"\lineref{foo}" or
8545 % \verb"\sublineref{foo}". These reference commands will produce,
8546 % respectively, the page, line and sub-line on which the
8547 % \verb"\edlabel{foo}" command occurred.
8548 %
8549 % The reference macros warn you if a reference is made to an
8550 % undefined label. If \verb"foo" has been used as a label before,
8551 % the \verb"\edlabel{foo}" command will issue a complaint; subsequent
8552 % \cs{edpageref} and \cs{lineref} commands will refer to the
8553 % latest occurrence of \verb"\label{foo}".
8554 %
8555 % \begin{macro}{\labelref@list}
8556 % Set up a new list, \cs{labelref@list}, to hold the page, line and
8557 % sub-line numbers for each label.
8558 % \begin{macrocode}
8559 \list@create{\labelref@list}
8560 % \end{macrocode}
8561 % \end{macro}
8562 %
8563 %
8564 % \begin{macro}{\zz@@@}
8565 % A convenience macro to zero two labeling counters in one go.
8566 % \changes{v0.2.1}{2003/08/26}{Minor change to \cs{zz@@@}}
8567 % \begin{macrocode}
8568 %% \newcommand*{\zz@@@}{000|000|000} % set three counters to zero in one go
8569 \newcommand*{\zz@@@}{000|000} % set two counters to zero in one go
8570
8571 % \end{macrocode}
8572 % \end{macro}
8573 %
8574 % \begin{macro}{\edlabel}
8575 % The \cs{edlabel} command first writes a \cs{@lab} macro to
8576 % the \cs{linenum@out} file. It then checks to see that the
8577 % \cs{labelref@list} actually has something in it (if not, it
8578 % creates a dummy entry), and pops the next value for the current
8579 % label, storing it in \cs{label@refs}. Finally it defines the
8580 % label to be \cs{empty} so that any future check will turn up
8581 % the fact that it has been used.\footnote{The remaining macros
8582 % in this section were kindly revised by Wayne
8583 % Sullivan,\index{Sullivan, Wayne} who
8584 % substantially improved their efficiency and flexibility.}
8585 %
8586 % \begin{PW}
8587 % This version of the original \edmac{} \cs{label} uses \cs{@bsphack}
8588 % and \cs{@esphack} to eliminate extra space problems and also the LaTeX
8589 % write methods for the \file{.aux} file.
8590 %
8591 % Jesse Billett\footnote{(\url{[email protected]}) via the \texttt{ctt}
8592 % thread `ledmac cross referencing', 25 August 2003.}
8593 % found that the original code could be off by several pages. This version,
8594 % hopefully cures that, and also allows for non-arabic page numbering.
8595 % \end{PW}
8596 %
8597 % \changes{v0.2.1}{2003/08/26}{Tweaked \cs{edlabel} to get correct page numbers}
8598 % \changes{v0.14}{2012/04/04}{Tweaked \cs{edlabel} to get correct line number if the command is first element of a paragraph.}
8599 % \begin{macrocode}
8600 \newcommand*{\edlabel}[1]{\@bsphack
8601 \write\linenum@out{\string\@lab}%
8602 \ifx\labelref@list\empty
8603 \xdef\label@refs{\zz@@@}%
8604 \else
8605 \gl@p\labelref@list\to\label@refs
8606 \ifvmode
8607 \advancelabel@refs
8608 \fi
8609 \fi
8610 % \edef\next{\write\@aux{\string\l@dmake@labels\label@refs|{#1}}}%
8611 % \next}
8612 % \end{macrocode}
8613 % \begin{PW}
8614 % Use code from the kernel \cs{label} command to write the correct
8615 % page number (it seems possible that the original \edmac's \cs{page@num}
8616 % scheme might also have had problems in this area).
8617 % \end{PW}
8618 % \begin{macrocode}
8619 \protected@write\@auxout{}%
8620 {\string\l@dmake@labels\space\thepage|\label@refs|{#1}}%
8621 \@esphack}
8622
8623 % \end{macrocode}
8624 % \end{macro}
8625 %
8626 %
8627 %\begin{macro}{\advancelabel@refs}
8628 %\begin{macro}{\labelrefsparseline}
8629 %\begin{macro}{\labelrefsparsesubline}
8630 % \begin{macrocode}
8631 %In cases where \cs{edlabel} is the first element in a paragraph, we have a problem with line counts, because line counts change only at the first horizontal box of the paragraph.
8632 %Hence, we need to test \cs{edlabel} if it occurs at the start of a paragraph. To do so, we use \cs{ifvmode}. If the test is true, we must advance by one unit the amount of text we write into the \verb].aux] file.
8633 %\changes{v0.19}{2012/09/08}{Debug \cs{advancelabel@refs} to prevent some troubles.}
8634 %We do so using \cs[advancelabel@refs} command.
8635 \newcommand{\advancelabel@refs}{%
8636 \newcounter{line}%
8637 \setcounter{line}{\expandafter\labelrefsparseline\label@refs}%
8638 \stepcounter{line}%
8639 \ifsublines@%
8640 \newcounter{subline}%
8641 \setcounter{subline}{\expandafter\labelrefsparsesubline\label@refs}%
8642 \stepcounter{subline}{1}%
8643 \def\label@refs{\theline|\thesubline}%
8644 \else%
8645 \def\label@refs{\theline|0}%
8646 \fi%
8647 }
8648 \def\labelrefsparseline#1|#2{#1}
8649 \def\labelrefsparsesubline#1|#2{#2}
8650 % \end{macrocode}
8651 % \end{macro}
8652 % \end{macro}
8653 % \end{macro}
8654 % \begin{macro}{\l@dmake@labels}
8655 % The \cs{l@dmake@labels} macro gets executed when the labels file is
8656 % read. For each label it defines a macro, whose name is made up
8657 % partly from the label you supplied, that contains the page, line
8658 % and sub-line numbers. But first it checks to see whether the
8659 % label has already been used (and complains if it has).
8660 %
8661 % \begin{PW}
8662 % The initial use of \cs{newcommand} is to catch if \cs{l@dmake@labels}
8663 % has been previously defined (by a class or package).
8664 % \end{PW}
8665 % \begin{macrocode}
8666 \newcommand*{\l@dmake@labels}{}
8667 \def\l@dmake@labels#1|#2|#3|#4{%
8668 \expandafter\ifx\csname the@label#4\endcsname \relax\else
8669 \led@warn@DuplicateLabel{#4}%
8670 \fi
8671 \expandafter\gdef\csname the@label#4\endcsname{#1|#2|#3}%
8672 \ignorespaces}
8673
8674 % \end{macrocode}
8675 % \end{macro}
8676 %
8677 % \begin{PW}
8678 % LaTeX reads the \texttt{aux} file at both the beginning and end of
8679 % the document, so we have to switch off duplicate label checking
8680 % after the first time the file is read.
8681 % \end{PW}
8682 %
8683 % \begin{macrocode}
8684 \AtBeginDocument{%
8685 \def\l@dmake@labels#1|#2|#3|#4{}%
8686 }
8687
8688 % \end{macrocode}
8689 %
8690 % \begin{macro}{\@lab}
8691 % The \cs{@lab} command, which appears in the \cs{linenum@out} file,
8692 % appends the current values of page, line and sub-line to the
8693 % \cs{labelref@list}. These values are defined by the earlier
8694 % \cs{@page}, \cs{@l}, and the \cs{sub@on} and \cs{sub@off} commands
8695 % appearing in the \cs{linenum@out} file.
8696 %
8697 % \begin{PW}
8698 % LaTeX uses the \texttt{page} counter for page numbers. However,
8699 % it appears that this is not the right place to grab the page number.
8700 % That task is now done in the \cs{edlabel} macro. This version
8701 % of \cs{@lab} appends just the current line and sub-line numbers
8702 % to \cs{labelref@list}.
8703 % \end{PW}
8704 % \changes{v0.2.1}{2003/08/26}{Removed page setting from \cs{@lab}}
8705 % \changes{v0.3}{2004/02/14}{Replaced \cs{the}\cs{line@num} by
8706 % \cs{linenumr@p}\cs{line@num} in
8707 % \cs{@lab}, and similar for sub-lines}
8708 % \begin{macrocode}
8709 \newcommand*{\@lab}{\xright@appenditem
8710 {\linenumrep{\line@num}|%
8711 \ifsublines@ \sublinenumrep{\subline@num}\else 0\fi}\to\labelref@list}
8712
8713 % \end{macrocode}
8714 % \end{macro}
8715 %
8716 % \begin{macro}{\edpageref}
8717 % \begin{macro}{\xpageref}
8718 % If the specified label exists, \cs{edpageref} gives its page number.
8719 % For this reference command, as for the other two, a special
8720 % version with prefix \verb"x" is provided for use in places where the
8721 % command is to be scanned as a number, as in \cs{linenum}. These
8722 % special versions have two limitations: they don't print error
8723 % messages if the reference is unknown, and they can't appear as
8724 % the first label or reference command in the file; you must ensure
8725 % that a \cs{edlabel} or a normal reference command appears first, or
8726 % these x-commands will always return zeros.
8727 % \begin{PW} LaTeX already defines a \cs{pageref}, so changing the name
8728 % to \cs{edpageref}. \end{PW}
8729 % \begin{macrocode}
8730 \newcommand*{\edpageref}[1]{\l@dref@undefined{#1}\l@dgetref@num{1}{#1}}
8731 \newcommand*{\xpageref}[1]{\l@dgetref@num{1}{#1}}
8732
8733 % \end{macrocode}
8734 % \end{macro}
8735 % \end{macro}
8736 %
8737 % \begin{macro}{\lineref}
8738 % \begin{macro}{\xlineref}
8739 % If the specified label exists, \cs{lineref} gives its line number.
8740 % \begin{macrocode}
8741 \newcommand*{\lineref}[1]{\l@dref@undefined{#1}\l@dgetref@num{2}{#1}}
8742 \newcommand*{\xlineref}[1]{\l@dgetref@num{2}{#1}}
8743
8744 % \end{macrocode}
8745 % \end{macro}
8746 % \end{macro}
8747 %
8748 % \begin{macro}{\sublineref}
8749 % \begin{macro}{\xsublineref}
8750 % If the specified label exists, \cs{sublineref} gives its sub-line number.
8751 % \begin{macrocode}
8752 \newcommand*{\sublineref}[1]{\l@dref@undefined{#1}\l@dgetref@num{3}{#1}}
8753 \newcommand*{\xsublineref}[1]{\l@dgetref@num{3}{#1}}
8754
8755 % \end{macrocode}
8756 % \end{macro}
8757 % \end{macro}
8758 %
8759 % The next three macros are used by the referencing commands above,
8760 % and do the job of extracting the right numbers from the label
8761 % macro that contains the page, line, and sub-line number.
8762 %
8763 % \begin{macro}{\l@dref@undefined}
8764 % The \cs{l@dref@undefined} macro is called when you refer to a label with
8765 % the normal referencing macros. Its argument is a label, and it
8766 % just checks that the label has been defined.
8767 %
8768 % \begin{macrocode}
8769 \newcommand*{\l@dref@undefined}[1]{%
8770 \expandafter\ifx\csname the@label#1\endcsname\relax
8771 \led@warn@RefUndefined{#1}%
8772 \fi}
8773
8774 % \end{macrocode}
8775 % \end{macro}
8776 %
8777 % \begin{macro}{\l@dgetref@num}
8778 % Next, \cs{l@dgetref@num} fetches the number we want. It has two
8779 % arguments: the first is simply a digit, specifying whether to
8780 % fetch a page (1), line (2) or sub-line (3) number. (This
8781 % switching is done by calling \cs{l@dlabel@parse}.) The second argument
8782 % is the label-macro, which because of the \cs{@lab} macro above is
8783 % defined to be a string of the type \verb"123|456|789".
8784 % \begin{macrocode}
8785 \newcommand*{\l@dgetref@num}[2]{%
8786 \expandafter
8787 \ifx\csname the@label#2\endcsname \relax
8788 000%
8789 \else
8790 \expandafter\expandafter\expandafter
8791 \l@dlabel@parse\csname the@label#2\endcsname|#1%
8792 \fi}
8793
8794 % \end{macrocode}
8795 % \end{macro}
8796 %
8797 % \begin{macro}{\l@dlabel@parse}
8798 % Notice that we slipped another \verb"|" delimiter into the
8799 % penultimate line of \cs{l@dgetref@num}, to
8800 % keep the `switch-number' separate from the reference numbers. This
8801 % \verb"|" is used as another parameter delimiter by \cs{l@dlabel@parse},
8802 % which extracts the appropriate number from its first arguments.
8803 % The \verb"|"-delimited arguments consist of the expanded label-macro
8804 % (three reference numbers), followed by the switch-number (1,
8805 % 2, or 3) which defines which of the earlier three numbers to
8806 % pick out. (It was earlier given as the first argument of
8807 % \cs{l@dgetref@num}.)
8808 % \begin{macrocode}
8809 \newcommand*{\l@dlabel@parse}{}
8810 \def\l@dlabel@parse#1|#2|#3|#4{%
8811 \ifcase #4\relax
8812 \or #1%
8813 \or #2%
8814 \or #3%
8815 \fi}
8816
8817 % \end{macrocode}
8818 % \end{macro}
8819 %
8820 % \begin{macro}{\xxref}
8821 % The \cs{xxref} command takes two arguments, both of which are
8822 % labels, e.g., \verb"\xxref{mouse}{elephant}". It first does some
8823 % checking to make sure that the labels do exist (if one doesn't,
8824 % those numbers are set to zero). Then it calls \cs{linenum} and sets
8825 % the beginning page, line, and sub-line numbers to those of the
8826 % place where \verb"\label{mouse}" was placed, and the ending
8827 % numbers to those at \verb"\label{elephant}". The point of this is
8828 % to be able to manufacture footnote line references to passages
8829 % which can't be specified in the normal way as the first argument
8830 % to \cs{critext} for one reason or another. Using \cs{xxref} in the
8831 % second argument of \cs{critext} lets you set things up at least
8832 % semi-automatically.
8833 % \begin{macrocode}
8834 \newcommand*{\xxref}[2]{%
8835 {\expandafter\ifx\csname the@label#1\endcsname
8836 \relax \expandafter\let\csname the@label#1\endcsname\zz@@@\fi
8837 \expandafter\ifx\csname the@label#2\endcsname \relax
8838 \expandafter\let\csname the@label#2\endcsname\zz@@@\fi
8839 \linenum{\csname the@label#1\endcsname|%
8840 \csname the@label#2\endcsname}}}
8841
8842 % \end{macrocode}
8843 % \end{macro}
8844 %
8845 % \begin{macro}{\edmakelabel}
8846 % Sometimes the \cs{edlabel} command cannot be used to specify
8847 % exactly the page and line desired; you can use the \cs{edmakelabel} macro
8848 % make your own label. For example, if you say
8849 % `\verb"\edmakelabel{elephant}{10|25|0}"' you will have created a
8850 % new label, and a later call to \verb"\edpageref{elephant}" would
8851 % print `10' and \verb"\lineref{elephant}" would print `25'.
8852 % The sub-line number here is zero.
8853 % \cs{edmakelabel} takes a label, followed by a page and a line number(s)
8854 % as arguments.
8855 % \begin{PW} LaTeX defines a \cs{makelabel} macro which is used in lists.
8856 % I've changed the name to \cs{edmakelabel}. \end{PW}
8857 % \begin{macrocode}
8858 \newcommand*{\edmakelabel}[2]{\expandafter\xdef\csname the@label#1\endcsname{#2}}
8859
8860 % \end{macrocode}
8861 % (If you are only going to refer to such a label using
8862 % \cs{xxref}, then you can omit entries in the same way as with
8863 % \cs{linenum} (see pp.\,\pageref{linenumdef} and
8864 % \pageref{linenumbers}), since \cs{xxref} makes a call to
8865 % \cs{linenum} in order to do its work.)
8866 % \end{macro}
8867 %
8868 %
8869 % \section{Endnotes}
8870 % \label{endnotes}\relax
8871 %
8872 % \begin{macro}{\l@d@end}
8873 % \begin{macro}{\ifl@dend@}
8874 % \begin{macro}{\l@dend@true}
8875 % \begin{macro}{\l@dend@false}
8876 % Endnotes of all varieties are saved up in a file, typically named
8877 % \meta{jobname}\file{.end}.
8878 % \cs{l@d@end} is the output stream number for
8879 % this file, and \verb"\ifl@dend@" is a flag that's \verb"true" when the file is open.
8880 % \begin{macrocode}
8881 \newwrite\l@d@end
8882 \newif\ifl@dend@
8883 % \end{macrocode}
8884 % \end{macro}
8885 % \end{macro}
8886 % \end{macro}
8887 % \end{macro}
8888 %
8889 % \begin{macro}{\l@dend@open}
8890 % \begin{macro}{\l@dend@close}
8891 % \cs{l@dend@open} and \cs{l@dend@close} are the
8892 % macros that are used to open and close the endnote file. Note that
8893 % all our writing to this file is \cs{immediate}: all page and
8894 % line numbers for the endnotes are generated by the same mechanism
8895 % we use for the footnotes, so that there's no need to defer any
8896 % writing to catch information from the output routine.
8897 % \begin{macrocode}
8898 \newcommand{\l@dend@open}[1]{\global\l@dend@true\immediate\openout\l@d@end=#1\relax}
8899 \newcommand{\l@dend@close}{\global\l@dend@false\immediate\closeout\l@d@end}
8900
8901 % \end{macrocode}
8902 % \end{macro}
8903 % \end{macro}
8904 %
8905 % \begin{macro}{\l@dend@stuff}
8906 % \cs{l@dend@stuff} is used by \cs{beginnumbering} to
8907 % do everything that's necessary for the endnotes at the
8908 % start of each section: it opens the \cs{l@d@end} file, if necessary,
8909 % and writes the section number to the endnote file.
8910 % \begin{macrocode}
8911 \newcommand{\l@dend@stuff}{%
8912 \ifl@dend@\relax\else
8913 \l@dend@open{\jobname.end}%
8914 \fi
8915 \immediate\write\l@d@end{\string\l@d@section{\the\section@num}}}
8916
8917 % \end{macrocode}
8918 % \end{macro}
8919 %
8920 % \begin{macro}{\Aendnote}
8921 % \begin{macro}{\Bendnote}
8922 % \begin{macro}{\Cendnote}
8923 % \begin{macro}{\Dendnote}
8924 % \begin{macro}{\Eendnote}
8925 % The following five macros each function to
8926 % write one endnote to the \file{.end} file. Like the footnotes, these
8927 % endnotes come in five series, \texttt{A} through \texttt{E}. We change
8928 % \cs{newlinechar} so that in the file every space becomes the
8929 % start of a new line; this generally ensures that a long note doesn't
8930 % exceed restrictions on the length of lines in files.
8931 % \begin{macrocode}
8932 \newcommand*{\Aendnote}[1]{{\newlinechar='40
8933 \immediate\write\l@d@end{\string\Aend%
8934 {\ifnumberedpar@\l@d@nums\fi}%
8935 {\ifnumberedpar@\@tag\fi}{#1}}}\ignorespaces}
8936 % \end{macrocode}
8937 % \begin{macrocode}
8938 \newcommand*{\Bendnote}[1]{{\newlinechar='40
8939 \immediate\write\l@d@end{\string\Bend%
8940 {\ifnumberedpar@\l@d@nums\fi}%
8941 {\ifnumberedpar@\@tag\fi}{#1}}}\ignorespaces}
8942 % \end{macrocode}
8943 % \begin{macrocode}
8944 \newcommand*{\Cendnote}[1]{{\newlinechar='40
8945 \immediate\write\l@d@end{\string\Cend%
8946 {\ifnumberedpar@\l@d@nums\fi}%
8947 {\ifnumberedpar@\@tag\fi}{#1}}}\ignorespaces}
8948 % \end{macrocode}
8949 % \begin{macrocode}
8950 \newcommand*{\Dendnote}[1]{{\newlinechar='40
8951 \immediate\write\l@d@end{\string\Dend%
8952 {\ifnumberedpar@\l@d@nums\fi}%
8953 {\ifnumberedpar@\@tag\fi}{#1}}}\ignorespaces}
8954 % \end{macrocode}
8955 % \begin{macrocode}
8956 \newcommand*{\Eendnote}[1]{{\newlinechar='40
8957 \immediate\write\l@d@end{\string\Eend%
8958 {\ifnumberedpar@\l@d@nums\fi}%
8959 {\ifnumberedpar@\@tag\fi}{#1}}}\ignorespaces}
8960
8961 % \end{macrocode}
8962 % \end{macro}
8963 % \end{macro}
8964 % \end{macro}
8965 % \end{macro}
8966 % \end{macro}
8967 %
8968 % \begin{macro}{\Aend}
8969 % \begin{macro}{\Bend}
8970 % \begin{macro}{\Cend}
8971 % \begin{macro}{\Dend}
8972 % \begin{macro}{\Eend}
8973 % \begin{macro}{\endprint}
8974 % \begin{macro}{\@gobblethree}
8975 % \begin{macro}{\l@d@section}
8976 % \cs{Aendnote} and the like write commands called \cs{Aend} and
8977 % so on to the endnote file; these are analogous to the various
8978 % \verb"footfmt" commands above, and they take the same arguments.
8979 % When we process this file, we'll want to pick out the notes of one
8980 % series and ignore all the rest. To do that, we equate the \verb"end"
8981 % command for the series we want to \cs{endprint}, and leave the
8982 % rest equated to \cs{@gobblethree}, which just skips over its three
8983 % arguments.\footnote{Christophe Hebeisen (\texttt{[email protected]})
8984 % emailed on 2003/11/05 to say he had found that \cs{@gobblethree} was also
8985 % defined in the amsfonts package.} The \cs{endprint} here is nearly identical in its
8986 % functioning to \cs{normalfootfmt}.
8987 %
8988 % The endnote file also contains \cs{l@d@section} commands, which
8989 % supply the section numbers from the main text; standard \Ledmac{} does
8990 % nothing with this information, but it's there if you want to write
8991 % custom macros to do something with it.
8992 % \changes{v0.2.2}{2003/11/05}{Used \cs{providecommand} for \cs{@gobblethree}
8993 % to avoid clash with the amsfonts package}
8994 % \begin{macrocode}
8995 \def\endprint#1#2#3{{\notefontsetup{\notenumfont\printendlines#1|}%
8996 \enspace{\select@lemmafont#1|#2}\enskip#3\par}}
8997 \providecommand*{\@gobblethree}[3]{}
8998 \let\Aend=\@gobblethree
8999 \let\Bend=\@gobblethree
9000 \let\Cend=\@gobblethree
9001 \let\Dend=\@gobblethree
9002 \let\Eend=\@gobblethree
9003 \let\l@d@section=\@gobble
9004
9005 % \end{macrocode}
9006 % \end{macro}
9007 % \end{macro}
9008 % \end{macro}
9009 % \end{macro}
9010 % \end{macro}
9011 % \end{macro}
9012 % \end{macro}
9013 % \end{macro}
9014 %
9015 % \begin{PW}
9016 % \begin{macro}{\setprintendlines}
9017 % The \cs{printendlines} macro is similar to \cs{printlines} but is
9018 % for printing endnotes rather than footnotes.
9019 %
9020 % The principal difference between foot- and endnotes is that footnotes
9021 % are printed on the page where they are specified but endnotes
9022 % are printed at a different point in the document. We need an indication
9023 % of the source of an endnote; \cs{setprintendlines} provides this
9024 % by always printing the page number. The coding is slightly simpler than
9025 % \cs{setprintlines}.
9026 %
9027 % First of all, we print the second page number only if
9028 % the ending page number is different
9029 % from the starting page number.\phantomsection\label{printendlines}
9030 % \changes{v0.7}{2005/02/18}{Added \cs{setprintendlines} for use by
9031 % \cs{printendlines}}
9032 % \begin{macrocode}
9033 \newcommand*{\setprintendlines}[6]{%
9034 \l@d@pnumfalse \l@d@dashfalse
9035 \ifnum#4=#1 \else
9036 \l@d@pnumtrue
9037 \l@d@dashtrue
9038 \fi
9039 % \end{macrocode}
9040 %
9041 % We print the ending line number if\/: (1)~we're printing the ending
9042 % page number, or (2)~it's different from the starting line number.
9043 % \begin{macrocode}
9044 \ifl@d@pnum \l@d@elintrue \else \l@d@elinfalse \fi
9045 \ifnum#2=#5 \else
9046 \l@d@elintrue
9047 \l@d@dashtrue
9048 \fi
9049 % \end{macrocode}
9050 %
9051 % We print the starting sub-line if it's nonzero.
9052 % \begin{macrocode}
9053 \l@d@ssubfalse
9054 \ifnum#3=0 \else
9055 \l@d@ssubtrue
9056 \fi
9057 % \end{macrocode}
9058 %
9059 % We print the ending sub-line if it's nonzero and: (1)~it's different
9060 % from the starting sub-line number, or (2)~the ending line number is
9061 % being printed.
9062 % \begin{macrocode}
9063 \l@d@eslfalse
9064 \ifnum#6=0 \else
9065 \ifnum#6=#3
9066 \ifl@d@elin \l@d@esltrue \else \l@d@eslfalse \fi
9067 \else
9068 \l@d@esltrue
9069 \l@d@dashtrue
9070 \fi
9071 \fi}
9072 % \end{macrocode}
9073 % \end{macro}
9074 %
9075 % \begin{macro}{\printendlines}
9076 % Now we're ready to print it all.
9077 % \changes{v0.3}{2004/02/14}{Added \cs{linenumr@p} and \cs{sublinenumr@p}
9078 % to \cs{printendlines}}
9079 % \begin{macrocode}
9080 \def\printendlines#1|#2|#3|#4|#5|#6|#7|{\begingroup
9081 \setprintendlines{#1}{#2}{#3}{#4}{#5}{#6}%
9082 % \end{macrocode}
9083 % The only subtlety left here is when to print a period between
9084 % numbers. But the only instance in which this is tricky is for the
9085 % ending sub-line number: it could be coming after the starting
9086 % sub-line number (in which case we want only the dash) or after an
9087 % ending line number (in which case we need to insert a period).
9088 % \begin{macrocode}
9089 \printnpnum{#1} \linenumrep{#2}%
9090 \ifl@d@ssub \fullstop \sublinenumrep{#3}\fi
9091 \ifl@d@dash \endashchar\fi
9092 \ifl@d@pnum \printnpnum{#4}\fi
9093 \ifl@d@elin \linenumrep{#5}\fi
9094 \ifl@d@esl \ifl@d@elin \fullstop\fi \sublinenumrep{#6}\fi
9095 \endgroup}
9096
9097 % \end{macrocode}
9098 % \end{macro}
9099 %
9100 % \begin{macro}{\printnpnum}
9101 % A macro to print a page number in an endnote.
9102 % \begin{macrocode}
9103 \newcommand*{\printnpnum}[1]{p.#1) }
9104
9105 % \end{macrocode}
9106 % \end{macro}
9107 % \end{PW}
9108 %
9109 %
9110 % \begin{macro}{\doendnotes}
9111 % \cs{doendnotes} is
9112 % the command you use to print one series of endnotes; it
9113 % takes one argument, the series letter of the note series you want
9114 % to print.
9115 % \begin{macrocode}
9116 \newcommand*{\doendnotes}[1]{\l@dend@close
9117 \begingroup
9118 \makeatletter
9119 \expandafter\let\csname #1end\endcsname=\endprint
9120 \input\jobname.end
9121 \endgroup}
9122 % \end{macrocode}
9123 % \end{macro}
9124 %
9125 % \begin{macro}{\noendnotes}
9126 % You can say \cs{noendnotes} before the first
9127 % \cs{beginnumbering} in your file if you aren't going to be using
9128 % any of the endnote commands: this will suppress the creation of
9129 % an \file{.end} file. If you do have some lingering endnote
9130 % commands in your file,
9131 % the notes will be written to your terminal and to the log file.
9132 % \begin{macrocode}
9133 \newcommand*{\noendnotes}{\global\let\l@dend@stuff=\relax
9134 \global\chardef\l@d@end=16 }
9135 % \end{macrocode}
9136 % \end{macro}
9137 %
9138 % \section{Side notes}
9139 % \begin{PW}
9140 %
9141 % Regular \verb?\marginpar?s do not work inside numbered text --- they
9142 % don't produce any note but do put an extra unnumbered blank line into
9143 % the text.
9144 %
9145 % \begin{macro}{\l@dold@xympar}
9146 % \begin{macro}{\@xympar}
9147 % Changing \verb?\@xympar? a little at least ensures that \verb?\marginpar?s
9148 % in numbered text do not disturb the flow.
9149 % \changes{v0.5}{2004/04/0}{Eliminated \cs{marginpar} disturbance}
9150 % \begin{macrocode}
9151 \let\l@dold@xympar\@xympar
9152 \renewcommand{\@xympar}{%
9153 \ifnumberedpar@
9154 \led@warn@NoMarginpars
9155 \@esphack
9156 \else
9157 \l@dold@xympar
9158 \fi}
9159
9160 % \end{macrocode}
9161 % \end{macro}
9162 % \end{macro}
9163 %
9164 % We provide side notes as replacement for \verb?\marginpar? in numbered text.
9165 % \changes{v0.5}{2004/04/03}{Added left and right side notes}
9166 % \changes{v0.5.1}{2004/04/10}{Added moveable side note}
9167 %
9168 % \begin{macro}{\sidenote@margin}
9169 % \begin{macro}{\sidenotemargin}
9170 % \begin{macro}{\l@dgetsidenote@margin}
9171 % These are the sidenote equivalents to \cs{line@margin} and \cs{linenummargin}
9172 % for specifying which margin. The default is the right margin (opposite to
9173 % the default for line numbers).
9174 % \changes{v0.5.1}{2004/04/10}{Added \cs{sidenotemargin} and \cs{sidenote@margin}}
9175 % \changes{v0.7}{2005/02/23}{Added \cs{l@dgetsidenote@margin}}
9176 % \begin{macrocode}
9177 \newcount\sidenote@margin
9178 \newcommand*{\sidenotemargin}[1]{{%
9179 \l@dgetsidenote@margin{#1}%
9180 \ifnum\@l@dtempcntb>\m@ne
9181 \global\sidenote@margin=\@l@dtempcntb
9182 \fi}}
9183 \newcommand*{\l@dgetsidenote@margin}[1]{%
9184 \def\@tempa{#1}\def\@tempb{left}%
9185 \ifx\@tempa\@tempb
9186 \@l@dtempcntb \z@
9187 \else
9188 \def\@tempb{right}%
9189 \ifx\@tempa\@tempb
9190 \@l@dtempcntb \@ne
9191 \else
9192 \def\@tempb{outer}%
9193 \ifx\@tempa\@tempb
9194 \@l@dtempcntb \tw@
9195 \else
9196 \def\@tempb{inner}%
9197 \ifx\@tempa\@tempb
9198 \@l@dtempcntb \thr@@
9199 \else
9200 \led@warn@BadSidenotemargin
9201 \@l@dtempcntb \m@ne
9202 \fi
9203 \fi
9204 \fi
9205 \fi}
9206 \sidenotemargin{right}
9207
9208 % \end{macrocode}
9209 % \end{macro}
9210 % \end{macro}
9211 % \end{macro}
9212 %
9213 % \begin{macro}{\l@dlp@rbox}
9214 % \begin{macro}{\l@drp@rbox}
9215 % We need two boxes to store sidenote texts.
9216 % \begin{macrocode}
9217 \newbox\l@dlp@rbox
9218 \newbox\l@drp@rbox
9219
9220 % \end{macrocode}
9221 % \end{macro}
9222 % \end{macro}
9223 %
9224 %
9225 % \begin{macro}{\ledlsnotewidth}
9226 % \begin{macro}{\ledrsnotewidth}
9227 % \begin{macro}{\ledlsnotesep}
9228 % \begin{macro}{\ledrsnotesep}
9229 % \begin{macro}{\ledlsnotefontsetup}
9230 % \begin{macro}{\ledrsnotefontsetup}
9231 % These specify the width of the left/right boxes (initialised to
9232 % \verb?\marginparwidth?, their distance from
9233 % the text (initialised to \verb?\linenumsep?, and the fonts used.
9234 % \begin{macrocode}
9235 \newdimen\ledlsnotewidth \ledlsnotewidth=\marginparwidth
9236 \newdimen\ledrsnotewidth \ledrsnotewidth=\marginparwidth
9237 \newdimen\ledlsnotesep \ledlsnotesep=\linenumsep
9238 \newdimen\ledrsnotesep \ledrsnotesep=\linenumsep
9239 \newcommand*{\ledlsnotefontsetup}{\raggedleft\footnotesize}
9240 \newcommand*{\ledrsnotefontsetup}{\raggedright\footnotesize}
9241
9242 % \end{macrocode}
9243 % \end{macro}
9244 % \end{macro}
9245 % \end{macro}
9246 % \end{macro}
9247 % \end{macro}
9248 % \end{macro}
9249 %
9250 %
9251 % \begin{macro}{\ledleftnote}
9252 % \begin{macro}{\ledrightnote}
9253 % \begin{macro}{\ledsidenote}
9254 % \verb?\ledleftnote?\marg{text} and \verb?\ledrightnote?\marg{text} are the
9255 % user commands for left and right sidenotes. \verb?\ledsidenote?\marg{text}
9256 % is the command for a moveable sidenote.
9257 % \begin{macrocode}
9258 \newcommand*{\ledleftnote}[1]{\edtext{}{\l@dlsnote{#1}}}
9259 \newcommand*{\ledrightnote}[1]{\edtext{}{\l@drsnote{#1}}}
9260 \newcommand*{\ledsidenote}[1]{\edtext{}{\l@dcsnote{#1}}}
9261
9262
9263 % \end{macrocode}
9264 % \end{macro}
9265 % \end{macro}
9266 % \end{macro}
9267 %
9268 %
9269 % \begin{macro}{\l@dlsnote}
9270 % \begin{macro}{\l@drsnote}
9271 % \begin{macro}{\l@dcsnote}
9272 % The `footnotes' for left, right, and moveable sidenotes. The whole
9273 % scheme is reminiscent of the critical footnotes code.
9274 % \begin{macrocode}
9275 \newif\ifrightnoteup
9276 \rightnoteuptrue
9277 \newcommand*{\l@dlsnote}[1]{%
9278 \ifnumberedpar@
9279 \xright@appenditem{\noexpand\vl@dlsnote{#1}}%
9280 \to\inserts@list
9281 \global\advance\insert@count \@ne
9282 \fi\ignorespaces}
9283 \newcommand*{\l@drsnote}[1]{%
9284 \ifnumberedpar@
9285 \xright@appenditem{\noexpand\vl@drsnote{#1}}%
9286 \to\inserts@list
9287 \global\advance\insert@count \@ne
9288 \fi\ignorespaces}
9289 \newcommand*{\l@dcsnote}[1]{%
9290 \ifnumberedpar@
9291 \xright@appenditem{\noexpand\vl@dcsnote{#1}}%
9292 \to\inserts@list
9293 \global\advance\insert@count \@ne
9294 \fi\ignorespaces}
9295
9296 % \end{macrocode}
9297 % \end{macro}
9298 % \end{macro}
9299 % \end{macro}
9300 %
9301 % \begin{macro}{\vl@dlsnote}
9302 % \begin{macro}{\vl@drsnote}
9303 % \begin{macro}{\vl@dcsnote}
9304 % Put the left/right text into boxes, but just save the moveable text.
9305 % \begin{macrocode}
9306 \newcommand*{\vl@dlsnote}[1]{\setl@dlp@rbox{#1}}
9307 \newcommand*{\vl@drsnote}[1]{\setl@drp@rbox{#1}}
9308 \newcommand*{\vl@dcsnote}[1]{\gdef\l@dcsnotetext{#1}}
9309
9310 % \end{macrocode}
9311 % \end{macro}
9312 % \end{macro}
9313 % \end{macro}
9314 %
9315 %
9316 % \begin{macro}{\setl@dlp@rbox}
9317 % \begin{macro}{\setl@drpr@box}
9318 % \verb?\setl@dlprbox?\marg{lednums}\marg{tag}\marg{text} puts \meta{text}
9319 % into the \verb?\l@dlp@rbox? box. And similarly for the right side box.
9320 % It is these boxes that finally
9321 % get displayed in the margins.
9322 % \begin{macrocode}
9323 \newcommand*{\setl@dlp@rbox}[1]{%
9324 {\parindent\z@\hsize=\ledlsnotewidth\ledlsnotefontsetup
9325 \global\setbox\l@dlp@rbox
9326 \ifleftnoteup
9327 =\vbox to\z@{\vss #1}%
9328 \else
9329 =\vbox to 0.70\baselineskip{\strut#1\vss}%
9330 \fi}}
9331 %% \global\setbox\l@dlp@rbox=\vbox to\z@{#3\vss}}}% aligns on top line
9332 \newcommand*{\setl@drp@rbox}[1]{%
9333 {\parindent\z@\hsize=\ledrsnotewidth\ledrsnotefontsetup
9334 \global\setbox\l@drp@rbox
9335 \ifrightnoteup
9336 =\vbox to\z@{\vss#1}%
9337 \else
9338 =\vbox to0.7\baselineskip{\strut#1\vss}%
9339 \fi}}
9340 \newif\ifleftnoteup
9341 \leftnoteuptrue
9342 % \end{macrocode}
9343 % \end{macro}
9344 % \end{macro}
9345 %
9346 % \begin{macro}{\savel@dcsnote}
9347 % \begin{macro}{\l@dcsnotetext}
9348 % Save the moveable note text in \cs{l@dcsnotetext}.
9349 % \begin{macrocode}
9350 \newcommand*{\savel@dcsnote}[3]{%
9351 \gdef\l@dcsnotetext{#3}}
9352
9353 % \end{macrocode}
9354 % \end{macro}
9355 % \end{macro}
9356 %
9357 % \begin{macro}{\affixside@note}
9358 % This macro puts any moveable sidenote text into the left or right sidenote
9359 % box, depending on which margin it is meant to go in. It's a very much
9360 % stripped down version of \cs{affixlin@num}.
9361 % \begin{macrocode}
9362 \newcommand*{\affixside@note}{%
9363 \gdef\@templ@d{}%
9364 \ifx\@templ@d\l@dcsnotetext \else
9365 \if@twocolumn
9366 \if@firstcolumn
9367 \setl@dlp@rbox{\l@dcsnotetext}%
9368 \else
9369 \setl@drp@rbox{\l@dcsnotetext}%
9370 \fi
9371 \else
9372 \@l@dtempcntb=\sidenote@margin
9373 \ifnum\@l@dtempcntb>\@ne
9374 \advance\@l@dtempcntb by\page@num
9375 \fi
9376 \ifodd\@l@dtempcntb
9377 \setl@drp@rbox{\l@dcsnotetext}%
9378 \else
9379 \setl@dlp@rbox{\l@dcsnotetext}%
9380 \fi
9381 \fi
9382 \fi}
9383
9384 % \end{macrocode}
9385 % \end{macro}
9386 %
9387 %
9388 %
9389 % \end{PW}
9390 %
9391 % \section{Familiar footnotes}
9392 %
9393 % \begin{PW}
9394 %
9395 % The original \edmac{} provided the five series of critical footnotes,
9396 % and LaTeX provides a single numbered footnote. The \Ledmac{} package
9397 % uses the \edmac{} mechanism to provide a few series of numbered footnotes.
9398 %
9399 % First, though, the \Lpack{footmisc} package has an option whereby
9400 % two or more consecutive \cs{footnote}s have their marks separated
9401 % by commas. This seems such a useful ability that it is provided
9402 % automatically by \Ledmac.
9403 %
9404 % \begin{macro}{\multiplefootnotemarker}
9405 % \begin{macro}{\multfootsep}
9406 % These macros may have been defined by the \Lclass{memoir} class,
9407 % are provided by the \Lpack{footmisc} package and perhaps
9408 % by other footnote packages.
9409 % \begin{macrocode}
9410 \providecommand*{\multiplefootnotemarker}{3sp}
9411 \providecommand*{\multfootsep}{\textsuperscript{\normalfont,}}
9412
9413 % \end{macrocode}
9414 % \end{macro}
9415 % \end{macro}
9416 %
9417 % \begin{macro}{\m@mmf@prepare}
9418 % A pair of self-cancelling kerns. This may have been defined in the
9419 % \Lclass{memoir} class.
9420 % \begin{macrocode}
9421 \providecommand*{\m@mmf@prepare}{%
9422 \kern-\multiplefootnotemarker
9423 \kern\multiplefootnotemarker\relax}
9424 % \end{macrocode}
9425 % \end{macro}
9426 %
9427 % \begin{macro}{\m@mmf@check}
9428 % This may have been defined in the \Lclass{memoir} class. If it recognises
9429 % the last kern as \cs{multiplefootnotemarker} it typesets \cs{multfootsep}.
9430 % \begin{macrocode}
9431 \providecommand*{\m@mmf@check}{%
9432 \ifdim\lastkern=\multiplefootnotemarker\relax
9433 \edef\@x@sf{\the\spacefactor}%
9434 \unkern
9435 \multfootsep
9436 \spacefactor\@x@sf\relax
9437 \fi}
9438
9439 % \end{macrocode}
9440 % \end{macro}
9441 %
9442 % We have to modify \verb?\@footnotetext? and \verb?\@footnotemark?. However,
9443 % if \Lclass{memoir} is used the modifications have already been made.
9444 % \changes{v0.4.1}{2004/03/25}{Only change \cs{@footnotetext} and
9445 % \cs{@footnotemark} if memoir not used}
9446 % \begin{macrocode}
9447 \@ifclassloaded{memoir}{}{%
9448 % \end{macrocode}
9449 % \begin{macro}{\@footnotetext}
9450 % Add \cs{m@mmf@prepare} at the end of \cs{@footnotetext}.
9451 % \begin{macrocode}
9452 \let\l@dold@footnotetext\@footnotetext
9453 \renewcommand{\@footnotetext}[1]{%
9454 \l@dold@footnotetext{#1}%
9455 \m@mmf@prepare}
9456 % \end{macrocode}
9457 % \end{macro}
9458 %
9459 % \begin{macro}{\@footnotemark}
9460 % Modify \cs{@footnotemark} to cater for adjacent \cs{footnote}s.
9461 % \begin{macrocode}
9462 \renewcommand*{\@footnotemark}{%
9463 \leavevmode
9464 \ifhmode
9465 \edef\@x@sf{\the\spacefactor}%
9466 \m@mmf@check
9467 \nobreak
9468 \fi
9469 \@makefnmark
9470 \m@mmf@prepare
9471 \ifhmode\spacefactor\@x@sf\fi
9472 \relax}
9473 % \end{macrocode}
9474 % \end{macro}
9475 % Finished the modifications for the non-memoir case.
9476 % \begin{macrocode}
9477 }
9478
9479 % \end{macrocode}
9480 %
9481 % \begin{macro}{\l@doldold@footnotetext}
9482 % \begin{macro}{\@footnotetext}
9483 % In order to enable the regular \verb?\footnote?s in numbered text
9484 % we have to play around with its \verb?\@footnotetext?, using
9485 % different forms for when in numbered or regular text.
9486 % \changes{v0.5}{2004/04/03}{Enabled regular \cs{footnote} in numbered text}
9487 % \begin{macrocode}
9488 \let\l@doldold@footnotetext\@footnotetext
9489 \renewcommand{\@footnotetext}[1]{%
9490 \ifnumberedpar@
9491 \edtext{}{\l@dbfnote{#1}}%
9492 \else
9493 \l@doldold@footnotetext{#1}%
9494 \fi}
9495 % \end{macrocode}
9496 % \end{macro}
9497 % \end{macro}
9498 %
9499 % \begin{macro}{\l@dbfnote}
9500 % \begin{macro}{\vl@dbfnote}
9501 % \verb?\l@dbfnote? adds the footnote to the insert list, and
9502 % \verb?\vl@dbfnote? calls the original \verb?\@footnotetext?.
9503 % \changes{v0.6}{2004/11/23}{Changed \cs{l@dbfnote} and \cs{vl@dbfnote} as
9504 % originals could give incorrect markers in the footnotes}
9505 % \begin{macrocode}
9506 \newcommand{\l@dbfnote}[1]{%
9507 \ifnumberedpar@
9508 \xright@appenditem{\noexpand\vl@dbfnote{{#1}}{\@thefnmark}}%
9509 \to\inserts@list
9510 \global\advance\insert@count \@ne
9511 \fi\ignorespaces}
9512 \newcommand{\vl@dbfnote}[2]{%
9513 \def\@thefnmark{#2}%
9514 \l@doldold@footnotetext{#1}}
9515
9516 % \end{macrocode}
9517 % \end{macro}
9518 % \end{macro}
9519 %
9520 % Now we can get on with providing the extra series of numbered
9521 % footnotes. The general naming convention is to add an uppercase letter,
9522 % denoting the series, at the end of macro names (the \edmac{} series
9523 % have an uppercase letter at the start of macro names).
9524 %
9525 % First we'll give all the code for the \texttt{A} series, then the
9526 % much more limited code for defining additional series.
9527 %
9528 % \subsection{The \texttt{A} series footnotes}
9529 %
9530 % \begin{macro}{\footnoteA}
9531 % \cs{footnoteA}\marg{text} is the user level command.
9532 % \changes{v0.6}{2004/11/23}{Modified \cs{footnoteA} and friends to
9533 % include \cs{@thefnmarkA} etc}
9534 % \begin{macrocode}
9535 \newcommand{\footnoteA}[1]{%
9536 \stepcounter{footnoteA}%
9537 \protected@xdef\@thefnmarkA{\thefootnoteA}%
9538 \@footnotemarkA
9539 \vfootnoteA{A}{#1}\m@mmf@prepare}
9540
9541 % \end{macrocode}
9542 % \end{macro}
9543 %
9544 % \begin{macro}{\footinsA}
9545 % The insert for the \texttt{A} series.
9546 % \begin{macrocode}
9547 \newinsert\footinsA
9548 % \end{macrocode}
9549 % \end{macro}
9550 %
9551 % \begin{macro}{\c@footnoteA}
9552 % \begin{macro}{\thefootnoteA}
9553 % The \texttt{A} series counter.
9554 % \begin{macrocode}
9555 \newcounter{footnoteA}
9556 \renewcommand{\thefootnoteA}{\arabic{footnoteA}}
9557
9558 % \end{macrocode}
9559 % \end{macro}
9560 % \end{macro}
9561 %
9562 %
9563 %
9564 % \begin{macro}{\footfootmarkA}
9565 % This macro typesets the \texttt{A} series marker at the start of
9566 % the footnote text (where it appears at the foot of the page).
9567 % \begin{macrocode}
9568 \newcommand*{\footfootmarkA}{\textsuperscript{\thefootnoteA}}
9569
9570 % \end{macrocode}
9571 % \end{macro}
9572 %
9573 % \begin{macro}{\mpfootnoteA}
9574 % \begin{macro}{\mpfootinsA}
9575 % The extras for minipages.
9576 % \changes{v0.4}{2004/02/29}{Familiar footnotes extended for minipages}
9577 % \begin{macrocode}
9578 \newcommand{\mpfootnoteA}[1]{%
9579 \stepcounter{footnoteA}%
9580 \protected@xdef\@thefnmarkA{\thefootnoteA}%
9581 \@footnotemarkA
9582 \mpvfootnoteA{A}{#1}\m@mmf@prepare}
9583 \newinsert\mpfootinsA
9584
9585 % \end{macrocode}
9586 % \end{macro}
9587 % \end{macro}
9588 %
9589 % We have to specify the default footnote style for the \texttt{A} series.
9590 % This is done later.
9591 %
9592 % That completes the specific macros that have to be specified for
9593 % the \texttt{A} series. Similar ones are required for any other series.
9594 %
9595 % \subsection{Footnote formats}
9596 %
9597 % Some of the code for the various formats is remarkably similar to that
9598 % in section~\ref{sec:nfootformat}.
9599 %
9600 % The following macros generally set things up for the `standard' footnote
9601 % format.
9602 %
9603 % \begin{macro}{\prebodyfootmark}
9604 % \begin{macro}{\postbodyfootmark}
9605 % Two convenience macros for use by \cs{...@footnotemark...} macros.
9606 % \begin{macrocode}
9607 \newcommand*{\prebodyfootmark}{%
9608 \leavevmode
9609 \ifhmode
9610 \edef\@x@sf{\the\spacefactor}%
9611 \m@mmf@check
9612 \nobreak
9613 \fi}
9614 \newcommand{\postbodyfootmark}{%
9615 \m@mmf@prepare
9616 \ifhmode\spacefactor\@x@sf\fi\relax}
9617
9618 % \end{macrocode}
9619 % \end{macro}
9620 % \end{macro}
9621 %
9622 %
9623 % \begin{macro}{\normal@footnotemarkX}
9624 % \cs{normal@footnotemarkX}\marg{series} sets up the typesetting of the
9625 % marker at the point where the footnote is called for.
9626 % \begin{macrocode}
9627 \newcommand*{\normal@footnotemarkX}[1]{%
9628 \prebodyfootmark
9629 \@nameuse{bodyfootmark#1}%
9630 \postbodyfootmark}
9631
9632 % \end{macrocode}
9633 % \end{macro}
9634 %
9635 % \begin{macro}{\normalbodyfootmarkX}
9636 % The \cs{normalbodyfootmarkX}\marg{series} \emph{really} typesets the
9637 % in-text marker. The style is the normal superscript.
9638 % \begin{macrocode}
9639 \newcommand*{\normalbodyfootmarkX}[1]{%
9640 \hbox{\textsuperscript{\normalfont\@nameuse{@thefnmark#1}}}}
9641 % \end{macrocode}
9642 % \end{macro}
9643 %
9644 % \begin{macro}{\normalvfootnoteX}
9645 % \cs{normalvfootnoteX}\marg{series}\marg{text} does the \cs{insert} for
9646 % the \meta{series} and calls the series' \cs{footfmt...} to format the
9647 % \meta{text}.
9648 % \begin{macrocode}
9649 \newcommand*{\normalvfootnoteX}[2]{%
9650 \insert\@nameuse{footins#1}\bgroup
9651 \notefontsetup
9652 \footsplitskips
9653 \spaceskip=\z@skip \xspaceskip=\z@skip
9654 \@nameuse{footfmt#1}{#1}{#2}\egroup}
9655
9656 % \end{macrocode}
9657 % \end{macro}
9658 %
9659 % \begin{macro}{\mpnormalvfootnoteX}
9660 % The minipage version.
9661 % \begin{macrocode}
9662 \newcommand*{\mpnormalvfootnoteX}[2]{%
9663 \global\setbox\@nameuse{mpfootins#1}\vbox{%
9664 \unvbox\@nameuse{mpfootins#1}
9665 \notefontsetup
9666 \hsize\columnwidth
9667 \@parboxrestore
9668 \color@begingroup
9669 \@nameuse{footfmt#1}{#1}{#2}\color@endgroup}}
9670
9671 % \end{macrocode}
9672 % \end{macro}
9673 %
9674 % \begin{macro}{\normalfootfmtX}
9675 % \cs{normalfootfmtX}\marg{series}\marg{text} typesets the footnote text,
9676 % prepended by the marker.
9677 % \begin{macrocode}
9678 \newcommand*{\normalfootfmtX}[2]{%
9679 \ledsetnormalparstuff
9680 {\notenumfont\@nameuse{footfootmark#1}\strut%\enspace
9681 #2\strut\par}}
9682
9683 % \end{macrocode}
9684 % \end{macro}
9685 %
9686 % \begin{macro}{\normalfootfootmarkX}
9687 % \cs{normalfootfootmarkX}\marg{series} is called by \cs{normalfootfmtX}
9688 % to typeset the footnote marker in the footer before the footnote text.
9689 % \begin{macrocode}
9690 \newcommand*{\normalfootfootmarkX}[1]{%
9691 \textsuperscript{\@nameuse{@thefnmark#1}}}
9692
9693 % \end{macrocode}
9694 % \end{macro}
9695 %
9696 % \begin{macro}{\normalfootstartX}
9697 % \cs{normalfootstartX}\marg{series} is the \meta{series} footnote
9698 % starting macro used in the output routine.
9699 % \begin{macrocode}
9700 \newcommand*{\normalfootstartX}[1]{%
9701 \vskip\skip\@nameuse{footins#1}%
9702 \leftskip=\z@
9703 \rightskip=\z@
9704 \@nameuse{footnoterule#1}}
9705
9706 % \end{macrocode}
9707 % \end{macro}
9708 %
9709 % \begin{macro}{\normalfootnoteruleX}
9710 % The rule drawn before the footnote series group.
9711 % \begin{macrocode}
9712 \let\normalfootnoteruleX=\footnoterule
9713
9714 % \end{macrocode}
9715 % \end{macro}
9716 %
9717 % \begin{macro}{\normalfootgroupX}
9718 % \cs{normalfootgroupX}\marg{series} sends the contents of the \meta{series}
9719 % insert box to the output page without alteration.
9720 % \begin{macrocode}
9721 \newcommand*{\normalfootgroupX}[1]{%
9722 \unvbox\@nameuse{footins#1}}
9723
9724 % \end{macrocode}
9725 % \end{macro}
9726 %
9727 % \begin{macro}{\mpnormalfootgroupX}
9728 % The minipage version.
9729 % \begin{macrocode}
9730 \newcommand*{\mpnormalfootgroupX}[1]{%
9731 \vskip\skip\@nameuse{mpfootins#1}
9732 \normalcolor
9733 \@nameuse{footnoterule#1}
9734 \unvbox\@nameuse{mpfootins#1}}
9735
9736 % \end{macrocode}
9737 % \end{macro}
9738 %
9739 %
9740 % \begin{macro}{\normalbfnoteX}
9741 % \changes{v0.7}{2005/02/18}{Removed extraneous space from \cs{normalbfnoteX}}
9742 % \begin{macrocode}
9743 \newcommand{\normalbfnoteX}[2]{%
9744 \ifnumberedpar@
9745 \xright@appenditem{\noexpand\vbfnoteX{#1}{#2}{\@nameuse{thefootnote#1}}}%
9746 \to\inserts@list
9747 \global\advance\insert@count \@ne
9748 \fi\ignorespaces}
9749
9750 % \end{macrocode}
9751 % \end{macro}
9752 %
9753 %
9754 % \begin{macro}{\vbfnoteX}
9755 % \begin{macrocode}
9756 \newcommand{\vbfnoteX}[3]{%
9757 \@namedef{@thefnmark#1}{#3}%
9758 \@nameuse{regvfootnote#1}{#1}{#2}}
9759
9760 % \end{macrocode}
9761 % \end{macro}
9762 %
9763 %
9764 % \begin{macro}{\vnumfootnoteX}
9765 % \changes{v0.7}{2005/02/18}{Removed extraneous space from \cs{vnumfootnoteX}}
9766 % \begin{macrocode}
9767 \newcommand{\vnumfootnoteX}[2]{%
9768 \ifnumberedpar@
9769 \edtext{}{\normalbfnoteX{#1}{#2}}%
9770 \else
9771 \@nameuse{regvfootnote#1}{#1}{#2}%
9772 \fi}
9773
9774 % \end{macrocode}
9775 % \end{macro}
9776 %
9777 %
9778 %
9779 % \begin{macro}{\footnormalX}
9780 % \cs{footnormalX}\marg{series} initialises the settings for
9781 % the \meta{series} footnotes. This should always be called for
9782 % each series.
9783 % \begin{macrocode}
9784 \newcommand*{\footnormalX}[1]{%
9785 \expandafter\let\csname footstart#1\endcsname=\normalfootstartX
9786 \@namedef{@footnotemark#1}{\normal@footnotemarkX{#1}}
9787 \@namedef{bodyfootmark#1}{\normalbodyfootmarkX{#1}}
9788 \expandafter\let\csname regvfootnote#1\endcsname=\normalvfootnoteX
9789 \expandafter\let\csname vfootnote#1\endcsname=\vnumfootnoteX
9790 \expandafter\let\csname footfmt#1\endcsname=\normalfootfmtX
9791 \@namedef{footfootmark#1}{\normalfootfootmarkX{#1}}
9792 \expandafter\let\csname footgroup#1\endcsname=\normalfootgroupX
9793 \expandafter\let\csname footnoterule#1\endcsname=\normalfootnoteruleX
9794 \count\csname footins#1\endcsname=1000
9795 \dimen\csname footins#1\endcsname=\ledfootinsdim
9796 \skip\csname footins#1\endcsname=1.2em \@plus .6em \@minus .6em
9797 % \end{macrocode}
9798 % Aditions for minipages.
9799 % \begin{macrocode}
9800 \expandafter\let\csname mpvfootnote#1\endcsname=\mpnormalvfootnoteX
9801 \expandafter\let\csname mpfootgroup#1\endcsname=\mpnormalfootgroupX
9802 \count\csname mpfootins#1\endcsname=1000
9803 % \dimen\csname mpfootins#1\endcsname=0.8\vsize
9804 \dimen\csname mpfootins#1\endcsname=\ledfootinsdim
9805 \skip\csname mpfootins#1\endcsname=1.2em \@plus .6em \@minus .6em
9806 }
9807
9808 % \end{macrocode}
9809 % \end{macro}
9810 %
9811 % \subsubsection{Two column footnotes}
9812 %
9813 % The following macros set footnotes in two columns. It is assumed
9814 % that the length of each footnote is less than the column width.
9815 %
9816 % \begin{macro}{\foottwocoolX}
9817 % \cs{foottwocolX}\marg{series}
9818 % \begin{macrocode}
9819 \newcommand*{\foottwocolX}[1]{%
9820 \expandafter\let\csname regvfootnote#1\endcsname=\twocolvfootnoteX
9821 \expandafter\let\csname footfmt#1\endcsname=\twocolfootfmtX
9822 \expandafter\let\csname footgroup#1\endcsname=\twocolfootgroupX
9823 \twocolfootsetupX{#1}
9824 \expandafter\let\csname mpvfootnote#1\endcsname=\mpnormalvfootnoteX
9825 \expandafter\let\csname mpfootgroup#1\endcsname=\mptwocolfootgroupX
9826 \mptwocolfootsetupX{#1}}
9827
9828 % \end{macrocode}
9829 % \end{macro}
9830 %
9831 % \begin{macro}{\twocolfootsetupX}
9832 % \begin{macro}{\mptwocolfootsetupX}
9833 % \cs{twocolfootsetupX}\marg{series}
9834 % \begin{macrocode}
9835 \newcommand*{\twocolfootsetupX}[1]{%
9836 \count\csname footins#1\endcsname 500
9837 \multiply\dimen\csname footins#1\endcsname by \tw@}
9838 \newcommand*{\mptwocolfootsetupX}[1]{%
9839 \count\csname mpfootins#1\endcsname 500
9840 \multiply\dimen\csname mpfootins#1\endcsname by \tw@}
9841
9842 % \end{macrocode}
9843 % \end{macro}
9844 % \end{macro}
9845 %
9846 % \begin{macro}{\twocolvfootnoteX}
9847 % \cs{twocolvfootnoteX}\marg{series}
9848 % \begin{macrocode}
9849 \newcommand*{\twocolvfootnoteX}[2]{%
9850 \insert\csname footins#1\endcsname\bgroup
9851 \notefontsetup
9852 \footsplitskips
9853 \spaceskip=\z@skip \xspaceskip=\z@skip
9854 \@nameuse{footfmt#1}{#1}{#2}\egroup}
9855
9856 % \end{macrocode}
9857 % \end{macro}
9858 %
9859 % \begin{macro}{\twocolfootfmtX}
9860 % \cs{twocolfootfmtX}\marg{series}
9861 % \begin{macrocode}
9862 \newcommand*{\twocolfootfmtX}[2]{%
9863 \normal@pars
9864 \hsize .45\hsize
9865 \parindent=\z@
9866 %%% \parfillskip=0pt \@plus 1fil
9867 \tolerance=5000\relax
9868 \raggedright
9869 \leavevmode
9870 {\notenumfont\@nameuse{footfootmark#1}\strut%\enspace
9871 #2\strut\par}\allowbreak}
9872
9873 % \end{macrocode}
9874 % \end{macro}
9875 %
9876 % \begin{macro}{\twocolfootgroupX}
9877 % \begin{macro}{\mptwocolfootgroupX}
9878 % \cs{twocolfootgroupX}\marg{series}
9879 % \begin{macrocode}
9880 \newcommand*{\twocolfootgroupX}[1]{{\notefontsetup
9881 \splittopskip=\ht\strutbox
9882 \expandafter
9883 \rigidbalance\csname footins#1\endcsname \tw@ \splittopskip}}
9884 \newcommand*{\mptwocolfootgroupX}[1]{{%
9885 \vskip\skip\@nameuse{mpfootins#1}
9886 \normalcolor
9887 \@nameuse{footnoterule#1}
9888 \splittopskip=\ht\strutbox
9889 \expandafter
9890 \rigidbalance\csname mpfootins#1\endcsname \tw@ \splittopskip}}
9891
9892 % \end{macrocode}
9893 % \end{macro}
9894 % \end{macro}
9895 %
9896 % \subsubsection{Three column footnotes}
9897 %
9898 % The following macros set footnotes in three columns. It is assumed
9899 % that the length of each footnote is less than the column width.
9900 %
9901 %
9902 % \begin{macro}{\footthreecolX}
9903 % \cs{footthreecolX}\marg{series}
9904 % \begin{macrocode}
9905 \newcommand*{\footthreecolX}[1]{%
9906 \expandafter\let\csname regvfootnote#1\endcsname=\threecolvfootnoteX
9907 \expandafter\let\csname footfmt#1\endcsname=\threecolfootfmtX
9908 \expandafter\let\csname footgroup#1\endcsname=\threecolfootgroupX
9909 \threecolfootsetupX{#1}
9910 \expandafter\let\csname mpvfootnote#1\endcsname=\mpnormalvfootnoteX
9911 \expandafter\let\csname mpfootgroup#1\endcsname=\mpthreecolfootgroupX
9912 \mpthreecolfootsetupX{#1}}
9913
9914 % \end{macrocode}
9915 % \end{macro}
9916 %
9917 % \begin{macro}{\threecolfootsetupX}
9918 % \begin{macro}{\mpthreecolfootsetupX}
9919 % \cs{threecolfootsetupX}\marg{series}
9920 % \begin{macrocode}
9921 \newcommand*{\threecolfootsetupX}[1]{%
9922 \count\csname footins#1\endcsname 333
9923 \multiply\dimen\csname footins#1\endcsname by \thr@@}
9924 \newcommand*{\mpthreecolfootsetupX}[1]{%
9925 \count\csname mpfootins#1\endcsname 333
9926 \multiply\dimen\csname mpfootins#1\endcsname by \thr@@}
9927
9928 % \end{macrocode}
9929 % \end{macro}
9930 % \end{macro}
9931 %
9932 % \begin{macro}{\threecolvfootnoteX}
9933 % \cs{threecolvfootnoteX}\marg{series}\marg{text}
9934 % \begin{macrocode}
9935 \newcommand*{\threecolvfootnoteX}[2]{%
9936 \insert\csname footins#1\endcsname\bgroup
9937 \notefontsetup
9938 \footsplitskips
9939 \@nameuse{footfmt#1}{#1}{#2}\egroup}
9940
9941 % \end{macrocode}
9942 % \end{macro}
9943 %
9944 % \begin{macro}{\threecolfootfmtX}
9945 % \cs{threecolfootfmtX}\marg{series}
9946 % \begin{macrocode}
9947 \newcommand*{\threecolfootfmtX}[2]{%
9948 \normal@pars
9949 \hsize .3\hsize
9950 \parindent=\z@
9951 %%% \parfillskip=0pt \@plus 1fil
9952 \tolerance=5000\relax
9953 \raggedright
9954 \leavevmode
9955 {\notenumfont\@nameuse{footfootmark#1}\strut%\enspace
9956 #2\strut\par}\allowbreak}
9957
9958 % \end{macrocode}
9959 % \end{macro}
9960 %
9961 % \begin{macro}{\threecolfootgroupX}
9962 % \begin{macro}{\mpthreecolfootgroupX}
9963 % \cs{threecolfootgroupX}\marg{series}
9964 % \begin{macrocode}
9965 \newcommand*{\threecolfootgroupX}[1]{{\notefontsetup
9966 \splittopskip=\ht\strutbox
9967 \expandafter
9968 \rigidbalance\csname footins#1\endcsname \thr@@ \splittopskip}}
9969 \newcommand*{\mpthreecolfootgroupX}[1]{{%
9970 \vskip\skip\@nameuse{mpfootins#1}
9971 \normalcolor
9972 \@nameuse{footnoterule#1}
9973 \splittopskip=\ht\strutbox
9974 \expandafter
9975 \rigidbalance\csname mpfootins#1\endcsname \thr@@ \splittopskip}}
9976
9977 % \end{macrocode}
9978 % \end{macro}
9979 % \end{macro}
9980 %
9981 % \subsubsection{Paragraphed footnotes}
9982 %
9983 % The following macros set footnotes as one paragraph.
9984 %
9985 % \begin{macro}{\footparagraphX}
9986 % \cs{footparagraphX}\marg{series}
9987 % \begin{macrocode}
9988 \newcommand*{\footparagraphX}[1]{%
9989 \expandafter\let\csname footstart#1\endcsname=\parafootstartX
9990 \expandafter\let\csname regvfootnote#1\endcsname=\para@vfootnoteX
9991 \expandafter\let\csname footfmt#1\endcsname=\parafootfmtX
9992 \expandafter\let\csname footgroup#1\endcsname=\para@footgroupX
9993 \expandafter\let\csname footnoterule#1\endcsname=\normalfootnoteruleX
9994 \count\csname footins#1\endcsname=1000
9995 \expandafter\let\csname mpvfootnote#1\endcsname=\mppara@vfootnoteX
9996 \expandafter\let\csname mpfootgroup#1\endcsname=\mppara@footgroupX
9997 \count\csname mpfootins#1\endcsname=1000
9998 \para@footsetupX{#1}}
9999
10000 % \end{macrocode}
10001 % \end{macro}
10002 %
10003 % \begin{macro}{\para@footsetupX}
10004 % \cs{para@footsetupX}\marg{series}
10005 % \changes{v0.2.2}{2003/11/04}{Added \cs{footfudgefiddle} to \cs{para@footsetupX}}
10006 % \begin{macrocode}
10007 \newcommand*{\para@footsetupX}[1]{{\notefontsetup
10008 \dimen0=\baselineskip
10009 \multiply\dimen0 by 1024
10010 \divide\dimen0 by \hsize \multiply\dimen0 by \footfudgefiddle\relax
10011 \expandafter
10012 \xdef\csname footfudgefactor#1\endcsname{%
10013 \expandafter\strip@pt\dimen0 }}}
10014
10015 % \end{macrocode}
10016 % \end{macro}
10017 %
10018 % \begin{macro}{\parafootstartX}
10019 % \cs{parafootstartX}\marg{series}
10020 % \begin{macrocode}
10021 \newcommand*{\parafootstartX}[1]{%
10022 \vskip\skip\@nameuse{footins#1}%
10023 \leftskip=\z@
10024 \rightskip=\z@
10025 \parindent=\z@
10026 \vskip\skip\@nameuse{footins#1}%
10027 \@nameuse{footnoterule#1}}
10028
10029 % \end{macrocode}
10030 % \end{macro}
10031 %
10032 % \begin{macro}{\para@vfootnoteX}
10033 % \begin{macro}{\mppara@vfootnoteX}
10034 % \cs{para@vfootnoteX}\marg{series}\marg{text}
10035 % \begin{macrocode}
10036 \newcommand*{\para@vfootnoteX}[2]{%
10037 \insert\csname footins#1\endcsname
10038 \bgroup
10039 \notefontsetup
10040 \footsplitskips
10041 \setbox0=\vbox{\hsize=\maxdimen%
10042 \let\bidi@RTL@everypar\@empty%
10043 \noindent\@nameuse{footfmt#1}{#1}{#2}}%
10044 \setbox0=\hbox{\unvxh0}%
10045 \dp0=\z@
10046 \ht0=\csname footfudgefactor#1\endcsname\wd0
10047 \box0
10048 \penalty0
10049 \egroup}
10050 \newcommand*{\mppara@vfootnoteX}[2]{%
10051 \global\setbox\@nameuse{mpfootins#1}\vbox{%
10052 \unvbox\@nameuse{mpfootins#1}
10053 \notefontsetup
10054 \footsplitskips
10055 \setbox0=\vbox{\hsize=\maxdimen%
10056 \let\bidi@RTL@everypar\@empty%
10057 \noindent\color@begingroup\@nameuse{footfmt#1}{#1}{#2}\color@endgroup}%
10058 \setbox0=\hbox{\unvxh0}%
10059 \dp0=\z@
10060 \ht0=\csname footfudgefactor#1\endcsname\wd0
10061 \box0
10062 \penalty0}}
10063
10064 % \end{macrocode}
10065 % \end{macro}
10066 % \end{macro}
10067 %
10068 % \begin{macro}{\parafootfmtX}
10069 % \cs{parafootfmtX}\marg{series}
10070 % \begin{macrocode}
10071 \newcommand*{\parafootfmtX}[2]{%
10072 \insertparafootftmsep
10073 \ledsetnormalparstuff
10074 {\notenumfont\@nameuse{footfootmark#1}\strut%\enspace
10075 #2\penalty-10}}
10076
10077 % \end{macrocode}
10078 % \end{macro}
10079 %
10080 % \begin{macro}{\para@footgroupX}
10081 % \begin{macro}{\mppara@footgroupX}
10082 % \cs{para@footgroupX}\marg{series}
10083 % \begin{macrocode}
10084 \newcommand*{\para@footgroupX}[1]{%
10085 \unvbox\csname footins#1\endcsname
10086 \makehboxofhboxes
10087 \setbox0=\hbox{\unhbox0 \removehboxes}%
10088 \notefontsetup
10089 \noindent\unhbox0\par}
10090 \newcommand*{\mppara@footgroupX}[1]{{%
10091 \vskip\skip\@nameuse{mpfootins#1}
10092 \normalcolor
10093 \@nameuse{footnoterule#1}
10094 \unvbox\csname mpfootins#1\endcsname
10095 \makehboxofhboxes
10096 \setbox0=\hbox{\unhbox0 \removehboxes}%
10097 \notefontsetup
10098 \noindent\unhbox0\par}}
10099
10100 % \end{macrocode}
10101 % \end{macro}
10102 % \end{macro}
10103 %
10104 %
10105 % \subsection{Other series footnotes}
10106 %
10107 % Other series, such as \texttt{B}, are provided here.
10108 %
10109 % \begin{macro}{\footnoteB}
10110 % \cs{footnoteB}\marg{text} is the user command for a series \texttt{B}
10111 % footnote.
10112 % \begin{macrocode}
10113 \newcommand{\footnoteB}[1]{%
10114 \stepcounter{footnoteB}%
10115 \protected@xdef\@thefnmarkB{\thefootnoteB}%
10116 \@footnotemarkB
10117 \vfootnoteB{B}{#1}\m@mmf@prepare}
10118
10119 % \end{macrocode}
10120 % \end{macro}
10121 %
10122 %
10123 % \begin{macro}{\c@footnoteB}
10124 % \begin{macro}{\thefootnoteB}
10125 % \begin{macrocode}
10126 \newcounter{footnoteB}
10127 \renewcommand{\thefootnoteB}{\arabic{footnoteB}}
10128
10129 % \end{macrocode}
10130 % \end{macro}
10131 % \end{macro}
10132 %
10133 % \begin{macro}{\footinsB}
10134 % \begin{macrocode}
10135 \newinsert\footinsB
10136
10137 % \end{macrocode}
10138 % \end{macro}
10139 %
10140 %
10141 % \begin{macro}{\mpfootnoteB}
10142 % \begin{macro}{\mpfootinsB}
10143 % The extras for minipages.
10144 % \changes{v0.4}{2004/02/29}{Familiar footnotes extended for minipages}
10145 % \begin{macrocode}
10146 \newcommand{\mpfootnoteB}[1]{%
10147 \stepcounter{footnoteB}%
10148 \protected@xdef\@thefnmarkB{\thefootnoteB}%
10149 \@footnotemarkB
10150 \mpvfootnoteB{B}{#1}\m@mmf@prepare}
10151 \newinsert\mpfootinsB
10152
10153 % \end{macrocode}
10154 % \end{macro}
10155 % \end{macro}
10156 %
10157 %
10158 % \begin{macro}{\footnoteC}
10159 % \cs{footnoteC}\marg{text} is the user command for a series \texttt{C}
10160 % footnote.
10161 % \begin{macrocode}
10162 \newcommand{\footnoteC}[1]{%
10163 \stepcounter{footnoteC}%
10164 \protected@xdef\@thefnmarkC{\thefootnoteC}%
10165 \@footnotemarkC
10166 \vfootnoteC{C}{#1}\m@mmf@prepare}
10167 % \end{macrocode}
10168 % \end{macro}
10169 %
10170 %
10171 % \begin{macro}{\c@footnoteC}
10172 % \begin{macro}{\thefootnoteC}
10173 % \begin{macro}{\footinsC}
10174 % \begin{macrocode}
10175 \newcounter{footnoteC}
10176 \renewcommand{\thefootnoteC}{\arabic{footnoteC}}
10177 \newinsert\footinsC
10178
10179 % \end{macrocode}
10180 % \end{macro}
10181 % \end{macro}
10182 % \end{macro}
10183 %
10184 % \begin{macro}{\mpfootnoteC}
10185 % \begin{macro}{\mpfootinsC}
10186 % The extras for minipages.
10187 % \changes{v0.4}{2004/02/29}{Familiar footnotes extended for minipages}
10188 % \begin{macrocode}
10189 \newcommand{\mpfootnoteC}[1]{%
10190 \stepcounter{footnoteC}%
10191 \protected@xdef\@thefnmarkC{\thefootnoteC}%
10192 \@footnotemarkC
10193 \mpvfootnoteC{C}{#1}\m@mmf@prepare}
10194 \newinsert\mpfootinsC
10195
10196 % \end{macrocode}
10197 % \end{macro}
10198 % \end{macro}
10199 %
10200 %
10201 % Don't forget to initialise the series.
10202 %
10203 % \begin{macrocode}
10204 \footnormalX{A}
10205 \footnormalX{B}
10206 \footnormalX{C}
10207
10208 % \end{macrocode}
10209 %
10210 % \begin{macro}{\doxtrafeeti}
10211 % \begin{macro}{\doreinxtrafeeti}
10212 % We have to add all the new kinds of familiar footnotes to the output
10213 % routine. These are the class 1 feet\index{class 1 feet}.
10214 % \begin{macrocode}
10215 \newcommand*{\doxtrafeeti}{%
10216 \setbox\@outputbox \vbox{%
10217 \unvbox\@outputbox
10218 \ifvoid\footinsA\else\footstartA{A}\footgroupA{A}\fi
10219 \ifvoid\footinsB\else\footstartB{B}\footgroupB{B}\fi
10220 \ifvoid\footinsC\else\footstartC{C}\footgroupC{C}\fi
10221 }}
10222
10223 \newcommand{\doreinxtrafeeti}{%
10224 \ifvoid\footinsA\else\insert\footinsA{\unvbox\footinsA}\fi
10225 \ifvoid\footinsB\else\insert\footinsB{\unvbox\footinsB}\fi
10226 \ifvoid\footinsC\else\insert\footinsC{\unvbox\footinsC}\fi
10227 }
10228
10229 % \end{macrocode}
10230 % \end{macro}
10231 % \end{macro}
10232 %
10233 % \begin{macro}{\addfootinsX}
10234 % Make life just a little easier for those who want additional series
10235 % of class 1\index{class 1 feet} footnotes.
10236 % \changes{v0.4.1}{2003/03/06}{Added minpage setup to \cs{addfootinsX}}
10237 % \begin{macrocode}
10238 \newcommand*{\addfootinsX}[1]{%
10239 \footnormalX{#1}%
10240 \g@addto@macro{\doxtrafeeti}{%
10241 \setbox\@outputbox \vbox{%
10242 \unvbox\@outputbox
10243 \ifvoid\@nameuse{footins#1}\else
10244 \@nameuse{footstart#1}{#1}\@nameuse{footgroup#1}{#1}\fi}}%
10245 \g@addto@macro{\doreinxtrafeeti}{%
10246 \ifvoid\@nameuse{footins#1}\else
10247 \insert\@nameuse{footins#1}{\unvbox\@nameuse{footins#1}}\fi}%
10248 \g@addto@macro{\l@dfambeginmini}{%
10249 \expandafter\expandafter\expandafter\let\expandafter\expandafter
10250 \csname footnote#1\endcsname \csname mpfootnote#1\endcsname}%
10251 \g@addto@macro{\l@dfamendmini}{%
10252 \ifvoid\@nameuse{mpfootins#1}\else\@nameuse{mpfootgroup#1}{#1}\fi}%
10253 }
10254 % \end{macrocode}
10255 % \end{macro}
10256 %
10257 % \end{PW}
10258 %
10259 % \begin{PW}
10260 % \section{Minipages and such}
10261 %
10262 % We can put footnotes into minipages. The preparatory code has
10263 % been set up earlier, all that remains is to ensure that it is available
10264 % inside a minipage box. This requires some alteration to the kernel code,
10265 % specifically the \verb?\@iiiminipage? and \verb?\endminipage? macros.
10266 % We'll arrange this so that additional series can be easily added.
10267 %
10268 % \begin{macro}{\l@dfeetbeginmini}
10269 % \begin{macro}{\l@dfeetendmini}
10270 % These will be the hooks in \verb?\@iiiminpage? and \verb?\endminipage?
10271 % They can be extended to handle other things if necessary.
10272 % \changes{v0.4}{2004/02/29}{Added \cs{l@dfeetbeginmini}, \cs{l@dfeetendmini}
10273 % and all their supporting code}
10274 % \begin{macrocode}
10275 \newcommand*{\l@dfeetbeginmini}{\l@dedbeginmini\l@dfambeginmini}
10276 \newcommand*{\l@dfeetendmini}{\l@dedendmini\l@dfamendmini}
10277
10278 % \end{macrocode}
10279 % \end{macro}
10280 % \end{macro}
10281 %
10282 % \begin{macro}{\l@dedbeginmini}
10283 % \begin{macro}{\l@dedendmini}
10284 % These handle the initiation and closure of critical footnotes in a
10285 % minipage environment. They can be extended to cater for additional
10286 % series.
10287 % \begin{macrocode}
10288 \newcommand*{\l@dedbeginmini}{%
10289 \let\Afootnote=\mpAfootnote%
10290 \let\Bfootnote=\mpBfootnote%
10291 \let\Cfootnote=\mpCfootnote%
10292 \let\Dfootnote=\mpDfootnote%
10293 \let\Efootnote=\mpEfootnote}
10294 \newcommand*{\l@dedendmini}{%
10295 \ifvoid\mpAfootins\else\mpAfootgroup{A}\fi%
10296 \ifvoid\mpBfootins\else\mpBfootgroup{B}\fi%
10297 \ifvoid\mpCfootins\else\mpCfootgroup{C}\fi%
10298 \ifvoid\mpDfootins\else\mpDfootgroup{D}\fi%
10299 \ifvoid\mpEfootins\else\mpEfootgroup{E}\fi}
10300
10301 % \end{macrocode}
10302 % \end{macro}
10303 % \end{macro}
10304 %
10305 % \begin{macro}{\l@dfambeginmini}
10306 % \begin{macro}{\l@dfamendmini}
10307 % These handle the initiation and closure of familiar footnotes in a
10308 % minipage environment. They can be extended to cater for additional
10309 % series.
10310 % \begin{macrocode}
10311 \newcommand*{\l@dfambeginmini}{%
10312 \let\footnoteA=\mpfootnoteA%
10313 \let\footnoteB=\mpfootnoteB%
10314 \let\footnoteC=\mpfootnoteC}
10315 \newcommand*{\l@dfamendmini}{%
10316 \ifvoid\mpfootinsA\else\mpfootgroupA{A}\fi%
10317 \ifvoid\mpfootinsB\else\mpfootgroupB{B}\fi%
10318 \ifvoid\mpfootinsC\else\mpfootgroupC{C}\fi}
10319
10320 % \end{macrocode}
10321 % \end{macro}
10322 % \end{macro}
10323 %
10324 % \begin{macro}{\@iiiminipage}
10325 % This is our extended form of the kernel \verb?\@iiiminipage? defined in
10326 % \file{ltboxes.dtx}.
10327 % \changes{v0.4}{2004/02/29}{Modified kernel \cs{@iiiminipage} and
10328 % \cs{endminipage} to cater for critical footnotes}
10329 % \begin{macrocode}
10330 \def\@iiiminipage#1#2[#3]#4{%
10331 \leavevmode
10332 \@pboxswfalse
10333 \setlength\@tempdima{#4}%
10334 \def\@mpargs{{#1}{#2}[#3]{#4}}%
10335 \setbox\@tempboxa\vbox\bgroup
10336 \color@begingroup
10337 \hsize\@tempdima
10338 \textwidth\hsize \columnwidth\hsize
10339 \@parboxrestore
10340 \def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c@mpfootnote\z@
10341 \let\@footnotetext\@mpfootnotetext
10342 % \end{macrocode}
10343 % The next line is our addition to the original.
10344 % \begin{macrocode}
10345 \l@dfeetbeginmini% added
10346 \let\@listdepth\@mplistdepth \@mplistdepth\z@
10347 \@minipagerestore
10348 \@setminipage}
10349
10350 % \end{macrocode}
10351 % \end{macro}
10352 %
10353 % \begin{macro}{\endminipage}
10354 % This is our extended form of the kernel \verb?\endminipage? defined in
10355 % \file{ltboxes.dtx}.
10356 % \begin{macrocode}
10357 \def\endminipage{%
10358 \par
10359 \unskip
10360 \ifvoid\@mpfootins\else
10361 \l@dunboxmpfoot
10362 \fi
10363 % \end{macrocode}
10364 % The next line is our addition to the original.
10365 % \begin{macrocode}
10366 \l@dfeetendmini% added
10367 \@minipagefalse
10368 \color@endgroup
10369 \egroup
10370 \expandafter\@iiiparbox\@mpargs{\unvbox\@tempboxa}}
10371
10372 % \end{macrocode}
10373 % \end{macro}
10374 %
10375 % \begin{macro}{\l@dunboxmpfoot}
10376 % \changes{v0.7}{2005/02/18}{Added \cs{l@dunboxmpfoot} containing
10377 % some common code}
10378 % \begin{macrocode}
10379 \newcommand*{\l@dunboxmpfoot}{%
10380 \vskip\skip\@mpfootins
10381 \normalcolor
10382 \footnoterule
10383 \unvbox\@mpfootins}
10384
10385 % \end{macrocode}
10386 % \end{macro}
10387 %
10388 % \begin{environment}{ledgroup}
10389 % This environment puts footnotes at the end, even if that happens to
10390 % be in the middle of a page, or crossing a page boundary. It is a sort
10391 % of unboxed, fixed width minipage.
10392 % \changes{v0.4}{2004/02/29}{Added ledgroup environment}
10393 % \begin{macrocode}
10394 \newenvironment{ledgroup}{%
10395 \def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c@mpfootnote\z@
10396 \let\@footnotetext\@mpfootnotetext
10397 \l@dfeetbeginmini%
10398 }{%
10399 \par
10400 \unskip
10401 \ifvoid\@mpfootins\else
10402 \l@dunboxmpfoot
10403 \fi
10404 \l@dfeetendmini%
10405 }
10406
10407 % \end{macrocode}
10408 % \end{environment}
10409 %
10410 % \begin{environment}{ledgroupsized}
10411 % \verb?\begin{ledgroupsized}?\oarg{pos}\marg{width} \\
10412 % This environment puts footnotes at the end, even if that happens to
10413 % be in the middle of a page, or crossing a page boundary. It is a sort
10414 % of unboxed, variable \meta{width} minipage. The optional \meta{pos}
10415 % controls the sideways position of numbered text.
10416 % \changes{v0.4}{2004/02/29}{Added ledgroupsized environment}
10417 % \changes{v0.5.1}{2004/04/10}{Only change \cs{hsize} in ledgroupsized
10418 % environment otherwise page number can be in wrong place}
10419 % \begin{macrocode}
10420 \newenvironment{ledgroupsized}[2][l]{%
10421 % \end{macrocode}
10422 % Set the various text measures.
10423 % \begin{macrocode}
10424 \hsize #2\relax
10425 %% \textwidth #2\relax
10426 %% \columnwidth #2\relax
10427 % \end{macrocode}
10428 % Initialize fills for centering.
10429 % \begin{macrocode}
10430 \let\ledllfill\hfil
10431 \let\ledrlfill\hfil
10432 \def\@tempa{#1}\def\@tempb{l}%
10433 % \end{macrocode}
10434 % Left adjusted numbered lines
10435 % \begin{macrocode}
10436 \ifx\@tempa\@tempb
10437 \let\ledllfill\relax
10438 \else
10439 \def\@tempb{r}%
10440 \ifx\@tempa\@tempb
10441 % \end{macrocode}
10442 % Right adjusted numbered lines
10443 % \begin{macrocode}
10444 \let\ledrlfill\relax
10445 \fi
10446 \fi
10447 % \end{macrocode}
10448 % Set up the footnoting.
10449 % \begin{macrocode}
10450 \def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c@mpfootnote\z@
10451 \let\@footnotetext\@mpfootnotetext
10452 \l@dfeetbeginmini%
10453 }{%
10454 \par
10455 \unskip
10456 \ifvoid\@mpfootins\else
10457 \l@dunboxmpfoot
10458 \fi
10459 \l@dfeetendmini%
10460 }
10461
10462 % \end{macrocode}
10463 % \end{environment}
10464 %
10465 % \end{PW}
10466 %
10467 % \begin{PW}
10468 % \section{Indexing}
10469 %
10470 % Here's some code for indexing using page \& line numbers.
10471 %
10472 % \begin{macro}{\pagelinesep}
10473 % \begin{macro}{\edindexlab}
10474 % \begin{macro}{\c@labidx}
10475 % In order to get a correct line number we have to use the label/ref
10476 % mechanism. These macros are for that.
10477 % \begin{macrocode}
10478 \newcommand{\pagelinesep}{-}
10479 \newcommand{\edindexlab}{$&}
10480 \newcounter{labidx}
10481 \setcounter{labidx}{0}
10482
10483 % \end{macrocode}
10484 % \end{macro}
10485 % \end{macro}
10486 % \end{macro}
10487 %
10488 % \begin{macro}{\doedindexlabel}
10489 % This macro sets an |\edlabel|.
10490 % \begin{macrocode}
10491 \newcommand{\doedindexlabel}{\stepcounter{labidx}%
10492 \edlabel{\edindexlab\thelabidx}}
10493
10494 % \end{macrocode}
10495 % \end{macro}
10496 %
10497 % \begin{macro}{\thepageline}
10498 % This macro makes up the page/line number combo from the label/ref.
10499 % \begin{macrocode}
10500 \newcommand{\thepageline}{%
10501 \thepage\pagelinesep\lineref{\edindexlab\thelabidx}}
10502
10503 % \end{macrocode}
10504 % \end{macro}
10505 %
10506 % The \Lpack{memoir} class provides more flexible indexing than the
10507 % standard classes. We need different code if the \Lpack{memoir}
10508 % class is being used.
10509 %
10510 % \begin{macrocode}
10511 \@ifclassloaded{memoir}{%
10512 % \end{macrocode}
10513 % \Lpack{memoir} is being used.
10514 % \changes{v0.4.1}{2003/03/29}{Let ledmac take advantage of memoir's indexing}
10515 %
10516 % \begin{macro}{\makeindex}
10517 % \begin{macro}{\edindex}
10518 % Need to add the definition of |\edindex| to |\makeindex|, and initialise
10519 % |\edindex| to do nothing. In this case |\edindex| has an optional
10520 % argument. We use the hook provided in \Lpack{memoir} v1.61.
10521 % \begin{macrocode}
10522 \g@addto@macro{\makememindexhook}{%
10523 \def\edindex{\@bsphack%
10524 \@ifnextchar [{\l@d@index}{\l@d@index[\jobname]}}}
10525 \newcommand{\edindex}[2][\jobname]{\@bsphack\@esphack}
10526 % \end{macrocode}
10527 % \end{macro}
10528 % \end{macro}
10529 %
10530 % \begin{macro}{\l@d@index}
10531 % |\l@d@index[file]| is the first stage of |\edindex|, handling the
10532 % |idx| file. This a virtually a verbatim copy of \Lpack{memoir}'s |\@index|,
10533 % the change being calling |\l@dwrindexm@m| instead of |\@wrindexm@m|.
10534 % \begin{macrocode}
10535 \def\l@d@index[#1]{%
10536 \@ifundefined{#1@idxfile}%
10537 {\ifreportnoidxfile
10538 \led@warn@NoIndexFile{#1}%
10539 \fi
10540 \begingroup
10541 \@sanitize
10542 \@nowrindex}%
10543 {\def\@idxfile{#1}%
10544 \doedindexlabel
10545 \begingroup
10546 \@sanitize
10547 \l@d@wrindexm@m}}
10548 % \end{macrocode}
10549 % \end{macro}
10550 %
10551 % \begin{macro}{\l@d@wrindexm@m}
10552 % \begin{macro}{\l@d@@wrindexhyp}
10553 % |\l@d@wrindexm@m{item}| writes the |idx| file name and the indexed
10554 % item to the |aux| file. These are almost verbatim copies of \Lpack{memoir}'s
10555 % |\@wrindexm@m| and |\@@wrindexhyp|.
10556 % \begin{macrocode}
10557 \newcommand{\l@d@wrindexm@m}[1]{\l@d@@wrindexhyp#1||\\}
10558 \def\l@d@@wrindexhyp#1|#2|#3\\{%
10559 \ifshowindexmark\@showidx{#1}\fi
10560 \ifx\\#2\\%
10561 \protected@write\@auxout{}%
10562 {\string\@@wrindexm@m{\@idxfile}{#1|hyperpage}{\thepageline}}%
10563 \else
10564 \def\Hy@temp@A{#2}%
10565 \ifx\Hy@temp@A\HyInd@ParenLeft
10566 \protected@write\@auxout{}%
10567 {\string\@@wrindexm@m{\@idxfile}{#1|#2hyperpage}{\thepageline}}%
10568 \else
10569 \protected@write\@auxout{}%
10570 {\string\@@wrindexm@m{\@idxfile}{#1|#2}{\thepageline}}%
10571 \fi
10572 \fi
10573 \endgroup
10574 \@esphack}
10575 % \end{macrocode}
10576 % \end{macro}
10577 % \end{macro}
10578 %
10579 % That finishes the \Lpack{memoir}-specific code.
10580 % \begin{macrocode}
10581 }{%
10582 % \end{macrocode}
10583 % \Lpack{memoir} is not being used, which makes life somewhat simpler.
10584 %
10585 % \begin{macro}{\makeindex}
10586 % \begin{macro}{\edindex}
10587 % Need to add the definition of |\edindex| to |\makeindex|, and initialise
10588 % |\edindex| to do nothing.
10589 % \begin{macrocode}
10590 \g@addto@macro{\makeindex}{%
10591 \def\edindex{\@bsphack
10592 \doedindexlabel
10593 \begingroup
10594 \@sanitize
10595 \@wredindex}}
10596 \newcommand{\edindex}[1]{\@bsphack\@esphack}
10597 % \end{macrocode}
10598 % \end{macro}
10599 % \end{macro}
10600 %
10601 % \begin{macro}{\@wredindex}
10602 % Write the index information to the \file{idx} file.
10603 % \begin{macrocode}
10604 \newcommand{\@wredindex}[1]{%
10605 \protected@write\@indexfile{}%
10606 {\string\indexentry{#1}{\thepageline}}%
10607 \endgroup
10608 \@esphack}
10609 % \end{macrocode}
10610 % \end{macro}
10611 %
10612 % That finishes the non-\Lpack{memoir} index code.
10613 % \begin{macrocode}
10614 }
10615
10616 % \end{macrocode}
10617 %
10618 % \begin{macro}{\l@d@@wrindexhyp}
10619 % If the \Lpack{hyperref} package is not loaded, it doesn't make sense
10620 % to clutter up the index with hyperreffing things.
10621 % \begin{macrocode}
10622 \AtBeginDocument{\@ifpackageloaded{hyperref}{}{%
10623 \def\l@d@@wrindexhyp#1||\\{%
10624 \ifshowindexmark\@showidx{#1}\fi
10625 \protected@write\@auxout{}%
10626 {\string\@@wrindexm@m{\@idxfile}{#1}{\thepageline}}%
10627 \endgroup
10628 \@esphack}}}
10629
10630 % \end{macrocode}
10631 % \end{macro}
10632 %
10633 %
10634 % \section{Macro as environment}
10635 %
10636 %
10637 % The following is borrowed, and renamed, from the \Lpack{amsmath}
10638 % package. See also the CTT thread `eeq and amstex', 1995/08/31, started
10639 % by Keith Reckdahl and ended definitively by David M. Jones.
10640 %
10641 %
10642 % \end{PW}
10643 %
10644 % Several of the [math] macros scan their body twice. This means we must
10645 % collect all text in the body of an environment form before calling
10646 % the macro.
10647 %
10648 % \begin{macro}{\@emptytoks}
10649 % This is actually defined in the \Lpack{amsgen} package.
10650 % \begin{macrocode}
10651 \newtoks\@emptytoks
10652
10653 % \end{macrocode}
10654 % \end{macro}
10655 %
10656 % The rest is from \Lpack{amsmath}.
10657 %
10658 % \begin{macro}{\l@denvbody}
10659 % A token register to contain the body.
10660 % \begin{macrocode}
10661 \newtoks\l@denvbody
10662
10663 % \end{macrocode}
10664 % \end{macro}
10665 %
10666 % \begin{macro}{\addtol@denvbody}
10667 % |\addtol@denvdody{arg}| adds |arg| to the token register |\l@denvbody|.
10668 % \begin{macrocode}
10669 \newcommand{\addtol@denvbody}[1]{%
10670 \global\l@denvbody\expandafter{\the\l@denvbody#1}}
10671
10672 % \end{macrocode}
10673 % \end{macro}
10674 %
10675 % \begin{macro}{\l@dcollect@body}
10676 % The macro |\l@dcollect@body| starts the scan for the |\end{...}| command
10677 % of the current environment. It takes a macro name as argument. This macro
10678 % is supposed to take the whole body of the environment as its argument.
10679 % For example, given |cenv#1{...}| as a macro that processes |#1|, then
10680 % the environment form, |\begin{env}| would call |\l@dcollect@body\cenv|.
10681 %
10682 % \begin{macrocode}
10683 \newcommand{\l@dcollect@body}[1]{%
10684 \l@denvbody{\expandafter#1\expandafter{\the\l@denvbody}}%
10685 \edef\processl@denvbody{\the\l@denvbody\noexpand\end{\@currenvir}}%
10686 \l@denvbody\@emptytoks \def\l@dbegin@stack{b}%
10687 \begingroup
10688 \expandafter\let\csname\@currenvir\endcsname\l@dcollect@@body
10689 \edef\processl@denvbody{\expandafter\noexpand\csname\@currenvir\endcsname}%
10690 \processl@denvbody}
10691
10692 % \end{macrocode}
10693 % \end{macro}
10694 %
10695 % \begin{macro}{\l@dpush@begins}
10696 % When adding a piece of the current environment's contents to |\l@denvbody|,
10697 % we scan it to check for additional |\begin| tokens, and add a `b' to the
10698 % stack for any that we find.
10699 % \begin{macrocode}
10700 \def\l@dpush@begins#1\begin#2{%
10701 \ifx\end#2\else b\expandafter\l@dpush@begins\fi}
10702
10703 % \end{macrocode}
10704 % \end{macro}
10705 %
10706 % \begin{macro}{\l@dcollect@@body}
10707 % |\l@dcollect@@body| takes two arguments: the first will consist of all text
10708 % up to the next |\end| command, and the second will be the |\end| command's
10709 % argument. If therte are any extra |\begin| commands in the body text,
10710 % a marker is pushed onto a stack by the |l@dpush@begins| function.
10711 % Empty state for this stack means we have reached the |\end| that matches
10712 % our original |\begin|. Otherwise we need to include the |\end| and its
10713 % argument in the material we are adding to the environment body accumulator.
10714 % \begin{macrocode}
10715 \def\l@dcollect@@body#1\end#2{%
10716 \edef\l@dbegin@stack{\l@dpush@begins#1\begin\end
10717 \expandafter\@gobble\l@dbegin@stack}%
10718 \ifx\@empty\l@dbegin@stack
10719 \endgroup
10720 \@checkend{#2}%
10721 \addtol@denvbody{#1}%
10722 \else
10723 \addtol@denvbody{#1\end{#2}}%
10724 \fi
10725 \processl@denvbody % A little tricky! Note the grouping
10726 }
10727
10728 % \end{macrocode}
10729 % \end{macro}
10730 %
10731 % \begin{PW}
10732 % There was a question on CTT about how to use |\collect@body| for a macro
10733 % taking an argument. The following is part of that thread.
10734 % \begin{verbatim}
10735 % From: Heiko Oberdiek <[email protected]>
10736 % Newsgroups: comp.text.tex
10737 % Subject: Re: Using \collect@body with commands that take >1 argument
10738 % Date: Fri, 08 Aug 2003 09:03:20 +0200
10739 %
10740 % [email protected] (Evan) wrote:
10741 % > I'm trying to make a new Latex environment that acts like the>
10742 % \colorbox command that is part of the color package. I looked through
10743 % > the FAQ and ran across this bit about using the \collect@body command
10744 % > that is part of AMSLaTeX:
10745 % > http://www.tex.ac.uk/cgi-bin/texfaq2html?label=cmdasenv
10746 % >
10747 % > It almost works. If I do something like the following:
10748 % > \newcommand{\redbox}[1]{\colorbox{red}{#1}}
10749 % >
10750 % > \makeatletter
10751 % > \newenvironment{redbox}{\collect@body \redbox}{}
10752 %
10753 % You will get an error message: Command \redbox already defined.
10754 % Thus you must rename either the command \redbox or the environment
10755 % name.
10756 %
10757 % > \begin{coloredbox}{blue}
10758 % > Yadda yadda yadda... this is on a blue background...
10759 % > \end{coloredbox}
10760 % > and can't figure out how to make the \collect@body take this.
10761 %
10762 % > \collect@body \colorbox{red}
10763 % > \collect@body {\colorbox{red}}
10764 %
10765 % The argument of \collect@body has to be one token exactly.
10766 %
10767 % \documentclass{article}
10768 % \usepackage{color}
10769 % \usepackage{amsmath}
10770 %
10771 % \newcommand{\redbox}[1]{\colorbox{red}{#1}}
10772 % \makeatletter
10773 % \newenvironment{coloredbox}[1]{%
10774 % \def\next@{\colorbox{#1}}%
10775 % \collect@body\next@
10776 % }{}
10777 %
10778 % % ignore spaces at begin and end of environment
10779 % \newenvironment{coloredboxII}[1]{%
10780 % \def\next@{\mycoloredbox{#1}}%
10781 % \collect@body\next@
10782 % }{}
10783 % \newcommand{\mycoloredbox}[2]{%
10784 % \colorbox{#1}{\ignorespaces#2\unskip}%
10785 % }
10786 %
10787 % % support of optional color model argument
10788 % \newcommand\coloredboxIII\endcsname{}
10789 % \def\coloredboxIII#1#{%
10790 % \@coloredboxIII{#1}%
10791 % }
10792 % \def\@coloredboxIII#1#2{%
10793 % \def\next@{\mycoloredboxIII{#1}{#2}}%
10794 % \collect@body\next@
10795 % }
10796 % \newcommand{\mycoloredboxIII}[3]{%
10797 % \colorbox#1{#2}{\ignorespaces#3\unskip}%
10798 % }
10799 %
10800 % \makeatother
10801 %
10802 % \begin{document}
10803 % Black text before
10804 % \begin{coloredbox}{blue}
10805 % Hello World
10806 % \end{coloredbox}
10807 % Black text after
10808 %
10809 % Black text before
10810 % \begin{coloredboxII}{blue}
10811 % Hello World
10812 % \end{coloredboxII}
10813 % Black text after
10814 %
10815 % Black text before
10816 % \begin{coloredboxIII}[rgb]{0,0,1}
10817 % Hello World
10818 % \end{coloredboxIII}
10819 % Black text after
10820 %
10821 % \end{document}
10822 %
10823 % Yours sincerely
10824 % Heiko <[email protected]>
10825 % \end{verbatim}
10826 %
10827 % \end{PW}
10828 %
10829 % \section{Verse}
10830 %
10831 % \begin{PW}
10832 % This is principally Wayne Sullivan's\index{Sullivan, Wayne}
10833 % code and commentary from \edstanza~\cite{EDSTANZA}.
10834 % \end{PW}
10835 %
10836 %
10837 % \begin{PW}
10838 % The macro \cmd{\hangingsymbol} is used to insert a symbol on each hanging of verses.
10839 %For example, in french typographie the symbol is `['. We obtain it by the next code:
10840 %\begin{verbatim}
10841 %\renewcommand{\hangingsymbol}{[\,}
10842 %\end{verbatim}
10843 % The \cs{ifinstanza} boolean is used to be sure that we are in a stanza part.
10844 % \begin{macro}{\hangingsymbol}
10845 % \begin{macro}{\ifinstanza}
10846 % \begin{macrocode}
10847 \newcommand*{\hangingsymbol}{}
10848 \newif\ifinstanza
10849 \instanzafalse
10850 % \end{macrocode}
10851 % \end{macro}
10852 % \end{macro}
10853 %\changes{v0.15}{2012/06/11}{New management of hangingsymbol insertion, preventing undesirable insertions.}
10854 %\changes{v0.17}{2012/08/03}{New new management of hangingsymbol insertion, preventing undesirable insertions.}
10855 % \begin{macro}{\inserthangingymbol}
10856 % \begin{macro}{\ifinserthangingsymbol}
10857 % The boolean \cs{ifinserthangingsymbol} is set to TRUE when \cs{@lock} is greater than 1, i.e. when we are not in the first line of a verse. The switch of \cs{ifinserthangingsymbol} is made in \cs{do@line} before the printing of line but after the line number calculation.
10858 % \begin{macrocode}
10859 \newif\ifinserthangingsymbol
10860 \newcommand{\inserthangingsymbol}{%
10861 \ifinserthangingsymbol%
10862 \ifinstanza%
10863 \hfill\hangingsymbol%
10864 \fi%
10865 \fi%
10866 }
10867 % \end{macrocode}
10868 % \end{macro}
10869 % \end{macro}
10870 % \begin{macro}{\ampersand}
10871 % Within a stanza the \verb?\&? macro is going to be usurped. We need an
10872 % alias in case an \& needs to be typeset in a stanza. Define it rather
10873 % than letting it in case some other package has already defined it.
10874 % \begin{macrocode}
10875 \newcommand*{\ampersand}{\char`\&}
10876
10877 % \end{macrocode}
10878 % \end{macro}
10879 % \end{PW}
10880 %
10881 %
10882 % \begin{macro}{\stanza@count}
10883 % \begin{macro}{\stanzaindentbase}
10884 % Before we can define the main macros we need to save and reset
10885 % some category codes. To save the current values we use
10886 % \verb+\next+ and \verb+\body+ from the \verb+\loop+ macro.
10887 % \begin{macrocode}
10888 \chardef\body=\catcode`\@
10889 \catcode`\@=11
10890 \chardef\next=\catcode`\&
10891 \catcode`\&=\active
10892
10893 % \end{macrocode}
10894 %
10895 % A count register is allocated for counting lines in a stanza; also allocated
10896 % is a dimension register which is used to specify the base value for
10897 % line indentation; all stanza indentations are multiples of this
10898 % value. The default value of \verb+\stanzaindentbase+ is 20pt.
10899 % \begin{macrocode}
10900 \newcount\stanza@count
10901 \newlength{\stanzaindentbase}
10902 \setlength{\stanzaindentbase}{20pt}
10903
10904 % \end{macrocode}
10905 % \end{macro}
10906 % \end{macro}
10907 %
10908 % \begin{macro}{\strip@szacnt}
10909 % \begin{macro}{\setstanzavalues}
10910 % The indentations of stanza lines are non-negative integer multiples of the
10911 % unit called
10912 % \verb+\stanzaindentbase+. To make it easier for the user to specify these
10913 % numbers, some list macros are defined. These take numerical values
10914 % in a list separated by commas and assign the values to special control
10915 % sequences using \verb+\mathchardef+. Though this does limit the range
10916 % from 0 to 32767, it should suffice for most applications,
10917 % including \emph{penalties}, which will be discussed below.
10918 % \begin{macrocode}
10919 \def\strip@szacnt#1,#2|{\def\@tempb{#1}\def\@tempa{#2|}}
10920 \newcommand*{\setstanzavalues}[2]{\def\@tempa{#2,,|}%
10921 \stanza@count\z@
10922 \def\next{\expandafter\strip@szacnt\@tempa
10923 \ifx\@tempb\empty\let\next\relax\else
10924 \expandafter\mathchardef\csname #1@\number\stanza@count
10925 @\endcsname\@tempb\relax
10926 \advance\stanza@count\@ne\fi\next}%
10927 \next}
10928
10929 % \end{macrocode}
10930 % \end{macro}
10931 % \end{macro}
10932 %
10933 % \begin{PW}
10934 % \begin{macro}{\setstanzaindents}
10935 % \begin{macro}{\setstanzapenalties}
10936 % \begin{macro}{\managestanza@modulo}
10937 % In the original \verb?\setstanzavalues{sza}{...}? had to be called to
10938 % set the indents, and similarly \verb?\setstanzavalues{szp}{...}?
10939 % to set the penalties. These two macros are a convenience to give
10940 % the user one less thing to worry about (misspelling the first argument).
10941 % Since version 0.13, the \verb+stanzaindentsrepetition+ counter can be used when the indentation is repeated every n verses. The \cs{managestanza@modulo} is a command which modifies the counter stanza@modulo. The command adds 1 to stanza@modulo, but if stanza@modulo is equal to the stanzaindentsrepetition counter, the command restarts it.
10942 %\changes{v0.13}{2011/11/08}{New stanzaindentsrepetition counter to repeat stanza indents every \emph{n} verses.}
10943 % \begin{macrocode}
10944 \newcommand*{\setstanzaindents}[1]{\setstanzavalues{sza}{#1}}
10945 \newcommand*{\setstanzapenalties}[1]{\setstanzavalues{szp}{#1}}
10946
10947 \newcounter{stanzaindentsrepetition}
10948 \newcount\stanza@modulo
10949
10950 \newcommand*{\managestanza@modulo}[0]{
10951 \advance\stanza@modulo\@ne
10952 \ifnum\stanza@modulo>\value{stanzaindentsrepetition}
10953 \stanza@modulo\@ne
10954 \fi
10955 }
10956 % \end{macrocode}
10957 % \end{macro}
10958 % \end{macro}
10959 % \end{macro}
10960 % \end{PW}
10961 %
10962 % \begin{macro}{\stanza@line}
10963 % \begin{macro}{\stanza@hang}
10964 % \begin{macro}{\sza@penalty}
10965 % Now we arrive at the main works. \verb+\stanza@line+ sets the
10966 % indentation for the line and starts a numbered paragraph---each
10967 % line is treated as a paragraph. \verb+\stanza@hang+ sets the
10968 % hanging indentation to be used if the stanza line requires
10969 % more than one print line. If it is known that each stanza line
10970 % will fit on one print line, it is advisable to set the
10971 % hanging indentation to zero. \verb+\sza@penalty+ places the
10972 % specified penalty following each stanza line. By default, this
10973 % facility is turned off so that no penalty is included. However,
10974 % the user may initiate these penalties to indicate good and bad
10975 % places in the stanza for page breaking.
10976 % \begin{macrocode}
10977 \def\stanza@line{
10978 \ifnum\value{stanzaindentsrepetition}=0
10979 \parindent=\csname sza@\number\stanza@count
10980 @\endcsname\stanzaindentbase
10981 \else
10982 \managestanza@modulo
10983 \parindent=\csname sza@\number\stanza@modulo
10984 @\endcsname\stanzaindentbase
10985 \fi
10986 \pstart\stanza@hang\ignorespaces}
10987 \xdef\stanza@hang{\noexpand\leavevmode\noexpand\startlock
10988 \hangindent\expandafter
10989 \noexpand\csname sza@0@\endcsname\stanzaindentbase
10990 \hangafter\@ne}
10991 \def\sza@penalty{\count@\csname szp@\number\stanza@count @\endcsname
10992 \ifnum\count@>\@M\advance\count@-\@M\penalty-\else
10993 \penalty\fi\count@}
10994 % \end{macrocode}
10995 % \end{macro}
10996 % \end{macro}
10997 % \end{macro}
10998 %
10999 % \begin{macro}{\startstanzahook}
11000 % \begin{macro}{\endstanzaextra}
11001 % \begin{macro}{\stanza}
11002 % Now we have the components of the \verb+\stanza+ macro,
11003 % which appears at the start of a group of lines. This macro
11004 % initializes the count and checks to see if hanging indentation
11005 % and penalties are to be included. Hanging indentation suspends
11006 % the line count, so that the enumeration is by verse line
11007 % rather than by print line. If the print line count is desired,
11008 % invoke \verb+\let\startlock=\relax+ and do the same for
11009 % \verb+\endlock+. Here and above we have used \verb+\xdef+ to
11010 % make the stored macros take up a bit less space, but it also
11011 % makes them more obscure to the reader. Lines of the stanza are
11012 % delimited by ampersands \&. The last line of the stanza must
11013 % end with \verb+\&+. For convenience the macro
11014 % \verb+\endstanzaextra+ is incuded. The user may use this to add
11015 % vertical space or penalties between stanzas.
11016 %
11017 % \begin{PW}
11018 % As a further convenience, the macro \verb?\startstanzahook? is
11019 % called at the beginning of a stanza. This can be defined to
11020 % do something useful.
11021 % \end{PW}
11022 % \begin{macrocode}
11023 \let\startstanzahook\relax
11024 \let\endstanzaextra\relax
11025 \xdef\stanza{\noexpand\instanzatrue\expandafter
11026 \begingroup\startstanzahook%
11027 \catcode`\&\active\global\stanza@count\@ne\stanza@modulo\@ne
11028 \noexpand\ifnum\expandafter\noexpand
11029 \csname sza@0@\endcsname=\z@\let\noexpand\stanza@hang\relax
11030 \let\noexpand\endlock\relax\noexpand\else\interlinepenalty
11031 \@M\rightskip\z@ plus 1fil\relax\noexpand\fi\noexpand\ifnum
11032 \expandafter\noexpand\csname szp@0@\endcsname=\z@
11033 \let\noexpand\sza@penalty\relax\noexpand\fi \def\noexpand&{%
11034 \noexpand\endlock\noexpand\pend\noexpand\sza@penalty\global
11035 \advance\stanza@count\@ne\noexpand\stanza@line}\def\noexpand
11036 \&{\noexpand\endlock\noexpand\pend\endgroup\noexpand\instanzafalse\expandafter\endstanzaextra}%
11037 \noexpand\stanza@line}
11038
11039 % \end{macrocode}
11040 % \end{macro}
11041 % \end{macro}
11042 % \end{macro}
11043 %
11044 % \begin{PW}
11045 % \begin{macro}{\flagstanza}
11046 % Use \verb?\flagstanza[len]{text}? at the start of a line to put \texttt{text}
11047 % a distance \texttt{len} before the start of the line. The default for
11048 % \texttt{len} is \verb?\stanzaindentbase?.
11049 % \begin{macrocode}
11050 \newcommand*{\flagstanza}[2][\stanzaindentbase]{%
11051 \hskip -#1\llap{#2}\hskip #1\ignorespaces}
11052
11053 % \end{macrocode}
11054 % \end{macro}
11055 % \end{PW}
11056 %
11057 % The ampersand \& is used to mark the end of each stanza line, except the
11058 % last, which is marked with \verb+\&+. This means that \verb+\halign+ may
11059 % not be used directly within a stanza line. This does not affect macros
11060 % involving alignments defined outside \verb+\stanza \&+. Since these
11061 % macros usurp the control sequence \verb+\&+, the replacement
11062 % \verb+\ampersand+ is defined to be used if this symbol is needed in a
11063 % stanza. Also we reset the modified category codes and initialize the
11064 % penalty default.
11065 % \begin{macrocode}
11066 \catcode`\&=\next
11067 \catcode`\@=\body
11068 %% \let\ampersand=\&
11069 \setstanzavalues{szp}{0}
11070
11071 % \end{macrocode}
11072 %
11073 %
11074 %
11075 %
11076 % \section{Arrays and tables}
11077 %
11078 % \begin{PW}
11079 %
11080 % This is based on the work by Herbert Breger\index{Breger, Herbert}
11081 % in developing \file{tabmac.tex}.
11082 % \begin{verbatim}
11083 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11084 % % This is file tabmac.tex 1.0.
11085 % % You find here macros for tabular structures compatible with
11086 % % Edmac (authored by Lavagnino/Wujastyk). The use of the macros is
11087 % % explained in German language in file tabanlei.dvi. The macros were
11088 % % developed for Edmac 2.3, but this file has been adjusted to Edmac 3.16.
11089 % %
11090 % % ATTENTION: This file uses some Edmac control sequences (like
11091 % % \text, \Afootnote etc.) and redefines \morenoexpands. If you yourself
11092 % % redefined some Edmac control sequences, be careful: some adjustements
11093 % % might be necessary.
11094 % % October 1996
11095 % %
11096 % % My kind thanks to Nora G^Æ’deke for valuable support. Any hints and
11097 % % comments are welcome, please contact Herbert Breger,
11098 % % Leibniz-Archiv, Waterloostr. 8, D -- 30169 Hannover, Germany
11099 % % Tel.: 511 - 1267 327
11100 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11101 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11102 % \end{verbatim}
11103 %
11104 % The original \file{tabmac.tex} file was void of comments or any explanatory
11105 % text other than the above notice. The algorithm is Breger's. I have made
11106 % some cosmetic changes to the original code and reimplemented some things
11107 % so they are more LaTeX-like. All the commentary is mine, as are any mistakes
11108 % or errors.
11109 %
11110 % \begin{macro}{\l@dtabnoexpands}
11111 % An extended and modified version of the original additional no expansions..
11112 % \begin{macrocode}
11113 \newcommand*{\l@dtabnoexpands}{%
11114 \def\ss{\noexpand\ss}%
11115 \def\"##1{\noexpand\"##1}%
11116 \def\'##1{\noexpand\'##1}%
11117 \def\`##1{\noexpand\`##1}%
11118 \def\^##1{\noexpand\^##1}%
11119 \def\phantom##1{\noexpand\phantom{##1}}%
11120 \def\hphantom##1{\noexpand\hphantom{##1}}%
11121 \def\underbrace##1{\noexpand\underbrace{##1}}%
11122 \def\dots{\noexpand\dots}%
11123 \let\rtab=0%
11124 \let\ctab=0%
11125 \let\ltab=0%
11126 \let\rtabtext=0%
11127 \let\ltabtext=0%
11128 \let\ctabtext=0%
11129 \let\edbeforetab=0%
11130 \let\edaftertab=0%
11131 \let\edatab=0%
11132 \let\edatabell=0%
11133 \let\edatleft=0%
11134 \let\edatright=0%
11135 \let\edvertline=0%
11136 \let\edvertdots=0%
11137 \let\edrowfill=0%
11138 }
11139
11140 % \end{macrocode}
11141 % \end{macro}
11142 %
11143 % \begin{macro}{\l@dampcount}
11144 % \begin{macro}{\l@dcolcount}
11145 % |\l@dampcount| is a counter for the \& column dividers and
11146 % |\l@dcolcount| is a counter for the columns. These were
11147 % |\Undcount| and |\stellencount| respectively.
11148 % \begin{macrocode}
11149 \newcount\l@dampcount
11150 \l@dampcount=1\relax
11151 \newcount\l@dcolcount
11152 \l@dcolcount=0\relax
11153
11154 % \end{macrocode}
11155 % \end{macro}
11156 % \end{macro}
11157 %
11158 % \begin{macro}{\hilfsbox}
11159 % \begin{macro}{\hilfsskip}
11160 % \begin{macro}{\Hilfsbox}
11161 % \begin{macro}{\hilfscount}
11162 % Some (temporary) helper items.
11163 % \begin{macrocode}
11164 \newbox\hilfsbox
11165 \newskip\hilfsskip
11166 \newbox\Hilfsbox
11167 \newcount\hilfscount
11168
11169 % \end{macrocode}
11170 % \end{macro}
11171 % \end{macro}
11172 % \end{macro}
11173 % \end{macro}
11174 %
11175 % 30 columns should be adequate (compared to the original 60).
11176 % These are the column widths. (Originally these were German spelled numbers
11177 % e.g., |\eins|, |\zwei|, etc).
11178 % \begin{macrocode}
11179 \newdimen\dcoli
11180 \newdimen\dcolii
11181 \newdimen\dcoliii
11182 \newdimen\dcoliv
11183 \newdimen\dcolv
11184 \newdimen\dcolvi
11185 \newdimen\dcolvii
11186 \newdimen\dcolviii
11187 \newdimen\dcolix
11188 \newdimen\dcolx
11189 \newdimen\dcolxi
11190 \newdimen\dcolxii
11191 \newdimen\dcolxiii
11192 \newdimen\dcolxiv
11193 \newdimen\dcolxv
11194 \newdimen\dcolxvi
11195 \newdimen\dcolxvii
11196 \newdimen\dcolxviii
11197 \newdimen\dcolxix
11198 \newdimen\dcolxx
11199 \newdimen\dcolxxi
11200 \newdimen\dcolxxii
11201 \newdimen\dcolxxiii
11202 \newdimen\dcolxxiv
11203 \newdimen\dcolxxv
11204 \newdimen\dcolxxvi
11205 \newdimen\dcolxxvii
11206 \newdimen\dcolxxviii
11207 \newdimen\dcolxxix
11208 \newdimen\dcolxxx
11209 \newdimen\dcolerr % added for error handling
11210
11211 % \end{macrocode}
11212 %
11213 % \begin{macro}{\l@dcolwidth}
11214 % This is a cunning way of storing the columnwidths indexed by
11215 % the column number |\l@dcolcount|, like an array. (was |\Dimenzuordnung|)
11216 % \begin{macrocode}
11217 \newcommand{\l@dcolwidth}{\ifcase \the\l@dcolcount \dcoli %???
11218 \or \dcoli \or \dcolii \or \dcoliii
11219 \or \dcoliv \or \dcolv \or \dcolvi
11220 \or \dcolvii \or \dcolviii \or \dcolix \or \dcolx
11221 \or \dcolxi \or \dcolxii \or \dcolxiii
11222 \or \dcolxiv \or \dcolxv \or \dcolxvi
11223 \or \dcolxvii \or \dcolxviii \or \dcolxix \or \dcolxx
11224 \or \dcolxxi \or \dcolxxii \or \dcolxxiii
11225 \or \dcolxxiv \or \dcolxxv \or \dcolxxvi
11226 \or \dcolxxvii \or \dcolxxviii \or \dcolxxix \or \dcolxxx
11227 \else \dcolerr \fi}
11228
11229 % \end{macrocode}
11230 % \end{macro}
11231 %
11232 % \begin{macro}{\stepl@dcolcount}
11233 % This increments the column counter, and issues an error message
11234 % if it is too large.
11235 % \begin{macrocode}
11236 \newcommand*{\stepl@dcolcount}{\advance\l@dcolcount\@ne
11237 \ifnum\l@dcolcount>30\relax
11238 \led@err@TooManyColumns
11239 \fi}
11240
11241 % \end{macrocode}
11242 % \end{macro}
11243 %
11244 % \begin{macro}{\l@dsetmaxcolwidth}
11245 % Sets the column width to the maximum value seen so far. (was |\dimenzuordnung|)
11246 % \begin{macrocode}
11247 \newcommand{\l@dsetmaxcolwidth}{%
11248 \ifdim\l@dcolwidth < \wd\hilfsbox
11249 \l@dcolwidth = \wd\hilfsbox
11250 \else \relax \fi}
11251
11252 % \end{macrocode}
11253 % \end{macro}
11254 %
11255 % \begin{macro}{\EDTEXT}
11256 % \begin{macro}{\xedtext}
11257 % \begin{macro}{\CRITEXT}
11258 % \begin{macro}{\xcritext}
11259 % We need to be able to modify the |\edtext| and |\critext| macros
11260 % and also restore their original definitions.
11261 % \begin{macrocode}
11262 \let\EDTEXT=\edtext
11263 \newcommand{\xedtext}[2]{\EDTEXT{#1}{#2}}
11264 \let\CRITEXT=\critext
11265 \long\def\xcritext #1#2/{\CRITEXT{#1}{#2}/}
11266 % \end{macrocode}
11267 % \end{macro}
11268 % \end{macro}
11269 % \end{macro}
11270 % \end{macro}
11271 %
11272 % \begin{macro}{\EDLABEL}
11273 % \begin{macro}{\xedlabel}
11274 % We need to be able to modify and restore the |\edlabel| macro.
11275 % \begin{macrocode}
11276 \let\EDLABEL=\edlabel
11277 \newcommand*{\xedlabel}[1]{\EDLABEL{#1}}
11278 % \end{macrocode}
11279 % \end{macro}
11280 % \end{macro}
11281 %
11282 %
11283 % \begin{macro}{\EDINDEX}
11284 % \begin{macro}{\xedindex}
11285 % \begin{macro}{\nulledindex}
11286 % Macros supporting modification and restoration of |\edindex|.
11287 % \begin{macrocode}
11288 \let\EDINDEX=\edindex
11289 \ifl@dmemoir
11290 \newcommand{\xedindex}{\@bsphack%
11291 \@ifnextchar [{\l@d@index}{\l@d@index[\jobname]}}
11292 \newcommand{\nulledindex}[2][\jobname]{\@bsphack\@esphack}
11293 \else
11294 \newcommand{\xedindex}{\@bsphack%
11295 \doedindexlabel
11296 \begingroup
11297 \@sanitize
11298 \@wredindex}
11299 \newcommand{\nulledindex}[1]{\@bsphack\@esphack}
11300 \fi
11301
11302 % \end{macrocode}
11303 % \end{macro}
11304 % \end{macro}
11305 % \end{macro}
11306 %
11307 %
11308 % \begin{macro}{\A@@footnote}
11309 % \begin{macro}{\B@@footnote}
11310 % \begin{macro}{\C@@footnote}
11311 % \begin{macro}{\D@@footnote}
11312 % \begin{macro}{\E@@footnote}
11313 % We need to be able to modify \Ledmac's footnote macros and restore their
11314 % original definitions. There are five of these.
11315 % \begin{macrocode}
11316 \let\A@@footnote=\Afootnote
11317 \let\B@@footnote=\Bfootnote
11318 \let\C@@footnote=\Cfootnote
11319 \let\D@@footnote=\Dfootnote
11320 \let\E@@footnote=\Efootnote
11321 % \end{macrocode}
11322 % \end{macro}
11323 % \end{macro}
11324 % \end{macro}
11325 % \end{macro}
11326 % \end{macro}
11327 %
11328 % \begin{macro}{\@line@@num}
11329 % Macro supporting restoration of |\linenum|.
11330 % \begin{macrocode}
11331 \let\@line@@num=\linenum
11332 % \end{macrocode}
11333 % \end{macro}
11334 %
11335 % \begin{macro}{\l@dgobbledarg}
11336 % \begin{macro}{\l@dgobblearg}
11337 % |\l@dgobbledarg| replaces its delineated argument by |\relax|
11338 % (was |\verschwinden|).
11339 % |\l@dgobblearg|\marg{arg} replaces its argument by |\relax|.
11340 % \begin{macrocode}
11341 \def\l@dgobbledarg #1/{\relax}
11342 \newcommand*{\l@dgobblearg}[1]{\relax}
11343
11344 % \end{macrocode}
11345 % \end{macro}
11346 % \end{macro}
11347 %
11348 % \begin{macro}{\Relax}
11349 % \begin{macro}{\NEXT}
11350 % \begin{macro}{\@hilfs@count}
11351 % \begin{macrocode}
11352 \let\Relax=\relax
11353 \let\NEXT=\next
11354 \newcount\@hilfs@count
11355
11356 % \end{macrocode}
11357 % \end{macro}
11358 % \end{macro}
11359 % \end{macro}
11360 %
11361 % \begin{macro}{\measuremcell}
11362 % Measure (recursively) the width required for a math cell. (was |\messen|)
11363 % \begin{macrocode}
11364 \def\measuremcell #1&{%
11365 \ifx #1\\ \ifnum\l@dcolcount=0\let\NEXT\relax%
11366 \else\l@dcheckcols%
11367 \l@dcolcount=0%
11368 \let\NEXT\measuremcell%
11369 \fi%
11370 \else\setbox\hilfsbox=\hbox{$\displaystyle{#1}$}%
11371 \stepl@dcolcount%
11372 \l@dsetmaxcolwidth%
11373 \let\NEXT\measuremcell%
11374 \fi\NEXT}
11375
11376 % \end{macrocode}
11377 % \end{macro}
11378 %
11379 % \begin{macro}{\measuretcell}
11380 % Measure (recursively) the width required for a text cell. (was |\messentext|)
11381 % \begin{macrocode}
11382 \def\measuretcell #1&{%
11383 \ifx #1\\ \ifnum\l@dcolcount=0\let\NEXT\relax%
11384 \else\l@dcheckcols%
11385 \l@dcolcount=0%
11386 \let\NEXT\measuretcell%
11387 \fi%
11388 \else\setbox\hilfsbox=\hbox{#1}%
11389 \stepl@dcolcount%
11390 \l@dsetmaxcolwidth%
11391 \let\NEXT\measuretcell%
11392 \fi\NEXT}
11393
11394 % \end{macrocode}
11395 % \end{macro}
11396 %
11397 % \begin{macro}{\measuremrow}
11398 % Measure (recursively) the width required for a math row. (was |\Messen|)
11399 % \begin{macrocode}
11400 \def\measuremrow #1\\{%
11401 \ifx #1&\let\NEXT\relax%
11402 \else\measuremcell #1&\\&\\&%
11403 \let\NEXT\measuremrow%
11404 \fi\NEXT}
11405 % \end{macrocode}
11406 % \end{macro}
11407 %
11408 % \begin{macro}{\measuretrow}
11409 % Measure (recursively) the width required for a text row. (was |\Messentext|)
11410 % \begin{macrocode}
11411 \def\measuretrow #1\\{%
11412 \ifx #1&\let\NEXT\relax%
11413 \else\measuretcell #1&\\&\\&%
11414 \let\NEXT\measuretrow%
11415 \fi\NEXT}
11416
11417 % \end{macrocode}
11418 % \end{macro}
11419 %
11420 % \begin{macro}{\edtabcolsep}
11421 % The length |\edtabcolsep| controls the distance between columns.
11422 % (was |\abstand|)
11423 % \begin{macrocode}
11424 \newskip\edtabcolsep
11425 \global\edtabcolsep=10pt
11426
11427 % \end{macrocode}
11428 % \end{macro}
11429 %
11430 % \begin{macro}{\NEXT}
11431 % \begin{macro}{\Next}
11432 % \begin{macrocode}
11433 \let\NEXT\relax
11434 \let\Next=\next
11435 % \end{macrocode}
11436 % \end{macro}
11437 % \end{macro}
11438 %
11439 % \begin{macro}{\variab}
11440 % \begin{macrocode}
11441 \newcommand{\variab}{\relax}
11442
11443 % \end{macrocode}
11444 % \end{macro}
11445 %
11446 % \begin{macro}{\l@dcheckcols}
11447 % Check that the number of columns is consistent. (was |\tabfehlermeldung|)
11448 % \begin{macrocode}
11449 \newcommand*{\l@dcheckcols}{%
11450 \ifnum\l@dcolcount=1\relax
11451 \else
11452 \ifnum\l@dampcount=1\relax
11453 \else
11454 \ifnum\l@dcolcount=\l@dampcount\relax
11455 \else
11456 \l@d@err@UnequalColumns
11457 \fi
11458 \fi
11459 \l@dampcount=\l@dcolcount
11460 \fi}
11461
11462 % \end{macrocode}
11463 % \end{macro}
11464 %
11465 % \begin{macro}{\l@dmodforcritext}
11466 % \begin{macro}{\l@drestoreforcritext}
11467 % Modify and restore various macros for when |\critext| is used.
11468 % \begin{macrocode}
11469 \newcommand{\l@dmodforcritext}{%
11470 \let\critext\relax%
11471 \let\Afootnote\l@dgobbledarg%
11472 \let\Bfootnote\l@dgobbledarg%
11473 \let\Cfootnote\l@dgobbledarg%
11474 \let\Dfootnote\l@dgobbledarg%
11475 \let\Efootnote\l@dgobbledarg%
11476 \let\edindex\nulledindex%
11477 \let\linenum\@gobble}
11478 \newcommand{\l@drestoreforcritext}{%
11479 \def\Afootnote##1##2/{\A@@footnote{##1}{##2}}%
11480 \def\Bfootnote##1##2/{\B@@footnote{##1}{##2}}%
11481 \def\Cfootnote##1##2/{\C@@footnote{##1}{##2}}%
11482 \def\Dfootnote##1##2/{\D@@footnote{##1}{##2}}%
11483 \def\Efootnote##1##2/{\E@@footnote{##1}{##2}}%
11484 \let\edindex\xedindex}
11485
11486 % \end{macrocode}
11487 % \end{macro}
11488 % \end{macro}
11489 %
11490 % \begin{macro}{\l@dmodforedtext}
11491 % \begin{macro}{\l@drestoreforedtext}
11492 % Modify and restore various macros for when |\edtext| is used.
11493 % \begin{macrocode}
11494 \newcommand{\l@dmodforedtext}{%
11495 \let\edtext\relax
11496 \let\Afootnote\l@dgobblearg
11497 \let\Bfootnote\l@dgobblearg
11498 \let\Cfootnote\l@dgobblearg
11499 \let\Dfootnote\l@dgobblearg
11500 \let\Efootnote\l@dgobblearg
11501 \let\edindex\nulledindex
11502 \let\linenum\@gobble}
11503 \newcommand{\l@drestoreforedtext}{%
11504 \def\Afootnote##1{\A@@footnote{##1}}%
11505 \def\Bfootnote##1{\B@@footnote{##1}}%
11506 \def\Cfootnote##1{\C@@footnote{##1}}%
11507 \def\Dfootnote##1{\D@@footnote{##1}}%
11508 \def\Efootnote##1{\E@@footnote{##1}}%
11509 \let\edindex\xedindex}
11510
11511 % \end{macrocode}
11512 % \end{macro}
11513 % \end{macro}
11514 %
11515 % \begin{macro}{\l@dnullfills}
11516 % \begin{macro}{\l@drestorefills}
11517 % Nullify and restore some column fillers, etc.
11518 % \begin{macrocode}
11519 \newcommand{\l@dnullfills}{%
11520 \def\edlabel##1{}%
11521 \def\edrowfill##1##2##3{}%
11522 }
11523 \newcommand{\l@drestorefills}{%
11524 \def\edrowfill##1##2##3{\@EDROWFILL@{##1}{##2}{##3}}%
11525 }
11526
11527 % \end{macrocode}
11528 % \end{macro}
11529 % \end{macro}
11530 %
11531 %
11532 %
11533 % The original definition of |\rverteilen| and friends
11534 % (`verteilen' is approximately `distribute') was along the lines:
11535 % \begin{verbatim}
11536 % \def\rverteilen #1&{\def\label##1{}%
11537 % \ifx #1! \ifnum\l@dcolcount=0%\removelastskip
11538 % \let\Next\relax%
11539 % \else\l@dcolcount=0%
11540 % \let\Next=\rverteilen%
11541 % \fi%
11542 % \else%
11543 % \footnoteverschw%
11544 % \stepl@dcolcount%
11545 % \setbox\hilfsbox=\hbox{$\displaystyle{#1}$}%
11546 % \let\critext=\xcritext\let\Dfootnote=\D@@footnote
11547 % \let\Afootnote=\A@@footnote\let\Bfootnote=\B@@footnote
11548 % \let\Cfootnote=\C@@footnote\let\linenum=\@line@@num%
11549 % \hilfsskip=\Dimenzuordnung%
11550 % \advance\hilfsskip by -\wd\hilfsbox
11551 % \def\label##1{\xlabel{##1}}%
11552 % \hskip\hilfsskip$\displaystyle{#1}$%
11553 % \hskip\edtabcolsep%
11554 % \let\Next=\rverteilen%
11555 % \fi\Next}
11556 % \end{verbatim}
11557 % where the lines
11558 % \begin{verbatim}
11559 % \let\critext=\xcritext\let\Dfootnote=\D@@footnote
11560 % \let\Afootnote=\A@@footnote\let\Bfootnote=\B@@footnote
11561 % \let\Cfootnote=\C@@footnote\let\linenum=\@line@@num%
11562 % \hilfsskip=\Dimenzuordnung%
11563 % \advance\hilfsskip by -\wd\hilfsbox
11564 % \def\label##1{\xlabel{##1}}%
11565 % \end{verbatim}
11566 % were common across the several |*verteilen*| macros, and also
11567 % \begin{verbatim}
11568 % \def\footnoteverschw{%
11569 % \let\critext\relax
11570 % \let\Afootnote=\verschwinden
11571 % \let\Bfootnote=\verschwinden
11572 % \let\Cfootnote=\verschwinden
11573 % \let\Dfootnote=\verschwinden
11574 % \let\linenum=\@gobble}
11575 % \end{verbatim}
11576 %
11577 % \begin{macro}{\letsforverteilen}
11578 % Gathers some lets and other code that is common to the |*verteilen*| macros.
11579 % \begin{macrocode}
11580 \newcommand{\letsforverteilen}{%
11581 \let\critext\xcritext
11582 \let\edtext\xedtext
11583 \let\edindex\xedindex
11584 \let\Afootnote\A@@footnote
11585 \let\Bfootnote\B@@footnote
11586 \let\Cfootnote\C@@footnote
11587 \let\Dfootnote\D@@footnote
11588 \let\Efootnote\E@@footnote
11589 \let\linenum\@line@@num
11590 \hilfsskip=\l@dcolwidth%
11591 \advance\hilfsskip by -\wd\hilfsbox
11592 \def\edlabel##1{\xedlabel{##1}}}
11593
11594 % \end{macrocode}
11595 % \end{macro}
11596 %
11597 % \begin{macro}{\setmcellright}
11598 % Typeset (recursively) cells of display math right justified. (was |\rverteilen|)
11599 % \begin{macrocode}
11600 \def\setmcellright #1&{\def\edlabel##1{}%
11601 \let\edindex\nulledindex
11602 \ifx #1\\ \ifnum\l@dcolcount=0%\removelastskip
11603 \let\Next\relax%
11604 \else\l@dcolcount=0%
11605 \let\Next=\setmcellright%
11606 \fi%
11607 \else%
11608 \disablel@dtabfeet%
11609 \stepl@dcolcount%
11610 \setbox\hilfsbox=\hbox{$\displaystyle{#1}$}%
11611 \letsforverteilen%
11612 \hskip\hilfsskip$\displaystyle{#1}$%
11613 \hskip\edtabcolsep%
11614 \let\Next=\setmcellright%
11615 \fi\Next}
11616
11617 % \end{macrocode}
11618 % \end{macro}
11619 %
11620 % \begin{macro}{\settcellright}
11621 % Typeset (recursively) cells of text right justified. (was |\rverteilentext|)
11622 % \begin{macrocode}
11623 \def\settcellright #1&{\def\edlabel##1{}%
11624 \let\edindex\nulledindex
11625 \ifx #1\\ \ifnum\l@dcolcount=0%\removelastskip
11626 \let\Next\relax%
11627 \else\l@dcolcount=0%
11628 \let\Next=\settcellright%
11629 \fi%
11630 \else%
11631 \disablel@dtabfeet%
11632 \stepl@dcolcount%
11633 \setbox\hilfsbox=\hbox{#1}%
11634 \letsforverteilen%
11635 \hskip\hilfsskip#1%
11636 \hskip\edtabcolsep%
11637 \let\Next=\settcellright%
11638 \fi\Next}
11639 % \end{macrocode}
11640 % \end{macro}
11641 %
11642 % \begin{macro}{\setmcellleft}
11643 % Typeset (recursively) cells of display math left justified. (was |\lverteilen|)
11644 % \begin{macrocode}
11645 \def\setmcellleft #1&{\def\edlabel##1{}%
11646 \let\edindex\nulledindex
11647 \ifx #1\\ \ifnum\l@dcolcount=0 \let\Next\relax%
11648 \else\l@dcolcount=0%
11649 \let\Next=\setmcellleft%
11650 \fi%
11651 \else \disablel@dtabfeet%
11652 \stepl@dcolcount%
11653 \setbox\hilfsbox=\hbox{$\displaystyle{#1}$}%
11654 \letsforverteilen
11655 $\displaystyle{#1}$\hskip\hilfsskip\hskip\edtabcolsep%
11656 \let\Next=\setmcellleft%
11657 \fi\Next}
11658
11659 % \end{macrocode}
11660 % \end{macro}
11661 %
11662 % \begin{macro}{\settcellleft}
11663 % Typeset (recursively) cells of text left justified. (was |\lverteilentext|)
11664 % \begin{macrocode}
11665 \def\settcellleft #1&{\def\edlabel##1{}%
11666 \let\edindex\nulledindex
11667 \ifx #1\\ \ifnum\l@dcolcount=0 \let\Next\relax%
11668 \else\l@dcolcount=0%
11669 \let\Next=\settcellleft%
11670 \fi%
11671 \else \disablel@dtabfeet%
11672 \stepl@dcolcount%
11673 \setbox\hilfsbox=\hbox{#1}%
11674 \letsforverteilen
11675 #1\hskip\hilfsskip\hskip\edtabcolsep%
11676 \let\Next=\settcellleft%
11677 \fi\Next}
11678 % \end{macrocode}
11679 % \end{macro}
11680 %
11681 % \begin{macro}{\setmcellcenter}
11682 % Typeset (recursively) cells of display math centered. (was |\zverteilen|)
11683 % \begin{macrocode}
11684 \def\setmcellcenter #1&{\def\edlabel##1{}%
11685 \let\edindex\nulledindex
11686 \ifx #1\\ \ifnum\l@dcolcount=0\let\Next\relax%
11687 \else\l@dcolcount=0%
11688 \let\Next=\setmcellcenter%
11689 \fi%
11690 \else \disablel@dtabfeet%
11691 \stepl@dcolcount%
11692 \setbox\hilfsbox=\hbox{$\displaystyle{#1}$}%
11693 \letsforverteilen%
11694 \hskip 0.5\hilfsskip$\displaystyle{#1}$\hskip0.5\hilfsskip%
11695 \hskip\edtabcolsep%
11696 \let\Next=\setmcellcenter%
11697 \fi\Next}
11698
11699 % \end{macrocode}
11700 % \end{macro}
11701 %
11702 % \begin{macro}{\settcellcenter}
11703 % Typeset (recursively) cells of text centered. (new)
11704 % \begin{macrocode}
11705 \def\settcellcenter #1&{\def\edlabel##1{}%
11706 \let\edindex\nulledindex
11707 \ifx #1\\ \ifnum\l@dcolcount=0 \let\Next\relax%
11708 \else\l@dcolcount=0%
11709 \let\Next=\settcellcenter%
11710 \fi%
11711 \else \disablel@dtabfeet%
11712 \stepl@dcolcount%
11713 \setbox\hilfsbox=\hbox{#1}%
11714 \letsforverteilen%
11715 \hskip 0.5\hilfsskip #1\hskip 0.5\hilfsskip%
11716 \hskip\edtabcolsep%
11717 \let\Next=\settcellcenter%
11718 \fi\Next}
11719
11720 % \end{macrocode}
11721 % \end{macro}
11722 %
11723 % \begin{macro}{\NEXT}
11724 % \begin{macrocode}
11725 \let\NEXT=\relax
11726
11727 % \end{macrocode}
11728 % \end{macro}
11729 %
11730 % \begin{macro}{\setmrowright}
11731 % Typeset (recursively) rows of right justified math. (was |\rsetzen|)
11732 % \begin{macrocode}
11733 \def\setmrowright #1\\{%
11734 \ifx #1& \let\NEXT\relax
11735 \else \centerline{\setmcellright #1&\\&\\&}
11736 \let\NEXT=\setmrowright
11737 \fi\NEXT}
11738 % \end{macrocode}
11739 % \end{macro}
11740 %
11741 % \begin{macro}{\settrowright}
11742 % Typeset (recursively) rows of right justified text. (was |\rsetzentext|)
11743 % \begin{macrocode}
11744 \def\settrowright #1\\{%
11745 \ifx #1& \let\NEXT\relax
11746 \else \centerline{\settcellright #1&\\&\\&}
11747 \let\NEXT=\settrowright
11748 \fi\NEXT}
11749
11750 % \end{macrocode}
11751 % \end{macro}
11752 %
11753 % \begin{macro}{\setmrowleft}
11754 % Typeset (recursively) rows of left justified math. (was |\lsetzen|)
11755 % \begin{macrocode}
11756 \def\setmrowleft #1\\{%
11757 \ifx #1&\let\NEXT\relax
11758 \else \centerline{\setmcellleft #1&\\&\\&}
11759 \let\NEXT=\setmrowleft
11760 \fi\NEXT}
11761 % \end{macrocode}
11762 % \end{macro}
11763 %
11764 % \begin{macro}{\settrowleft}
11765 % Typeset (recursively) rows of left justified text. (was |\lsetzentext|)
11766 % \begin{macrocode}
11767 \def\settrowleft #1\\{%
11768 \ifx #1& \let\NEXT\relax
11769 \else \centerline{\settcellleft #1&\\&\\&}
11770 \let\NEXT=\settrowleft
11771 \fi\NEXT}
11772
11773 % \end{macrocode}
11774 % \end{macro}
11775 %
11776 % \begin{macro}{\setmrowcenter}
11777 % Typeset (recursively) rows of centered math. (was |\zsetzen|)
11778 % \begin{macrocode}
11779 \def\setmrowcenter #1\\{%
11780 \ifx #1& \let\NEXT\relax%
11781 \else \centerline{\setmcellcenter #1&\\&\\&}
11782 \let\NEXT=\setmrowcenter
11783 \fi\NEXT}
11784 % \end{macrocode}
11785 % \end{macro}
11786 %
11787 % \begin{macro}{\settrowcenter}
11788 % Typeset (recursively) rows of centered text. (new)
11789 % \begin{macrocode}
11790 \def\settrowcenter #1\\{%
11791 \ifx #1& \let\NEXT\relax
11792 \else \centerline{\settcellcenter #1&\\&\\&}
11793 \let\NEXT=\settrowcenter
11794 \fi\NEXT}
11795
11796 % \end{macrocode}
11797 % \end{macro}
11798 %
11799 % \begin{macro}{\nullsetzen}
11800 % (was |\nullsetzen|)
11801 % \begin{macrocode}
11802 \newcommand{\nullsetzen}{%
11803 \stepl@dcolcount%
11804 \l@dcolwidth=0pt%
11805 \ifnum\l@dcolcount=30\let\NEXT\relax%
11806 \l@dcolcount=0\relax
11807 \else\let\NEXT\nullsetzen%
11808 \fi\NEXT}
11809
11810 % \end{macrocode}
11811 % \end{macro}
11812 %
11813 % \begin{macro}{\edatleft}
11814 % |\edatleft|\oarg{math}\marg{symbol}\marg{len} (combination and
11815 % generalisation of original |\Seklam| and |\Seklamgl|).
11816 % Left \meta{symbol}, 2\meta{len} high with prepended \meta{math} vertically centered.
11817 % \begin{macrocode}
11818 \newcommand{\edatleft}[3][\@empty]{%
11819 \ifx#1\@empty
11820 \vbox to 10pt{\vss\hbox{$\left#2\vrule width0pt height #3
11821 depth 0pt \right. $\hss}\vfil}
11822 \else
11823 \vbox to 4pt{\vss\hbox{$#1\left#2\vrule width0pt height #3
11824 depth 0pt \right. $}\vfil}
11825 \fi}
11826 % \end{macrocode}
11827 % \end{macro}
11828 %
11829 %
11830 % \begin{macro}{\edatright}
11831 % |\edatright|\oarg{math}\marg{symbol}\marg{len} (combination and
11832 % generalisation of original |\seklam| and |\seklamgl|).
11833 % Right \meta{symbol}, 2\meta{len} high with appended \meta{math} vertically centered.
11834 % \begin{macrocode}
11835 \newcommand{\edatright}[3][\@empty]{%
11836 \ifx#1\@empty
11837 \vbox to 10pt{\vss\hbox{$\left.\vrule width0pt height #3
11838 depth 0pt \right#2 $\hss}\vfil}
11839 \else
11840 \vbox to 4pt{\vss\hbox{$\left.\vrule width0pt height #3
11841 depth 0pt \right#2 #1 $}\vfil}
11842 \fi}
11843
11844 % \end{macrocode}
11845 % \end{macro}
11846 %
11847 %
11848 % \begin{macro}{\edvertline}
11849 % |\edvertline|\marg{len} vertical line \meta{len} high. (was |\sestrich|)
11850 % \begin{macrocode}
11851 \newcommand{\edvertline}[1]{\vbox to 8pt{\vss\hbox{\vrule height #1}\vfil}}
11852
11853 % \end{macrocode}
11854 % \end{macro}
11855 %
11856 % \begin{macro}{\edvertdots}
11857 % |\edvertdots|\marg{len} vertical dotted line \meta{len} high. (was |\sepunkte|)
11858 % \begin{macrocode}
11859 \newcommand{\edvertdots}[1]{\vbox to 1pt{\vss\vbox to #1%
11860 {\cleaders\hbox{$\m@th\hbox{.}\vbox to 0.5em{ }$}\vfil}}}
11861
11862 % \end{macrocode}
11863 % \end{macro}
11864 %
11865 % I don't know if this is relevant here, and I haven't tried it,
11866 % but the following appeared on CTT.
11867 % \begin{verbatim}
11868 % From: [email protected] (Mark Wooding)
11869 % Newsgroups: comp.text.tex
11870 % Subject: Re: Dotted line
11871 % Date: 13 Aug 2003 13:51:14 GMT
11872 %
11873 % Alexis Eisenhofer <[email protected]> wrote:
11874 % > Can anyone provide me with the LaTex command for a vertical dotted line?
11875 %
11876 % How dotted? Here's the basic rune.
11877 % \newbox\linedotbox
11878 % \setbox\linedotbox=\vbox{...}
11879 % \leaders\copy\linedotbox\vskip2in
11880 %
11881 % For just dots, this works:
11882 % \setbox\linedotbox=\vbox{\hbox{\normalfont.}\kern2pt}
11883 %
11884 % For dashes, something like
11885 % \setbox\linedotbox=\vbox{\leaders\vrule\vskip2pt\vskip2pt}
11886 % is what you want. (Adjust the `2pt' values to taste. The first one is
11887 % the length of the dashes, the second is the length of the gaps.)
11888 %
11889 % For dots in mid-paragraph, you need to say something like
11890 % \lower10pt\vbox{\leaders\copy\linedotbox\vskip2in}
11891 % which is scungy but works.
11892 %
11893 % -- [mdw]
11894 % \end{verbatim}
11895 %
11896 % \begin{macro}{\edfilldimen}
11897 % A length. (was |\klamdimen|)
11898 % \begin{macrocode}
11899 \newdimen\edfilldimen
11900 \edfilldimen=0pt
11901
11902 % \end{macrocode}
11903 % \end{macro}
11904 %
11905 % \begin{macro}{\c@addcolcount}
11906 % \begin{macro}{\theaddcolcount}
11907 % A counter to hold the number of a column. We use a roman number so
11908 % that we can grab the column dimension from |\dcol...|.
11909 % \begin{macrocode}
11910 \newcounter{addcolcount}
11911 \renewcommand{\theaddcolcount}{\roman{addcolcount}}
11912 % \end{macrocode}
11913 % \end{macro}
11914 % \end{macro}
11915 %
11916 % \begin{macro}{\l@dtabaddcols}
11917 % |\l@dtabaddcols|\marg{startcol}\marg{endcol} adds the widths of
11918 % the columns \meta{startcol} through \meta{endcol} to |\edfilldimen|.
11919 % It is a LaTeX style
11920 % reimplementation of the original |\@add@|.
11921 % \begin{macrocode}
11922 \newcommand{\l@dtabaddcols}[2]{%
11923 \l@dcheckstartend{#1}{#2}%
11924 \ifl@dstartendok
11925 \setcounter{addcolcount}{#1}%
11926 \@whilenum \value{addcolcount}<#2\relax \do
11927 {\advance\edfilldimen by \the \csname dcol\theaddcolcount\endcsname
11928 \advance\edfilldimen by \edtabcolsep
11929 \stepcounter{addcolcount}}%
11930 \advance\edfilldimen by \the \csname dcol\theaddcolcount\endcsname
11931 \fi
11932 }
11933
11934 % \end{macrocode}
11935 % \end{macro}
11936 %
11937 % \begin{macro}{\ifl@dstartendok}
11938 % \begin{macro}{\l@dcheckstartend}
11939 % |\l@dcheckstartend|\marg{startcol}\marg{endcol} checks that the values
11940 % of \meta{startcol} and \meta{endcol} are sensible. If they are then
11941 % |\ifl@dstartendok| is set TRUE, otherwise it is set FALSE.
11942 % \begin{macrocode}
11943 \newif\ifl@dstartendok
11944 \newcommand{\l@dcheckstartend}[2]{%
11945 \l@dstartendoktrue
11946 \ifnum #1<\@ne
11947 \l@dstartendokfalse
11948 \led@err@LowStartColumn
11949 \fi
11950 \ifnum #2>30\relax
11951 \l@dstartendokfalse
11952 \led@err@HighEndColumn
11953 \fi
11954 \ifnum #1>#2\relax
11955 \l@dstartendokfalse
11956 \led@err@ReverseColumns
11957 %%% \ledmac@error{Start column is greater than end column}{\@ehc}%
11958 \fi
11959 }
11960
11961 % \end{macrocode}
11962 % \end{macro}
11963 % \end{macro}
11964 %
11965 % \begin{macro}{\edrowfill}
11966 % \begin{macro}{\@edrowfill@}
11967 % \begin{macro}{\@EDROWFILL@}
11968 % |\edrowfill|\marg{startcol}\marg{endcol}{fill}
11969 % fills columns \meta{startcol} to \meta{endcol} inclusive with
11970 % \meta{fill} (e.g. |\hrulefill|, |\upbracefill|).
11971 % This is a LaTex style reimplementation and generalization of the
11972 % original |\waklam|, |\Waklam|, |\waklamec|, |\wastricht|
11973 % and |\wapunktel| macros.
11974 % \begin{macrocode}
11975 \newcommand*{\edrowfill}[3]{%
11976 \l@dtabaddcols{#1}{#2}%
11977 \hb@xt@ \the\l@dcolwidth{\hb@xt@ \the\edfilldimen{#3}\hss}}
11978 \let\@edrowfill@=\edrowfill
11979 \def\@EDROWFILL@#1#2#3{\@edrowfill@{#1}{#2}{#3}}
11980
11981 % \end{macrocode}
11982 % \end{macro}
11983 % \end{macro}
11984 % \end{macro}
11985 %
11986 %
11987 % \DescribeMacro{\edbeforetab}
11988 % \DescribeMacro{\edaftertab}
11989 % The macro |\edbeforetab|\marg{text}\marg{math} puts \meta{text} at
11990 % the left margin before array cell entry \meta{math}. Conversely,
11991 % the macro |\edaftertab|\marg{math}\marg{text} puts \meta{text}
11992 % at the right margin after array cell entry \meta{math}.
11993 % |\edbeforetab| should be in the first column and |\edaftertab| in the
11994 % last column.
11995 % The following macros support these.
11996 %
11997 % \begin{macro}{\leftltab}
11998 % |\leftltab|\marg{text} for |\edbeforetab| in |\ltab|. (was |\linksltab|)
11999 % \begin{macrocode}
12000 \newcommand{\leftltab}[1]{%
12001 \hb@xt@\z@{\vbox{\edtabindent%
12002 \moveleft\Hilfsskip\hbox{\ #1}}\hss}}
12003
12004 % \end{macrocode}
12005 % \end{macro}
12006 %
12007 % \begin{macro}{\leftrtab}
12008 % |\leftrtab|\marg{text}\marg{math} for |\edbeforetab| in |\rtab|. (was |\linksrtab|)
12009 % \begin{macrocode}
12010 \newcommand{\leftrtab}[2]{%
12011 #2\hb@xt@\z@{\vbox{\edtabindent%
12012 \advance\Hilfsskip by\dcoli%
12013 \moveleft\Hilfsskip\hbox{\ #1}}\hss}}
12014
12015 % \end{macrocode}
12016 % \end{macro}
12017 %
12018 % \begin{macro}{\leftctab}
12019 % |\leftctab|\marg{text}\marg{math} for |\edbeforetab| in |\ctab|. (was |\linksztab|)
12020 % \begin{macrocode}
12021 \newcommand{\leftctab}[2]{%
12022 \hb@xt@\z@{\vbox{\edtabindent\l@dcolcount=\l@dampcount%
12023 \advance\Hilfsskip by 0.5\dcoli%
12024 \setbox\hilfsbox=\hbox{\def\edlabel##1{}%
12025 \disablel@dtabfeet$\displaystyle{#2}$}%
12026 \advance\Hilfsskip by -0.5\wd\hilfsbox%
12027 \moveleft\Hilfsskip\hbox{\ #1}}\hss}%
12028 #2}
12029
12030 % \end{macrocode}
12031 % \end{macro}
12032 %
12033 % \begin{macro}{\rightctab}
12034 % |\rightctab|\marg{math}\marg{text} for |\edaftertab| in |\ctab|. (was |\rechtsztab|)
12035 % \begin{macrocode}
12036 \newcommand{\rightctab}[2]{%
12037 \setbox\hilfsbox=\hbox{\def\edlabel##1{}%
12038 \disablel@dtabfeet#2}\l@dampcount=\l@dcolcount%
12039 #1\hb@xt@\z@{\vbox{\edtabindent\l@dcolcount=\l@dampcount%
12040 \advance\Hilfsskip by 0.5\l@dcolwidth%
12041 \advance\Hilfsskip by -\wd\hilfsbox%
12042 \setbox\hilfsbox=\hbox{\def\edlabel##1{}%
12043 \disablel@dtabfeet$\displaystyle{#1}$}%
12044 \advance\Hilfsskip by -0.5\wd\hilfsbox%
12045 \advance\Hilfsskip by \edtabcolsep%
12046 \moveright\Hilfsskip\hbox{ #2}}\hss}%
12047 }
12048
12049 % \end{macrocode}
12050 % \end{macro}
12051 %
12052 % \begin{macro}{\rightltab}
12053 % |\rightltab|\marg{math}\marg{text} for |\edaftertab| in |\ltab|. (was |\rechtsltab|)
12054 % \begin{macrocode}
12055 \newcommand{\rightltab}[2]{%
12056 \setbox\hilfsbox=\hbox{\def\edlabel##1{}%
12057 \disablel@dtabfeet#2}\l@dampcount=\l@dcolcount%
12058 #1\hb@xt@\z@{\vbox{\edtabindent\l@dcolcount=\l@dampcount%
12059 \advance\Hilfsskip by\l@dcolwidth%
12060 \advance\Hilfsskip by-\wd\hilfsbox%
12061 \setbox\hilfsbox=\hbox{\def\edlabel##1{}%
12062 \disablel@dtabfeet$\displaystyle{#1}$}%
12063 \advance\Hilfsskip by-\wd\hilfsbox%
12064 \advance\Hilfsskip by\edtabcolsep%
12065 \moveright\Hilfsskip\hbox{ #2}}\hss}%
12066 }
12067
12068 % \end{macrocode}
12069 % \end{macro}
12070 %
12071 % \begin{macro}{\rightrtab}
12072 % |\rightrtab|\marg{math}\marg{text} for |\edaftertab| in |\rtab|. (was |\rechtsrtab|)
12073 % \begin{macrocode}
12074 \newcommand{\rightrtab}[2]{%
12075 \setbox\hilfsbox=\hbox{\def\edlabel##1{}%
12076 \disablel@dtabfeet#2}%
12077 #1\hb@xt@\z@{\vbox{\edtabindent%
12078 \advance\Hilfsskip by-\wd\hilfsbox%
12079 \advance\Hilfsskip by\edtabcolsep%
12080 \moveright\Hilfsskip\hbox{ #2}}\hss}%
12081 }
12082
12083 % \end{macrocode}
12084 % \end{macro}
12085 %
12086 % \begin{macro}{\rtab}
12087 % \begin{macro}{\edbeforetab}
12088 % \begin{macro}{\edaftertab}
12089 % |\rtab|\marg{body} typesets \meta{body} as an array with the
12090 % entries right justified. (was |\rtab|)
12091 % (Here and elsewhere,
12092 % |\edbeforetab| and |\edaftertab| were originally |\davor| and |\danach|)
12093 % The original |\rtab| and friends included a fair bit of common code
12094 % which I have extracted into macros.
12095 %
12096 % The process is first to measure the \meta{body} to get the column
12097 % widths, and then in a second pass to typeset the body.
12098 % \begin{macrocode}
12099 \newcommand{\rtab}[1]{%
12100 \l@dnullfills
12101 \def\edbeforetab##1##2{\leftrtab{##1}{##2}}%
12102 \def\edaftertab##1##2{\rightrtab{##1}{##2}}%
12103 \measurembody{#1}%
12104 \l@drestorefills
12105 \variab
12106 \setmrowright #1\\&\\%
12107 \enablel@dtabfeet}
12108
12109 % \end{macrocode}
12110 % \end{macro}
12111 % \end{macro}
12112 % \end{macro}
12113 %
12114 % \begin{macro}{\measurembody}
12115 % |\measurembody|\marg{body} measures the array \meta{body}.
12116 % \begin{macrocode}
12117 \newcommand{\measurembody}[1]{%
12118 \disablel@dtabfeet%
12119 \l@dcolcount=0%
12120 \nullsetzen%
12121 \l@dcolcount=0
12122 \measuremrow #1\\&\\%
12123 \global\l@dampcount=1}
12124
12125 % \end{macrocode}
12126 % \end{macro}
12127 %
12128 % \begin{macro}{\rtabtext}
12129 % |\rtabtext|\marg{body} typesets \meta{body} as a tabular with the
12130 % entries right justified. (was |\rtabtext|)
12131 % \begin{macrocode}
12132 \newcommand{\rtabtext}[1]{%
12133 \l@dnullfills
12134 \measuretbody{#1}%
12135 \l@drestorefills
12136 \variab
12137 \settrowright #1\\&\\%
12138 \enablel@dtabfeet}
12139
12140 % \end{macrocode}
12141 % \end{macro}
12142 %
12143 % \begin{macro}{\measuretbody}
12144 % |\measuretbody|\marg{body} measures the tabular \meta{body}.
12145 % \begin{macrocode}
12146 \newcommand{\measuretbody}[1]{%
12147 \disablel@dtabfeet%
12148 \l@dcolcount=0%
12149 \nullsetzen%
12150 \l@dcolcount=0
12151 \measuretrow #1\\&\\%
12152 \global\l@dampcount=1}
12153
12154 % \end{macrocode}
12155 % \end{macro}
12156 %
12157 % \begin{macro}{\ltab}
12158 % \begin{macro}{\edbeforetab}
12159 % \begin{macro}{\edaftertab}
12160 % Array with entries left justified. (was |\ltab|)
12161 % \begin{macrocode}
12162 \newcommand{\ltab}[1]{%
12163 \l@dnullfills
12164 \def\edbeforetab##1##2{\leftltab{##1}{##2}}%
12165 \def\edaftertab##1##2{\rightltab{##1}{##2}}%
12166 \measurembody{#1}%
12167 \l@drestorefills
12168 \variab
12169 \setmrowleft #1\\&\\%
12170 \enablel@dtabfeet}
12171
12172 % \end{macrocode}
12173 % \end{macro}
12174 % \end{macro}
12175 % \end{macro}
12176 %
12177 % \begin{macro}{\ltabtext}
12178 % Tabular with entries left justified. (was |\ltabtext|)
12179 % \begin{macrocode}
12180 \newcommand{\ltabtext}[1]{%
12181 \l@dnullfills
12182 \measuretbody{#1}%
12183 \l@drestorefills
12184 \variab
12185 \settrowleft #1\\&\\%
12186 \enablel@dtabfeet}
12187
12188 % \end{macrocode}
12189 % \end{macro}
12190 %
12191 % \begin{macro}{\ctab}
12192 % \begin{macro}{\edbeforetab}
12193 % \begin{macro}{\edaftertab}
12194 % Array with centered entries. (was |\ztab|)
12195 % \begin{macrocode}
12196 \newcommand{\ctab}[1]{%
12197 \l@dnullfills
12198 \def\edbeforetab##1##2{\leftctab{##1}{##2}}%
12199 \def\edaftertab##1##2{\rightctab{##1}{##2}}%
12200 \measurembody{#1}%
12201 \l@drestorefills
12202 \variab
12203 \setmrowcenter #1\\&\\%
12204 \enablel@dtabfeet}
12205
12206 % \end{macrocode}
12207 % \end{macro}
12208 % \end{macro}
12209 % \end{macro}
12210 %
12211 % \begin{macro}{\ctabtext}
12212 % Tabular with entries centered. (new)
12213 % \begin{macrocode}
12214 \newcommand{\ctabtext}[1]{%
12215 \l@dnullfills
12216 \measuretbody{#1}%
12217 \l@drestorefills
12218 \variab
12219 \settrowcenter #1\\&\\%
12220 \enablel@dtabfeet}
12221
12222 % \end{macrocode}
12223 % \end{macro}
12224 %
12225 % \begin{macro}{\spreadtext}
12226 % (was |\breitertext|)
12227 % \begin{macrocode}
12228 \newcommand{\spreadtext}[1]{%\l@dcolcount=\l@dampcount%
12229 \hb@xt@ \the\l@dcolwidth{\hbox{#1}\hss}}
12230 % \end{macrocode}
12231 % \end{macro}
12232 %
12233 % \begin{macro}{\spreadmath}
12234 % (was |\breiter|, `breiter' = `broadly')
12235 % \begin{macrocode}
12236 \newcommand{\spreadmath}[1]{%
12237 \hb@xt@ \the\l@dcolwidth{\hbox{$\displaystyle{#1}$}\hss}}
12238
12239 % \end{macrocode}
12240 % \end{macro}
12241 %
12242 % I have left the remaining \tabmac{} alone, apart from changing some names.
12243 % I'm not yet sure what they do or how they do it. Authors should not use
12244 % any of these as they are likely to be mutable.
12245 %
12246 % \begin{macro}{\tabellzwischen}
12247 % (was |\tabellzwischen|)
12248 % \begin{macrocode}
12249 \def\tabellzwischen #1&{%
12250 \ifx #1\\ \let\NEXT\relax \l@dcolcount=0
12251 \else \stepl@dcolcount%
12252 \l@dcolwidth = #1 mm
12253 \let\NEXT=\tabellzwischen
12254 \fi \NEXT }
12255
12256 % \end{macrocode}
12257 % \end{macro}
12258 %
12259 % \begin{macro}{\edatabell}
12260 % For example |\edatabell 4 & 19 & 8 \\| specifies 3 columns with widths
12261 % of 4, 19, and 8mm. (was |\atabell|)
12262 % \begin{macrocode}
12263 \def\edatabell #1\\{%
12264 \tabellzwischen #1&\\&}
12265 % \end{macrocode}
12266 % \end{macro}
12267 %
12268 % \begin{macro}{\Setzen}
12269 % (was |\Setzen|, `setzen' = `set')
12270 % \begin{macrocode}
12271 \def\Setzen #1&{%
12272 \ifx #1\relax \let\NEXT=\relax
12273 \else \stepl@dcolcount%
12274 \let\tabelskip=\l@dcolwidth
12275 \EDTAB #1|
12276 \let\NEXT=\Setzen
12277 \fi\NEXT}
12278
12279 % \end{macrocode}
12280 % \end{macro}
12281 %
12282 % \begin{macro}{\EDATAB}
12283 % (was |\ATAB|)
12284 % \begin{macrocode}
12285 \def\EDATAB #1\\{%
12286 \ifx #1\Relax \centerline{\Setzen #1\relax&}
12287 \let\Next\relax
12288 \else \centerline{\Setzen #1&\relax&}
12289 \let\Next=\EDATAB
12290 \fi\Next}
12291 % \end{macrocode}
12292 % \end{macro}
12293 %
12294 % \begin{macro}{\edatab}
12295 % (was |\atab|)
12296 % \begin{macrocode}
12297 \newcommand{\edatab}[1]{%
12298 \variab%
12299 \EDATAB #1\\\Relax\\}
12300
12301 % \end{macrocode}
12302 % \end{macro}
12303 %
12304 % \begin{macro}{\HILFSskip}
12305 % \begin{macro}{\Hilfsskip}
12306 % More helpers.
12307 % \begin{macrocode}
12308 \newskip\HILFSskip
12309 \newskip\Hilfsskip
12310
12311 % \end{macrocode}
12312 % \end{macro}
12313 % \end{macro}
12314 %
12315 % \begin{macro}{\EDTABINDENT}
12316 % (was |\TABINDENT|)
12317 % \begin{macrocode}
12318 \newcommand{\EDTABINDENT}{%
12319 \ifnum\l@dcolcount=30\let\NEXT\relax\l@dcolcount=0%
12320 \else\stepl@dcolcount%
12321 \advance\Hilfsskip by\l@dcolwidth%
12322 \ifdim\l@dcolwidth=0pt\advance\hilfscount\@ne
12323 \else\advance\Hilfsskip by \the\hilfscount\edtabcolsep%
12324 \hilfscount=1\fi%
12325 \let\NEXT=\EDTABINDENT%
12326 \fi\NEXT}%
12327 % \end{macrocode}
12328 % \end{macro}
12329 %
12330 % \begin{macro}{\edtabindent}
12331 % (was |\tabindent|)
12332 % \begin{macrocode}
12333 \newcommand{\edtabindent}{%
12334 \l@dcolcount=0\relax
12335 \Hilfsskip=0pt%
12336 \hilfscount=1\relax
12337 \EDTABINDENT%
12338 \hilfsskip=\hsize%
12339 \advance\hilfsskip -\Hilfsskip%
12340 \Hilfsskip=0.5\hilfsskip%
12341 }%
12342
12343 % \end{macrocode}
12344 % \end{macro}
12345 %
12346 % \begin{macro}{\EDTAB}
12347 % (was |\TAB|)
12348 % \begin{macrocode}
12349 \def\EDTAB #1|#2|{%
12350 \setbox\tabhilfbox=\hbox{$\displaystyle{#1}$}%
12351 \setbox\tabHilfbox=\hbox{$\displaystyle{#2}$}%
12352 \advance\tabelskip -\wd\tabhilfbox%
12353 \advance\tabelskip -\wd\tabHilfbox%
12354 \unhbox\tabhilfbox\hskip\tabelskip%
12355 \unhbox\tabHilfbox}%
12356
12357 % \end{macrocode}
12358 % \end{macro}
12359 %
12360 % \begin{macro}{\EDTABtext}
12361 % (was |\TABtext|)
12362 % \begin{macrocode}
12363 \def\EDTABtext #1|#2|{%
12364 \setbox\tabhilfbox=\hbox{#1}%
12365 \setbox\tabHilfbox=\hbox{#2}%
12366 \advance\tabelskip -\wd\tabhilfbox%
12367 \advance\tabelskip -\wd\tabHilfbox%
12368 \unhbox\tabhilfbox\hskip\tabelskip%
12369 \unhbox\tabHilfbox}%
12370 % \end{macrocode}
12371 % \end{macro}
12372 %
12373 % \begin{macro}{\tabhilfbox}
12374 % \begin{macro}{\tabHilfbox}
12375 % Further helpers.
12376 % \begin{macrocode}
12377 \newbox\tabhilfbox
12378 \newbox\tabHilfbox
12379
12380 % \end{macrocode}
12381 % \end{macro}
12382 % \end{macro}
12383 %
12384 % \begin{verbatim}
12385 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12386 % % That finishes tabmac
12387 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12388 % \end{verbatim}
12389 %
12390 % \begin{environment}{edarrayl}
12391 % \begin{environment}{edarrayc}
12392 % \begin{environment}{edarrayr}
12393 % The `environment' forms for |\ltab|, |\ctab| and |\rtab|.
12394 % \begin{macrocode}
12395 \newenvironment{edarrayl}{\l@dcollect@body\ltab}{}
12396 \newenvironment{edarrayc}{\l@dcollect@body\ctab}{}
12397 \newenvironment{edarrayr}{\l@dcollect@body\rtab}{}
12398
12399 % \end{macrocode}
12400 % \end{environment}
12401 % \end{environment}
12402 % \end{environment}
12403 %
12404 % \begin{environment}{edtabularl}
12405 % \begin{environment}{edtabularc}
12406 % \begin{environment}{edtabularr}
12407 % The `environment' forms for |\ltabtext|, |\ctabtext| and |\rtabtext|.
12408 % \begin{macrocode}
12409 \newenvironment{edtabularl}{\l@dcollect@body\ltabtext}{}
12410 \newenvironment{edtabularc}{\l@dcollect@body\ctabtext}{}
12411 \newenvironment{edtabularr}{\l@dcollect@body\rtabtext}{}
12412
12413 % \end{macrocode}
12414 % \end{environment}
12415 % \end{environment}
12416 % \end{environment}
12417 %
12418 % Here's the code for enabling |\edtext| (instead of |\critext|).
12419 %
12420 % \begin{macro}{\usingcritext}
12421 % \begin{macro}{\disablel@dtabfeet}
12422 % \begin{macro}{\enablel@dtabfeet}
12423 % \begin{macro}{\usingedtext}
12424 % Declarations for using |\critext{}.../| or using |\edtext{}{}| inside
12425 % tabulars.
12426 % The default at this point is for |\edtext|.
12427 % \begin{macrocode}
12428 \newcommand{\usingcritext}{%
12429 \def\disablel@dtabfeet{\l@dmodforcritext}%
12430 \def\enablel@dtabfeet{\l@drestoreforcritext}}
12431 \newcommand{\usingedtext}{%
12432 \def\disablel@dtabfeet{\l@dmodforedtext}%
12433 \def\enablel@dtabfeet{\l@drestoreforedtext}}
12434
12435 \usingedtext
12436
12437 % \end{macrocode}
12438 % \end{macro}
12439 % \end{macro}
12440 % \end{macro}
12441 % \end{macro}
12442 %
12443 % \end{PW}
12444 %
12445 % \section{The End}\label{end}
12446 %
12447
12448 %</code>
12449 %
12450 % \newpage
12451 % \appendix
12452 %
12453 % \section{Examples}\label{examples}
12454 %
12455 %
12456 % \begin{PW}
12457 % This section presents some sample documents.
12458 %
12459 % The examples
12460 % in sections~\ref{example:ledfeat} through \ref{example:ledmixed}, plus
12461 % \ref{example:ledbraonain},
12462 % were originally written for TeX.
12463 % I have done some limited conversions of these so that
12464 % they look more like LaTeX code. In particular wherever possible
12465 % I have replaced \cs{def} commands by either \cs{newcommand} or
12466 % \cs{renewcommand} as appropriate.
12467 % I have also replaced the original TeX font handling commands by the
12468 % LaTeX font commands.
12469 %
12470 % The other examples were written natively in LaTeX.
12471 %
12472 % The figures are from processed versions of the files. Having latexed
12473 % a file I used DVIPS to get Encapsulated PostScript, then the epstopdf
12474 % script to get a PDF version as well, for example: \\
12475 % \begin{verbatim}
12476 % > latex ledeasy
12477 % > latex ledeasy
12478 % > latex ledeasy
12479 % > dvips -E -o ledeasy.eps ledeasy
12480 % > epstopdf ledeasy.eps % produces ledeasy.pdf
12481 % \end{verbatim}
12482 %
12483 % For those who aren't fascinated by LaTeX code, I show the all the
12484 % typeset results first, then the code that produced them.
12485 %
12486 % \end{PW}
12487 %
12488 % \clearpage
12489 %
12490 % \begin{figure}[p]
12491 % \centering
12492 % \includegraphics{ledeasy}
12493 % \caption{Output from \file{ledeasy.tex}.}
12494 % \label{easy-out}
12495 % \end{figure}
12496 %
12497 % \begin{figure}[p]
12498 % \centering
12499 % \includegraphics{ledfeat}
12500 % \caption{Output from \file{ledfeat.tex}.}
12501 % \label{features-out}
12502 % \end{figure}
12503 %
12504 % \begin{figure}[p]
12505 % \centering
12506 % \includegraphics{ledioc}
12507 % \caption{Output from \file{ledioc.tex}.}
12508 % \label{iocasta-out}
12509 % \end{figure}
12510 %
12511 % \begin{figure}[p]
12512 % \centering
12513 % \includegraphics{ledarden}
12514 % \caption{Output from \file{ledarden.tex}.}
12515 % \label{arden-out}
12516 % \end{figure}
12517 %
12518 % \begin{figure}[p]
12519 % \centering
12520 % \hspace*{-2in}\includegraphics{ledmixed}\hspace*{-2in}
12521 % \caption{Output from \texttt{ledmixed.tex}.}
12522 % \label{periphyseon-out}
12523 % \end{figure}
12524 %
12525 % \begin{figure}[p]
12526 % \centering
12527 % \includegraphics{ledekker}
12528 % \caption{Output from \file{ledekker.tex}.}
12529 % \label{ledekker-out}
12530 % \end{figure}
12531 %
12532 % \begin{figure}[p]
12533 % \centering
12534 % \includegraphics{ledbraonain}
12535 % \caption{Output from \file{ledbraonain.tex}.}
12536 % \label{braonain-out}
12537 % \end{figure}
12538 %
12539 %
12540 % \clearpage
12541 %
12542 % \subsection{Simple example}\label{example:ledeasy}
12543 %
12544 % \begin{PW}
12545 % This made-up example, \file{ledeasy.tex}, is included to show how
12546 % simple it can be to use \edmac{} in a LaTeX document.
12547 % The code is given below and the result is shown in Figure~\ref{easy-out}.
12548 %
12549 % \end{PW}
12550 %
12551 % \medskip
12552 % \hrule
12553 % \medskip
12554 % \begin{macrocode}
12555 %<*easy>
12556 % ledeasy.tex simple example of the ledmac package
12557 \documentclass{article}
12558 \usepackage{ledmac}
12559 %% number every line
12560 \setcounter{firstlinenum}{1}
12561 \setcounter{linenumincrement}{1}
12562 %% Show some B series familiar footnotes, lettered and paragraphed
12563 \renewcommand*{\thefootnoteB}{\alph{footnoteB}}
12564 \footparagraphX{B}
12565 %% no endnotes
12566 \noendnotes
12567 %% narrow sidenotes
12568 \setlength{\ledrsnotewidth}{4em}
12569 \title{Simple Example}
12570 \author{Peter Wilson\thanks{Standing on the shoulders of giants.}}
12571 \date{}
12572 \begin{document}
12573 \maketitle
12574 \tableofcontents
12575 \section{First}
12576 This is a simple example of using the \textsf{ledmac}
12577 package with ordinary LaTeX constructs.
12578
12579 \subsection{Example text}\label{subsec}
12580
12581 \beginnumbering
12582 \pstart
12583 The \textsf{ledmac} package lets you do some unusual things in
12584 a LaTeX document. For example you can have lines numbered and
12585 there are
12586 \edtext{several}{\Afootnote{This is an `A' footnote.}}
12587 \edtext{levels}{\Bfootnote{This is a `B' level footnote.}}
12588 of footnotes.
12589 You can label lines within the numbered text and refer to them
12590 outside. Do not try and use any normal LaTeX
12591 marginpars\footnote{You will get a warning but no text.}%
12592 \ledrightnote{Sidenotes are OK}
12593 or \edtext{exotica}{\Afootnote{Like floats.}}
12594 within the numbered portions of the text\edlabel{line}.
12595 \pend
12596 \endnumbering
12597
12598 \section{Last}
12599
12600 I forgot to mention that you can use ordinary
12601 footnotes\footnote{An ordinary footnote}\footnote{And another}
12602 outside the numbered text. You can also\footnoteB{Additionally}
12603 have\footnoteB{Specify} formatted footnotes\footnoteB{Like this}
12604 in normal\footnoteB{Text that does not have line numbers} text.
12605
12606 There are \lineref{line} numbered lines in the example shown
12607 in section~\ref{subsec}.
12608
12609 \end{document}
12610 %</easy>
12611 % \end{macrocode}
12612 %
12613 %
12614 % \subsection{General example of features} \label{example:ledfeat}
12615 %
12616 % This made-up example, \file{ledfeat.tex}, is included purely to illustrate
12617 % some of \Ledmac's main features. It is hard to find real-world
12618 % examples that actually use as many layers of notes as this, so we made
12619 % one up. The example is a bit tricky to read, but close study and
12620 % comparison with the output (Figure~\ref{features-out}) will be
12621 % illuminating.
12622 %
12623 % \begin{PW}
12624 % I have converted the original TeX code to look more like LaTeX code.
12625 % \end{PW}
12626 %
12627 % \medskip
12628 % \hrule
12629 % \medskip
12630 % \begin{macrocode}
12631 %<*features>
12632 % ledfeat.tex Small test file for ledmac package
12633 \documentclass{article}
12634 \usepackage{ledmac}
12635
12636 \noendnotes % we aren't having any endnotes
12637
12638 \makeatletter
12639 % I'd like a spaced out colon after the lemma:
12640 \newcommand{\spacedcolon}{{\rmfamily\thinspace:\thinspace}}
12641 \renewcommand*{\normalfootfmt}[3]{%
12642 \ledsetnormalparstuff
12643 {\notenumfont\printlines#1|}\strut\enspace
12644 {\select@lemmafont#1|#2}\spacedcolon\enskip#3\strut\par}
12645
12646 % And I'd like the 3-col notes printed with a hanging indent:
12647 \renewcommand*{\threecolfootfmt}[3]{%
12648 \normal@pars
12649 \hsize .3\hsize
12650 \setlength{\parindent}{0pt}
12651 \tolerance=5000 % high, but not infinite
12652 \raggedright
12653 \hangindent1.5em \hangafter1
12654 \leavevmode
12655 \strut\hbox to 1.5em{\notenumfont\printlines#1|\hfil}\ignorespaces
12656 {\select@lemmafont#1|#2}\rbracket\enskip
12657 #3\strut\par\allowbreak}
12658
12659 % And I'd like the 2-col notes printed with a double colon:
12660 \newcommand*{\doublecolon}{{\rmfamily\thinspace::\thinspace}}
12661 \renewcommand*{\twocolfootfmt}[3]{%
12662 \normal@pars
12663 \hsize .45\hsize
12664 \setlength{\parindent}{0pt}
12665 \tolerance=5000
12666 \raggedright
12667 \leavevmode
12668 \strut{\notenumfont\printlines#1|}\enspace
12669 {\select@lemmafont#1|#2}\doublecolon\enskip
12670 #3\strut\par\allowbreak}
12671
12672 % And in the paragraphed footnotes, I'd like a colon too:
12673 \renewcommand*{\parafootfmt}[3]{%
12674 \ledsetnormalparstuff
12675 {\notenumfont\printlines#1|}\enspace
12676 {\select@lemmafont#1|#2}\spacedcolon\enskip
12677 #3\penalty-10 }
12678 \makeatother
12679
12680 % I'd like the line numbers picked out in bold.
12681 \renewcommand{\notenumfont}{\bfseries}
12682 \lineation{page}
12683 \linenummargin{inner}
12684 \setcounter{firstlinenum}{3} % just because I can
12685 \setcounter{linenumincrement}{1}
12686 \foottwocol{A}
12687 \footthreecol{B}
12688 \footparagraph{E}
12689 % I've changed \normalfootfmt, so invoke it again for C and D notes.
12690 \footnormal{C}
12691 \footnormal{D}
12692
12693 \begin{document}
12694
12695 \beginnumbering
12696
12697 \pstart
12698 This is an \edtext{example}{
12699 \Afootnote{eximemple C, D.}}
12700 of some %\footnote{A normal footnote}
12701 text with \edtext{variant}{
12702 \Afootnote{alternative, A, B.}}
12703 readings recorded as `A' footnotes. From here on, \edtext{though}{
12704 \Afootnote{however $\alpha$, $\beta$}},
12705 we shall have \edtext{`C'}{
12706 \Bfootnote{B, \textit{pace} the text}}.
12707 \edtext{For spice, let us mark a longer passage, but give a different
12708 lemma for it, so that we don't get a \edtext{huge}{
12709 \Dfootnote{vast E, F; note that this is
12710 a `D' note to section of text within a longer lemma}}
12711 amount of text in a note}{\lemma{For spice \dots\ note}
12712 \Cfootnote{The note here is type `C'}}.
12713 \edtext{Finally}{
12714 \Efootnote{in the end X, Y}},
12715 \edtext{we}{
12716 \Efootnote{us K}}
12717 \edtext{shouldn't}{
12718 \Efootnote{ought not to L, M}}
12719 \edtext{forget the}{
12720 \Efootnote{omit to mention the \S, \P}}
12721 \edtext{paragraphed}{
12722 \Efootnote{blocked M, N}}
12723 \edtext{notes}{
12724 \Efootnote{variants HH, KK}},
12725 which are so \edtext{useful}{
12726 \Efootnote{truly useful L, P}}
12727 when there are \edtext{a great number of}{
12728 \Efootnote{many, many (preferably)}}
12729 short notes to be \edtext{recorded}{
12730 \Efootnote{noted: repetition}}.
12731 \pend
12732
12733 \pstart
12734 This is a second paragraph, giving more \textit{\edtext{examples}{
12735 \Afootnote{eximples L, M.}}}
12736 of text with \edtext{variant}{
12737 \Afootnote{alternative, A, B.}}
12738 readings recorded as `A' footnotes. From here on, \edtext{though}{
12739 \Bfootnote{however $\alpha$, $\beta$}},
12740 we shall have \edtext{`B'}{
12741 \Bfootnote{B, as correctly stated in the text}} notes in the text.
12742 \edtext{For spice, let us mark a longer passage, but give a different
12743 lemma for it, so that we don't get a \textit{\edtext{huge}{
12744 \Dfootnote{vast E, F; note that this is
12745 a `D' note to text within a longer lemma.}}}
12746 amount of text in a note}{\lemma{For spice, \dots\ note}
12747 \Cfootnote{This is a rogue note of type `C'.}}.
12748 \edtext{Finally}{
12749 \Bfootnote{In the end X, Y}},
12750 \edtext{we}{
12751 \Bfootnote{we here K}}
12752 \edtext{shouldn't}{
12753 \Bfootnote{ought not to L, M}}
12754 \edtext{forget the}{
12755 \Bfootnote{omit to mention the \S, \P}}
12756 \edtext{column}{
12757 \Bfootnote{blocked M, N}}
12758 \edtext{notes}{
12759 \Bfootnote{variants H}},
12760 which are so \edtext{useful}{
12761 \Bfootnote{very, very useful L, P}}
12762 when there are \edtext{many}{
12763 \Bfootnote{lots of Z}}
12764 short notes to be \edtext{recorded}{
12765 \Bfootnote{recorded and put down: M (repetition)}}.
12766 \pend
12767
12768 \endnumbering
12769 \end{document}
12770 %</features>
12771 % \end{macrocode}
12772 % \medskip
12773 % \hrule
12774 % \medskip
12775 %
12776 % \subsection{Gascoigne}
12777 %
12778 % The first real-life example is taken from an edition of George
12779 % Gascoigne's \textit{A Hundreth Sundrie Flowres} that is being
12780 % prepared by G.~W.~Pigman III,\index{Pigman, III$^{rd}$, G. W.} at
12781 % the California Institute of Technology. Figure \ref{iocasta-out}
12782 % shows the result of setting the text with \Ledmac.
12783 %
12784 %
12785 % \begin{PW}
12786 % I have LaTeXified the original code, and removed all the code related
12787 % to the main document layout, relying on the standard LaTeX layout parameters..
12788 % \end{PW}
12789 %
12790 % \medskip
12791 %
12792 % \hrule
12793 % \medskip
12794 % \begin{macrocode}
12795 %<*ioc>
12796 %% ledioc.tex
12797 \documentclass{article}
12798 \usepackage{ledmac}
12799
12800 \noendnotes
12801 \makeatletter
12802
12803 \newcommand{\os}{\scriptsize}
12804 \setcounter{firstsublinenum}{1000}
12805 \frenchspacing \setlength{\parskip}{0pt} \hyphenpenalty=1000
12806
12807 % Say \nolinenums if you want no line numbers in the notes.
12808 \newif\ifnolinenums
12809 \newcommand{\nolinenums}{\global\nolinenumstrue}
12810 \newcommand{\linenums}{\global\nolinenumsfalse}
12811
12812 \renewcommand{\rightlinenum}{\ifbypage@\ifnum\line@num<10\kern.5em\fi\else
12813 \ifnum\line@num<10\kern1em\else\ifnum\line@num<100
12814 \kern.5em\fi\fi\fi\kern.5em\numlabfont\the\line@num
12815 \ifnum\subline@num>0:\the\subline@num\fi}
12816
12817 \renewcommand{\leftlinenum}{\numlabfont\the\line@num
12818 \ifnum\subline@num>0:\the\subline@num\fi \kern.5em}
12819 \linenummargin{outer}
12820 \lineation{page}
12821
12822 \newcommand{\ggfootfmt}[3]{%
12823 \notefontsetup
12824 \let\par=\endgraf
12825 \rightskip=0pt \leftskip=0pt
12826 \setlength{\parindent}{0pt} \parfillskip=0pt plus 1fil
12827 \ifnolinenums\relax\else
12828 \begingroup \os \printlines#1|\endgroup
12829 \enskip
12830 \fi
12831 {\rmfamily #2\def\@tempa{#2}\ifx\@tempa\empty
12832 \else]\enskip\fi#3\penalty-10 }}
12833
12834 % Now reset the \Afootnote parameters and macros:
12835 \footparagraph{A}
12836 \let\Afootfmt=\ggfootfmt
12837 \dimen\Afootins=\vsize
12838 \skip\Afootins=3pt plus9pt
12839 \newcommand*{\ggfootstart}[1]{\vskip\skip\Afootins}
12840 \let\Afootstart=\ggfootstart
12841
12842 \newcommand*{\stage}[1]{\pstart\startsub\parindent=0pt
12843 \hangindent=3em\hangafter=0
12844 {\itshape #1}\let\par=\finishstage}
12845 \newcommand{\finishstage}{\pend\endsub}
12846 \newcommand{\sen}{\leavevmode\lower1ex\hbox{\textrm{''}}}
12847 \newcommand{\senspeak}[1]{\pstart\obeylines\setbox0=\hbox{\textrm{''}}%
12848 \leavevmode
12849 \lower1ex\copy0\kern-\wd0\hskip1em{\textit{#1}}%
12850 \hbox to1ex{}\ignorespaces}
12851 \newcommand*{\speak}[1]{\pstart\obeylines\hskip1em{\textit{#1}}%
12852 \hbox to1ex{}\ignorespaces}
12853 \def\nospeaker{\parindent=0em\pstart\let\par=\pend}
12854 \newcommand*{\nospeak}{\pstart\obeylines}
12855 \makeatother
12856
12857 \begin{document}
12858
12859 \setlength{\parindent}{0pt}
12860
12861 \beginnumbering
12862
12863 \stage{Oedipus \edtext{entreth}{\Afootnote{\textit{intrat} MS}}.}
12864
12865 \nospeak
12866 Or that with wrong the right and doubtlesse heire,
12867 Shoulde banisht be out of his princely seate.
12868 Yet thou O queene, so fyle thy sugred toung,
12869 And with suche counsell decke thy mothers tale,
12870 That peace may bothe the brothers heartes inflame,
12871 And rancour yelde, that erst possest the same.
12872 \pend
12873
12874 \speak{Eteocl.} Mother, beholde, youre hestes for to obey,
12875 In person nowe am I resorted hither:
12876 In haste therefore, fayne woulde I knowe what cause
12877 With hastie speede, so moued hath your mynde
12878 To call me nowe so causelesse out of tyme,
12879 When common wealth moste craues my onely ayde:
12880 Fayne woulde I knowe, what queynt commoditie
12881 Persuades you thus to take a truce for tyme,
12882 And yelde the gates wide open to my foe,
12883 The gates that myght our stately state defende,
12884 And nowe are made the path of our decay.
12885 \pend
12886
12887 \senspeak{Ioca.}Represse deare son, those raging stormes of wrath,
12888 \sen That so bedimme the eyes of thine intente,
12889 \edtext{\sen As when \edtext{the}{\Afootnote{thie MS}} tongue %
12890 (a redy Instrument)
12891 \sen Would \edtext{fayne pronounce}{\Afootnote{faynest tell MS}} %
12892 the meaning of \edtext{the minde}{\Afootnote{thy minde MS}},
12893 \sen \edtext{It}{\lemma{It \dots\ worde.}\Afootnote{Thie %
12894 swelling hart puft vp with wicked ire / Can scarce pronounce %
12895 one inward louing thought. MS}} cannot speake one honest %
12896 seemely worde.}{\lemma{As \dots\ worde.}\Afootnote{\textit{not %
12897 in} \os73}}
12898 \sen But when disdayne is shrunke, or sette asyde,
12899 \sen And mynde of man with leysure can discourse
12900 \sen What seemely woordes his tale may best beseeme,
12901 \sen And that the toung vnfoldes without affectes
12902 \sen Then may proceede an answere sage and graue,
12903 \sen And euery sentence sawst with sobernesse:
12904 Wherefore vnbende thyne angrie browes deare chylde,
12905 And caste thy rolling eyes none other waye,
12906 That here doost not \edtext{\textit{Medusaes}}{%
12907 \Afootnote{One of the furies. {\os75}m}} face beholde,
12908 But him, euen him, thy blood and brother deare.
12909 And thou beholde, my \textit{Polinices} eke,
12910 Thy brothers face, wherin when thou mayst see
12911 Thine owne image, remember therwithall,
12912 That what offence thou woldst to him were done,
12913 \pend
12914 \endnumbering
12915
12916 \end{document}
12917
12918 %</ioc>
12919 % \end{macrocode}
12920 % \medskip
12921 % \hrule
12922 %
12923 %
12924 % \subsection{Shakespeare} \label{example:ledarden}
12925 %
12926 % The following text illustrates another input file of moderate
12927 % complexity, with two layers of annotation in use. The example is
12928 % taken from the Arden \textit{Merchant of Venice}.\index{Shakespeare, William}
12929 %
12930 %
12931 % \begin{PW}
12932 % I have roughly converted the original TeX file to a LaTeX file.
12933 % The file is below and the result of LaTeXing it is shown in
12934 % Figure~\ref{arden-out}.
12935 % \end{PW}
12936 %
12937 %
12938 % \medskip
12939 % \hrule
12940 % \medskip
12941 %
12942 % \begin{macrocode}
12943 %<*arden>
12944 %% ledarden.tex
12945 \documentclass{article}
12946 \usepackage{ledmac}
12947
12948 \makeatletter
12949 \newcommand{\stage}[1]{\rlap{\hbox to \the\linenumsep{%
12950 \hfil\llap{[\textit{#1}]}}}}
12951
12952 \newcommand{\speaker}[1]{\pstart\hangindent2em\hangafter1
12953 \leavevmode\textit{#1}\enspace\ignorespaces}
12954
12955 \newcommand{\exit}[1]{\hfill\stage{#1}}
12956
12957 % LEDMAC customizations:
12958 \noendnotes
12959 \setlength{\parindent}{0pt}
12960 \setlength{\linenumsep}{.4in}
12961 \rightskip\linenumsep
12962
12963 \renewcommand{\interparanoteglue}{1em plus.5em minus.1em}
12964
12965 \newcommand{\scf}{\tiny}
12966 \let\Afootnoterule=\relax \let\Bfootnoterule=\relax
12967
12968 \renewcommand{\rightlinenum}{\numlabfont\llap{\the\line@num}}
12969 \frenchspacing
12970
12971 % Footnote formats:
12972 % \nonumparafootfmt is a footnote format without line numbers.
12973 \newcommand{\nonumparafootfmt}[3]{%
12974 \ledsetnormalparstuff
12975 \rightskip=0pt
12976 \select@lemmafont#1|#2\rbracket\enskip
12977 \itshape #3\penalty-10 }
12978
12979 \newcommand{\newparafootfmt}[3]{%
12980 \ledsetnormalparstuff
12981 {\notenumfont\printlines#1|}\fullstop\enspace
12982 {\select@lemmafont#1|#2}\rbracket\enskip
12983 \itshape #3\penalty-10 }
12984
12985 \newcommand{\newtwocolfootfmt}[3]{%
12986 \normal@pars
12987 \hsize .48\hsize
12988 \tolerance=5000
12989 \rightskip=0pt \leftskip=0pt \parindent=5pt
12990 \strut\notenumfont\printlines#1|\fullstop\enspace
12991 \itshape #2\/\rbracket\penalty100\hskip .5em plus .5em
12992 \normalfont #3\strut\goodbreak}
12993
12994 % Footnote style selections etc. (done last):
12995 \footparagraph{A}
12996 \foottwocol{B}
12997 \let\Afootfmt=\newparafootfmt
12998 \let\Bfootfmt=\newtwocolfootfmt
12999 \let\collation=\Afootnote
13000 \let\note=\Bfootnote
13001 \lineation{section}
13002 \linenummargin{right}
13003 \makeatother
13004
13005 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13006
13007 \begin{document}
13008 \pagestyle{empty}
13009
13010 % Initially, we don't want line numbers.
13011 \let\Afootfmt=\nonumparafootfmt
13012
13013 \beginnumbering
13014 \pstart
13015 \centerline{[\edtext{SCENE III}{
13016 \lemma{Scene III}
13017 \collation{Capell; om. Q, F; \textnormal{Scene IV} Pope.}}.---%
13018 \edtext{\textit{Venice}}{
13019 \collation{om. Q, F; Shylock's house Theobald; The same.
13020 A Room in Shylock's House Capell.}}.]}
13021 \pend
13022 \bigskip
13023
13024 \pstart
13025 \centerline{\textit{Enter} JESSICA \textit{and}
13026 [\edtext{LAUNCELOT}{
13027 \lemma{Launcelot}
13028 \collation{Rowe; om. Q, F.}}] \textit{the clown.}} \pend \bigskip
13029
13030 \let\Afootfmt=\newparafootfmt % we do want line numbers from now
13031
13032 \setline{0}%
13033
13034 \speaker{Jes.}\edtext{I am}{
13035 \collation{Q, F; \textnormal{I'm} Pope.}}
13036 sorry thou wilt leave my father so,\\
13037 Our house is hell, and thou (a merry devil)\\
13038 Didst rob it of some taste of tediousness,---\\
13039 But fare thee well, there is a ducat for thee,\\
13040 And Launcelot, \edtext{soon}{
13041 \note{early.}}
13042 at supper shalt thou see\\
13043 Lorenzo, who is thy new master's guest,\\
13044 Give him this letter,---do it secretly,---\\
13045 And so farewell: I would not have my father\\
13046 See me \edtext{in}{
13047 \collation{Q; om. F.}}
13048 talk with thee.
13049 \pend
13050
13051 \speaker{Laun.}
13052 \edtext{}{\lemma{\textit{Laun.}}\collation{Q2; Clowne. Q, F.}}%
13053 \edtext{Adieu!}{
13054 \collation{\textnormal{Adiew}, Q, F.}}
13055 tears \edtext{exhibit}{
13056 \note{Eccles paraphrased ``My tears serve to express what my
13057 tongue should, if sorrow would permit it,'' but probably it is
13058 Launce\-lot's blunder for prohibit (Halliwell) or inhibit
13059 (Clarendon).}}
13060 my tongue, most beautiful \edtext{pagan}{
13061 \note{This may have a scurrilous undertone: cf. \textit{2 H 4,}
13062 {\scf II.} \textrm{ii. 168.}}}%
13063 , most sweet \edtext{Jew!}{
13064 \collation{\textnormal{Iewe}, Q, F. \quad \textnormal{do]} Q, F;
13065 \textnormal{did} F2.}}%
13066 ---if a Christian \edtext{do}{
13067 \note{Malone upheld the reading of Qq and F by comparing {\scf II.}
13068 vi. 23: ``When you shall please to play the thieves for
13069 wives''; Launcelot seems fond of hinting at what is going to
13070 happen (cf. {\scf II.} v. 22--3). If F2's ``did'' is accepted,
13071 \textit{get} is used for beget, as in {\scf III.} v. 9.}}
13072 not play the knave and get thee, I am much deceived; but \edtext{adieu!}{
13073 \collation{\textnormal{adiew}, Q, F.}}
13074 these \edtext{foolish drops do \edtext{something}{
13075 \collation{Q; \textnormal{somewhat} F.}}
13076 drown my manly spirit}{
13077 \lemma{foolish\textnormal{\dots}spirit}
13078 \note{``tears do not become a man'' (\textit{AYL.}, {\scf III.}
13079 iv. 3); cf. also \textit{H 5,} {\scf IV.} vi. 28--32.}}%
13080 : \edtext{adieu!}{
13081 \collation{\textnormal{adiew}. Q, F. \quad \textnormal{S. D.]} Q2, F; om. Q;
13082 after l. 15 Capell.}}
13083 \exit{Exit.}
13084 \pend
13085
13086 \speaker{Jes.}
13087 Farewell good Launcelot.\\
13088 Alack, what heinous sin is it in me\\
13089 To be ashamed to be my father's \edtext{child!}{
13090 \collation{\textnormal{child}, Q, F; \textnormal{Child?} Rowe.}}
13091 \pend
13092 \endnumbering
13093
13094 \end{document}
13095
13096 %</arden>
13097 % \end{macrocode}
13098 %
13099 % \medskip
13100 % \hrule
13101 %
13102 %
13103 % \subsection{Classical text edition} \label{example:ledmixed}
13104 %
13105 % The next example, which was extracted from a longer file kindly
13106 % supplied by Wayne Sullivan,\index{Sullivan, Wayne} University
13107 % College, Dublin, Ireland, illustrates the use of \Ledmac{} to
13108 % produce a Latin text edition, the \textit{Periphyseon}, with Greek
13109 % passages.\footnote{The bibliographic details of the forthcoming book
13110 % are: Iohannis Scotti Erivgenae, \textit{Periphyseon} (\textit{De
13111 % Diuisione Naturae}) Liber Qvartvs [Scriptores Latini Hiberniae
13112 % vol.\,xii], (Dublin: School of Celtic Studies, Dublin Institute
13113 % for Advanced Studies, forthcoming 1992).} The Greek font used is
13114 % that prepared by Silvio Levy\index{Levy, Silvio} and described in
13115 % \textit{TUGboat}.\footnote{\textit{TUGboat} \textbf{9} (1988), pp.\,20--24.} The
13116 % output of this file is shown in Figure~\ref{periphyseon-out}.
13117 % Note the use of two layers of footnotes to record testimonia and
13118 % manuscript readings respectively.
13119 %
13120 % \begin{PW}
13121 % I have converted the original \edmac{} example file from TeX
13122 % to something that looks more like LaTeX.
13123 % \end{PW}
13124 %
13125 % ^^A Periphyseon, Liber IV
13126 %
13127 %
13128 % \medskip
13129 % \hrule
13130 % \medskip
13131 %
13132 % \begin{macrocode}
13133 %<*periph>
13134 % ledmixed.tex
13135 \documentclass{article}
13136 \usepackage{ledmac}
13137
13138 \noendnotes
13139 %% \overfullrule0 pt
13140 \lefthyphenmin=3
13141
13142 % \end{macrocode}
13143 % \begin{PW}
13144 % The LaTeX version uses the \Lpack{lgreek} package to access Silvio Levy's
13145 % greek font. The \texttt{delims} package option
13146 % subverts\footnote{It actually changes its category code.} the normal meaning
13147 % of \$ to switch in and out of math mode. We have to save the original meaning
13148 % of \$ before calling the package. Later, we use \cs{Ma} and \cs{aM} for math mode
13149 % switching.
13150 % \end{PW}
13151 % \begin{macrocode}
13152 \let\Ma=$
13153 \let\aM=$
13154 \usepackage[delims]{lgreek}
13155
13156 % We need an addition to \no@expands since the \active $ in lgreek
13157 % causes problems:
13158 \newcommand{\morenoexpands}{\let$=0}
13159
13160 \makeatletter
13161
13162 \newbox\lp@rbox
13163
13164 \newcommand{\ffootnote}[1]{%
13165 \ifnumberedpar@
13166 \xright@appenditem{\noexpand\vffootnote{f}{{\l@d@nums}{\@tag}{#1}}}%
13167 \to\inserts@list
13168 \global\advance\insert@count by 1
13169 % \else %% may be used only in numbered text
13170 % \vffootnote{f}{{0|0|0|0|0|0|0}{}{#1}}%
13171 \fi\ignorespaces}
13172
13173 \newcommand{\gfootnote}[1]{%
13174 \ifnumberedpar@
13175 \xright@appenditem{\noexpand\vgfootnote{g}{#1}}%
13176 \to\inserts@list
13177 \global\advance\insert@count by 1
13178 % \else %% may be used only in numbered text
13179 % \vgfootnote{g}{#1}%
13180 \fi\ignorespaces}
13181
13182 \newcommand{\setlp@rbox}[3]{%
13183 {\parindent\z@\hsize=2.5cm\raggedleft\scriptsize
13184 \baselineskip 9pt%
13185 \global\setbox\lp@rbox=\vbox to\z@{\vss#3}}}
13186
13187 \newcommand{\vffootnote}[2]{\setlp@rbox#2}
13188
13189 \newcommand{\vgfootnote}[2]{\def\rd@ta{#2}}
13190
13191
13192
13193 \renewcommand{\affixline@num}{%
13194 \ifsublines@
13195 \@l@dtempcntb=\subline@num
13196 \ifnum\subline@num>\c@firstsublinenum
13197 \@l@dtempcnta=\subline@num
13198 \advance\@l@dtempcnta by-\c@firstsublinenum
13199 \divide\@l@dtempcnta by\c@sublinenumincrement
13200 \multiply\@l@dtempcnta by\c@sublinenumincrement
13201 \advance\@l@dtempcnta by\c@firstsublinenum
13202 \else
13203 \@l@dtempcnta=\c@firstsublinenum
13204 \fi
13205 %
13206 \ifcase\sub@lock
13207 \or
13208 \ifnum\sublock@disp=1
13209 \@l@dtempcntb=0 \@l@dtempcnta=1
13210 \fi
13211 \or
13212 \ifnum\sublock@disp=2 \else
13213 \@l@dtempcntb=0 \@l@dtempcnta=1
13214 \fi
13215 \or
13216 \ifnum\sublock@disp=0
13217 \@l@dtempcntb=0 \@l@dtempcnta=1
13218 \fi
13219 \fi
13220 \else
13221 \@l@dtempcntb=\line@num
13222 \ifnum\line@num>\c@firstlinenum
13223 \@l@dtempcnta=\line@num
13224 \advance\@l@dtempcnta by-\c@firstlinenum
13225 \divide\@l@dtempcnta by\c@linenumincrement
13226 \multiply\@l@dtempcnta by\c@linenumincrement
13227 \advance\@l@dtempcnta by\c@firstlinenum
13228 \else
13229 \@l@dtempcnta=\c@firstlinenum
13230 \fi
13231 \ifcase\@lock
13232 \or
13233 \ifnum\lock@disp=1
13234 \@l@dtempcntb=0 \@l@dtempcnta=1
13235 \fi
13236 \or
13237 \ifnum\lock@disp=2 \else
13238 \@l@dtempcntb=0 \@l@dtempcnta=1
13239 \fi
13240 \or
13241 \ifnum\lock@disp=0
13242 \@l@dtempcntb=0 \@l@dtempcnta=1
13243 \fi
13244 \fi
13245 \fi
13246 %
13247 \ifnum\@l@dtempcnta=\@l@dtempcntb
13248 \@l@dtempcntb=\line@margin
13249 \ifnum\@l@dtempcntb>1
13250 \advance\@l@dtempcntb by\page@num
13251 \fi
13252 \ifodd\@l@dtempcntb
13253 % #1\rlap{{\rightlinenum}}%
13254 \xdef\rd@ta{\the\line@num}%
13255 \else
13256 \llap{{\leftlinenum}}%#1%
13257 \fi
13258 \else
13259 %#1%
13260 \fi
13261 \ifcase\@lock
13262 \or
13263 \global\@lock=2
13264 \or \or
13265 \global\@lock=0
13266 \fi
13267 \ifcase\sub@lock
13268 \or
13269 \global\sub@lock=2
13270 \or \or
13271 \global\sub@lock=0
13272 \fi}
13273
13274 \lineation{page}
13275 \linenummargin{right}
13276 \footparagraph{A}
13277 \footparagraph{B}
13278
13279 \renewcommand{\notenumfont}{\footnotesize}
13280 \newcommand{\notetextfont}{\footnotesize}
13281
13282 \let\Afootnoterule=\relax
13283 \count\Afootins=825
13284 \count\Bfootins=825
13285
13286 \newcommand{\Aparafootfmt}[3]{%
13287 \ledsetnormalparstuff
13288 \scriptsize
13289 \notenumfont\printlines#1|\enspace
13290 % \lemmafont#1|#2\enskip
13291 \notetextfont
13292 #3\penalty-10\hskip 1em plus 4em minus.4em\relax}
13293
13294 \newcommand{\Bparafootfmt}[3]{%
13295 \ledsetnormalparstuff
13296 \scriptsize
13297 \notenumfont\printlines#1|\enspace
13298 \select@lemmafont#1|#2\rbracket\enskip
13299 \notetextfont
13300 #3\penalty-10\hskip 1em plus 4em minus.4em\relax }
13301 \makeatother
13302
13303 \let\Afootfmt=\Aparafootfmt
13304 \let\Bfootfmt=\Bparafootfmt
13305 \def\lemmafont#1|#2|#3|#4|#5|#6|#7|{\scriptsize}
13306 \parindent=1em
13307
13308 \newcommand{\lmarpar}[1]{\edtext{}{\ffootnote{#1}}}
13309 \newcommand{\rmarpar}[1]{\edtext{}{\gfootnote{#1}}}
13310 \emergencystretch40pt
13311
13312 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13313
13314 \begin{document}
13315
13316 \beginnumbering
13317 \pstart
13318 \rmarpar{741C}
13319 \noindent \edtext{Incipit Quartus $PERIFUSEWN$}{%
13320 \lemma{incipit\ .~.~.\ $PERIFUSEWN$}\Bfootnote{\textit{om.\ R},
13321 incipit quartus \textit{M}}}
13322 \pend
13323 \medskip
13324
13325 \pstart
13326 \noindent \edtext{NVTRITOR}{\lemma{$ANAKEFALIOSIS$}\Bfootnote{\textit{
13327 FJP, lege} $<anakefala'iwsis$}}.\lmarpar{$ANAKEFALIOSIS$
13328 NATVRARVM} Prima nostrae
13329 \edtext{Physiologiae}{\lemma{physiologiae}\Bfootnote{phisiologiae
13330 \textit{P}, physeologiae \textit{R}}}
13331 intentio praecipuaque mat\-e\-ria erat
13332 \edtext{quod}{\Bfootnote{\textit{p}.\ natura \textit{transp.\ MR}}}
13333 \edtext{$UPEROUSIADES$}{\Bfootnote{\textit{codd.\ Vtrum}
13334 $<uperousi'wdhs$ (hoc est superessentialis) natura \textit{cum Gale
13335 (p.160) an} $<uperousi'oths$ (hoc est superessentialis natura)
13336 \textit{cum Floss (PL 122,741C) intelligendum sit, ambigitur}}}
13337 (hoc est superessentialis) natura sit causa creatrix existentium et
13338 non existentium omnium, a nullo creata, unum principium, una
13339 origo, unus et uniuersalis uniuersorum fons, a nullo manans, dum
13340 ab eo manant omnia, trinitas coessentialis in tribus substantiis,
13341 $ANARQOS$ (hoc est sine principio), principium et finis, una
13342 bonitas, deus unus,
13343 \edtext{$OMOUSIOS$}{\Bfootnote{\textit{codd., lege} $<omoo'usios$}}
13344 \edtext{et}{\lemma{\textbf{et}}\Bfootnote{\textit{
13345 R}\textsuperscript{1}, \textit{om.\ R}\textsuperscript{0}}}
13346 $UPEROUSIOS$ (id est coessentialis et superessentialis). Et, ut
13347 ait sanctus Epifanius, episcopus Constantiae Cypri, in
13348 \edtext{$AGKURATW$}{\Bfootnote{anchurato \textit{MR}}}
13349 sermone
13350 \edtext{de fide}{\Bfootnote{Glo\Ma\langle\aM ssa\Ma\rangle\aM: Ita
13351 enim uocatur sermo eius de fide $AGKURATOS$, id est procuratus
13352 \textit{mg.\ add.\ FJP}}}:
13353 \begin{itshape}Tria sancta, tria consancta, tria
13354 \edtext{agentia}{\Bfootnote{actiua \textit{MR}}},
13355 tria coagentia, tria
13356 \edtext{formantia}{\Bfootnote{formatiua \textit{MR}}},
13357 tria conformantia, tria
13358 \edtext{operantia}{\Bfootnote{operatiua \textit{MR}}},
13359 tria cooperantia, tria subsistentia, tria\rmarpar{742C}
13360 consubsistentia sibi inuicem coexistentia. Trinitas haec
13361 sancta uocatur: tria existentia, una consonantia, una deitas
13362 \edtext{eiusdem}{\Bfootnote{eiusdemque \textit{M}}}
13363 essentiae,
13364 \edtext{eiusdem uirtutis, eiusdem
13365 \edtext{subsistentiae}{\Bfootnote{substantiae \textit{R}}}}{%
13366 \Bfootnote{\textit{om.\ M}}},
13367 similia
13368 \edtext{similiter}{\Bfootnote{ex simili \textit{MR}}}
13369 aequalitatem gratiae operantur patris et filii et sancti spiritus.
13370 Quomodo autem
13371 \edtext{sunt}{\Bfootnote{\textit{om.\ M}}},
13372 ipsis relinquitur docere:
13373 \edtext{`Nemo enim nouit patrem nisi filius, neque filium nisi pater,
13374 et cuicumque filius reuelauerit'}{\Afootnote{Matth.\ 11, 27}};
13375 reuelatur autem per spiritum sanctum. Non ergo haec tria existentia
13376 aut ex ipso aut per ipsum aut ad ipsum in unoquoque digne intelliguntur,
13377 \Ma\mid\! R, 264^{\rm r}\!\mid\aM\ sicut ipsa reuelant:\end{itshape}
13378 $FWS, PUR, PNEUMA$
13379 \edtext{(hoc est lux, ignis, spiritus)}{\Afootnote{EPIPHANIVS,
13380 \textit{Ancoratus} 67; PG~43, 137C--140A; GCS 25, p.~82, 2--12}}.
13381 \pend
13382
13383 \pstart
13384 Haec, ut dixi, ab Epifanio tradita, ut quisquis interrogatus quae
13385 tria et quid unum in sancta trinitate debeat credere, sana fide
13386 \Ma\!\mid J, 1^{\rm v}\!\mid\aM\ respondere ualeat, aut ad
13387 fidem accedens\rmarpar{743A} sic erudiatur. Et mihi uidetur
13388 spiritum pro calore posuisse, quasi dixisset in similitudine:
13389 lux, ignis, calor. Haec enim tria unius essentiae sunt. Sed cur
13390 lucem primo dixit, non est mirum. Nam et pater lux est et ignis
13391 et calor; et filius est lux, ignis, calor; et
13392 \edtext{spiritus sanctus}{\Bfootnote{sanctus spiritus \textit{R}}}
13393 lux, ignis, calor. Illuminat enim pater, illuminat filius, illuminat
13394 spiritus sanctus: ex ipsis enim omnis scientia et sapientia donatur.
13395 \pend
13396 \endnumbering
13397
13398 \end{document}
13399
13400 %</periph>
13401 % \end{macrocode}
13402 %
13403 % \medskip
13404 % \hrule
13405 %
13406 % ^^A PW: I have removed the bits of the Arabic and Sanskrit examples.
13407 % ^^A PW: the iffalse ... fi trick doesn't work here because of embedded ifs
13408 %
13409 % \subsection{Nijmegen}\label{example:ledekker}
13410 % \changes{v0.2.2}{2003/11/09}{Added the Dekker example}
13411 % \changes{v0.6}{2004/11/16}{Changed version of the Dekker example}
13412 %
13413 % \begin{PW}
13414 % This example, illustrated in Figure~\ref{ledekker-out},
13415 % was provided in 2004 by Dirk-Jan Dekker\index{Dekker, Dirk-Jan}
13416 % of the Department of Medieval History at the University of
13417 % Nijmegen\footnote{On 1st September 2004 the University changed its
13418 % name to Radboud University.}.
13419 % Unlike earlier examples, this was coded for LaTeX and \Ledmac{} from
13420 % the start. I have reformatted the example to help it fit this document;
13421 % any errors are those that I have inadvertently introduced. Note that
13422 % repeated line numbers are eliminated from the footnotes.
13423 % \end{PW}
13424 %
13425 % \medskip
13426 % \hrule
13427 % \medskip
13428 % \begin{macrocode}
13429 %<*dekker>
13430 %%% This is ledekker.tex, a sample critical text edition
13431 %%% written in LaTeX2e with the ledmac package.
13432 %%% (c) 2003--2004 by Dr. Dirk-Jan Dekker,
13433 %%% University of Nijmegen (The Netherlands)
13434 %%% (PRW) Modified slightly by PRW to fit the ledmac manual
13435
13436 \documentclass[10pt, letterpaper, oneside]{article}
13437 \usepackage[latin]{babel}
13438 \usepackage{ledmac}
13439
13440 \lineation{section}
13441 \linenummargin{left}
13442 \sidenotemargin{outer}
13443
13444 \renewcommand{\notenumfont}{\footnotesize}
13445 \newcommand{\notetextfont}{\footnotesize}
13446
13447 %\let\Afootnoterule=\relax
13448 \let\Bfootnoterule=\relax
13449 \let\Cfootnoterule=\relax
13450
13451 \addtolength{\skip\Afootins}{1.5mm}
13452 %\addtolength{\skip\Bfootins}{1.5mm}
13453 %\addtolength{\skip\Cfootins}{1.5mm}
13454
13455 \makeatletter
13456
13457 \renewcommand*{\para@vfootnote}[2]{%
13458 \insert\csname #1footins\endcsname
13459 \bgroup
13460 \notefontsetup
13461 \footsplitskips
13462 \l@dparsefootspec #2\ledplinenumtrue % new from here
13463 \ifnum\@nameuse{previous@#1@number}=\l@dparsedstartline\relax
13464 \ledplinenumfalse
13465 \fi
13466 \ifnum\previous@page=\l@dparsedstartpage\relax
13467 \else \ledplinenumtrue \fi
13468 \ifnum\l@dparsedstartline=\l@dparsedendline\relax
13469 \else \ledplinenumtrue \fi
13470 \expandafter\xdef\csname previous@#1@number\endcsname{\l@dparsedstartline}
13471 \xdef\previous@page{\l@dparsedstartpage} % to here
13472 \setbox0=\vbox{\hsize=\maxdimen%
13473 \let\bidi@RTL@everypar\@empty%
13474 \noindent\csname #1footfmt\endcsname#2}%
13475 \setbox0=\hbox{\unvxh0}%
13476 \dp0=0pt
13477 \ht0=\csname #1footfudgefactor\endcsname\wd0
13478 \box0
13479 \penalty0
13480 \egroup
13481 }
13482
13483 \newcommand*{\previous@A@number}{-1}
13484 \newcommand*{\previous@B@number}{-1}
13485 \newcommand*{\previous@C@number}{-1}
13486 \newcommand*{\previous@page}{-1}
13487
13488 \newcommand{\abb}[1]{#1%
13489 \let\rbracket\nobrak\relax}
13490 \newcommand{\nobrak}{\textnormal{}}
13491 \newcommand{\morenoexpands}{%
13492 \let\abb=0%
13493 }
13494
13495 \newcommand{\Aparafootfmt}[3]{%
13496 \ledsetnormalparstuff
13497 \scriptsize
13498 \notenumfont\printlines#1|\enspace
13499 % \lemmafont#1|#2\enskip
13500 \notetextfont
13501 #3\penalty-10\hskip 1em plus 4em minus.4em\relax}
13502
13503 \newcommand{\Bparafootfmt}[3]{%
13504 \ledsetnormalparstuff
13505 \scriptsize
13506 \notenumfont\printlines#1|%
13507 \ifledplinenum
13508 \enspace
13509 \else
13510 {\hskip 0em plus 0em minus .3em}
13511 \fi
13512 \select@lemmafont#1|#2\rbracket\enskip
13513 \notetextfont
13514 #3\penalty-10\hskip 1em plus 4em minus.4em\relax }
13515
13516 \newcommand{\Cparafootfmt}[3]{%
13517 \ledsetnormalparstuff
13518 \notenumfont\printlines#1|\enspace
13519 % \lemmafont#1|#2\enskip
13520 \notetextfont
13521 #3\penalty-10\hskip 1em plus 4em minus.4em\relax}
13522
13523 \makeatother
13524
13525 \footparagraph{A}
13526 \footparagraph{B}
13527 \footparagraph{C}
13528
13529 \let\Afootfmt=\Aparafootfmt
13530 \let\Bfootfmt=\Bparafootfmt
13531 \let\Cfootfmt=\Cparafootfmt
13532
13533 \emergencystretch40pt
13534
13535 \author{Guillelmus de Berchen}
13536 \title{Chronicle of Guelders}
13537 \date{}
13538 \hyphenation{archi-epi-sco-po Huns-dis-brug li-be-ra No-vi-ma-gen-si}
13539 \begin{document}
13540 \maketitle
13541 \thispagestyle{empty}
13542
13543 \section*{St.\ Stephen's Church in Nijmegen}
13544 \beginnumbering
13545 \autopar
13546
13547 \noindent
13548 Nobilis itaque comes Otto imperio et dominio Novimagensi sibi,
13549 ut praefertur, impignoratis et commissis
13550 \edtext{proinde}{\Bfootnote{primum D}} praeesse cupiens, anno
13551 \textsc{liiii}\ledsidenote{1254} superius descripto, mense
13552 Iu\edtext{}{\Afootnote{p.\ 227~R}}nio, una cum iudice, scabinis
13553 ceterisque civibus civitatis Novimagensis, pro ipsius et
13554 inhabitantium in ea necessitate,\edtext{}{\Afootnote{p.\ 97~N}}
13555 commodo et utilitate, ut
13556 \edtext{ecclesia eius}{\Bfootnote{ecclesia D: eius eius H}}
13557 parochialis
13558 \edtext{\abb{extra civitatem}}{\Bfootnote{\textit{om.}~H}} sita
13559 destrueretur et \edtext{infra}{\Bfootnote{intra D}} muros
13560 \edtext{transfer\edtext{}{\Afootnote{p.\ 129~D}}retur}%
13561 {\Bfootnote{transferreretur NH}}
13562 ac de novo construeretur, \edtext{a reverendo patre domino
13563 \edtext{Conrado de \edtext{Hofsteden}%
13564 {\Bfootnote{Hoffstede D: Hoffsteden H}},
13565 archiepiscopo
13566 \edtext{Coloniensi}{\Bfootnote{Colononiensi H}}}%
13567 {\Cfootnote{Conrad of Hochstaden was archbishop of Cologne in
13568 1238--1261}}, licentiam}{\Cfootnote{William is confusing two
13569 charters that are five years apart. Permission from St.\ Apostles'
13570 Church in Cologne had been obtained as early as 1249. Cf.\ Sloet,
13571 \textit{Oorkondenboek} nr.\ 707 (14 November 1249):
13572 ``\ldots{}nos devotionis tue precibus annuentes, ut ipsam
13573 ecclesiam faciens demoliri transferas in locum alium competentem,
13574 tibi auctoritate presentium indulgemus\ldots{}''}}, et a
13575 venerabilibus \edtext{dominis}{\Bfootnote{viris H}} decano et
13576 capitulo sanctorum Apostolorum
13577 \edtext{Coloniensi}{\Bfootnote{Coloniae H}}, ipsius ecclesiae ab
13578 antiquo veris et pacificis patronis, consensum, citra tamen
13579 praeiudicium, damnum aut gravamen
13580 \edtext{iurium}{\Bfootnote{virium D}} et bonorum eorundem,
13581 impetravit.
13582
13583 \edtext{Et exinde \edtext{liberum}{\Bfootnote{librum H}} locum
13584 eiusdem civitatis \edtext{qui}{\Bfootnote{quae D}} dicitur
13585 \edtext{Hundisbrug}{\Bfootnote{Hundisburch D: Hunsdisbrug R}},
13586 de praelibati Wilhelmi Romanorum
13587 \edtext{regis}{\Bfootnote{imperatoris D}}, ipsius fundi
13588 do\edtext{}{\Afootnote{f.\ 72v~M}}mini, consensu, ad aedificandum
13589 \edtext{\abb{et consecrandum}}{\Bfootnote{\textit{om.}\ H}}
13590 ecclesi\edtext{}{\Afootnote{p.\ 228~R}}am et coemeterium,
13591 \edtext{eisdem}{\Bfootnote{eiusdem D}} decano et capitulo de
13592 expresso eiusdem civitatis assensu libera contradiderunt voluntate,
13593 obligantes se ipsi \edtext{comes}{\Bfootnote{comites D}} et civitas
13594 \edtext{\abb{dictis}}{\Bfootnote{\textit{om.}\ H}} decano et
13595 capitulo, quod in recompensationem illius areae infra castrum et
13596 portam, quae fuit dos ecclesiae, in qua plebanus habitare
13597 solebat---quae \edtext{tunc}{\Bfootnote{nunc H}} per novum fossatum
13598 civitatis est destructa---aliam aream competentem et ecclesiae
13599 novae,
13600 \edtext{ut praefertur, aedificandae}{\lemma{\abb{ut\ldots aedificandae}}%
13601 \Bfootnote{\textit{om.}\ H}} satis
13602 \edtext{contiguam}{\Bfootnote{contiguum M}}, ipsi plebano darent
13603 et assignarent. Et desuper
13604 \edtext{\abb{apud}}{\Bfootnote{\textit{om.}\ H}} dictam ecclesiam
13605 sanctorum Apostolorum \edtext{est}{\Bfootnote{et H}}
13606 \edtext{littera}{\Bfootnote{litteram H}} sigillis ipsorum
13607 Ottonis\edtext{}{\Afootnote{p.\ 130~D}} comitis et civitatis
13608 \edtext{Novimagensis}{\Bfootnote{Novimagii D}}
13609 \edtext{sigillata}{\Bfootnote{sigillis communita H}}.}%
13610 {\Cfootnote{Cf.\ Sloet, \textit{Oorkondenboek} nr.\ 762 (June 1254)}}
13611
13612 % (PRW) the full document continues on after this point
13613 %%%%%%%%%%%%%%%%%%%%%%%%%%%
13614 \endnumbering
13615 \end{document}
13616 %%%%%%%%%%%%%%%%%%
13617
13618 %</dekker>
13619 % \end{macrocode}
13620 %
13621 % \medskip
13622 % \hrule
13623 % \medskip
13624 %
13625 % \subsection{Irish verse}\label{example:ledbraonain}
13626 % \changes{v0.3}{2004/02/14}{Added the Braonain example}
13627 %
13628 % \begin{PW}
13629 % This example, illustrated in Figure~\ref{braonain-out},
13630 % is a somewhat modified and shortened version of Wayne Sullivan's example
13631 % demonstration for \edstanza.
13632 %
13633 % The stanza lines are numbered according to the source verse lines,
13634 % not according to the printed lines. For example, the
13635 % sixth (`f') line in the first stanza is printed as two lines as the source
13636 % line was too long to fit on one printed line. Note that if you process
13637 % this yourself you will get error reports about counters the first time
13638 % through; this is because alphabetic counters, like roman numerals, have no
13639 % notion of zero.
13640 %
13641 % As is fairly typical of critical edition typesetting, some of
13642 % \Lpack{ledmac}'s internal macros had to be modified to get the
13643 % desired effects.
13644 % \end{PW}
13645 %
13646 % \medskip
13647 % \hrule
13648 % \medskip
13649 % \begin{macrocode}
13650 %<*braonain>
13651 %%% This is ledbraonain.tex, a sample critical verse edition.
13652 %%% Originally written for TeX processing with edmac and edstanza
13653 %%% by Wayne Sullivan.
13654 %%% Extensively modified by Peter Wilson for LaTeX and the ledmac package.
13655
13656 \documentclass{article}
13657 \usepackage{ledmac}
13658
13659 \setlength{\textheight}{40pc}
13660 \setlength{\textwidth}{24pc}
13661 \bigskipamount=12pt plus 6pt minus 6pt
13662 \newcommand*{\notetextfont}{\footnotesize}
13663
13664 %%% Just one footnote series
13665 \footparagraph{C}
13666 \count\Cfootins=800
13667 \makeatletter
13668 %% but using two different formats
13669 \def\xparafootfmt#1#2#3{%
13670 \ledsetnormalparstuff
13671 {\notenumfont\printlines#1|}\enspace
13672 %%% {\select@lemmafont#1|#2}\rbracket\enskip
13673 \notetextfont #3\penalty-10 }
13674 \def\yparafootfmt#1#2#3{%
13675 \ledsetnormalparstuff
13676 %%% {\notenumfont\printlines#1|}\enspace
13677 %%% {\select@lemmafont#1|#2}\rbracket\enskip
13678 \notetextfont #3\penalty-10 }
13679
13680 \let\Cfootfmt=\xparafootfmt
13681 \skip\Cfootins=\bigskipamount
13682 \makeatother
13683
13684 %% This is the default, but just to demonstrate...
13685 \setlength{\stanzaindentbase}{20pt}
13686
13687 %% MUST SET THE INDENTS
13688 %% indent multiples; first=hangindent.
13689 %% Must all be non-negative whole numbers
13690 \setstanzaindents{4,1,2,1,2,3,3,1,2,1}
13691
13692 %% Set stanza line penalties
13693 %% Must be nonnegative whole numbers.
13694 %% An initial zero indicates no penalties.
13695 \setstanzapenalties{1,5000,10500,5000,10500,5000,5000,5000,0}
13696 %\setstanzapenalties{0}% the default
13697
13698 %% Put some space between stanzas
13699 \let\endstanzaextra=\bigbreak % ==> \bigskip \penalty -200
13700
13701 %% (almost) force line break in foot paragraph
13702 \mathchardef\IMM=9999
13703 \def\lbreak{\hfil\penalty-\IMM}
13704
13705 %% Number each stanza in bold
13706 \newcounter{stanzanum}
13707 \setcounter{stanzanum}{0}
13708 \newcommand*{\numberit}{%
13709 \flagstanza[0.5\stanzaindentbase]{\textbf{\thestanzanum}}}
13710 %% Use the hook to insert the number (and counteract a new line)
13711 %% and reset the line number to zero
13712 \newcommand*{\startstanzahook}{\refstepcounter{stanzanum}%
13713 \numberit\vskip-\baselineskip%
13714 \setlinenum{0}}
13715
13716 %% Want to label the footnotes with the stanza and line number
13717 %% We'll use \linenum to replace the sub-line number
13718 %% with the stanza number, redefining \edtext to do this
13719 %% automatically for us.
13720 %%%%%%%%%%%%%%%%%%%%%%%%%
13721 \makeatletter
13722
13723 \renewcommand{\edtext}[2]{\leavevmode
13724 \begingroup
13725 \no@expands
13726 \xdef\@tag{#1}%
13727 \set@line
13728 \global\insert@count=0
13729 \ignorespaces \linenum{||\the\c@stanzanum}#2\relax
13730 \flag@start
13731 \endgroup
13732 #1%
13733 \ifx\end@lemmas\empty \else
13734 \gl@p\end@lemmas\to\x@lemma
13735 \x@lemma
13736 \global\let\x@lemma=\relax
13737 \fi
13738 \flag@end}
13739
13740 %% We need only a very simple macro for footnote numbers,
13741 %% to produce the stanza number (sub-line) then the line number.
13742 \def\printstanzalines#1|#2|#3|#4|#5|#6|#7|{\begingroup
13743 #3\fullstop \linenumrep{#2}
13744 \endgroup}
13745 \let\oldprintlines\printlines
13746
13747 \makeatother
13748 %%%%%%%%%%%%%%%%%%%%%%%%%
13749
13750 \pagestyle{empty}
13751
13752 \begin{document}
13753
13754 \beginnumbering
13755
13756 \pstart \centering \textbf{22} \pend
13757
13758 \bigskip
13759 %% do not print line number beside heading
13760 \setcounter{firstlinenum}{1000}
13761 %% and heading footnotes use a different format
13762 \let\Cfootfmt=\yparafootfmt
13763
13764 \pstart
13765 \centerline{[Se\'an \'O Braon\'ain cct] chuim Tom\'ais U\'{\i}
13766 \edtext{Dh\'unlaing}{\Cfootnote{\textbf{22} \textit{Teideal}: Dhuinnluinng T,
13767 Se\'aghan Mac Domhnaill cct B\lbreak}}}
13768 \pend
13769
13770 \pstart
13771 \centerline{[Fonn: M\'airse\'ail U\'{'i} Sh\'uilleabh\'ain (P\'ainseach
13772 na nUbh]}
13773 \pend
13774
13775 \bigskip
13776
13777 %% revert to the regular footnote format
13778 \let\Cfootfmt=\xparafootfmt
13779 %% but use our special number printing routine
13780 \let\printlines\printstanzalines
13781 %% Use letters for line numbering
13782 \linenumberstyle{alph}
13783 %% number lines from the second onwards
13784 \setcounter{firstlinenum}{2}
13785 \setcounter{linenumincrement}{1}
13786
13787 %% Each verse starts with \stanza.
13788 %% Lines end with &; the last line with \&.
13789
13790 \stanza
13791 A \edtext{dhuine}{\Cfootnote{dhuinne T}} gan ch\'eill do
13792 \edtext{mhaisligh}{\Cfootnote{mhaslaidh T, mhaslaig B}} an chl\'eir&
13793 is tharcaisnigh naomhscruipt na bhf\'aige,&
13794 na haitheanta \edtext{r\'eab}{\Cfootnote{raob T}} 's an
13795 t-aifreann thr\'eig&
13796 \edtext{re}{\Cfootnote{le B}} taithneamh do chlaonchreideamh
13797 Mh\'artain,&
13798 c\'a rachair \edtext{'od}{\Cfootnote{dod B}} dh\'{\i}on ar
13799 \'Iosa Nasardha&
13800 nuair \edtext{chaithfimid}{\Cfootnote{chaithfam\'{\i}d T}} cruinn
13801 bheith ar \edtext{mhaoileann}{\Cfootnote{maoilinn B}} Josepha?&
13802 N\'{\i} caraid Mac Crae chuim t'anama '
13803 \edtext{phl\'e}{\Cfootnote{phleidh T}}&
13804 n\'a Calvin \edtext{bhiais}{\Cfootnote{bh\'{\i}os B}} taobh
13805 \edtext{ris}{\Cfootnote{leis B}} an l\'a sin.\&
13806
13807 \stanza
13808 N\'ach damanta an sc\'eal don chreachaire
13809 \edtext{chlaon}{\Cfootnote{claon B}}&
13810 ghlac baiste na cl\'eire 'na ph\'aiste&
13811 's do \edtext{glanadh}{\Cfootnote{glannuig T}} mar ghr\'ein
13812 \'on bpeaca r\'o-dhaor&
13813 tr\'{\i} \edtext{ainibhfios}{\Cfootnote{ainnibhfios T, ainnbhfios B}}
13814 \edtext{\'Eva}{\Cfootnote{\'Eabha B}} rinn \'Adam,&
13815 tuitim ar\'{\i}s f\'e chuing na haicme sin&
13816 tug atharrach br\'{\i} don scr\'{\i}bhinn bheannaithe,&
13817 d'aistrigh b\'easa \edtext{agus}{\Cfootnote{is B}} reachta na cl\'eire&
13818 's n\'ach \edtext{tugann}{\Cfootnote{tuigionn T}} aon
13819 gh\'eilleadh don Ph\'apa?\&
13820
13821 \stanza
13822 Gach \edtext{scolaire}{\Cfootnote{sgollaire T}} baoth, n\'{\i}
13823 \edtext{mholaim}{\Cfootnote{mholluim T}} a cheird&
13824 \edtext{'t\'a ag obair}{\Cfootnote{'t\'ag ccobar T}}
13825 \edtext{le}{\Cfootnote{re B}} g\'eilleadh d\'a th\'aille&
13826 don \edtext{doirbhchoin chlaon}{\Cfootnote{dorbhchon daor B}}
13827 d\'a ngorthar Mac Crae,&
13828 deisceabal \edtext{straeigh}{\Cfootnote{straodhaig T}} as an
13829 gcoll\'aiste.&
13830 T\'a \edtext{\edtext{adaithe}{\Cfootnote{fadaighthe B}}
13831 th\'{\i}os}{\Cfootnote{fhadoghthe ts\'{\i}os T}} in
13832 \'{\i}ochtar ifrinn,&
13833 gan \edtext{solas}{\Cfootnote{sollus T}} gan soilse i
13834 dt\'{\i}orthaibh dorcha,&
13835 tuigsint an l\'einn, gach
13836 \edtext{cuirpeacht}{\Cfootnote{cuirripeacht T}} d\'ein&
13837 is \edtext{Lucifer}{\Cfootnote{Luicifer T, L\'ucifer B}} aosta
13838 'na \edtext{mh\'aistir}{\Cfootnote{mhaighistir T}}.\&
13839
13840 \endnumbering
13841
13842 \end{document}
13843
13844 %</braonain>
13845 % \end{macrocode}
13846 %
13847 %
13848 % \medskip
13849 % \hrule
13850 %
13851 %
13852 % \clearpage
13853 %
13854 % \bibliographystyle{alpha}
13855 % \section*{}
13856 % \addcontentsline{toc}{section}{References}
13857 % \begin{thebibliography}{WWW99}
13858 %
13859 % \bibitem[Bre96]{TABMAC}
13860 % Herbert Breger.
13861 % \newblock \tabmac.
13862 % \newblock October 1996.
13863 % \newblock (Available from CTAN in
13864 % \texttt{macros/plain/contrib/tabmac})
13865 %
13866 % \bibitem[Bur01]{POEMSCOLTUG}
13867 % John Burt.
13868 % \newblock `Typesetting critical editions of poetry'.
13869 % \newblock \emph{TUGboat}, \textbf{22}, 4, pp 353--361, December 2001.
13870 % \newblock (Code available from CTAN in
13871 % \texttt{macros/latex/contrib/poemscol})
13872 %
13873 % \bibitem[Eck03]{PARALLEL}
13874 % Matthias Eckermann.
13875 % \newblock \emph{The \Lpack{Parallel}-Package}.
13876 % \newblock April 2003.
13877 % \newblock (Available from CTAN in
13878 % \texttt{macros/latex/contrib/parallel})
13879 %
13880 % \bibitem[Fai03]{FOOTMISC}
13881 % Robin Fairbairns.
13882 % \newblock \emph{\Lpack{footmisc} --- a portmanteau package for
13883 % customising footnotes in LaTeX}.
13884 % \newblock February 2003.
13885 % \newblock (Available from CTAN in
13886 % \texttt{macros/latex/contrib/footmisc})
13887 %
13888 %
13889 % \bibitem[LW90]{EDMACTUG}
13890 % John Lavagnino and Dominik Wujastyk.
13891 % \newblock `An overview of \edmac: a \textsc{Plain} TeX format for
13892 % critical editions'.
13893 % \newblock \emph{TUGboat}, \textbf{11}, 4, pp. 623--643, November 1990.
13894 % \newblock (Code available from CTAN in
13895 % \texttt{macros/plain/contrib/edmac})
13896 %
13897 % \bibitem[L\"{u}c03]{EDNOTES}
13898 % Uwe L\"{u}ck.
13899 % \newblock `\textsf{ednotes} --- critical edition typesetting with LaTeX'.
13900 % \newblock \emph{TUGboat}, \textbf{24}, 2, pp. 224--236, 2003.
13901 % \newblock (Code available from CTAN in
13902 % \texttt{macros/latex/contrib/ednotes})
13903 %
13904 % \bibitem[Sul92]{EDSTANZA}
13905 % Wayne G.~Sullivan.
13906 % \newblock \emph{The file \texttt{edstanza.doc}}.
13907 % \newblock June 1992.
13908 % \newblock (Available from CTAN in
13909 % \texttt{macros/plain/contrib/edmac})
13910 %
13911 % \bibitem[Wil02]{MEMOIR}
13912 % Peter Wilson.
13913 % \newblock \emph{The \Lpack{memoir} class for configurable typesetting}.
13914 % \newblock November 2002.
13915 % \newblock (Available from CTAN in
13916 % \texttt{macros/latex/contrib/memoir})
13917 %
13918 % \bibitem[Wil04]{LEDPAR}
13919 % Peter Wilson.
13920 % \newblock \emph{Parallel typesetting for critical editions:
13921 % the \Lpack{ledpar} package}.
13922 % \newblock December 2004.
13923 % \newblock (Available from CTAN in
13924 % \texttt{macros/latex/contrib/ledmmac})
13925 %
13926 % \bibitem[Wil05]{LEDARAB}
13927 % Peter Wilson.
13928 % \newblock \emph{Critical editions and arabic typesetting:
13929 % the \Lpack{ledarab} and \Lpack{afoot} packages}.
13930 % \newblock February 2005.
13931 % \newblock (Available from CTAN in
13932 % \texttt{macros/latex/contrib/ledmmac})
13933 %
13934 % \end{thebibliography}
13935 %
13936 % \Finale
13937 % \section*{}
13938 % \addcontentsline{toc}{section}{Index}
13939 % \PrintIndex
13940 %
13941 % \section*{}
13942 % \addcontentsline{toc}{section}{Change History}
13943 % \PrintChanges
13944 % \endinput
13945 \endinput
13946
13947 %% \CharacterTable
13948 %% {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
13949 %% 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
13950 %% Digits \0\1\2\3\4\5\6\7\8\9
13951 %% Exclamation \! Double quote \" Hash (number) \#
13952 %% Dollar \$ Percent \% Ampersand \&
13953 %% Acute accent \' Left paren \( Right paren \)
13954 %% Asterisk \* Plus \+ Comma \,
13955 %% Minus \- Point \. Solidus \/
13956 %% Colon \: Semicolon \; Less than \<
13957 %% Equals \= Greater than \> Question mark \?
13958 %% Commercial at \@ Left bracket \[ Backslash \\
13959 %% Right bracket \] Circumflex \^ Underscore \_
13960 %% Grave accent \` Left brace \{ Vertical bar \|
13961 %% Right brace \} Tilde \~}
13962 %%