Debian Codegraph @

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

raw
1 % \iffalse meta-comment
2 %
3 % ledpar.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 2004, 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 \CodelineIndex
39 \RecordChanges
40 %%\OnlyDescription
41 \renewcommand{\MakeUppercase}[1]{#1}
42 \pagestyle{headings}
43 \setcounter{StandardModuleDepth}{1}
44 \setcounter{IndexColumns}{2}
45 \usepackage[noeledmac]{ledmac}
46 \usepackage{ledpar}
47 \begin{document}
48 \raggedbottom
49 \DocInput{ledpar.dtx}
50 \end{document}
51 %</driver>
52 %
53 % \fi
54 %
55 % \CheckSum{4822}
56 %
57 % \makeatletter
58 % \newcommand*{\DescribeIt}{\leavevmode\@bsphack\begingroup\MakePrivateLetters
59 % \Describe@It}
60 % \newcommand*{\Describe@It}[1]{\endgroup
61 % \marginpar{\raggedleft\PrintDescribeEnv{#1}}%
62 % \SpecialItIndex{#1}\@esphack\ignorespaces}
63 % \newcommand*{\SpecialItIndex}[1]{\@bsphack
64 % \index{#1\actualchar{\protect\ttfamily#1}\encapchar usage}\@esphack}
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}
118 %
119 % \GetFileInfo{ledpar.sty}
120 % \newcommand{\dtxfilename}{\texttt{ledpar.dtx}}
121 % \changes{v0.1}{2004/12/10}{First public release}
122 % \changes{v0.2}{2005/01/01}{Fix babel problems}
123 % \changes{v0.3}{2005/03/24}{Reorganize for ledarab}
124 % \changes{v0.3a}{2005/03/30}{Minor \cs{linenummargin} fix}
125 % \changes{v0.3b}{2005/04/08}{Improved parallel page balancing}
126 % \changes{v0.3c}{2011/06/16}{Compatibilty with Polyglossia}
127 % \changes{v0.4}{2011/08/03}{No more ledparpatch. All patches are now in the main file.}
128 % \changes{v0.5}{2011/08/21}{Corrections about \cs{section} and other titles in numbered sections}
129 % \changes{v0.6}{2011/08/22}{Be able to us \cs{chapter} in parallel pages.}
130 % \changes{v0.7}{2011/08/31}{Option `shiftedverses' which make there is no blank between two parallel verses with inequal length.}
131 % \changes{v0.8}{2011/09/16}{Possibility to have a symbol on each hanging of verses, like in the french typography. Redefine the commande \cs{hangingsymbol} to define the character.}
132 % \changes{v0.9}{2011/10/01}{Possibilty to number the pstart with the commands \cs{numberpstarttrue}.}
133 % \changes{v0.9.1}{2011/10/02}{The numbering of the pstarts restarts on each \cs{beginnumbering}.}
134 % \changes{v0.9.2}{2011/11/08}{Debug : with \cs{Columns}, the hanging indentation now runs on the left columns and the hanging symbol is shown only when \cs{stanza} is used.}
135 % \changes{v0.9.3}{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.}
136 % \changes{v0.10}{2011/04/04}{\cs{edlabel} commands which start a paragraph are now put in the right place.}
137 % \changes{v0.10}{2011/04/04}{\cs{edlabel} commands on the right side are now correctly indicated.}
138 % \changes{v0.13}{2011/04/04}{Report ledmac 0.14 debug of \cs{lineation}.}
139 % \hyphenation{man-u-script man-u-scripts}
140 % \changes{v0.14a}{2015/07/19}{Reledpar is released.}
141 % \hyphenation{man-u-script man-u-scripts}
142 %
143 % \newcommand{\Lpack}[1]{\textsf{#1}}
144 % \newcommand{\Lclass}[1]{\textsf{#1}}
145 % \newcommand{\file}[1]{\texttt{#1}}
146 % \newcommand{\ledpar}{ledpar}
147 % \newcommand{\ledmac}{ledmac}
148 % \newcommand{\Ledmac}{\Lpack{\ledmac}}
149 % \newcommand{\Ledpar}{\Lpack{\ledpar}}
150 % \newcommand{\edmac}{\texttt{EDMAC}}
151 % \newcommand{\tabmac}{\texttt{TABMAC}}
152 % \newcommand{\edstanza}{\texttt{EDSTANZA}}
153 % \newcommand{\PWcomment}[1]{}
154 % \newenvironment{PW}{\itshape}{}
155 % \renewenvironment{PW}{\sffamily}{}
156 % \newcommand{\texbook}{\textit{TeXbook}}
157 % \newcommand{\thetexbook}{\textit{The TeXbook}}
158 %
159 % ^^A PW added following as the definitions are at some unknown elsewhere
160 % \newcommand{\egstart}{}
161 % \newcommand{\egmid}{}
162 % \newcommand{\egend}{}
163 %
164 % \renewcommand{\egstart}{%
165 % \par
166 % \begingroup
167 % \centering
168 % \begin{minipage}{0.45\textwidth}}
169 % \renewcommand{\egmid}{%
170 % \end{minipage}\hfill\begin{minipage}{0.45\textwidth}}
171 % \renewcommand{\egend}{%
172 % \end{minipage}\par\endgroup}
173 %
174 % \title{Parallel typesetting for critical editions: \\
175 % the \Lpack{\ledpar} (deprecated) package\thanks{This file (\dtxfilename)
176 % has version number \fileversion, last revised \filedate.}}
177 % \author{%
178 % Peter Wilson \\
179 % Herries Press\thanks{\texttt{herries dot press at earthlink dot net}}\\
180 % Ma\"ieul Rouquette\thanks{\texttt{maieul at maieul dot net}}}
181 %
182 % \date{}
183 %
184 %
185 % \maketitle
186 %
187 %
188 % {\large\bfseries This is documentation of deprecated ledpar package. If your start your project, we suggest that you use reledpar instead. If for old projects you can't migrate to reledpar, you can continue to use this documentation and the ledpar package.}
189 % \begin{abstract}
190 % The \Ledmac{} package, which is based on the \PlainTeX\ set of
191 % \edmac\ macros, has been used for some time for typesetting critical
192 % editions. The \Ledpar{} package is an extension to \Ledmac{}
193 % which enables texts and their critical apparatus to be typeset in
194 % parallel, either in two columns or on pairs of facing pages.
195 %
196 % 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.
197 %
198 % You can subscribe to the eledmac email list in:\\ \url{https://lists.berlios.de/pipermail/ledmac-users/}
199 % \end{abstract}
200 %
201 % \tableofcontents
202 %
203 % \listoffigures
204 %
205 %
206 % \section{Introduction}
207 %
208 % The \edmac{} macros \cite{EDMACTUG} for typesetting critical editions
209 % of texts
210 % have been available for use with TeX for some years. Since \edmac{}
211 % became available there had been a small but constant demand for a
212 % version of \edmac{} that could be used with LaTeX. The \Ledmac{}
213 % package was introduced in 2003 in an attempt to satisfy that request.
214 %
215 % Some critical editions contain texts in more than one form, such as
216 % a set of verses in one language and their translations in another. In
217 % such cases there is a desire to be able to typeset the two texts, together
218 % with any critical apparatus, in parallel. The \Ledpar{} package
219 % is an extension to \Ledmac{} that enables two texts and their
220 % apparatus to be set in parallel, either in two columns or on pairs of
221 % facing pages.
222 %
223 % The package has to try and coerce \TeX{} into paths it was not designed
224 % for. Use of the package, therefore, may produce some surprising results.
225 %
226 % This manual contains a general description of how to use
227 % \Ledpar{} starting in section~\ref{howto};
228 % the complete source code for the package,
229 % with extensive documentation (in sections~\ref{overview}
230 % through \ref{end});
231 % and an Index to the source code. As \Ledpar{} is an adjunct to \Ledmac{}
232 % I assume that you have read the \Ledmac{} manual. Also \Ledpar{} requires
233 % \Ledmac{} to be used, preferably at least version 0.10 (2011/08/22).
234 % You do not need to read the source code for this package in order to
235 % use it but doing so may help to answer any questions you might have.
236 % On a first reading,
237 % I suggest that you should skip anything after the general documentation in
238 % sections~\ref{howto} until~\ref{overview},
239 % unless you are particularly interested in the innards of \Ledpar.
240 %
241 %
242 % \section{The \Lpack{\ledpar} package}\label{howto}
243 %
244 % A file may mix \emph{numbered} and \emph{unnumbered} text.
245 % Numbered text is printed with marginal line numbers and can include
246 % footnotes and endnotes that are referenced to those line numbers:
247 % this is how you'll want to print the text that you're editing.
248 % Unnumbered text is not printed with line numbers, and you can't
249 % use \Ledmac's note commands with it: this is appropriate for
250 % introductions and other material added by the editor around the
251 % edited text.
252 %
253 % The \Ledpar{} package lets you typeset two \emph{numbered} texts in
254 % parallel. This can be done either as setting the `Leftside' and `Rightside'
255 % texts in two columns or on facing pages.
256 % In the paired pages case footnotes are placed at the bottom of the page
257 % on which they are called out --- that is, footnotes belonging to the left
258 % are set at the foot of a left (even numbered) page, and those for right
259 % texts are at the bottom of the relevant right (odd numbered) page. However,
260 % in the columnar case, all footnotes are set at the bottom left of the
261 % page on which they are called out --- they are not set below the
262 % relevant column.
263 % The line numbering schemes need not be the same for the two texts.
264 %
265 % \subsection{General}
266 %
267 % \Ledmac{} essentially puts each chunk of numbered text
268 % (the text within a \cs{pstart} \ldots \cs{pend}) into a box and then
269 % following the \cs{pend} extracts the text line by line from the box
270 % to number and print it. More precisely, the text is first put into the
271 % the box as though it was being typeset as normal onto a page and
272 % any notes are stored without being typeset. Then each typeset line
273 % is extracted from the box and any notes for that line are recalled.
274 % The line, with any notes, is then output for printing, possibly with
275 % a line number attached. Effectively, all the text is typeset and then
276 % afterwards all the notes are typeset.
277 %
278 %
279 % \Ledpar{} similarly puts the left and right chunks into boxes but can't
280 % immediately output the text after a \cs{pend} --- it has to wait until
281 % after both the left and right texts have been collected before it can
282 % start processing. This means that several boxes are required and possibly
283 % TeX has to store a lot of text in its memory; both the number of potential
284 % boxes and memory are limited. If TeX's memory is overfilled the recourse is
285 % to reduce the amount of text stored before printing.
286 %
287 % \DescribeMacro{\maxchunks}
288 % It is possible to have multiple chunks in the left and right texts before
289 % printing them. The macro \cs{maxchunks}\marg{num} specifies the maximum
290 % number of chunks within the left or right texts. This is initially set as: \\
291 % \verb?\maxchunks{10}? \\
292 % meaning that there can be up to 10 chunks in the left text and up to
293 % 10 chunks in
294 % the right text, requiring a total of 20 boxes. If you need more chunks
295 % then you can increase \cs{maxchunks}. The \cs{maxchunks} must be called in the preamble.
296 %
297 % TeX has a limited number of boxes; if you get an error
298 % message along the lines of `no room for a new box', then load the package etex, which needs pdflatex or xelatex. If you \cs{maxchunks} is too little
299 %you can get a \Ledmac{} error message along the
300 % lines: `Too many \cs{pstart} without printing. Some text will be lost.'
301 % then you will have to either increase \cs{maxchunks} or use the
302 % parallel printing commands (\cs{Columns} or \cs{Pages}) more frequently.
303 %
304 % When typesetting verse using \cs{syntax}, each line is treated as a chunk,
305 % so be warned that if you are setting parallel verses you might have to
306 % increase \cs{maxchunks} much more than it appears at first sight.
307 %
308 % In general, \Ledmac{} is a TeX resource hog, and \Ledpar{} only
309 % makes things worse in this respect.
310 %
311 % \section{Parallel columns}\label{columns}
312 %
313 % \DescribeEnv{pairs}
314 % Numbered text that is to be set in columns must be within a \verb?pairs?
315 % environment. Within the environment the text for the lefthand and righthand
316 % columns is placed within the \verb?Leftside? and \verb?Rightside?
317 % environments, respectively; these are described in more detail below
318 % in section~\ref{leftright}.
319 %
320 % \DescribeMacro{\Columns}
321 % The command \cs{Columns} typesets the texts in the previous pair of
322 % \verb?Leftside? and \verb?Rightside? environments.
323 % The general scheme for parallel columns looks like this:
324 % \begin{verbatim}
325 % \begin{pairs}
326 % \begin{Leftside} ... \end{Leftside}
327 % \begin{Rightside} ... \end{Rightside}
328 % \Columns
329 % \begin{Leftside} ... \end{Leftside}
330 % ...
331 % \Columns
332 % \end{pairs}
333 % \end{verbatim}
334 %
335 % There is no required pagebreak before or after the columns.
336 %
337 % \DescribeMacro{\Lcolwidth}
338 % \DescribeMacro{\Rcolwidth}
339 % The lengths \cs{Lcolwidth} and \cs{Rcolwidth} are the widths of the left
340 % and right columns, respectively. By default, these are: \\
341 % \verb?\setlength{\Lcolwidth}{0.45\textwidth}? \\
342 % \verb?\setlength{\Rcolwidth}{0.45\textwidth}? \\
343 % They may be adjusted if one text tends to be `bulkier' than the other.
344 %
345 % \DescribeMacro{\columnrulewidth}
346 % \DescribeMacro{\columnseparator}
347 % The macro \cs{columnseparator} is called between each left/right pair
348 % of lines. By default it inserts a vertical rule of width
349 % \cs{columnrulewidth}. As this is initially defined to be 0pt the rule
350 % is invisible. For a visible rule between the columns you could try: \\
351 % \verb?\setlength{\columnrulewidth}{0.4pt}? \\
352 % You can also modify \cs{columnseparator} if you want more control.
353 % When you use \cs{stanza}, the visible rule may shift when a verse has a hanging indent. To prevent shifting, use \cs{setstanzaindents} outside the \verb|Leftside| or \verb|Rightside| environment.
354 %
355 %
356 % \section{Facing pages}\label{pages}
357 %
358 % \DescribeEnv{pages}
359 % Numbered text that is to be set on facing pages must be within a \verb?pages?
360 % environment. Within the environment the text for the lefthand and righthand
361 % pages is placed within the \verb?Leftside? and \verb?Rightside?
362 % environments, respectively.
363 %
364 % \DescribeMacro{\Pages}
365 % The command \cs{Pages} typesets the texts in the previous pair of
366 % \verb?Leftside? and \verb?Rightside? environments.
367 % The general scheme for parallel pages looks like this:
368 % \begin{verbatim}
369 % \begin{pages}
370 % \begin{Leftside} ... \end{Leftside}
371 % \begin{Rightside} ... \end{Rightside}
372 % \Pages
373 % \begin{Leftside} ... \end{Leftside}
374 % ...
375 % \Pages
376 % \end{pages}
377 % \end{verbatim}
378 % The \verb?Leftside? text is set on lefthand (even numbered) pages and
379 % the \verb?Rightside? text is set on righthand (odd numbered) pages.
380 % Each \cs{Pages} command starts a new even numbered page. After parallel
381 % typesetting is finished, a new page is started.
382 %
383 % \DescribeMacro{\Lcolwidth}
384 % \DescribeMacro{\Rcolwidth}
385 % Within the \verb?pages? environment the lengths \cs{Lcolwidth} and
386 % \cs{Rcolwidth} are the widths of the left
387 % and right pages, respectively. By default, these are set to the normal
388 % textwidth for the document, but can be changed within the environment if
389 % necessary.
390 %
391 % \DescribeMacro{\goalfraction}
392 % When doing parallel pages \Ledpar{} has to guess where TeX is going to
393 % put pagebreaks and hopefully get there first in order to put the pair of
394 % texts on their proper pages. When it thinks that the fraction
395 % \cs{goalfraction} of a page has been filled, it finishes that page and
396 % starts on the other side's text. The definition is: \\
397 % \verb?\newcommand*{\goalfraction}{0.9}? \\
398 % If you think you can get more on a page, increase this. On the other hand,
399 % if some left text overflows onto an odd numbered page or some right text
400 % onto an even page, try reducing it, for instance by: \\
401 % \verb?\renewcommand*{\goalfraction}{0.8}?
402 %
403 % \section{Left and right texts}\label{leftright}
404 %
405 % Parallel texts are divided into Leftside and Rightside. The form of the
406 % contents of these two are independent of whether they will be set
407 % in columns or pages.
408 %
409 % \DescribeEnv{Leftside}
410 % \DescribeEnv{Rightside}
411 % The left text is put within the \verb?Leftside? environment and the
412 % right text likewise in the \verb?Rightside? environment. The number of
413 % \verb?Leftside? and \verb?Rightside? environments must be the same.
414 %
415 % Within these environments you can designate the line numbering scheme(s)
416 % to be used.
417 % \DescribeMacro{\firstlinenum}
418 % \DescribeMacro{\linenumincrement}
419 % \DescribeMacro{\firstsublinenum}
420 % \DescribeMacro{\sublinenumincrement}
421 % The \Ledmac{} package originally used counters for specifying the
422 % numbering scheme; now both \Ledmac\footnote{when used with \Lpack{ledpatch}
423 % v0.2 or greater.} and
424 % the \Ledpar{} package use macros instead. Following
425 % \cs{firstlinenum}\marg{num} the first line number will be \meta{num}, and
426 % following \cs{linenumincrement}\marg{num} only every \meta{num}th
427 % line will have a printed number. Using these macros inside the
428 % \verb?Leftside? and \verb?Rightside? environments gives you independent
429 % control over the left and right numbering schemes. The \cs{firstsublinenum}
430 % and \cs{sublinenumincrement} macros correspondingly set the numbering
431 % scheme for sublines.
432 %
433 % \DescribeMacro{\pstart}
434 % \DescribeMacro{\pend}
435 % In a serial (non-parallel) mode, each numbered paragraph, or chunk,
436 % is contained
437 % between the \cs{pstart} and \cs{pend} macros, and the paragraph is output
438 % when the \cs{pend} macro occurs. The situation is somewhat different
439 % with parallel typesetting as the left text (contained within \cs{pstart}
440 % and \cs{pend} groups within the \verb?Leftside? environment) has to be
441 % set in parallel with the right text (contained within its own \cs{pstart}
442 % and \cs{pend} groups within the corresponding \verb?Rightside? environment)
443 % the \cs{pend} macros cannot immediately initiate any typesetting ---
444 % this has to be controlled by the \cs{Columns} or \cs{Pages} macros.
445 % Several chunks may be specified within a \verb?Leftside? or
446 % \verb?Rightside? environment.
447 % A multi-chunk text then looks like:
448 % \begin{verbatim}
449 % \begin{...side}
450 % % \beginnumbering
451 % \pstart first chunk \pend
452 % \pstart second chunk \pend
453 % ...
454 % \pstart last chunk \pend
455 % % \endnumbering
456 % \end{...side}
457 % \end{verbatim}
458 % Numbering, via \cs{beginnumbering} and \cs{endnumbering}, may extend
459 % across several \verb?Leftside? or \verb?Rightside? environments.
460 % Remember, though,
461 % that the Left/Right sides are effectively independent of each other.
462 %
463 % Generally speaking, controls like \cs{firstlinenum} or \cs{linenummargin}
464 % apply to sequential and left texts. To effect right texts only they have
465 % to be within a \verb?Rightside? environment.
466
467 % If you are using the
468 % \Lpack{babel} package with different languages
469 % (via, say, \cs{selectlanguage}) for the left and right texts it is
470 % particularly important to select the appropriate language within the
471 % \verb?Leftside? and \verb?Rightside? environments. The initial language
472 % selected for the right text is the \Lpack{babel} package's default. Also,
473 % it is the \emph{last} \cs{selectlanguage} in a side that controls the
474 % language used in any notes for that side when they get printed. If
475 % you are using multilingual notes then it is probably safest to explicitly
476 % specify the language(s) for each note rather than relying on the language
477 % selection for the side. The right side language is also
478 % applied to the right side line numbers.
479 %
480 % Corresponding left and right sides must have the same number of
481 % paragraph chunks --- if there are four on the left there must be four
482 % on the right, even if some are empty. The start of each pair of left and
483 % right chunks are aligned horizontally on the page. The ends may
484 % come at different positions --- if one chunk is shorter than the other
485 % then blank lines are output on the shorter side until the end of the longer
486 % chunk is reached.
487 %
488 % \section{Numbering text lines and paragraphs}
489 %
490 % \DescribeMacro{\beginnumbering}
491 % \DescribeMacro{\endnumbering}
492 % Each section of numbered text must be preceded by
493 % \cs{beginnumbering} and followed by \cs{endnumbering}, like: \\
494 % \cs{beginnumbering} \\
495 % \meta{text} \\
496 % \cs{endnumbering} \\
497 % These have to be separately specified within \verb?Leftside? and
498 % \verb?Rightside? environments.
499 %
500 % The \cs{beginnumbering} macro resets the line number to zero,
501 % reads an auxiliary file called \meta{jobname}.\file{nn} (where
502 % \meta{jobname} is the name of the main input file for this job,
503 % and \file{nn} is 1 for the first numbered section, 2 for
504 % the second section, and so on), and then creates a new version of
505 % this auxiliary file to collect information during this run.
506 % Separate auxiliary files are unmaintained for right hand texts and
507 % these are named \meta{jobname}.\file{nnR}, using the `R' to distinguish
508 % them from the left hand and serial (non-parallel) texts.
509 %
510 % \DescribeMacro{\memorydump}
511 % The command \cs{memorydump} effectively performs an \cs{endumbering}
512 % immediately followed by a \cs{beginnumbering} while not restarting the
513 % numbering sequence. This has the effect of clearing TeX's memory of previous
514 % texts and any associated notes, allowing
515 % longer apparent streams of parallel texts. The command should be applied
516 % to both left and right texts, and after making sure that all previous
517 % notes have been output. For example, along the lines of:
518 % \begin{verbatim}
519 % \begin{Leftside}
520 % \beginnumbering
521 % ...
522 % \end{Leftside}
523 % \begin{Rightside}
524 % \beginnumbering
525 % ...
526 % \end{Rightside}
527 % \Pages
528 % \begin{Leftside}
529 % \memorydump
530 % ...
531 % \end{Leftside}
532 % \begin{Rightside}
533 % \memorydump
534 % ...
535 % \end{verbatim}
536 %
537 % \DescribeMacro{\Rlineflag}
538 % The value of \cs{Rlineflag} is appended to the line numbers of the
539 % right texts. Its default definition is: \\
540 % \verb?\newcommand*{\Rlineflag}{R}? \\
541 % This may be useful for parallel columns but for parallel pages it might
542 % be more appropriate to redefine it as: \\
543 % \verb?\renewcommand*{\Rlineflag}{}?.
544 %
545 % \DescribeMacro{\printlinesR}
546 % \DescribeMacro{\ledsavedprintlines}
547 % The \cs{printlines} macro is ordinarily used to print the line number
548 % references for critical footnotes. For footnotes from right side texts
549 % a special version is supplied, called \cs{printlinesR}, which incorporates
550 % \cs{Rlineflag}. (The macro \cs{ledsavedprintlines} is a copy of the original
551 % \cs{printlines}, just in case \ldots). As provided, the package makes no
552 % use of \cs{printlinesR} but you may find it useful. For example, if you only
553 % use the B footnote series in righthand texts then you may wish to flag
554 % any line numbers in those footnotes with the value of \cs{Rlineflag}. You
555 % could do this by putting the following code in your preamble:
556 % \begin{verbatim}
557 % \let\oldBfootfmt\Bfootfmt
558 % \renewcommand{\Bfootfmt}[3]{%
559 % \let\printlines\printlinesR
560 % \oldBfootfmt{#1}{#2}{#3}}
561 % \end{verbatim}
562 %
563 %
564 %
565 %\changes{v0.9}{2011/10/01}{Possibility to number \cs{pstart}.}
566 % 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 numerotation with \DescribeMacro{\numberpstartfalse}\cs{numberpstartfalse}. You can redefine the commands \DescribeMacro{\thepstartL}\cs{thepstartL} and \DescribeMacro{\thepstartR}\cs{thepstartR} to change style. The numbering restarts on each \cs{beginnumbering}
567 % \section{Verse}
568 %
569 % If you are typesetting verse with \Ledmac{} you can use the \cs{stanza}
570 % construct, and you can also use this in right or left parallel texts.
571 % In this case each verse line is a chunk which has two implications.
572 % (1) you can unexpectedly exceed the \cs{maxchunks} limit or the overall
573 % limit on the number of boxes, and (2) left and right verse lines are
574 % matched, which may not be desirable if one side requires more print lines
575 % for verse lines than the other does.
576 %
577 % \DescribeEnv{astanza}
578 % \Ledpar{} provides an \verb?astanza? environment which you can use instead
579 % of \cs{stanza} (simply replace \verb?\stanza? by \verb?\begin{astanza}? and
580 % add \verb?\end{astanza}? after the ending \verb?\&?). Within the
581 % \verb?astanza? environment each verse line is treated as a paragraph,
582 % so there must be no blank lines in the environment otherwise there will
583 % be some extraneous vertical spacing.
584 %
585 % If you get an error message along the lines of `Missing number,
586 % treated as zero \cs{sza@0@}' it is because you have forgotten to use
587 % \cs{setstanzaindents} to set the stanza indents.
588 %
589 % \DescribeMacro{\skipnumbering}
590 % The command \cs{skipnumbering} when inserted in a line of parallel text
591 % causes the numbering of that particular line to be skipped. This can
592 % useful if you are putting some kind of marker (even if it is only a
593 % blank line) between stanzas. Remember, parallel texts must be numbered
594 % and this provides a way to slip in an `unnumbered' line.
595 %
596 % The \verb?astanza? environment forms a chunk but you may want to
597 % have more than one stanza within the chunk. Here are a couple of ways of
598 % doing that with a blank line between each internal stanza, and with
599 % each stanza numbered. First some preliminary definitions:
600 % \begin{verbatim}
601 % \newcommand*{\stanzanum}[2][\stanzaindentbase]{%
602 % \hskip -#1\llap{\textbf{#2}}\hskip #1\ignorespaces}
603 % \newcommand{\interstanza}{\par\mbox{}\skipnumbering}
604 % \end{verbatim}
605 % And now for two stanzas in one. In this first example the line numbering
606 % repeats for each stanza.
607 % \begin{verbatim}
608 % \setstanzaindents{1,0,1,0,1,0,1,0,1,0,1}
609 % \begin{pairs}
610 % \begin{Leftside}
611 % \firstlinenum{2}
612 % \linenumincrement{1}
613 % \beginnumbering
614 % \begin{astanza}
615 % \stanzanum{1} First in first stanza &
616 % Second in first stanza &
617 % Second in first stanza &
618 % Third in first stanza &
619 % Fourth in first stanza &
620 % \interstanza
621 % \setline{2}\stanzanum{2} First in second stanza &
622 % Second in second stanza &
623 % Second in second stanza &
624 % Third in second stanza &
625 % Fourth in second stanza \&
626 % \end{astanza}
627 % ...
628 % \end{verbatim}
629 % And here is a slightly different way of doing the same thing, but with
630 % the line numbering being continuous.
631 % \begin{verbatim}
632 % \setstanzaindents{1,0,1,0,1,0,0,1,0,1,0,1}
633 % \begin{pairs}
634 % \begin{Leftside}
635 % \firstlinenum{2}
636 % \linenumincrement{1}
637 % \beginnumbering
638 % \begin{astanza}
639 % \stanzanum{1} First in first stanza &
640 % Second in first stanza &
641 % Second in first stanza &
642 % Third in first stanza &
643 % Fourth in first stanza &
644 % \strut &
645 % \stanzanum{2}\advanceline{-1} First in second stanza &
646 % Second in second stanza &
647 % Second in second stanza &
648 % Third in second stanza &
649 % Fourth in second stanza \&
650 % \end{astanza}
651 % ...
652 % \end{verbatim}
653 %
654 %
655 %
656 % \DescribeMacro{\hangingsymbol}Like in ledmac, you could redefine the command \cmd{\hangingsymbol} to insert a character in each hanged line. If you use it, you must run \LaTeX two time. Example for the french typographie
657 %\begin{verbatim}
658 %\renewcommand{\hangingsymbol}{[\,}
659 %\end{verbatim}
660 % \StopEventually{}
661 %
662 % \clearpage
663 % \section{Implementation overview}\label{overview}
664 %
665 % TeX is designed to process a single stream of text, which may include
666 % footnotes, tables, and so on. It just keeps converting its input into
667 % a stream typeset pages. It was not designed for typesetting two texts
668 % in parallel, where it has to alternate from one to the other. Further,
669 % TeX essentially processes its input one paragraph at a time --- it is
670 % very difficult to get at the `internals' of a paragraph such as the
671 % individual lines in case you want to number them or put some mark at the
672 % start or end of the lines.
673 %
674 % \Ledmac{} solves the problem of line numbering by putting the paragraph
675 % in typeset form into a box, and then extracting the lines one by one
676 % from the box for TeX to put them onto the page with the appropriate page
677 % breaks. Most of the \Ledmac{} code is concerned with handling this box
678 % and its contents.
679 %
680 % \Ledpar's solution to the problem of parallel texts is to put the two
681 % texts into separate boxes, and then appropriately extract the pairs of
682 % lines from the boxes. This involves duplicating
683 % much of the original box code for an extra right text box. The other,
684 % smaller,
685 % part of the code is concerned with coordinating the line extractions from
686 % the boxes.
687 %
688 % The package code is presented in roughly in the same order as in \Ledmac.
689 %
690 % \section{Preliminaries}
691 % \label{preliminaries}\relax
692 %
693 % Announce the name and version of the package, which is
694 % targetted for LaTeX2e. The package also requires the \Ledmac{}
695 % package, preferably at least version 0.13 (2011/11/08).
696 %
697 % \begin{macrocode}
698 %<*code>
699 \NeedsTeXFormat{LaTeX2e}
700 \ProvidesPackage{ledpar}[2015/07/19 v0.14a ledmac extension for parallel texts]
701
702 % \end{macrocode}
703 % With the option `shiftedverses' a long verse one the left side (or in the right side) don't make a blank on the corresponding verse, but the blank is put on the bottom of the page. Consequently, the verses on the parallel pages are shifted, but the shifted stop at every end of pages.
704 %
705 % \begin{macrocode}
706 \newif\ifshiftedverses
707 \shiftedversesfalse
708 \DeclareOption{shiftedverses}{\shiftedversestrue}
709 \ProcessOptions
710 % \end{macrocode}
711 % As noted above, much of the code is a duplication of the original
712 % \Ledmac{} code to handle the extra box(es) for the right hand side text,
713 % and sometimes for the left hand side as well. In order to distinguish
714 % I use `R' or `L' in the names of macros for the right and left code.
715 % The specifics of `L' and `R' are normally hidden from the user by
716 % letting the \verb?Leftside? and \verb?Rightside? environments set things
717 % up appropriately.
718 %
719 % \begin{macro}{\ifl@dpairing}
720 % \begin{macro}{\ifl@dpaging}
721 % \begin{macro}{\ifledRcol}
722 % \cs{ifl@dpairing} is set TRUE if we are processing parallel texts and
723 % \cs{ifl@dpaging} is also set TRUE if we are doing parallel pages.
724 % \cs{ifledRcol} is set TRUE if we are doing the right hand text.
725 % \cs{ifl@dpairing} is defined in \Lpack{ledmac}.
726 % \changes{v0.3}{2005/02/24}{Moved \cs{ifl@dpairing} to ledmac}
727 % \changes{v0.9}{2005/10/01}{Moved \cs{iflledRcol} and \cs{ifnumberingR} to ledmac}
728 % \begin{macrocode}
729 \l@dpairingfalse
730 \newif\ifl@dpaging
731 \l@dpagingfalse
732 \ledRcolfalse
733 % \end{macrocode}
734 % \end{macro}
735 % \end{macro}
736 % \end{macro}
737 %
738 % \begin{macro}{\Lcolwidth}
739 % \begin{macro}{\Rcolwidth}
740 % The widths of the left and right parallel columns (or pages).
741 % \begin{macrocode}
742 \newdimen\Lcolwidth
743 \Lcolwidth=0.45\textwidth
744 \newdimen\Rcolwidth
745 \Rcolwidth=0.45\textwidth
746
747 % \end{macrocode}
748 % \end{macro}
749 % \end{macro}
750 %
751 % \subsection{Messages}
752 %
753 % All the error and warning messages are collected here as macros.
754 %
755 % \begin{macro}{\led@err@TooManyPstarts}
756 % \begin{macrocode}
757 \newcommand*{\led@err@TooManyPstarts}{%
758 \ledmac@error{Too many \string\pstart\space without printing.
759 Some text will be lost}{\@ehc}}
760 % \end{macrocode}
761 % \end{macro}
762 %
763 % \begin{macro}{\led@err@BadLeftRightPstarts}
764 % \begin{macrocode}
765 \newcommand*{\led@err@BadLeftRightPstarts}[2]{%
766 \ledmac@error{The numbers of left (#1) and right (#2)
767 \string\pstart s do not match}{\@ehc}}
768 % \end{macrocode}
769 % \end{macro}
770 %
771 % \begin{macro}{\led@err@LeftOnRightPage}
772 % \begin{macro}{\led@err@RightOnLeftPage}
773 % \begin{macrocode}
774 \newcommand*{\led@err@LeftOnRightPage}{%
775 \ledmac@error{The left page has ended on a right page}{\@ehc}}
776 \newcommand*{\led@err@RightOnLeftPage}{%
777 \ledmac@error{The right page has ended on a left page}{\@ehc}}
778 % \end{macrocode}
779 % \end{macro}
780 % \end{macro}
781 %
782 %
783 % \section{Sectioning commands}
784 %
785 % \begin{macro}{\section@numR}
786 % This is the right side equivalent of \cs{section@num}.
787 %
788 % Each section will read and write an associated `line-list
789 % file', containing information used to do the numbering. Normally
790 % the file will be called \meta{jobname}\file{.nn}, where \file{nn} is the
791 % section number. However, for right side texts the file is called
792 % \meta{jobname}\file{.nnR}. The \cs{extensionchars} applies to the
793 % right side files just as it does to the normal files.
794 % \begin{macrocode}
795 \newcount\section@numR
796 \section@numR=\z@
797 % \end{macrocode}
798 % \end{macro}
799 %
800 %
801 % \begin{macro}{\ifpst@rtedL}
802 % \begin{macro}{\ifpst@rtedR}
803 % \cs{ifpst@rtedL} is set FALSE at the start of left side numbering, and
804 % similarly for \cs{ifpst@rtedR}.
805 % \cs{ifpst@rtedL} is defined in \Lpack{ledmac}.
806 % \changes{v0.3}{2005/02/24}{Moved \cs{ifpst@rtedL} to ledmac}
807 % \begin{macrocode}
808 \pst@rtedLfalse
809 \newif\ifpst@rtedR
810 \pst@rtedRfalse
811
812 % \end{macrocode}
813 % \end{macro}
814 % \end{macro}
815 %
816 % \begin{macro}{\beginnumbering}
817 % For parallel processing the original \cs{beginnumbering} is extended
818 % to zero \cs{l@dnumpstartsL} --- the number of chunks to be processed.
819 % It also sets \cs{ifpst@rtedL} to FALSE.
820 % \begin{macrocode}
821 \providecommand*{\beginnumbering}{%
822 \ifnumbering
823 \led@err@NumberingStarted
824 \endnumbering
825 \fi
826 \global\l@dnumpstartsL \z@
827 \global\pst@rtedLfalse
828 \global\numberingtrue
829 \global\advance\section@num \@ne
830 \initnumbering@reg
831 \message{Section \the\section@num}%
832 \line@list@stuff{\jobname.\extensionchars\the\section@num}%
833 \l@dend@stuff}
834 % \end{macrocode}
835 % \end{macro}
836 %
837 % \begin{macro}{\beginnumberingR}
838 % This is the right text equivalent of \cs{beginnumbering}, and begins
839 % a section of numbered text.
840 % \begin{macrocode}
841 \newcommand*{\beginnumberingR}{%
842 \ifnumberingR
843 \led@err@NumberingStarted
844 \endnumberingR
845 \fi
846 \global\l@dnumpstartsR \z@
847 \global\pst@rtedRfalse
848 \global\numberingRtrue
849 \global\advance\section@numR \@ne
850 \global\absline@numR \z@
851 \global\line@numR \z@
852 \global\@lockR \z@
853 \global\sub@lockR \z@
854 \global\sublines@false
855 \global\let\next@page@numR\relax
856 \global\let\sub@change\relax
857 \message{Section \the\section@numR R }%
858 \line@list@stuffR{\jobname.\extensionchars\the\section@numR R}%
859 \l@dend@stuff
860 \setcounter{pstartR}{1}
861 }
862
863 % \end{macrocode}
864 % \end{macro}
865 %
866 % \begin{macro}{\endnumbering}
867 % This is the left text version of the regular \cs{endnumbering} and must
868 % follow the last text for a left text numbered section.
869 % It sets \cs{ifpst@rtedL} to FALSE. It is fully defined in \Lpack{ledmac}.
870 % \end{macro}
871 %
872 % \begin{macro}{\endnumberingR}
873 % This is the right text equivalent of \cs{endnumbering} and must follow the
874 % last text for a right text numbered section.
875 % \begin{macrocode}
876 \def\endnumberingR{%
877 \ifnumberingR
878 \global\numberingRfalse
879 \normal@pars
880 \ifl@dpairing
881 \global\pst@rtedRfalse
882 \else
883 \ifx\insertlines@listR\empty\else
884 \global\noteschanged@true
885 \fi
886 \ifx\line@listR\empty\else
887 \global\noteschanged@true
888 \fi
889 \fi
890 \ifnoteschanged@
891 \led@mess@NotesChanged
892 \fi
893 \else
894 \led@err@NumberingNotStarted
895 \fi}
896
897 % \end{macrocode}
898 % \end{macro}
899 %
900 %
901 % \begin{macro}{\pausenumberingR}
902 % \begin{macro}{\resumenumberingR}
903 % These are the right text equivalents of \cs{pausenumbering} and
904 % \cs{resumenumbering}.
905 % \begin{macrocode}
906 \newcommand*{\pausenumberingR}{%
907 \endnumberingR\global\numberingRtrue}
908 \newcommand*{\resumenumberingR}{%
909 \ifnumberingR
910 \global\pst@rtedRtrue
911 \global\advance\section@numR \@ne
912 \led@mess@SectionContinued{\the\section@numR R}%
913 \line@list@stuffR{\jobname.\extensionchars\the\section@numR R}%
914 \l@dend@stuff
915 \else
916 \led@err@numberingShouldHaveStarted
917 \endnumberingR
918 \beginnumberingR
919 \fi}
920
921 % \end{macrocode}
922 % \end{macro}
923 % \end{macro}
924 %
925 % \begin{macro}{\memorydumpL}
926 % \begin{macro}{\memorydumpR}
927 % \cs{memorydump} is a shorthand for \cs{pausenumbering}\cs{resumenumbering}.
928 % This will clear the memorised stuff for the previous chunks while
929 % keeping the numbering going.
930 % \begin{macrocode}
931 \newcommand*{\memorydumpL}{%
932 \endnumbering
933 \numberingtrue
934 \global\pst@rtedLtrue
935 \global\advance\section@num \@ne
936 \led@mess@SectionContinued{\the\section@num}%
937 \line@list@stuff{\jobname.\extensionchars\the\section@num}%
938 \l@dend@stuff}
939 \newcommand*{\memorydumpR}{%
940 \endnumberingR
941 \numberingRtrue
942 \global\pst@rtedRtrue
943 \global\advance\section@numR \@ne
944 \led@mess@SectionContinued{\the\section@numR R}%
945 \line@list@stuffR{\jobname.\extensionchars\the\section@numR R}%
946 \l@dend@stuff}
947
948 % \end{macrocode}
949 % \end{macro}
950 % \end{macro}
951 %
952 %
953 %
954 % \section{Line counting}
955 % \label{lineation}\relax
956 %
957 % \subsection{Choosing the system of lineation}
958 %% \changes{v0.11}{2012/06/11}{Lineation can be by pstart (like in ledmac 0.15).}
959 % Sometimes you want line numbers that start at $1$ at the top of each
960 % 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
961 % of each section and increase regardless of page breaks.
962 % \Ledpar{} lets you choose different schemes for the left and right texts.
963 %
964 % \begin{macro}{\ifbypstart@R}
965 % \begin{macro}{\bypstart@Rtrue}
966 % \begin{macro}{\bypstart@Rfalse}
967 % \begin{macro}{\ifbypage@R}
968 % \begin{macro}{\bypage@Rtrue}
969 % \begin{macro}{\bypage@Rfalse}
970 % The \cs{ifbypage@R} and \cs{ifbypstart@R} flag specifie the current lineation
971 % system: \begin{itemize}
972 % \item line-of-page : \verb|bypstart@R = false| and \verb|bypage@R = true|.
973 % \item line-of-pstart : \verb|bypstart@R = true| and \verb|bypage@R = false|.
974 % \end{itemize}
975 % \Ledpar{} will use the line-of-section system unless instructed otherwise.
976 % \begin{macrocode}
977 \newif\ifbypage@R
978 \newif\ifbypstart@R
979 \bypage@Rfalse
980 \bypstart@Rfalse
981 % \end{macrocode}
982 % \end{macro}
983 % \end{macro}
984 % \end{macro}
985 % \end{macro}
986 % \end{macro}
987 % \end{macro}
988 %
989 % \begin{macro}{\lineationR}
990 % \cs{lineationR}\marg{word} is the macro used to select the
991 % lineation system for right texts.
992 % Its argument is a string: either \texttt{page}, \texttt{pstart} or \texttt{section}.
993 % \begin{macrocode}
994 \newcommand*{\lineationR}[1]{{%
995 \ifnumbering
996 \led@err@LineationInNumbered
997 \else
998 \def\@tempa{#1}\def\@tempb{page}%
999 \ifx\@tempa\@tempb
1000 \global\bypage@Rtrue
1001 \global\bypstart@Rfalse
1002 \else
1003 \def\@tempb{pstart}%
1004 \ifx\@tempa\@tempb
1005 \global\bypage@Rfalse
1006 \global\bypstart@Rtrue
1007 \else
1008 \def@tempb{section}
1009 \ifx\@tempa\@tempb
1010 \global\bypage@Rfalse
1011 \global\bypstart@Rfalse
1012 \else
1013 \led@warn@BadLineation
1014 \fi
1015 \fi
1016 \fi
1017 \fi}}
1018 % \end{macrocode}
1019 % \end{macro}
1020 %
1021 % \begin{macro}{\linenummargin}
1022 % \begin{macro}{\line@marginR}
1023 % You call \cs{linenummargin}\marg{word} to specify which margin you want your
1024 % right text's line numbers in; it takes one argument, a string.
1025 % You can put the line numbers in the same margin on every page using
1026 % \texttt{left} or \texttt{right}; or you can use \texttt{inner} or
1027 % \texttt{outer} to get them in the inner or outer margins.
1028 % You can change this within a numbered section, but the
1029 % change may not take effect just when you'd like; if it's done between
1030 % paragraphs nothing surprising should happen.
1031 %
1032 % For right texts the selection is recorded in the count \cs{line@marginR},
1033 % otherwise in the count \cs{line@margin}:
1034 % $0$ for left, $1$ for right, $2$ for outer, and $3$ for inner.
1035 % \changes{v0.3a}{2005/03/30}{Don't just set \cs{line@marginR} in \cs{linenummargin}}
1036 % \begin{macrocode}
1037 \newcount\line@marginR
1038 \renewcommand*{\linenummargin}[1]{{%
1039 \l@dgetline@margin{#1}%
1040 \ifnum\@l@dtempcntb>\m@ne
1041 \ifledRcol
1042 \global\line@marginR=\@l@dtempcntb
1043 \else
1044 \global\line@margin=\@l@dtempcntb
1045 \fi
1046 \fi}}
1047 % \end{macrocode}
1048 % By default put right text numbers at the right.
1049 % \begin{macrocode}
1050 \line@marginR=\@ne
1051
1052 % \end{macrocode}
1053 % \end{macro}
1054 % \end{macro}
1055 %
1056 % \begin{macro}{\c@firstlinenumR}
1057 % \begin{macro}{\c@linenumincrementR}
1058 % The following counters tell \Ledmac{} which right text lines should be
1059 % printed with line numbers. \texttt{firstlinenum} is the number of the
1060 % first line in each section that gets a number;
1061 % \texttt{linenumincrement}
1062 % is the difference between successive numbered lines. The initial
1063 % values of these counters produce labels on lines $5$, $10$, $15$, etc.
1064 % \texttt{linenumincrement} must be at least $1$.
1065 %
1066 % \begin{macrocode}
1067 \newcounter{firstlinenumR}
1068 \setcounter{firstlinenumR}{5}
1069 \newcounter{linenumincrementR}
1070 \setcounter{linenumincrementR}{5}
1071 % \end{macrocode}
1072 % \end{macro}
1073 % \end{macro}
1074 %
1075 % \begin{macro}{\c@firstsublinenumR}
1076 % \begin{macro}{\c@sublinenumincrementR}
1077 % The following parameters are just like \texttt{firstlinenumR} and
1078 % \texttt{linenumincrementR}, but for sub-line numbers.
1079 % \texttt{sublinenumincrementR} must be at least $1$.
1080 %
1081 % \begin{macrocode}
1082 \newcounter{firstsublinenumR}
1083 \setcounter{firstsublinenumR}{5}
1084 \newcounter{sublinenumincrementR}
1085 \setcounter{sublinenumincrementR}{5}
1086
1087 % \end{macrocode}
1088 % \end{macro}
1089 % \end{macro}
1090 %
1091 % \begin{macro}{\firstlinenum}
1092 % \begin{macro}{\linenumincrement}
1093 % \begin{macro}{\firstsublinenum}
1094 % \begin{macro}{\sublinenumincrement}
1095 % These are the user's macros for changing (sub) line numbers. They are
1096 % defined in \Lpack{ledmac} v0.7, but just in case
1097 % I have started by \cs{provide}ing them.
1098 % \begin{macrocode}
1099 \providecommand*{\firstlinenum}{}
1100 \providecommand*{\linenumincrement}{}
1101 \providecommand*{\firstsublinenum}{}
1102 \providecommand*{\sublinenumincrement}{}
1103 \renewcommand*{\firstlinenum}[1]{%
1104 \ifledRcol \setcounter{firstlinenumR}{#1}%
1105 \else \setcounter{firstlinenum}{#1}%
1106 \fi}
1107 \renewcommand*{\linenumincrement}[1]{%
1108 \ifledRcol \setcounter{linenumincrementR}{#1}%
1109 \else \setcounter{linenumincrement}{#1}%
1110 \fi}
1111 \renewcommand*{\firstsublinenum}[1]{%
1112 \ifledRcol \setcounter{firstsublinenumR}{#1}%
1113 \else \setcounter{firstsublinenum}{#1}%
1114 \fi}
1115 \renewcommand*{\sublinenumincrement}[1]{%
1116 \ifledRcol \setcounter{sublinenumincrementR}{#1}%
1117 \else \setcounter{sublinenumincrement}{#1}%
1118 \fi}
1119
1120 % \end{macrocode}
1121 % \end{macro}
1122 % \end{macro}
1123 % \end{macro}
1124 % \end{macro}
1125 %
1126 % \begin{macro}{\Rlineflag}
1127 % This is appended to the line numbers of right text.
1128 % \begin{macrocode}
1129 \newcommand*{\Rlineflag}{R}
1130
1131 % \end{macrocode}
1132 % \end{macro}
1133 %
1134 % \begin{macro}{\linenumrepR}
1135 % \begin{macro}{\sublinenumrepR}
1136 % \cs{linenumrepR}\marg{ctr} typesets the right line number \meta{ctr}, and
1137 % similarly \cs{sublinenumrepR} for subline numbers.
1138 % \changes{v0.3}{2005/02/10}{Added \cs{linenumrepR} and \cs{sublinenumrepR}}
1139 % \begin{macrocode}
1140 \newcommand*{\linenumrepR}[1]{\@arabic{#1}}
1141 \newcommand*{\sublinenumrepR}[1]{\@arabic{#1}}
1142
1143 % \end{macrocode}
1144 % \end{macro}
1145 % \end{macro}
1146 %
1147 % \begin{macro}{\leftlinenumR}
1148 % \begin{macro}{\rightlinenumR}
1149 % \begin{macro}{\l@dlinenumR}
1150 % \cs{leftlinenumR} and \cs{rightlinenumR} are the macros that are
1151 % called to print the right text's marginal line numbers. Much of the
1152 % code for these is common and is unmaintained in \cs{l@dlinenumR}.
1153 % \changes{v0.3}{2005/02/10}{Simplified \cs{leftlinenumR} and
1154 % \cs{rightlinenumR} by introducing \cs{l@dlinenumR}}
1155 % \begin{macrocode}
1156 \newcommand*{\leftlinenumR}{%
1157 \l@dlinenumR
1158 \kern\linenumsep}
1159 \newcommand*{\rightlinenumR}{%
1160 \kern\linenumsep
1161 \l@dlinenumR}
1162 \newcommand*{\l@dlinenumR}{%
1163 \numlabfont\linenumrepR{\line@numR}\Rlineflag%
1164 \ifsublines@
1165 \ifnum\subline@num>\z@
1166 \unskip\fullstop\sublinenumrepR{\subline@numR}%
1167 \fi
1168 \fi}
1169
1170 % \end{macrocode}
1171 % \end{macro}
1172 % \end{macro}
1173 % \end{macro}
1174 %
1175 %
1176 % \subsection{Line-number counters and lists}
1177 %
1178 % We need another set of counters and lists for the right text,
1179 % corresponding to those in \Lpack{ledmac} for regualr or left text.
1180 %
1181 % \begin{macro}{\line@numR}
1182 % \begin{macro}{\subline@numR}
1183 % \begin{macro}{\absline@numR}
1184 % The count \cs{line@numR} stores the line number that's used in
1185 % the right text's marginal line numbering and in notes.
1186 % The count \cs{subline@numR} stores
1187 % a sub-line number that qualifies \cs{line@numR}.
1188 % The count \cs{absline@numR} stores the
1189 % absolute number of lines since the start
1190 % of the right text section: that is, the number we've actually printed,
1191 % no matter what numbers we attached to them.
1192 %
1193 % \begin{macrocode}
1194 \newcount\line@numR
1195 \newcount\subline@numR
1196 \newcount\absline@numR
1197
1198 % \end{macrocode}
1199 % \end{macro}
1200 % \end{macro}
1201 % \end{macro}
1202 %
1203 % \begin{macro}{\line@listR}
1204 % \begin{macro}{\insertlines@listR}
1205 % \begin{macro}{\actionlines@listR}
1206 % \begin{macro}{\actions@listR}
1207 % Now we can define the list macros that will be created from the
1208 % line-list file. They are directly analagous to the left text ones.
1209 % The full list of action codes and their meanings is given in the \Ledmac{}
1210 % manual.
1211 %
1212 % Here are the commands to create these lists:
1213 %
1214 % \begin{macrocode}
1215 \list@create{\line@listR}
1216 \list@create{\insertlines@listR}
1217 \list@create{\actionlines@listR}
1218 \list@create{\actions@listR}
1219
1220 % \end{macrocode}
1221 % \end{macro}
1222 % \end{macro}
1223 % \end{macro}
1224 % \end{macro}
1225 %
1226 % \begin{macro}{\linesinpar@listL}
1227 % \begin{macro}{\linesinpar@listR}
1228 % \begin{macro}{\maxlinesinpar@list}
1229 % In order to synchonise left and right chunks in parallel processing
1230 % we need to know how many lines are in each left and right text chunk,
1231 % and the maximum of these for each pair of chunks.
1232 % \begin{macrocode}
1233 \list@create{\linesinpar@listL}
1234 \list@create{\linesinpar@listR}
1235 \list@create{\maxlinesinpar@list}
1236
1237 % \end{macrocode}
1238 % \end{macro}
1239 % \end{macro}
1240 % \end{macro}
1241 %
1242 % \begin{macro}{\page@numR}
1243 % The right text page number.
1244 % \begin{macrocode}
1245 \newcount\page@numR
1246
1247 % \end{macrocode}
1248 % \end{macro}
1249 %
1250 %
1251 % \subsection{Reading the line-list file}
1252 %
1253 %
1254 % \begin{macro}{\read@linelist}
1255 % \cs{read@linelist}\marg{file} is the control sequence
1256 % that's called by \cs{beginnumbering}
1257 % (via \cs{line@list@stuff}) to open and process a
1258 % line-list file; its argument is the name of the file.
1259 % \phantomsection\label{readlinelist}
1260 % \begin{macrocode}
1261 \renewcommand*{\read@linelist}[1]{%
1262 % \end{macrocode}
1263 % We do do different things depending whether or not we are processing
1264 % right text
1265 % \begin{macrocode}
1266 \ifledRcol
1267 \list@clear{\line@listR}%
1268 \list@clear{\insertlines@listR}%
1269 \list@clear{\actionlines@listR}%
1270 \list@clear{\actions@listR}%
1271 \list@clear{\linesinpar@listR}%
1272 \list@clear{\linesonpage@listR}
1273 \else
1274 \list@clearing@reg
1275 \list@clear{\linesinpar@listL}%
1276 \list@clear{\linesonpage@listL}%
1277 \fi
1278 % \end{macrocode}
1279 %
1280 % Make sure that the \cs{maxlinesinpar@list} is empty (otherwise things
1281 % will be thrown out of kilter if there is any old stuff still hanging
1282 % in there).
1283 % \begin{macrocode}
1284 \list@clear{\maxlinesinpar@list}
1285 % \end{macrocode}
1286 % Now get the file and interpret it.
1287 % \begin{macrocode}
1288 \get@linelistfile{#1}%
1289 \endgroup
1290 % \end{macrocode}
1291 %
1292 % When the reading is done, we're all through with the
1293 % line-list file. All the information we needed
1294 % from it will now be encoded in our list macros.
1295 % Finally, we
1296 % initialize the \cs{next@actionline} and \cs{next@action} macros,
1297 % which specify where and what the next action to be taken is.
1298 % \begin{macrocode}
1299 \ifledRcol
1300 \global\page@numR=\m@ne
1301 \ifx\actionlines@listR\empty
1302 \gdef\next@actionlineR{1000000}%
1303 \else
1304 \gl@p\actionlines@listR\to\next@actionlineR
1305 \gl@p\actions@listR\to\next@actionR
1306 \fi
1307 \else
1308 \global\page@num=\m@ne
1309 \ifx\actionlines@list\empty
1310 \gdef\next@actionline{1000000}%
1311 \else
1312 \gl@p\actionlines@list\to\next@actionline
1313 \gl@p\actions@list\to\next@action
1314 \fi
1315 \fi}
1316
1317 % \end{macrocode}
1318 % \end{macro}
1319 %
1320 % This version of \cs{read@linelist} creates list macros
1321 % containing data for the entire section, so they could get rather
1322 % large. The \cs{memorydump} macro is available if you run into
1323 % macro memory limitations.
1324 %
1325 % \subsection{Commands within the line-list file}
1326 %
1327 % This section defines the commands that can appear within a
1328 % line-list file, except for \cs{@lab} which is in a
1329 % later section among the cross-referencing commands it is
1330 % associated with.
1331 %
1332 % The macros with \verb"action" in their names contain all the code
1333 % that modifies the action-code list.
1334 % \begin{macro}{\@l@regR}
1335 % \begin{macro}{\@l}
1336 % \cs{@l} does everything related to the start of a
1337 % new line of numbered text. Exactly what it does depends
1338 % on whether right text is being processed.
1339 %
1340 % \begin{macrocode}
1341 \newcommand{\@l@regR}{%
1342 \ifx\l@dchset@num\relax \else
1343 \advance\absline@numR \@ne
1344 \set@line@action
1345 \let\l@dchset@num\relax
1346 \advance\absline@numR \m@ne
1347 \advance\line@numR \m@ne% % do we need this?
1348 \fi
1349 \advance\absline@numR \@ne
1350 \ifx\next@page@numR\relax \else
1351 \page@action
1352 \let\next@page@numR\relax
1353 \fi
1354 \ifx\sub@change\relax \else
1355 \ifnum\sub@change>\z@
1356 \sublines@true
1357 \else
1358 \sublines@false
1359 \fi
1360 \sub@action
1361 \let\sub@change\relax
1362 \fi
1363 \ifcase\@lockR
1364 \or
1365 \@lockR \tw@
1366 \or\or
1367 \@lockR \z@
1368 \fi
1369 \ifcase\sub@lockR
1370 \or
1371 \sub@lockR \tw@
1372 \or\or
1373 \sub@lockR \z@
1374 \fi
1375 \ifsublines@
1376 \ifnum\sub@lockR<\tw@
1377 \advance\subline@numR \@ne
1378 \fi
1379 \else
1380 \ifnum\@lockR<\tw@
1381 \advance\line@numR \@ne \subline@numR \z@
1382 \fi
1383 \fi}
1384
1385 \renewcommand*{\@l}[2]{%
1386 \fix@page{#1}%
1387 \ifledRcol
1388 \@l@regR
1389 \else
1390 \@l@reg
1391 \fi}
1392
1393 % \end{macrocode}
1394 % \end{macro}
1395 % \end{macro}
1396 % \begin{macro}{\last@page@numR}
1397 % \begin{macro}{\fix@page}
1398 % We have to adjust \cs{fix@page} to handle parallel texts.
1399 %
1400 % \begin{macrocode}
1401 \newcount\last@page@numR
1402 \last@page@numR=-10000
1403 \renewcommand*{\fix@page}[1]{%
1404 \ifledRcol
1405 \ifnum #1=\last@page@numR
1406 \else
1407 \ifbypage@R
1408 \line@numR \z@ \subline@numR \z@
1409 \fi
1410 \page@numR=#1\relax
1411 \last@page@numR=#1\relax
1412 \def\next@page@numR{#1}%
1413 \fi
1414 \else
1415 \ifnum #1=\last@page@num
1416 \else
1417 \ifbypage@
1418 \line@num \z@ \subline@num \z@
1419 \fi
1420 \page@num=#1\relax
1421 \last@page@num=#1\relax
1422 \def\next@page@num{#1}%
1423 \fi
1424 \fi}
1425
1426 % \end{macrocode}
1427 % \end{macro}
1428 % \end{macro}
1429 %
1430 %
1431 % \begin{macro}{\@adv}
1432 % The \cs{@adv}\marg{num} macro advances
1433 % the current visible line number by the amount specified as
1434 % its argument. This is used to implement \cs{advanceline}.
1435 % \begin{macrocode}
1436 \renewcommand*{\@adv}[1]{%
1437 \ifsublines@
1438 \ifledRcol
1439 \advance\subline@numR by #1\relax
1440 \ifnum\subline@numR<\z@
1441 \led@warn@BadAdvancelineSubline
1442 \subline@numR \z@
1443 \fi
1444 \else
1445 \advance\subline@num by #1\relax
1446 \ifnum\subline@num<\z@
1447 \led@warn@BadAdvancelineSubline
1448 \subline@num \z@
1449 \fi
1450 \fi
1451 \else
1452 \ifledRcol
1453 \advance\line@numR by #1\relax
1454 \ifnum\line@numR<\z@
1455 \led@warn@BadAdvancelineLine
1456 \line@numR \z@
1457 \fi
1458 \else
1459 \advance\line@num by #1\relax
1460 \ifnum\line@num<\z@
1461 \led@warn@BadAdvancelineLine
1462 \line@num \z@
1463 \fi
1464 \fi
1465 \fi
1466 \set@line@action}
1467
1468 % \end{macrocode}
1469 % \end{macro}
1470 %
1471 % \begin{macro}{\@set}
1472 % The \cs{@set}\marg{num} macro sets
1473 % the current visible line number to the value specified as
1474 % its argument. This is used to implement \cs{setline}.
1475 % \begin{macrocode}
1476 \renewcommand*{\@set}[1]{%
1477 \ifledRcol
1478 \ifsublines@
1479 \subline@numR=#1\relax
1480 \else
1481 \line@numR=#1\relax
1482 \fi
1483 \set@line@action
1484 \else
1485 \ifsublines@
1486 \subline@num=#1\relax
1487 \else
1488 \line@num=#1\relax
1489 \fi
1490 \set@line@action
1491 \fi}
1492
1493 % \end{macrocode}
1494 % \end{macro}
1495 %
1496 % \begin{macro}{\l@d@set}
1497 % \begin{macro}{\l@dchset@num}
1498 % The \cs{l@d@set}\marg{num} macro sets
1499 % the line number for the next \verb?\pstart...? to the value specified as
1500 % its argument. This is used to implement \cs{setlinenum}.
1501 %
1502 % \verb?\l@dchset@num? is a flag to the \verb?\@l? macro. If it is not
1503 % \verb?\relax? then a linenumber change is to be done.
1504 % \begin{macrocode}
1505 \renewcommand*{\l@d@set}[1]{%
1506 \ifledRcol
1507 \line@numR=#1\relax
1508 \advance\line@numR \@ne
1509 \def\l@dchset@num{#1}
1510 \else
1511 \line@num=#1\relax
1512 \advance\line@num \@ne
1513 \def\l@dchset@num{#1}
1514 \fi}
1515 \let\l@dchset@num\relax
1516
1517 % \end{macrocode}
1518 % \end{macro}
1519 % \end{macro}
1520 %
1521 % \begin{macro}{\page@action}
1522 % \cs{page@action}
1523 % adds an entry to the action-code list to change the page number.
1524 % \begin{macrocode}
1525 \renewcommand*{\page@action}{%
1526 \ifledRcol
1527 \xright@appenditem{\the\absline@numR}\to\actionlines@listR
1528 \xright@appenditem{\next@page@numR}\to\actions@listR
1529 \else
1530 \xright@appenditem{\the\absline@num}\to\actionlines@list
1531 \xright@appenditem{\next@page@num}\to\actions@list
1532 \fi}
1533 % \end{macrocode}
1534 % \end{macro}
1535 %
1536 % \begin{macro}{\set@line@action}
1537 % \cs{set@line@action} adds an entry to the action-code
1538 % list to change the visible line number.
1539 % \begin{macrocode}
1540 \renewcommand*{\set@line@action}{%
1541 \ifledRcol
1542 \xright@appenditem{\the\absline@numR}\to\actionlines@listR
1543 \ifsublines@
1544 \@l@dtempcnta=-\subline@numR
1545 \else
1546 \@l@dtempcnta=-\line@numR
1547 \fi
1548 \advance\@l@dtempcnta by -5000\relax
1549 \xright@appenditem{\the\@l@dtempcnta}\to\actions@listR
1550 \else
1551 \xright@appenditem{\the\absline@num}\to\actionlines@list
1552 \ifsublines@
1553 \@l@dtempcnta=-\subline@num
1554 \else
1555 \@l@dtempcnta=-\line@num
1556 \fi
1557 \advance\@l@dtempcnta by -5000\relax
1558 \xright@appenditem{\the\@l@dtempcnta}\to\actions@list
1559 \fi}
1560
1561 % \end{macrocode}
1562 % \end{macro}
1563 %
1564 % \begin{macro}{\sub@action}
1565 % \cs{sub@action}
1566 % adds an entry to the action-code list to turn sub-lineation on or
1567 % off, according to the current value of the \cs{ifsublines@} flag.
1568 % \begin{macrocode}
1569 \renewcommand*{\sub@action}{%
1570 \ifledRcol
1571 \xright@appenditem{\the\absline@numR}\to\actionlines@listR
1572 \ifsublines@
1573 \xright@appenditem{-1001}\to\actions@listR
1574 \else
1575 \xright@appenditem{-1002}\to\actions@listR
1576 \fi
1577 \else
1578 \xright@appenditem{\the\absline@num}\to\actionlines@list
1579 \ifsublines@
1580 \xright@appenditem{-1001}\to\actions@list
1581 \else
1582 \xright@appenditem{-1002}\to\actions@list
1583 \fi
1584 \fi}
1585
1586 % \end{macrocode}
1587 % \end{macro}
1588 %
1589 % \begin{macro}{\do@lockon}
1590 % \begin{macro}{\do@lockonR}
1591 % \cs{lock@on}
1592 % adds an entry to the action-code list to turn line number
1593 % locking on. The current setting of the sub-lineation flag tells us
1594 % whether this applies to line numbers or sub-line numbers.
1595 % \begin{macrocode}
1596 \newcount\@lockR
1597 \newcount\sub@lockR
1598
1599 \newcommand*{\do@lockonR}{%
1600 \xright@appenditem{\the\absline@numR}\to\actionlines@listR
1601 \ifsublines@
1602 \xright@appenditem{-1005}\to\actions@listR
1603 \ifnum\sub@lockR=\z@
1604 \sub@lockR \@ne
1605 \else
1606 \ifnum\sub@lockR=\thr@@
1607 \sub@lockR \@ne
1608 \fi
1609 \fi
1610 \else
1611 \xright@appenditem{-1003}\to\actions@listR
1612 \ifnum\@lockR=\z@
1613 \@lockR \@ne
1614 \else
1615 \ifnum\@lockR=\thr@@
1616 \@lockR \@ne
1617 \fi
1618 \fi
1619 \fi}
1620
1621 \renewcommand*{\do@lockon}{%
1622 \ifx\next\lock@off
1623 \global\let\lock@off=\skip@lockoff
1624 \else
1625 \ifledRcol
1626 \do@lockonR
1627 \else
1628 \do@lockonL
1629 \fi
1630 \fi}
1631 % \end{macrocode}
1632 % \end{macro}
1633 % \end{macro}
1634 %
1635 % \begin{macro}{\lock@off}
1636 % \begin{macro}{\do@lockoff}
1637 % \begin{macro}{\do@lockoffR}
1638 % \begin{macro}{\skip@lockoff}
1639 % \cs{lock@off} adds an entry to the action-code list
1640 % to turn line number locking off.
1641 % \begin{macrocode}
1642
1643
1644 \newcommand{\do@lockoffR}{%
1645 \xright@appenditem{\the\absline@numR}\to\actionlines@listR
1646 \ifsublines@
1647 \xright@appenditem{-1006}\to\actions@listR
1648 \ifnum\sub@lockR=\tw@
1649 \sub@lockR \thr@@
1650 \else
1651 \sub@lockR \z@
1652 \fi
1653 \else
1654 \xright@appenditem{-1004}\to\actions@listR
1655 \ifnum\@lockR=\tw@
1656 \@lockR \thr@@
1657 \else
1658 \@lockR \z@
1659 \fi
1660 \fi}
1661
1662 \renewcommand*{\do@lockoff}{%
1663 \ifledRcol
1664 \do@lockoffR
1665 \else
1666 \do@lockoffL
1667 \fi}
1668 \global\let\lock@off=\do@lockoff
1669
1670 % \end{macrocode}
1671 % \end{macro}
1672 % \end{macro}
1673 % \end{macro}
1674 % \end{macro}
1675 %
1676 % \begin{macro}{\n@num}
1677 % This macro implements the \cs{skipnumbering} command. It uses a new
1678 % action code, namely 1007.
1679 % \begin{macrocode}
1680 \providecommand*{\n@num}{}
1681 \renewcommand*{\n@num}{%
1682 \ifledRcol
1683 \xright@appenditem{\the\absline@numR}\to\actionlines@listR
1684 \xright@appenditem{-1007}\to\actions@listR
1685 \else
1686 \n@num@reg
1687 \fi}
1688
1689 % \end{macrocode}
1690 % \end{macro}
1691 %
1692 % \begin{macro}{\@ref}
1693 % \begin{macro}{\insert@countR}
1694 % \cs{@ref}
1695 % marks the start of a passage, for creation of a footnote reference.
1696 % It takes two arguments:
1697 % \begin{itemize}\addtolength{\itemsep}{-1ex}
1698 % \item \verb"#1", the number of entries to add to \cs{insertlines@list}
1699 % for this reference. \SpecialMainIndex{\insert@count}
1700 % This value for right text, here and within \cs{edtext},
1701 % which computes it and writes it to the line-list file,
1702 % will be stored in the count \cs{insert@countR}.
1703 % \begin{macrocode}
1704 \newcount\insert@countR
1705 % \end{macrocode}
1706 %
1707 % \item \verb"#2", a sequence of other line-list-file commands, executed to
1708 % determine the ending line-number. (This may also include other
1709 % \cs{@ref} commands, corresponding to uses of \cs{edtext}
1710 % within the first argument of another instance of \cs{edtext}.)
1711 % \end{itemize}
1712 %
1713 % The first thing \cs{@ref} itself does is to add the specified number
1714 % of items to the \cs{insertlines@list} list.
1715 % \begin{macrocode}
1716 \renewcommand*{\@ref}[2]{%
1717 \ifledRcol
1718 \global\insert@countR=#1\relax
1719 \loop\ifnum\insert@countR>\z@
1720 \xright@appenditem{\the\absline@numR}\to\insertlines@listR
1721 \global\advance\insert@countR \m@ne
1722 \repeat
1723 % \end{macrocode}
1724 %
1725 % Next, process the second argument to determine the page
1726 % and line numbers for the end of this lemma.
1727 % We temporarily equate \cs{@ref} to a different macro that just executes
1728 % its argument, so that nested \cs{@ref} commands are just skipped
1729 % this time. Some other macros need to be temporarily redefined to
1730 % suppress their action.
1731 % \begin{macrocode}
1732 \begingroup
1733 \let\@ref=\dummy@ref
1734 \let\page@action=\relax
1735 \let\sub@action=\relax
1736 \let\set@line@action=\relax
1737 \let\@lab=\relax
1738 #2
1739 \global\endpage@num=\page@numR
1740 \global\endline@num=\line@numR
1741 \global\endsubline@num=\subline@numR
1742 \endgroup
1743 % \end{macrocode}
1744 %
1745 % Now store all the information about the location of the lemma's
1746 % start and end in \cs{line@list}.
1747 % \begin{macrocode}
1748 \xright@appenditem%
1749 {\the\page@numR|\the\line@numR|%
1750 \ifsublines@ \the\subline@numR \else 0\fi|%
1751 \the\endpage@num|\the\endline@num|%
1752 \ifsublines@ \the\endsubline@num \else 0\fi}\to\line@listR
1753 % \end{macrocode}
1754 %
1755 % Finally, execute the second argument of \cs{@ref} again,
1756 % to perform for real all the commands within it.
1757 % \begin{macrocode}
1758 #2
1759 \else
1760 % \end{macrocode}
1761 % And when not in right text
1762 % \begin{macrocode}
1763 \@ref@reg{#1}{#2}%
1764 \fi}
1765 % \end{macrocode}
1766 % \end{macro}
1767 % \end{macro}
1768 %
1769 % \begin{macro}{\@pend}
1770 % \begin{macro}{\@pendR}
1771 % \cs{@pend}\marg{num} adds its argument to the \cs{linesinpar@listL}
1772 % list, and analagously for \cs{@pendR}. If needed, it resets line number. We start off with a
1773 % \cs{providecommand} just in case an older version of \Ledmac{} is being
1774 % used which does not define these macros.
1775 % \begin{macrocode}
1776 \providecommand*{\@pend}[1]{}
1777 \renewcommand*{\@pend}[1]{%
1778 \ifbypstart@\global\line@num=0\fi%
1779 \xright@appenditem{#1}\to\linesinpar@listL}
1780 \providecommand*{\@pendR}[1]{}
1781 \renewcommand*{\@pendR}[1]{%
1782 \ifbypstart@R\global\line@numR=0\fi%
1783 \xright@appenditem{#1}\to\linesinpar@listR}
1784
1785 % \end{macrocode}
1786 % \end{macro}
1787 % \end{macro}
1788 %
1789 % \begin{macro}{\@lopL}
1790 % \begin{macro}{\@lopR}
1791 % \cs{@lopL}\marg{num} adds its argument to the \cs{linesonpage@listL}
1792 % list, and analagously for \cs{@lopR}. We start off with a
1793 % \cs{providecommand} just in case an older version of \Ledmac{} is being
1794 % used which does not define these macros.
1795 % \begin{macrocode}
1796 \providecommand*{\@lopL}[1]{}
1797 \renewcommand*{\@lopL}[1]{%
1798 \xright@appenditem{#1}\to\linesonpage@listL}
1799 \providecommand*{\@lopR}[1]{}
1800 \renewcommand*{\@lopR}[1]{%
1801 \xright@appenditem{#1}\to\linesonpage@listR}
1802
1803 % \end{macrocode}
1804 % \end{macro}
1805 % \end{macro}
1806 %
1807 % \subsection{Writing to the line-list file}
1808 %
1809 % We've now defined all the counters, lists, and commands involved in
1810 % reading the line-list file at the start of a section. Now we'll
1811 % cover the commands that \Ledmac{} uses within the text of a
1812 % section to write commands out to the line-list.
1813 %
1814 % \begin{macro}{\linenum@outR}
1815 % The file for right texts will be opened on output stream \cs{linenum@outR}.
1816 % \begin{macrocode}
1817 \newwrite\linenum@outR
1818 % \end{macrocode}
1819 % \end{macro}
1820 %
1821 % \begin{macro}{\iffirst@linenum@out@R}
1822 % \begin{macro}{\first@linenum@out@Rtrue}
1823 % \begin{macro}{\first@linenum@out@Rfalse}
1824 % Once any file is opened on this stream, we keep it open forever, or
1825 % else switch to another file that we keep open.
1826 % \begin{macrocode}
1827 \newif\iffirst@linenum@out@R
1828 \first@linenum@out@Rtrue
1829 % \end{macrocode}
1830 % \end{macro}
1831 % \end{macro}
1832 % \end{macro}
1833 %
1834 % \begin{macro}{\line@list@stuffR}
1835 % This is the right text version of the \cs{line@list@stuff}\marg{file}
1836 % macro. It is called by \cs{beginnumberingR} and performs
1837 % all the line-list operations needed at the start of a section.
1838 % Its argument is the name of the line-list file.
1839 % \begin{macrocode}
1840 \newcommand*{\line@list@stuffR}[1]{%
1841 \read@linelist{#1}%
1842 \iffirst@linenum@out@R
1843 \immediate\closeout\linenum@outR
1844 \global\first@linenum@out@Rfalse
1845 \immediate\openout\linenum@outR=#1
1846 \else
1847 \closeout\linenum@outR
1848 \openout\linenum@outR=#1
1849 \fi}
1850
1851 % \end{macrocode}
1852 % \end{macro}
1853 %
1854 % \begin{macro}{\new@lineR}
1855 % The \cs{new@lineR} macro sends the \cs{@l} command to the right text
1856 % line-list file, to mark the start of a new text line.
1857 % \begin{macrocode}
1858 \newcommand*{\new@lineR}{%
1859 \write\linenum@outR{\string\@l[\the\c@page][\thepage]}}
1860 % \end{macrocode}
1861 % \end{macro}
1862 %
1863 % \begin{macro}{\flag@start}
1864 % \begin{macro}{\flag@end}
1865 % We enclose a lemma marked by \cs{edtext} in
1866 % \cs{flag@start} and \cs{flag@end}: these send the \cs{@ref}
1867 % command to the line-list file.
1868 % \changes{v0.3}{2005/02/04}{Removed extraneous spaces from\cs{flag@end}}
1869 % \begin{macrocode}
1870 \renewcommand*{\flag@start}{%
1871 \ifledRcol
1872 \edef\next{\write\linenum@outR{%
1873 \string\@ref[\the\insert@countR][}}%
1874 \next
1875 \else
1876 \edef\next{\write\linenum@out{%
1877 \string\@ref[\the\insert@count][}}%
1878 \next
1879 \fi}
1880 \renewcommand*{\flag@end}{%
1881 \ifledRcol
1882 \write\linenum@outR{]}%
1883 \else
1884 \write\linenum@out{]}%
1885 \fi}
1886 % \end{macrocode}
1887 % \end{macro}
1888 % \end{macro}
1889 %
1890 % \begin{macro}{\startsub}
1891 % \begin{macro}{\endsub}
1892 % \cs{startsub} and \cs{endsub}
1893 % turn sub-lineation on and off, by writing
1894 % appropriate instructions to the line-list file.
1895 % \begin{macrocode}
1896 \renewcommand*{\startsub}{\dimen0\lastskip
1897 \ifdim\dimen0>0pt \unskip \fi
1898 \ifledRcol \write\linenum@outR{\string\sub@on}%
1899 \else \write\linenum@out{\string\sub@on}%
1900 \fi
1901 \ifdim\dimen0>0pt \hskip\dimen0 \fi}
1902 \def\endsub{\dimen0\lastskip
1903 \ifdim\dimen0>0pt \unskip \fi
1904 \ifledRcol \write\linenum@outR{\string\sub@off}%
1905 \else \write\linenum@out{\string\sub@off}%
1906 \fi
1907 \ifdim\dimen0>0pt \hskip\dimen0 \fi}
1908
1909 % \end{macrocode}
1910 % \end{macro}
1911 % \end{macro}
1912 %
1913 % \begin{macro}{\advanceline}
1914 % You can use \cs{advanceline}\marg{num}
1915 % in running text to advance the current visible
1916 % line-number by a specified value, positive or negative.
1917 % \begin{macrocode}
1918 \renewcommand*{\advanceline}[1]{%
1919 \ifledRcol \write\linenum@outR{\string\@adv[#1]}%
1920 \else \write\linenum@out{\string\@adv[#1]}%
1921 \fi}
1922 % \end{macrocode}
1923 % \end{macro}
1924 %
1925 % \begin{macro}{\setline}
1926 % You can use \cs{setline}\marg{num}
1927 % in running text (i.e., within \verb?\pstart...\pend?) to set the
1928 % current visible
1929 % line-number to a specified positive value.
1930 % \begin{macrocode}
1931 \renewcommand*{\setline}[1]{%
1932 \ifnum#1<\z@
1933 \led@warn@BadSetline
1934 \else
1935 \ifledRcol \write\linenum@outR{\string\@set[#1]}%
1936 \else \write\linenum@out{\string\@set[#1]}%
1937 \fi
1938 \fi}
1939 % \end{macrocode}
1940 % \end{macro}
1941 %
1942 % \begin{macro}{\setlinenum}
1943 % You can use \cs{setlinenum}\marg{num}
1944 % before a \verb?\pstart? to set the visible line-number to a specified
1945 % positive value. It writes a \verb?\l@d@set? command to the line-list file.
1946 % \begin{macrocode}
1947 \renewcommand*{\setlinenum}[1]{%
1948 \ifnum#1<\z@
1949 \led@warn@BadSetlinenum
1950 \else
1951 \ifledRcol \write\linenum@outR{\string\l@d@set[#1]}
1952 \else \write\linenum@out{\string\l@d@set[#1]} \fi
1953 \fi}
1954
1955 % \end{macrocode}
1956 % \end{macro}
1957 %
1958 % \begin{macro}{\startlock}
1959 % \begin{macro}{\endlock}
1960 % You can use \cs{startlock} or \cs{endlock}
1961 % in running text to start or end line number locking at
1962 % the current line. They decide whether line numbers or sub-line numbers
1963 % are affected, depending on the current state of the sub-lineation flags.
1964 % \begin{macrocode}
1965 \renewcommand*{\startlock}{%
1966 \ifledRcol \write\linenum@outR{\string\lock@on}%
1967 \else \write\linenum@out{\string\lock@on}%
1968 \fi}
1969 \def\endlock{%
1970 \ifledRcol \write\linenum@outR{\string\lock@off}%
1971 \else \write\linenum@out{\string\lock@off}%
1972 \fi}
1973
1974 % \end{macrocode}
1975 % \end{macro}
1976 % \end{macro}
1977 %
1978 % \begin{macro}{\skipnumbering}
1979 % In numbered text, \cs{skipnumbering} in a line will suspend the
1980 % numbering for that particular line. That is, line numbers are unchanged and
1981 % no line number will be printed.
1982 % \begin{macrocode}
1983 \renewcommand*{\skipnumbering}{%
1984 \ifledRcol \write\linenum@outR{\string\n@num}%
1985 \advanceline{-1}%
1986 \else
1987 \skipnumbering@reg
1988 \fi}
1989
1990 % \end{macrocode}
1991 % \end{macro}
1992 %
1993 %
1994 % \section{Marking text for notes}
1995 % \label{text}\relax
1996 %
1997 % The \cs{edtext} (or \cs{critext}) macro is used to create all
1998 % footnotes and endnotes,
1999 % as well as to print the portion of the main text to which a given note
2000 % or notes is keyed. The idea is to have that lemma appear only once in
2001 % the \file{.tex} file: all instances of it in the main text and in the
2002 % notes are copied from that one appearance.
2003 %
2004 % \cs{critext} requires two arguments. At any point within numbered
2005 % text, you use it by saying:
2006 % \begin{verbatim}
2007 % \critext{#1}#2/
2008 % \end{verbatim}
2009 % Similarly \cs{edtext} requires the same two arguments
2010 % but you use it by saying:
2011 % \begin{verbatim}
2012 % \edtext{#1}{#2}
2013 % \end{verbatim}
2014 %
2015 %
2016 % \begin{macro}{\critext}
2017 % Now we begin \cs{critext} itself.
2018 %
2019 % We slightly modify the original to make accomodation for when right text is
2020 % being processed.
2021 %
2022 % \begin{macrocode}
2023 \long\def\critext#1#2/{\leavevmode
2024 \begingroup
2025 \no@expands
2026 \xdef\@tag{#1}%
2027 \set@line
2028 \ifledRcol \global\insert@countR \z@
2029 \else \global\insert@count \z@ \fi
2030 \ignorespaces #2\relax
2031 \flag@start
2032 \endgroup
2033 \showlemma{#1}%
2034 \ifx\end@lemmas\empty \else
2035 \gl@p\end@lemmas\to\x@lemma
2036 \x@lemma
2037 \global\let\x@lemma=\relax
2038 \fi
2039 \flag@end}
2040 % \end{macrocode}
2041 % \end{macro}
2042 %
2043 % \begin{macro}{\edtext}
2044 % And similarly for \cs{edtext}.
2045 % \begin{macrocode}
2046 \renewcommand{\edtext}[2]{\leavevmode
2047 \begingroup
2048 \no@expands
2049 \xdef\@tag{#1}%
2050 \set@line
2051 \ifledRcol \global\insert@countR \z@
2052 \else \global\insert@count \z@ \fi
2053 \ignorespaces #2\relax
2054 \flag@start
2055 \endgroup
2056 \showlemma{#1}%
2057 \ifx\end@lemmas\empty \else
2058 \gl@p\end@lemmas\to\x@lemma
2059 \x@lemma
2060 \global\let\x@lemma=\relax
2061 \fi
2062 \flag@end}
2063
2064 % \end{macrocode}
2065 % \end{macro}
2066 %
2067 %
2068 % \begin{macro}{\set@line}
2069 % The \cs{set@line} macro
2070 % is called by \cs{edtext} to put the line-reference field and
2071 % font specifier for the current block of text into \cs{l@d@nums}.
2072 % \begin{macrocode}
2073 \renewcommand*{\set@line}{%
2074 \ifledRcol
2075 \ifx\line@listR\empty
2076 \global\noteschanged@true
2077 \xdef\l@d@nums{000|000|000|000|000|000|\edfont@info}%
2078 \else
2079 \gl@p\line@listR\to\@tempb
2080 \xdef\l@d@nums{\@tempb|\edfont@info}%
2081 \global\let\@tempb=\undefined
2082 \fi
2083 \else
2084 \ifx\line@list\empty
2085 \global\noteschanged@true
2086 \xdef\l@d@nums{000|000|000|000|000|000|\edfont@info}%
2087 \else
2088 \gl@p\line@list\to\@tempb
2089 \xdef\l@d@nums{\@tempb|\edfont@info}%
2090 \global\let\@tempb=\undefined
2091 \fi
2092 \fi}
2093
2094 % \end{macrocode}
2095 % \end{macro}
2096 %
2097 % \section{Parallel environments}
2098 %
2099 % The initial set up for parallel processing is deceptively simple.
2100 %
2101 %
2102 % \begin{environment}{pairs}
2103 % \begin{environment}{pages}
2104 % \begin{macro}{chapterinpages}
2105 % The \verb?pairs? environment is for parallel columns and the \verb?pages?
2106 % environment for parallel pages.
2107 % \begin{macrocode}
2108 \newenvironment{pairs}{%}
2109 \l@dpairingtrue
2110 \l@dpagingfalse
2111 }{%
2112 \l@dpairingfalse
2113 }
2114 % \end{macrocode}
2115 % The \verb?pages? environment additionally sets the `column' widths to the
2116 % \cs{textwidth} (as known at the time the package is called). In this environment, there are two text in parallel on 2 pages. To prevent chapters starting on a lefthand page, the \cs{chapter} command is redefined to not clear pages.
2117 % \begin{macrocode}
2118 \newenvironment{pages}{%
2119 \let\oldchapter\chapter
2120 \let\chapter\chapterinpages
2121 \l@dpairingtrue
2122 \l@dpagingtrue
2123 \setlength{\Lcolwidth}{\textwidth}%
2124 \setlength{\Rcolwidth}{\textwidth}%
2125 }{%
2126 \l@dpairingfalse
2127 \l@dpagingfalse
2128 \let\chapter\oldchapter
2129 }
2130 \newcommand{\chapterinpages}{\thispagestyle{plain}%
2131 \global\@topnum\z@
2132 \@afterindentfalse
2133 \secdef\@chapter\@schapter}
2134
2135 % \end{macrocode}
2136 % \end{macro}
2137 % \end{environment}
2138 % \end{environment}
2139 %
2140 %
2141 % \begin{macro}{ifinstanzaL}
2142 % \begin{macro}{ifinstanzaR}
2143 % These boolean tests are switched by the \cs{stanza} command, using either the left or right side.
2144 % \begin{macrocode}
2145 \newif\ifinstanzaL
2146 \newif\ifinstanzaR
2147 % \end{macrocode}
2148 % \end{macro}
2149 % \end{macro}
2150 % \begin{environment}{Leftside}
2151 % Within the \verb?pairs? and \verb?pages? environments the left and
2152 % right hand texts are within \verb?Leftside? and \verb?Rightside?
2153 % environments, respectively. The \verb?Leftside? environment is simple,
2154 % indicating that right text is not within its purview and using some
2155 % particular macros.
2156 % \changes{v0.3}{2005/02/10}{Added hooks into Leftside environment}
2157 % \begin{macrocode}
2158 \newenvironment{Leftside}{%
2159 \ledRcolfalse
2160 \let\beginnumbering\beginnumbering\setcounter{pstartL}{1}
2161 \let\pstart\pstartL
2162 \let\thepstart\thepstartL
2163 \let\pend\pendL
2164 \let\memorydump\memorydumpL
2165 \Leftsidehook
2166 \let\oldstanza\stanza
2167 \renewcommand{\stanza}{\oldstanza\global\instanzaLtrue}
2168 }{
2169 \let\stanza\oldstanza
2170 \Leftsidehookend}
2171 % \end{macrocode}
2172 % \end{environment}
2173 %
2174 % \begin{macro}{\Leftsidehook}
2175 % \begin{macro}{\Leftsidehookend}
2176 % \begin{macro}{\Rightsidehook}
2177 % \begin{macro}{\Rightsidehookend}
2178 % Hooks into the start and end of the \texttt{Leftside} and \texttt{Rightside}
2179 % environments. These are initially empty.
2180 % \changes{v0.3}{2005/02/10}{Added \cs{Leftsidehook}, \cs{Leftsidehookend},
2181 % \cs{Rightsidehook} and \cs{Rightsidehookend}}
2182 % \begin{macrocode}
2183 \newcommand*{\Leftsidehook}{}
2184 \newcommand*{\Leftsidehookend}{}
2185 \newcommand*{\Rightsidehook}{}
2186 \newcommand*{\Rightsidehookend}{}
2187
2188 % \end{macrocode}
2189 % \end{macro}
2190 % \end{macro}
2191 % \end{macro}
2192 % \end{macro}
2193 %
2194 % \begin{environment}{Rightside}
2195 % The \verb?Rightside? environment is only slightly more complicated
2196 % than the \verb?Leftside?.
2197 % Apart from indicating that right text is being provided it
2198 % ensures that the right right text code will be used.
2199 % \begin{macrocode}
2200 \newenvironment{Rightside}{%
2201 \ledRcoltrue
2202 \let\beginnumbering\beginnumberingR
2203 \let\endnumbering\endnumberingR
2204 \let\pausenumbering\pausenumberingR
2205 \let\resumenumbering\resumenumberingR
2206 \let\memorydump\memorydumpR
2207 \let\thepstart\thepstartR
2208 \let\pstart\pstartR
2209 \let\pend\pendR
2210 \let\lineation\lineationR
2211 \Rightsidehook
2212 \let\oldstanza\stanza
2213 \renewcommand{\stanza}{\oldstanza\global\instanzaRtrue}
2214 }{%
2215 \ledRcolfalse
2216 \let\stanza\oldstanza
2217 \Rightsidehookend
2218 }
2219
2220 % \end{macrocode}
2221 % \end{environment}
2222 %
2223 %
2224 %
2225 % \section{Paragraph decomposition and reassembly}
2226 % \label{paragraph}\relax
2227 %
2228 % In order to be able to count the lines of text and affix line
2229 % numbers, we add an extra stage of processing for each paragraph.
2230 % We send the paragraph into a box
2231 % register, rather than straight onto the vertical list, and when
2232 % the paragraph ends we
2233 % slice the paragraph into its component lines; to each line we
2234 % add any notes or line numbers, add a command to write to the
2235 % line-list, and then at last send the line to the vertical list.
2236 % This section contains all the code for this processing.
2237 %
2238 % \subsection{Boxes, counters, {\tt\protect\bslash pstart}
2239 % and {\tt\protect\bslash pend}}
2240 %
2241 % \begin{macro}{\num@linesR}
2242 % \begin{macro}{\one@lineR}
2243 % \begin{macro}{\par@lineR}
2244 % Here are numbers and flags that are used internally in the course
2245 % of the paragraph decomposition.
2246 %
2247 % When we first form the paragraph, it goes into a box register,
2248 % \cs{l@dLcolrawbox} or \cs{l@dRcolrawbox} for right text, instead of onto the
2249 % current vertical list.
2250 % The \cs{ifnumberedpar@} flag will be \verb"true" while a paragraph is
2251 % being processed in that way.
2252 % \cs{num@lines(R)} will store the number of lines in the paragraph
2253 % when it's complete. When we chop it up into lines, each line
2254 % in turn goes into the
2255 % \cs{one@line} or \cs{one@lineR} register, and \cs{par@line(R)}
2256 % will be the number
2257 % of that line within the paragraph.
2258 % \begin{macrocode}
2259 \newcount\num@linesR
2260 \newbox\one@lineR
2261 \newcount\par@lineR
2262 % \end{macrocode}
2263 % \end{macro}
2264 % \end{macro}
2265 % \end{macro}
2266 %
2267 % \begin{macro}{\pstartL}
2268 % \begin{macro}{\pstartR}
2269 % \cs{pstart} starts the paragraph by
2270 % clearing the \cs{inserts@list} list and other
2271 % relevant variables, and then arranges for the
2272 % subsequent text to go into the appropriate box.
2273 % \cs{pstart} needs to appear at the start of
2274 % every paragraph that's to be numbered.
2275 %
2276 % Beware: everything that occurs between \cs{pstart} and \cs{pend}
2277 % is happening within a group; definitions must be global if you want
2278 % them to survive past the end of the paragraph.
2279 %
2280 % We have to have specific left and right \cs{pstart} when parallel processing;
2281 % among other things because of potential changes in the linewidth. The \verb|old| counters are used to have the good reset of the pstart counters at the begining of the \cs{Pages} command.
2282 %
2283 % \begin{macrocode}
2284
2285 \newcounter{pstartL}
2286 \newcounter{pstartLold}
2287 \renewcommand{\thepstartL}{{\bfseries\@arabic\c@pstartL}. }
2288 \newcounter{pstartR}
2289 \newcounter{pstartRold}
2290 \renewcommand{\thepstartR}{{\bfseries\@arabic\c@pstartR}. }
2291
2292 \newcommand*{\pstartL}{
2293 \if@nobreak
2294 \let\@oldnobreak\@nobreaktrue
2295 \else
2296 \let\@oldnobreak\@nobreakfalse
2297 \fi
2298 \@nobreaktrue
2299 \ifnumbering \else
2300 \led@err@PstartNotNumbered
2301 \beginnumbering
2302 \fi
2303 \ifnumberedpar@
2304 \led@err@PstartInPstart
2305 \pend
2306 \fi
2307 % \end{macrocode}
2308 % If this is the first \cs{pstart} in a numbered section, clear any inserts
2309 % and set \cs{ifpst@rtedL} to FALSE. Save the pstartL counter.
2310 % \begin{macrocode}
2311 \ifpst@rtedL\else
2312 \setcounter{pstartLold}{\value{pstartL}}%
2313 \list@clear{\inserts@list}%
2314 \global\let\next@insert=\empty
2315 \global\pst@rtedLtrue
2316 \fi
2317 \begingroup\normal@pars
2318 % \end{macrocode}
2319 % When parallel processing we check that we haven't exceeded
2320 % the maximum number of chunks. In any event we grab a box for the
2321 % forthcoming text.
2322 % \begin{macrocode}
2323 \global\advance\l@dnumpstartsL \@ne
2324 \ifnum\l@dnumpstartsL>\l@dc@maxchunks
2325 \led@err@TooManyPstarts
2326 \global\l@dnumpstartsL=\l@dc@maxchunks
2327 \fi
2328 \global\setnamebox{l@dLcolrawbox\the\l@dnumpstartsL}=\vbox\bgroup\ifautopar\else\ifnumberpstart\ifsidepstartnum\else\thepstartL\fi\fi\fi%
2329 \hsize=\Lcolwidth
2330 \numberedpar@true}
2331 % \end{macrocode}
2332 %
2333 % \begin{macrocode}
2334 \newcommand*{\pstartR}{
2335 \if@nobreak
2336 \let\@oldnobreak\@nobreaktrue
2337 \else
2338 \let\@oldnobreak\@nobreakfalse
2339 \fi
2340 \@nobreaktrue
2341 \ifnumberingR \else
2342 \led@err@PstartNotNumbered
2343 \beginnumberingR
2344 \fi
2345 \ifnumberedpar@
2346 \led@err@PstartInPstart
2347 \pendR
2348 \fi
2349 \ifpst@rtedR\else
2350 \setcounter{pstartRold}{\value{pstartR}}%
2351 \list@clear{\inserts@listR}%
2352 \global\let\next@insertR=\empty
2353 \global\pst@rtedRtrue
2354 \fi
2355 \begingroup\normal@pars
2356 \global\advance\l@dnumpstartsR \@ne
2357 \ifnum\l@dnumpstartsR>\l@dc@maxchunks
2358 \led@err@TooManyPstarts
2359 \global\l@dnumpstartsR=\l@dc@maxchunks
2360 \fi
2361 \global\setnamebox{l@dRcolrawbox\the\l@dnumpstartsR}=\vbox\bgroup\ifautopar\else\ifnumberpstart\ifsidepstartnum\else\thepstartR\fi\fi\fi%
2362 \hsize=\Rcolwidth
2363 \numberedpar@true}
2364 % \end{macrocode}
2365 % \end{macro}
2366 % \end{macro}
2367 %
2368 %
2369 % \begin{macro}{\pendL}
2370 % \cs{pend} must be used to end a numbered paragraph. Again we need
2371 % a version
2372 % that knows about left parallel texts.
2373 %
2374 % \begin{macrocode}
2375 \newcommand*{\pendL}{\ifnumbering \else
2376 \led@err@PendNotNumbered
2377 \fi
2378 \ifnumberedpar@ \else
2379 \led@err@PendNoPstart
2380 \fi
2381 % \end{macrocode}
2382 % We set all the usual interline penalties to zero and then immediately
2383 % call \cs{endgraf} to end the paragraph; this ensures that there'll
2384 % be no large interline penalties to prevent us from slicing the
2385 % paragraph into pieces. These penalties revert to the values
2386 % that you set when the group for the \cs{vbox} ends.
2387 % \begin{macrocode}
2388 \l@dzeropenalties
2389 \endgraf\global\num@lines=\prevgraf\egroup
2390 \global\par@line=0
2391 % \end{macrocode}
2392 % End the group that was begun in the \cs{pstart}.
2393 % \begin{macrocode}
2394 \endgroup
2395 \ignorespaces
2396 \@oldnobreak
2397 \ifnumberpstart
2398 \addtocounter{pstartL}{1}
2399 \fi}
2400
2401 % \end{macrocode}
2402 % \end{macro}
2403 %
2404 % \begin{macro}{\pendR}
2405 % The version of \cs{pend} needed for right texts.
2406 %
2407 % \begin{macrocode}
2408 \newcommand*{\pendR}{\ifnumberingR \else
2409 \led@err@PendNotNumbered
2410 \fi
2411 \ifnumberedpar@ \else
2412 \led@err@PendNoPstart
2413 \fi
2414 \l@dzeropenalties
2415 \endgraf\global\num@linesR=\prevgraf\egroup
2416 \global\par@lineR=0
2417 \endgroup
2418 \ignorespaces
2419 \@oldnobreak
2420 \ifnumberpstart
2421 \addtocounter{pstartR}{1}
2422 \fi
2423 }
2424
2425 % \end{macrocode}
2426 % \end{macro}
2427 %
2428 %
2429 % \subsection{Processing one line}
2430 %
2431 % For parallel texts we have to be able to process left and right lines
2432 % independently. For sequential text we happily use the
2433 % original \cs{do@line}. Otherwise \ldots
2434 %
2435 % \begin{macro}{\l@dleftbox}
2436 % \begin{macro}{\l@drightbox}
2437 % A line of left text will be put in the box \cs{l@dleftbox}, and analagously
2438 % for a line of right text.
2439 % \begin{macrocode}
2440 \newbox\l@dleftbox
2441 \newbox\l@drightbox
2442
2443 % \end{macrocode}
2444 % \end{macro}
2445 % \end{macro}
2446 %
2447 % \begin{macro}{\countLline}
2448 % \begin{macro}{\countRline}
2449 % We need to know the number of lines processed.
2450 % \begin{macrocode}
2451 \newcount\countLline
2452 \countLline \z@
2453 \newcount\countRline
2454 \countRline \z@
2455
2456 % \end{macrocode}
2457 % \end{macro}
2458 % \end{macro}
2459 %
2460 % \begin{macro}{\@donereallinesL}
2461 % \begin{macro}{\@donetotallinesL}
2462 % \begin{macro}{\@donereallinesR}
2463 % \begin{macro}{\@donetotallinesR}
2464 % We need to know the number of `real' lines output (i.e., those that
2465 % have been input by the user), and the total lines output (which includes
2466 % any blank lines output for synchronisation).
2467 % \begin{macrocode}
2468 \newcount\@donereallinesL
2469 \newcount\@donetotallinesL
2470 \newcount\@donereallinesR
2471 \newcount\@donetotallinesR
2472
2473 % \end{macrocode}
2474 % \end{macro}
2475 % \end{macro}
2476 % \end{macro}
2477 % \end{macro}
2478 %
2479 %
2480 % \changes{v0.11}{2012/06/11}{Change \cs{do@lineL} and \cs{do@lineR} to allow line numbering by pstart(like in ledmac 0.15).}
2481 % \begin{macro}{\do@lineL}
2482 % The \cs{do@lineL} macro is called to
2483 % do all the processing for a single line of left text.
2484 % \changes{v0.3}{2005/02/10}{Added \cs{do@lineLhook} to \cs{do@lineL}}
2485 % \changes{v0.3}{2005/02/10}{Simplified \cs{do@lineL} by using macros for
2486 % some common code}
2487 % \begin{macrocode}
2488 \newcommand*{\do@lineL}{%
2489 \advance\countLline \@ne
2490 \ifvbox\namebox{l@dLcolrawbox\the\l@dpscL}%
2491 {\vbadness=10000
2492 \splittopskip=\z@
2493 \do@lineLhook
2494 \l@demptyd@ta
2495 \global\setbox\one@line=\vsplit\namebox{l@dLcolrawbox\the\l@dpscL}
2496 to\baselineskip}%
2497 \unvbox\one@line \global\setbox\one@line=\lastbox
2498 \getline@numL
2499 \ifnum\@lock>\@ne\inserthangingsymboltrue\else\inserthangingsymbolfalse\fi
2500 \setbox\l@dleftbox
2501 \hb@xt@ \Lcolwidth{%
2502 \affixpstart@numL
2503 \affixline@num
2504 \l@dld@ta
2505 \add@inserts
2506 \affixside@note
2507 \l@dlsn@te
2508 {\ledllfill\hb@xt@ \wd\one@line{\inserthangingsymbolL\new@line\l@dunhbox@line{\one@line}}\correcthangingL\ledrlfill\l@drd@ta%
2509 \l@drsn@te
2510 }}%
2511 \add@penaltiesL
2512 \global\advance\@donereallinesL\@ne
2513 \global\advance\@donetotallinesL\@ne
2514 \else
2515 \setbox\l@dleftbox \hb@xt@ \Lcolwidth{\hspace*{\Lcolwidth}}%
2516 \global\advance\@donetotallinesL\@ne
2517 \fi}
2518
2519
2520 % \end{macrocode}
2521 % \end{macro}
2522 %
2523 % \begin{macro}{\do@lineLhook}
2524 % \begin{macro}{\do@lineRhook}
2525 % Hooks, initially empty, into the respective \cs{do@line(L/R)} macros.
2526 % \changes{v0.3}{2005/02/10}{Added \cs{do@lineLhook} and \cs{do@lineRhook}}
2527 % \begin{macrocode}
2528 \newcommand*{\do@lineLhook}{}
2529 \newcommand*{\do@lineRhook}{}
2530
2531 % \end{macrocode}
2532 % \end{macro}
2533 % \end{macro}
2534 %
2535 % \begin{macro}{\do@lineR}
2536 % The \cs{do@lineR} macro is called to
2537 % do all the processing for a single line of right text.
2538 % \changes{v0.3}{2005/02/10}{Changed \cs{do@lineR} similarly to \cs{do@lineL}}
2539 % \begin{macrocode}
2540 \newcommand*{\do@lineR}{%
2541 \advance\countRline \@ne
2542 \ifvbox\namebox{l@dRcolrawbox\the\l@dpscR}%
2543 {\vbadness=10000
2544 \splittopskip=\z@
2545 \do@lineRhook
2546 \l@demptyd@ta
2547 \global\setbox\one@lineR=\vsplit\namebox{l@dRcolrawbox\the\l@dpscR}
2548 to\baselineskip}%
2549 \unvbox\one@lineR \global\setbox\one@lineR=\lastbox
2550 \getline@numR
2551 \ifnum\@lockR>\@ne\inserthangingsymbolRtrue\else\inserthangingsymbolRfalse\fi
2552 \setbox\l@drightbox
2553 \hb@xt@ \Rcolwidth{%
2554 \affixpstart@numR
2555 \affixline@numR
2556 \l@dld@ta
2557 \add@insertsR
2558 \affixside@noteR
2559 \l@dlsn@te
2560 {\correcthangingR\ledllfill\hb@xt@ \wd\one@lineR{\inserthangingsymbolR\new@lineR\l@dunhbox@line{\one@lineR}}\ledrlfill\l@drd@ta%
2561 \l@drsn@te
2562 }}%
2563 \add@penaltiesR
2564 \global\advance\@donereallinesR\@ne
2565 \global\advance\@donetotallinesR\@ne
2566 \else
2567 \setbox\l@drightbox \hb@xt@ \Rcolwidth{\hspace*{\Rcolwidth}}
2568 \global\advance\@donetotallinesR\@ne
2569 \fi}
2570
2571
2572 % \end{macrocode}
2573 % \end{macro}
2574 %
2575 %
2576 % \subsection{Line and page number computation}
2577 %
2578 % \begin{macro}{\getline@numR}
2579 % The \cs{getline@numR} macro
2580 % determines the page and line numbers for the right text line we're about to
2581 % send to the vertical list.
2582 % \begin{macrocode}
2583 \newcommand*{\getline@numR}{%
2584 \ifnumberline
2585 \global\advance\absline@numR \@ne
2586 \fi
2587 \do@actionsR
2588 \do@ballastR
2589 \ifnumberline
2590 \ifsublines@
2591 \ifnum\sub@lockR<\tw@
2592 \global\advance\subline@numR \@ne
2593 \fi
2594 \else
2595 \ifnum\@lockR<\tw@
2596 \global\advance\line@numR \@ne
2597 \global\subline@numR \z@
2598 \fi
2599 \fi
2600 \fi
2601 }
2602 \newcommand*{\getline@numL}{%
2603 \ifnumberline
2604 \global\advance\absline@num \@ne
2605 \fi
2606 \do@actions
2607 \do@ballast
2608 \ifnumberline
2609 \ifsublines@
2610 \ifnum\sub@lock<\tw@
2611 \global\advance\subline@num \@ne
2612 \fi
2613 \else
2614 \ifnum\@lock<\tw@
2615 \global\advance\line@num \@ne
2616 \global\subline@num \z@
2617 \fi
2618 \fi
2619 \fi
2620 }
2621
2622
2623 % \end{macrocode}
2624 % \end{macro}
2625 %
2626 % \begin{macro}{\do@ballastR}
2627 % \phantomsection\label{do@ballastR}\relax
2628 % The real work in the line macros above is done in \cs{do@actions}, but
2629 % before we plunge into that, let's get \cs{do@ballastR} out of the
2630 % way.
2631 % \begin{macrocode}
2632 \newcommand*{\do@ballastR}{\global\ballast@count=\z@
2633 \begingroup
2634 \advance\absline@numR \@ne
2635 \ifnum\next@actionlineR=\absline@numR
2636 \ifnum\next@actionR>-1001
2637 \global\advance\ballast@count by -\c@ballast
2638 \fi
2639 \fi
2640 \endgroup}
2641 % \end{macrocode}
2642 % \end{macro}
2643 %
2644 %
2645 % \begin{macro}{\do@actionsR}
2646 % \begin{macro}{\do@actions@fixedcodeR}
2647 % \begin{macro}{\do@actions@nextR}
2648 %
2649 % The \cs{do@actionsR} macro
2650 % looks at the list of actions to take at particular right text absolute line
2651 % numbers, and does everything that's specified for the current line.
2652 %
2653 % It may call itself recursively and we use tail recursion, via
2654 % \cs{do@actions@nextR} for this.
2655 % \changes{v0.3}{2005/02/24}{Used \cs{do@actions@fixedcode} in \cs{do@actionsR}}
2656 % \begin{macrocode}
2657 \newcommand*{\do@actions@fixedcodeR}{%
2658 \ifcase\@l@dtempcnta%
2659 \or% % 1001
2660 \global\sublines@true
2661 \or% % 1002
2662 \global\sublines@false
2663 \or% % 1003
2664 \global\@lockR=\@ne
2665 \or% % 1004
2666 \ifnum\@lockR=\tw@
2667 \global\@lockR=\thr@@
2668 \else
2669 \global\@lockR=\z@
2670 \fi
2671 \or% % 1005
2672 \global\sub@lockR=\@ne
2673 \or% % 1006
2674 \ifnum\sub@lockR=\tw@
2675 \global\sub@lockR=\thr@@
2676 \else
2677 \global\sub@lockR=\z@
2678 \fi
2679 \or% % 1007
2680 \l@dskipnumbertrue
2681 \else
2682 \led@warn@BadAction
2683 \fi}
2684
2685
2686 \newcommand*{\do@actionsR}{%
2687 \global\let\do@actions@nextR=\relax
2688 \@l@dtempcntb=\absline@numR
2689 \ifnum\@l@dtempcntb<\next@actionlineR\else
2690 \ifnum\next@actionR>-1001\relax
2691 \global\page@numR=\next@actionR
2692 \ifbypage@R
2693 \global\line@numR \z@ \global\subline@numR \z@
2694 \fi
2695 \else
2696 \ifnum\next@actionR<-4999\relax % 9/05 added relax here
2697 \@l@dtempcnta=-\next@actionR
2698 \advance\@l@dtempcnta by -5001\relax
2699 \ifsublines@
2700 \global\subline@numR=\@l@dtempcnta
2701 \else
2702 \global\line@numR=\@l@dtempcnta
2703 \fi
2704 \else
2705 \@l@dtempcnta=-\next@actionR
2706 \advance\@l@dtempcnta by -1000\relax
2707 \do@actions@fixedcodeR
2708 \fi
2709 \fi
2710 \ifx\actionlines@listR\empty
2711 \gdef\next@actionlineR{1000000}%
2712 \else
2713 \gl@p\actionlines@listR\to\next@actionlineR
2714 \gl@p\actions@listR\to\next@actionR
2715 \global\let\do@actions@nextR=\do@actionsR
2716 \fi
2717 \fi
2718 \do@actions@nextR}
2719
2720 % \end{macrocode}
2721 % \end{macro}
2722 % \end{macro}
2723 % \end{macro}
2724 %
2725 % \subsection{Line number printing}
2726 %
2727 % \begin{macro}{\l@dcalcnum}
2728 % \begin{macro}{\ch@cksub@l@ckR}
2729 % \begin{macro}{\ch@ck@l@ckR}
2730 % \begin{macro}{\f@x@l@cksR}
2731 % \begin{macro}{\affixline@numR}
2732 % \cs{affixline@numR} is the right text version of the
2733 % \cs{affixline@num} macro.
2734 % \changes{v0.3}{2005/02/24}{Changed \cs{affixline@numR} to match new ledmac}
2735 % \changes{v0.11}{2012/06/11}{Changed \cs{affixline@numR} to allow to disable line numbering (like in ledmac 0.15).}
2736 % \begin{macrocode}
2737
2738 \providecommand*{\l@dcalcnum}[3]{%
2739 \ifnum #1 > #2\relax
2740 \@l@dtempcnta = #1\relax
2741 \advance\@l@dtempcnta by -#2\relax
2742 \divide\@l@dtempcnta by #3\relax
2743 \multiply\@l@dtempcnta by #3\relax
2744 \advance\@l@dtempcnta by #2\relax
2745 \else
2746 \@l@dtempcnta=#2\relax
2747 \fi}
2748
2749 \newcommand*{\ch@cksub@l@ckR}{%
2750 \ifcase\sub@lockR
2751 \or
2752 \ifnum\sublock@disp=\@ne
2753 \@l@dtempcntb \z@ \@l@dtempcnta \@ne
2754 \fi
2755 \or
2756 \ifnum\sublock@disp=\tw@
2757 \else
2758 \@l@dtempcntb \z@ \@l@dtempcnta \@ne
2759 \fi
2760 \or
2761 \ifnum\sublock@disp=\z@
2762 \@l@dtempcntb \z@ \@l@dtempcnta \@ne
2763 \fi
2764 \fi}
2765
2766 \newcommand*{\ch@ck@l@ckR}{%
2767 \ifcase\@lockR
2768 \or
2769 \ifnum\lock@disp=\@ne
2770 \@l@dtempcntb \z@ \@l@dtempcnta \@ne
2771 \fi
2772 \or
2773 \ifnum\lock@disp=\tw@
2774 \else
2775 \@l@dtempcntb \z@ \@l@dtempcnta \@ne
2776 \fi
2777 \or
2778 \ifnum\lock@disp=\z@
2779 \@l@dtempcntb \z@ \@l@dtempcnta \@ne
2780 \fi
2781 \fi}
2782
2783 \newcommand*{\f@x@l@cksR}{%
2784 \ifcase\@lockR
2785 \or
2786 \global\@lockR \tw@
2787 \or \or
2788 \global\@lockR \z@
2789 \fi
2790 \ifcase\sub@lockR
2791 \or
2792 \global\sub@lockR \tw@
2793 \or \or
2794 \global\sub@lockR \z@
2795 \fi}
2796
2797
2798 \newcommand*{\affixline@numR}{%
2799 \ifnumberline
2800 \ifl@dskipnumber
2801 \global\l@dskipnumberfalse
2802 \else
2803 \ifsublines@
2804 \@l@dtempcntb=\subline@numR
2805 \l@dcalcnum{\subline@numR}{\c@firstsublinenumR}{\c@sublinenumincrementR}%
2806 \ch@cksub@lockR
2807 \else
2808 \@l@dtempcntb=\line@numR
2809 \ifx\linenumberlist\empty
2810 \l@dcalcnum{\line@numR}{\c@firstlinenumR}{\c@linenumincrementR}%
2811 \else
2812 \@l@dtempcnta=\line@numR
2813 \edef\rem@inder{,\linenumberlist,\number\line@numR,}%
2814 \edef\sc@n@list{\def\noexpand\sc@n@list
2815 ####1,\number\@l@dtempcnta,####2|{\def\noexpand\rem@inder{####2}}}%
2816 \sc@n@list\expandafter\sc@n@list\rem@inder|%
2817 \ifx\rem@inder\empty\advance\@l@dtempcnta\@ne\fi
2818 \fi
2819 \ch@ck@l@ckR
2820 \fi
2821 \ifnum\@l@dtempcnta=\@l@dtempcntb
2822 \if@twocolumn
2823 \if@firstcolumn
2824 \gdef\l@dld@ta{\llap{{\leftlinenumR}}}%
2825 \else
2826 \gdef\l@drd@ta{\rlap{{\rightlinenumR}}}%
2827 \fi
2828 \else
2829 \@l@dtempcntb=\line@marginR
2830 \ifnum\@l@dtempcntb>\@ne
2831 \advance\@l@dtempcntb by\page@numR
2832 \fi
2833 \ifodd\@l@dtempcntb
2834 \gdef\l@drd@ta{\rlap{{\rightlinenumR}}}%
2835 \else
2836 \gdef\l@dld@ta{\llap{{\leftlinenumR}}}%
2837 \fi
2838 \fi
2839 \fi
2840 \f@x@l@cksR
2841 \fi
2842 \fi}
2843 % \end{macrocode}
2844 % \end{macro}
2845 % \end{macro}
2846 % \end{macro}
2847 % \end{macro}
2848 % \end{macro}
2849 % \subsection{Pstart number printing in side}
2850 % The printing of the pstart number is like in ledmac, with two differences :
2851 %\begin{itemize}
2852 %\item Some commands have versions suffixed by R or L.
2853 %\item The \cs{affixpstart@num} and \cs{affixpstart@numR} commands are called in the \cs{Pages} command. Consequently, the \verb|pstartL| and \verb|pstartR| counters must be reset at the begining of this command.
2854 %\end{itemize}
2855 % \begin{macro}{\affixpstart@numL}
2856 % \begin{macro}{\affixpstart@numR}
2857 % \begin{macro}{\leftpstartnumR}
2858 % \begin{macro}{\rightpstartnumR}
2859 % \begin{macro}{\leftpstartnumL}
2860 % \begin{macro}{\rightpstartnumL}
2861 % \begin{macro}{\ifpstartnumR}
2862 % \begin{macrocode}
2863
2864 \newcommand*{\affixpstart@numL}{%
2865 \ifsidepstartnum
2866 \if@twocolumn
2867 \if@firstcolumn
2868 \gdef\l@dld@ta{\llap{{\leftpstartnumL}}}%
2869 \else
2870 \gdef\l@drd@ta{\rlap{{\rightpstartnumL}}}%
2871 \fi
2872 \else
2873 \@l@dtempcntb=\line@margin
2874 \ifnum\@l@dtempcntb>\@ne
2875 \advance\@l@dtempcntb \page@num
2876 \fi
2877 \ifodd\@l@dtempcntb
2878 \gdef\l@drd@ta{\rlap{{\rightpstartnumL}}}%
2879 \else
2880 \gdef\l@dld@ta{\llap{{\leftpstartnumL}}}%
2881 \fi
2882 \fi
2883 \fi
2884 }
2885 \newcommand*{\affixpstart@numR}{%
2886 \ifsidepstartnum
2887 \if@twocolumn
2888 \if@firstcolumn
2889 \gdef\l@dld@ta{\llap{{\leftpstartnumR}}}%
2890 \else
2891 \gdef\l@drd@ta{\rlap{{\rightpstartnumR}}}%
2892 \fi
2893 \else
2894 \@l@dtempcntb=\line@marginR
2895 \ifnum\@l@dtempcntb>\@ne
2896 \advance\@l@dtempcntb \page@numR
2897 \fi
2898 \ifodd\@l@dtempcntb
2899 \gdef\l@drd@ta{\rlap{{\rightpstartnumR}}}%
2900 \else
2901 \gdef\l@dld@ta{\llap{{\leftpstartnumR}}}%
2902 \fi
2903 \fi
2904 \fi
2905 }
2906
2907 \newcommand*{\leftpstartnumL}{
2908 \ifpstartnum
2909 \thepstartL
2910 \kern\linenumsep\global\pstartnumfalse\fi
2911 }
2912 \newcommand*{\rightpstartnumL}{
2913 \ifpstartnum\kern\linenumsep
2914 \thepstartL
2915 \global\pstartnumfalse\fi
2916 }
2917 \newif\ifpstartnumR
2918 \pstartnumRtrue
2919 \newcommand*{\leftpstartnumR}{
2920 \ifpstartnumR
2921 \thepstartR
2922 \kern\linenumsep\global\pstartnumRfalse\fi
2923 }
2924 \newcommand*{\rightpstartnumR}{
2925 \ifpstartnumR\kern\linenumsep
2926 \thepstartR
2927 \global\pstartnumRfalse\fi
2928 }
2929 % \end{macrocode}
2930 % \end{macro}
2931 % \end{macro}
2932 % \end{macro}
2933 % \end{macro}
2934 % \end{macro}
2935 % \end{macro}
2936 % \end{macro}
2937 % \subsection{Add insertions to the vertical list}
2938 %
2939 % \begin{macro}{\inserts@listR}
2940 % \cs{inserts@listR} is the list macro that contains the inserts that
2941 % we save up for one right text paragraph.
2942 %
2943 % \begin{macrocode}
2944 \list@create{\inserts@listR}
2945 % \end{macrocode}
2946 % \end{macro}
2947 %
2948 %
2949 % \begin{macro}{\add@insertsR}
2950 % \begin{macro}{\add@inserts@nextR}
2951 % The right text version.
2952 % \begin{macrocode}
2953 \newcommand*{\add@insertsR}{%
2954 \global\let\add@inserts@nextR=\relax
2955 \ifx\inserts@listR\empty \else
2956 \ifx\next@insertR\empty
2957 \ifx\insertlines@listR\empty
2958 \global\noteschanged@true
2959 \gdef\next@insertR{100000}%
2960 \else
2961 \gl@p\insertlines@listR\to\next@insertR
2962 \fi
2963 \fi
2964 \ifnum\next@insertR=\absline@numR
2965 \gl@p\inserts@listR\to\@insertR
2966 \@insertR
2967 \global\let\@insertR=\undefined
2968 \global\let\next@insertR=\empty
2969 \global\let\add@inserts@nextR=\add@insertsR
2970 \fi
2971 \fi
2972 \add@inserts@nextR}
2973
2974 % \end{macrocode}
2975 % \end{macro}
2976 % \end{macro}
2977 %
2978 % \subsection{Penalties}
2979 %
2980 % \begin{macro}{\add@penaltiesL}
2981 % \begin{macro}{\add@penaltiesR}
2982 % \cs{add@penaltiesL} is
2983 % the last macro used by \cs{do@lineL}. It adds up the club,
2984 % widow, and interline penalties, and puts a single penalty
2985 % of the appropriate size
2986 % back into the paragraph; these penalties get
2987 % removed by the \cs{vsplit} operation. \cs{displaywidowpenalty} and
2988 % \cs{brokenpenalty} are not restored, since we have no easy way to
2989 % find out where we should insert them.
2990 %
2991 % \phantomsection\label{add@penalties}
2992 % In the code below, which is a virtual copy of the original
2993 % \cs{add@penalties}, \cs{num@lines} is the number of lines in the whole
2994 % paragraph, and \cs{par@line} is the line we're working on at the
2995 % moment. The count \cs{@l@dtempcnta} is used to calculate and
2996 % accumulate the penalty; it is initially set to the value of
2997 % \cs{ballast@count}, which has been worked out in \cs{do@ballast}.
2998 % Finally, the penalty is
2999 % checked to see that it doesn't go below $-10000$.
3000 % \begin{verbatim}
3001 % \newcommand*{\add@penaltiesR}{\@l@dtempcnta=\ballast@count
3002 % \ifnum\num@linesR>\@ne
3003 % \global\advance\par@lineR \@ne
3004 % \ifnum\par@lineR=\@ne
3005 % \advance\@l@dtempcnta by \clubpenalty
3006 % \fi
3007 % \@l@dtempcntb=\par@lineR \advance\@l@dtempcntb \@ne
3008 % \ifnum\@l@dtempcntb=\num@linesR
3009 % \advance\@l@dtempcnta by \widowpenalty
3010 % \fi
3011 % \ifnum\par@lineR<\num@linesR
3012 % \advance\@l@dtempcnta by \interlinepenalty
3013 % \fi
3014 % \fi
3015 % \ifnum\@l@dtempcnta=\z@
3016 % \relax
3017 % \else
3018 % \ifnum\@l@dtempcnta>-10000
3019 % \penalty\@l@dtempcnta
3020 % \else
3021 % \penalty -10000
3022 % \fi
3023 % \fi}
3024 % \end{verbatim}
3025 % This is for a single chunk. However, as we are probably dealing
3026 % with several chunks at a time, the above is nor really relevant. I think
3027 % that it is likely with parallel text that there is no real need to add
3028 % back any penalties; even if there was, they would have to match across the
3029 % left and right lines. So, I end up with the following.
3030 %
3031 % \begin{macrocode}
3032 \newcommand*{\add@penaltiesL}{}
3033 \newcommand*{\add@penaltiesR}{}
3034
3035 % \end{macrocode}
3036 % \end{macro}
3037 % \end{macro}
3038 %
3039 % \subsection{Printing leftover notes}
3040 %
3041 % \begin{macro}{\flush@notesR}
3042 % The \cs{flush@notesR}
3043 % macro is called after the entire right text has been sliced up
3044 % and sent on to the vertical list.
3045 % \begin{macrocode}
3046 \newcommand*{\flush@notesR}{%
3047 \@xloop
3048 \ifx\inserts@listR\empty \else
3049 \gl@p\inserts@listR\to\@insertR
3050 \@insertR
3051 \global\let\@insertR=\undefined
3052 \repeat}
3053
3054 % \end{macrocode}
3055 % \end{macro}
3056 %
3057 %
3058 % \section{Footnotes}
3059 % \label{footnotes}\relax
3060 %
3061 % \subsection{Outer-level footnote commands}
3062 % \begin{macro}{\Afootnote}
3063 % The outer-level footnote commands will look familiar: they're
3064 % just called \cs{Afootnote}, \cs{Bfootnote}, etc., instead of
3065 % plain \cs{footnote}. What they do, however, is quite different,
3066 % since they have to operate in conjunction with \cs{edtext} when
3067 % numbering is in effect.
3068 %
3069 % If we're within a line-numbered paragraph, then, we tack this note onto
3070 % the \cs{inserts@list} list, and increment the deferred-page-bottom-note
3071 % counter.
3072 % \begin{macrocode}
3073 \renewcommand*{\Afootnote}[1]{%
3074 \ifnumberedpar@
3075 \ifledRcol
3076 \xright@appenditem{\noexpand\vAfootnote{A}%
3077 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@listR
3078 \global\advance\insert@countR \@ne
3079 \else
3080 \xright@appenditem{\noexpand\vAfootnote{A}%
3081 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list
3082 \global\advance\insert@count \@ne
3083 \fi
3084 % \end{macrocode}
3085 %
3086 % Within free text, there's no need to put off making the insertion
3087 % for this note. No line numbers are available, so this isn't generally
3088 % that useful; but you might want to use it to get around some
3089 % limitation of \Ledmac.
3090 % \begin{macrocode}
3091 \else
3092 \vAfootnote{A}{{0|0|0|0|0|0|0}{}{#1}}%
3093 \fi\ignorespaces}
3094 % \end{macrocode}
3095 % \end{macro}
3096 %
3097 % \begin{macro}{\Bfootnote}
3098 % \begin{macro}{\Cfootnote}
3099 % \begin{macro}{\Dfootnote}
3100 % \begin{macro}{\Efootnote}
3101 % We need similar commands for the other footnote series.
3102 % \begin{macrocode}
3103 \renewcommand*{\Bfootnote}[1]{%
3104 \ifnumberedpar@
3105 \ifledRcol
3106 \xright@appenditem{\noexpand\vBfootnote{B}%
3107 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@listR
3108 \global\advance\insert@countR \@ne
3109 \else
3110 \xright@appenditem{\noexpand\vBfootnote{B}%
3111 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list
3112 \global\advance\insert@count \@ne
3113 \fi
3114 \else
3115 \vBfootnote{B}{{0|0|0|0|0|0|0}{}{#1}}%
3116 \fi\ignorespaces}
3117 % \end{macrocode}
3118 % \begin{macrocode}
3119 \renewcommand*{\Cfootnote}[1]{%
3120 \ifnumberedpar@
3121 \ifledRcol
3122 \xright@appenditem{\noexpand\vCfootnote{C}%
3123 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@listR
3124 \global\advance\insert@countR \@ne
3125 \else
3126 \xright@appenditem{\noexpand\vCfootnote{C}%
3127 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list
3128 \global\advance\insert@count \@ne
3129 \fi
3130 \else
3131 \vCfootnote{C}{{0|0|0|0|0|0|0}{}{#1}}%
3132 \fi\ignorespaces}
3133 % \end{macrocode}
3134 % \begin{macrocode}
3135 \renewcommand*{\Dfootnote}[1]{%
3136 \ifnumberedpar@
3137 \ifledRcol
3138 \xright@appenditem{\noexpand\vDfootnote{D}%
3139 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@listR
3140 \global\advance\insert@countR \@ne
3141 \else
3142 \xright@appenditem{\noexpand\vDfootnote{D}%
3143 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list
3144 \global\advance\insert@count \@ne
3145 \fi
3146 \else
3147 \vDfootnote{D}{{0|0|0|0|0|0|0}{}{#1}}%
3148 \fi\ignorespaces}
3149 % \end{macrocode}
3150 % \begin{macrocode}
3151 \renewcommand*{\Efootnote}[1]{%
3152 \ifnumberedpar@
3153 \ifledRcol
3154 \xright@appenditem{\noexpand\vEfootnote{E}%
3155 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@listR
3156 \global\advance\insert@countR \@ne
3157 \else
3158 \xright@appenditem{\noexpand\vEfootnote{E}%
3159 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list
3160 \global\advance\insert@count \@ne
3161 \fi
3162 \else
3163 \vEfootnote{E}{{0|0|0|0|0|0|0}{}{#1}}%
3164 \fi\ignorespaces}
3165
3166 % \end{macrocode}
3167 % \end{macro}
3168 % \end{macro}
3169 % \end{macro}
3170 % \end{macro}
3171 %
3172 % \begin{macro}{\mpAfootnote}
3173 % \begin{macro}{\mpBfootnote}
3174 % \begin{macro}{\mpCfootnote}
3175 % \begin{macro}{\mpDfootnote}
3176 % \begin{macro}{\mpEfootnote}
3177 % For footnotes in minipages and the like, we need a similar series of commands.
3178 % \begin{macrocode}
3179 \renewcommand*{\mpAfootnote}[1]{%
3180 \ifnumberedpar@
3181 \ifledRcol
3182 \xright@appenditem{\noexpand\mpvAfootnote{A}%
3183 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@listR
3184 \global\advance\insert@countR \@ne
3185 \else
3186 \xright@appenditem{\noexpand\mpvAfootnote{A}%
3187 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list
3188 \global\advance\insert@count \@ne
3189 \fi
3190 \else
3191 \mpvAfootnote{A}{{0|0|0|0|0|0|0}{}{#1}}%
3192 \fi\ignorespaces}
3193 % \end{macrocode}
3194 % \begin{macrocode}
3195 \renewcommand*{\mpBfootnote}[1]{%
3196 \ifnumberedpar@
3197 \ifledRcol
3198 \xright@appenditem{\noexpand\mpvBfootnote{B}%
3199 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@listR
3200 \global\advance\insert@countR \@ne
3201 \else
3202 \xright@appenditem{\noexpand\mpvBfootnote{B}%
3203 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list
3204 \global\advance\insert@count \@ne
3205 \fi
3206 \else
3207 \mpvBfootnote{B}{{0|0|0|0|0|0|0}{}{#1}}%
3208 \fi\ignorespaces}
3209 % \end{macrocode}
3210 % \begin{macrocode}
3211 \renewcommand*{\mpCfootnote}[1]{%
3212 \ifnumberedpar@
3213 \ifledRcol
3214 \xright@appenditem{\noexpand\mpvCfootnote{C}%
3215 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@listR
3216 \global\advance\insert@countR \@ne
3217 \else
3218 \xright@appenditem{\noexpand\mpvCfootnote{C}%
3219 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list
3220 \global\advance\insert@count \@ne
3221 \fi
3222 \else
3223 \mpvCfootnote{C}{{0|0|0|0|0|0|0}{}{#1}}%
3224 \fi\ignorespaces}
3225 % \end{macrocode}
3226 % \begin{macrocode}
3227 \renewcommand*{\mpDfootnote}[1]{%
3228 \ifnumberedpar@
3229 \ifledRcol
3230 \xright@appenditem{\noexpand\mpvDfootnote{D}%
3231 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@listR
3232 \global\advance\insert@countR \@ne
3233 \else
3234 \xright@appenditem{\noexpand\mpvDfootnote{D}%
3235 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list
3236 \global\advance\insert@count \@ne
3237 \fi
3238 \else
3239 \mpvDfootnote{D}{{0|0|0|0|0|0|0}{}{#1}}%
3240 \fi\ignorespaces}
3241 % \end{macrocode}
3242 % \begin{macrocode}
3243 \renewcommand*{\mpEfootnote}[1]{%
3244 \ifnumberedpar@
3245 \ifledRcol
3246 \xright@appenditem{\noexpand\mpvEfootnote{E}%
3247 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@listR
3248 \global\advance\insert@countR \@ne
3249 \else
3250 \xright@appenditem{\noexpand\mpvEfootnote{E}%
3251 {{\l@d@nums}{\@tag}{#1}}}\to\inserts@list
3252 \global\advance\insert@count \@ne
3253 \fi
3254 \else
3255 \mpvEfootnote{E}{{0|0|0|0|0|0|0}{}{#1}}%
3256 \fi\ignorespaces}
3257 % \end{macrocode}
3258 % \end{macro}
3259 % \end{macro}
3260 % \end{macro}
3261 % \end{macro}
3262 % \end{macro}
3263 % \begin{macro}{\l@dedendmini}
3264 % \begin{macrocode}
3265 \renewcommand*{\l@dedendmini}{%
3266 \ifl@dpairing
3267 \ifledRcol
3268 \flush@notesR
3269 \else
3270 \flush@notes
3271 \fi
3272 \fi
3273 \ifvoid\mpAfootins\else\mpAfootgroup{A}\fi%
3274 \ifvoid\mpBfootins\else\mpBfootgroup{B}\fi%
3275 \ifvoid\mpCfootins\else\mpCfootgroup{C}\fi%
3276 \ifvoid\mpDfootins\else\mpDfootgroup{D}\fi%
3277 \ifvoid\mpEfootins\else\mpEfootgroup{E}\fi}
3278 % \end{macrocode}
3279 % \end{macro}
3280 % \subsection{Normal footnote formatting} \label{sec:nfootformat}
3281 %
3282 % The \cs{printlines} macro prints the line
3283 % numbers for a note---which, in the
3284 % general case, is a rather complicated task.
3285 % The seven parameters of the
3286 % argument are the line numbers as stored in \cs{l@d@nums}, in the
3287 % form described on page \pageref{linenumbers}: the starting
3288 % page, line, and sub-line numbers, followed by the ending page,
3289 % line, and sub-line numbers, and then the font specifier for
3290 % the lemma.
3291 %
3292 %
3293 % \begin{macro}{\printlinesR}
3294 % \begin{macro}{\ledsavedprintlines}
3295 % This is the right text version of \cs{printlines} and takes account
3296 % of \cs{Rlineflag}. Just in case, \cs{ledsavedprintlines} is a copy
3297 % of the original \cs{printlines}.
3298 %
3299 % Just a reminder of the arguments: \\
3300 % \verb?\printlinesR #1 | #2 | #3 | #4 | #5 | #6 | #7? \\
3301 % \verb?\printlinesR start-page | line | subline | end-page | line | subline | font ?
3302 % \changes{v0.3}{2005/02/10}{Simplified \cs{printlinesR} by using
3303 % \cs{setprintlines}}
3304 % \begin{macrocode}
3305 \def\printlinesR#1|#2|#3|#4|#5|#6|#7|{\begingroup
3306 \setprintlines{#1}{#2}{#3}{#4}{#5}{#6}%
3307 \ifl@d@pnum #1\fullstop\fi
3308 \ifledplinenum \linenumr@p{#2}\Rlineflag\else \symplinenum\fi
3309 \ifl@d@ssub \fullstop \sublinenumr@p{#3}\fi
3310 \ifl@d@dash \endashchar\fi
3311 \ifl@d@pnum #4\fullstop\fi
3312 \ifl@d@elin \linenumr@p{#5}\Rlineflag\fi
3313 \ifl@d@esl \ifl@d@elin \fullstop\fi \sublinenumr@p{#6}\fi
3314 \endgroup}
3315
3316 \let\ledsavedprintlines\printlines
3317
3318 % \end{macrocode}
3319 % \end{macro}
3320 % \end{macro}
3321 %
3322 %
3323 %
3324 % \section{Cross referencing}
3325 % \label{xref}\relax
3326 %
3327 %
3328 % \begin{macro}{\labelref@listR}
3329 % Set up a new list, \cs{labelref@listR}, to hold the page, line and
3330 % sub-line numbers for each label in right text.
3331 % \begin{macrocode}
3332 \list@create{\labelref@listR}
3333
3334 % \end{macrocode}
3335 % \end{macro}
3336 %
3337 %
3338 % \begin{macro}{\edlabel}
3339 % The \cs{edlabel} command first writes a \cs{@lab} macro to
3340 % the \cs{linenum@out} file. It then checks to see that the
3341 % \cs{labelref@list} actually has something in it (if not, it
3342 % creates a dummy entry), and pops the next value for the current
3343 % label, storing it in \cs{label@refs}. Finally it defines the
3344 % label to be \cs{empty} so that any future check will turn up
3345 % the fact that it has been used.
3346 % \begin{macrocode}
3347 \renewcommand*{\edlabel}[1]{\@bsphack
3348 \ifledRcol
3349 \write\linenum@outR{\string\@lab}%
3350 \ifx\labelref@listR\empty
3351 \xdef\label@refs{\zz@@@}%
3352 \else
3353 \gl@p\labelref@listR\to\label@refs
3354 \fi
3355 \ifvmode
3356 \advancelabel@refs
3357 \fi
3358 \protected@write\@auxout{}%
3359 {\string\l@dmake@labelsR\space\thepage|\label@refs|{#1}}%
3360 \else
3361 \write\linenum@out{\string\@lab}%
3362 \ifx\labelref@list\empty
3363 \xdef\label@refs{\zz@@@}%
3364 \else
3365 \gl@p\labelref@list\to\label@refs
3366 \fi
3367 \ifvmode
3368 \advancelabel@refs
3369 \fi
3370 \protected@write\@auxout{}%
3371 {\string\l@dmake@labels\space\thepage|\label@refs|{#1}}%
3372 \fi
3373 \@esphack}
3374
3375 % \end{macrocode}
3376 % \end{macro}
3377 %
3378 % \begin{macro}{\l@dmake@labelsR}
3379 % This is the right text version of \cs{l@dmake@labels}, taking account
3380 % of \cs{Rlineflag}.
3381 %
3382 % \begin{macrocode}
3383 \def\l@dmake@labelsR#1|#2|#3|#4{%
3384 \expandafter\ifx\csname the@label#4\endcsname \relax\else
3385 \led@warn@DuplicateLabel{#4}%
3386 \fi
3387 \expandafter\gdef\csname the@label#4\endcsname{#1|#2\Rlineflag|#3}%
3388 \ignorespaces}
3389 \AtBeginDocument{%
3390 \def\l@dmake@labelsR#1|#2|#3|#4{}%
3391 }
3392
3393 % \end{macrocode}
3394 % \end{macro}
3395 %
3396 %
3397 % \begin{macro}{\@lab}
3398 % The \cs{@lab} command, which appears in the \cs{linenum@out} file,
3399 % appends the current values of page, line and sub-line to the
3400 % \cs{labelref@list}. These values are defined by the earlier
3401 % \cs{@page}, \cs{@l}, and the \cs{sub@on} and \cs{sub@off} commands
3402 % appearing in the \cs{linenum@out} file.
3403 %
3404 % \begin{macrocode}
3405 \renewcommand*{\@lab}{%
3406 \ifledRcol
3407 \xright@appenditem{\linenumr@p{\line@numR}|%
3408 \ifsublines@ \sublinenumr@p{\subline@numR}\else 0\fi}%
3409 \to\labelref@listR
3410 \else
3411 \xright@appenditem{\linenumr@p{\line@num}|%
3412 \ifsublines@ \sublinenumr@p{\subline@num}\else 0\fi}%
3413 \to\labelref@list
3414 \fi}
3415
3416 % \end{macrocode}
3417 % \end{macro}
3418 %
3419 %
3420 % \section{Side notes}
3421 %
3422 % Regular \verb?\marginpar?s do not work inside numbered text --- they
3423 % don't produce any note but do put an extra unnumbered blank line into
3424 % the text.
3425 % \begin{macro}{\sidenote@marginR}
3426 % \begin{macro}{\sidenotemargin}
3427 % Specifies which margin sidenotes can be in.
3428 % \begin{macrocode}
3429 \newcount\sidenote@marginR
3430 \renewcommand*{\sidenotemargin}[1]{{%
3431 \l@dgetsidenote@margin{#1}%
3432 \ifnum\@l@dtempcntb>\m@ne
3433 \ifledRcol
3434 \global\sidenote@marginR=\@l@dtempcntb
3435 \else
3436 \global\sidenote@margin=\@l@dtempcntb
3437 \fi
3438 \fi}}
3439 \sidenotemargin{right}
3440 \global\sidenote@margin=\@ne
3441
3442 % \end{macrocode}
3443 % \end{macro}
3444 % \end{macro}
3445 %
3446 % \begin{macro}{\l@dlsnote}
3447 % \begin{macro}{\l@drsnote}
3448 % \begin{macro}{\l@dcsnote}
3449 % The `footnotes' for left, right, and moveable sidenotes. The whole
3450 % scheme is reminiscent of the critical footnotes code.
3451 % \begin{macrocode}
3452 \renewcommand*{\l@dlsnote}[1]{%
3453 \ifnumberedpar@
3454 \ifledRcol
3455 \xright@appenditem{\noexpand\vl@dlsnote{#1}}%
3456 \to\inserts@listR
3457 \global\advance\insert@countR \@ne
3458 \else
3459 \xright@appenditem{\noexpand\vl@dlsnote{#1}}%
3460 \to\inserts@list
3461 \global\advance\insert@count \@ne
3462 \fi
3463 \fi\ignorespaces}
3464 \renewcommand*{\l@drsnote}[1]{%
3465 \ifnumberedpar@
3466 \ifledRcol
3467 \xright@appenditem{\noexpand\vl@drsnote{#1}}%
3468 \to\inserts@listR
3469 \global\advance\insert@countR \@ne
3470 \else
3471 \xright@appenditem{\noexpand\vl@drsnote{#1}}%
3472 \to\inserts@list
3473 \global\advance\insert@count \@ne
3474 \fi
3475 \fi\ignorespaces}
3476 \renewcommand*{\l@dcsnote}[1]{%
3477 \ifnumberedpar@
3478 \ifledRcol
3479 \xright@appenditem{\noexpand\vl@dcsnote{#1}}%
3480 \to\inserts@listR
3481 \global\advance\insert@countR \@ne
3482 \else
3483 \xright@appenditem{\noexpand\vl@dcsnote{#1}}%
3484 \to\inserts@list
3485 \global\advance\insert@count \@ne
3486 \fi
3487 \fi\ignorespaces}
3488
3489 % \end{macrocode}
3490 % \end{macro}
3491 % \end{macro}
3492 % \end{macro}
3493 %
3494 % \begin{macro}{\affixside@noteR}
3495 % The right text version of \cs{affixside@note}.
3496 % \begin{macrocode}
3497 \newcommand*{\affixside@noteR}{%
3498 \gdef\@templ@d{}%
3499 \ifx\@templ@d\l@dcsnotetext \else
3500 \if@twocolumn
3501 \if@firstcolumn
3502 \setl@dlp@rbox{\l@dcsnotetext}%
3503 \else
3504 \setl@drp@rbox{\l@dcsnotetext}%
3505 \fi
3506 \else
3507 \@l@dtempcntb=\sidenote@marginR
3508 \ifnum\@l@dtempcntb>\@ne
3509 \advance\@l@dtempcntb by\page@num
3510 \fi
3511 \ifodd\@l@dtempcntb
3512 \setl@drp@rbox{\l@dcsnotetext}%
3513 \else
3514 \setl@dlp@rbox{\l@dcsnotetext}%
3515 \fi
3516 \fi
3517 \fi}
3518
3519 % \end{macrocode}
3520 % \end{macro}
3521 %
3522 %
3523 % \section{Familiar footnotes}
3524 %
3525 %
3526 % \begin{macro}{\l@dbfnote}
3527 % \verb?\l@dbfnote? adds the footnote to the insert list, and
3528 % \verb?\vl@dbfnote? calls the original \verb?\@footnotetext?.
3529 % \begin{macrocode}
3530 \renewcommand{\l@dbfnote}[1]{%
3531 \ifnumberedpar@
3532 \ifledRcol
3533 \xright@appenditem{\noexpand\vl@dbfnote{{#1}}{\@thefnmark}}%
3534 \to\inserts@listR
3535 \global\advance\insert@countR \@ne
3536 \else
3537 \xright@appenditem{\noexpand\vl@dbfnote{{#1}}{\@thefnmark}}%
3538 \to\inserts@list
3539 \global\advance\insert@count \@ne
3540 \fi
3541 \fi\ignorespaces}
3542
3543 % \end{macrocode}
3544 % \end{macro}
3545 %
3546 %
3547 % \begin{macro}{\normalbfnoteX}
3548 % \changes{v0.3}{2005/02/04}{Removed extraneous spaces from \cs{normalbfnoteX}}
3549 % \begin{macrocode}
3550 \renewcommand{\normalbfnoteX}[2]{%
3551 \ifnumberedpar@
3552 \ifledRcol
3553 \xright@appenditem{\noexpand\vbfnoteX{#1}{#2}{\@nameuse{thefootnote#1}}}%
3554 \to\inserts@listR
3555 \global\advance\insert@countR \@ne
3556 \else
3557 \xright@appenditem{\noexpand\vbfnoteX{#1}{#2}{\@nameuse{thefootnote#1}}}%
3558 \to\inserts@list
3559 \global\advance\insert@count \@ne
3560 \fi
3561 \fi\ignorespaces}
3562
3563 % \end{macrocode}
3564 % \end{macro}
3565 %
3566 %
3567
3568 % \section{Verse}
3569 %\changes{v0.11}{2012/06/11}{New management of hangingsymbol insertion, preventing undesirable insertions.}
3570 %\changes{v0.12}{2012/08/03}{New new management of hangingsymbol insertion, preventing undesirable insertions.}
3571 % Like in ledmac, the insertion of hangingsymbol is based on \cs{ifinserthangingsymbol}, and, for the right side, on \cs{ifinserthangingsymbolR}.
3572 % \begin{macro}{\inserthangingsymbolL}
3573 % \begin{macro}{\inserthangingsymbolR}
3574 % \begin{macrocode}
3575 \newif\ifinserthangingsymbolR
3576 \newcommand{\inserthangingsymbolL}{%
3577 \ifinserthangingsymbol%
3578 \ifinstanzaL%
3579 \hfill\hangingsymbol%
3580 \fi%
3581 \fi}
3582 \newcommand{\inserthangingsymbolR}{%
3583 \ifinserthangingsymbolR%
3584 \ifinstanzaR%
3585 \hfill\hangingsymbol%
3586 \fi%
3587 \fi}
3588 % \end{macrocode}
3589 % \end{macro}
3590 % \end{macro}
3591 %\changes{v0.11}{2012/06/11}{Prevent shift of column separator when a verse is hanged}
3592 % When a verse is hanged, the column separator is shifted. To prevent it, the \cs{do@lineL} and \cs{do@lineR} commands call \cs{correcthangingL} and \cs{correcthangingR} commands. These commands insert horizontal skip which length is equal to the hang indent.
3593 % \begin{macro}{\correcthangingL}
3594 % \begin{macro}{\correcthangingR}
3595 % \begin{macrocode}
3596 \newcommand{\correcthangingL}{%
3597 \ifl@dpaging\else%
3598 \ifinstanzaL%
3599 \ifinserthangingsymbol%
3600 \hskip \@ifundefined{sza@0@}{0}{\expandafter%
3601 \noexpand\csname sza@0@\endcsname}\stanzaindentbase%
3602 \fi%
3603 \fi%
3604 \fi}
3605
3606 \newcommand{\correcthangingR}{%
3607 \ifl@dpaging\else%
3608 \ifinstanzaR%
3609 \ifinserthangingsymbolR%
3610 \hskip \@ifundefined{sza@0@}{0}{\expandafter%
3611 \noexpand\csname sza@0@\endcsname}\stanzaindentbase%
3612 \fi%
3613 \fi%
3614 \fi}
3615 % \end{macrocode}
3616 % \end{macro}
3617 % \end{macro}
3618 % Before we can define the main stanza macros we need to be able to save
3619 % and reset
3620 % the category code for \&. To save the current value we use
3621 % \verb+\next+ from the \verb+\loop+ macro.
3622 % \begin{macrocode}
3623 \chardef\next=\catcode`\&
3624 \catcode`\&=\active
3625
3626 % \end{macrocode}
3627 %
3628 %
3629 %
3630 % \begin{environment}{astanza}
3631 % This is roughly an environmental form of \cs{stanza}, which treats
3632 % its stanza-like contents as a single chunk.
3633 %
3634 % \begin{macrocode}
3635 \newenvironment{astanza}{%
3636 \startstanzahook
3637 \catcode`\&\active
3638 \global\stanza@count\@ne
3639 \ifnum\usenamecount{sza@0@}=\z@
3640 \let\stanza@hang\relax
3641 \let\endlock\relax
3642 \else
3643 %%% \interlinepenalty\@M % this screws things up, but I don't know why
3644 \rightskip\z@ plus 1fil\relax
3645 \fi
3646 \ifnum\usenamecount{szp@0@}=\z@
3647 \let\sza@penalty\relax
3648 \fi
3649 \def&{%
3650 \endlock\mbox{}%
3651 \sza@penalty
3652 \global\advance\stanza@count\@ne
3653 \@astanza@line}%
3654 \def\&{%
3655 \endlock\mbox{}
3656 \pend
3657 \endstanzaextra}%
3658 \pstart
3659 \@astanza@line
3660 }{}
3661
3662 % \end{macrocode}
3663 % \end{environment}
3664 %
3665 % \begin{macro}{\@astanza@line}
3666 % This gets put at the start of each line in the environment. It sets up
3667 % the paragraph style --- each line is treated as a paragraph.
3668 % \begin{macrocode}
3669 \newcommand*{\@astanza@line}{%
3670 \parindent=\csname sza@\number\stanza@count @\endcsname\stanzaindentbase
3671 \par
3672 \stanza@hang%\mbox{}%
3673 \ignorespaces}
3674
3675 % \end{macrocode}
3676 % \end{macro}
3677 %
3678 % Lastly reset the modified category codes.
3679 % \begin{macrocode}
3680 \catcode`\&=\next
3681
3682 % \end{macrocode}
3683 %
3684 % \section{Naming macros}
3685 %
3686 % The LaTeX kernel provides \cs{@namedef} and \cs{@namuse} for defining
3687 % and using macros that may have non-letters in their names. We need
3688 % something similar here as we are going to need and use some numbered
3689 % boxes and counters.
3690 %
3691 % \begin{macro}{\newnamebox}
3692 % \begin{macro}{\setnamebox}
3693 % \begin{macro}{\unhnamebox}
3694 % \begin{macro}{\unvnamebox}
3695 % \begin{macro}{\namebox}
3696 % A set of macros for creating and using `named'boxes; the macros are called
3697 % after the regular box macros, but including the string `name'.
3698 % \begin{macrocode}
3699 \providecommand*{\newnamebox}[1]{%
3700 \expandafter\newbox\csname #1\endcsname}
3701 \providecommand*{\setnamebox}[1]{%
3702 \expandafter\setbox\csname #1\endcsname}
3703 \providecommand*{\unhnamebox}[1]{%
3704 \expandafter\unhbox\csname #1\endcsname}
3705 \providecommand*{\unvnamebox}[1]{%
3706 \expandafter\unvbox\csname #1\endcsname}
3707 \providecommand*{\namebox}[1]{%
3708 \csname #1\endcsname}
3709
3710 % \end{macrocode}
3711 % \end{macro}
3712 % \end{macro}
3713 % \end{macro}
3714 % \end{macro}
3715 % \end{macro}
3716 %
3717 % \begin{macro}{\newnamecount}
3718 % \begin{macro}{\usenamecount}
3719 % Macros for creating and using `named' counts.
3720 % \begin{macrocode}
3721 \providecommand*{\newnamecount}[1]{%
3722 \expandafter\newcount\csname #1\endcsname}
3723 \providecommand*{\usenamecount}[1]{%
3724 \csname #1\endcsname}
3725
3726 % \end{macrocode}
3727 % \end{macro}
3728 % \end{macro}
3729 %
3730 % \section{Counts and boxes for parallel texts}
3731 %
3732 % In sequential text, each chunk (that enclosed by \cs{pstart} \ldots
3733 % \cs{pend}) is put into a box called \cs{raw@text} and then immediately
3734 % printed, resulting in the box being emptied and ready for the next chunk.
3735 % For parallel processing multiple boxes are needed as printing is delayed.
3736 % We also need extra counters for various things.
3737 %
3738 % \begin{macro}{\maxchunks}
3739 % \begin{macro}{\l@dc@maxchunks}
3740 % The maximum number of chunk pairs before printing has to be called for.
3741 % The default is 10 chunk pairs.
3742 % \begin{macrocode}
3743 \newcount\l@dc@maxchunks
3744 \newcommand{\maxchunks}[1]{\l@dc@maxchunks=#1}
3745 \maxchunks{10}
3746
3747 % \end{macrocode}
3748 % \end{macro}
3749 % \end{macro}
3750 %
3751 % \begin{macro}{\l@dnumpstartsL}
3752 % \begin{macro}{\l@dnumpstartsR}
3753 % The numbers of left and right chunks. \cs{l@dnumpstartsL} is defined
3754 % in \Lpack{ledmac}.
3755 % \changes{v0.3}{2005/02/24}{Moved \cs{l@dnumpstartsL} to ledmac}
3756 % \begin{macrocode}
3757 \newcount\l@dnumpstartsR
3758
3759 % \end{macrocode}
3760 % \end{macro}
3761 % \end{macro}
3762 %
3763 % \begin{macro}{\l@pscL}
3764 % \begin{macro}{\l@pscR}
3765 % A couple of scratch counts for use in left and right texts, respectively.
3766 % \begin{macrocode}
3767 \newcount\l@dpscL
3768 \newcount\l@dpscR
3769
3770 % \end{macrocode}
3771 % \end{macro}
3772 % \end{macro}
3773 %
3774 % \begin{macro}{\l@dsetuprawboxes}
3775 % This macro creates \cs{maxchunks} pairs of boxes for left and right
3776 % chunks. The boxes are called \cs{l@dLcolrawbox1}, \cs{l@dLcolrawbox2}, etc.
3777 % \begin{macrocode}
3778 \newcommand*{\l@dsetuprawboxes}{%
3779 \@l@dtempcntb=\l@dc@maxchunks
3780 \loop\ifnum\@l@dtempcntb>\z@
3781 \newnamebox{l@dLcolrawbox\the\@l@dtempcntb}
3782 \newnamebox{l@dRcolrawbox\the\@l@dtempcntb}
3783 \advance\@l@dtempcntb \m@ne
3784 \repeat}
3785
3786 % \end{macrocode}
3787 % \end{macro}
3788 %
3789 % \begin{macro}{\l@dsetupmaxlinecounts}
3790 % \begin{macro}{\l@dzeromaxlinecounts}
3791 % To be able to synchronise left and right texts we need
3792 % to know the maximum number of text lines there are in each pair of chunks.
3793 % \cs{l@dsetupmaxlinecounts} creates \cs{maxchunks} new counts
3794 % called \cs{l@dmaxlinesinpar1}, etc., and
3795 % \cs{l@dzeromaxlinecounts} zeroes all of them.
3796 % \begin{macrocode}
3797 \newcommand*{\l@dsetupmaxlinecounts}{%
3798 \@l@dtempcntb=\l@dc@maxchunks
3799 \loop\ifnum\@l@dtempcntb>\z@
3800 \newnamecount{l@dmaxlinesinpar\the\@l@dtempcntb}
3801 \advance\@l@dtempcntb \m@ne
3802 \repeat}
3803 \newcommand*{\l@dzeromaxlinecounts}{%
3804 \begingroup
3805 \@l@dtempcntb=\l@dc@maxchunks
3806 \loop\ifnum\@l@dtempcntb>\z@
3807 \global\usenamecount{l@dmaxlinesinpar\the\@l@dtempcntb}=\z@
3808 \advance\@l@dtempcntb \m@ne
3809 \repeat
3810 \endgroup}
3811
3812 % \end{macrocode}
3813 % \end{macro}
3814 % \end{macro}
3815 %
3816 % Make sure that all these are set up. This has to be done after the
3817 % user has had an opportunity to change \cs{maxchunks}.
3818 % \begin{macrocode}
3819 \AtBeginDocument{%
3820 \l@dsetuprawboxes
3821 \l@dsetupmaxlinecounts
3822 \l@dzeromaxlinecounts
3823 \l@dnumpstartsL=\z@
3824 \l@dnumpstartsR=\z@
3825 \l@dpscL=\z@
3826 \l@dpscR=\z@}
3827
3828 % \end{macrocode}
3829 %
3830 % \section{Fixing babel}
3831 %
3832 % With parallel texts there is the possibility that the two sides
3833 % might use different languages via \verb?babel?. On the other hand,
3834 % \verb?babel? might not be called at all (even though it might be already
3835 % built into the format).
3836 % \changes{v0.2}{2004/12/20}{Added section of babel related code}
3837 %
3838 % With the normal sequential text each line is initially typeset
3839 % in the current language environment, and then it is output at which
3840 % time its attachments are typeset (in the same language environment.
3841 % In the parallel case lines are typeset in their current language but
3842 % an attachment might be typeset outside the language environment
3843 % of its line if the left and right side languages are different.
3844 % To counter this, we have to make sure that the correct language is
3845 % used at the proper times.
3846 %
3847 % \begin{macro}{\ifl@dusedbabel}
3848 % \begin{macro}{\l@dusedbabelfalse}
3849 % \begin{macro}{\l@dusedbabeltrue}
3850 % A flag for checking if \verb?babel? has been used as a package.
3851 % \begin{macrocode}
3852 \newif\ifl@dusedbabel
3853 \l@dusedbabelfalse
3854 % \end{macrocode}
3855 % \end{macro}
3856 % \end{macro}
3857 % \end{macro}
3858 %
3859 % \begin{macro}{\ifl@dsamelang}
3860 % \begin{macro}{\l@dsamelangfalse}
3861 % \begin{macro}{\l@dsamelangtrue}
3862 % A flag for checking if the same \verb?babel? language has been used
3863 % for both the left and right texts.
3864 % \begin{macrocode}
3865 \newif\ifl@dsamelang
3866 \l@dsamelangtrue
3867 % \end{macrocode}
3868 % \end{macro}
3869 % \end{macro}
3870 % \end{macro}
3871 %
3872 % \begin{macro}{\l@dchecklang}
3873 % I'm going to use \cs{theledlanguageL} and \cs{theledlanguageR} to hold
3874 % the names of the languages used for the left and right texts. This macro
3875 % sets \cs{ifl@dsamelang} TRUE if they are the same, otherwise it
3876 % sets it FALSE.
3877 % \begin{macrocode}
3878 \newcommand*{\l@dchecklang}{%
3879 \l@dsamelangfalse
3880 \edef\@tempa{\theledlanguageL}\edef\@temp{\theledlanguageR}%
3881 \ifx\@tempa\@tempb
3882 \l@dsamelangtrue
3883 \fi}
3884
3885 % \end{macrocode}
3886 % \end{macro}
3887 %
3888 % \begin{macro}{\l@dbbl@set@language}
3889 % In \verb?babel? the macro \cs{bbl@set@language}\marg{lang} does the work when
3890 % the language \meta{lang} is changed via \cs{selectlanguage}.
3891 % Unfortunately for me, if it is given
3892 % an argument in the form of a control sequence it strips off the \verb?\?
3893 % character rather than expanding the command. I need a version that accepts
3894 % an argument in the form \cs{lang} without it stripping the \verb?\?.
3895 % \begin{macrocode}
3896 \newcommand*{\l@dbbl@set@language}[1]{%
3897 \edef\languagename{#1}%
3898 \select@language{\languagename}%
3899 \if@filesw
3900 \protected@write\@auxout{}{\string\select@language{\languagename}}%
3901 \addtocontents{toc}{\string\select@language{\languagename}}%
3902 \addtocontents{lof}{\string\select@language{\languagename}}%
3903 \addtocontents{lot}{\string\select@language{\languagename}}%
3904 \fi}
3905
3906 % \end{macrocode}
3907 % \end{macro}
3908 %
3909 % The rest of the setup has to be postponed until the end of the preamble
3910 % when we know if \verb?babel? has been used or not. However, for now assume
3911 % that it has not been used.
3912 %
3913 % \begin{macro}{\selectlanguage}
3914 % \begin{macro}{\l@duselanguage}
3915 % \begin{macro}{\theledlanguageL}
3916 % \begin{macro}{\theledlanguageR}
3917 % \cs{selectlanguage} is a \verb?babel? command. \cs{theledlanguageL} and
3918 % \cs{theledlanguageR} are the names of the languages of the left and right
3919 % texts. \cs{l@duselanguage} is similar to \cs{selectlanguage}.
3920 % \begin{macrocode}
3921 \providecommand{\selectlanguage}[1]{}
3922 \newcommand*{\l@duselanguage}[1]{}
3923 \gdef\theledlanguageL{}
3924 \gdef\theledlanguageR{}
3925
3926 % \end{macrocode}
3927 %
3928 % Now do the \verb?babel? fix or \verb?polyglossia?, if necessary.
3929 % \begin{macrocode}
3930 \AtBeginDocument{%
3931 \@ifundefined{xpg@main@language}{%
3932 \@ifundefined{bbl@main@language}{%
3933 % \end{macrocode}
3934 % Either \verb?babel? has not been used or it has been used with no
3935 % specified language.
3936 % \begin{macrocode}
3937 \l@dusedbabelfalse
3938 \renewcommand*{\selectlanguage}[1]{}}{%
3939 % \end{macrocode}
3940 % Here we deal with the case where babel has been used. \cs{selectlanguage}
3941 % has to be redefined to use our version of \cs{bbl@set@language} and to
3942 % store the left or right language.
3943 % \begin{macrocode}
3944 \l@dusedbabeltrue
3945 \let\l@doldselectlanguage\selectlanguage
3946 \let\l@doldbbl@set@language\bbl@set@language
3947 \let\bbl@set@language\l@dbbl@set@language
3948 \renewcommand{\selectlanguage}[1]{%
3949 \l@doldselectlanguage{#1}%
3950 \ifledRcol \gdef\theledlanguageR{#1}%
3951 \else \gdef\theledlanguageL{#1}%
3952 \fi}
3953 % \end{macrocode}
3954 % \cs{l@duselanguage} simply calls the original \cs{selectlanguage} so
3955 % that \cs{theledlanguageL} and \cs{theledlanguageR} are unaltered.
3956 % \begin{macrocode}
3957 \renewcommand*{\l@duselanguage}[1]{%
3958 \l@doldselectlanguage{#1}}
3959 % \end{macrocode}
3960 % Lastly, initialise the left and right languages to the current \verb?babel?
3961 % one.
3962 % \begin{macrocode}
3963 \gdef\theledlanguageL{\bbl@main@language}%
3964 \gdef\theledlanguageR{\bbl@main@language}%
3965 }%
3966 }
3967 % \end{macrocode}
3968 % If on Polyglossia
3969 % \begin{macrocode}
3970 { \apptocmd{\xpg@set@language}{%
3971 \ifledRcol \gdef\theledlanguageR{#1}%
3972 \else \gdef\theledlanguageL{#1}%
3973 \fi}%
3974 \let\l@duselanguage\xpg@set@language
3975 \gdef\theledlanguageL{\xpg@main@language}%
3976 \gdef\theledlanguageR{\xpg@main@language}%
3977 % \end{macrocode}
3978 % That's it.
3979 % \begin{macrocode}
3980 }}
3981 % \end{macrocode}
3982 % \end{macro}
3983 % \end{macro}
3984 % \end{macro}
3985 % \end{macro}
3986 %
3987 %
3988 % \section{Parallel columns}
3989 %
3990 % \begin{macro}{\Columns}
3991 % The \cs{Columns} command results in the previous Left and
3992 % Right texts being typeset in matching columns. There should
3993 % be equal numbers of chunks in the left and right texts.
3994 %
3995 % \begin{macrocode}
3996 \newcommand*{\Columns}{%
3997 \setcounter{pstartL}{\value{pstartLold}}
3998 \setcounter{pstartR}{\value{pstartRold}}
3999 \ifnum\l@dnumpstartsL=\l@dnumpstartsR\else
4000 \led@err@BadLeftRightPstarts{\the\l@dnumpstartsL}{\the\l@dnumpstartsR}%
4001 \fi
4002 % \end{macrocode}
4003 % Start a group and zero counters, etc.
4004 % \begin{macrocode}
4005 \begingroup
4006 \l@dzeropenalties
4007 \endgraf\global\num@lines=\prevgraf
4008 \global\num@linesR=\prevgraf
4009 \global\par@line=\z@
4010 \global\par@lineR=\z@
4011 \global\l@dpscL=\z@
4012 \global\l@dpscR=\z@
4013 % \end{macrocode}
4014 % Check if there are chunks to be processed, and process them
4015 % two by two (left and right pairs).
4016 % \begin{macrocode}
4017 \check@pstarts
4018 \loop\if@pstarts
4019 \global\pstartnumtrue
4020 \global\pstartnumRtrue
4021 % \end{macrocode}
4022 % Increment \cs{l@dpscL} and \cs{l@dpscR} which here count
4023 % the numbers of left and right chunks.
4024 % \begin{macrocode}
4025 \global\advance\l@dpscL \@ne
4026 \global\advance\l@dpscR \@ne
4027 % \end{macrocode}
4028 % Check if there is text yet to be processed in at least one of
4029 % the two current chunks, and also whether the left and right languages
4030 % are the same
4031 % \changes{v0.2}{2004/12/20}{Added \cs{l@dchecklang} and \cs{l@duselanguage}
4032 % to \cs{Columns}}
4033 % \begin{macrocode}
4034 \checkraw@text
4035 \l@dchecklang
4036 { \loop\ifaraw@text
4037 % \end{macrocode}
4038 % Grab the next pair of left and right text lines and output them, swapping
4039 % languages if they differ
4040 % \begin{macrocode}
4041 \ifl@dsamelang
4042 \do@lineL
4043 \do@lineR
4044 \else
4045 \l@duselanguage{\theledlanguageL}%
4046 \do@lineL
4047 \l@duselanguage{\theledlanguageR}%
4048 \do@lineR
4049 \fi
4050 \hb@xt@ \hsize{%
4051 \hfill \unhbox\l@dleftbox
4052 \hfill \columnseparator \hfill
4053 \unhbox\l@drightbox
4054 }%
4055 \checkraw@text
4056 \repeat}
4057 % \end{macrocode}
4058 % Having completed a pair of chunks, write the number of lines
4059 % in each chunk to the respective section files. Increment pstart counters and reset line numbering if it's by pstart.
4060 % \changes{v0.11}{2012/06/11}{Line numbering by pstart.}
4061 % \begin{macrocode}
4062 \@writelinesinparL
4063 \@writelinesinparR
4064 \check@pstarts
4065 \ifbypstart@
4066 \write\linenum@out{\string\@set[1]}
4067 \fi
4068 \ifbypstart@R
4069 \write\linenum@outR{\string\@set[1]}
4070 \fi
4071 \addtocounter{pstartL}{1}
4072 \addtocounter{pstartR}{1}
4073 \repeat
4074 % \end{macrocode}
4075 % Having output all chunks, make sure all notes have been output,
4076 % then zero counts ready for the next set of texts. The boolean tests for stanza are switched to false.
4077 % \begin{macrocode}
4078 \flush@notes
4079 \flush@notesR
4080 \endgroup
4081 % \end{macrocode}
4082 % \begin{macrocode}
4083 \global\l@dpscL=\z@
4084 \global\l@dpscR=\z@
4085 \global\l@dnumpstartsL=\z@
4086 \global\l@dnumpstartsR=\z@
4087 \ignorespaces
4088 \global\instanzaLfalse
4089 \global\instanzaRfalse}
4090
4091 % \end{macrocode}
4092 % \end{macro}
4093 %
4094 % \begin{macro}{\columnseparator}
4095 % \begin{macro}{\columnrulewidth}
4096 % The separator between line pairs in parallel columns is in the form
4097 % of a vertical rule extending a little below the baseline and with a height
4098 % slightly greater than the \cs{baselineskip}. The width of the rule
4099 % is \cs{columnrulewidth} (initially 0pt so the rule is invisible).
4100 % \begin{macrocode}
4101 \newcommand*{\columnseparator}{%
4102 \smash{\rule[-0.2\baselineskip]{\columnrulewidth}{1.05\baselineskip}}}
4103 \newdimen\columnrulewidth
4104 \columnrulewidth=\z@
4105
4106 % \end{macrocode}
4107 % \end{macro}
4108 % \end{macro}
4109 %
4110 % \begin{macro}{\if@pstarts}
4111 % \begin{macro}{\@pstartstrue}
4112 % \begin{macro}{\@pstartsfalse}
4113 % \begin{macro}{\check@pstarts}
4114 % \cs{check@pstarts} returns \cs{@pstartstrue} if there are any unprocessed
4115 % chunks.
4116 % \begin{macrocode}
4117 \newif\if@pstarts
4118 \newcommand*{\check@pstarts}{%
4119 \@pstartsfalse
4120 \ifnum\l@dnumpstartsL>\l@dpscL
4121 \@pstartstrue
4122 \else
4123 \ifnum\l@dnumpstartsR>\l@dpscR
4124 \@pstartstrue
4125 \fi
4126 \fi
4127 }
4128
4129 % \end{macrocode}
4130 % \end{macro}
4131 % \end{macro}
4132 % \end{macro}
4133 % \end{macro}
4134 %
4135 % \begin{macro}{\ifaraw@text}
4136 % \begin{macro}{\araw@texttrue}
4137 % \begin{macro}{\araw@textfalse}
4138 % \begin{macro}{\checkraw@text}
4139 % \cs{checkraw@text} checks whether the current Left or Right box is
4140 % void or not. If one or other is not void it sets \cs{araw@texttrue},
4141 % otherwise both are void and it sets \cs{araw@textfalse}.
4142 % \begin{macrocode}
4143 \newif\ifaraw@text
4144 \araw@textfalse
4145 \newcommand*{\checkraw@text}{%
4146 \araw@textfalse
4147 \ifvbox\namebox{l@dLcolrawbox\the\l@dpscL}
4148 \araw@texttrue
4149 \else
4150 \ifvbox\namebox{l@dRcolrawbox\the\l@dpscR}
4151 \araw@texttrue
4152 \fi
4153 \fi
4154 }
4155
4156 % \end{macrocode}
4157 % \end{macro}
4158 % \end{macro}
4159 % \end{macro}
4160 % \end{macro}
4161 %
4162 %
4163 % \begin{macro}{\@writelinesinparL}
4164 % \begin{macro}{\@writelinesinparR}
4165 % These write the number of text lines in a chunk to the section files,
4166 % and then afterwards zero the counter.
4167 % \begin{macrocode}
4168 \newcommand*{\@writelinesinparL}{%
4169 \edef\next{%
4170 \write\linenum@out{\string\@pend[\the\@donereallinesL]}}%
4171 \next
4172 \global\@donereallinesL \z@}
4173 \newcommand*{\@writelinesinparR}{%
4174 \edef\next{%
4175 \write\linenum@outR{\string\@pendR[\the\@donereallinesR]}}%
4176 \next
4177 \global\@donereallinesR \z@}
4178
4179 % \end{macrocode}
4180 % \end{macro}
4181 % \end{macro}
4182 %
4183 % \section{Parallel pages}
4184 %
4185 % This is considerably more complicated than parallel columns.
4186 %
4187 % \begin{macro}{\numpagelinesL}
4188 % \begin{macro}{\numpagelinesR}
4189 % \begin{macro}{\l@dminpagelines}
4190 % Counts for the number of lines on a left or right page, and the smaller
4191 % of the number of lines on a pair of facing pages.
4192 % \begin{macrocode}
4193 \newcount\numpagelinesL
4194 \newcount\numpagelinesR
4195 \newcount\l@dminpagelines
4196
4197 % \end{macrocode}
4198 % \end{macro}
4199 % \end{macro}
4200 % \end{macro}
4201 %
4202 %
4203 % \begin{macro}{\Pages}
4204 % The \cs{Pages} command results in the previous Left and
4205 % Right texts being typeset on matching facing pages. There should
4206 % be equal numbers of chunks in the left and right texts.
4207 %
4208 % \begin{macrocode}
4209 \newcommand*{\Pages}{%
4210 \setcounter{pstartL}{\value{pstartLold}}
4211 \setcounter{pstartR}{\value{pstartRold}}
4212 \typeout{}
4213 \typeout{*************************** PAGES ***************************}
4214 \ifnum\l@dnumpstartsL=\l@dnumpstartsR\else
4215 \led@err@BadLeftRightPstarts{\the\l@dnumpstartsL}{\the\l@dnumpstartsR}%
4216 \fi
4217 % \end{macrocode}
4218 % Get onto an empty even (left) page, then initialise counters, etc.
4219 % \begin{macrocode}
4220 \cleartol@devenpage
4221 \begingroup
4222 \l@dzeropenalties
4223 \endgraf\global\num@lines=\prevgraf
4224 \global\num@linesR=\prevgraf
4225 \global\par@line=\z@
4226 \global\par@lineR=\z@
4227 \global\l@dpscL=\z@
4228 \global\l@dpscR=\z@
4229 \writtenlinesLfalse
4230 \writtenlinesRfalse
4231 % \end{macrocode}
4232 % Check if there are chunks to be processed.
4233 % \begin{macrocode}
4234 \check@pstarts
4235 \loop\if@pstarts
4236 % \end{macrocode}
4237 % Loop over the number of chunks, incrementing the chunk counts
4238 % (\cs{l@dpscL}
4239 % and \cs{l@dpscR} are chunk (box) counts.)
4240 % \begin{macrocode}
4241 \global\advance\l@dpscL \@ne
4242 \global\advance\l@dpscR \@ne
4243 % \end{macrocode}
4244 % Calculate the maximum number of real text lines in the chunk pair,
4245 % storing the result in the relevant \cs{l@dmaxlinesinpar}.
4246 % \begin{macrocode}
4247 \getlinesfromparlistL
4248 \getlinesfromparlistR
4249 \l@dcalc@maxoftwo{\@cs@linesinparL}{\@cs@linesinparR}%
4250 {\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}%
4251 \check@pstarts
4252 \repeat
4253 % \end{macrocode}
4254 % Zero the counts again, ready for the next bit.
4255 % \begin{macrocode}
4256 \global\l@dpscL=\z@
4257 \global\l@dpscR=\z@
4258 % \end{macrocode}
4259 % Get the number of lines on the first pair of pages and store
4260 % the minumum in \cs{l@dminpagelines}.
4261 % \begin{macrocode}
4262 \getlinesfrompagelistL
4263 \getlinesfrompagelistR
4264 \l@dcalc@minoftwo{\@cs@linesonpageL}{\@cs@linesonpageR}%
4265 {\l@dminpagelines}%
4266 % \end{macrocode}
4267 % Now we start processing the left and right chunks (\cs{l@dpscL} and
4268 % \cs{l@dpscR} count the left and right chunks), starting with the first pair.
4269 % \begin{macrocode}
4270 \check@pstarts
4271 \if@pstarts
4272 % \end{macrocode}
4273 % Increment the chunk counts to get the first pair.
4274 % \begin{macrocode}
4275 \global\advance\l@dpscL \@ne
4276 \global\advance\l@dpscR \@ne
4277 % \end{macrocode}
4278 % We haven't processed any lines from these chunks yet, so zero the
4279 % respective line counts.
4280 % \begin{macrocode}
4281 \global\@donereallinesL=\z@
4282 \global\@donetotallinesL=\z@
4283 \global\@donereallinesR=\z@
4284 \global\@donetotallinesR=\z@
4285 % \end{macrocode}
4286 % Start a loop over the boxes (chunks).
4287 % \begin{macrocode}
4288 \checkraw@text
4289 % \end{macrocode}
4290 % \begin{macrocode}
4291 % \begingroup
4292 { \loop\ifaraw@text
4293 % \end{macrocode}
4294 % See if there is more that can be done for the left page and set up the
4295 % left language.
4296 % \changes{v0.2}{2004/12/20}{Added \cs{l@duselanguage} to \cs{Pages}}
4297 % \begin{macrocode}
4298 \checkpageL
4299 \l@duselanguage{\theledlanguageL}%
4300 %%% \begingroup
4301 { \loop\ifl@dsamepage
4302
4303 % \end{macrocode}
4304 % Process the next (left) text line, adding it to the page.
4305 % \changes{v0.3}{2005/02/10}{Added \cs{ledstrutL} to \cs{Pages}}
4306 % \begin{macrocode}
4307 \do@lineL
4308 \advance\numpagelinesL \@ne
4309 \ifshiftedverses
4310 \ifdim\ht\l@dleftbox>0pt\hb@xt@ \hsize{\ledstrutL\unhbox\l@dleftbox}\fi%
4311 \else
4312 \hb@xt@ \hsize{\ledstrutL\unhbox\l@dleftbox}%
4313 \fi
4314 % \end{macrocode}
4315 % Perhaps we have to move to the next (left) box. Check if we have got all
4316 % we can onto the page. If not, repeat for the next line.
4317 % \begin{macrocode}
4318
4319 \get@nextboxL
4320 \checkpageL
4321 \repeat
4322 % \end{macrocode}
4323 % That (left) page has been filled. Output the number of real lines
4324 % on the page --- if the page break is because the page has been
4325 % filled with lines, use the actual number, otherwise the page has been
4326 % ended early in order to synchronise with the facing page so use an
4327 % impossibly large number.
4328 % \begin{macrocode}
4329 \ifl@dpagefull
4330 \@writelinesonpageL{\the\numpagelinesL}%
4331 \else
4332 \@writelinesonpageL{1000}%
4333 \fi
4334 % \end{macrocode}
4335 % Zero the left page lines count and clear the page to get onto the facing
4336 % (odd, right) page.
4337 % \begin{macrocode}
4338 \numpagelinesL \z@
4339 \clearl@dleftpage }%
4340 % \end{macrocode}
4341 % Now do the same for the right text.
4342 % \changes{v0.3}{2005/02/10}{Added \cs{ledstrutR} to \cs{Pages}}
4343 % \begin{macrocode}
4344 \checkpageR
4345 \l@duselanguage{\theledlanguageR}%
4346 { \loop\ifl@dsamepage
4347 \do@lineR
4348 \advance\numpagelinesR \@ne
4349 \ifshiftedverses
4350 \ifdim\ht\l@drightbox>0pt\hb@xt@ \hsize{\ledstrutR\unhbox\l@drightbox}\fi%
4351 \else
4352 \hb@xt@ \hsize{\ledstrutR\unhbox\l@drightbox}%
4353 \fi
4354 \get@nextboxR
4355 \checkpageR
4356 \repeat
4357 \ifl@dpagefull
4358 \@writelinesonpageR{\the\numpagelinesR}%
4359 \else
4360 \@writelinesonpageR{1000}%
4361 \fi
4362 \numpagelinesR=\z@
4363 % \end{macrocode}
4364 % The page is full, so move onto the next (left, odd) page and repeat left
4365 % text processing.
4366 % \begin{macrocode}
4367 \clearl@drightpage}
4368 % \end{macrocode}
4369 % More to do? If there is we have to get the number of lines for the next
4370 % pair of pages before starting to output them.
4371 % \changes{v0.3b}{2005/04/08}{Added \cs{l@dminpagelines} calculation
4372 % for succeeding page pairs}
4373 % \begin{macrocode}
4374 \checkraw@text
4375 \ifaraw@text
4376 \getlinesfrompagelistL
4377 \getlinesfrompagelistR
4378 \l@dcalc@minoftwo{\@cs@linesonpageL}{\@cs@linesonpageR}%
4379 {\l@dminpagelines}%
4380 \fi
4381 \repeat}
4382 % \end{macrocode}
4383 % We have now output the text from all the chunks.
4384 % \begin{macrocode}
4385 \fi
4386 % \end{macrocode}
4387 % Make sure that there are no inserts hanging around.
4388 % \begin{macrocode}
4389 \flush@notes
4390 \flush@notesR
4391 \endgroup
4392 % \end{macrocode}
4393 % Zero counts ready for the next set of left/right text chunks. The boolean tests for stanza are switched to false.
4394 % \begin{macrocode}
4395 \global\l@dpscL=\z@
4396 \global\l@dpscR=\z@
4397 \global\l@dnumpstartsL=\z@
4398 \global\l@dnumpstartsR=\z@
4399 \global\instanzaLfalse
4400 \global\instanzaRfalse
4401 \ignorespaces}
4402
4403 % \end{macrocode}
4404 % \end{macro}
4405 %
4406 % \begin{macro}{\ledstrutL}
4407 % \begin{macro}{\ledstrutR}
4408 % Struts inserted into leftand right text lines.
4409 % \changes{v0.3}{2005/02/10}{Added \cs{ledtrutL} and \cs{ledstrutR}}
4410 % \begin{macrocode}
4411 \newcommand*{\ledstrutL}{\strut}
4412 \newcommand*{\ledstrutR}{\strut}
4413
4414 % \end{macrocode}
4415 % \end{macro}
4416 % \end{macro}
4417 %
4418 %
4419 % \begin{macro}{\cleartoevenpage}
4420 % \begin{macro}{\cleartol@devenpage}
4421 % \begin{macro}{\clearl@dleftpage}
4422 % \begin{macro}{\clearl@drightpage}
4423 % \cs{cleartoevenpage}, which is defined in the memoir class,
4424 % is like \cs{clear(double)page} except that we
4425 % end up on an even page.
4426 % \cs{cleartol@devenpage} is similar except that it first checks to see
4427 % if it is already on an empty page.
4428 % \cs{clearl@dleftpage} and \cs{clearl@drightpage} get us onto
4429 % an odd and even page, respectively, checking that we end up on
4430 % the immediately next page.
4431 % \begin{macrocode}
4432 \providecommand{\cleartoevenpage}[1][\@empty]{%
4433 \clearpage
4434 \ifodd\c@page\hbox{}#1\clearpage\fi}
4435 \newcommand*{\cleartol@devenpage}{%
4436 \ifdim\pagetotal<\topskip% on an empty page
4437 \else
4438 \clearpage
4439 \fi
4440 \ifodd\c@page\hbox{}\clearpage\fi}
4441 \newcommand*{\clearl@dleftpage}{%
4442 \clearpage
4443 \ifodd\c@page\else
4444 \led@err@LeftOnRightPage
4445 \hbox{}%
4446 \cleardoublepage
4447 \fi}
4448 \newcommand*{\clearl@drightpage}{%
4449 \clearpage
4450 \ifodd\c@page
4451 \led@err@RightOnLeftPage
4452 \hbox{}%
4453 \cleartoevenpage
4454 \fi}
4455
4456 % \end{macrocode}
4457 % \end{macro}
4458 % \end{macro}
4459 % \end{macro}
4460 % \end{macro}
4461 %
4462 % \begin{macro}{\getlinesfromparlistL}
4463 % \begin{macro}{\@cs@linesinparL}
4464 % \begin{macro}{\getlinesfromparlistR}
4465 % \begin{macro}{\@cs@linesinparR}
4466 % \cs{getlinesfromparlistL} gets the next entry from the
4467 % \cs{linesinpar@listL} and puts it into \cs{@cs@linesinparL}; if the
4468 % list is empty, it sets \cs{@cs@linesinparL} to 0. Similarly
4469 % for \cs{getlinesfromparlistR}.
4470 % \begin{macrocode}
4471 \newcommand*{\getlinesfromparlistL}{%
4472 \ifx\linesinpar@listL\empty
4473 \gdef\@cs@linesinparL{0}%
4474 \else
4475 \gl@p\linesinpar@listL\to\@cs@linesinparL
4476 \fi}
4477 \newcommand*{\getlinesfromparlistR}{%
4478 \ifx\linesinpar@listR\empty
4479 \gdef\@cs@linesinparR{0}%
4480 \else
4481 \gl@p\linesinpar@listR\to\@cs@linesinparR
4482 \fi}
4483
4484 % \end{macrocode}
4485 % \end{macro}
4486 % \end{macro}
4487 % \end{macro}
4488 % \end{macro}
4489 %
4490 % \begin{macro}{\getlinesfrompagelistL}
4491 % \begin{macro}{\@cs@linesonpageL}
4492 % \begin{macro}{\getlinesfrompagelistR}
4493 % \begin{macro}{\@cs@linesonpageR}
4494 % \cs{getlinesfrompagelistL} gets the next entry from the
4495 % \cs{linesonpage@listL} and puts it into \cs{@cs@linesonpageL}; if the
4496 % list is empty, it sets \cs{@cs@linesonpageL} to 1000. Similarly
4497 % for \cs{getlinesfrompagelistR}.
4498 % \begin{macrocode}
4499 \newcommand*{\getlinesfrompagelistL}{%
4500 \ifx\linesonpage@listL\empty
4501 \gdef\@cs@linesonpageL{1000}%
4502 \else
4503 \gl@p\linesonpage@listL\to\@cs@linesonpageL
4504 \fi}
4505 \newcommand*{\getlinesfrompagelistR}{%
4506 \ifx\linesonpage@listR\empty
4507 \gdef\@cs@linesonpageR{1000}%
4508 \else
4509 \gl@p\linesonpage@listR\to\@cs@linesonpageR
4510 \fi}
4511
4512 % \end{macrocode}
4513 % \end{macro}
4514 % \end{macro}
4515 % \end{macro}
4516 % \end{macro}
4517 %
4518 % \begin{macro}{\@writelinesonpageL}
4519 % \begin{macro}{\@writelinesonpageR}
4520 % These macros output the number of lines on a page to the section file
4521 % in the form of \cs{@lopL} or \cs{@lopR} macros.
4522 % \begin{macrocode}
4523 \newcommand*{\@writelinesonpageL}[1]{%
4524 \edef\next{\write\linenum@out{\string\@lopL{#1}}}%
4525 \next}
4526 \newcommand*{\@writelinesonpageR}[1]{%
4527 \edef\next{\write\linenum@outR{\string\@lopR{#1}}}%
4528 \next}
4529
4530 % \end{macrocode}
4531 % \end{macro}
4532 % \end{macro}
4533 %
4534 %
4535 % \begin{macro}{\l@dcalc@maxoftwo}
4536 % \begin{macro}{\l@dcalc@minoftwo}
4537 % \cs{l@dcalc@maxoftwo}\marg{num}\marg{num}\marg{count} sets \meta{count}
4538 % to the maximum of the two \meta{num}.
4539 %
4540 % Similarly
4541 % \cs{l@dcalc@minoftwo}\marg{num}\marg{num}\marg{count} sets \meta{count}
4542 % to the minimum of the two \meta{num}.
4543 %
4544 % \begin{macrocode}
4545 \newcommand*{\l@dcalc@maxoftwo}[3]{%
4546 \ifnum #2>#1\relax
4547 #3=#2\relax
4548 \else
4549 #3=#1\relax
4550 \fi}
4551 \newcommand*{\l@dcalc@minoftwo}[3]{%
4552 \ifnum #2<#1\relax
4553 #3=#2\relax
4554 \else
4555 #3=#1\relax
4556 \fi}
4557
4558 % \end{macrocode}
4559 % \end{macro}
4560 % \end{macro}
4561 %
4562 % \begin{macro}{\ifl@dsamepage}
4563 % \begin{macro}{\l@dsamepagetrue}
4564 % \begin{macro}{\l@dsamepagefalse}
4565 % \begin{macro}{\ifl@dpagefull}
4566 % \begin{macro}{\l@dpagefulltrue}
4567 % \begin{macro}{\l@dpagefullfalse}
4568 % \begin{macro}{\checkpageL}
4569 % \begin{macro}{\checkpageR}
4570 % \cs{checkpageL} tests if the space and lines already taken on the page by
4571 % text and footnotes is less than the constraints. If so, then
4572 % \cs{ifl@dpagefull} is set FALSE and \cs{ifl@dsamepage} is set TRUE.
4573 % If the page is spatially full
4574 % then \cs{ifl@dpagefull} is set TRUE and \cs{ifl@dsamepage} is set FALSE.
4575 % If it is not spatially full but the maximum number of lines have been
4576 % output then both \cs{ifl@dpagefull} and \cs{ifl@dsamepage}
4577 % are set FALSE.
4578 %
4579 % \begin{macrocode}
4580 \newif\ifl@dsamepage
4581 \l@dsamepagetrue
4582 \newif\ifl@dpagefull
4583 \newcommand*{\checkpageL}{%
4584 \l@dpagefulltrue
4585 \l@dsamepagetrue
4586 \check@goal
4587 \ifdim\pagetotal<\ledthegoal
4588 \ifnum\numpagelinesL<\l@dminpagelines
4589 \else
4590 \l@dsamepagefalse
4591 \l@dpagefullfalse
4592 \fi
4593 \else
4594 \l@dsamepagefalse
4595 \l@dpagefulltrue
4596 \fi}
4597 \newcommand*{\checkpageR}{%
4598 \l@dpagefulltrue
4599 \l@dsamepagetrue
4600 \check@goal
4601 \ifdim\pagetotal<\ledthegoal
4602 \ifnum\numpagelinesR<\l@dminpagelines
4603 \else
4604 \l@dsamepagefalse
4605 \l@dpagefullfalse
4606 \fi
4607 \else
4608 \l@dsamepagefalse
4609 \l@dpagefulltrue
4610 \fi}
4611
4612 % \end{macrocode}
4613 % \end{macro}
4614 % \end{macro}
4615 % \end{macro}
4616 % \end{macro}
4617 % \end{macro}
4618 % \end{macro}
4619 % \end{macro}
4620 % \end{macro}
4621 %
4622 % \begin{macro}{\ledthegoal}
4623 % \begin{macro}{\goalfraction}
4624 % \begin{macro}{\check@goal}
4625 % \cs{ledthegoal} is the amount of space allowed to taken by text and
4626 % footnotes on a page before a forced pagebreak. This can be controlled via
4627 % \cs{goalfraction}. \cs{ledthegoal} is calculated via \cs{check@goal}.
4628 % \begin{macrocode}
4629 \newdimen\ledthegoal
4630 \ifshiftedverses
4631 \newcommand*{\goalfraction}{0.95}
4632 \else
4633 \newcommand*{\goalfraction}{0.9}
4634 \fi
4635
4636 \newcommand*{\check@goal}{%
4637 \ledthegoal=\goalfraction\pagegoal}
4638
4639 % \end{macrocode}
4640 % \end{macro}
4641 % \end{macro}
4642 % \end{macro}
4643 %
4644 %
4645 % \begin{macro}{\ifwrittenlinesL}
4646 % \begin{macro}{\ifwrittenlinesL}
4647 % Booleans for whether line data has been written to the section file.
4648 % \begin{macrocode}
4649 \newif\ifwrittenlinesL
4650 \newif\ifwrittenlinesR
4651
4652 % \end{macrocode}
4653 % \end{macro}
4654 % \end{macro}
4655 %
4656 % \begin{macro}{\get@nextboxL}
4657 % \begin{macro}{\get@nextboxR}
4658 % \changes{v0.11}{2012/06/11}{Change \cs{get@nextboxL} and \cs{get@nextboxR} to allow to disable line numbering (like in ledmac 0.15).}
4659 % If the current box is not empty (i.e., still contains some lines)
4660 % nothing is done. Otherwise if and only if a synchronisation point is
4661 % reached the next box is started.
4662 %
4663 % \begin{macrocode}
4664 \newcommand*{\get@nextboxL}{%
4665 \ifvbox\namebox{l@dLcolrawbox\the\l@dpscL}% box is not empty
4666 % \end{macrocode}
4667 % The current box is not empty; do nothing.
4668 % \begin{macrocode}
4669 \else% box is empty
4670 % \end{macrocode}
4671 % The box is empty; check if enough lines (real and blank) have been
4672 % output.
4673 % \begin{macrocode}
4674 \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscL}>\@donetotallinesL
4675 \else
4676 % \end{macrocode}
4677 % Sufficient lines have been output.
4678 % \begin{macrocode}
4679 \ifwrittenlinesL
4680 \else
4681 % \end{macrocode}
4682 % Write out the number of lines done, and set the boolean so this is only
4683 % done once.
4684 % \begin{macrocode}
4685 \@writelinesinparL
4686 \writtenlinesLtrue
4687 \fi
4688 \ifnum\l@dnumpstartsL>\l@dpscL
4689 % \end{macrocode}
4690 % \changes{v0.11}{2012/06/11}{Pstart number can be printed in side}
4691 % There are still unprocessed boxes. Recalculate the maximum number of
4692 % lines needed, and move onto the next box (by incrementing \cs{l@dpscL}). If needed, restart the line numbering. Increment the pstartL counter.
4693 % \begin{macrocode}
4694 \writtenlinesLfalse
4695 \ifbypstart@
4696 \ifnum\value{pstartL}<\value{pstartLold}
4697 \else
4698 \global\line@num=0
4699 \fi
4700 \fi
4701 \addtocounter{pstartL}{1}
4702 \global\pstartnumtrue
4703 \l@dcalc@maxoftwo{\the\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}%
4704 {\the\@donetotallinesL}%
4705 {\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}%
4706 \global\@donetotallinesL \z@
4707 \global\advance\l@dpscL \@ne
4708 \fi
4709 \fi
4710 \fi}
4711 % \end{macrocode}
4712 %
4713 % \begin{macrocode}
4714 \newcommand*{\get@nextboxR}{%
4715 \ifvbox\namebox{l@dRcolrawbox\the\l@dpscR}% box is not empty
4716 \else% box is empty
4717 \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscR}>\@donetotallinesR
4718 \else
4719 \ifwrittenlinesR
4720 \else
4721 \@writelinesinparR
4722 \writtenlinesRtrue
4723 \fi
4724 \ifnum\l@dnumpstartsR>\l@dpscR
4725 \writtenlinesRfalse
4726 \ifbypstart@R
4727 \ifnum\value{pstartR}<\value{pstartRold}
4728 \else
4729 \global\line@numR=0
4730 \fi
4731 \fi
4732 \addtocounter{pstartR}{1}
4733 \global\pstartnumRtrue
4734 \l@dcalc@maxoftwo{\the\usenamecount{l@dmaxlinesinpar\the\l@dpscR}}%
4735 {\the\@donetotallinesR}%
4736 {\usenamecount{l@dmaxlinesinpar\the\l@dpscR}}%
4737 \global\@donetotallinesR \z@
4738 \global\advance\l@dpscR \@ne
4739 \fi
4740 \fi
4741 \fi}
4742
4743 % \end{macrocode}
4744 % \end{macro}
4745 % \end{macro}
4746 %
4747 % \section{The End}\label{end}
4748 %
4749
4750
4751 %</code>
4752 %
4753 % \newpage
4754 % \appendix
4755 %
4756 % \section{Examples}\label{examples}
4757 %
4758 % This section presents some sample documents.
4759 %
4760 %
4761 % The figures are from processed versions of the files. Having latexed
4762 % a file I used DVIPS to get Encapsulated PostScript, then the epstopdf
4763 % script to get a PDF version as well, for example: \\
4764 % \begin{verbatim}
4765 % > latex villon
4766 % > latex villon
4767 % > latex villon
4768 % > dvips -E -o villon.eps villon % produces villon.eps
4769 % > epstopdf villon.eps % produces villon.pdf
4770 % \end{verbatim}
4771 %
4772 % For a multipage example, DVIPS has an option to output a range of pages (-p
4773 % for the first and -l (letter l) for the last).
4774 % For instance, to output a single page, say page 2:\\
4775 % \begin{verbatim}
4776 % > latex djd17nov
4777 % > latex djd17nov
4778 % > latex djd17nov
4779 % > dvips -E -p2 -l2 -o djd17novL.eps djd17nov % produces djd17novL.eps
4780 % > epstopdf djd17novL.eps % produces djd17novL.pdf
4781 % \end{verbatim}
4782 %
4783 % For those who aren't fascinated by LaTeX code, I show the all the
4784 % typeset results first, then the code that produced them.
4785 %
4786 %
4787 % \cleardoublepage
4788 %
4789 % \begin{figure}[p]
4790 % \centering
4791 % \includegraphics{villon}
4792 % \caption{Output from \file{villon.tex}.}
4793 % \label{villon-out}
4794 % \end{figure}
4795 %
4796 % \begin{figure}[p]
4797 % \centering
4798 % \includegraphics{djd17novL}
4799 % \caption{Left page output from \file{djd17nov.tex}.}
4800 % \label{djdL-out}
4801 % \end{figure}
4802 %
4803 % \begin{figure}[p]
4804 % \centering
4805 % \includegraphics{djd17novR}
4806 % \caption{Right page output from \file{djd17nov.tex}.}
4807 % \label{djdR-out}
4808 % \end{figure}
4809 %
4810 % \begin{figure}[p]
4811 % \centering
4812 % \includegraphics{djdpoems1}
4813 % \caption{First left page output from \file{djdpoems.tex}.}
4814 % \label{djdp1-out}
4815 % \end{figure}
4816 %
4817 % \begin{figure}[p]
4818 % \centering
4819 % \includegraphics{djdpoems2}
4820 % \caption{First right page output from \file{djdpoems.tex}.}
4821 % \label{djdp2-out}
4822 % \end{figure}
4823 %
4824 % \begin{figure}[p]
4825 % \centering
4826 % \includegraphics{djdpoems3}
4827 % \caption{Second left page output from \file{djdpoems.tex}.}
4828 % \label{djdp3-out}
4829 % \end{figure}
4830 %
4831 % \begin{figure}[p]
4832 % \centering
4833 % \includegraphics{djdpoems4}
4834 % \caption{Second right page output from \file{djdpoems.tex}.}
4835 % \label{djdp4-out}
4836 % \end{figure}
4837 %
4838 %
4839 %
4840 % \clearpage
4841 %
4842 % \subsection{Parallel column example}\label{example:villon}
4843 %
4844 % This made-up example, \file{villon.tex}, is included to show
4845 % parallel columns and how they can be interspersed in regular text.
4846 % The verses are set using the \cs{stanza} construct, where each
4847 % verse line is a chunk.
4848 % The code is given below and the result is shown in Figure~\ref{villon-out}.
4849 %
4850 % \medskip
4851 % \hrule
4852 % \medskip
4853 % \begin{macrocode}
4854 %<*villon>
4855 %%% villon.tex Example parallel columns
4856 \documentclass{article}
4857 \addtolength{\textheight}{-10\baselineskip}
4858 \usepackage{ledmac,ledpar}
4859 %% Use r instead of R to flag right text line numbers
4860 \renewcommand{\Rlineflag}{r}
4861 %% Use the flag in the notes
4862 \let\oldBfootfmt\Bfootfmt
4863 \renewcommand{\Bfootfmt}[3]{%
4864 \let\printlines\printlinesR
4865 \oldBfootfmt{#1}{#2}{#3}}
4866 \begin{document}
4867
4868 I thought that limericks were peculiarly English, but this appears not
4869 to be the case. As with most limericks this one is by Anonymous.
4870
4871 \vspace*{\baselineskip}
4872
4873 \begin{pairs}
4874 %% no indentation
4875 \setstanzaindents{0,0,0,0,0,0,0,0,0}
4876 %% no number flag
4877 \renewcommand{\Rlineflag}{}
4878 %% draw a rule and widen the columns
4879 \setlength{\columnrulewidth}{0.4pt}
4880 \setlength{\Lcolwidth}{0.46\textwidth}
4881 \setlength{\Rcolwidth}{\Lcolwidth}
4882
4883 \begin{Leftside}
4884 %% set left text line numbering sequence
4885 \firstlinenum{2}
4886 \linenumincrement{2}
4887 \linenummargin{left}
4888 \beginnumbering
4889 \stanza
4890 Il y avait un jeune homme de Dijon, &
4891 Qui n'avait que peu de religion. &
4892 Il dit: `Quant \`{a} moi, &
4893 Je d\'{e}teste tous les trois, &
4894 Le P\`{e}re, et le Fils, et le Pigeon.' \&
4895 \endnumbering
4896 \end{Leftside}
4897
4898 \begin{Rightside}
4899 %% different right text line numbering sequence
4900 \firstlinenum{1}
4901 \linenumincrement{2}
4902 \linenummargin{right}
4903 \beginnumbering
4904 \stanza
4905 There was a young man of Dijon, &
4906 Who had only a little religion, &
4907 He said: `As for me, &
4908 I detest all the three, &
4909 The Father, the Son, and the Pigeon.' \&
4910 \endnumbering
4911 \end{Rightside}
4912
4913 \Columns
4914 \end{pairs}
4915
4916 \vspace*{\baselineskip}
4917
4918 The following is verse \textsc{lxxiii} of Fran\c{c}ois Villon's
4919 \textit{Le Testament} (The Testament), composed in 1461.
4920
4921 %% Allow for hanging indentation for long lines
4922 \setstanzaindents{1,0,0,0,0,0,0,0,0}
4923 %% Columns wider than the default
4924 \setlength{\Lcolwidth}{0.46\textwidth}
4925 \setlength{\Rcolwidth}{\Lcolwidth}
4926 \vspace*{\baselineskip}
4927
4928 \begin{pairs}
4929 \begin{Leftside}
4930 \firstlinenum{2}
4931 \linenumincrement{2}
4932 \linenummargin{left}
4933 \beginnumbering
4934 \stanza
4935 Dieu mercy et Tacque Thibault, &
4936 Qui tant d'eaue froid m'a fait boire, &
4937 Mis en bas lieu, non pas en hault, &
4938 Mengier d'angoisse maints \edtext{poire}{\lemma{poire d'angoisse}%
4939 \Afootnote{This has a triple meaning: literally it is the fruit of the
4940 choke pear,
4941 figuratively it means `bitter fruit', and it also refers to a torture
4942 instrument.}}, &
4943 Enferr\'{e} \ldots Quant j'en ay memoire, &
4944 Je Prie pour luy \edtext{\textit{et reliqua}}{\Afootnote{and so on}}, &
4945 Que Dieu luy doint, et voire, voire! &
4946 Ce que je pense \ldots \textit{et cetera}. \&
4947 \endnumbering
4948 \end{Leftside}
4949
4950 \begin{Rightside}
4951 \firstlinenum{2}
4952 \linenumincrement{2}
4953 \linenummargin{right}
4954 \beginnumbering
4955 \stanza
4956 Thanks to God --- and to \edtext{Tacque Thibaud}{%
4957 \Bfootnote{A favourite of Jean, Duc de Berry and loathed for his exactions
4958 and debauchery. Villon uses his name as an insulting nickname for
4959 Thibaud d'Auxigny, the Bishop of Orl\'{e}ans.}} &
4960 Who made me drink so much \edtext{cold water}{%
4961 \Bfootnote{Can either refer to the normal prison diet of bread and
4962 water or to a common medieval torture which involved forced drinking
4963 of cold water.}}, &
4964 Put me underground instead of higher up &
4965 And made me eat such bitter fruit, &
4966 In chains \ldots When I think of this, &
4967 I pray for him---\textit{et reliqua;} &
4968 May God grant him (yes, by God) &
4969 What I think \ldots \textit{et cetera}. \&
4970 \endnumbering
4971 \end{Rightside}
4972
4973 \Columns
4974 \end{pairs}
4975
4976 \vspace*{\baselineskip}
4977
4978 The translation and notes are by Anthony Bonner,
4979 \textit{The Complete Works of Fran\c{c}ois Villon}, published by
4980 Bantam Books in 1960.
4981
4982 \end{document}
4983
4984 %</villon>
4985 % \end{macrocode}
4986 %
4987 %
4988 % \subsection{Example parallel facing pages} \label{example:djd17nov}
4989 %
4990 % This example, illustrated in Figures~\ref{djdL-out} and~\ref{djdR-out},
4991 % was provided in November 2004 by Dirk-Jan Dekker\index{Dekker, Dirk-Jan}
4992 % of the Department of Medieval History at Radboud University, Nijmegen.
4993 %
4994 % \medskip
4995 % \hrule
4996 % \medskip
4997 %
4998 % \begin{macrocode}
4999 %<*djd17nov>
5000 %%% This is djd17nov.tex, a sample critical text edition
5001 %%% written in LaTeX2e with the ledmac and ledpar packages.
5002 %%% (c) 2003--2004 by Dr. Dirk-Jan Dekker,
5003 %%% Radboud University, Nijmegen (The Netherlands)
5004 %%% (PRW) Modified slightly by PRW to fit the ledpar manual
5005
5006 \documentclass[10pt, letterpaper, twoside]{article}
5007 \usepackage[latin,english]{babel}
5008 \usepackage{makeidx}
5009 \usepackage{ledmac,ledpar}
5010 \lineation{section}
5011 \linenummargin{inner}
5012 \sidenotemargin{outer}
5013
5014 \makeindex
5015
5016 \renewcommand{\notenumfont}{\footnotesize}
5017 \newcommand{\notetextfont}{\footnotesize}
5018
5019 %\let\Afootnoterule=\relax
5020 \let\Bfootnoterule=\relax
5021 \let\Cfootnoterule=\relax
5022
5023 \addtolength{\skip\Afootins}{1.5mm}
5024 %\addtolength{\skip\Bfootins}{1.5mm}
5025 %\addtolength{\skip\Cfootins}{1.5mm}
5026
5027 \makeatletter
5028
5029 \renewcommand*{\para@vfootnote}[2]{%
5030 \insert\csname #1footins\endcsname
5031 \bgroup
5032 \notefontsetup
5033 \interlinepenalty=\interfootnotelinepenalty
5034 \floatingpenalty=\@MM
5035 \splittopskip=\ht\strutbox \splitmaxdepth=\dp\strutbox
5036 \leftskip=\z@skip \rightskip=\z@skip
5037 \l@dparsefootspec #2\ledplinenumtrue% new from here
5038 \ifnum\@nameuse{previous@#1@number}=\l@dparsedstartline\relax
5039 \ledplinenumfalse
5040 \fi
5041 \ifnum\previous@page=\l@dparsedstartpage\relax
5042 \else \ledplinenumtrue \fi
5043 \ifnum\l@dparsedstartline=\l@dparsedendline\relax
5044 \else \ledplinenumtrue \fi
5045 \expandafter\xdef\csname previous@#1@number\endcsname{\l@dparsedstartline}%
5046 \xdef\previous@page{\l@dparsedstartpage}% to here
5047 \setbox0=\vbox{\hsize=\maxdimen
5048 \noindent\csname #1footfmt\endcsname#2}%
5049 \setbox0=\hbox{\unvxh0}%
5050 \dp0=0pt
5051 \ht0=\csname #1footfudgefactor\endcsname\wd0
5052 \box0
5053 \penalty0
5054 \egroup
5055 }
5056
5057 \newcommand*{\previous@A@number}{-1}
5058 \newcommand*{\previous@B@number}{-1}
5059 \newcommand*{\previous@C@number}{-1}
5060 \newcommand*{\previous@page}{-1}
5061
5062 \newcommand{\abb}[1]{#1%
5063 \let\rbracket\nobrak\relax}
5064 \newcommand{\nobrak}{\textnormal{}}
5065 \newcommand{\morenoexpands}{%
5066 \let\abb=0%
5067 }
5068
5069 \newcommand{\Aparafootfmt}[3]{%
5070 \ledsetnormalparstuff
5071 \scriptsize
5072 \notenumfont\printlines#1|\enspace
5073 % \lemmafont#1|#2\enskip
5074 \notetextfont
5075 #3\penalty-10\hskip 1em plus 4em minus.4em\relax}
5076
5077 \newcommand{\Bparafootfmt}[3]{%
5078 \ledsetnormalparstuff
5079 \scriptsize
5080 \notenumfont\printlines#1|%
5081 \ifledplinenum
5082 \enspace
5083 \else
5084 {\hskip 0em plus 0em minus .3em}%
5085 \fi
5086 \select@lemmafont#1|#2\rbracket\enskip
5087 \notetextfont
5088 #3\penalty-10\hskip 1em plus 4em minus.4em\relax }
5089
5090 \newcommand{\Cparafootfmt}[3]{%
5091 \ledsetnormalparstuff
5092 \scriptsize
5093 \notenumfont\printlines#1|\enspace
5094 % \lemmafont#1|#2\enskip
5095 \notetextfont
5096 #3\penalty-10\hskip 1em plus 4em minus.4em\relax}
5097
5098 \makeatother
5099
5100 \footparagraph{A}
5101 \footparagraph{B}
5102 \footparagraph{C}
5103
5104 \let\Afootfmt=\Aparafootfmt
5105 \let\Bfootfmt=\Bparafootfmt
5106 \let\Cfootfmt=\Cparafootfmt
5107
5108 \renewcommand*{\Rlineflag}{}
5109
5110 \emergencystretch40pt
5111
5112 \author{Guillelmus de Berchen}
5113 \title{Chronicon Geldriae}
5114 \date{}
5115 \hyphenation{archi-epi-sco-po Huns-dis-brug li-be-ra No-vi-ma-gen-si}
5116 \begin{document}
5117 \begin{pages}
5118 \begin{Leftside}
5119 \beginnumbering\pstart
5120 \selectlanguage{latin}
5121 \section{De ecclesia S. Stephani Novimagensi}
5122
5123 \noindent\setline{1}
5124 Nobilis itaque comes Otto\protect\edindex{Otto II of Guelders}
5125 imperio et dominio Novimagensi sibi, ut praefertur, impignoratis
5126 et commissis
5127 \edtext{proinde}{\Bfootnote{primum D}} praeesse cupiens, anno
5128 \textsc{liiii} superius descripto, mense
5129 Iu\edtext{}{\Afootnote{p.\ 227~R}}nio, una cum iudice, scabinis ceterisque
5130 civibus civitatis Novimagensis, pro ipsius et inhabitantium in ea
5131 necessitate,\edtext{}{\Afootnote{p.\ 97~N}} commodo et utilitate,
5132 ut \edtext{ecclesia eius}{\Bfootnote{ecclesia D: eius eius H}} parochialis
5133 \edtext{\abb{extra civitatem}}{\Bfootnote{\textit{om.}~H}} sita
5134 destrueretur et \edtext{infra}{\Bfootnote{intra D}} muros
5135 \edtext{transfer\edtext{}{\Afootnote{p.\ 129~D}}retur}%
5136 {\Bfootnote{transferreretur NH}}
5137 ac de novo construeretur,
5138 \edtext{a reverendo patre domino
5139 Conrado\protect\edindex{Conrad of Hochstaden} de
5140 \edtext{Hofsteden}{\Bfootnote{Hoffstede D: Hoffsteden H}}, archiepiscopo
5141 \edtext{Coloniensi}{\Bfootnote{Colononiensi H}}, licentiam}%
5142 {\Cfootnote{William is confusing two charters that are five years
5143 apart. Permission from St.\ Apostles' Church in Cologne had been
5144 obtained as early as 1249. Cf.\
5145 Sloet\protect\index{Sloet van de Beele, L.A.J.W.},
5146 \textit{Oorkondenboek} nr.\ 707 (14 November 1249):
5147 ``\ldots{}nos devotionis tue precibus annuentes, ut ipsam ecclesiam
5148 faciens demoliri transferas in locum alium competentem, tibi
5149 auctoritate presentium indulgemus\ldots''}}, et a venerabilibus
5150 \edtext{dominis}{\Bfootnote{viris H}} decano et capitulo sanctorum
5151 Apostolorum\protect\edindex{St. Apostles' (Cologne)}
5152 \edtext{Coloniensi}{\Bfootnote{Coloniae H}}, ipsius ecclesiae ab
5153 antiquo veris et pacificis patronis, consensum, citra tamen
5154 praeiudicium, damnum aut gravamen \edtext{iurium}{\Bfootnote{virium D}}
5155 et bonorum eorundem, impetravit.
5156 \pend
5157
5158 \pstart
5159 \edtext{Et exinde \edtext{liberum}{\Bfootnote{librum H}}
5160 locum eiusdem civitatis
5161 \edtext{qui}{\Bfootnote{quae D}} dicitur
5162 \edtext{Hundisburg}{\Bfootnote{Hundisburch D: Hundisbrug HMN:
5163 Hunsdisbrug R}}\protect\edindex{Hundisburg},
5164 de praelibati Wilhelmi\protect\edindex{William II of Holland} Romanorum
5165 \edtext{regis}{\Bfootnote{imperatoris D}}, ipsius fundi
5166 do\edtext{}{\Afootnote{f.\ 72v~M}}mini, consensu, ad aedificandum
5167 \edtext{\abb{et consecrandum}}{\Bfootnote{\textit{om.}\ H}}
5168 ecclesi\edtext{}{\Afootnote{p.\ 228~R}}am et coemeterium,
5169 \edtext{eisdem}{\Bfootnote{eiusdem D}} decano et capitulo de expresso
5170 eiusdem civitatis assensu libera contradiderunt voluntate, obligantes
5171 se ipsi \edtext{comes}{\Bfootnote{comites D}} et civitas
5172 \edtext{\abb{dictis}}{\Bfootnote{\textit{om.}\ H}} decano et capitulo,
5173 quod in recompensationem illius areae infra castrum et portam, quae
5174 fuit dos ecclesiae, in qua plebanus habitare solebat---quae
5175 \edtext{tunc}{\Bfootnote{nunc H}} per novum fossatum civitatis est
5176 destructa---aliam aream competentem et ecclesiae novae,
5177 \edtext{ut praefertur, aedificandae}{%
5178 \lemma{\abb{ut\ldots aedificandae}}\Bfootnote{\textit{om.}\ H}} satis
5179 \edtext{contiguam}{\Bfootnote{contiguum M}}, ipsi plebano darent et
5180 assignarent.}{\Cfootnote{Cf.\ Sloet, \textit{Oorkondenboek} nr.\ 762
5181 (June 1254)}} Et desuper
5182 \edtext{\abb{apud}}{\Bfootnote{\textit{om.}\ H}} dictam ecclesiam
5183 sanctorum Apostolorum \edtext{est}{\Bfootnote{et H}}
5184 \edtext{littera}{\Bfootnote{litteram H}} sigillis ipsorum
5185 Ottonis\edtext{}{\Afootnote{p.\ 130~D}} comitis et civitatis
5186 \edtext{Novimagensis}{\Bfootnote{Novimagii D}}
5187 \edtext{sigillata}{\Bfootnote{sigillis communita H}}.
5188 \pend
5189
5190 \pstart
5191 // One additional line to show synchronization. //
5192 \pend
5193 \endnumbering
5194 \end{Leftside}
5195
5196 \begin{Rightside}
5197 \sidenotemargin{right}\selectlanguage{english}
5198 \beginnumbering
5199 \pstart
5200 \addtocounter{section}{-1}%
5201 \leavevmode\section{St.\ Stephen's Church in Nijmegen}
5202
5203 \noindent\setline{1}%
5204 After the noble count Otto had taken in pledge the power over
5205 Nijmegen,\footnote{In 1247 William II\protect\index{William II of Holland}
5206 (1227--1256) count of Holland needed money to fight his way to
5207 Aachen\protect\index{Aachen} to be crowned King of the Holy Roman
5208 Empire. He gave the town of Nijmegen in pledge to Otto
5209 II\protect\index{Otto II of Guelders} (1229--1271) count of Guelders.}
5210 like I have written above, he wanted to protect the town. So in June
5211 1254\ledsidenote{1254} he and the judge, the sheriffs and other
5212 citizens of Nijmegen obtained permission to demolish the parish
5213 church that lay outside the town walls,\footnote{Since the early
5214 seventh century old St.\ Stephen's church had been located close
5215 to the castle, at today's
5216 Kelfkensbos\protect\index{Kelfkensbos (Nijmegen)} square.
5217 Traces of the church and the presbytery were found during excavations
5218 in 1998--1999.} to move it inside the walls and to rebuild it new.
5219 This operation was necessary and useful both for Otto himself and
5220 for the inhabitants of the town. The reverend father Conrad of
5221 Hochstaden, archbishop of
5222 Cologne,\footnote{Conrad of Hochstaden ({\textdagger} 1261) was
5223 archbishop of Cologne in 1238--1261. Nijmegen belonged to the
5224 archdiocese of Cologne until 1559.} gave his permission. So did the
5225 reverend dean and canons of the chapter of St.\
5226 Apostles'\protect\index{St. Apostles' (Cologne)} in Cologne, who had
5227 long\footnote{They probably became the patrons when the chapter was
5228 established in the early eleventh century. About the church and the
5229 chapter, see Gottfried Stracke\protect\index{Stracke, G.},
5230 \textit{K\"{o}ln:\ St.\ Aposteln}, Stadtspuren -- Denkm\"{a}ler in
5231 K\"{o}ln, vol.\ 19, K\"{o}ln: J.\,P.\ Bachem, 1992.} been the true
5232 and benevolent patrons of the church---but they did not allow Otto
5233 to do anything without their knowledge, nor to infringe their rights,
5234 nor to damage their property.
5235 \pend
5236
5237 \pstart
5238 And so the count and the town voluntarily gave an open space in town
5239 called Hundisburg, which was owned by the aforementioned king William,
5240 to the dean and chapter of St.\ Apostles' in order to build and
5241 consecrate a church and graveyard. King William approved and the
5242 town of Nijmegen explicitly expressed its assent. A new ditch was dug
5243 on property of the church near the castle and the
5244 harbour,\footnote{Nowadays, the exact location of the medieval
5245 ditch---and of two Roman ones---can be seen in the pavement of
5246 Kelfkensbos\protect\index{Kelfkensbos (Nijmegen)} square.} causing
5247 the demolition of the presbytery. In compensation, the count and
5248 citizens committed themselves to giving the parish priest another
5249 suitable space close enough to the new church that was about to be
5250 built. A letter about these transactions, with the seals of count
5251 Otto and the town of Nijmegen, is kept at St.\ Apostles'
5252 church.\footnote{The original letter is lost. A 15th century
5253 transcription of it is kept at the Historisches Archiv der
5254 Stadt K\"{o}ln (HAStK).}
5255 \pend
5256
5257 \pstart
5258 // One additional line to show synchronization. //
5259 \pend
5260 \endnumbering
5261 \end{Rightside}
5262 \Pages
5263 \end{pages}
5264
5265 %%%%%%%%%%%%%%%%%%%%%%%%%%%
5266 \printindex
5267 \end{document}
5268 %%%%%%%%%%%%%%%%%%
5269
5270 %</djd17nov>
5271 % \end{macrocode}
5272 %
5273 % \medskip
5274 % \hrule
5275 %
5276 % \subsection{Example poetry on parallel facing pages} \label{example:djdpoems}
5277 %
5278 % This example, illustrated in Figures~\ref{djdp1-out} to~\ref{djdp4-out},
5279 % was originally provided in November 2004 by
5280 % Dirk-Jan Dekker\index{Dekker, Dirk-Jan} for an earlier version of \Ledpar.
5281 % I have updated it, and also extended it to show the difference between
5282 % the \cs{stanza} command and the \verb?astanza? environment. \cs{stanza}
5283 % is used for the first pair of pages and \verb?astanza? for the second
5284 % pair. Note the
5285 % definition of \cs{endstanzaextra} to give a short line after each stanza.
5286 %
5287 % \medskip
5288 % \hrule
5289 % \medskip
5290 %
5291 % \begin{macrocode}
5292 %<*djdpoems>
5293 %%% djdpoems.tex example parallel verses on facing pages
5294 \documentclass{article}
5295 \usepackage{ledmac,ledpar}
5296 \addtolength{\textheight}{-15\baselineskip}
5297
5298 \maxchunks{24} % default value = 10
5299 \setstanzaindents{6,0,1,0,1}
5300
5301 \newcommand{\longdash}{---------}
5302
5303 \footparagraph{A} % for left pages
5304 \footparagraph{B} % for right pages
5305 \firstlinenum{1}
5306 \linenumincrement{1}
5307
5308 \let\oldBfootfmt\Bfootfmt
5309 \renewcommand{\Bfootfmt}[3]{%
5310 \let\printlines\printlinesR
5311 \oldBfootfmt{#1}{#2}{#3}}
5312
5313 \begin{document}
5314
5315 \newcommand{\interstanza}{\pstart\centering\longdash\skipnumbering\pend}
5316
5317 \begin{pages}
5318 \begin{Leftside}
5319 \def\endstanzaextra{\interstanza}
5320 \beginnumbering
5321
5322 \stanza
5323 Arma gravi numero violentaque bella parabam &
5324 edere, materi\={a} conveniente modis. &
5325 Par erat inferior versus---risisse Cupido &
5326 dicitur atque unum surripuisse pedem. \&
5327
5328 \stanza
5329 ``Quis tibi, saeve puer, dedit hoc in carmina iuris? &
5330 Pieridum vates, non tua turba \edtext{sumus}{\Afootnote{note lost}}. &
5331 Quid si praeripiat flavae V\u{e}nus arma Minervae, &
5332 ventilet accensas flava Minerva faces? \&
5333
5334 \stanza
5335 Quis probet in silvis Cererem regnare iugosis, &
5336 lege pharetratae Virginis arva coli? &
5337 Crinibus insignem quis \edtext{acuta}{\Afootnote{acut\={a} (abl.\ abs.)}}
5338 cuspide Phoebum &
5339 instruat, Aoniam Marte movente lyram? \&
5340 \endnumbering
5341 \end{Leftside}
5342
5343 \begin{Rightside}
5344 \def\endstanzaextra{\interstanza}
5345 \beginnumbering
5346 \firstlinenum{1}
5347 \linenumincrement{1}
5348 \setstanzaindents{6,0,1,0,1,0}
5349
5350 \stanza
5351 I was preparing to sing of weapons and violent wars, &
5352 in heavy numbers, with the subject matter suited to the verse measure. &
5353 The even lines were as long as the odd ones, but Cupid laughed, &
5354 they said, and he stole away one foot.\footnote{I.e., the even lines,
5355 which were hexameters (with six feet) became pentameters
5356 (with five feet).} \&
5357
5358 \stanza
5359 ``O cruel boy, who gave you the right over poetry? &
5360 We poets belong to the Pierides,\footnote{Muses} we are not your folk. &
5361 \edlabel{beginparadox}What if Venus should seize away the arms of
5362 Minerva with the golden hair, &
5363 if Minerva with the golden hair should fan alight the kindled torch
5364 of love? \&
5365
5366 \stanza
5367 Who would approve of Ceres\footnote{Ceres was the Roman goddess of
5368 the harvest.} reigning on the woodland ridges, &
5369 and of land tilled under the law of the Maid with the
5370 quiver\footnote{By `\textit{Virgo}' (`Virgin') Ovid means Diana, the
5371 Roman goddess of the hunt.}? &
5372 Who would provide Phoebus with his beautiful hair with a sharp-pointed
5373 spear, &
5374 while Mars stirs the \edtext{Aonian}{\Bfootnote{Mount Parnassus,
5375 where the Muses live, is located in Aonia.}}
5376 lyre?\edlabel{endparadox}\footnote{Lines
5377 \xlineref{beginparadox}--\xlineref{endparadox} show some paradoxical
5378 situations that would occur if the gods didn't stay with their own
5379 business.} \&
5380 \endnumbering
5381 \end{Rightside}
5382
5383 \Pages
5384 \end{pages}
5385
5386 \begin{pages}
5387 \begin{Leftside}
5388 \def\endstanzaextra{\interstanza}
5389 \beginnumbering
5390
5391 \begin{astanza}
5392 Arma gravi numero violentaque bella parabam &
5393 edere, materi\={a} conveniente modis. &
5394 Par erat inferior versus---risisse Cupido &
5395 dicitur atque unum surripuisse pedem. \&
5396 \end{astanza}
5397
5398 \begin{astanza}
5399 ``Quis tibi, saeve puer, dedit hoc in carmina iuris? &
5400 Pieridum vates, non tua turba \edtext{sumus}{\Afootnote{note lost}}. &
5401 Quid si praeripiat flavae V\u{e}nus arma Minervae, &
5402 ventilet accensas flava Minerva faces? \&
5403 \end{astanza}
5404
5405 \begin{astanza}
5406 Quis probet in silvis Cererem regnare iugosis, &
5407 lege pharetratae Virginis arva coli? &
5408 Crinibus insignem quis \edtext{acuta}{\Afootnote{acut\={a} (abl.\ abs.)}}
5409 cuspide Phoebum &
5410 instruat, Aoniam Marte movente lyram? \&
5411 \end{astanza}
5412
5413 \endnumbering
5414 \end{Leftside}
5415
5416 \begin{Rightside}
5417 \def\endstanzaextra{\interstanza}
5418 \beginnumbering
5419 \firstlinenum{1}
5420 \linenumincrement{1}
5421 \setstanzaindents{6,0,1,0,1,0}
5422
5423 \begin{astanza}
5424 I was preparing to sing of weapons and violent wars, &
5425 in heavy numbers, with the subject matter suited to the verse measure. &
5426 The even lines were as long as the odd ones, but Cupid laughed, &
5427 they said, and he stole away one foot.\footnote{I.e., the even lines,
5428 which were hexameters (with six feet) became pentameters
5429 (with five feet).} \&
5430 \end{astanza}
5431
5432 \begin{astanza}
5433 ``O cruel boy, who gave you the right over poetry? &
5434 We poets belong to the Pierides,\footnote{Muses} we are not your folk. &
5435 \edlabel{beginparadox}What if Venus should seize away the arms of
5436 Minerva with the golden hair, &
5437 if Minerva with the golden hair should fan alight the kindled torch
5438 of love? \&
5439 \end{astanza}
5440
5441 \begin{astanza}
5442 Who would approve of Ceres\footnote{Ceres was the Roman goddess of the
5443 harvest.} reigning on the woodland ridges, &
5444 and of land tilled under the law of the Maid with the
5445 quiver\footnote{By `\textit{Virgo}' (`Virgin') Ovid means Diana,
5446 the Roman goddess of the hunt.}? &
5447 Who would provide Phoebus with his beautiful hair with a sharp-pointed
5448 spear, &
5449 while Mars stirs the \edtext{Aonian}{\Bfootnote{Mount Parnassus, where
5450 the Muses live, is located in Aonia.}}
5451 lyre?\edlabel{endparadox}\footnote{Lines
5452 \xlineref{beginparadox}--\xlineref{endparadox} show some paradoxical
5453 situations that would occur if the gods didn't stay with their
5454 own business.} \&
5455 \end{astanza}
5456
5457 \endnumbering
5458 \end{Rightside}
5459
5460 \Pages
5461 \end{pages}
5462
5463 \end{document}
5464
5465 %</djdpoems>
5466 % \end{macrocode}
5467 %
5468 % \medskip
5469 % \hrule
5470 %
5471 % \clearpage
5472 %
5473 % \bibliographystyle{alpha}
5474 % \begin{thebibliography}{WWW99}
5475 % \addcontentsline{toc}{section}{References}
5476 % \bibitem[LW90]{EDMACTUG}
5477 % John Lavagnino and Dominik Wujastyk.
5478 % \newblock `An overview of \edmac: a \textsc{Plain} TeX format for
5479 % critical editions'.
5480 % \newblock \emph{TUGboat}, \textbf{11}, 4, pp. 623--643, November 1990.
5481 % \newblock (Code available from CTAN in
5482 % \texttt{macros/plain/contrib/edmac})
5483 %
5484 %
5485 % \bibitem[Wil02]{MEMOIR}
5486 % Peter Wilson.
5487 % \newblock \emph{The \Lpack{memoir} class for configurable typesetting}.
5488 % \newblock November 2002.
5489 % \newblock (Available from CTAN in
5490 % \texttt{macros/latex/contrib/memoir})
5491 %
5492 % \bibitem[Wil04]{LEDMAC}
5493 % Peter Wilson.
5494 % \newblock \emph{\Lpack{ledmac} A presumptuous attempt to port
5495 % \Lpack{EDMAC},\Lpack{TABMAC} and \Lpack{EDSTANZA} to
5496 % LaTeX}.
5497 % \newblock December 2004.
5498 % \newblock (Available from CTAN in
5499 % \texttt{macros/latex/contrib/ledmac})
5500 %
5501 % \end{thebibliography}
5502 %
5503 % \Finale
5504 % \section*{}
5505 % \addcontentsline{toc}{section}{Index}
5506 % \PrintIndex
5507 %
5508 % \section*{}
5509 % \addcontentsline{toc}{section}{Change History}
5510 % \PrintChanges
5511 % \endinput
5512 \endinput
5513
5514 %% \CharacterTabl
5515 %% 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
5516 %% 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
5517 %% Digits \0\1\2\3\4\5\6\7\8\9
5518 %% Exclamation \! Double quote \" Hash (number) \#
5519 %% Dollar \$ Percent \% Ampersand \&
5520 %% Acute accent \' Left paren \( Right paren \)
5521 %% Asterisk \* Plus \+ Comma \,
5522 %% Minus \- Point \. Solidus \/
5523 %% Colon \: Semicolon \; Less than \<
5524 %% Equals \= Greater than \> Question mark \?
5525 %% Commercial at \@ Left bracket \[ Backslash \\
5526 %% Right bracket \] Circumflex \^ Underscore \_
5527 %% Grave accent \` Left brace \{ Vertical bar \|
5528 %% Right brace \} Tilde \~}
5529 %%