Debian Codegraph @

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

raw
1 % \iffalse meta-comment
2 %
3 % reledmac.dtx
4 % Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net
5 % Maintainer:Maïeul Rouquette maieul at maieul dot net
6 % Copyright 2003 -- 2005 Peter R. Wilson / 2011-.. Maïeul Rouquette
7 %
8 % This work may be distributed and/or modified under the
9 % conditions of the LaTeX Project Public License, either
10 % version 1.3 of this license or (at your option) any
11 % later version.
12 % The latest version of the license is in
13 % http://www.latex-project.org/lppl.txt
14 % and version 1.3 or later is part of all distributions of
15 % LaTeX version 2003/06/01 or later.
16 %
17 % This work has the LPPL maintenance status "maintained".
18 %
19 % This work consists of the files listed in the README file.
20 %
21 %
22 %<*driver>
23 \documentclass[twoside]{ltxdoc}
24 \usepackage[T1]{fontenc}
25 \usepackage{xr-hyper}
26 \usepackage{url}
27 \usepackage[draft=false,
28 plainpages=false,
29 pdfpagelabels,
30 bookmarksnumbered,
31 % hyperindex=true
32 hyperindex=false
33 ]{hyperref}
34 \addtolength\marginparwidth{30pt}
35 \usepackage[mono=false]{libertine}
36 \usepackage[series={A,B},noend,noeledsec,nofamiliar]{reledmac}
37 \usepackage{reledpar}
38 \usepackage[english]{babel}
39 \usepackage{xspace}
40 \usepackage{doctools}
41 \usepackage{graphicx,metalogo}
42 \usepackage{csquotes}
43 % Index and Changelog in one column
44 \makeatletter
45 \renewenvironment{theglossary}{%
46 \@restonecoltrue\if@twocolumn\@restonecolfalse\fi
47 \columnseprule \z@ \columnsep 35\p@
48 \glossary@prologue%
49 \GlossaryParms \let\item\@idxitem \ignorespaces}
50 {\if@restonecol\onecolumn\else\clearpage\fi}
51 \def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
52 \columnseprule \z@ \columnsep 35\p@
53 \index@prologue%
54 \IndexParms \let\item\@idxitem \ignorespaces}
55 \def\endtheindex{\if@restonecol\onecolumn\else\clearpage\fi}
56 \@mparswitchfalse
57 \makeatother
58 \EnableCrossrefs
59 \RecordChanges
60 \CodelineIndex
61 %%\OnlyDescription
62 \renewcommand{\MakeUppercase}[1]{#1}
63 \pagestyle{headings}
64 \setcounter{StandardModuleDepth}{1}
65 \usepackage{longtable}
66 \externaldocument[reledpar-]{reledpar}
67 \begin{document}
68 \raggedbottom
69 \DocInput{reledmac.dtx}
70 \end{document}
71 %</driver>
72 %
73 % \fi
74 %
75 % \newcommand{\reff}[1]{\ref{#1} p.~\pageref{#1}}
76 %
77 % \makeatletter
78 % \newcommand*{\DescribeIt}{\leavevmode\@bsphack\begingroup\MakePrivateLetters
79 % \Describe@It}
80 % \newcommand*{\Describe@It}[1]{\endgroup
81 % \marginpar{\raggedleft\PrintDescribeEnv{#1}}%
82 % \SpecialItIndex{#1}\@esphack\ignorespaces}
83 % \newcommand*{\SpecialItIndex}[1]{\@bsphack
84 % \index{#1\actualchar{\protect\ttfamily#1}\encapchar usage}\@esphack}
85 %
86 % \DoNotIndex{\@,\@@par,\@beginparpenalty,\@empty}
87 % \DoNotIndex{\@flushglue,\@input}
88 % \DoNotIndex{\@makefnmark,\@makeother,\@maketitle}
89 % \DoNotIndex{\@namedef,\@ne,\@spaces,\@tempa}
90 % \DoNotIndex{\@tempb,\@tempswafalse,\@tempswatrue}
91 % \DoNotIndex{\@thanks,\@thefnmark,\@topnum}
92 % \DoNotIndex{\@@,\@elt,\@forloop,\@fortmp,\@gtempa,\@totalleftmargin}
93 % \DoNotIndex{\",\/,\@ifundefined,\@nil,\@verbatim,\@vobeyspaces}
94 % \DoNotIndex{\|,\~,\ ,\active,\advance,\aftergroup,\begingroup,\bgroup}
95 % \DoNotIndex{\mathcal,\csname,\def,\documentstyle,\dospecials,\edef}
96 % \DoNotIndex{\egroup}
97 % \DoNotIndex{\else,\endcsname,\endgroup,\endinput,\endtrivlist}
98 % \DoNotIndex{\expandafter,\fi,\fnsymbol,\futurelet,\gdef,\global}
99 % \DoNotIndex{\hbox,\hss,\if,\if@inlabel,\if@tempswa,\if@twocolumn}
100 % \DoNotIndex{\ifcase}
101 % \DoNotIndex{\ifcat,\iffalse,\ifx,\ignorespaces,\index,\input,\item}
102 % \DoNotIndex{\jobname,\kern,\leavevmode,\leftskip,\let,\llap,\lower}
103 % \DoNotIndex{\m@ne,\next,\newpage,\nobreak,\noexpand,\nonfrenchspacing}
104 % \DoNotIndex{\obeylines,\or,\protect,\raggedleft,\rightskip,\rm,\sc}
105 % \DoNotIndex{\setbox,\setcounter,\small,\space,\string,\strut}
106 % \DoNotIndex{\strutbox}
107 % \DoNotIndex{\thefootnote,\thispagestyle,\topmargin,\trivlist,\tt}
108 % \DoNotIndex{\twocolumn,\typeout,\vss,\vtop,\xdef,\z@}
109 % \DoNotIndex{\,,\@bsphack,\@esphack,\@noligs,\@vobeyspaces,\@xverbatim}
110 % \DoNotIndex{\`,\catcode,\end,\escapechar,\frenchspacing,\glossary}
111 % \DoNotIndex{\hangindent,\hfil,\hfill,\hskip,\hspace,\ht,\it,\langle}
112 % \DoNotIndex{\leaders,\long,\makelabel,\marginpar,\markboth,\mathcode}
113 % \DoNotIndex{\mathsurround,\mbox,\newcount,\newdimen,\newskip}
114 % \DoNotIndex{\nopagebreak}
115 % \DoNotIndex{\parfillskip,\parindent,\parskip,\penalty,\raise,\rangle}
116 % \DoNotIndex{\section,\setlength,\TeX,\topsep,\underline,\unskip,\verb}
117 % \DoNotIndex{\vskip,\vspace,\widetilde,\\,\%,\@date,\@defpar}
118 % \DoNotIndex{\[,\{,\},\]}
119 % \DoNotIndex{\count@,\ifnum,\loop,\today,\uppercase,\uccode}
120 % \DoNotIndex{\baselineskip,\begin,\tw@}
121 % \DoNotIndex{\a,\b,\c,\d,\e,\f,\g,\h,\i,\j,\k,\l,\m,\n,\o,\p,\q}
122 % \DoNotIndex{\r,\s,\t,\u,\v,\w,\x,\y,\z,\A,\B,\C,\D,\E,\F,\G,\H}
123 % \DoNotIndex{\I,\J,\K,\L,\M,\N,\O,\P,\Q,\R,\S,\T,\U,\V,\W,\X,\Y,\Z}
124 % \DoNotIndex{\1,\2,\3,\4,\5,\6,\7,\8,\9,\0}
125 % \DoNotIndex{\!,\#,\$,\&,\',\(,\),\+,\.,\:,\;,\<,\=,\>,\?,\_}
126 % \DoNotIndex{\discretionary,\immediate,\makeatletter,\makeatother}
127 % \DoNotIndex{\meaning,\newenvironment,\par,\relax,\renewenvironment}
128 % \DoNotIndex{\repeat,\scriptsize,\selectfont,\the,\undefined}
129 % \DoNotIndex{\arabic,\do,\makeindex,\null,\number,\show,\write,\@ehc}
130 % \DoNotIndex{\@author,\@ehc,\@ifstar,\@sanitize,\@title,\everypar}
131 % \DoNotIndex{\if@minipage,\if@restonecol,\ifeof,\ifmmode}
132 % \DoNotIndex{\lccode,\newtoks,\onecolumn,\openin,\p@,\SelfDocumenting}
133 % \DoNotIndex{\settowidth,\@resetonecoltrue,\@resetonecolfalse,\bf}
134 % \DoNotIndex{\clearpage,\closein,\lowercase,\@inlabelfalse}
135 % \DoNotIndex{\selectfont,\mathcode,\newmathalphabet,\rmdefault}
136 % \DoNotIndex{\bfdefault}
137 % \DoNotIndex{\newcommand,\renewcommand,\providecommand}
138 % \DoNotIndex{\ ,\to,\hsize,\multiply,\textit}
139 %
140 % \newcommand{\dtxfilename}{\texttt{reledmac.dtx}}
141 % \GetFileInfo{reledmac.sty}
142 % ^^A To put the changes in the right order: see http://tex.stackexchange.com/a/74113/7712
143 %\makeatletter
144 % \let\org@changes@\changes@
145 % \def\my@changes v#1.#2.#3\@nil{%
146 % \org@changes@{v#1.\six@digits{#2}.#3=v#1.#2.#3}%
147 % }%
148 % \newcommand*{\six@digits}[1]{%
149 % \ifnum#1<100000 0\fi
150 % \ifnum#1<10000 0\fi
151 % \ifnum#1<1000 0\fi
152 % \ifnum#1<100 0\fi
153 % \two@digits{#1}%
154 % }%
155 % \renewcommand*{\changes@}[1]{%
156 % \my@changes#1.\@nil
157 % }%
158 %\makeatother
159 % \newcommand{\edmac}{\protect\package{EDMAC}\xspace}
160 % \newcommand{\tabmac}{\protect\package{tabmac}\xspace}
161 % \newcommand{\edstanza}{\protect\package{edstanza}\xspace}
162
163 % \newcommand{\ledmac}{\protect\package{ledmac}\xspace}
164 % \newcommand{\Ledmac}{\protect\package{Ledmac}\xspace}
165 % \newcommand{\ledpar}{\protect\package{ledpar}\xspace}
166 % \newcommand{\Ledpar}{\protect\package{Ledpar}\xspace}
167
168
169 % \newcommand{\eledmac}{\protect\package{eledmac}\xspace}
170 % \newcommand{\Eledmac}{\protect\package{Eledmac}\xspace}
171 % \newcommand{\eledpar}{\protect\package{eledpar}\xspace}
172 % \newcommand{\Eledpar}{\protect\package{Eledpar}\xspace}
173
174 % \newcommand{\reledmac}{\protect\package{reledmac}\xspace}
175 % \newcommand{\Reledmac}{\protect\package{Reledmac}\xspace}
176 % \newcommand{\reledpar}{\protect\package{reledpar}\xspace}
177 % \newcommand{\Reledpar}{\protect\package{Reledpar}\xspace}
178
179 % \let\macpackage\reledmac
180 % \let\parpackage\reledpar
181 % \let\Macpackage\reledmac
182 % \let\Parpackage\reledpar
183 % \newcommand{\texbook}{\textit{TeXbook}\xspace}
184 % \newcommand{\thetexbook}{\textit{The TeXbook}\xspace}
185 %
186 % \newcommand{\egstart}{%
187 % \par
188 % \begingroup
189 % \centering
190 % \begin{minipage}{0.45\textwidth}}
191 % \newcommand{\egmid}{%
192 % \end{minipage}\hfill\begin{minipage}{0.45\textwidth}}
193 % \newcommand{\egend}{%
194 % \end{minipage}\par\endgroup}
195 % \changes{v0.1.0}{2003/03/25}{First public release}
196 % \changes{v0.2.0}{2003/08/16}{Added tabmac code, and extended indexing}
197 % \changes{v0.2.1}{2003/09/13}{Bug fixes and match with mempatch v1.8}
198 % \changes{v0.2.2}{2003/11/09}{Improved paragraph footnotes}
199 % \changes{v0.2.2}{2003/11/09}{New Dekker example}
200 % \changes{v0.3.0}{2004/02/14}{Includes edstanza and more}
201 % \changes{v0.3.1}{2004/02/18}{Not released. Added remarks about the parallel package}
202 % \changes{v0.4.0}{2004/02/29}{Added minipage, etc., support}
203 % \changes{v0.4.1}{2004/03/28}{Not released. Minor editorial improvements and code tweaks}
204 % \changes{v0.5.0}{2004/04/04}{Added sidenotes, familiar footnotes in numbered text}
205 % \changes{v0.5.1}{2004/04/10}{Fixed right line numbers killed in v0.5}
206 % \changes{v0.6.0}{2004/11/16}{Fixed long paragraphs looping}
207 % \changes{v0.6.0}{2004/11/16}{Prepared for eledpar package}
208 % \changes{v0.6.0}{2004/12/10}{Fixed minor typos}
209 % \changes{v0.7.0}{2005/02/18}{Tidying up for eledpar and ledarab packages}
210 % \changes{v0.7.0}{2005/02/18}{Replaced all \protect\cs{interAfootnotelinepenalty}, etc.,
211 % by just \protect\cs{interfootnotelinepenalty}}
212 % \changes{v0.7.0}{2005/03/02}{eledmac having been available for 2 years,
213 % deleted the commented out original edmac texts}
214 % \changes{v0.7.0}{2011/06/17}{Ma\"ieul Rouquette new maintainer}
215 % \changes{v0.8.0}{2011/17/06}{Bug on endnotes fixed: in a // text, all endnotes will print and be placed at the ends of columns (!)}
216 % \changes{v0.8.1}{2011/07/14}{Bug on \protect\cs{edtext} ; \protect\cs{critex} ; \protect\cs{lemma} fixed: we can now us non-switching commands}
217 % \changes{v0.9.0}{2011/08/03}{No more ledpatch. All patches are now in the main file.}
218 % \changes{v0.9.1}{2011/08/08}{Fix some bugs linked to integrating ledpatch on the main file.}
219 % \changes{v0.10.0}{2011/08/22}{Corrections to \protect\cs{section} and other titles in numbered sections}
220 % \changes{v0.11.0}{2011/09/16}{Makes it possible to add a symbol on each verse's hanging, as in French typography. Redefines the command \protect\cs{hangingsymbol} to define the character.}
221 % \changes{v0.12.0}{2011/10/01}{Possibility to number the pstart with the commands \protect\cs{numberpstarttrue}.}
222 % \changes{v0.12.0}{2011/10/01}{For compatibility with eledpar, possibility to use \protect\cs{autopar} on the right side.}
223 % \changes{v0.12.1}{2011/10/02}{The numbering of \protect\cs{pstarts} restarts on each \protect\cs{beginnumbering}.}
224 % \changes{v0.12.1}{2011/10/02}{Do not number \protect\cs{pstarts} of stanza.}
225 % \changes{v0.13.0}{2011/11/08}{New stanzaindentsrepetition counter: to repeat stanza indents every \emph{n} verses.}
226 % \changes{v0.13.1}{2011/11/18}{\protect\cs{thepstartL} and \protect\cs{thepstartR} use now \protect\cs{bfseries} and not \protect\cs{bf}, which is deprecated and makes conflicts with memoir class.}
227 % \changes{v0.14.0}{2012/04/04}{Tweaked \protect\cs{edlabel} to get correct line number if the command is first element of a paragraph.}
228 % \changes{v1.0.0}{2012/09/15}{Some compatibility break with eledmac. Change of name: eledmac.}
229 % \changes{v1.1.0}{2012/09/25}{New package option: parapparatus.}
230 % \changes{v1.4.0}{2012/11/16}{Compatibility with LuaTeX of RTL notes.}
231 % \changes{v1.4.2}{2012/12/12}{Debug with some special classes.}
232 % \changes{v1.4.3}{2012/12/18}{Spurious space after familiar footnotes.}
233 % \changes{v1.4.4}{2013/02/18}{Label inside familiar footnotes.}
234 % \changes{v1.4.5}{2013/03/02}{Bug with komasscript + eledpar + chapter.}
235 % \changes{v1.4.6}{2013/04/15}{Bug with memoir class introduced by 1.4.5.}
236 % \changes{v1.4.8}{2013/07/02}{Corrects a bug with parallel texts introduced by 1.1.}
237 % \changes{v1.6.1}{2013/10/27}{Corrects a false hanging verse when a verse is exactly the length of a line.}
238 % \changes{v1.4.0}{2012/11/16}{Compatibility with LuaTeX of RTL notes.}
239 % \changes{v1.8.0}{2013/12/13}{Compatibility with parledgroup option of eledpar package.}
240 % \changes{v1.8.2}{2014/01/31}{Debug compatibility problem with hebrew option of babel package.}
241 % \changes{v1.8.3}{2014/02/03}{Fix spurious spaces added by v1.7.0.}
242 % \changes{v1.10.0}{2014/02/27}{Add \protect\cs{pstartref} and \protect\cs{xpstartref} to refer to a pstart number (extension of \protect\cs{edlabel}).}
243 % \changes{v1.10.1}{2014/02/28}{Compatibility with \textsf{cleveref}.}
244 % \changes{v1.10.2}{2014/03/17}{Compatibility of stanza with v1.8a of babel-greek.}
245 % \changes{v1.10.3}{2014/04/07}{Debug of cross-referencing.}
246 % \changes{v1.10.4}{2014/04/09}{Debug of critical notes in edtabular environnment.}
247 % \changes{v1.10.5}{2014/04/14}{Debug of \protect\cs{xxref}.}
248 % \changes{v1.10.5}{2014/04/14}{Debug of \protect\cs{pausenumbering}.}
249 % \changes{v1.10.6}{2014/05/01}{Debug of interaction between \protect\cs{autopar} and\protect\cs{pausenumbering}.}
250 % \changes{v1.11.1}{2014/05/29}{Correct a bug when a critical note starts with plus or minus.}
251 % \changes{v1.12.0}{2014/08/05}{Compatibility with \protect\package{musixtex}.}
252 % \changes{v1.12.0}{2014/08/05}{Debug eledmac sectioning command after using \protect\cs{resumenumbering}.}
253 % \changes{v1.12.3}{2014/08/15}{Underline lemma in \protect\cs{eledxxx} when using draft mode.}
254 % \changes{v1.12.3}{2014/08/15}{Correct bug with side and familiar notes in tabular environments.}
255 % \changes{v1.12.3}{2014/08/15}{Debug left and right notes (bugs added by 1.12.0)}
256 % \changes{v1.12.3}{2014/08/15}{Debug \protect\cs{eledxxx} with some paper size}
257 % \changes{v1.12.4}{2014/08/25}{Debug spurious page breaks before \protect\cs{chapter} (bug added in 1.12.0)}
258 % \changes{v1.13.1}{2014/09/25}{Debug quotation environment inside of a \protect\cs{pstart} preceded by a sectioning command.}
259 % \changes{v1.13.1}{2014/09/25}{Coming back of page and line breaking penalties's management, deleted by error in v0.17.}
260 % \changes{v1.13.2}{2014/09/30}{Fix a bug with normal footnotes, added by v1.13.0.}
261 % \changes{v1.13.3}{2014/10/04}{Fix extra spaces with paragraphed footnotes, added by v1.13.0.}
262 % \changes{v1.13.4}{2014/10/20}{Fix a bug with index when memoir class is used without hyperref}
263 % \changes{v1.15.0}{2015/01/12}{Fix a bug with footnotes layout when using some options of the geometry package (bug add by v1.13.0).}
264 % \changes{v1.16.0}{2015/01/23}{Compatibility of standard footnotes with some biblatex styles.}
265 % \changes{v1.16.0}{2015/01/23}{New \protect\cs{stanzaindent} command.}
266 % \changes{v1.18.0}{2015/02/23}{Compatibility with \LuaLaTeX\ RTL languages.}
267 % \changes{v1.19.0}{2015/03/06}{\protect\cs{Xmaxhnotes} and \protect\cs{maxhnotesX} work now for both two-columns and three-columns setting.}
268 % \changes{v1.19.0}{2015/03/06}{Compatibility with \protect\package{eledpar} v.1.13.0.}
269 % \changes{v1.19.1}{2015/03/12}{Call \protect\cs{correct@footinsX@box} and \protect\cs{correct@Xfootins@box} directly in \protect\cs{print@notesX@forpages} and \protect\cs{print@Xnotes@forpages}, that is in \protect\package{eledpar}.}
270 % \changes{v1.20.0}{2015/03/22}{Correct \protect\cs{Xinplaceofnumber} hook.}
271 % \changes{v1.20.0}{2015/03/22}{Add series option.}
272 % \changes{v1.20.0}{2015/03/22}{Fix issues with RTL text in notes when using \LuaLaTeX.}
273 % \changes{v1.20.0}{2015/03/22}{The \protect\cs{newif}s are not followed by boolean values set to false, because it is the \TeX\ default setting.}
274 % \changes{v1.20.0}{2015/03/22}{Explicit error message when calling \protect\cs{Xfootnote} outside of \protect\cs{edtext}.}
275 % \changes{v1.20.0}{2015/03/22}{Fix a bug with line number typesetting direction when using \protect\cs{eledsection} and similar commands for RTL texts with \LuaLaTeX.}
276 % \changes{v1.21.0}{2015/04/13}{\protect\cs{AtEveryPstart} and \protect\cs{AtEveryPend} are now compatible with \protect\cs{autopar}}
277 % \changes{v1.21.0}{2015/04/13}{Fix a bug with space between columns with notes in two columns (bug added in v1.13.0).}
278 % \changes{v1.21.0}{2015/04/13}{Add nocritical, noend, nofamiliar and noledgroup options.}
279 % \changes{v1.21.0}{2015/04/13}{Fix a bug with \protect\cs{maxhnotesX} when using \protect\cs{foottwocolX} or \protect\cs{footthreecolX}.}
280 % \changes{v1.21.0}{2015/04/13}{Add \protect\cs{Xtwolinesbutnotmore} and \protect\cs{Xtwolinesonlyinsamepage}.}
281 % \changes{v1.21.0}{2015/04/13}{Fix a bug when a \protect\cs{Xfootnote} follows a \protect\cs{Xendnote} in the second argument of \protect\cs{edtext} (bug added in eledmac 1.0.0 !).}
282 % \changes{v1.21.0}{2015/04/13}{Add noeledsec package option}
283 % \changes{v1.21.0}{2015/04/13}{parapparatus option works now with familiar footnotes.}
284 % \changes{v1.21.0}{2015/04/13}{Add \protect\cs{beforenotesX} and \protect\cs{Xbeforenotes} features for notes set in two and three column.}
285 % \changes{v1.21.0}{2015/04/13}{Debug \protect\cs{beforenotesX} \protect\cs{maxhnotesX} \protect\cs{noteswidthliketwocolumnsX} and \protect\cs{afterruleX} with footnotes set in two and three columns.}
286 % \changes{v1.21.0}{2015/04/13}{\protect\cs{Xafterrule} and \protect\cs{afterruleX} features no longer create problems of overflowing at the bottom of the page.}
287 % \changes{v1.21.0}{2015/04/13}{\protect\cs{preXnotes} and \protect\cs{prenotesX} features no longer create problems of overflowing at the bottom of the page.}
288 % \changes{v1.21.0}{2015/04/13}{Fix spurious space after first page number in \protect\cs{doendnotes}. oldprintnpnumspace option allows to come back to previous setting}
289 % \changes{v1.21.0}{2015/04/13}{\protect\cs{chapter} inside optional argument of \protect\cs{pstart} works when typesetting parallel pages}
290 % \changes{v1.22.0}{2015/04/25}{When using hyperref package, internal links in index or with \protect\cs{edlineref} are now targeted to the top and not longer to the bottom of the lines they refer to.}
291 % \changes{v1.22.0}{2015/04/25}{Provides support for xindy.}
292 % \changes{v1.22.0}{2015/04/25}{Adds hyperlink for references to notes in indices.}
293 % \changes{v1.22.0}{2015/04/25}{Fix conflict between noend package option and edtabularx environments}
294 % \changes{v1.22.1}{2015/04/29}{Fix a bug (added on v1.22.0) with \protect\cs{Xinplaceofnumber} hook.}
295 % \changes{v1.23.0}{2015/05/18}{Compatibility between nofamiliar/nocriticals option and minipage/ledgroup.}
296 % \changes{v1.23.0}{2015/05/18}{Fix error of \protect\cs{iftrue} not closed.}
297 % \changes{v1.23.0}{2015/05/18}{Allow use of \protect\cs{sameword} with inputenc managing of UTF-8.}
298 % \changes{v1.23.0}{2015/05/18}{Error message when using \protect\cs{beginnumbering}\ldots\ \protect\cs{endnumbering} without \protect\cs{pstart}.}
299 % \changes{v1.23.0}{2015/05/18}{New tools to ensure the line-list file uses the right version of commands when upgrading the eledmac version.}
300 % \changes{v1.23.0}{2015/05/18}{Fix a bug with \protect\cs{skipnumbering} called immediately after a \protect\cs{pstart}.}
301 % \changes{v1.23.0}{2015/05/18}{Fix spurious space with \protect\cs{skipnumbering} (bug added on v1.21.0).}
302 % \changes{v1.23.1}{2015/05/20}{Fix a bug with \protect\cs{lemma} command in the right side.}
303 % \changes{v1.23.2}{2015/05/29}{Compatibility with \LaTeX's release 2015.}
304 % \changes{v1.24.0}{2015/06/02}{We can reinitialize \protect\cs{AtEveryPstart} and \protect\cs{AtEveryPend} providing to it an empty argument.}
305 % \changes{v1.24.1}{2015/06/21}{\protect\cs{lemma} is disabled when using \protect\option{nocritical} option.}
306 % \changes{v1.24.2}{2015/06/26}{Fix incompatibility between \protect\option{nofamiliar} option and \protect\package{memoir} package.}
307 % \changes{v1.24.3}{2015/07/07}{Restore marginal numbers and notes with sectioning command (bug introduced in v1.21.0)}
308 % \changes{v1.24.4}{2015/07/19}{Fix spurious space with \protect\cs{edindex} when using xindy+hyperref option.}
309 % \changes{v1.24.5}{2015/07/16}{Fix a bug of indent, when a added in 1.1.0, when a \protect\cs{beginnumbering} immediately follow a sectioning command.}
310 % \changes{v2.0.0}{2015/07/19}{Package's name becomes \reledmac.}
311 % \changes{v2.0.0}{2015/07/19}{In order to have a more consistent name's convention, many names has been changed.}
312 % \changes{v2.0.0}{2015/07/19}{Many \LaTeX's output macros are now patched and not override.}
313 % \changes{v2.0.0}{2015/07/19}{Add nonum option for endnotes.}
314 % \changes{v2.0.0}{2015/07/19}{Add \protect\cs{Xendinplaceofnumber} hook.}
315 % \changes{v2.0.0}{2015/07/19}{Add \protect\cs{Xendnonumber} hook.}
316 % \changes{v2.0.0}{2015/07/19}{Fix a bug when printing only one series of endnotes, but wanted to keep endnotes for other series.}
317 % \changes{v2.0.1}{2015/07/27}{Fix incompatibility between optional argument of \protect\cs{pstart} and \protect\cs{numberpstarttrue}}
318 % \changes{v2.0.1}{2015/07/27}{Fix a bug in eledmac-compat option}
319 % \changes{v2.1.0}{2015/08/08}{New tools to number stanzas}
320 % \changes{v2.1.0}{2015/08/02}{Fix a bug with \protect\cs{chapter} in optional argument of \protect\cs{pstart} in parallel typesetting with \protect\ltxclass{scrbook}.}
321 % \changes{v2.1.0}{2015/08/02}{Fix a bug with \protect\cs{eledchapter} in parallel typesetting with \protect\ltxclass{scrbook}.}
322 % \changes{v2.1.0}{2015/08/02}{Fix a bug with \protect\cs{setline} at the beginning of a \protect\cs{pstart}.}
323 % \changes{v2.1.0}{2015/08/02}{Fix a bug with \protect\cs{advanceline} at the beginning of a \protect\cs{pstart}.}
324 % \changes{v2.1.0}{2015/08/08}{Fix spacing bug with \protect\cs{Xbhooknote} and \protect\cs{bhooknoteX} when using them to insert text and not to execute code.}
325 % \changes{v2.1.0}{2015/08/08}{Fix spacing bug with \protect\cs{Xbhooknote} and \protect\cs{bhooknoteX} when using them to insert text and not to execute code.}
326 % \changes{v2.1.1}{2015/08/13}{Fix a bug with \protect\cs{ledpbsetting}\protect\arg{before}.}
327 % \changes{v2.1.2}{2015/08/26}{Fix a bug with lineation by pstart and tabular environments (added in 2.1.0).}
328 % \changes{v2.1.3}{2015/09/05}{Fix a bug with \protect\cs{edindex} when using not-Latin characters without UTF-8 engines}
329 % \changes{v2.1.3}{2015/09/05}{\protect\cs{Xhangindent} and \protect\cs{hangindentX} work now with all the paragraphs in the note.}
330 % \changes{v2.1.3}{2015/09/05}{\protect\cs{Xnoindent} and \protect\cs{noindentX} work now again (broken in 2.0.0).}
331 % \changes{v2.1.3}{2015/09/05}{Change some internal code in order to provide compatibility with \LaTeX\ release of october~2015}
332 % \changes{v2.1.3}{2015/09/05}{Fix a bug which inserted double space before paragraphed familiar notes.}
333 % \changes{v2.2.0}{2015/09/29}{Fix a bug with combination of \protect\cs{onehalfspacing} and two columns and three columns notes typeset.}
334 % \changes{v2.2.0}{2015/09/29}{Fix a bug with some setting command and optimization option.}
335 % \changes{v2.2.0}{2015/09/29}{New setting tools for endnotes: \protect\cs{Xendnumberonlyfirstinline}, \protect\cs{Xendnumberonlyfirstintwolines}, \protect\cs{Xendsymlinenum}, \protect\cs{Xendbeforenumber}, \protect\cs{Xendafterenumber}, \protect\cs{Xendbeforesymlinenum}, \protect\cs{Xendaftersymlinenum}, \protect\cs{Xendboxsymlinenum}, \protect\cs{Xendhangindent}, \protect\cs{Xendbhooklinenumber}, \protect\cs{Xendahooklinenumber}, \protect\cs{Xendbhookinplaceofnumber}, \protect\cs{Xendahookinplaceofnumber}.}
336 % \changes{v2.2.0}{2015/09/29}{Fix spurious space with paragraphed critical notes when using \LuaLaTeX.}
337 % \changes{v2.2.0}{2015/09/29}{Increase line list version number to ensure compatibility with new options of \reledpar package.}
338 % \changes{v2.2.1}{2015/10/05}{Compatibility with \LaTeX format 2015/10/01.}
339 % \changes{v2.2.2}{2015/10/09}{Fix a bug in \protect\cs{sethangingsymbol}.}
340 % \changes{v2.2.2}{2015/10/09}{Fix a bug with old version of \protect\package{etex}.}
341 % \hyphenation{man-u-script man-u-scripts}
342 % \changes{v2.3.0}{2015/10/14}{Warning message when using some setting commands inside rightside environment (deprecated behavior)}
343 % \changes{v2.3.0}{2015/10/14}{Disable empty lines as paragraph in stanza.}
344 % \changes{v2.3.0}{2015/10/14}{Fix incompatibility of paragraphed footnotes with \protect\package{bidi} v17.9 and following.}
345 % \changes{v2.3.1}{2015/10/19}{Fix spurious space when using optional argument of \protect\cs{stanza} (introduced in v2.3.0).}
346 % \changes{v2.4.0}{2015/10/19}{\protect\cs{Xbhooknote} and \protect\cs{bhooknoteX} work with notes in columns.}
347 % \changes{v2.4.0}{2015/10/19}{Fix a bug with \protect\cs{sameword} in right side.}
348 % \changes{v2.4.0}{2015/10/19}{Fix spurious space in two columns and three columns notes.}
349 % \changes{v2.4.0}{2015/10/19}{Fix a bug of \protect\cs{parindentX} and \protect\cs{Xparindent} with two columns and three columns notes.}
350 % \changes{v2.4.0}{2015/10/19}{Fix spurious space when using optional argument of \protect{stanza} (introduced in v2.3.0).}
351 % \changes{v2.4.1}{2015/10/26}{Fix a bug with \protect\cs{appref} and \protect\cs{apprefwithpage} (introduced in v2.4.0).}
352 % \changes{v2.4.1}{2015/10/26}{Fix a bug with tabular environments when using \protect\package{babel} or \protect\package{polyglossia} languages that override \LaTeX\ \protect\cs{roman} command, like Greek.}
353 % \changes{v2.4.1}{2015/10/26}{Fix a bug with tabular environments when using \protect\package{babel} or \protect\package{polyglossia} languages that override \LaTeX\ \protect\cs{roman} command, like Greek language.}
354 % \changes{v2.5.0}{2015/11/13}{Compatibility with new hook and tools of \protect\reledpar~2.6.0.}
355 % \changes{v2.5.0}{2015/11/13}{\protect\cs{lemma} can be used even when the \protect\option{nocritical} is enabled.}
356 % \changes{v2.5.0}{2015/11/13}{New hooks to customize page and line number appearance in endnotes.}
357 % \changes{v2.5.0}{2015/11/13}{New hooks: \protect\cs{Xbhookgroup} and \protect\cs{bhookgroupX}.}
358 % \changes{v2.5.0}{2015/11/13}{\protect\cs{appref} and \protect\cs{apprefwithpage} can take linerangesep optional argument.}
359 % \changes{v2.5.0}{2015/11/13}{\protect\cs{apprefwithpage} works also when \protect\option{noend} option is enabled.}
360 % \changes{v2.5.0}{2015/11/13}{\protect\cs{apprefwithpage} and \protect\cs{appref} print double quotation mark when the label was not defined.}
361 % \changes{v2.5.0}{2015/11/13}{\protect\cs{apprefwithpage} and \protect\cs{appref} work with right side crossref.}
362 % \changes{v2.5.0}{2015/11/13}{\protect\cs{edlabel} works now in \protect\cs{Xfootnote}.}
363 % \changes{v2.5.0}{2015/11/13}{Log now states \protect\enquote{There were undefined references} when using wrong references in \protect\cs{edlineref} or \protect{edpageref}.}
364 % \changes{v2.5.0}{2015/11/13}{Fix spurious vertical space in \protect\env{astanza} environment (\reledpar)}
365 % \changes{v2.6.0}{2015/11/20}{Adds compatibility with \protect\option{innnote} and \protect\option{notenumber} options of \protect\package{indextools} package.}
366 % \changes{v2.6.0}{2015/11/20}{Fix a bug with footnote counter in \protect\env{ledgroup} (added in v2.5.0).}
367 % \changes{v2.6.0}{2015/11/20}{Fix bug, introduced in v2.5.0, with footnote numbering in parallel typesetting when using \protect\package{perpage} package.}
368 % \changes{v2.7.0}{2015/11/29}{Warning for duplicate and undefined labels are parsable by latexmk}
369 % \changes{v2.7.0}{2015/11/29}{Warning for duplicate labels does not send any more a false line and page number}
370 % \changes{v2.7.0}{2015/11/29}{Fix a bug with \protect\cs{SErefwithpage}.}
371 % \changes{v2.7.0}{2015/11/29}{Fix (again) bugs with footnote numbering in parallel typesetting while using \protect\env{ledgroup} environments (bug added in v2.5.0).}
372 % \changes{v2.7.0}{2015/11/29}{When using \protect\package{hyperref} package, add links for \protect\cs{SEref} and related, \protect\cs{appref} and related.}
373 % \changes{v2.7.0}{2015/11/29}{When using \protect\package{hyperref} package, add links from critical footnotes and critical endnotes to the line of text they refers}
374 % \changes{v2.7.0}{2015/11/29}{When using \protect\package{hyperref} package, add link in familiar footnotes between the footnote marks in the text and the footnote marks in the footnote}
375 % \changes{v2.7.0}{2015/11/29}{Fix bugs in compatibility with \protect\option{innote} and \protect\option{notenumber} options of \protect\package{indextools} package, when indexing outside of a \protect\env{ledgroup}.}
376 % \changes{v2.7.0}{2015/11/29}{New commands to make glossaries connected to page and linenumber with the \protect\package{glossaries} package}
377 % \changes{v2.7.0}{2015/11/29}{Add dash as default page range separator for \protect\cs{SEonlypage}}
378 % \changes{v2.7.0}{2015/11/29}{Delete parenthesis after \protect\cs{SErefonlypage}.}
379 % \changes{v2.7.0}{2015/11/29}{New setting commands: \protect\cs{setSErefonlypageprefixsingle} and \protect\cs{setSErefonlypageprefixmore}}
380 % \changes{v2.7.0}{2015/11/29}{Debug \protect\cs{SErefonlypage} when referring to only one page.}
381 % \changes{v2.7.1}{2015/12/06}{Debug \protect\cs{Xbhookgroup} hooks executed on columnar footnotes (moved to a larger group, to take effect).}
382 % \changes{v2.7.2}{2015/12/13}{Fix problem of hyphenation when using \protect\package{hyperref} package (added in v2.7.0).}
383 % \changes{v2.8.0}{2016/01/15}{\protect\macpackage cross-referencing can take advantage of \protect\package{xr} package.}
384 % \changes{v2.8.0}{2016/01/15}{No indentation for paragraphed notes in ledgroup. Can be changed with \protect\cs{Xparindent} and \protect\cs{parindentX}.}
385 % \changes{v2.8.0}{2016/01/15}{More \protect\cs{edgls\ldots} commands.}
386 % \changes{v2.8.1}{2016/02/22}{Warnings for undefined labels are really parsable by latexmk}
387 % \changes{v2.8.2}{2016/02/27}{Fix a bug with \protect\cs{AtEveryPstart} added in version 2.0.0.}
388 % \changes{v2.8.2}{2016/02/27}{Fix a bug with vertical space after the between-sectioning command as optional argument of a \protect\cs{pstart} and \protect\cs{pstart} content}
389 % \changes{v2.8.2}{2016/02/27}{Fix a bug concerning indent in a paragraph immediately following a sectioning command (bug NOT fixed on reledpar)}
390 % \changes{v2.9.0}{2016/03/23}{Allow continuing line numbering between normal text and parallel text, using \protect\cs{pausenumbering} and \protect\cs{resumenumbering} and the \protect\option{continuousnumberingwithcolumns} option.}
391 % \changes{v2.9.0}{2016/03/23}{Fix a bug when using \protect\cs{lineneation}\protect\arg{page} and \protect\cs{pausenumbering}\protect\ldots\protect\cs{resumenumbering}.}
392 % \changes{v2.9.0}{2016/03/23}{Write correct metadata in numbered files when using \protect\cs{pausenumbering}\protect\ldots\protect\cs{resumenumbering}.}
393 % \changes{v2.9.0}{2016/03/23}{Fix a bug with three- and two-column footnote setting (added in v.2.4.0).}
394 % \changes{v2.9.0}{2016/03/23}{Fix spurious space inside three-column familiar footnote.}
395 % \changes{v2.9.1}{2016/04/09}{Fix a bug when notes start with \protect\option{plus} or \protect\option{minus}.}
396 % \changes{v2.9.2}{2016/04/30}{Fix a bug with \protect\package{hyperref} package when a lemma starts with \protect\option{plus} or \protect\enquote{minus} (bug introduced in v.~2.7.0).}
397 % \changes{v2.9.3}{2016/05/02}{Fix a bug with line number position and reset added by v.~2.9.0}
398 % \changes{v2.10.0}{2016/05/08}{Add \protect\cs{AtEveryStanza} and \protect\cs{AtEveryStopStanza}.}
399 % \changes{v2.10.0}{2016/05/08}{More specific error messages.}
400 % \changes{v2.10.0}{2016/05/08}{Fix a bug in \protect\cs{ledlsnotefontsetup} and \protect\cs{ledrsnotefontsetup} which could not handle \protect\cs{color} command properly.}
401 % \changes{v2.10.1}{2016/05/18}{Add \protect\option{nopenalties} option.}
402 % \changes{v2.10.1}{2016/05/18}{Fix a bug introduced in v.~1.4: not paragraphed critical footnotes could prevent marginal line number from being displayed}
403 % \changes{v2.11.0}{2016/06/02}{Prevent \protect\cs{Xtxtbeforenotes} hook from causing notes to go beyond the bottom margin}
404 % \changes{v2.11.0}{2016/06/02}{Make \protect\cs{parafootsepX} work}
405 % \changes{v2.11.0}{2016/06/02}{Fix a bug in \protect\cs{Xparafootsep} in parallel typesetting}
406 % \changes{v2.11.0}{2016/06/02}{Add new tools to produce an apparatus of manuscripts}
407 % \changes{v2.12.0}{2016/06/16}{Fix a bug with familiar footnote number in optional argument of \protect\cs{pstart} or \protect\cs{pend} in parallel typesetting}
408 % \changes{v2.12.0}{2016/06/16}{Add \protect\cs{hidenumberingonleftpage} and \protect\cs{hidenumberingonrightpage}}
409 % \changes{v2.12.0}{2016/06/16}{\protect\cs{preXnotes} becomes \protect\cs{Xprenotes} (naming convention)}
410 % \changes{v2.12.0}{2016/06/16}{Add \protect\option{auxdir} option.}
411 % \changes{v2.12.0}{2016/06/16}{Add \protect\cs{toendnotes} and related.}
412 % \changes{v2.12.0}{2016/06/16}{Fix a bug when using \protect\cs{chapter} in optional argument of \protect\cs{pstart} in parallel typesetting in combination with the \protect\option{noeledsec} option.}
413 % \changes{v2.12.0}{2016/06/16}{Fix spurious vertical space in \protect\cs{chapter} when used as optional argument of \protect\cs{pstart} in parallel tyepsetting.}
414 % \changes{v2.12.0}{2016/06/16}{Fix a bug with \protect\cs{ledinnernote} and \protect\cs{ledouternote} in parallel typesetting}
415 % \changes{v2.12.0}{2016/06/16}{More accurate message to control the position of \protect\cs{Xfootnote} and \protect\cs{applabel} in the \protect\LaTeX\ code}
416 % \changes{v2.12.0}{2016/06/16}{Fix a bug in critical and familiar footnotes when using uppercase letters with accent mark}
417 % \changes{v2.12.0}{2016/06/16}{Make endnote compatible with \protect\cs{sameword} mechanism}
418 % \changes{v2.13.0}{2016/06/18}{Version 2.13.0 never existed.}
419 % \changes{v2.13.1}{2016/06/18}{In critical footnotes, the right side flag is printed only if requested explicitly with \protect\cs{Xlineflag} (bug added in v.~2.5.0).}
420 % \changes{v2.13.2}{2016/06/24}{Fix a bug added in v.~11.2 which could make parallel typesetting not work.}
421 % \changes{v2.13.3}{2016/06/28}{Makes \protect\cs{Xendafterpagenumbe} affecting \protect\cs{SErefwithpage}}
422 % \changes{v2.14.0}{2016/07/01}{Hyperref with the line number inside critical footnotes is correct when using \protect\cs{xxref}}
423 % \changes{v2.14.0}{2016/07/01}{Some internal changes for new features of \protect\reledpar.}
424 % \changes{v2.14.1}{2016/07/04}{Fix a bug when using \protect\cs{footnoteX} in the first argument of \protect\cs{edtext}.}
425 % \changes{v2.14.1a}{2016/07/14}{Fix problematic typos in the handbook.}
426 % \changes{v2.15.0}{2016/07/22}{Add \enquote{byline} arrangement.}
427 % \changes{v2.15.0}{2016/07/22}{Fix \protect\cs{Xtxtbeforenotes} in ledgroup.}
428 % \changes{v2.15.1}{2016/09/07}{Fix \protect\cs{edindex} in tabular environments.}
429 % \changes{v2.15.2}{2016/09/12}{Fix a bug with \protect\package{fancyhdr} package 3.8 and later.}
430 % \changes{v2.15.3}{2016/09/26}{Fix a bug with \protect\cs{section} in optional argument of \protect\cs{pstart} and empty line before \protect\cs{pend} (bug added in v2.8.2).}
431 % \changes{v2.15.3}{2016/09/26}{Simplification of the sectioning command code.}
432 % \changes{v2.16.0}{2016/10/02}{Display a warning message if using a version of \protect\LaTeX\ that is too old.}
433 % \changes{v2.16.0}{2016/10/02}{Deleted dead code.}
434 % \changes{v2.16.0}{2016/10/02}{New options for \protect\cs{fnpos} and \protect\cs{mpfnpos} to set a customized order for familiar and critical footnotes.}
435 % \changes{v2.16.0}{2016/10/02}{Compatibility with new features of \protect\reledpar}
436 % \changes{v2.16.0}{2016/10/02}{Fix a bug with \protect\cs{Xtxtbeforenotes} for notes in three or two columns}
437 % \changes{v2.16.0}{2016/10/02}{Fix a bug with \protect\cs{Xgroupbylines} for notes in two columns}
438 % \changes{v2.16.0}{2016/10/02}{Fix a bug with \protect\option{notenumber} option of \protect\package{indextools} package when indexing texts in familiar footnotes.}
439 % \changes{v2.16.0}{2016/10/02}{When indexing texts in familiar footnotes with \protect\cs{edtext}, refer to the line number where the footnote is called.}
440 % \changes{v2.16.0}{2016/10/02}{When indexing texts in sidenotes with \protect\cs{edtext}, refer to the line number where the sidenote is called.}
441 % \changes{v2.16.0}{2016/10/02}{Fix potential bug when using \protect\cs{edindex} in critical footnotes.}
442 % \changes{v2.16.0}{2016/10/02}{Add \protect\cs{Xendpagenumberonlyfirst}, \protect\cs{Xendpagenumberonlyfirstifsingle}, \protect\cs{Xendpagenumberonlyfirstintwo}, \protect\cs{Xendinplaceofpagenumber} and \protect\cs{Xendsympagenum} hooks.}
443 % \changes{v2.16.0}{2016/10/02}{When \protect\cs{edindex} is called outside of a \protect\cs{beginnumbering}\protect\ldots\protect\cs{endnumbering} structure, it is automatically switched to \protect\cs{index}, with a warning message.}
444 % \changes{v2.16.1}{2016/10/04}{Fix a bug with redefinition of the style of the footnote number (bug added in v2.12.0)}
445 % \changes{v2.16.2}{2016/10/07}{Error message if \protect\package{footmisc} is loaded after \protect\package{reledmac}.}
446 % \changes{v2.16.2}{2016/10/07}{Fix a bug introduced by v2.16.1 when using non-expandable control sequence, like \protect\cs{normalfont}, in the footnote number style.}
447 % \changes{v2.16.3}{2016/10/12}{Fix a bug with \protect\cs{SEref} (bug added in v2.7.0).}
448 % \changes{v2.16.4}{2016/10/16}{Fix a bug with vertical space before sectioning command in optional argument of \protect\cs{pstart} (bug added in v2.15.3).}
449 % \changes{v2.16.5}{2016/10/20}{Fix potential spurious spaces in endnotes.}
450 % \changes{v2.16.6}{2016/11/14}{Take into account \protect\cs{linenumberstyle} when using \protect\cs{edlineref}.}
451 % \changes{v2.16.6}{2016/11/14}{Fix a bug with the line number style in \protect\cs{doennotes} when referring to right side line in parallel typesetting.}
452 % \changes{v2.16.7}{2016/12/12}{Fix a bug with \protect\cs{numberpstarttrue} when using multiple \protect\cs{beginnumbering}\ldots\ \protect\cs{endnumbering}.}
453 % \changes{v2.16.7}{2016/12/12}{Fix a bug with \protect\cs{msdata} when using multiple \protect\cs{beginnumbering}\ldots\ \protect\cs{endnumbering}.}
454 % \changes{v2.16.8}{2016/12/16}{Fix a bug with \protect\cs{edindex} in footnotes in parallel typesetting.}
455 % \changes{v2.17.0}{2016/12/23}{Add \protect\cs{edglsadd} command.}
456 % \changes{v2.17.0}{2016/12/23}{Add \protect\cs{setmsdataposition} setting.}
457 % \changes{v2.17.1}{2017/01/22}{Fix spurious space in paragraphed footnotes when using \protect\LuaLaTeX without using Right-To-Left text.}
458 % \changes{v2.17.2}{2017/01/25}{Change log message when numbered files still don't exist, in order to improve compatibility with \protect\emph{latexmk}.}
459 % \changes{v2.17.3}{2017/01/31}{Fix a bug with \protect\cs{doendnotesbysection} and \protect\cs{doendnotes}.}
460 % \changes{v2.17.4}{2017/02/10}{Fix a bug with \protect\cs{setSErefonlypageprefixsingle} and \protect\cs{setSErefonlypageprefixmore}.}
461 % \changes{v2.17.5}{2017/02/12}{Fix a bug with \protect\cs{pstartref} when refering to the left side in parallel typesetting.}
462 % \changes{v2.18.0}{2017/02/22}{Fix a bug when using both \protect\cs{Xnumberonlyfirstintwolines} or \protect\cs{Xnumberonlyfirstinline} and \protect\cs{Xparafootsep} and \protect\cs{Xsymlinenum}.}
463 % \changes{v2.18.0}{2017/02/22}{Fix a bug when using a \protect\cs{edtext} in two lines or more in right-to-left typesetting with \protect\XeLaTeX.}
464 % \changes{v2.18.1}{2017/03/20}{Fix a bug when using \protect\cs{msdata} with \protect\LuaLaTeX or with the \protect\package{hyperref} package.}
465 % \changes{v2.19.0}{2017/04/14}{Add better compatibility with the \protect\package{csquotes} package when using familiar footnotes.}
466 % \changes{v2.19.0}{2017/04/14}{Add \protect\cs{footnoteXmark} and \protect\cs{footnoteXtext} commands.}
467 % \title{\Macpackage \\
468 % \changes{v2.19.0}{2017/04/14}{Fix a bug with paragraph indent after sectioning command.}
469 % \changes{v2.20.0}{2017/05/04}{Fix a bug when using familiar footnotes in \protect\cs{eledsection} and related.}
470 % \changes{v2.20.0}{2017/05/04}{Reset font specification at the beginning of familiar footnotes.}
471 % \changes{v2.20.0}{2017/05/04}{Add starred version of \protect\cs{AtEveryPstart}, \protect\cs{AtEveryPend}, \protect\cs{AtEveryStanza} and \protect\cs{AtEveryStopStanza}.}
472 % \changes{v2.20.0}{2017/05/04}{Add \protect\cs{AtStartEveryStanza}, \protect\cs{BeforeEveryStopStanza}, \protect\cs{AtEndEveryPend}, \protect\cs{AtStartEveryPstart}.}
473 % \changes{v2.20.0}{2017/05/04}{Add second optional argument to \protect\cs{pstart}, \protect\cs{pend} and \protect\cs{stanza}.}
474 % \changes{v2.20.0}{2017/05/04}{Add third and fourth optional argument to \protect\cs{newverse}.}
475 % \changes{v2.21.0}{2017/06/04}{Fix a bug when using formatting command in the argument of \protect\cs{edindex} inside \protect\cs{edtext}.}
476 % \changes{v2.21.0}{2017/06/04}{Now, as explained in the handbook, a \protect\cs{edindex} inside \protect\cs{edtext} only creates an index reference to the main text, and not to the critical footnote.}
477 % \changes{v2.21.0}{2017/06/04}{Add the possibility of nested \protect\cs{sameword} commands.}
478 % \changes{v2.22.0}{2017/06/08}{Fix a bug added in v2.16.0 when using \protect\cs{Xtxtbeforenotes} with paragraphed or normal footnotes.}
479 % \changes{v2.22.0}{2017/06/08}{Fix a bug with three and two columns critical footnotes, broken in v.~2.17.6.}
480 % \changes{v2.22.0}{2017/06/08}{Add \protect\cs{txtbeforenotesX} hook.}
481 % \changes{v2.22.0}{2017/06/08}{Add \protect\cs{txtbeforenotesonlyonceX} and \protect\cs{Xtxtbeforenotesonlyonce} hooks.}
482 % \changes{v2.22.1}{2017/07/07}{Compatibility with new version of \protect\reledpar.}
483 % \changes{v2.22.1}{2017/07/07}{Fix a bug with some commands inside \protect\cs{sameword}.}
484 % \changes{v2.22.2}{2017/07/17}{Do not print footnotes at the first run.}
485 % \changes{v2.23.0}{2017/07/31}{Add \protect\option{swcaseinsensitive} option}
486 % \changes{v2.23.0}{2017/07/31}{Optimisation of the code added on v2.22.2 to not print footnotes at the first run.}
487 % \changes{v2.24.0}{2017/08/17}{When a \protect\cs{setlinenum} is used, it is stronger than the \protect\cs{lineation}\protect\arg{page} setting.}
488 % \changes{v2.24.0}{2017/08/17}{Fix a bug with \protect\cs{edlabel} at the beginning of a \protect\cs{pstart}.}
489 % \changes{v2.24.0}{2017/08/17}{Add \protect\cs{swnoexpands} macro to avoid problems with not fully expandable macro inside \protect\cs{sameword}.}
490 % \changes{v2.24.0}{2017/08/17}{Fix spurious space with \protect\cs{labelpstarttrue}}
491 % \changes{v2.24.1}{2017/08/31}{Compatibility with \protect\parpackage 2.20.2}
492 % \changes{v2.24.2}{2017/10/21}{Fix bug between tabular environments and endnotes}
493 % \changes{v2.25.0}{2017/11/05}{Add \protect\cs{Xendtxtbeforenotes} hook}
494 % \changes{v2.26.0}{2017/11/11}{Fix bug in \protect\cs{xpstartref}}
495 % \changes{v2.26.0}{2017/11/11}{Add a mechanism for annotation of stanza line numbering}
496 % \changes{v2.26.1}{2017/11/26}{Fix bug with \protect\cs{linenumannotation}}
497 % \changes{v2.26.2}{2017/12/22}{Fix bug with \protect\cs{Xgroupbyline} and optional argument of critical footnotes.}
498 % \changes{v2.26.2}{2017/12/22}{Fix bug with \protect\cs{Xgroupbyline} for the series after the first one.}
499 % \changes{v2.26.2}{2017/12/22}{Fix bug with \protect\cs{Xgroupbyline} and \protect\cs{Xparafootsep}.}
500 % \changes{v2.26.2}{2017/11/22}{Fix bug with \protect\cs{linenumannotation} in parallel typesetting}
501 % \changes{v2.26.3}{2018/01/06}{Fix bug added by v2.26.0 with notes in parallel typesetting}
502 % \changes{v2.26.4}{2018/01/18}{Fix bug when using \protect\cs{numberpstarttrue} and alterning between manual \protect\cs{pstart} and automatic \protect\cs{pstart} produced by \protect\cs{autopar}}
503 % \changes{v2.26.5}{2018/01/18}{Fix bug with using \protect\cs{eledsection} and related when alternate normal typesetting and parallel typesetting}
504 % \changes{v2.26.5}{2018/01/28}{Check that users have a enough recent version of \protect\package{xparse}}
505 % \changes{v2.26.5}{2018/01/18}{Fix bug when using \protect\cs{eledsection} with the \protect\option{continuousnumberingwithcolumns} of \protect\parpackage}
506 % \changes{v2.26.5}{2018/01/28}{Fix bug with \protect\option{continuousnumberingwithcolumns}}
507 % \changes{v2.26.6}{2018/02/28}{Fix bug with \protect\cs{lineation} by page and nexted \protect\cs{edtext} between two pages (added in v.~2.24.0)}
508 % \changes{v2.26.7}{2018/04/07}{Fix page number in footnote and endnotes when using \protect\option{sameparallelpagenumber} option of \protect\parpackage and typesetting critical text in single mode after critical text in double page mode}
509 % \changes{v2.26.8}{2018/04/30}{Fix bug in some specific cases, introduced by v.2.27.7}
510 % \changes{v2.26.9}{2018/05/02}{Fix bug with critical footnotes line number when alternating between \protect\cs{numberlinefalse} and \protect\cs{numberlinetrue}.}
511 % \changes{v2.26.9}{2018/05/02}{Fix bug with page number in footnote after \protect\cs{mainmatter} (bug introduced in v2.26.7)}
512 % \changes{v2.26.9}{2018/05/02}{Workaround with a bug of \protect\LaTeX 2018/04/01 patch level 3 to generate the .sty file from a .ins file}
513 % \changes{v2.26.10}{2018/05/05}{Really fix bug with page number in footnote after \protect\cs{mainmatter} (bug introduced in v2.26.7)}
514 % \changes{v2.26.10}{2018/05/05}{Add error message when insertion a \protect\cs{pstart} or \protect\cs{pend} inside \protect\cs{edtext} arguments}
515 % \changes{v2.26.11}{2018/05/21}{Allow to use \protect\cs{edtext} inside \protect\cs{sameword}}
516 % \changes{v2.26.12}{2018/07/19}{Precise minimal version of xparse package required.}
517 % \changes{v2.27.0}{2018/09/13}{Add \protect\cs{doinsidethislinehook}.}
518 % \changes{v2.27.1}{2018/10/12}{Fix spurious space in \protect\cs{hidenumbering}.}
519 % \changes{v2.28.0}{2018/11/30}{Familiar footnotes can take an optional argument to manually define the footnote mark.}
520 % \changes{v2.28.1}{2018/12/22}{Fix bug with the alignment of the columns of two and three columns critical footnotes.}
521 % \changes{v2.29.0}{2019/01/08}{Fix bug with \protect\cs{linenumannotation} and \protect\option{nofamiliar} option.}
522 % \changes{v2.29.0}{2019/01/08}{Really reset line number annotation at each line}
523 % \changes{v2.29.0}{2019/01/08}{Add \protect\option{noresetlinenumannotation}}
524 % \changes{v2.29.0}{2019/01/08}{Fix little bug with \protect\cs{msdata}}
525 % \changes{v2.30.0}{2019/01/22}{Add \protect\cs{Xnoidenticallinenumannotation} and \protect\cs{Xendnoidenticallinenumannotation} hooks}
526 % \changes{v2.30.0}{2019/01/22}{Add separator between line number annotations in margin. Add \protect\cs{setlinenumannotationsep}}
527 % \changes{v2.31.0}{2019/02/22}{Add \protect\option{noprefix} and \protect\option{prefixmore} to \protect\cs{appref} and \protect\cs{SEref}.}
528 % \changes{v2.31.1}{2019/03/03}{Fix bug with \protect\cs{Xgroupbyline}, which could produce spurious blank lines.}
529 % \changes{v2.31.1}{2019/03/03}{Fix bug with multiple footnote layer and \protect\cs{Xgroupbyline}.}
530 % \changes{v2.31.1}{2019/03/03}{Fix incompatibility between \protect\cs{Xgroupbyline} and \protect\package{hyperref} package.}
531 % \changes{v2.31.1}{2019/03/03}{Fix incompatibility between \protect\cs{Xgroupbyline} and optional argument of critical footnotes.}
532 % \changes{v2.31.1}{2019/03/03}{Fix bug in vertical spacing with \protect\cs{Xgroupbyline}.}
533 % \changes{v2.31.1}{2019/03/03}{Fix bug with indentation with \protect\cs{Xgroupbyline}.}
534 % \changes{v2.31.1}{2019/03/03}{Fix bug with \protect\cs{Xhangindent} and \protect\cs{hangindentX} for right-to-left texts.}
535 % \changes{v2.31.2}{2019/04/03}{Fix bug with familiar footnote containing non-default font (introduced with v.~2.20.0).}
536 % \changes{v2.31.3}{2019/06/19}{Fix bug with paragraphed footnote in RTL context.}
537 % \changes{v2.32.0}{2019/07/15}{Add \protect\cs{Xlinenumannotationonlyfirst}, \protect\cs{Xlinenumannotationonlyfirstintwo}, \protect\cs{Xsymlinenumannotation}, \protect\cs{Xendlinenumannotationonlyfirst}, \protect\cs{Xendlinenumannotationonlyfirstintwo} and \protect\cs{Xendsymlinenumannotation}.}
538 % \changes{v2.32.1}{2019/07/21}{Do not print \protect\cs{Xendsep} if we print \protect\cs{Xendsymlinenum}.}
539 % \changes{v2.32.1}{2019/07/21}{When using \protect\cs{parindentX} or \protect\cs{Xparindent} and stanza, use the normal indentation in the footnote, not the verse indentation.}
540 % \changes{v2.32.2}{2019/11/28}{Fix spurious vertical space in familiar footnotes with \protect\LuaLaTeX.}
541 % \changes{v2.32.3}{2019/12/09}{Fix bug with critical footnotes when typesetting Arabic text with \protect\package{polyglossia}.}
542 % \changes{v2.32.4}{2020/02/04}{Fix bug \protect\cs{footnoteXmark} and \protect\cs{footnoteXtext}.}
543 % \changes{v2.32.4}{2020/01/04}{\protect\cs{footnoteXmark} and \protect\cs{footnoteXtext} can now have an optional argument, setting the footnote number.}
544 % \changes{v2.32.4}{2020/02/04}{Fix bug when using \protect\cs{Xgroupbyline} and twocol arrangement.}
545 % \changes{v2.32.4}{2020/02/04}{Fix bug with three and two columns footnotes when using \protect\package{bidi}.}
546 % \changes{v2.32.5}{2020/03/08}{Fix bug with \protect\cs{edindex} inside \protect\cs{eledsection} and related.}
547 % \changes{v2.32.5}{2020/03/08}{Fix bug with page number in index with \protect\cs{edindex} when indexing a critical notes.}
548 % \changes{v2.32.5}{2020/03/08}{Fix bug with macro inside \protect\cs{sameword} with no-\protect\XeTeX\ engines.}
549 % \changes{v2.32.6}{2020/04/19}{Fix bug with glossary entries inside the first argument of \protect\cs{edtext}.}
550 % \changes{v2.32.6}{2020/04/19}{Add hyperref link when inserting glossary entries.}
551 % \changes{v2.32.7}{2020/05/03}{Fix bug with \protect\cs{parafootsepX}.}
552 % \changes{v2.32.7}{2020/05/03}{Fix bug with \protect\cs{lineation}\arg{pstart} and \protect\cs{edtext} in the very first line of a \protect\cs{pstart}.}
553 % \changes{v2.32.7}{2020/05/03}{Fix spurious spaces at the very first line of \protect\env{edtabular} environnments.}
554 % \changes{v2.32.8}{2020/05/24}{Add subline number in manuscript apparatus.}
555 % \changes{v2.33.0}{2020/05/31}{Add startstanzaindentsrepetition feature.}
556 % \changes{v2.33.0}{2020/05/31}{Add antilabe feature.}
557 % \changes{v2.33.0}{2020/05/31}{Add \protect\cs{Xinnotemark} and \protect\cs{innotemarkX} hooks.}
558 % \changes{v2.33.1}{2020/06/06}{Fix a spacing bug when the argument of \protect\cs{antilabe} contains more than one word.}
559 % \changes{v2.34.0}{2020/06/24}{Add \protect\cs{Xpstartonlyfirst} and \protect\cs{Xstanzaonlyfirst}.}
560 % \changes{v2.34.0}{2020/06/24}{Add \protect\cs{Xpstartseparator}.}
561 % \changes{v2.34.1}{2020/06/30}{Fix bug with page number when using stanazindentsrepetition, bug introduced in v2.33.0.}
562 % \changes{v2.34.2}{2020/07/06}{Fix bug with tabular environment, in some specific use case, added in v2.32.7.}
563 % \changes{v2.34.3}{2020/08/19}{Fix bug with \protect\cs{parafootsepX} when the footnotes are called outside of a numbered section.}
564 % \changes{v2.34.3}{2020/08/19}{Fix incompatibility between lineation by \protect\cs{pstart} and (a)stanza.}
565 % \changes{v2.34.3}{2020/08/19}{Make commands like \protect\cs{hidenumbering} working at the very beginning of a verse when the first argument of \protect\cs{setstanzaindents} is equal to 0.}
566 % \changes{v2.34.4}{2020/09/16}{Fix some bugs with lineation by page, when a numbered section starts at the very beginning of page.}
567 % \changes{v2.34.4}{2020/09/16}{Fix bugs with \protect\cs{parafootsepX} outside of numbered section.}
568 % \changes{v2.34.5}{2020/09/23}{Fix incompatibility between \protect\cs{apprefwithpage} / \protect\cs{SErefwithpage} and line number annotation mechanism.}
569 % \changes{v2.34.6}{2020/09/23}{Fix incompatibility with \protect\package{calc} package (added with v2.34.4).}
570 % \changes{v2.34.7}{2020/11/19}{Fix bug with \protect\cs{parafootsepX} in some circumstances (added with v2.34.4).}
571 % \changes{v2.35.0}{2020/11/29}{Add \protect\cs{linenumannotationothersidetrue}.}
572 % \changes{v2.35.0}{2020/11/29}{Add new hooks: \protect\cs{Xnolinenumber}, \protect\cs{Xendnolinenumber}, \protect\cs{Xnolinenumberifannotation}, \protect\cs{Xendnolinenumberifannotation}.}
573 % \changes{v2.35.1}{2020/12/20}{Fix a bug when printing ending page number in endnotes and using the \protect\package{hyperref} package.}
574 % \changes{v2.36.0}{2021/01/21}{Fix bug with sublineation on right side of parallel typesetting.}
575 % \changes{v2.36.0}{2021/01/21}{Add \protect\cs{Xnonote} and \protect\cs{nonoteX}.}
576 % \changes{v2.36.1}{2021/02/14}{Fix bug with crossreferencing in parallel typesetting (added in v2.34.4)}
577 % \changes{v2.37.0}{2021/02/28}{Fix incompatibility between \protect\cs{eledsection} (and related) and \protect\package{hyperref}. Incompatibility was introduced by some changes in \protect\package{hyperref} package.}
578 % \changes{v2.37.0}{2021/02/28}{Fix bug with \protect\cs{Xnonote}}
579 % \changes{v2.37.0}{2021/02/28}{Improve syntaxis check.}
580 % \changes{v2.37.1}{2021/03/08}{Fix bug with \protect\cs{edgls} and related in \protect\cs{edtext} argument. Require \protect\package{glossaries-extra} is \protect\package{glossaries} is loaded.}
581 % \changes{v2.37.2}{2021/04/04}{Fix bug with \protect\cs{Xstanzaonlyfirst}.}
582 % \changes{v2.37.2}{2021/04/04}{Fix bug with \protect\option{parapparatus} option and nested \protect\cs{edtext}.}
583 % \changes{v2.37.2}{2021/04/04}{Fix bug with \protect\cs{Xgroupbyline} and two or three columns notes.}
584 % \changes{v2.38.0}{2021/05/30}{Fix indent bugs with stanza and right-to-left typesetting.}
585 % \changes{v2.38.0}{2021/05/30}{Fix bug with \protect\cs{lemma} and right-to-left typesetting with \protect\XeLaTeX.}
586 % \changes{v2.38.0}{2021/05/30}{Add hyperlinks between footnote and lemma when using abbreviated line range.}
587 % \changes{v2.38.0}{2021/05/30}{Add \protect\cs{Xnopagenumberifcurrent} hook.}
588 % \changes{v2.38.0}{2021/05/30}{Add \protect\cs{Xbeforepagenumber} hook.}
589 % \changes{v2.38.1}{2021/09/27}{Fix incompatibility between \protect\parpackage's option \protect\option{continuousnumberingwithcolumns} and lineation by page.}
590 % \changes{v2.38.2}{2021/11/03}{Fix bug when using \protect\cs{applabel} in conjunction with \protect\package{hyperref} package.}
591 % \changes{v2.38.2}{2021/11/03}{Fix some trouble in indentation in stanza, when switching to some language with \protect\package{polyglossia}.}
592 % \changes{v2.39.0}{2021/01/11}{Add \protect\cs{Xnotboxingsubline} and \protect\cs{Xendnotboxingsubline} hooks.}
593 % \changes{v2.39.1}{2021/02/04}{Fix bug with index in familiar and critical footnotes.}
594 % \changes{v2.39.2}{2023/07/04}{Fix bug with \protect\cs{edlabel} in \protect\cs{eledsection} and related.}
595 % \changes{v2.39.2}{2023/07/04}{Fix bug with with \protect\option{continuousnumberingwithcolumns} when right column starts a new page and we use lineation by page.}
596 % \changes{v2.39.2}{2023/07/04}{Tools for \protect\parpackage v2.25.4}
597 % \changes{v2.39.3}{2023/07/08}{Fix bug with \protect\cs{edlabel} after tabular environment (added by v2.39.2).}
598 % \changes{v2.39.4}{2023/07/20}{Fix bug with hyperlink when using \protect\cs{footnoteXmark} and \protect\cs{footnoteXtext}.}
599 % \changes{v2.39.5}{2023/07/21}{The fix in v2.39.4 did'nt work well in tabular environment.}
600 % \changes{v2.39.6}{2023/08/14}{Fix compatibility with memoir v3.8.}
601 % \changes{v2.39.7}{2023/08/21}{Fix compatibility with \protect\cs{pagenumbering} of memoir v3.8.}
602 % \changes{v2.39.7}{2023/08/21}{Again fix with hyperref, footnote and tabular environment}
603 % \changes{v2.40.0}{2023/09/30}{Add\protect\cs{Xonlyonerule} and \protect\cs{onlyoneruleX} hooks}
604 % \changes{v2.40.0}{2023/09/30}{Add\protect\option{onlyonerule} option}
605 % \changes{v2.40.1}{2024/05/11}{Reset \protect\cs{parfillskip} after paragraphed and columned footnote}
606 % \changes{v2.40.1}{2024/05/11}{Fix bug when using \protect\cs{edlabel} in \protect\env{edtabular} and related}
607 % \changes{v2.40.1}{2024/05/11}{Dealing with direction in \protect\cs{footnoteXtxt} when using LuaLaTeX}
608 % \changes{v2.40.2}{2025/02/07}{Bug with right pstart number with continuousnumberingwithcolumns}
609 % \changes{v2.40.3}{2025/03/25}{Fix arithmetic overflow when using paragraphed footnote with high baselineskip value}
610 % \changes{v2.40.4}{2025/04/13}{Fix bug with \protect\cs{lockon} immediately following a (explicit or implicit) \protect\cs{lockoff}.}
611 % \changes{v2.41.0}{2025/07/08}{Fix message when using \protect\cs{SEref} inside a critical footnote.}
612 % \changes{v2.41.0}{2025/07/08}{Make \protect\cs{Xparindent} and \protect\cs{parindentX} working with ledgroup.}
613 % \changes{v2.42.1}{2025/09/04}{Fix bug with line number side when footnote overlap multiple page}
614 % \changes{v2.43.0}{2025/11/05}{Add \protect\cs{afternumberX}}
615 % \changes{v2.44.0}{2025/12/08}{Add \protect\cs{colseparatorX} and \protect\cs{Xcolseparator}}
616 % \changes{v2.44.1}{2026/01/27}{Fix \protect\option{sameparallelpagenumber} option of \protect\reledpar when using \protect\cs{xxmatter} commands of \protect\LaTeX}
617 % \changes{v2.44.2}{2026/02/06}{Fix bug in footnote position with recent version of \protect\LaTeX}
618 % \changes{v2.44.3}{2026/02/23}{Fix bug with \protect\cs{parindentX} and \protect\cs{Xparindent} when setting differs from one series to another}
619 % \changes{v2.44.4}{2026/03/06}{Fix bug with \protect\cs{parindentX} and \protect\cs{Xparindent} in ledgroup}
620 % \changes{v2.44.4}{2026/03/06}{Fix multiple bug in endnotes when using multiple numbering section}
621 % Typeset scholarly editions with \LaTeX\thanks{This file (\dtxfilename)
622 % has version number \fileversion, last revised \filedate.}}
623 %
624 % \author{%
625 % Ma\"ieul Rouquette\thanks{\texttt{maieul at maieul dot net}} \\
626 % {\small based on the \protect\package{ledmac} by} \\
627 % Peter Wilson \\
628 % Herries Press \\
629 % {\small with the \edmac\ plugins \tabmac{} and \edstanza{} by}\\
630 % Herbert Breger and Wayne Sullivan,
631 % {\small all based on \edmac\ by} \\
632 % John Lavagnino and Dominik Wujastyk
633 % }
634 %
635 % \date{}
636 %
637 %
638 % \maketitle
639 %
640 %
641 % \begin{abstract}
642 %
643 % The \macpackage provides many tools in order to typeset scholarly editions.
644 % It is based on the \eledmac package, which was based on the \ledmac package, which was based on the \edmac \TeX\ package.
645 %
646 % It can be used in combination with \parpackage in order to typeset two texts in parallel,
647 % like an original text and its translation in a modern language.
648 %
649 %
650 % \Macpackage provides many tools and options. Normally, they are all documented in this file.
651 % Also provided is a help folder, \enquote{\href{examples/.}{examples}}. The folder contains additional examples (although not for every possible case).
652 % Examples starting with \enquote{1-} are for basic uses, those starting with \enquote{2-} are for advanced uses.
653 %
654 % To report bugs or request a new feature, please go to ledmac GitHub page and click on \enquote{New Issue}: \url{https://github.com/maieul/ledmac/issues/}.
655 % You must create an account on github.com to access my page (maieul/ledmac).
656 % GitHub accounts are free for open-source users. You can post messages in English or in French (preferred).
657 %
658 % You can subscribe to the \macpackage mail list at:\\ \url{http://geekographie.maieul.net/146}
659 % \end{abstract}
660 %
661 % \renewcommand{\numberline}[1]{#1~}
662 % \tableofcontents
663 %
664 %
665 % \section{Introduction}
666 %
667 % \subsection{Aim of the package}
668 %
669 % The \macpackage\ package, together with \LaTeX, provides several
670 % important facilities for formatting critical editions of texts in
671 % a traditional manner. Major features include:
672 % \begin{itemize}
673 % \item automatic stepped line numbering, by page, section or paragraph;
674 % \item sub-lineation within the main series of line numbers;
675 % \item variant readings automatically keyed to line numbers;
676 % \item caters to both prose and verse;
677 % \item multiple series of footnotes and endnotes;
678 % \item block or columnar formatting of the footnotes;
679 % \item simple tabular material may be line numbered;
680 % \item indexing keyed to page and line numbers.
681 % \end{itemize}
682 %
683 % \Macpackage allows the scholar engaged in preparing a critical
684 % edition to focus attention wholly on the task of creating the
685 % critical text and evaluating the variant readings, text-critical
686 % notes and testimonia. \LaTeX{} and \Macpackage\ will take care of
687 % the formatting and visual correlation of all the disparate types
688 % of information.
689 %
690 % Apart from \macpackage there are other \LaTeX\ packages for typesetting critical editions.
691 % However, the aim of \macpackage is to provide an \enquote{all in one} and flexible tool in the field of critical editions.
692 %
693 % Any suggestions for new features are welcome.
694 %
695 % This manual contains a general description of how to use \macpackage, followed by
696 % the complete source code and its extensive documentation (in sections~\ref{overview} and following, enumerated with Roman numerals).
697 % It ends with a list of actions to do when migrating from one version to other, a change history and an index to the
698 % source code.
699 %
700 % You do not need to read the source code for this package in order to use it; we
701 % provide this code primarily for reference, and many of our
702 % comments on it repeat material that is also found in earlier sections. But no documentation,
703 % however thorough, can cover every question that comes up and many can be
704 % answered quickly by consulting the code. On a first reading,
705 % we suggest that you read only the general documentation in
706 % sections~\ref{howto}, unless you are particularly interested in the innards of \macpackage.
707 %
708 % \subsection{History}
709 %
710 % \subsubsection{\edmac}
711 %
712 % The original version of \edmac{} was \texttt{TEXTED.TEX}, written
713 % by John Lavagnino\index{Lavagnino, John}
714 % in late 1987 and early 1988 for formatting
715 % critical editions of English plays.
716 %
717 % John passed these macros on to Dominik Wujastyk\index{Wujastyk, Dominik}
718 % who, in
719 % September--October 1988, added the footnote paragraphing mechanism,
720 % margin swapping and other changes to suit his own purposes, making the
721 % style more like that traditionally used for classical texts in Latin and
722 % Greek (e.g., the Oxford Classical Texts series). He also wrote some
723 % extra documentation and sent the files out to several people. This
724 % version of the macros was the first to be called \edmac.
725 %
726 % The present version was developed in the summer of 1990, with the
727 % intent of adding necessary features, streamlining and documenting
728 % the code, and further generalizing it to make it easily adaptable
729 % to the needs of editors in different disciplines. John did most
730 % of the general reworking and documentation, with the financial
731 % assistance of the Division of the Humanities and Social Sciences,
732 % California Institute of Technology. Dominik adapted the code to
733 % the conventions of Frank Mittelbach's\index{Mittelbach, Frank}
734 % \verb"doc" option, and added some documentation, multiple-column
735 % footnotes, cross-references, and crop marks.\footnote{This version of
736 % the macros was used to format the Sanskrit text in volume I of {\em
737 % Metarules of P\=a\d ninian Grammar\/} by Dominik Wujastyk (Groningen:
738 % Forsten, 1993).} A description by John and Dominik of this version of
739 % \edmac{} was published as \enquote{An overview of \edmac: a \PlainTeX\
740 % format for critical editions}, \emph{TUGboat} \textit{11} (1990),
741 % pp.\,623--643.
742 %
743 % From 1991 through 1994, the macros continued to evolve, and were tested at a
744 % number of sites. We are very grateful to all the members of the (now defunct)
745 % \verb"[email protected]" discussion group who helped us with
746 % smoothing out the bugs and infelicities in the macros.
747 % Ron Whitney\index{Whitney, Ron} and our anonymous reviewer at
748 % the TUG were both of great help in ironing out last-minute
749 % wrinkles, while Ron made some important suggestions which may help
750 % to make future versions of \edmac{} even more efficient.
751 % Wayne
752 % Sullivan,\index{Sullivan, Wayne} in particular, provided several
753 % important fixes and contributions, including adapting the
754 % Mittelbach\slash
755 % Sch\"opf\index{Sch\"opf, Rainer}\index{Mittelbach, Frank} \enquote{New
756 % Font Selection Scheme} for use with \PlainTeX\ and \edmac.
757 % Another project Wayne has worked
758 % on is a \verb"DVI" post-processor which works with an \edmac{}
759 % that has been slightly modified to output \protect\cs{special}s. This
760 % combination enables you to recover to some extent the text of
761 % each line as {\sc ascii} code, facilitating the creation of
762 % concordances, an {\em index verborum}, etc.
763 %
764 % As of 1994, we were pleased to be able to say that \edmac{} was
765 % being used for the real-life book production of several interesting
766 % editions, such as the Latin texts of Euclid's {\sl
767 % Elements},\footnote{Gerhard Brey\index{Brey, Gerhard} used \edmac{} in
768 % the production of Hubert L.~L.\ Busard\index{Busard, Hubert L.~L.} and
769 % Menso Folkerts,\index{Folkerts, Menso} {\em Robert of Chester's
770 % (?)\index{Chester, Robert of} Redaction of Euclid's\index{Euclid} {\em
771 % Elements}, the so-called Adelard II\index{Adelard II} Version}, 2 vols.,
772 % (Basel, Boston, Berlin: Birkh\"auser, 1992).} an edition of the letters
773 % of Nicolaus Copernicus,\footnote{Being prepared at the German Copernicus
774 % Research Institute, Munich.}\index{Copernicus, Nicolaus} Simon
775 % Bredon's\index{Bredon, Simon} {\em Arithmetica},\footnote{Being prepared
776 % by Menso Folkerts {\em et al.}, at the Institut f\"ur Geschichte der
777 % Naturwissenschaften in Munich.} a Latin translation by Plato of
778 % Tivoli\index{Plato of Tivoli} of an Arabic astrolabe
779 % text,\footnote{Richard Lorch,\index{Lorch, Richard} Gerhard
780 % Brey\index{Brey, Gerhard} {\em et al.}, at the same Institute.} a Latin
781 % translation of part II of the Arabic {\em Algebra\/} by Ab\=u K\=amil
782 % Shuj\=a' b.~Aslam,\index{Abu Kamil Shuja' b.~Aslam}\footnote{Richard
783 % Lorch, \enquote{Ab\=u K\=amil on the Pentagon and Decagon} in {\em Vestigia
784 % Mathematica}, ed.\ M. Folkerts and J. P. Hogendijk (Amsterdam, Atlanta:
785 % Rodopi, 1993).} the Latin {\em Rithmachia\/} of Werinher von
786 % Tegernsee,\footnote{Menso Folkerts, \enquote{Die {\em Rithmachia\/} des Werinher
787 % von Tegernsee}, ibid.} a middle-Dutch romance epic on the
788 % Crusades,\footnote{Geert H. M. Claassens,\index{Claassens, Geert H. M.}
789 % {\em De Middelnederlandse Kruisvaartromans}, (Amsterdam: Schiphower en
790 % Brinkman, 1993).} a seventeenth-century Hungarian politico-philosophical
791 % tract,\footnote{Emil Hargittay, {\em Cs\'aky Istv\'an: Politica
792 % philosophiai Okoskod\'as-szerint val\'o rendes \'eletnek p\'eld\'aja
793 % (1664--1674)\/} (Budapest: Argumentum Kiad\'o, 1992).} an anonymous
794 % Latin compilation from Hungary entitled {\em Sermones Compilati in
795 % Studio Gererali Quinqeecclesiensi in Regno Ungarie},\footnote{Being
796 % produced, as was the previous book, by Gyula Mayer\index{Mayer, Gyula}
797 % in Budapest.} the collected letters and papers of
798 % Leibniz,\index{Leibniz}\footnote{Leibniz, {\em S\"amtliche Schriften und
799 % Briefe}, series {\sc I, III, VII,} being edited by Dr.\ H.\
800 % Breger\index{Breger, Herbert}, Dr.~N. G\"adeke\index{G\"adeke, Nora} and
801 % others at the Leibniz-Archiv, Nieders\"achsische Landesbibliothek, Hannover.
802 % (see \url{https://www.gwlb.de/leibniz/digitale-ressourcen/repositorium-des-leibniz-archivs})}
803 % Theodosius's\index{Theodosius} {\em Spherics}, the German {\em
804 % Algorismus} of Sacrobosco,\index{Sacrobosco} the Sanskrit text of the
805 % {\em K\={a}\'{s}ik\={a}\-v\d{r}tti\/} of V\={a}mana\index{Vamana} and
806 % Jay\={a}ditya\index{Jayaditya},\footnote{Being prepared at Poona and
807 % Lausanne Universities.} and the English texts of Thomas
808 % Middleton's\index{Middleton, Thomas} collected works.
809 %
810 % \subsubsection{\ledmac}
811 %
812 %
813 %
814 % Version 1.0 of \tabmac{} was released by
815 % Herbert Breger\index{Breger, Herbert} in October
816 % 1996. This added the capability for typesetting tabular material.
817 %
818 % Version 0.01 of \edstanza{} was released by
819 % Wayne Sullivan~\index{Sullivan, Wayne}
820 % in June 1992, to help a colleague with typesetting Irish verse.
821 %
822 % In March 2003 Peter Wilson started an attempt to port \edmac{}
823 % from TeX to LaTeX. The starting point was \edmac{} version 3.16
824 % as documented on 19 July 1994 (available from CTAN). In August 2003
825 % the \tabmac{} functions were added; the starting point for these
826 % being version 1.0 of Ocober 1996. The \edstanza{} (v0.01) functions were
827 % added in February 2004. Sidenotes and regular footnotes in numbered
828 % text were added in April 2004. This port was called \ledmac (\LaTeX\ \edmac).
829 %
830 % Since July~2011, ledmac is maintained by Ma\"ieul Rouquette. It is increasingly
831 % powerful and flexible, but it also has become increasingly divergent from the original TeX macro.
832 %
833 % \subsubsection{\eledmac}
834 % Important changes were put in version 1.0, to make \ledmac more easily extensible (see \reff{displayoptions}).
835 % These changes can trigger small problems with the old customization. That is why a new name was selected: \eledmac (extended \ledmac).
836 %
837 % To migrate from \ledmac to \eledmac, please read \reff{migration}.
838 %
839 % \subsubsection{\reledmac}
840 %
841 % \eledmac has facilitated the creation of customized critical editions.
842 % However, the changes made to allow such customization were made in a non-systematic way.
843 % Many deprecated commands were kept and many technical \enquote{debts} were accumulated,
844 % hindering the future evolution of the package.
845 %
846 % For these reasons, Maïeul Rouquette decided on a spring cleaning of the code.
847 % As some commands name were changed, the resulting compatibility was broken (a little).
848 %
849 % A new name was selected: \reledmac (extended renewed \eledmac).
850 % To migrate from \eledmac to \reledmac, please read \reff{migratereledmac}.
851 %
852 % \subsection{Bibliography}
853 % A collaborative list of works edited with (r)(e)(ledmac is available at
854 % \url{https://www.zotero.org/groups/209265/critical_editions_typeset_with_edmac_ledmac_eledmac_and_reledmac/}.
855 % Please add your own edition made with (r)(e)ledmac.
856 %
857 % If you write a book or an article about (r)(e)ledmac, please add it on the collaborative bibliography on \url{https://www.zotero.org/groups/1024519/}.
858 % \subsection{Acknowledgements}
859 % Maïeul Rouquette may thank his predecessor, and all the \macpackage\ communauty. Especially, he may thanks all the people who checks English spell and grammar for the handbook.
860 % \section{How the package works --- the problem of the number of \LaTeX\ runs}\label{howto}
861 % The \macpackage package is a three-pass package like \LaTeX\ itself.
862 % Although your textual apparatus and line
863 % numbers will be printed on the first run, it takes two more
864 % compilations by \LaTeX\ to be sure that everything is correctly
865 % placed, and one more if you typeset right-to-left text with \XeLaTeX.
866 % If you make any subsequent changes altering the number
867 % of lines or notes, the input file may similarly
868 % require three passes to get everything to the right place.
869 % \Macpackage will tell you that you need to make more runs when it detects changes,
870 % but it does not expend the labor to check this thoroughly. If you have
871 % problems with a line or two misnumbered at the top of a page, try
872 % running \LaTeX\ once or twice more.
873 %
874 % \textbf{However, the best way to be sure that one has made the right number of runs
875 % is to use some of \LaTeX's run scripts like \emph{latexmk}}.
876 %
877 % \section{Compatibility warning}
878 %
879 % If you use other classes than \cs{article} or \cs{book}, or modify the layout with \package{geometry}, some settings should be made to have correct height for the blocks of notes.
880 %
881 %Please read \reff{Xmaxhnotes}.
882 %
883 % If you use the \LuaTeX\ engine, you need \LuaTeX\ 1.1.0 or later.
884 % A file may mix \emph{numbered} and \emph{unnumbered} text.
885 %
886 % Numbered text is printed with marginal line numbers and can include
887 % footnotes and endnotes that are referenced to those line numbers:
888 % this is how you will want to print the text that you are editing.
889 %
890 % Unnumbered text is not printed with line numbers, and you can't
891 % use \macpackage's note commands with it: this is appropriate for
892 % introductions and other material added by the editor around the
893 % edited text.
894 %
895 %
896 % \section{Options}
897 % The package can be loaded with a number of global options which are listed here. There are two types of options:
898 % 1) options which provide specific features, and, 2) options which optimize the package's performance.
899 % It is advisable for you to read the relevant parts of the handbook, before reading about the first type of option
900 % (specific features), but you can look at the second type (package optimization) in your first reading of the manual.
901 %
902 % \subsection{Specific features}
903 % \begin{description}
904 % \item[draft] underlines lemmas in the main text.
905 % \item[auxdir] \macpackage generates auxiliary files.
906 % It could be useful to store them in a specific directory.
907 % You can set it using \option{auxdir}=\meta{folder} option.
908 % Note the two following point:
909 % \begin{enumerate}
910 % \item \TeX\ is not able to create folder. You should create it yourself.
911 % \item The option does not change the default \LaTeX auxiliary files (.aux, .toc, \ldots).
912 % \end{enumerate}
913 % \item[antilabe] enable \cs{antilabe} feature (see \reff{antilabe});
914 % \item[eledmac-compat] help to migrate from \eledmac to \reledmac (see \reff{eledmac-compat});
915 % \item[nopenalties] must be called in some cases when using paragraphed endnotes (see \reff{nopenalties)};
916 % \item[nopbinverse] prevents page break within verse environment;
917 % \item[noquotation] by default, the quotation environment is redefined within numbered text. You can disable this redefinition with \verb|noquotation| (see \reff{noquotation});
918 % \item[noresetlinenumannotation] does not reset the annotations to line number at each line (see \reff{annotation});
919 % \item[onlyonerule] by default, each series of footnotes has its own rule; this option makes sure only one footnote rule is printed in each page. See §~\ref{opt:onlyonerule} (p.~\pageref{opt:onlyonerule}) for more details.
920 % \item[parapparatus] by default, the apparatus cannot contain paragraph breaks; this option enables paragraphing inside the apparatus;
921 % \item[swcaseinsensitive] make \cs{sameword} command case insensitive;
922 % \item[widthliketwocolumns] set the width of the text printed in a single column to be the same as the width of the text printed in two parallel columns with \parpackage. This is useful when alternating between normal and parallel typesetting;
923 % \item[xindy] and \verb|xindy+hyperref| select \verb+xindy+ as the index processor (\reff{xindy}).
924 % \end{description}
925 %
926 % \subsection{Optimizing package performance}\label{option:performance}
927 % \begin{description}
928 % \item[nocritical] disables tools for critical footnotes (\protect\cs{Afootnote}, \protect\cs{Bfootnote} etc.). If you do not need critical footnotes, this option lets \macpackage\ run faster.
929 % It will also preserve room for other packages.
930 % \item[noeledsec] disables tools for \protect\cs{eledsection} and related commands (\reff{eledsection}).
931 % \item[noend] disables tools for endnotes (\protect\cs{Aendnote}, \protect\cs{Bendnote} etc.). If you do not need endnotes, this option lets \macpackage\ run faster.
932 % It will also preserve room for other packages.
933 % \item[nofamiliar] disables tools for familiar footnotes (\protect\cs{footnoteA}, \protect\cs{footnoteB} etc.). If you do not need familiar footnotes, this option lets \macpackage\ run faster.
934 % It will also preserve room for other packages.
935 % \item[noledgroup] \macpackage allows use of a series of critical notes and a new series of normal notes inside minipage and ledgroup environments (see \reff{ledgroup}). However, such features use up computer memory, at the expense of other processing needs. So if you do not need this feature, use \verb+noledgroup+ option. This should make \macpackage faster.
936 % \item[series] \Macpackage\ defines five levels of notes: A, B, C, D, E.
937 % Using all these levels consumes memory space and processing speed.
938 % This is why, if your work does not require the entire A--E series, you can narrow down the available number of series.
939 % For example, if you only need A and B series, call the package with \verb+series={A,B}+ option.
940 % \end{description}
941 %
942 % \section{Text lines and paragraphs numbering}
943 %
944 % \subsection{Text lines numbering}
945 % \DescribeMacro{\beginnumbering}
946 % \DescribeMacro{\endnumbering}
947 % Each section of numbered text must be preceded by \protect\cs{beginnumbering}
948 % and followed by \protect\cs{endnumbering}, as in the following example. \\
949 % \egstart
950 % \begin{verbatim}
951 % \beginnumbering
952 % Text
953 % \endnumbering
954 % \end{verbatim}
955 % \egend
956 %
957 % The \protect\cs{beginnumbering} macro resets the line number to zero,
958 % reads an auxiliary file called \meta{jobname}.\file{nn} (where
959 % \meta{jobname} is the name of the main input file for this job,
960 % and \file{nn} is 1 for the first numbered section, 2 for
961 % the second section, and so on), and then creates a new version of
962 % this auxiliary file to collect information during this run. The
963 % first instance of \protect\cs{beginnumbering} also opens a file called
964 % \meta{jobname}\file{.<series>end} to receive the text of the endnotes.
965 % \protect\cs{endnumbering} closes the \meta{jobname}.\file{nn} file.
966 %
967 % If the line numbering of a text is to be continuous from start to end,
968 % then the whole text will be typed between one pair of
969 % \protect\cs{beginnumbering} and \protect\cs{endnumbering} commands. But your text
970 % will most often contain chapter or other divisions marking sections
971 % that should be independently numbered, and these will be appropriate
972 % places to begin new numbered sections.
973 %
974 % \Macpackage has to read and store in memory
975 % a certain amount of information about the entire section when it
976 % encounters a \protect\cs{beginnumbering} command, so it speeds up the
977 % processing and reduces memory use when a text is divided into a larger
978 % number of sections (at the expense of multiplying the number of
979 % external files that are generated).
980 %
981 % \subsection{Paragraphs}
982 % \subsubsection{Basics}
983 % \DescribeMacro{\pstart}
984 % \DescribeMacro{\pend}
985 % Within a numbered section, each paragraph of numbered text must
986 % be marked using the \protect\cs{pstart} and \protect\cs{pend} commands like this: \\
987 % \egstart
988 % \begin{verbatim}
989 % \pstart
990 % Paragraph of text.
991 % \pend
992 % \end{verbatim}
993 % \egend
994 %
995 % Text that appears within a numbered section but is not marked with
996 % \protect\cs{pstart} and \protect\cs{pend} will not be numbered.
997 %
998 % The following example shows the proper section and paragraph
999 % markup and the kind of output that would typically be generated:
1000 % \egstart
1001 % \begin{verbatim}
1002 % \beginnumbering
1003 % \pstart
1004 % This is a sample paragraph, with
1005 % lines numbered automatically.
1006 % \pend
1007 %
1008 % \pstart
1009 % This paragraph too has its
1010 % lines automatically numbered.
1011 % \pend
1012 %
1013 % The lines of this paragraph are
1014 % not numbered.
1015 %
1016 % \pstart
1017 % And here the numbering begins
1018 % again.
1019 % \pend
1020 % \endnumbering
1021 % \end{verbatim}
1022 % \egend
1023 %
1024 % \subsubsection{Automatically producing \protect\cs{pstart} \ldots{} \protect\cs{pend}}
1025 % \DescribeMacro{\autopar}\label{autopar}
1026 % You can use \protect\cs{autopar} to avoid the nuisance of this paragraph markup
1027 % and still have every paragraph automatically numbered. The
1028 % \protect\cs{autopar} command needs to be called inside a \cs{beginnumbering}\ldots\cs{endnumbering} structure, as follows:
1029 % \egstart
1030 % \begin{verbatim}
1031 % \beginnumbering
1032 % \autopar
1033 %
1034 % A paragraph of numbered text.
1035 %
1036 % Another paragraph of numbered
1037 % text.
1038 %
1039 % \endnumbering
1040 % \end{verbatim}
1041 % \egend
1042 %
1043 % \protect\cs{autopar} fails, however, on paragraphs that start with a
1044 % \verb"{" or with any other command that starts a new group before it
1045 % generates any text. Such paragraphs need to be started explicitly,
1046 % before the new group is opened,
1047 % using \protect\cs{indent}, \protect\cs{noindent}, or \protect\cs{leavevmode}, or using
1048 % \protect\cs{pstart} itself.\footnote{For a detailed study of the
1049 % reasons for this restriction, see Barbara Beeton, \enquote{Initiation
1050 % rites}, \textit{TUGboat} \textbf{12} (1991),
1051 % pp.\,257--258.\protect\index{Beeton, Barbara Ann Neuhaus Friend}}
1052 %
1053 % \subsubsection{Content before specific \protect\cs{pstart} and after specific \protect\cs{pend}}\label{pstart:optionalarg}
1054 % \changes{v1.12.0}{2014/08/05}{Optional arguments for \protect\cs{pstart} and \protect\cs{pend}.}
1055 % Both \protect\cs{pstart} and \protect\cs{pend} can take an optional argument in brackets.
1056 % Its content will be printed before the beginning of \protect\cs{pstart} / after the end of \protect\cs{pend} instead of the argument of \protect\cs{AtEveryPstart} / \protect\cs{AtEveryPend}.
1057 %
1058 % Note that a \cs{noindent} will be automatically added before this argument, and, consequently, a \cs{parskip} will be inserted.
1059 % You can use a second optional argument in brackets to avoid that \cs{noindent}.
1060 % \begin{verbatim}
1061 % \pstart[foo] % A \noindent will be inserted before foo.
1062 % \pstart[][foo]% No \noindent before foo.
1063 % \end{verbatim}
1064 %
1065 % The second optional argument of \cs{pstart} / \cs{pend} replaces the argument of \cs{AtEveryPstart*} / \cs{AtEveryPend*}.
1066 %
1067 % If you need to start a \protect\cs{pstart} with brackets, or to add brackets after a \protect\cs{pend}, just add a \protect\cs{relax} between \protect\cs{pstart}\,\ldots\,\protect\cs{pend} and the brackets.
1068 %
1069 % This feature is also useful when typesetting verses (see \reff{verse}) or \parpackage\ (see \reff{eledpar}).
1070 %
1071 % A \protect\cs{noindent} is automatically added before this argument.
1072 %
1073 % \subsubsection{Content before every \protect\cs{pstart} and after every \protect\cs{pend}}
1074 % \changes{v1.15.0}{2015/01/12}{New commands \protect\cs{AtEveryPstart} and \protect\cs{AtEveryPend}.}
1075 % \label{AtEveryPstart} \DescribeMacro{\AtEveryPstart}\DescribeMacro{\AtEveryPend}
1076 % You can use both \protect\cs{AtEveryPstart} and \protect\cs{AtEveryPend}.
1077 % Their arguments will be printed before every \protect\cs{pstart} begins / after every \protect\cs{pend} ends.
1078 %
1079 % Note that a \cs{noindent} will be inserted before the argument, and, consequently, a \cs{parskip}. You can use the starred version of \protect\cs{AtEveryPstart} and \protect\cs{AtEveryPend} to avoid the \cs{noindent}.
1080 %
1081 % \DescribeMacro{\AtStartEveryPstart}\DescribeMacro{\AtEndEveryPend}
1082 % The argument of \cs{AtStartEveryPstart} / \cs{AtEndEveryPend} will be inserted at the beginning / the end of every \cs{pstart} / \cs{pend} in the same paragraph. For example, if you want each \cs{pstart} to start with a star, you can use:
1083 % \begin{verbatim}
1084 % \AtStartEveryPstart{*}
1085 % \end{verbatim}
1086 % Instead of manually doing
1087 % \begin{verbatim}
1088 % \pstart * Real pstart content.\pend
1089 % \end{verbatim}
1090 % \subsubsection{Numbering paragraphs (\protect\cs{pstart})}
1091 % \changes{v0.12.0}{2011/10/01}{Possibility to number \protect\cs{pstart}.}
1092 % It is possible to insert a number at every \protect\cs{pstart} command; you must use the \DescribeMacro{\numberpstarttrue}\protect\cs{numberpstarttrue} command to have it. You can stop the numbering with \DescribeMacro{\numberpstartfalse}\protect\cs{numberpstartfalse}.
1093 % You can redefine the command \DescribeMacro{\thepstart}\protect\cs{thepstart} to change style.
1094 % You can change the value of the pstart number by using \emph{after} \protect\cs{beginnumbering}:
1095 % \begin{verbatim}
1096 % \setcounter{pstart}{value}
1097 % \end{verbatim}
1098 % On each \protect\cs{beginnumbering} the numbering restarts.
1099 % \changes{v0.15.0}{2012/06/11}{Possibility to print \protect\cs{pstart} number at the sides of the text.}
1100 %
1101 % \DescribeMacro{\sidepstartnumtrue}
1102 % With the \protect\cs{sidepstartnumtrue} command, the number of \protect\cs{pstart} will be printed at the sides of the text.
1103 % In this case, the line number will be not printed.
1104 %
1105 % \changes{v1.1.0}{2012/09/25}{Add \protect\cs{labelpstarttrue}.}
1106 % \DescribeMacro{\labelpstarttrue}
1107 % With the \protect\cs{labelpstarttrue} command, a \protect\cs{label} added just after a \protect\cs{pstart} will refer to the number of this pstart.
1108 %
1109 % \subsubsection{Languages written in Right to Left}
1110 % If you use languages written right to left with \LuaLaTeX\ or \XeLaTeX,
1111 % you must switch text direction \emph{before} the \protect\cs{pstart} command.
1112 %
1113 % \subsubsection{Memory limits}
1114 % \textbf{This paragraph is kept for history, but the problems described below should not appear with the most recent version of \LaTeX.}
1115 %
1116 % \label{pause}
1117 % \DescribeMacro{\pausenumbering}
1118 % \DescribeMacro{\resumenumbering}
1119 % \Macpackage stores a lot of information about line numbers and
1120 % footnotes in memory as it goes through a numbered section. But
1121 % at the end of such a section, it empties its memory out, so to
1122 % speak. If your text has a very long numbered section it is
1123 % possible that your \LaTeX\ may reach its memory limit. There are
1124 % two solutions to this.
1125 %
1126 % The first solution is to get a larger \LaTeX\ with increased memory.
1127 %
1128 % The second solution is to
1129 % split your long section into several smaller ones. The trouble
1130 % with this is that your line numbering will start again at zero
1131 % with each new section. To avoid this problem, we provide
1132 % \protect\cs{pausenumbering} and \protect\cs{resumenumbering} which are just
1133 % like \protect\cs{endnumbering} \ldots\ \protect\cs{beginnumbering}, except that
1134 % they arrange for your line numbering to continue across the break.
1135 % Use \protect\cs{pausenumbering} only between numbered paragraphs:
1136 % \egstart
1137 % \begin{verbatim}
1138 % \beginnumbering
1139 % \pstart
1140 % Paragraph of text.
1141 % \pend
1142 % \pausenumbering
1143 %
1144 % \resumenumbering
1145 % \pstart
1146 % Another paragraph.
1147 % \pend
1148 % \endnumbering
1149 % \end{verbatim}
1150 % \egend
1151 %
1152 % We have defined these commands as two macros, in case you find it necessary
1153 % to insert text between numbered sections without disturbing the
1154 % line numbering. But if you are really just using these macros to
1155 % save memory, you might as well type,
1156 % \egstart
1157 % \begin{verbatim}
1158 % \newcommand{\memorybreak}{\pausenumbering\resumenumbering}
1159 % \end{verbatim}
1160 % and type \protect\cs{memorybreak} between the relevant \protect\cs{pend} and
1161 % \protect\cs{pstart}.
1162 % \egend
1163 %
1164 % \subsection{Lineation commands}
1165 %
1166 % \subsubsection{Disabling lineation}
1167 % \DescribeMacro{\numberlinefalse} \DescribeMacro{\numberlinetrue}
1168 % Line numbering can be disabled with \protect\cs{numberlinefalse}. It can be enabled again with \protect\cs{numberlinetrue}.
1169 %
1170 % \textbf{This feature must be used with caution.}
1171 % \begin{itemize}
1172 % \item It should not be use if you have critical footnotes after \cs{numberlinefalse}.
1173 % \item It could be used in the following cases:
1174 % \begin{itemize}
1175 % \item You want only familiar footnotes, not critical footnotes;
1176 % \item You want only parallel typesetting (using \parpackage) but no critical footnotes.
1177 % \item You disable, for a portion of text, line numbering
1178 % \end{itemize}
1179 % \item It must not be used if:
1180 % \begin{itemize}
1181 % \item You do not want to have the line number in the margins, but do want to use critical footnotes. In this case, set \cs{firstlinenum} to a big value, such as 100,000 (\reff{firstlinenum}).
1182 % \item You want to freeze the line numbering for some line, but still keep critical footnotes. In this case, use \cs{startlock} (\reff{startlock}).
1183 % \end{itemize}
1184 % \end{itemize}
1185 % A successor to \reledmac\ may disable this feature.
1186 % \subsubsection{Setting lineation start and step}
1187 % \DescribeMacro{\firstlinenum}\label{firstlinenum}
1188 % \DescribeMacro{\linenumincrement}
1189 % By default, \macpackage numbers every 5th line. There are two counters that control this behavior:
1190 % \verb?firstlinenum? and \verb?linenumincrement?. They can be changed using \protect\cs{firstlinenum}\marg{num} and
1191 % \protect\cs{linenumincrement}\marg{num}. \protect\cs{firstlinenum} specifies the first
1192 % line that will have a printed number, and \protect\cs{linenumincrement} is
1193 % the difference between successive numbered lines. For example, to start printing numbers at the first line
1194 % and to have every other line numbered: \\
1195 % \verb?\firstlinenum{1} \linenumincrement{2}?
1196 %
1197 % \DescribeMacro{\firstsublinenum}
1198 % \DescribeMacro{\sublinenumincrement}
1199 % There are similar commands, \protect\cs{firstsublinenum}\marg{num} and
1200 % \protect\cs{sublinenumincrement}\marg{num} for controlling sub-line numbering.
1201 %
1202 % \DescribeMacro{\linenumberlist}\label{linenumberlist}
1203 % You can define \protect\cs{linenumberlist} to specify a non-uniform distribution
1204 % of printed line numbers. For example: \\
1205 % \verb?\gdef\linenumberlist{1,2,3,5,7,11,13,17,19,23,29}? \\
1206 % to have numbers printed on prime-numbered lines only. There must be
1207 % no spaces within the definition which consists of comma-separated integer
1208 % numbers. The numbers can be in any order but it is easier to read if you
1209 % put them in numerical order. Either omitting the definition of
1210 % \protect\cs{linenumberlist} or following the empty definition \\
1211 % \verb?\gdef\linenumberlist{}? \\
1212 % the standard numbering sequence is applied. The standard sequence
1213 % is that specified by the combination of the \verb+firstlinenum+,
1214 % \verb+linenumincrement+, \verb+firstsublinenum+ and
1215 % \verb+linenumincrement+ counter values.
1216 %
1217 % \subsubsection{Setting lineation reset}
1218 % \DescribeMacro{\lineation}
1219 % \changes{v1.0.0}{2012/09/15}{Debug in lineation command}
1220 % Lines can be numbered either by page, by pstart or by section; you specify
1221 % this using the \protect\cs{lineation}\marg{arg}
1222 % macro, where \meta{arg} is either
1223 % \texttt{page}, \texttt{pstart} or \texttt{section}.
1224
1225 % You may only use this command at places
1226 % where numbering is not in effect; you can't change the lineation system
1227 % within a section. You can change it between sections: they don't all
1228 % have to use the same lineation system.
1229 % The package's standard setting is \verb"\lineation{section}". If the lineation is by pstart, the pstart number will be printed before the line number in the notes.
1230 %
1231 % \subsubsection{Setting line number margin}
1232 % \DescribeMacro{\linenummargin}
1233 % The command \protect\cs{linenummargin}\marg{location} specifies the margin
1234 % where the line (or pstart) numbers will be printed. The permissable values
1235 % for \meta{location} are \texttt{left}, \texttt{right}, \texttt{inner}, or \texttt{outer}:
1236 % for example, \verb"\linenummargin{inner}".
1237 % The package's default setting is \\
1238 % \verb"\linenummargin{left}" \\
1239 % to typeset the numbers in the left hand margin.
1240 % You can change this whenever you're not in the middle of
1241 % making a paragraph.
1242 %
1243 % More precisely, the value of
1244 % \protect\cs{linenummargin} used is the value in effect at the \protect\cs{pend}
1245 % of a numbered paragraph. Apart from an initial setting for
1246 % \protect\cs{linenummargin}, only change \protect\cs{linenummargin} after a \protect\cs{pend},
1247 % whereupon it will apply to all following numbered paragraphs, until
1248 % changed again (changing it between a \protect\cs{pstart} and \protect\cs{pend}
1249 % pair will apply the change to all of the current paragraph).
1250 %
1251 % \subsubsection{Other settings}
1252 %
1253 % \DescribeMacro{\leftlinenum}
1254 % \DescribeMacro{\rightlinenum}
1255 % \DescribeMacro{\linenumsep}
1256 % When a marginal line number is to be printed, there are many ways to display it.
1257 % You can redefine \protect\cs{leftlinenum} and \protect\cs{rightlinenum} to
1258 % change the way marginal line numbers are printed in the
1259 % left and right margins respectively; the initial
1260 % versions print the number in font \protect\cs{numlabfont} (described
1261 % below) at a distance \protect\cs{linenumsep} (initially set to one pica)
1262 % from the text.
1263 %
1264 % \subsection{Changing the line numbers}
1265 %
1266 % Normally, line numbering starts at 1 for the first line of
1267 % a section and increments by one for each line thereafter. There
1268 % are various common modifications of this system and the
1269 % commands described here allow you to put such modifications
1270 % into effect.
1271 %
1272 % \subsubsection{Sublineation}
1273 % \DescribeMacro{\startsub}
1274 % \DescribeMacro{\endsub}
1275 % You insert the \protect\cs{startsub} and \protect\cs{endsub} commands in your text
1276 % to turn sub-lineation on and off. For example, stage directions in plays are often numbered with sub-line
1277 % numbers: as line $10.1$, $10.2$, $10.3$, rather than as $11$, $12$, and $13$.
1278 % Titles and headings are sometimes numbered with sub-line numbers as well.
1279 %
1280 % When sub-lineation is in effect, the line number counter is
1281 % frozen and the sub-line counter advances instead. If one of these
1282 % commands appears in the middle of a line, it doesn't take effect
1283 % until the next line; in other words, a line is counted as a line
1284 % or sub-line depending on what it started out as, even if it
1285 % changes in the middle.
1286 %
1287 % \DescribeMacro{\Xsublinesep}
1288 % \DescribeMacro{\Xsublinesepside}
1289 % You can change the separator between the line number and the subline number either by using \cs{Xsublinesep} without any optional argument (\reff{Xsublinesep}) or by using \cs{Xsublinesepside}. In the second case, it will change the separator only for line numbers in the margins, not in the footnotes.
1290 % \subsubsection{Locking lineation}\label{startlock}
1291 % \DescribeMacro{\startlock}
1292 % \DescribeMacro{\endlock}
1293 % The \protect\cs{startlock} command, used in running text, locks the
1294 % line number at its current value, until you insert \protect\cs{endlock}.
1295 % It can tell for itself whether you are in a patch of line or
1296 % sub-line numbering. One use for line-number locking is in printing
1297 % poetry: there the line numbers should be those of verse lines
1298 % rather than of printed lines, even when a verse line requires several
1299 % printed lines. But in this case you may use the \cs{stanza} mechanism, see \reff{verse}.
1300 %
1301 % \DescribeMacro{\lockdisp}
1302 % When line-number locking is used,
1303 % several printed lines may have the same line number, and you have to
1304 % specify whether you want the number attached to the first printed
1305 % line or the last, or whether you just want the number printed by
1306 % them all, assuming that the settings of the previous parameters
1307 % requires the display of a line number for this line.
1308 % You specify your preference using \protect\cs{lockdisp}\marg{arg}; its
1309 % argument is a word, either \verb+first+, \verb+last+, or \verb+all+.
1310 % The package initially sets this as \protect\cs{lockdisp}\verb+{first}+.
1311 %
1312 % \subsubsection{Setting and changing line number}
1313 % \DescribeMacro{\setline}
1314 % \DescribeMacro{\advanceline}
1315 % In some cases you may want to modify the line numbers that are
1316 % automatically calculated: if you are printing only fragments
1317 % of a work but want to print line numbers appropriate to a complete
1318 % version, for example. The \protect\cs{setline}\marg{num} and
1319 % \protect\cs{advanceline}\marg{num} commands
1320 % may be used to change the current line's number (or the sub-line
1321 % number, if sub-lineation is currently on). They change both the
1322 % marginal line numbers and the line numbers passed to the notes.
1323 % \protect\cs{setline} takes one argument, the value to which you want
1324 % the line number set; it must be $0$ or greater. \protect\cs{advanceline}
1325 % takes one argument, an amount that should be added to the current
1326 % line number; it may be positive or negative.
1327 %
1328 % \DescribeMacro{\setlinenum}
1329 % The \protect\cs{setline} and \protect\cs{advanceline} macros should only be used
1330 % within a \protect\cs{pstart}\ldots\protect\cs{pend} group. The \protect\cs{setlinenum}\marg{num}
1331 % command can be used outside such a group, for example, between
1332 % a \protect\cs{pend} and a \protect\cs{pstart}. It sets the line number
1333 % to \meta{num}.
1334 % It has no effect if used within a \protect\cs{pstart}\ldots\protect\cs{pend} group.
1335 %
1336 % \subsubsection{Line number style}
1337 % \DescribeMacro{\linenumberstyle}
1338 % \DescribeMacro{\sublinenumberstyle}
1339 % Line numbers are normally printed as arabic numbers. You can
1340 % use \protect\cs{linenumberstyle}\marg{style} to change the numbering style.
1341 % \meta{style} must be one of:
1342 % \begin{description}
1343 % \item[\texttt{Alph}] Uppercase letters (A \ldots\ Z).
1344 % \item[\texttt{alph}] Lowercase letters (a \ldots\ z).
1345 % \item[\texttt{arabic}] Arabic numerals (1, 2, \ldots)
1346 % \item[\texttt{Roman}] Uppercase Roman numerals (I, II, \ldots)
1347 % \item[\texttt{roman}] Lowercase Roman numerals (i, ii, \ldots)
1348 % \end{description}
1349 % Note that with the \texttt{Alph} or \texttt{alph} styles, \enquote{numbers}
1350 % must be between 1 and 26 inclusive.
1351 %
1352 % Similarly \protect\cs{sublinenumberstyle}\marg{style} can be used to change
1353 % the numbering style of sub-line numbers, which is normally arabic numerals.
1354 %
1355 % \subsubsection{Skipping and hidding number}
1356 % \DescribeMacro{\skipnumbering}
1357 % When inserted into a numbered line the macro \protect\cs{skipnumbering} causes
1358 % the numbering of that particular line to be skipped; that is, the line
1359 % number is unchanged and no line number will be printed.
1360 % Note that if you use it in \protect\cs{stanza}, you must call it at the beginning of the verse.
1361 %
1362 % \DescribeMacro{\hidenumbering}
1363 % \changes{v1.21.0}{2015/04/13}{Add \protect\cs{hidenumbering}}
1364 % When inserted into a numbered line, the macro \protect\cs{hidenumbering} causes
1365 % the number for that particular line to be hidden; namely, no line number will print.
1366 % Note that if you use it in \protect\cs{stanza}, you must call it at the beginning of the verse.
1367 %
1368 % \DescribeMacro{\hidenumberingonleftpage}
1369 % \cs{hidenumberingonleftpage} is like \protect{hidenumbering}, but is applied only on left page. \cs{hidenumberingonrightpage} is applied on right page.
1370 % They can be useful if the position of the line number is depending on the position of the page, but the position of the marginal note is fixed.
1371 % \subsection{Adding annotations to line numbers}\label{annotation}
1372 % You may want to have two or more numbers associated with a line of text.
1373 % Consider, for example, the following cases:
1374 % \begin{itemize}
1375 % \item You want to split a line of verse into two parts depending upon some stylistic / rhythmic / linguistic convention.
1376 % \item You want to add the line number used by a previous edition of the work.
1377 % \item You want to typeset biblical text, and use division in verse.
1378 % \end{itemize}
1379 % In such instances, you must add the second number manually, as \macpackage\ can't determine a general pattern for such numbering, which depends too heavily upon the edited text.\footnote{However, you may create your own commands dealing with such patterns which will in turn call \macpackage\ commands.}
1380 %
1381 % \DescribeMacro{\linenumannotation}
1382 % To resolve this issue, \macpackage\ allows you to annotate line numbers using the following command:
1383 % \begin{verbatim}
1384 % \linenumannotation{<annotation>}
1385 % \end{verbatim}
1386 %
1387 % The annotation can contain any textual value (whether number, text, or other) such as the line number from the older edition.
1388 % Here are some characteristics of line number annotation:
1389 % \begin{itemize}
1390 % \item An annotation is associated with a line of text. It is reset with each new line of text, unless you use the \option{noresetlinenumannotation} option of \macpackage.
1391 % \item It is printed alongside the line number in the margin.
1392 % \item It is printed following the line number in critical footnotes and endnotes.
1393 % \item And of particular interest: the annotation is printed in the critical note \emph{only} when the \cs{edtext} is issued after the \cs{linenumannotation}.
1394 % \item If two or more annotations are called before an \cs{edtext}, the last one is used in associated notes.
1395 % \item If an annotation is called within an \cs{edtext}, it is printed as an annotation for the end of the lemma.
1396 % \end{itemize}
1397 % Here is an example, supposing we are on line 1:
1398 % \begin{verbatim}
1399 % \edtext{first lemma}
1400 % \linenumannotation{A}
1401 % \edtext{second lemma}{...}
1402 % \edtext{third%
1403 % \linenumannotation{B}
1404 % lemma}{...}
1405 % \edtext{fourth lemma}&
1406 % \end{verbatim}
1407 % In the critical notes, the line number will be followed
1408 % \begin{itemize}
1409 % \item by nothing in the first lemma, as there is no annotation for this line;
1410 % \item by \enquote{A} for the second lemma;
1411 % \item by \enquote{A-B} for the third lemma, as it starts while annotation A is still in effect and it finishes after annotation B has already taken effect;
1412 % \item by \enquote{B} for the fourth lemma.
1413 % \end{itemize}
1414 %
1415 % Note that the annotation must be called before the beginning of a \cs{edtext} to be taken into account as a starting annotation. So:
1416 % \begin{verbatim}
1417 % \linenumannotation{A}\edtext{something...\linenumannotation{B}}{\Afootnote{foo}}
1418 % \end{verbatim}
1419 % will use \verb+A+ as starting annotation, while:
1420 % \begin{verbatim}
1421 % \edtext{\linenumannotation{A}something...\linenumannotation{B}}{\Afootnote{foo}}
1422 % \end{verbatim}
1423 % won't.
1424 % \subsubsection{Resetting annotation}
1425 % You can manually reset annotation using \cs{resetlinenumannotation}\verb+{}+. Note that this macro takes no argument, but you should use empty brackets or \textbackslash in order to avoid gobbling spaces.\footnote{As for all \TeX\ macro with no argument.}
1426 % \subsubsection{Modifying annotation associated with a specific note}\label{lineannot}
1427 %
1428 % The \cs{linenum} (\reff{linenum}) macro changes the line number passed to a note.
1429 % \DescribeMacro{\lineannot}The \cs{lineannot} macro does the same for the annotations.
1430 % It takes one argument, containing the beginning and ending annotations separated by a pipe (\verb+|+).
1431 % As with \cs{linenum}, if one wishes to change some specific part of the annotation, one can use
1432 % \begin{verbatim}
1433 % \lineannot{|b}% to change the ending annotation
1434 % \lineannot{a|}% to change the beginning annotation
1435 % \lineannot{a|b}% to change both
1436 % \lineannot{\empty|}% to delete the beginning annotation
1437 % \end{verbatim}
1438 % \subsubsection{Changing the position of the annotation}\label{annotationposition}
1439 % By default, annotations are placed after line numbers in both margin and footnote.
1440 %
1441 % \DescribeMacro{\Xlinenumannotationposition}
1442 % \DescribeMacro{\Xlinenumannotationpositionside}
1443 % \DescribeMacro{\Xendlinenumannotationposition}
1444 % To change this behavior, one can use one of the following commands:
1445 % \begin{itemize}
1446 % \item \cs{Xlinenumannotationposition}\oarg{s}\marg{v} changes the position in critical footnotes with \meta{s} for the series of footnotes to which it applies, where \meta{s} may be a comma-separated list of series. When \meta{s} is empty, the change applies also to annotations at the sides of the page, alongside the line number.
1447 % \item \cs{Xlinenumannotationpositionside}\marg{v} changes the position at the sides of the page, alongside the line numbers.
1448 %
1449 % Note that \cs{Xlinenumannotationposition} without any optional argument will override this setting.
1450 % \item \cs{Xendlinenumannotationposition}\oarg{s}\marg{v} changes the position in critical endnotes,
1451 % \meta{s} for the series of endnotes to which it applies, where \meta{s} may once again be a comma-separated list of series.
1452 % \end{itemize}
1453 % In each of these three commands, \meta{v} can be \option{after} or \option{before} to indicate position with regards to the line number.
1454 %
1455 % \DescribeMacro{\linenumannotationothersidetrue}
1456 % With the \cs{linenumannotationothersidetrue}, the annotation will appear on the margin side opposite to the line number.
1457 %
1458 % You can reset the default behavior with \cs{linenumannotationothersidefalse}.
1459 %
1460 % \subsubsection{Changing the macro in which annotations are wrapped}\label{wraplinenumannotation}
1461 % By default, annotations are wrapped in the \cs{textsuperscript} macro.
1462 % You can modify this using one of the following:
1463 % \begin{itemize}
1464 % \item \cs{Xwraplinenumannotation}\oarg{s}\marg{cmd} for critical footnotes; \meta{s} indicates the series of notes to which it applies and may be a comma-separated list of series.
1465 % When \meta{s} is empty, the change applies to the annotations in the margins also---around the line number---as well as to the annotations referenced using the \cs{annotationref} command of the crossref mechanism (\reff{crossref}).
1466 % \item \cs{Xwraplinenumannotationside}\marg{cmd} for annotations in the margins only.
1467 %
1468 % Note that \cs{Xwraplinenumannotation} without any optional argument will override this setting.
1469 % \item \cs{Xwraplinenumannotationref}\marg{cmd} for annotations referenced using the \cs{annotationref} command of the crossref mechanism (\reff{crossref}).
1470 %
1471 % Note that \cs{Xwraplinenumannotation} without any optional argument will override this setting.
1472 % \item \cs{Xendwraplinenumannotation}\oarg{s}\marg{cmd} for critical endnotes, where \meta{s} indicates the series of notes to which it applies, which may be a comma-separated list.
1473 % \end{itemize}
1474 % \meta{cmd} is a command which can take one argument; the backslash is required though.
1475 %
1476 % For example, if you do not wish to have annotations in the margins, but do want to have them in bold in the critical footnotes and endnotes, you say:\footnote{The \cs{@gobble} command takes one argument, and returns nothing.}
1477 % \begin{verbatim}
1478 % \makeatletter
1479 % \Xwraplinenumannotation{\textbf}
1480 % \Xendwraplinenumannotation{\textbf}
1481 % \Xwraplinenumannotationside{\@gobble}
1482 % \makeatother
1483 % \end{verbatim}
1484 % \subsubsection{Not printing the second identical annotations}
1485 % If you print only line number annotation, you may get in critical notes something like \verb+6-6+,
1486 % because the starting and ending annotations are the same.
1487 % \DescribeMacro{\Xnoidenticallinenumannotation}
1488 % \DescribeMacro{\Xendnoidenticallinenumannotation}
1489 % You can avoid that using \\
1490 % \cs{Xnoidenticallinenumannotation}\oarg{s}, for critical footnotes \\
1491 % or
1492 % \cs{Xendnoidenticallinenumannotation}\oarg{s}
1493 % \subsubsection{Separator between annotations}
1494 % \DescribeMacro{\setlinenumannotationsep}
1495 % If there an more than one annotation in the same line, there are separated by a comma.
1496 % If you want to change the separator, you can use \\
1497 % \cs{setlinenumannotationsep}\marg{sep}
1498 % \subsubsection{Annotations in the apparatus}
1499 % Some other options for annotations in the apparatus are described in \reff{annotation-inapparatus}
1500 % \subsection{Executing code at each line}\label{linehook}
1501 % \Macpackage provides an advanced feature for users.
1502 % \DescribeMacro{\dolinehook}\DescribeMacro{\doinsidelinehook}
1503 % The argument passed to \protect\cs{dolinehook}\marg{arg} will be executed
1504 % before slicing a new line in the paragraph.
1505 % The argument passed to \protect\cs{doinsidelinehook}\marg{arg} will be executed before printing a new line, when the line number has already been fixed.
1506 % In many cases, the latter is more useful than the former.
1507 % The file \href{examples/2-line_numbers_in_header.tex}{examples/2-line\_numbers\_in\_header.tex} provides
1508 % an example for printing the first and last line numbers of a page in the header.
1509 %
1510 % \subsection{Executing code at a specific line}
1511 % Sometime, you want to execute a code at a precise point in the flow of your text.
1512 % For example, if the current header of the page corresponds to the position inside the text, you may want to use \cs{markboth} (or similar) command.
1513 % The main problem is that you need to execute \cs{markboth} when \macpackage\ typesets the text, and not when it reads it, because that could create damage with vertical spacing.
1514 %
1515 % \DescribeMacro{\doinsidethislinehook}
1516 % The \cs{doinsidethislinehook}\marg{code} macro allows \meta{code} to be executed when the text is typeset. The \meta{code} will be executed in the line equivalent to the position of \cs{doinsidethislinehook} in the flow of the text.
1517 %
1518 % For example, with the following code:
1519 % \begin{verbatim}
1520 % \beginnumbering
1521 % \pstart
1522 % ...
1523 % 1.\doinsidelinehook{\markboth{1}{1}} a
1524 % \pend
1525 % \end{verbatim}
1526 % \verb+\markboth{1}{1}+ will be executed at the line the \verb+1.+ will be typeset.
1527 % The \meta{code} of \cs{doinsidethislinehook} will be executed only at the second run of \LaTeX.
1528 %
1529 % See the file
1530 % \href{examples/2-subdivision-number-in-header.tex}{examples/2-subdivision-number-in-header.tex} for an example.
1531 % Especially, the use of this command with \LaTeX\ counters is quite complex, but the example show you how to deal with this problem.
1532 %
1533 % \section{Apparatus commands}
1534 %
1535 % \subsection{Terminology}
1536 % We call \enquote{critical notes} notes which refer to both a lemma, that is a part of text, and a line number.
1537 % Critical notes are subdivided in critical footnotes and critical endnotes.
1538 %
1539 % We call \enquote{familiar notes} notes which refer to a footnote mark in the main text.
1540 %
1541 % \Macpackage manages many series of notes of each category.
1542 % A series of notes is identified by an uppercase letter.
1543 % When the series letter is at the \emph{beginning} of a command name, it refers to a critical footnote.
1544 % When the series letter is at the \emph{end} of a command name, it refers to a familiar footnote.
1545 %
1546 % So:
1547 % \begin{itemize}
1548 % \item \protect\cs{Afootnote} is a critical footnote of the series A.
1549 % \item \protect\cs{Bendnote} is a critical endnote of the series B.
1550 % \item \protect\cs{footnoteC} is a familiar footnote of the series C.
1551 % \end{itemize}
1552 % \subsection{Critical notes}
1553 % \subsubsection{The lemma}
1554 % \DescribeMacro{\edtext}
1555 % Within numbered paragraphs, all footnotes and endnotes are generated
1556 % by the \protect\cs{edtext} macro:
1557 % \begin{verse}
1558 % \protect\cs{edtext}\marg{lemma}\marg{commands}
1559 % \end{verse}
1560 %
1561 %
1562 % The \meta{lemma} argument is the lemma in the main text: \protect\cs{edtext}
1563 % both prints this as part of the text, and makes it available to the
1564 % \meta{commands} you specify to generate notes.
1565 %
1566 % For example:
1567 % \egstart
1568 % \begin{verbatim}
1569 % I am happy:
1570 % I saw my friend \edtext{Smith}{
1571 % \Afootnote{Jones C, D.}}
1572 % on Tuesday.
1573 % \end{verbatim}
1574 % \egmid
1575 % \beginnumbering
1576 % \firstlinenum{1}
1577 % \linenumincrement{1}
1578 % \pstart
1579 % I am happy: I saw my friend \edtext{Smith}{
1580 % \Afootnote{Jones C, D.}}
1581 % on Tuesday.
1582 % \pend
1583 % \endnumbering
1584 % \egend
1585 %
1586 % The lemma \verb?Smith? is printed as part of this sentence in
1587 % the text, and is also made available to the footnote
1588 % that specifies a variant, \verb?Jones C, D?. The footnote macro
1589 % is supplied with the line number at which the lemma appears
1590 % in the main text.
1591 %
1592 % The \meta{lemma} may contain further \protect\cs{edtext} commands.
1593 % Nesting makes
1594 % it possible to print an explanatory note on a long passage together with
1595 % notes on variants for individual words within the passage. For
1596 % example:
1597 % \egstart
1598 % \begin{verbatim}
1599 % I am happy: \edtext{I saw my friend
1600 % \edtext{Smith}{\Afootnote{Jones
1601 % C, D.}} on Tuesday.}{
1602 % \Bfootnote{The date was
1603 % July 16, 1954.}
1604 % }
1605 % \end{verbatim}
1606 % \egmid
1607 % \beginnumbering
1608 % \firstlinenum{1}
1609 % \linenumincrement{1}
1610 % \pstart
1611 % I am happy: \edtext{I saw my friend
1612 % \edtext{Smith}{\Afootnote{Jones
1613 % C, D.}} on Tuesday.}{
1614 % \Bfootnote{The date was
1615 % July 16, 1954.}
1616 % }
1617 % \pend
1618 % \endnumbering
1619 % \egend
1620 %
1621 % However, \protect\cs{edtext} cannot handle overlapping but unnested
1622 % notes---for example, one note covering lines 10--15, and another
1623 % covering 12--18; an \protect\cs{edtext} that starts in the \meta{lemma}
1624 % argument of another \protect\cs{edtext} must end there, too. (The
1625 % \protect\cs{lemma} and \protect\cs{linenum} commands may be used to
1626 % generate overlapping notes if necessary.)
1627 %
1628 % \subsubsection{Footnotes}
1629 %
1630 % The second argument of the \protect\cs{edtext} macro, \meta{commands},
1631 % may contain a series of subsidiary commands that generate
1632 % various kinds of notes.
1633 %
1634 % \DescribeMacro{\Afootnote}
1635 % \DescribeMacro{\Bfootnote}
1636 % \DescribeMacro{\Cfootnote}
1637 % \DescribeMacro{\Dfootnote}
1638 % \DescribeMacro{\Efootnote}
1639 % Five separate series of footnotes are maintained; each macro
1640 % takes one argument like \protect\cs{Afootnote}\marg{text}.
1641 % When all of the five
1642 % are used, the \texttt{A} notes appear in a layer just below the main
1643 % text, followed by the rest in turn, down to the \texttt{E} notes at
1644 % the bottom.
1645 % These are the main macros that you will use to construct
1646 % the critical apparatus of your text.
1647 %
1648 % If you need more series of critical notes, please look at \reff{newseries}.
1649 %
1650 %\changes{v1.0.0}{2012/09/15}{Options nonum and nosep in \protect\cs{Xfootnote}.}
1651 %\changes{v1.20.0}{2015/03/22}{Options fulllines in \protect\cs{Xfootnote}.}\label{Xfootnoteopt}
1652 % An optional argument can be added before the text of the footnote. Its value is a comma-separated list of options.
1653 % \label{fulllines}The available options are:
1654 % \begin{itemize}
1655 % \item \verb|fulllines| to disable \protect\cs{Xtwolines} and \protect\cs{Xmorethantwolines} features for this note (cf. \reff{Xtwolines}).
1656 % \item \verb|nonum| disables line numbering for this note. A horizontal blank space is added instead. You can use \cs{Xinplaceofnumber} to set it (\reff{Xinplaceofnumber}).
1657 % \item \verb|nosep| to disable the lemma separator for this note. A horizontal blank space is added instead. You can use \cs{Xinplaceoflemmaseparator} to set it (\reff{Xinplaceoflemmaseparator}).
1658 % \item \verb|linerangesep=|\meta{c} to change to \meta{c} the separator between start line and end line for this particular note.
1659 % \end{itemize}
1660 %
1661 % Example: \protect\cs{Afootnote}\verb|[nonum]|\marg{text}.
1662 %
1663 % \subsubsection{Endnotes}
1664 % \paragraph{Inserting endnotes}
1665 % \DescribeMacro{\Aendnote}
1666 % \DescribeMacro{\Bendnote}
1667 % \DescribeMacro{\Cendnote}
1668 % \DescribeMacro{\Dendnote}
1669 % \DescribeMacro{\Eendnote}
1670 % The package also maintains five separate series of endnotes.
1671 %
1672 % If you do not need the endnotes facility, you should use \verb+noend+ option when loading \macpackage.
1673 %
1674 % The mechanism is similar to the one for footnotes: each macro takes one or more optional arguments and one single argument, like:\\
1675 % \protect\cs{Aendnote}\oarg{option}\marg{text}.
1676 %
1677 % \label{Xendnoteopt}\meta{option} can contain a comma-separated list of values. Allowed values are:
1678 % \begin{itemize}
1679 % \item \verb|fulllines| to disable \protect\cs{Xendtwolines} and \protect\cs{Xendmorethantwolines} features for this particular note (cf. \reff{Xtwolines}).
1680 % \item \verb+nonum+ to disable line number for this particular note.
1681 % \item \verb|nosep| to disable the lemma separator for this particular note. A horizontal blank space is added instead. You can use \cs{Xendinplaceoflemmaseparator} to set it (\reff{Xendinplaceoflemmaseparator}).
1682 % \item \verb|linerangesep=|\meta{c} to change to \meta{c} the separator between start line and end line for this particular note.
1683 % \end{itemize}
1684 %
1685 %
1686 % \paragraph{Printing endnotes}
1687 % \DescribeMacro{\doendnotes}\label{doendnotes} Normally, endnotes are not printed: you must use the
1688 % \protect\cs{doendnotes}\marg{s}, where \meta{s} is the letter of the series to be printed. Put this command where you want the corresponding set of endnotes printed.
1689 % In this case, all the endnotes of the \meta{s} series are printed, for all numbered sections.
1690 % \changes{v1.22.0}{2015/04/25}{Add \protect\cs{doendnotesbysection} command.}
1691 % \changes{v1.22.0}{2015/04/25}{Standardize endnotes handbook.}
1692 %
1693 % \DescribeMacro{\doendnotesbysection} However, you may want to print the endnotes of one given series covering the first numbered section, then the endnotes of another given series covering the first numbered section, then the endnotes of the first given series covering the second numbered section, then the endnotes of the second given series covering the second numbered section, and so forth.
1694 % In this case, use \protect\cs{doendnotesbysection}\marg{s}.
1695 % For each value of \meta{s}, the first call of the command will print the notes for the first series, the second call will print the notes for the second series etc.
1696 % For example, do:
1697 % \begin{verbatim}
1698 % \section{Endnotes}
1699 % \subsection{First text}
1700 % \doendnotesbysection{A}
1701 % \doendnotesbysection{B}
1702 % \subsection{Second text}
1703 % \doendnotesbysection{A}
1704 % \doendnotesbysection{B}
1705 % \end{verbatim}
1706 %
1707 % Note that by default inside endnotes no separator is used between the lemma and the content.
1708 % However you can use the \protect\cs{Xendlemmaseparator} macro to define one (\reff{Xendlemmaseparator}).
1709 %
1710 % As endnotes may be printed at any point in the document they always
1711 % start with the page number where they are called.
1712 %
1713 % \paragraph{Code between endnotes}
1714 % \DescribeMacro{\toendnotes}
1715 % \DescribeMacro{\Xtoendnotes}
1716 % Sometimes, it is useful to insert content between endnotes of the same series: for example to separate endnotes of different sections of the same text.
1717 % In this case, you could use \emph{inside
1718 % numbered text} the command:\\
1719 % \cs{toendnotes}\oarg{series}\marg{content}
1720 % where \meta{series} is a comma-separated list of the series of endnotes where \meta{content} must be inserted.
1721 % If \meta{series} is empty, then \meta{content} is inserted to all the series.
1722 %
1723 % For example:
1724 % \begin{verbatim}
1725 % \toendnotes{\section{Section's title}}
1726 % \end{verbatim}
1727 %
1728 % Alternatively, you can use \cs{Xtoendnotes}\marg{content}, where \enquote{X} must be replaced by a series letter.
1729 %
1730 % Remember that the endnotes are temporarily stored in an auxiliary file. That means in general you want to write the \meta{content} in the auxiliary file \emph{without expanding it}, that is without interpreting \TeX\ content.
1731 %
1732 % However, in some cases, you may want to write a
1733 % once-expanded\footnote{The expansion mechanism of \TeX\ is a quite complex problem, but fundamental. We have no place to explain it fully here. Read introduction to \TeX\ to understand well.}
1734 % version of the \meta{content}, that is the version where the commands are expanded on the first level.
1735 % This can be, for example, to get a counter value.
1736 % Use the starred version in this case.
1737 % For example:
1738 % \begin{verbatim}
1739 % \Atoendnotes*{\string\section{Letter 1 (chap. \thechapter)}}
1740 % \end{verbatim}
1741 %
1742 % \subsubsection{Paragraph in critical apparatus}
1743 % By default, no paragraph can be made in the notes of the critical apparatus.
1744 % You can allow it by adding the options \verb+parapparatus+ when loading the package:
1745 % \begin{verbatim}
1746 % \usepackage[parapparatus]{eledmac}
1747 % \end{verbatim}
1748 %
1749 % Note that you \emph{cannot} use paragraphs (e.g. blank lines or \cs{par}) inside of notes, when they are set to \texttt{paragraph} arrangement!
1750 %
1751 % \subsubsection{Change lemma and line number}
1752 % \DescribeMacro{\lemma}
1753 % \changes{v1.0.0}{2012/09/15}{\protect\cs{lemma} can contain commands.}
1754 % If you want to change the lemma that gets passed to the notes, you
1755 % can do this by using \protect\cs{lemma}\marg{alternative} within the
1756 % second argument to \protect\cs{edtext} and before the note commands.
1757 % The most common use of this command is to abbreviate the lemma that's
1758 % printed in the notes. For example:
1759 % \egstart
1760 % \begin{verbatim}
1761 % I am happy:
1762 % \edtext{I saw my friend
1763 % \edtext{Smith}{\Afootnote{Jones
1764 % C, D.}} on Tuesday.}
1765 % {\lemma{I \dots\ Tuesday.}
1766 % \Bfootnote{The date was
1767 % July 16, 1954.}
1768 % }
1769 % \end{verbatim}
1770 % \egmid
1771 % \beginnumbering
1772 % \pstart
1773 % I am happy:
1774 % \edtext{I saw my friend
1775 % \edtext{Smith}{\Afootnote{Jones
1776 % C, D.}} on Tuesday.}
1777 % {\lemma{I \dots\ Tuesday.}
1778 % \Bfootnote{The date was
1779 % July 16, 1954.}
1780 % }
1781 % \pend
1782 % \endnumbering
1783 % \egend
1784 %
1785 % \DescribeMacro{\linenum}
1786 % \label{linenum}
1787 % You can use \protect\cs{linenum}\marg{arg} to change the line numbers passed to
1788 % the notes. \meta{arg} actually consist of seven parameters: the page,
1789 % line, and sub-line number for the start of the lemma; the same
1790 % three numbers for the end of the lemma; and the font specifier
1791 % for the lemma. As the argument to \protect\cs{linenum}, you specify
1792 % those seven parameters in that order, separated by vertical bars
1793 % (the \verb"|" character). I.e.\\
1794 % \verb+\linenum{+\meta{start page}\verb+|+\meta{s. line}\verb+|+\meta{s. sub-l.}\verb+|+\meta{end p.}\verb+|+\meta{e. l.}\verb+|+\meta{e. sub-l.}\verb+|+\meta{font}\verb+|+\verb+}+\\
1795 % However, you can retain the value
1796 % computed by \macpackage for any number by simply omitting it; and
1797 % you can omit a sequence of vertical bars at the end of the
1798 % argument. For example, \verb"\linenum{|||23}" changes only the ending page number of the current lemma.
1799 %
1800 % This command does not change the marginal line numbers in any way;
1801 % it just changes the numbers passed to the notes. Its use comes in
1802 % situations that \protect\cs{edtext} has trouble dealing with for
1803 % whatever reason. If you need notes for overlapping passages that
1804 % aren't nested, for instance, you can use \protect\cs{lemma} and
1805 % \protect\cs{linenum} to generate such notes despite the limitations of
1806 % \protect\cs{edtext}. If the \meta{lemma} argument to \protect\cs{edtext} is
1807 % extremely long, you may run out of memory; here again you can
1808 % specify a note with an abbreviated lemma using \protect\cs{lemma} and
1809 % \protect\cs{linenum}. The numbers used in \protect\cs{linenum} need not be
1810 % entered manually; you can use the \enquote{\texttt{x-}} symbolic cross-referencing
1811 % commands below (\reff{crossref}) to compute them
1812 % automatically.
1813 %
1814 % Similarly, being able to manually change the lemma's font specifier
1815 % in the notes might be important if you were using multiple scripts or
1816 % languages. The form of the font specifier is three
1817 % separate codes separated by \verb"/" characters, giving the family,
1818 % series, and shape codes as defined within NFSS.
1819 %
1820 % \subsubsection{Changing the names of commands for critical apparatus}
1821 %
1822 % The commands for generating the apparatus have been given
1823 % rather bland names, because editors in different fields have
1824 % widely divergent notions of what sort of notes are required, where
1825 % they should be printed, and what they should be called. But this
1826 % does not mean you have to type \protect\cs{Afootnote} when you would rather
1827 % type something you find more meaningful, like \protect\cs{variant}.
1828 %
1829 % We recommend that you create a series of such aliases and use them
1830 % instead of the names chosen here; all you have to do is put commands
1831 % of this form at the start of your file:\footnote{We use \protect\cs{newcommand} and \protect\cs{newcommandx} instead of classical \protect\cs{let} command because the edtabular environments have to modify the notes definition, and we need to use the newest definition of notes. Read the handbook of \protect\package{xargs} to know more about \protect\cs{newcommandx}.}
1832 % \begin{verbatim}
1833 % \newcommandx{\variant}[2][1,usedefault]{\Afootnote[#1]{#2}}
1834 % \newcommandx{\explanatory}[2][1,usedefault]{\Bfootnote[#1]{#2}}
1835 % \newcommand{\trivial}[1]{\Aendnote{#1}}
1836 % \newcommandx{\testimonia}[2][1,usedefault]{\Cfootnote[#1]{#2}}
1837 % \end{verbatim}
1838 %
1839 %
1840 % \subsection{Disambiguation of identical words in the apparatus}\label{sameword}
1841 % \changes{v1.15.0}{2015/01/12}{New tools to prevent ambiguous references in lemma}
1842 % \changes{v1.23.0}{2015/05/18}{Fix a bug with \protect\cs{sameword} when the same lemma is used for multiple notes or for nested \protect\cs{edtext}s.}
1843 % \changes{v1.23.0}{2015/05/18}{Optional argument of \protect\cs{sameword} can be a comma-separated list of \protect\cs{edtext} depth.}
1844 % \changes{v1.23.0}{2015/05/18}{Fix a bug with \protect\cs{sameword} when the lemma overlaps multiple line.}
1845 % Sometimes, the same word occurs twice (or more) in the same line.
1846 % \Macpackage provides tools to disambiguate references in the critical notes.
1847 % The lemma will be followed by a reference number if a given word occurs more that once in the same line.
1848 %
1849 % \subsubsection{Basic use}
1850 % \DescribeMacro{\sameword} To use this tool, you have to mark every occurrence of the potentially ambiguous term with the \protect\cs{sameword} command:
1851 % \begin{verbatim}
1852 % Lupus \sameword{aut} canis \edtext{\sameword{aut}}{\Afootnote{et}} felix
1853 % \end{verbatim}
1854 % In this example, \verb+aut+ will be followed, in the critical note, by the exponent \verb+2+ if it is printed in the same line as the first \verb+aut+, but it will not if it is printed in a different line. The number is printed only after the second run.
1855 %
1856 % \subsubsection{Case setting}
1857 % By default, \cs{sameword} is sensitive to the case. E.g. \enquote{foo} is considered as a different word to \enquote{Foo}.
1858 %
1859 % You can use the \option{swcaseinsensitive} when loading the package to make \cs{sameword} insensitive to the case, i.e.
1860 % to consider \enquote{foo} as identical \enquote{Foo}.
1861 %
1862 % \subsubsection{Notes about input encoding with UTF-8 processor}
1863 %
1864 % If you use UTF-8 processor, like \XeLaTeX\ or \LuaLaTeX, there should not be any glitches.
1865 % However, pay attention to how characters are encoded. Similar-looking characters may be represented differently in unicode numbering.
1866 %
1867 % For instance, in French, \enquote{é} has two possible Unicode codepoints:
1868 % \begin{itemize}
1869 % \item LATIN SMALL LETTER E (U+0065) + COMBINING ACUTE ACCENT (U+0301)
1870 % \item LATIN SMALL LETTER E WITH ACUTE (U+00E9)
1871 % \end{itemize}
1872 %
1873 % Which unicode number you use depends, many times, on your keyboard configuration (the computer-input system).
1874 %
1875 % Inside \macpackage, the \protect\cs{sameword} command considers these two unicodes (code positions) as different characters. If you use only one unicode number consistently, the distinction will probably make no difference to how your text looks, but \protect\cs{sameword} will process the text inaccurately, based on the unicode numbers. To prevent this, do the following:
1876 % \begin{itemize}
1877 % \item If you use \XeLaTeX, add this line in your preamble:\verb+ \XeTeXinputnormalization 1+.
1878 % \item If you use \LuaLaTeX, use the \protect\package{uninormalize} package of Michal Hoftich\footnote{\url{https://github.com/michal-h21/uninormalize}.} with the \verb+buffer+ option set to true.
1879 % \end{itemize}
1880 %
1881 % With these tools, \XeTeX\ / \LuaTeX\ will dynamicaly normalize unicode input when reading the file.
1882 % Consequently, you will have no problems with the \protect\cs{sameword} command.
1883 % \subsubsection{Notes about right-to-left texts}
1884 % Due to some internal limits of \XeTeX, \cs{sameword} does not work with right-to-left text with this engine.
1885 %
1886 % If you need to use \cs{sameword} with right-to-left text, you must use \LuaTeX.
1887 % \subsubsection{Use with \protect\cs{lemma} command}
1888 % If you use the \protect\cs{lemma} command, \macpackage\ cannot know to which occurence of \cs{sameword} in the first argument of \cs{edtext} a word marked with \cs{sameword} in \cs{lemma} should refer.
1889 %
1890 % For example, in the following example:
1891 % \begin{verbatim}
1892 % some thing
1893 % \edtext{\sameword{sw}
1894 % and other \sameword{sw}
1895 % and again \sameword{sw}
1896 % it is all}%
1897 % {\lemma{\sameword{sw} \ldots all}\Afootnote{critical note}}.%
1898 % \end{verbatim}
1899 % \Macpackage\ cannot know if the \enquote{sw} in \protect\cs{lemma} refers to the word after \enquote{thing}, after \enquote{other}, or after \enquote{again}.
1900 %
1901 % Consequently, you must tell \macpackage to which instance of \protect\cs{sameword} you are referring in the first argument of \protect\cs{edtext}:
1902 % \begin{itemize}
1903 % \item In the content of \protect\cs{lemma}, use \protect\cs{sameword} with no optional argument.
1904 % \item In the first argument of \protect\cs{edtext}, use \protect\cs{sameword} with the optional argument \oarg{X}. \meta{X} is the depth of the \protect\cs{edtext} where the \protect\cs{lemma} is used.
1905 % So if the \protect\cs{lemma} is called in a \protect\cs{edtext} inside another \protect\cs{edtext}, \meta{X} is equal to \verb+2+.
1906 % If the \protect\cs{lemma} is called in a \protect\cs{edtext} \enquote{of first level}, \meta{X} is equal to \verb|1|. If the lemma is called in both 1 and 2 \protect\cs{edtext} depth, \meta{X} is \verb+1,2+. If that word is referenced in the lemma of every \protect\cs{edtext} depth, \meta{X} can also be set to \verb+inlemma+.
1907 % \end{itemize}
1908 % Note that only words that are actually referenced in a \protect\cs{lemma} need the optional argument. Therefore, the first \protect\cs{sameword} in the example above should have \enquote{1} as its optional argument, to be referenced correctly in the lemma.
1909 %
1910 % Note also that the \meta{X} does not refer to the level where the \protect\cs{sameword} occurs, but to the level of the \protect\cs{lemma} that refers to that \protect\cs{sameword}. For example:
1911 % \begin{verbatim}
1912 % \edtext{some \edtext{\sameword[1]{word}}{\Afootnote{om. M}}
1913 % and other \sameword{word}
1914 % and again a \sameword{word}
1915 % it is all}%
1916 % }{\lemma{some \sameword{word} \ldots all}\Afootnote{critical note}}.%
1917 % \end{verbatim}
1918 % Here the \protect\cs{sameword} occurs in an \protect\cs{edtext} of level 2,
1919 % but since it is referenced by \protect\cs{lemma} on level 1, it has \enquote{1} in the optional argument.
1920 %
1921 % In the following example figure, each framed box represents an \protect\cs{edtext} level.
1922 % Each number is an occurrence of \protect\cs{sameword}. After a framed box,
1923 % the text in superscript represents the content of \protect\cs{lemma} for that \protect\cs{edtext} level.
1924 % The text in subscript at the right of a number represents the content of the optional argument of \protect\cs{sameword}.
1925 %
1926 %\fbox{%
1927 % \fbox{%
1928 % $1_{\mathrm{inlemma}}$
1929 % \fbox{$2$}
1930 % $3_2$%
1931 % }\textsuperscript{$1$\ldots$3$}%
1932 % 4
1933 % $5_1$
1934 % }\textsuperscript{1\ldots5}
1935 %
1936 % The \protect\cs{sameword} number~3 is called in a \protect\cs{lemma} related to an \protect\cs{edtext} of level~2.
1937 % It must be marked by \enquote{2}.
1938 %
1939 % The \protect\cs{sameword} number~5 is called in a \protect\cs{lemma} related to \protect\cs{edtext} of level~1. It must be marked by \enquote{1}.
1940 %
1941 % The \protect\cs{sameword} number~1 is called in two \protect\cs{lemma}s: one related to a \protect\cs{edtext} of level~1, the other related to \protect\cs{edtext} of level~2.
1942 % It must be marked by \enquote{1,2}.
1943 % However, as \protect\cs{lemma} is called only in level~1 and~2, \enquote{1,2} could replaced by \enquote{inlemma}.
1944 %
1945 % The \protect\cs{sameword} number~2 is in the first argument of a \protect\cs{edtext} of level~3, but it has no \protect\cs{lemma}-command, so there is no need to mark it.
1946 %
1947 % Here, the corresponding code:
1948 % \egstart
1949 % \begin{verbatim}
1950 %\edtext{%
1951 % \edtext{%
1952 % \sameword[inlemma]{A} (1)
1953 % \edtext{%
1954 % \sameword{A} (2)
1955 % }%
1956 % {%
1957 % \Afootnote{level~3}%
1958 % }%
1959 % \sameword[2]{A} (3)
1960 % }%
1961 % {%
1962 % \lemma{%
1963 % \sameword{A}%
1964 % \ldots%
1965 % \sameword{A}%
1966 % }%
1967 % \Afootnote{level~2}%
1968 % }%
1969 % \sameword{A} (4)
1970 % \sameword[1]{A} (5)
1971 %}%
1972 %{%
1973 % \lemma{\sameword{A}\ldots\sameword{A}}%
1974 % \Afootnote{level~1}%
1975 %}
1976 % \end{verbatim}
1977 % \egmid
1978 % \beginnumbering
1979 % \firstlinenum{1}
1980 % \linenumincrement{1}
1981 % \pstart
1982 %\edtext{%
1983 % \edtext{%
1984 % \sameword[inlemma]{A} (1)
1985 % \edtext{%
1986 % \sameword{A} (2)
1987 % }%
1988 % {%
1989 % \Afootnote{level~3}%
1990 % }%
1991 % \sameword[2]{A} (3)
1992 % }%
1993 % {%
1994 % \lemma{\sameword{A}\ldots\sameword{A}}%
1995 % \Afootnote{level~2}%
1996 % }%
1997 % \sameword{A} (4)
1998 % \sameword[1]{A} (5)
1999 %}%
2000 %{%
2001 % \lemma{\sameword{A}\ldots\sameword{A}}%
2002 % \Afootnote{level~1}%
2003 %}
2004 % \pend
2005 % \endnumbering
2006 % \egend
2007 %
2008 % \subsubsection{Sameword for a group of words}
2009 % Sometimes a group of words and not only a single word, occurs multiple times.
2010 % In this case, you have two possibilities.
2011 %
2012 % First, you can consider only the individual words, and not groups of word.
2013 % For example:
2014 % \begin{verbatim}
2015 %\sameword{per} \sameword{causam}
2016 %tamen scire
2017 %\edtext{\sameword{causam}}{\Bfootnote{fnote}}
2018 %est
2019 %\edtext{\sameword{per} \sameword{causam}}{\Bfootnote{causam rei B}}
2020 %cognoscere
2021 %\edtext{\sameword{causam}}{\Bfootnote{fnote}}
2022 % \end{verbatim}
2023 % \begin{ledgroup}
2024 % \beginnumbering
2025 % \pstart
2026 %\sameword{per} \sameword{causam}
2027 %tamen scire
2028 %\edtext{\sameword{causam}}{\Bfootnote{fnote}}
2029 %est
2030 %\edtext{\sameword{per} \sameword{causam}}{\Bfootnote{causam rei B}}
2031 %cognoscere
2032 %\edtext{\sameword{causam}}{\Bfootnote{fnote}}
2033 % \pend
2034 % \endnumbering
2035 % \end{ledgroup}
2036 % In this case it is clear which \enquote{per causam} is meant.
2037 %
2038 % However, in the case that \enquote{per causam} is the lemma of the second note, there should be only one number for that whole lemma.
2039 % In this case we can mark all \enquote{per causam} groups.
2040 % But as \enquote{causam} is also called as lemma in note~1 and ~3, we need to use nested \cs{sameword} commands.
2041 % Consequently, we need to use \cs{lemma} for the \cs{edtext} linked to \enquote{per causam}, as we don't want to number each individual word.
2042 %
2043 % \begin{verbatim}
2044 %\sameword{per \sameword{causam}} tamen scire
2045 %\edtext{\sameword{causam}}{\Bfootnote{fnote}} est
2046 %\edtext{\sameword[1]{per \sameword{causam}}}{\lemma{\sameword{per causam}}\Bfootnote{causam rei B}} cognoscere
2047 %\edtext{\sameword{causam}}{\Bfootnote{fnote}}
2048 % \end{verbatim}
2049 % \begin{ledgroup}
2050 %\beginnumbering
2051 %\pstart
2052 %\sameword{per \sameword{causam}} tamen scire
2053 %\edtext{\sameword{causam}}{\Bfootnote{fnote}} est
2054 %\edtext{\sameword[1]{per \sameword{causam}}}%
2055 % {\lemma{\sameword{per causam}}\Bfootnote{causam rei B}}
2056 % cognoscere
2057 %\edtext{\sameword{causam}}{\Bfootnote{fnote}}
2058 %\pend
2059 %\endnumbering
2060 % \end{ledgroup}
2061 % \subsubsection{Customizing}
2062 % \DescribeMacro{\showwordrank}You can redefine the \protect\cs{showwordrank} macro to change the way the number is printed. The default value is
2063 % \begin{verbatim}
2064 %\newcommand{\showwordrank}[2]{%
2065 % #1\textsuperscript{#2}%
2066 %}
2067 % \end{verbatim}
2068 % \subsubsection{Problems with some macros}
2069 % \DescribeMacro{\swnoexpands}Macros inside \protect\cs{sameword} that are not fully expandable, mainly macros which manipulate font features, write on full or have optional argument, may cause problems during compilation. Custom commands inside \protect\cs{sameword} may therefore result in errors saying that \enquote{Use of \\sameword doesn't match its definition.} To solve this, include a redefinition of your custom commands in the \protect\cs{swnoexpands} macro.
2070 % In order to not include any content of a macro during comparison, identify the command with \protect\cs{@gobble} For example:
2071 % \begin{verbatim}
2072 %\makeatletter
2073 %\appto{\swnoexpands}{%
2074 % \let\somemacro\@gobble%
2075 %}
2076 %\makeatother
2077 % \end{verbatim}
2078 % This will drop the content of \protect\cs{somemacro} during comparison.
2079 %
2080 % To include the content of the first and only one argument of a custom command in sameword comparison, use the \protect\cs{@firstofone} command. For example, this is how \cs{emph} is handled:
2081 % \begin{verbatim}
2082 %\makeatletter
2083 % \appto{\swnoexpands}{%
2084 % \let\emph\@firstofone%
2085 %}
2086 %\makeatother
2087 % \end{verbatim}
2088 % To include command which can take optional argument, use \cs{RenewExpandableDocumentCommand} of \cs{xparse}. For example, this is how \cs{edindex} is handled:
2089 % \begin{verbatim}
2090 %\makeatletter
2091 % \appto{\swnoexpands}{%
2092 % \RenewExpandableDocumentCommand{\edindex}{om}{}%
2093 %}
2094 %\makeatother
2095 % \end{verbatim}
2096 % \subsubsection{Automatic sameword annotation}
2097 % All potentially ambiguous apparatus entries must be annotated manually. That
2098 % annotation process is laborious and includes a risk of errors.
2099 % \emph{Samewords} is a Python script that can automate this step of the
2100 % process. It can be installed via the \emph{Python Package Index}, but see
2101 % \url{https://github.com/stenskjaer/samewords}
2102 % for more info and documentation. The script is still at a beta stage, so
2103 % comments and questions as well as error reports are very welcome at
2104 % \url{https://github.com/stenskjaer/samewords/issues}.
2105 %
2106 % Please note that the maintainer of this script is not identical with the maintainer of \macpackage.
2107 %
2108 % \subsection{Apparatus of manuscripts}
2109 % The critical notes mostly refer to textual variants between manuscripts which contain the text to be edited.
2110 % It may so happen that the manuscripts only contain parts of the text.
2111 % Depending on one's wishes, \macpackage\ can generate lists of relevant manuscripts for any delimited portion of text.
2112 % Such lists are referred to as \enquote{apparatuses of manuscripts}.
2113 %
2114 % To produce an apparatus of manuscripts with \macpackage, you have to insert specific commands that are used to mark the sections for which only part of the manuscripts are relevant.
2115 % These commands will be processed, and \textbf{after the second \TeX{} run}, corresponding apparatuses of manuscripts will be inserted in the first (viz. 'A' series) level of footnotes.
2116 %
2117 % As the insertion of this apparatus can change the page breaks, you may have to run \TeX{} two or more times.
2118 % We strongly recommend to use tools like \emph{latexmk} to do that.
2119 %
2120 % \subsubsection{Marking sections of text}
2121 % \DescribeMacro{\msdata}
2122 % \cs{msdata}\marg{text} must be inserted at the point where a section for which only part of the manuscripts are relevant starts.
2123 % \meta{text} can be any arbitrary text, viz. a list of the manuscripts that are used for the section that starts.
2124 % The command must be attached right at the point where the section starts, with no space, like so:
2125 % \begin{verbatim}
2126 % \msdata{ABC}Lorem ipsum
2127 % \end{verbatim}
2128 % Which means that the section of text starting by \enquote{Lorem ipsum} is witnessed by manuscripts A, B and C.
2129 %
2130 % \DescribeMacro{\stopmsdata}
2131 % \cs{stopmsdata} must be inserted at the point where the section of text previously marked by \cs{msdata} ends.
2132 % The command must be attached right to the end of the section, with no space.
2133 % As \cs{stopmsdata} is a \LaTeX\ argumentless macro, it will gobble the following space.
2134 % To keep that space, you have to either append a backslash followed by a space or \verb+{}+ to \cs{stopmsdata}, like so:
2135 % \begin{verbatim}
2136 % \msdata{ABC}Lorem ipsum dolor
2137 % [...]
2138 % amet\stopmsdata{} \msdata{ABCD}sic transit [...]
2139 % \end{verbatim}
2140 % Which means that the part of text containing \enquote{Lorem ipsum dolor [...] amet} is witnessed by manuscripts A, B and C, while the part of text starting \enquote{sic transit} is witnessed by manuscripts A, B, C and D.
2141 %
2142 % \cs{stopmsdata} is also automatically inserted by \cs{msdata}.
2143 %
2144 % Note that in most cases, any \cs{stopmsdata} is followed by \cs{msdata}. However, as these two command are usually separated by a space, it may happen that a line break be automatically inserted between them.
2145 % This is why it is advised to always insert \cs{stopmsdata}, even if \cs{msdata} inserts it in case it is forgotten.
2146 %
2147 % \subsubsection{Layout of the apparatus of manuscripts}
2148 % On every page, the apparatus of manuscripts marks the corresponding section with starting and ending line numbers.
2149 % However, the following rules will be applied:
2150 % \begin{itemize}
2151 % \item If the section does not start on the current page, the starting line number will be the line number of the first line on the page.
2152 % \item If the section does not stop on the current page, the ending line number will be the line number of the last line on the page.
2153 % \item If the section neither starts nor ends on the current page, no line number will be printed. The same is true in case both \cs{msdata} is called at the very beginning of the page and \cs{endmsdata} is called at the very end of the page.
2154 % \end{itemize}
2155 % \subsubsection{Settings}
2156 % As the apparatus of manuscripts technically consists of first-level critical notes ('A' series), any setting available for critical notes can be applied (\reff{displayoptions}).
2157 % However, the following \emph{additional} commands are available.
2158 %
2159 % \DescribeMacro{\setmsdataseries}
2160 % The series used by default for the apparatus of manuscripts is series A.
2161 % However, you can change it with \cs{setmsdataseries}\marg{series}.
2162 %
2163 % \DescribeMacro{\setmsdatalabel}
2164 % As the apparatus of manuscripts consists of regular critical footnotes, a lemma is associated to them.
2165 % By default, it is \enquote{Ms.}.
2166 % You can change it using \cs{setmsdatalabel}\marg{txt}.
2167 %
2168 % \DescribeMacro{\setmsdataposition}
2169 % If you want the manuscript apparatus to be on the same level of critical footnotes as the other apparatuses, for each line, reledmac will first insert the manuscript apparatus, then the other footnotes.
2170 % You can change it using:\\
2171 % \cs{msdataposition}\arg{regular-msdata}\\
2172 % And restore the default behavior using
2173 % \cs{msdataposition}\arg{msdata-regular}
2174 % \subsection{Familiar notes} \label{sec:desc:familiar}
2175 %
2176 %
2177 % \subsubsection{Basic use}
2178 % \DescribeMacro{\footnoteA}
2179 % \DescribeMacro{\footnoteB}
2180 % \DescribeMacro{\footnoteC}
2181 % \DescribeMacro{\footnoteD}
2182 % \DescribeMacro{\footnoteE}
2183 % As well as the standard \LaTeX\ footnotes generated via \protect\cs{footnote},
2184 % the package also provides
2185 % five series of additional footnotes called \protect\cs{footnoteA} through
2186 % \protect\cs{footnoteE}. These have the familiar marker in the text, and
2187 % the marked text at the foot of the page can be formated using
2188 % any of the styles described for the critical footnotes. Note that
2189 % the \enquote{regular} footnotes have the series letter at the end of the macro
2190 % name whereas the critical footnotes have the series letter at the start
2191 % of the name.
2192 %
2193 % The footnote can take a first optional argument to manually define the footnote number or footnote symbol.
2194 % For example:
2195 % \begin{verbatim}
2196 % \footnoteA[22]{This footnote will be numbered 22}
2197 % \end{verbatim}
2198 % \subsubsection{Customizing mark}
2199 % \DescribeMacro{\thefootnoteA}
2200 % \DescribeMacro{\bodyfootmarkA}
2201 % \DescribeMacro{\footfootmarkA}
2202 % Each series uses a set of macros for
2203 % styling the marks. The mark numbering scheme of series A is defined by the
2204 % \protect\cs{thefootnoteA} macro; the default is: \\
2205 % \verb?\renewcommand*{\thefootnoteA}{\arabic{footnoteA}}?\\
2206 % The appearance of the mark in the text is controlled by \protect\cs{bodyfootmarkA}
2207 % which is defined as: \\
2208 % \verb?\newcommand*{\bodyfootmarkA}{%? \\
2209 % \verb? \hbox{\textsuperscript{\normalfont\@nameuse{@thefnmarkA}}}}? \\
2210 % The command \protect\cs{footfootmarkA} controls the appearance of the mark at the
2211 % start of the footnote text. It is defined as: \\
2212 % \verb?\newcommand*{\footfootmarkA}{\textsuperscript{\@nameuse{@thefnmarkA}}}?
2213 %
2214 % There are similar command triples for the other series.
2215 % \subsubsection{Separator for multiple footnotes}
2216 % The \protect\package{footmisc} package~\cite{FOOTMISC} by Robin
2217 % Fairbairns\index{Fairbairns, Robin} has an option whereby
2218 % sequential footnote
2219 % marks in the text can be separated by
2220 % commas\textsuperscript{3,4} like so.
2221 % As a convenience \reledmac\ provides this automatically.
2222 %
2223 % \DescribeMacro{\multfootsep}
2224 % \protect\cs{multfootsep} is used as the separator between footnote markers.
2225 % Its default definition is: \\
2226 % \verb?\providecommand*{\multfootsep}{\textsuperscript{\normalfont,}}? \\
2227 % and can be changed if necessary.
2228 %
2229 % \subsection{Printing the footnote mark without printing the footnote text}
2230 % \DescribeMacro{\footnoteXmark}
2231 % \DescribeMacro{\footnoteXtext}
2232 % In certain cases, you can't directly use \cs{footnoteX}; for example, when using\cs{uline} command of the \package{ulem} package. You need to print the footnote mark first, then call the footnote text to be inserted.
2233 %
2234 % For all \meta{X} command, \macpackage provides a \cs{footnote\meta{X}mark} command and a \cs{footnote\meta{X}text} command, equivalent to standard \LaTeX's command \cs{footnotemark} and \cs{footnotetext}.
2235 % For example, to use with \cs{uline}, do:
2236 % \begin{verbatim}
2237 % This is \uline{a test containing\mbox{\footnoteAmark}}\footnoteAtext{A
2238 % simple footnote.}\uline{ a simple footnote.}
2239 % \end{verbatim}
2240 %
2241 % If you use \parpackage, you can't use these two commands to print the footnote mark on one side and the footnote text on the other side.
2242 %
2243 % You must use \cs{footnote\meta{X}nomk} and \cs{footnote\meta{X}mk}, defined in \parpackage (\reff{reledpar-nomk})
2244 % \subsection{Changing series}
2245 % \subsubsection{Create a new series}\label{newseries}
2246 %
2247 % If you need more than five series of critical footnotes, you can
2248 % create extra series, using \protect\cs{newseries} command. For example, to create F and G series \protect\cs{newseries}\verb+{G,H}+.
2249 %
2250 % \subsubsection{Delete series}
2251 % As the number of series which are defined increases, \macpackage gets slower.
2252 % If you do not need all of the six standard series (A--E),
2253 % you can load the package with the \verb+series+ option.
2254 % For example, if you need only series~A and~B, use:
2255 % \begin{verbatim}
2256 % \usepackage[series={A,B}]{eledmac}
2257 % \end{verbatim}
2258 % \subsubsection{Series order}
2259 % The default series order is the one called with the \verb+series+ option of the package, or, if this option is not used, A, B, C, D, E.
2260 % Series order determines footnotes order.
2261 %
2262 % \DescribeMacro{\seriesatbegin}\DescribeMacro{\seriesatend} However in some specific cases, you need to change the series order at some point inside the document.
2263 % You can use \protect\cs{seriesatbegin}\marg{s} to pull up a given series \meta{s} to the beginning, or \protect\cs{seriesatend}\marg{s} to push it down to the end.
2264 % \subsection{Position of critical and familiar footnotes}
2265 % \DescribeMacro{\fnpos}\DescribeMacro{\mpfnpos}
2266 % There is a historical incoherence in \protect\package{(r)(e)ledmac}. The familiar footnotes are
2267 % before the critical footnotes in a normal page, but after in a minipage or in a ledgroup.
2268 % However, it is possible to change the relative position of both types of footnotes.
2269 % If you want to have familiar footnotes after critical footnotes in a normal page, use:
2270 % \begin{verbatim}
2271 % \fnpos{critical-familiar}
2272 % \end{verbatim}
2273 % Or, if you want a minipage or ledgroup to have critical footnotes after familiar footnotes, use:
2274 % \begin{verbatim}
2275 % \mpfnpos{familiar-critical}
2276 % \end{verbatim}
2277 %
2278 % You can also decide to alternate familiar and critical footnotes with your own order.
2279 % In this case, the second argument of \cs{fnpos} or \cs{mpfnpos} is a comma-separated list of values.
2280 % Each value has the following form:\\
2281 % \meta{series}\meta{type}
2282 %
2283 % \meta{series} is a series letter (A,B,C etc.), while \meta{type} must be either \enquote{critical} or \enquote{familiar}.
2284 %
2285 % For example, suppose you want to first print the familiar footnotes of the \enquote{A} series, then all the series of critical footnotes, and finally all the series of familiar footnotes, except the \enquote{A} series.
2286 % In this case, use the following command:
2287 % \begin{verbatim}
2288 %\fnpos{%
2289 % {A}{familiar},
2290 % {A}{critical},%
2291 % {B}{critical},%
2292 % {C}{critical},%
2293 % {D}{critical},%
2294 % {E}{critical},%
2295 % {B}{familiar},%
2296 % {C}{familiar},%
2297 % {D}{familiar},%
2298 % {E}{familiar}%
2299 %}
2300 % \end{verbatim}
2301 % Note that you must define the position of all the series of footnotes you use.
2302 % If you don't, you will have infinite runs of \LaTeX.
2303 %
2304 % \section{Apparatus customization}
2305 % \label{displayoptions}
2306 % \subsection{Introduction}
2307 % \changes{v1.0.0}{2012/09/15}{New generic commands to customize footnote display.}
2308 % Some commands can be used to change the way the footnotes are displayed.\footnote{In the code of \macpackage, these commands are called \enquote{hooks}.}
2309 % All can have an optional argument \oarg{s}, which is the letter of the series\,---\,or
2310 % a list of letters separated by comma\,---\,depending on which option is applied.
2311 % If the optional argument is omitted or empty, the setting will apply to the entire series.
2312 %
2313
2314 % When a length, noted \meta{l}, is used, it can be stretchable: \verb|a plus b minus c|. The final length |m| is calculated by \LaTeX{} to have: $a-c \leq m \leq a+b$. If you use some relative unit\footnote{Like \verb|em| which is the width of an \enquote{m} in a given font.}, it will be relative to font size of the footnote, except for commands concerning the place kept by the notes --- including blank space.
2315 %
2316 % Some commands are boolean, indicating when an option is enabled.
2317 % If you want to disable the option after enabling it, you must use \verb+[false+] as the second optional argument.
2318 % For example:
2319 % \begin{itemize}
2320 % \item \verb+\XX[A][false]+ to disable the \enquote{XX} option for the series A.
2321 % \item \verb+\XX[][false]+ to disable it for all series.
2322 %
2323 % \end{itemize}
2324 % There is also name convention:
2325 % \begin{itemize}
2326 % \item Names prefixed by \verb+X+ are for setting of critical footnotes.
2327 % \item Names prefixed by \verb+Xend+ are for setting of critical endnotes.
2328 % \item Names suffixed by \verb+X+ are for setting of familiar footnotes.
2329 % \end{itemize}
2330 %
2331 % \subsection{Notes arrangement in a series}\label{arrangement}
2332 %
2333 % \DescribeMacro{\Xarrangement}
2334 % \DescribeMacro{\arrangementX}
2335 % By default, all footnotes are formatted as a series of separate
2336 % paragraphs in one column. Three other formats are also
2337 % available for notes.
2338 %
2339 % Use \protect\cs{Xarrangement}\oarg{s}\marg{a} to change the arrangement of the \meta{s} series of critical footnotes and \protect\cs{arrangementX}\oarg{s}\marg{a} to change the arrangement of the \meta{s} series of familiar footnotes.
2340 %
2341 % The value of \meta{a} can be one of the following:
2342 % \begin{itemize}
2343 % \item \verb+paragraph+ formats
2344 % all of the footnotes of a series as a single paragraph; if you use this arrangement, you are strongly encouraged to read \reff{paragraphednotes:advanced}.
2345 % \item \verb+twocol+ formats them as separate paragraphs,
2346 % but in two columns;
2347 % \item \verb+threecol+, in three columns.
2348 % \item \verb+normal+, restore normal arrangement.
2349 % \end{itemize}
2350 %
2351 % You should set up the page layout parameters, and in particular the
2352 % \protect\cs{baselineskip} of the footnotes, before you call this
2353 % macro because its action depends on these;
2354 % too much or too little space will be allotted for the notes on
2355 % the page if these macros use the wrong
2356 % values.
2357 %
2358 % \label{nobreaks}Note that you \emph{cannot} use paragraphs (e.g. blank lines or
2359 % \cs{par}) or line breaks (\cs{break} or \cs{linebreak} or \cs{newline} etc.)
2360 % inside of notes, when they are
2361 % set to \texttt{paragraph} arrangement!
2362 %
2363 % The notes arrangement must be called after having defined the document geometry setting.
2364 % If you must change geometry setting inside your document, do not forget to call note arrangement again.
2365 %
2366 % \protect\cs{hsize} has been set for the pages that use
2367 % this series of notes; otherwise \TeX\ will try to put too
2368 % many or too few of these notes on each page. If you need to
2369 % change the \protect\cs{hsize} within the document, call
2370 % the arrangement macro again afterwards to take account of the new
2371 % value.
2372 % \subsection{Disabling footnote}
2373 % \DescribeMacro{Xnonote}\DescribeMacro{nonoteX}
2374 % Some time, you may want to export your edition without notes, but don't want to modify globally your code.
2375 %
2376 % \cs{Xnonote}\oarg{s} allow to disable critical notes for the series \meta{s}.
2377 %
2378 % \cs{nonoteX}\oarg{s} is the same for familiar notes.
2379 %
2380 % \subsection{Control number printing}
2381 % \subsubsection{Print line number only at first time}
2382 % \DescribeMacro{\Xnumberonlyfirstinline}\label{Xnumberonlyfirstinline}
2383 % \changes{v1.0.1}{2012/09/16}{Correction on \protect\cs{Xnumberonlyfirstinline} with lineation by pstart or by page.}
2384 % By default, the line number is printed inside every note. If you want to print it only the first time for a given line number
2385 % (i.e., once for line 1, once for line 2, etc.), you can use \protect\cs{Xnumberonlyfirstinline}\oarg{s}.
2386 %
2387 %
2388 % \changes{v1.1.0}{2012/09/25}{Add \protect\cs{Xnumberonlyfirstintwolines}}
2389 % \DescribeMacro{\Xnumberonlyfirstintwolines}\label{Xnumberonlyfirstintwolines}
2390 % Suppose you have a lemma on line~2 and a lemma that extends from line~2 into line~3.
2391 % With \protect\cs{Xnumberonlyfirstinline}, the second lemma is considered to be on the same line as the first lemma.
2392 % But if you use both \protect\cs{Xnumberonlyfirstinline}\oarg{s} and \protect\cs{Xnumberonlyfirstintwolines}\oarg{s}, a distinction is made.
2393 %
2394 %
2395 % \DescribeMacro{\Xsymlinenum}
2396 % For setting a particular symbol in place of the line number, you can use \protect\cs{Xsymlinenum}\oarg{s}\marg{symbol} in combination with \protect\cs{Xnumberonlyfirstinline}\oarg{s}. From the second lemma of the same line, the symbol will be used instead of the line number. Note that any command called in \meta{symbol} must be robust. Use \protect\cs{robustify} to robustify a non-robust command.
2397 %
2398 % \DescribeMacro{\Xendnumberonlyfirstinline}
2399 % \DescribeMacro{\Xendnumberonlyfirstintwolines}
2400 % \DescribeMacro{\Xendsymlinenum}
2401 % For endnotes, \cs{Xendnumberonlyfirstinline}; \cs{Xendnumberonlyfirstintwolines} and \cs{Xendsymlinenum} are the equivalents of
2402 % \\ \cs{Xnumberonlyfirstinline}; \cs{Xnumberonlyfirstintwolines} and \cs{Xsymlinenum}.
2403 %
2404 %
2405 % \subsubsection{Print page number only at first time}
2406 % For endnotes, \reledmac\ provides a mechanism for printing the page number only the first time it is seen.
2407 % However, when a lemma spans over two pages, the line numbers are normally printed in the following pattern: starting page number - starting line number - ending page number - ending line number.
2408 % It follows that what corresponds to the actual \enquote{page number} may not be self-evident. So:
2409 % \DescribeMacro{\Xendpagenumberonlyfirst} \cs{Xendpagenumberonlyfirst}\oarg{s} can be called to ensure that the starting page number of a lemma be not printed if it is the same as the ending page number of the preceding lemma.
2410 % You can use \emph{additionally} one (and only one) of the following commands:
2411 % \begin{itemize}
2412 % \item \cs{Xendpagenumberonlyfirstifsingle}\oarg{s}:
2413 % the first page number of the lemma will not be printed only if the following conditions are true:
2414 % \begin{enumerate}
2415 % \item The starting page number of the lemma is the same as the ending page number of the preceding lemma.
2416 % \item The ending page number of the lemma is the same as the starting page number of the lemma.
2417 % \end{enumerate}
2418 % In this case the ending page number will always be printed if it is different from the starting page number.
2419 % \item \cs{Xendpagenumberonlyfirstintwo}\oarg{s}: both the starting page number and the ending page number of a lemma are not printed if they are both the same as the starting page number and the ending page number of the preceding lemma respectively.
2420 %
2421 % \end{itemize}
2422
2423 %
2424 % In any case, you can use:
2425 % \begin{itemize}
2426 % \item \DescribeMacro{\Xendsympagenum} \cs{Xendsympagenum}\oarg{series}\marg{c} to print \meta{c} when the page number is not printed.
2427 % \item \DescribeMacro{\Xendinplaceofpagenumber} \cs{Xendinplaceofpagenumber}\oarg{series}\marg{l} to print a \meta{l} length horizontal space in case no symbol is printed instead of the page number.
2428 %
2429 % \end{itemize}
2430 %
2431 % \subsubsection{Arbitrary text before line number}
2432 % \paragraph{For critical notes}
2433 % \DescribeMacro{\Xtxtbeforenumber}
2434 % \cs{Xtxtbeforenumber}\oarg{s}\marg{txt} allows the insertion of \meta{txt} before the line number only when the line number is printed, so taking into account \cs{Xnumberonlyfirstinline} and the like.
2435 % \DescribeMacro{\Xbeforepagenumber}
2436 % \cs{Xbeforepagenumber}\oarg{s}\marg{txt} allows the insertion of \meta{txt} before the page number only when the page number is printed, so when a note spans across two or more pages and the lineation is by page.
2437 % \paragraph{For endnotes}\label{pagelineendnotes}
2438 % \DescribeMacro{\Xendbeforepagenumber}
2439 % \cs{Xendbeforepagenumber}\oarg{s}\marg{text} defines the text before the page number in endnotes. Default value is \verb+p.+ (\enquote{p} followed by a dot).
2440 %
2441 % \DescribeMacro{\Xendafterpagenumber}
2442 % \cs{Xendafterpagenumber}\oarg{s}\marg{text} defines the text after the page number in endnotes. Default value is \verb+) + (open parenthesis followed by a single space).
2443 % \DescribeMacro{\Xendlineprefixsingle}
2444 % \cs{Xendlineprefixsingle}\oarg{s}\marg{text} defines the text before the line number in endnotes when there is only one line. Default value is empty.
2445 % \DescribeMacro{\Xendlineprefixmore}
2446 % \cs{Xendlineprefixmore}\oarg{s}\marg{text} defines the text before the line number in endnotes when there is more than one line. Default value is empty. If you don't define it, it will use the value defined by \cs{Xendlineprefixsingle}.
2447 % \subsubsection{Separator for line range}\label{linerangeseparator}
2448 % \changes{v2.4.0}{2015/10/19}{New hooks: \protect\cs{Xlinerangeseparator} and \protect\cs{Xendlinerangeseparator}.}
2449 % \changes{v2.4.0}{2015/10/19}{Option linerangesep for critical footnotes and endnotes.}
2450 % \DescribeMacro{\Xlinerangeseparator}
2451 % \DescribeMacro{\Xendlinerangeseparator}
2452 % By default, the separator between the begin line and the end line in a lines' range is an endash in a normal font (\verb+\textnormal{--}+).
2453 % You can change it for critical footnotes with \cs{Xlinerangeseparator}\oarg{s}\marg{text}, and with \cs{Xendlinerangeseparator}\oarg{s}\marg{text} for critical endnotes.
2454 %
2455 % \subsubsection{Abbreviate line range}
2456 % \changes{v1.20.0}{2015/03/22}{Add \protect\cs{Xtwolines} and \protect\cs{Xmorethantwolines} hooks}
2457 % \label{Xtwolines}
2458 % \DescribeMacro{\Xtwolines}\DescribeMacro{\Xmorethantwolines}
2459 % If a lemma is printed on two subsequent lines, \macpackage\ will print the first and the last line numbers.
2460 % Instead of this, it is also possible to print an abbreviation which stands for \enquote{line 1 and subsequent line(s)}.
2461 %
2462 % To achieve this, use \protect\cs{Xtwolines}\oarg{s}\marg{text} and \protect\cs{Xmorethantwolines}\oarg{s}\marg{text}.
2463 % The \meta{text} argument of \protect\cs{Xtwolines} will be printed if the lemma is on two lines, and the \meta{text} argument of \protect\cs{Xmorethantwolines} will be printed if the lemma is on three or more lines.
2464 % For example:
2465 % \begin{verbatim}
2466 % \Xtwolines{sq.}
2467 % \Xmorethantwolines{sqq.}
2468 % \end{verbatim}
2469 % will print \enquote{1sq.} for a lemma which falls on lines 1--2 and \enquote{1sqq.} for a lemma which falls on lines 1--4.
2470 %
2471 % If you use \protect\cs{Xtwolines} without setting \protect\cs{Xmorethantwolines}, the \meta{text} argument
2472 % of \protect\cs{Xtwolines} will be used for lemmas which fall on three or more lines.
2473 %
2474 % However, if you want to use a short form (when the lemma overlaps two lines, but not more than two), use \protect\cs{Xtwolinesbutnotmore}\oarg{series}.
2475 %
2476 %
2477 % When you use lineation by page, the final page number, if different from the initial page number,
2478 % will not be printed, because the final page number is included in the \protect\cs{Xendtwolines} symbol.
2479 %
2480 % \DescribeMacro{\Xtwolinesonlyinsamepage}
2481 % However, you can force print the final page number with\\
2482 % \protect\cs{Xtwolinesonlyinsamepage}\oarg{series}.
2483 %
2484 %
2485 % You can disable \protect\cs{Xtwolines} and related for a specific note by using the \enquote{[fulllines]} argument in the note macro cf.~\reff{fulllines}.
2486 %
2487 % \label{Xendtwolines}\changes{v1.21.0}{2015/04/13}{Add \protect\cs{Xendtwolines}, \protect\cs{Xendmorethantwolines}, \protect\cs{Xendtwolinesbutnotmore} and \protect\cs{Xendtwolinesonlyinsamepage}.}
2488 % \DescribeMacro{\Xendtwolines}\DescribeMacro{\Xendmorethantwolines}\DescribeMacro{\Xendtwolinesbutnotmore}
2489 % For endnotes, use these macros:
2490 % \protect\cs{Xendtwolines}; \protect\cs{Xendmorethantwolines}; \linebreak \protect\cs{Xendtwolinesbutnotmore};\\
2491 % \protect\cs{Xendtwolinesonlyinsamepage} instead of \protect\cs{Xtwolines}; \protect\cs{Xmorethantwolines};\\
2492 % \protect\cs{Xtwolinesbutnotmore}; \protect\cs{Xtwolinesonlyinsamepage}.
2493 %
2494 % \subsubsection{Disabling line number printing}
2495 % \DescribeMacro{\Xnonumber}
2496 % You can use \protect\cs{Xnonumber}\oarg{s} if you do not want to have no line/page/pstart number in the footnotes, nor line number annotation.
2497 %
2498 % \DescribeMacro{\Xendnonumber} \protect\cs{Xendnonumber}\oarg{s} is the same for endnotes.
2499 %
2500 % \subsubsection{Disabling page number printing}
2501 % \DescribeMacro{\Xnopagenumberifcurrent}%
2502 % When we use a lineation by page, \macpackage checks if a lemma spans across two page. In this case, it prints the starting end ending page number.
2503 %
2504 % Many times, one of these two page numbers is also the current page number.
2505 %
2506 % In this case, it is possible to disable page number printing, using \cs{Xnopagenumberifcurrent}\oarg{s}.
2507 % \subsubsection{Printing pstart number}
2508 % \changes{v1.1.0}{2012/09/25}{Add \protect\cs{Xpstart} and \protect\cs{Xonlypstart}}
2509 % \changes{v1.18.0}{2015/02/23}{Add \protect\cs{Xpstarteverytime}}
2510 % \changes{v1.18.0}{2015/02/23}{Debug \protect\cs{Xonlypstart} when using \protect\cs{Xnumberonlyfirstinline} and the current line number differs from the previous.}
2511 % \DescribeMacro{\Xpstart}
2512 % You can use \protect\cs{Xpstart}\oarg{s} if you want to print the pstart number in the footnote, before the line and subline number.
2513 % Note that when you change the lineation system, the option is automatically switched:
2514 % \begin{itemize}
2515 % \item If you use lineation by pstart, the option is enabled.
2516 % \item If you use lineation by section or by page, the option is disabled.
2517 % \end{itemize}
2518 %
2519 % \DescribeMacro{\Xpstarteverytime}
2520 % By default, the pstart number is printed only in the part of text where you have called \protect\cs{numberpstarttrue}.
2521 % We don't know why you would like to print the pstart number in the notes and not in the main text.
2522 % However, if you want to do it, you can call \protect\cs{Xpstarteverytime}\oarg{s}.
2523 % In this case, the pstart number will be printed every time in footnote.
2524 %
2525 % \DescribeMacro{\Xonlypstart}
2526 % In combination with \protect\cs{Xpstart}, you can use \protect\cs{Xonlypstart}\oarg{s} if you want to print only the pstart number in the footnote, and not the line and subline number.
2527 %
2528 % \DescribeMacro{Xpstartonlyfirst} You can use \cs{Xpstartonlyfirst}\oarg{s} to print the pstart number only the first time it appears in the apparatus.
2529 % \DescribeMacro{\Xpstartseparator}
2530 % When using \cs{Xpstart}, you can use \cs{Xpstartseparator}\oarg{s}\marg{text} to print \meta{text} after the pstart number.
2531 % Default value is empty.
2532 % \subsubsection{Printing stanza number}
2533 %
2534 % \DescribeMacro{\Xstanza}\label{Xstanza}
2535 % You can use \cs{Xstanza}\oarg{s} if you want to print the stanza number in the footnote, before the line and subline number.
2536 %
2537 % Of course the stanza number is printed only when you use \cs{numberstanza}
2538 %
2539 % \DescribeMacro{\Xstanzaseparator}
2540 % When using \cs{Xstanza}, you can use \cs{Xstanzaseparator}\oarg{s}\marg{text} to print \meta{text} after the stanza number.
2541 % Default value is empty.
2542 %
2543 % \DescribeMacro{Xstanzaonlyfirst} You can use \cs{Xstanzaonlyfirst}\oarg{s} to print the stanza number only the first time it appears in the apparatus.
2544 % \subsubsection{Options for line number annotations}\label{annotation-inapparatus}
2545 % \DescribeMacro{\Xlinenumannotationonlyfirst}
2546 % By default, the line number annotation (\reff{annotation}) is printed in every note. If you want to print it only the first time for a given annotation
2547 % you can use \cs{Xlinenumannotationonlyfirst}\oarg{s}.
2548 %
2549 % Note the two following points:
2550 % \begin{itemize}
2551 % \item If you use the \option{noresetlinenumannotation} option of \macpackage, the \cs{Xlinenumannotationonlyfirst} won't take account of the official line number.
2552 % \item The \cs{Xlinenumannotationonlyfirst} works for consecutive lemmas with the same annotation. That is, if you have for example a lemma with an \verb+A+ annotation, then a lemma with a \verb+B+ annotation, then a lemma with an \verb+A+ annotation, each lemma will have its own annotation in the apparatus.
2553 % \end{itemize}
2554 %
2555 % \DescribeMacro{\Xlinenumannotationonlyfirstintwo}
2556 % Suppose you have a lemma on annotation~1 and a lemma that extends from annotation~1 into annotation~3.
2557 % With \cs{Xlinenumannotationonlyfirst}, the second lemma is considered to have the same annotation as the first lemma.
2558 % But if you use both \cs{Xlinenumannotationonlyfirst}\oarg{s} and \cs{Xlinenumannotationonlyfirstintwo}\oarg{s}, a distinction is made.
2559 %
2560 %
2561 % \DescribeMacro{\Xsymlinenumannotation}
2562 % To use a particular symbol in place of the line number annotation, you can use \protect\cs{Xsymlinenumannotation}\oarg{s}\marg{symbol} in combination with \protect\cs{Xlinenumannotationonlyfirst}\oarg{s}. From the second lemma with the same line number annotation, the symbol will be used instead of the annotation. Note that any command called in \meta{symbol} must be robust. Use \protect\cs{robustify} to robustify a non-robust command.
2563 %
2564 % \DescribeMacro{\Xendlinenumannotationonlyfirst}
2565 % \DescribeMacro{\Xendlinenumannotationonlyfirstintwo}
2566 % \DescribeMacro{\Xendsymlinenumannotation}
2567 % For endnotes, \cs{Xendlinenumannotationonlyfirst}; \cs{Xendlinenumannotationonlyfirstintwo} and \cs{Xendsymlinenumannotation} are the equivalents of
2568 % \\ \cs{Xlinenumannotationonlyfirst}; \cs{Xlinenumannotationonlyfirstintwo} and \cs{Xsymlinenumannotation}.
2569 %
2570 %
2571 % \DescribeMacro{\Xnolinenumberifannotation}
2572 % \DescribeMacro{\Xendnolinenumberifannotation}
2573 % The \cs{Xnolinenumberifannotation} disable line number printing only for critical notes when there are some annotations to the line number.
2574 %
2575 % The \cs{Xendnolinenumberifannotation} is the same for endnotes.
2576
2577 % \subsubsection{Separator between line and subline numbers}\label{Xsublinesep}
2578 % \DescribeMacro{\Xsublinesep}
2579 % \cs{Xsublinesep}\oarg{s}\marg{txt} changes the separator between line and subline in footnotes.
2580 %
2581 % \textbf{Employed without optional argument, it also changes the separator in side numbering}.
2582 %
2583 % \DescribeMacro{\Xendsublinesep}
2584 % \cs{Xendsublinesep}\oarg{s}\marg{txt} does the same thing for endnotes.
2585 %
2586 % \textbf{However, it does not change anything for the separator in side numbering. Use \cs{Xsublinesep} without optional argument or \cs{Xsublinesepside}\marg{txt} to do it.}
2587 %
2588 % The default value is \verb+\textnormal{.}+.
2589 % \subsubsection{Separator between page and line numbers}
2590 % \changes{v2.16.0}{2016/01/10}{Add \protect\cs{Xpagelinesep} hook.}
2591 % \DescribeMacro{\Xpagelinesep}
2592 % \cs{Xpagelinesep}\oarg{s}\marg{txt} changes the separator between the page and line number in footnotes.
2593 %
2594 % By default, the value defined for \cs{Xsublinesep} is used.
2595 %
2596 % \subsubsection{Space around number}
2597 % \DescribeMacro{\Xbeforenumber}
2598 % With \protect\cs{Xbeforenumber}\oarg{s}\marg{l}, you can add some space before the line number in a footnote. If the line number is not printed, the space is not either. The default value is 0~pt.
2599 %
2600 % \DescribeMacro{\Xafternumber}
2601 % With \protect\cs{Xafternumber}\oarg{s}\marg{l} you can add some space after the line number in a footnote. If the line number is not printed, neither is the space. The default value is 0.5~em.
2602 %
2603 % \DescribeMacro{\Xendbeforenumber}\DescribeMacro{\Xendafternumber}
2604 % \cs{Xendbeforenumber} and \cs{Xendafterenumber} are the equivalents of \cs{Xbeforenumber} and \cs{Xafterenumber} for endnotes.
2605 %
2606 % \DescribeMacro{\afternumberX}
2607 % You can set \cs{afternumberX} to set the space after the footnote number in familiar footnote. The default value is 0~pt.
2608 %
2609 % This applies only to the number in the footnote, not in the body.
2610 %
2611 % Also, notes that \LaTeX add a space after superscripted text, so also after footnote number.
2612 %
2613 % So, you may decrease this space of your expected total space. To do that, is \cs{dimexpr} computation and \cs{scriptspace} value.
2614 %
2615 % For example, if you want a total space of 2~pt, you may add a space of 1.5~pt, because there are the 0.5~pt of space after superscripted number.
2616 %
2617 % So do
2618 % \begin{verbatim}
2619 % \afternumberX{\dimexpr 2pt - \scriptspace\relax}%
2620 % \end{verbatim}
2621 %\changes{v1.4.3}{2012/12/18}{Add \protect\cs{Xnonbreakableafternumber}.}
2622 %\DescribeMacro{\Xnonbreakableafternumber}
2623 % By default, the space defined by \protect\cs{Xafternumber} is breakable.
2624 % With \protect\cs{Xnonbreakableafternumber}\oarg{s} it becomes nonbreakable.
2625 %
2626 % \subsubsection{Space around line symbol}
2627 % \DescribeMacro{\Xbeforesymlinenum}
2628 % With \protect\cs{Xbeforesymlinenum}\oarg{s}\marg{l} you can add some space before the line symbol in a footnote. The default value is value set by \protect\cs{Xbeforenumber}.
2629 %
2630 % \DescribeMacro{\Xaftersymlinenum}
2631 % With \protect\cs{Xaftersymlinenum}\oarg{s}\marg{l} you can add some space after the line symbol in a footnote. The default value is value set by \protect\cs{Xafternumber}.
2632 %
2633 % \DescribeMacro{\Xendbeforesymlinenum}
2634 % \DescribeMacro{\Xendaftersymlinenum}
2635 % \cs{Xendbeforesymlinenum} and \cs{Xendaftersymlinenum} are the equivalents of \cs{Xbeforesymlinenum} and \cs{Xaftersymlinenum} for the endnotes.
2636 %
2637 % \subsubsection{Space in place of number}
2638 % \DescribeMacro{\Xinplaceofnumber}\label{Xinplaceofnumber}
2639 % If no number or symbolic line number is printed, you can add a space, with \cs{Xinplaceofnumber}\oarg{s}\marg{l}. The default value is 1~em.
2640 %
2641 % \DescribeMacro{\Xendinplaceofnumber} \cs{Xendinplaceofnumber}\oarg{s}\marg{l} is the same, for critical endnotes.
2642 % \subsubsection{Boxing line number and line symbol}
2643 % \DescribeMacro{\Xboxlinenum}
2644 % It could be useful to put the line numbers inside a fixed box: the content of the note will be printed after this box.
2645 % You can use \protect\cs{Xboxlinenum}\oarg{s}\marg{l} to do that.
2646 % To subsequently disable this feature, use \protect\cs{Xboxlinenum} with length equal to 0~pt.
2647 % One use of this feature is to print line numbers in a column, and the note in an other column:
2648 % \begin{verbatim}
2649 %\Xhangindent{1em}
2650 %\Xafternumber{0em}
2651 %\Xboxlinenum{1em}
2652 % \end{verbatim}
2653 %
2654 % \DescribeMacro{\Xboxsymlinenum}
2655 % \protect\cs{Xboxsymlinenum}\oarg{s}\marg{l} is the same as \protect\cs{Xboxlinenum} but for the line number symbol.
2656 %
2657 % \DescribeMacro{\Xendboxsymlinenum}
2658 % \protect\cs{Xendboxsymlinenum}\oarg{s}\marg{l} is the same as \protect\cs{Xboxsymlinenum} but for endnotes.
2659 %
2660 % \changes{v1.23.0}{2015/05/18}{Add \protect\cs{Xboxlinenumalign} and \protect\cs{Xendboxlinenumalign}.}
2661 % \DescribeMacro{\Xboxlinenumalign}
2662 % If you put line number in box, it will be aligned left inside the box.
2663 % However, you can change it using \protect\cs{Xboxlinenumalign}\oarg{s}\marg{text} where \meta{text} can be the following:
2664 % \begin{description}
2665 % \item[L] to align left (default value);
2666 % \item[R] to align right;
2667 % \item[C] to center.
2668 % \end{description}
2669 %
2670 % \changes{v1.23.0}{2015/05/18}{Add \protect\cs{Xboxstartlinenum}, \protect\cs{Xendboxstartlinenum}, \protect\cs{Xboxendlinenum}, \protect\cs{Xendboxendlinenum}.}
2671 % When using \protect\cs{Xboxlinenum}, \macpackage put all the line number description in the same box. That is, the same box will contain: the start line number, the dash, and either the end line number or the range symbol (like \verb+ff.+).
2672 % However, it is possible to box them in two different boxes.
2673 % \begin{itemize}
2674 % \item \protect\cs{Xboxstartlinenum}\oarg{s}\marg{l} will box the start line number in a box of length \meta{l}. The content will be put at the right of the box.
2675 % \item \protect\cs{Xboxendlinenum}\oarg{s}\marg{l} will box the dash plus the end line number or the range symbol in a box of length \meta{l}. The content will be put at the left of the box.
2676 % \end{itemize}
2677 %
2678 % With these two commands, it is possible to horizontally align the dash of line number when using critical notes, to obtain something like:
2679 % \begin{verbatim}
2680 % 1
2681 % 12-23
2682 % 24ff.
2683 % \end{verbatim}
2684 %
2685 % \DescribeMacro{\Xnotboxingsubline}
2686 % By default, for the start line number, these things are boxed:
2687 % \begin{itemize}
2688 % \item (start) line number annotation, if before line number;
2689 % \item (start) page and (start) line number;
2690 % \item (start) line flag;
2691 % \item (start) line number annotation, if after line number;
2692 % \item (start) subline number.
2693 % \end{itemize}
2694 %
2695 % You may exclude subline number and line number annotation after line number, using \cs{Xnotboxingsubline}\oarg{s}.
2696 % \DescribeMacro{\Xendboxlinenum}
2697 % \DescribeMacro{\Xendboxlinenumalign}
2698 % \DescribeMacro{\Xendboxstartline}
2699 % \DescribeMacro{\Xendboxendlinenum}
2700 % \changes{v1.20.0}{2015/03/22}{Add \protect\cs{Xendboxlinenum}}
2701 % \protect\cs{Xendboxlinenum}\oarg{s}\marg{l},
2702 % \protect\cs{Xendboxlinenumalign}\oarg{s}\marg{text},
2703 % \protect\cs{Xendboxstartlinenum}\oarg{s}\marg{l},
2704 % \protect\cs{Xendnotboxingsubline}\oarg{s},
2705 % \protect\cs{Xendboxendlinenum}\oarg{s}\marg{l}
2706 % are the same as, respectively,
2707 % \protect\cs{Xboxlinenum},
2708 % \protect\cs{Xboxlinenumalign},
2709 % \protect\cs{Xboxstartlinenum},
2710 % \protect\cs{Xnotboxingsubline},
2711 % \protect\cs{Xboxendlinenum}
2712 % except in endnotes.
2713 %
2714 %
2715 %\subsection{Separator between the lemma and the note}
2716 % \subsubsection{For footnotes}
2717 % \DescribeMacro{\Xlemmaseparator}
2718 % By default, in a footnote, the separator between the lemma and the note is a right bracket (\protect\cs{rbracket})\footnote{For \protect\package{polyglossia}, when the lemma is RTL, the bracket automatically switches to a left bracket.}. You can use \protect\cs{Xlemmaseparator}\oarg{s}\marg{Xlemmaseparator} to change it. The optional argument can be used to specify the series in which it is used. Note that there is a non-breakable space between the lemma and the separator, but a \textbf{breakable} space between the separator and the following text.
2719 %
2720 % \DescribeMacro{\Xbeforelemmaseparator}
2721 % Using \protect\cs{Xbeforelemmaseparator}\oarg{s}\marg{l} you can add some space between lemma and separator. If your lemma separator is empty, this space won't be printed. The default value is 0~em.
2722 %
2723 % \DescribeMacro{\Xafterlemmaseparator}
2724 % Using \protect\cs{Xafterlemmaseparator}\oarg{s}\marg{l} you can add some space between separator and note. If your lemma separator is empty, this space will not be printed. The default value is 0.5~em.
2725 %
2726 % \DescribeMacro{\Xnolemmaseparator}
2727 % You can suppress the lemma separator, using \protect\cs{Xnolemmaseparator}\oarg{s}, which is simply a alias of \protect\cs{Xlemmaseparator}\oarg{s}\verb|{}|.
2728 %
2729 % \DescribeMacro{\Xinplaceoflemmaseparator}\label{Xinplaceoflemmaseparator}
2730 % With \protect\cs{Xinplaceoflemmaseparator}\oarg{s}\marg{l} you can add a space if no lemma separator is printed. The default value is 1~em.
2731 %
2732 %
2733 % \subsubsection{For endnotes}\label{Xendlemmaseparator}
2734 % \changes{v1.22.0}{2015/04/25}{Add option for lemma separator inside endnotes}
2735 % \DescribeMacro{\Xendlemmaseparator}
2736 % By default, there is no separator inside endnotes between the lemma and the content of the note. You can use \protect\cs{Xendlemmaseparator}\oarg{s}\marg{Xendlemmaseparator} to change this. The optional argument can be used to specify the series in which it is used.
2737 % A common value of \meta{Xendlemmaseparator} is \cs{rbracket}.
2738 %
2739 % Note that there is a non-breakable space between the lemma and the separator, but a \textbf{breakable} space between the separator and the following text.
2740 %
2741 % \DescribeMacro{\Xendbeforelemmaseparator}
2742 % Using \protect\cs{Xendbeforelemmaseparator}\oarg{s}\marg{l} you can add some space between the lemma and the separator. If your lemma separator is empty, this space won't be printed. The default value is 0~em.
2743 %
2744 % \DescribeMacro{\Xendafterlemmaseparator}
2745 % Using \protect\cs{Xendafterlemmaseparator}\oarg{s}\marg{l} you can add some space between the separator and the content of the note. If your lemma separator is empty, this space won't be printed. The default value is 0.5~em.
2746 %
2747 %
2748 % \DescribeMacro{\Xendinplaceoflemmaseparator}\label{Xendinplaceoflemmaseparator}
2749 % With \protect\cs{Xendinplaceoflemmaseparator}\oarg{s}\marg{l} you can add some space if you choose to remove the lemma separator. The default value is 0.5~em.
2750 %
2751 %
2752 % \subsection{Font style}
2753 % \subsubsection{For line number}
2754 % \DescribeMacro{\Xnotenumfont}
2755 % \protect\cs{Xnotenumfont}\oarg{s}\marg{command} is used to change the font style for line numbers in critical footnotes ;
2756 % \meta{command} must be one (or more) switching command, like \protect\cs{bfseries}.
2757 %
2758 % \DescribeMacro{\Xendnotenumfont}
2759 % \protect\cs{Xendnotenumfont}\oarg{s}\marg{command} is used to change the font style for line numbers in critical footnotes.
2760 % \meta{command} must be one (or more) switching command, like \protect\cs{bfseries}.
2761 %
2762 % \DescribeMacro{\notenumfontX}
2763 % \protect\cs{notenumfontX}\oarg{s}\marg{command} is used to change the font style for note numbers in familiar footnotes.
2764 % \meta{command} must be one (or more) switching command, like \protect\cs{bfseries}.
2765 %
2766
2767 % \subsubsection{For the lemma}
2768 % \changes{v1.11.0}{2014/05/09}{Add hooks to disable the font selection for lemma in footnote.}
2769 % \DescribeMacro{\Xlemmadisablefontselection}
2770 % By default, font of the lemma in footnote is the same as font of the lemma in the main text. For example, if the lemma is in italic in the main text, it is also in italic in note. The \protect\cs{Xlemmadisablefontselection}\oarg{s} command allows to disable it for a specific series.
2771 %
2772 % \DescribeMacro{\Xendlemmadisablefontselection}
2773 % By default, font of the lemma in endnote is the same as font of the lemma in the main text. For example, if the lemma is in italic in the main text, it is also in italic in note. The command allows \protect\cs{Xendlemmadisablefontselection}\oarg{s} to disable it for a specific series.
2774 %
2775
2776 % \changes{v2.7.0}{2015/11/29}{New hooks: \protect\cs{Xlemmafont} and \protect\cs{Xendlemmafont}}
2777 % \DescribeMacro{\Xlemmafont}\DescribeMacro{\Xendlemmafont}
2778 % Use \cs{Xlemmafont}\oarg{s}\marg{cmd} to apply a \TeX\ font command to the lemma.
2779 %For example, to have boldface lemma:
2780 % \begin{verbatim}
2781 %\Xlemmafont{\bfseries}
2782 % \end{verbatim}
2783 % \cs{Xendlemmafont}\oarg{s}\marg{cmd} is the same for endnotes.
2784 %
2785 %
2786 % \subsubsection{For all notes}
2787 % \DescribeMacro{\Xnotefontsize}
2788 % \protect\cs{Xnotefontsize}\oarg{s}\marg{command} is used to define the font size of critical footnotes of the series. The default value is \protect\cs{footnotesize}.
2789 % The \meta{command} must not be a size in pt, but a \LaTeX\ macro, like \protect\cs{small}.
2790 %
2791 % \DescribeMacro{\notefontsizeX}
2792 % \protect\cs{notefontsizeX}\oarg{s}\marg{command} is used to define the font size of familiar footnotes of the series. The default value is \protect\cs{footnotesize}.
2793 % The \meta{command} must not be a size in pt, but a \LaTeX\ macro, like \protect\cs{small}.
2794 %
2795 % \DescribeMacro{\Xendnotefontsize}
2796 % \protect\cs{Xendnotefontsize}\oarg{s}\marg{l} is used to define the font size of end critical footnotes of the series. The default value is \protect\cs{footnotesize}.
2797 % The \meta{command} must not be a size in pt, but a \LaTeX\ macro, like \protect\cs{small}.
2798 %
2799 % \subsection{Wrapping notes}
2800 % \changes{v2.42.0}{2025/07/22}{Add \protect\cs{Xwrapcomponents}}
2801 % \changes{v2.42.0}{2025/07/22}{Add \protect\cs{Xendwrapcomponents}}
2802 % \changes{v2.42.0}{2025/07/22}{Add \protect\cs{wrapcomponentsX}}
2803 % \DescribeMacro{\Xwrapcomponents}
2804 % \cs{Xwrapcomponents}\oarg{s}\marg{cmd} is used to wrap all the components of a critical footnotes in a argumented macro. By \enquote{components} we mean \enquote{(page/line) numbers + lemma + separator + content of the note}.
2805 %
2806 % This hook may be used if you want to have footnote in left-to-right, while the main text is in right-to-left.
2807 % \begin{verbatim}
2808 % \Xwrapcomponents{\LR}
2809 % \end{verbatim}
2810 %
2811 % \DescribeMacro{\Xendwrapcomponents}
2812 % \cs{Xendwrapcomponents}\oarg{s}\marg{cmd} is the same as \cs{Xwrapcomponents}, but for endnotes.
2813 %
2814 % \DescribeMacro{\wrapcomponentsX}
2815 % \cs{wrapcomponentsX}\oarg{s}\marg{cmd} is the same as \cs{Xwrapcomponents}, but for familiar footnote. In this case, \enquote{components} means \enquote{footnote number + space + footnote text}.
2816 % \subsubsection{Wrapping line number}
2817 % \changes{v2.41.0}{2025/07/08}{Add \protect\cs{Xwrapnumbers} and \protect\cs{Xendwrapnumbers}}
2818 % \DescribeMacro{\Xwrapnumbers}
2819 % \cs{Xwrapnumbers}\oarg{s}\marg{cmd} is used to wrap, in the footnote, the reference number (pstart + page number + line number + annotation) in a command. For exemple, you may define a macro to wrap numbers in parenthesis, then calling it as argument of \cs{Xwrapnumbers}.
2820 % \begin{verbatim}
2821 %\newcommand{\reledmacparenthesis}[1]{(#1)}
2822 %\Xwrapnumbers{\reledmacparenthesis}
2823 % \end{verbatim}
2824 % Note that if the numbers are note printed, then the macro is not called. The result is boxed if you use \protect\cs{Xboxlinenum}.
2825 %
2826 % \DescribeMacro{\Xendwrapnumbers}
2827 % \cs{Xendwrapnumbers}\oarg{s}\marg{cmd} do the same for endnotes.
2828 % \subsubsection{Wrapping lemmas}
2829 % \changes{v2.10.0}{2016/05/08}{New hooks: \protect\cs{Xwraplemma} and \protect\cs{Xendwraplemma}}
2830 % \DescribeMacro{\Xwraplemma}\label{Xwraplemma}
2831 % \cs{Xwraplemma}\oarg{s}\marg{cmd} is used to wrap, in the footnote, the lemma in a \LaTeX\ command.
2832 % For example, with the \package{bidi} package, to ensure having a lemma written right to left, use \cs{Xwraplemma}\arg{\cs{RL}}.
2833 %
2834 % \DescribeMacro{\Xwrapendlemma}
2835 % \cs{Xendwraplemma}\oarg{s}\marg{cmd} is the same for endnotes.
2836 %
2837 % \subsubsection{Wrapping contents}
2838 % \changes{v2.10.0}{2016/05/08}{New hooks: \protect\cs{Xwrapcontent}, \protect\cs{Xendwrapcontent} and \protect\cs{wrapcontentX}.}
2839 % \DescribeMacro{\Xwrapcontent}
2840 % \cs{Xwrapcontent}\oarg{s}\marg{cmd} is used to wrap the footnote contents --- excluding the lemma --- in a \LaTeX\ command.
2841 %
2842 % For example, if the language of your note is not the same as the language of the lemma, use \cs{Xwrapcontent}\arg{\cs{foreignlanguage}\marg{language}} (with \package{babel}) or \cs{Xwrapcontent}\arg{\cs{text\meta{language}}} (for babel).
2843 %
2844 % \DescribeMacro{\Xendwrapcontent}
2845 % \cs{Xendwrapcontent}\oarg{s}\marg{cmd} is the same for endnotes.
2846 %
2847 % \DescribeMacro{\wrapcontentX}
2848 % \cs{wrapcontentX}\oarg{s}\marg{cmd} is the same for familiar footnotes.
2849 % \subsection{Indent of notes content}
2850 % \changes{v1.21.0}{2015/04/13}{Add \protect\cs{Xparindent} and \protect\cs{hangindentX}}
2851 % \DescribeMacro{\Xparindent}
2852 % By default, \macpackage does not add indentation before the paragraphs inside critical footnotes.
2853 % Use \protect\cs{Xparindent}\oarg{s} to enable indentation.
2854 %
2855 % \DescribeMacro{\parindentX}
2856 % By default, \macpackage does not add indentation before the paragraphs inside familiar footnotes.
2857 % Use \protect\cs{parindentX}\oarg{s} to enable indentation.
2858 %
2859 % \DescribeMacro{\Xhangindent}
2860 % For critical notes NOT paragraphed you can define an indent with \protect\cs{Xhangindent}\oarg{s}\marg{l}, which will be applied in the second line of notes. It can help to make distinction between a new note and a break in a note. The default value is 0~pt.
2861 %
2862 % \DescribeMacro{\hangindentX}
2863 % For familiar notes NOT paragraphed you can define an indentation with \protect\cs{hangindentX}\oarg{s}\marg{l}, which will be applied in the second line of notes. It can help to make a distinction between a new note and a break in a note.
2864
2865 % \DescribeMacro{\Xendhangindent}
2866 % For critical endnotes NOT paragraphed you can define an indentation with \protect\cs{Xendhangindent}\oarg{s}\marg{l}, which will be applied in the second line of notes. It can help to make a distinction between a new note and a break in a note.
2867 %
2868 %
2869 % \subsection{Arbitrary code}
2870
2871 % \subsubsection{Arbitrary code around line number}
2872 % \DescribeMacro{\Xendbhooklinenumber}
2873 % \cs{Xendbhooklinenumber}\oarg{s}\marg{code} is used to execute code before line numbers in endnotes. The code is executed before the \cs{Xendbeforelinenumber} space and before the \cs{Xendnotenumfont} font setting.
2874 %
2875 % \DescribeMacro{\Xendahooklinenumber}
2876 % \cs{Xendahooklinenumber}\oarg{s}\marg{code} is used to execute code after line number in endnotes.
2877 % The code is executed after the \cs{Xendafternumber} space.
2878 %
2879 %
2880 %
2881 % \DescribeMacro{\Xendbhookinplaceofnumber}
2882 % \cs{Xendbhookinplaceofnumber}\oarg{s}\marg{code} is used to execute code before a space or symbol which replaces line number in endnotes. The code is executed before the \cs{Xendbeforesymlinenum} space and before the \cs{Xendnotenumfont} font setting.
2883 %
2884 % \DescribeMacro{\Xendahookinplaceofnumber}
2885 % \cs{Xendahookinplaceofnumber}\oarg{s}\marg{code} is used to execute code after a space or symbol which replaces line number in endnotes.
2886 % The code is executed after the \cs{Xendaftersymlinenum} space.
2887 % \subsubsection{Arbitrary code at the beginning of notes}
2888 % \changes{v1.1.0}{2012/09/25}{New hook to add arbitrary code at the beginning of the notes}
2889 % The three next commands add arbitrary code at the beginning of notes.
2890 % As the name's space is local to the notes, you can use it to redefine some style inside the notes.
2891 % For example, if you don't want the pstart number to be in bold, use:
2892 % \begin{verbatim}
2893 % \Xbhooknote{\renewcommand{\thepstart}{\arabic{pstart}.}}
2894 % \end{verbatim}
2895 %
2896 % \DescribeMacro{\Xbhooknote}
2897 % \protect\cs{Xbhooknote}\oarg{s}\marg{code} is to be used at the beginning of each critical footnote.
2898 %
2899 %
2900 % \DescribeMacro{\bhooknoteX}
2901 % \protect\cs{bhooknoteX}\oarg{s}\marg{code} is to be used at the beginning of each familiar footnote.
2902 %
2903 %
2904 % \DescribeMacro{\Xendbhooknote}
2905 % \protect\cs{Xendbhooknote}\oarg{s}\marg{code} is to be used at the beginning of each endnote.
2906 %
2907 % \subsubsection{Arbitrary code before inserting note}
2908 % \DescribeMacro{\Xbeforeinserting}
2909 % \DescribeMacro{beforeinsertingX}
2910 % \cs{Xbeforeinserting}\oarg{s}\marg{code}
2911 % and \cs{beforeinsertingX}\oarg{s}\marg{code}
2912 % are very technical commands.
2913 %
2914 % They allow one to add any arbitrary code just before the footnotes are added in the list of footnotes.
2915 % The main use is to insert text direction code.
2916 % For example, if you edit right-to-left text with \package{bidi}, but want your critical footnote be left-to-right, use \cs{Xbeforeinserting}{\cs{LTR}}.
2917 % You should also use \cs{Xwraplemma} to ensure your lemmas are right-to-left in a left-to-right paragraph (\reff{Xwraplemma}).
2918 %
2919 % Note that the changes are local to the footnote.
2920 %
2921 %
2922 % \subsection{Options for footnotes in columns}
2923 %
2924 % \subsubsection{Alignment}
2925 % \DescribeMacro{\Xcolalign}
2926 % \DescribeMacro{\colalignX}
2927 % \changes{v1.21.0}{2015/04/13}{Add \protect\cs{Xcolalign} and \protect\cs{colalignX} hooks}
2928 % By default, text in footnotes of two or three columns are flush left and without hyphenation.
2929 % However, you can change this with \protect\cs{Xcolalign}\oarg{s}\marg{code} for critical footnotes,
2930 % and \protect\cs{colalignX}\oarg{s}\marg{code} for familiar footnotes.
2931 %
2932 % \verb+<code>+ must be one of the following command:
2933 % \begin{description}
2934 % \item[\protect\cs{justifying}] to have text justified, as usual with \LaTeX. You can also let \verb+<code>+ empty.
2935 % \item[\protect\cs{raggedright}] to have text left aligned, but \emph{without hyphenation}. That is the default \macpackage\ setting.
2936 % \item[\protect\cs{RaggedRight}] to have text left aligned \emph{with hyphenation} (requires \package{ragged2e}).
2937 % \item[\protect\cs{raggedleft}] to have text right aligned, but \emph{without hyphenation}.
2938 % \item[\protect\cs{RaggedLeft}] to have text right aligned \emph{with hyphenation} (requires \package{ragged2e}).
2939 % \item[\protect\cs{centering}] to have text centered, but \emph{without hyphenation}.
2940 % \item[\protect\cs{Centering}] to have text centered \emph{with hyphenation} (requires \package{ragged2e}).
2941 % \end{description}
2942 %
2943 % \subsubsection{Size of the columns}\label{hsizecols}
2944 % For the following four macros, be careful that the columns are made from right to left.
2945 %
2946 % \DescribeMacro{\Xhsizetwocol}
2947 % \protect\cs{Xhsizetwocol}\oarg{s}\marg{l} is used to change width of a column when critical notes are displaying in two columns. Default value is \verb+.45 \hsize+.
2948 %
2949 % \DescribeMacro{\Xhsizethreecol}
2950 % \protect\cs{Xhsizethreecol}\oarg{s}\marg{l} is used to change width of a column when critical notes are displaying in three columns. Default value is \verb+.3 \hsize+.
2951 %
2952 % \DescribeMacro{\hsizetwocolX}
2953 % \protect\cs{hsizetwocolX}\oarg{s}\marg{l} is used to change width of a column when familiar notes are displaying in two columns. Default value is \verb+.45 \hsize+.
2954 %
2955 % \DescribeMacro{\hsizethreecolX}
2956 % \protect\cs{hsizethreecolX}\oarg{s}\marg{l} is used to change width of a column when familiar notes are displaying in three columns. Default value is \verb+.3 \hsize+.
2957 %
2958 % \subsubsection{Separator between columns}
2959 % \DescribeMacro{Xcolseparator}
2960 % \cs{Xcolseparator}\oarg{s}\marg{c}
2961 % allows you to define a separator to be inserted between columns of critical footnotes.
2962 % \meta{c} must be a series of \LaTeX macro. Typically, to insert a vertical
2963 % rule with a \protect{1em} space around, use:
2964 % \begin{verbatim}
2965 % \Xcolseparator{\hspace{1em}\vrule\hspace{1em}}%
2966 % \end{verbatim}
2967 % \DescribeMacro{colseparatorX}
2968 % \cs{Xcolseparator}\oarg{s}\marg{c}
2969 % allows you to define a separator to be inserted between columns of familiar footnotes.
2970 % \subsection{Options for paragraphed footnotes and notes grouped by line}\label{optionparagraphed}
2971 % \subsubsection{Mark separation of notes}
2972 % \DescribeMacro{\Xafternote} \DescribeMacro{\afternoteX}
2973 % You can add some horizontal space after a note by using \protect\cs{Xafternote}\oarg{s}\marg{l} (for critical footnotes) or \protect\cs{afternoteX}\oarg{s}\marg{l} (for familiar footnotes). The default value is \verb|1em plus.4em minus.4em|.
2974 %
2975 % \DescribeMacro{\Xparafootsep}\DescribeMacro{\parafootsepX}
2976 % For paragraphed footnotes (see below), you can choose the separator between each note by using \protect\cs{Xparafootsep}\oarg{s}\marg{text} for critical notes and \protect\cs{parafootsepX} for familiar notes.
2977 % A common separator is the double pipe ($\parallel$), which you can set by using \protect\cs{Xparafootsep}\verb+{$\parallel$}+.
2978 %
2979 % Note that if the symbol defined by \protect\cs{Xsymlinenum} must be used at the beginning of a note, the \protect\cs{Xparafootsep} / \protect\cs{parafootsepX} is not used before this note.
2980 %
2981 % \subsubsection{Ragged text}
2982 % \changes{v1.12.0}{2014/08/05}{New options for ragged-paragraph notes}
2983 % \DescribeMacro{\Xragged}
2984 % Text in paragraphed critical notes is justified, but you can use \protect\cs{Xragged}\oarg{s}\arg{L} if you want it to be ragged left (i.e., right justified),
2985 % or \protect\cs{Xragged}\oarg{s}\arg{R} if you want it to be ragged right (i.e., left justified).
2986 %
2987 % \DescribeMacro{\raggedX}
2988 % Text in paragraphed footnotes is justified, but you can use \protect\cs{raggedX}\oarg{s}\arg{L} if you want it to be ragged left, or \protect\cs{raggedX}\oarg{s}\arg{R} if you want it to be ragged right.
2989 %
2990 % \subsection{Options for block of notes}
2991 %
2992 % \subsubsection{Grouping notes by line}
2993 % \DescribeMacro{\Xgroupbyline}
2994 % If you do not use \cs{Xarrangement}\arg{paragraph}, you may want to group all the critical footnotes related to the same line in the same paragraph.
2995 % In this case, use \cs{Xgroupbyline}\oarg{series}.
2996 %
2997 % In many cases, you might like to use it in combination with \cs{Xnumberonlyfirstinline} (\reff{Xnumberonlyfirstinline}).
2998 %
2999 % Note that the \cs{Xafternote} and \cs{Xparafootsep} settings are used to determine space and content between footnotes (\reff{optionparagraphed}).
3000 % \DescribeMacro{\Xgroupbylineseparetwolines}
3001 % Suppose you have two notes on line~1 which overlap lines~1 and~2.
3002 % This last note will be printed, if you use \cs{Xgroupbyline} in the same group as the previous one.
3003 % In the case you want that note to be distinct, you must use both \cs{Xgroupbyline} and \cs{Xgroupbylineseparetwolines}\oarg{s}.
3004 %
3005 % In many cases, you might like to use it in combination with \cs{Xnumberonlyfirstintwolines} (\reff{Xnumberonlyfirstintwolines})
3006 %
3007 % \subsubsection{Text before notes}
3008 % \changes{v1.1.0}{2012/09/12}{New options for block of notes.}
3009 % \DescribeMacro{\Xtxtbeforenotes}
3010 % You can add text before critical footnotes with \protect\cs{Xtxtbeforenotes}\oarg{s}\marg{text}.
3011 % \DescribeMacro{\txtbeforenotesX}
3012 %
3013 % You can add text before familiar footnotes with \protect\cs{txtbeforenotesX}\oarg{s}\marg{text}.
3014 %
3015 % \DescribeMacro{\Xendtxtbeforenotes}
3016 % You can add text before endnotes with \protect\cs{Xendtxtbeforenotes}\oarg{s}\marg{text}. The text will be typeset only if there are endnotes.
3017 %
3018 % \DescribeMacro{\Xtxtbeforenotesonlyonce}
3019 % \DescribeMacro{\txtbeforenotesonlyonceX} By default, such texts are inserted at the beginning of the groups of notes on each page.
3020 % You can add \cs{Xtxtbeforenotesonlyonce} (for critical footnotes) and \cs{txtbeforenotesonlyonceX} (for familiar footnotes) to insert them only the first time notes are typeset.
3021 % \subsubsection{Code before notes}
3022 %\DescribeMacro{\Xbhookgroup}
3023 %\DescribeMacro{\bhookgroupX}
3024 % While \cs{Xtxtbeforenotes} is for typesetting text before notes, \cs{Xbhookgroup}\oarg{s}\marg{code} and \cs{bhookgroupX}\oarg{s}\marg{code} (for critical and familiar respectively) are for executing code before a group of notes, between the rules and the printing of the notes.
3025 %
3026 %
3027 % \subsubsection{Spacing}
3028 % \DescribeMacro{\Xbeforenotes}
3029 % You can change the vertical space before the rule of the critical notes with \protect\cs{Xbeforenotes}\oarg{s}\marg{l}.
3030 % The default value is \verb|1.2em plus .6em minus .6em|.
3031 %
3032 % \textbf{Be careful, the standard \LaTeX\ footnote rule used by \macpackage decreases by 3pt. This 3pt decrease is not changed by this command.}
3033 %
3034 % \DescribeMacro{\beforenotesX}
3035 % You can change the vertical space printed before the rule of the familiar notes with \protect\cs{beforenotesX}\oarg{s}\marg{l}.
3036 % The default value is \verb|1.2em plus .6em minus .6em|.
3037 %
3038 % \textbf{Be careful, the standard \LaTeX\ footnote rule, which is used by \macpackage, decreases 3pt. These 3pt are not changed by this command.}
3039 %
3040 % \DescribeMacro{\Xprenotes}
3041 % You can set the space before the first series of critical notes printed on each page
3042 % and set a different amount of space for each subsequent series on the page.
3043 % You can do it with \protect\cs{Xprenotes}\marg{l}. The default value is \verb+0pt+.
3044 % You can disable this feature by setting the length to 0pt.
3045 %
3046 % \DescribeMacro{\prenotesX}
3047 % You can set the space before the first printed (in a page) series of familiar notes to be different from the space before other series.
3048 % The default value is \verb+0pt+.
3049 % You can do this with \protect\cs{prenotesX}\marg{l}. You can disable this feature by setting the length to 0pt.
3050 %
3051 % \subsubsection{Printing only one footnote rule per page}
3052 % By default, each series of notes has its own footnote rule.
3053 % \label{opt:onlyonerule} Using \option{onlyonerule} when loading the \Macpackage packages ensures that only one rule will be printed in each page.
3054 %
3055 % However, you may want to have only one footnote rule for all series of \emph{critical} footnotes, but also one (and only one) footnote rule for all series of \emph{familiar} footnotes.
3056 %
3057 % For example, if in one page you have three series of critical footnotes and four series of familiar footnotes, you may want to have, in all, two rules.
3058 %
3059 % To do that use
3060 % \begin{itemize}
3061 % \item \DescribeMacro{Xonlyonerule} to produce only a single footnote rule for all critical footnotes;
3062 % \item \DescribeMacro{onlyoneruleX} to produce only a single footnote rule for all familiar footnotes.
3063 % \end{itemize}
3064 %\subsubsection{Space after footnotes rules}
3065 % \changes{v1.12.0}{2014/08/05}{New hooks: \protect\cs{Xafterrule} and \protect\cs{afterruleX}}
3066 % \DescribeMacro{\Xafterrule}
3067 % You can change the vertical space printed after the rule of the critical notes with \protect\cs{Xafterrule}\oarg{s}\marg{l}.
3068 % The default value is \verb|0pt|.
3069 %
3070 % \textbf{Be careful, the standard \LaTeX\ footnote rule, which is used by \macpackage, adds 2.6pt. These 2.6pt are not changed by this command.}
3071 %
3072 %
3073 % \DescribeMacro{\afterruleX}
3074 % You can change the vertical space printed after the rule of the familiar notes with \protect\cs{afterruleX}\oarg{s}\marg{l}.
3075 % % The default value is \verb|0pt|.
3076 %
3077 % \textbf{Be careful, the standard \LaTeX\ footnote rule, which is used by \macpackage, adds 2.6pt. These 2.6pt are not changed by this command.}
3078 %
3079 %
3080 % \subsubsection{Maximum height}\label{Xmaxhnotes}
3081 % \DescribeMacro{\Xmaxhnotes}
3082 % By default, one series of critical notes can take up to 80\% of \cs{vsize}, before being broken to the next page.
3083 % If you want to change the size use \protect\cs{Xmaxhnotes}\oarg{s}\marg{l}.
3084 % Be careful: the length must be fixed (no stretch), and is relative to the the current font.
3085 % For example, if you want the note to take, at most, 33\% of the text height, do \verb|\Xmaxhnotes{.33\textheight}|.
3086 %
3087 % \DescribeMacro{\maxhnotesX}
3088 % \protect\cs{maxhnotesX}\oarg{s}\marg{l} is the same as previous, but for familiar footnotes.
3089 %
3090 % Note that in many cases, you should call these commands in the begin of the document, because the \cs{vsize} in the preamble is not the same as \cs{vsize} after the preamble.
3091 % That why we recommend to you to add in your preamble
3092 % \begin{verbatim}
3093 % \AtBeginDocument{
3094 % \maxhnotesX{0.8\textheight}
3095 % \Xmaxhnotes{0.8\textheight}
3096 % }
3097 % \end{verbatim}
3098 %
3099 % Be careful with the two previous commands.
3100 % Actually, for technical purposes, one paragraphed note is considered as one block.
3101 % Consequently, it cannot be broken between two pages, even if you used these commands.
3102 % The debug is in the todolist.
3103 % \subsubsection{Width}
3104 % \changes{v2.7.0}{2015/11/29}{New hooks: \protect\cs{Xhsize} and \protect\cs{hsizeX}}
3105 % \changes{v2.7.2}{2015/12/13}{\protect\cs{Xhsize} and \protect\cs{hsizeX} become \protect\cs{Xwidth} and \protect\cs{widthX}}
3106 % \DescribeMacro{\Xwidth}
3107 % \DescribeMacro{\widthX}
3108 % \cs{Xwidth}\oarg{s}\marg{l} sets the total width of critical footnotes.
3109 % \cs{widthX}\oarg{s}\marg{l} does the same for familiar footnotes.
3110 %
3111 % \meta{l} can be a length expression, parsable with \cs{dimexpr}.
3112 % For example:
3113 % \begin{verbatim}
3114 %\Xwidth{\columnwidth+\marginparsep+\ledrsnotewidth}
3115 %\widthX{\columnwidth+\marginparsep+\ledrsnotewidth}
3116 % \end{verbatim}
3117 %
3118 % Note that changes the with of the block of notes.
3119 % If you want to change the width of each column when typesetting notes in columns, use \cs{Xhsizetwocol}, \cs{Xhsizethreecol}, \cs{hsizetwocolX}, \cs{hsizethreecolX}, see \reff{hsizecols}.
3120 %
3121 % \subsection{Footnotes and the \parpackage columns}
3122 % \changes{v1.13.0}{2014/09/16}{Add \protect\cs{Xnoteswidthliketwocolumns} and \protect\cs{noteswidthliketwocolumnsX}}
3123 % \DescribeMacro{\Xnoteswidthliketwocolumns}\DescribeMacro{\noteswidthliketwocolumnsX}
3124 % If you use \parpackage\ \protect\cs{columns} macro, you can call:
3125 % \begin{itemize}
3126 % \item \protect\cs{Xnoteswidthliketwocolumns}\oarg{s} to create critical notes with a two-column size width.
3127 % \item \protect\cs{noteswidthliketwocolumnsX}\oarg{s} to create familiar notes with a two-column size width.
3128 % \end{itemize}
3129 % \subsection{Endnotes in one paragraph}
3130 % \changes{v1.12.0}{2015/04/25}{Add \protect\cs{Xendparagraph} and related settings.}
3131 % \DescribeMacro{\Xendparagraph}
3132 % By default, any new endnote starts a new paragraph.
3133 % Use \protect\cs{Xendparagraph}\oarg{s} to have all end notes of one given series set in one paragraph.
3134 %
3135 % \DescribeMacro{\Xendafternote}
3136 % You can add some space after a endnote series by using \protect\cs{Xendafternote}\oarg{s}\marg{l}. The default value is \verb|1em plus.4em minus.4em|.
3137 %
3138 % \DescribeMacro{\Xendsep}
3139 % You can choose the separator between each note by \protect\cs{Xendsep}\oarg{s}\marg{text}. A common separator is the double pipe ($\parallel$), which you can set by using \protect\cs{Xendsep}\verb+{$\parallel$}+.
3140 %
3141 % \section{Fonts}\label{fonts}
3142 % One of the most important features of the appearance of the notes,
3143 % and indeed of your whole document, will be the fonts used. We will
3144 % first describe the commands that give you control over the
3145 % use of fonts in the different structural elements of the document,
3146 % especially within the notes, and then in
3147 % subsequent sections specify how these commands are used.
3148 %
3149 %
3150 %
3151 % \DescribeMacro{\numlabfont}
3152 % Line numbers for the main text
3153 % are usually printed in a smaller font in the margin.
3154 % The \protect\cs{numlabfont} macro is provided as a standard name for
3155 % that font: it is initially defined as \\
3156 % \verb"\newcommand{\numlabfont}{\normalfont\scriptsize}" \\
3157 % You might wish to use a different font if, for example,
3158 % you preferred to have these line numbers printed using
3159 % old-style numerals.
3160 %
3161 %
3162 %
3163 %
3164 % \DescribeMacro{\select@lemmafont}
3165 % We will briefly discuss \protect\cs{select@lemmafont}
3166 % here because it is important to know about
3167 % it now, although it is not one of the macros you would expect to
3168 % change in the course of a simple job. Hence it is \enquote{protected}
3169 % by having the @-sign in its name.
3170 %
3171 % When you use the \protect\cs{edtext} macro to mark a word in your text
3172 % as a lemma, that word will normally be printed again in your
3173 % apparatus. If the word in the text happens to be in a font such
3174 % as italic or bold you would probably expect it to appear in the
3175 % apparatus in the same font. This becomes an absolute necessity
3176 % if the font is actually a different script, such as Arabic or
3177 % Cyrillic. \protect\cs{select@lemmafont} does the work of
3178 % decoding \macpackage's data about the fonts used to print the lemma in
3179 % the main text and calling up those fonts for printing the lemma in
3180 % the note.
3181 %
3182 % \protect\cs{select@lemmafont} is a macro that takes one long
3183 % argument---the cluster of line numbers passed to the note
3184 % commands. This cluster ends with a code indicating what
3185 % fonts were in use at the start of the lemma.
3186 % \protect\cs{select@lemmafont} selects the appropriate font for the
3187 % note using that font specifier.
3188 %
3189 % \Macpackage uses \protect\cs{select@lemmafont} in a standard footnote
3190 % format macro called \protect\cs{normalfootfmt}. The footnote formats
3191 % for each of the layers \texttt{A} to \texttt{E} are \protect\cs{let} equal
3192 % to \protect\cs{normalfootfmt}. So all the layers of the footnotes are
3193 % formatted in the same way.
3194 %
3195 %
3196 % \section{Verse}\label{verse}
3197 %
3198 % \subsection{Basic}
3199 %
3200 % \DescribeMacro{\stanza}
3201 % \DescribeMacro{\&}
3202 % Use \verb?\stanza? at the start of a stanza. Each line in a stanza
3203 % is ended by an ampersand (\verb+&+), and the stanza itself is ended
3204 % by putting \verb?\&? at the end of the last line.
3205 %
3206 % If you need to add brackets directly after \verb?\stanza?, \verb+&+ or \verb?\&?, add \cs{norelax}. Otherwise, the brackets will be interpreted as delimitation of an optional argument (cf.~\reff{contentverse})
3207 %
3208 %
3209 % \subsection{Define stanza indents}
3210 % \DescribeMacro{\stanzaindentbase}
3211 % Lines within a stanza may be indented. The indents are integer multiples
3212 % of the length \verb?\stanzaindentbase?, whose default value is 20pt.
3213 %
3214 % \DescribeMacro{\setstanzaindents}
3215 % In order to use the stanza macros, \textbf{one must set the indentation values}.
3216 % First the value of \verb+\stanzaindentbase+ should be set,
3217 % unless the default value 20pt is desired.
3218 % Every stanza line indentation is a multiple of this.
3219 %
3220 % To specify these
3221 % multiples one invokes, for example \\
3222 % \verb+\setstanzaindents{3,1,2,1,2}+. \\
3223 %
3224 % The numerical entries must be whole numbers, 0 or greater, separated by
3225 % commas without embedded spaces. The first entry
3226 % gives the hanging indentation to be used if the stanza line requires more
3227 % than one print line.
3228 %
3229 % If it is known that each stanza line will fit in one print line,
3230 % then this first entry should be 0; \TeX\ does less
3231 % work in this case, but no harm ensues if the hanging indentation is not
3232 % 0 but is never used.
3233 %
3234 % If you want the hanging verse to be flush right,
3235 % you can use \protect\cs{sethanginsymbol}: see p.~\reff{hfillhanging}.
3236 %
3237 % Enumeration is by stanza lines, not by print lines.
3238 % In the above example the lines are indented one unit, two units, one unit,
3239 % two units, with 3 units of hanging indentation in case a stanza line is too
3240 % long to fit on one print line.
3241 %
3242 % \subsection{Repeating stanza indents}
3243 %\changes{v0.13.0}{2011/11/08}{New stanzaindentsrepetition counter to repeat stanza indents every \emph{n} verses.}
3244 % \label{stanzaindentsrepetition}Since version 0.13, if the indentation is repeated every \emph{n} verses of the stanza, you can define only the \emph{n} first indentations, and indicate that they are repeated, defining the value of the \verb+stanzaindentsrepetition+ counter at \emph{n}. For example:
3245 %\begin{verbatim}
3246 %\setstanzaindents{5,1,0}
3247 %\setcounter{stanzaindentsrepetition}{2}
3248 % \end{verbatim}
3249 %
3250 % is like
3251 %\begin{verbatim}
3252 %\setstanzaindents{5,1,0,1,0,1,0,1,0,1,0}
3253 % \end{verbatim}
3254 %
3255 % \textbf{Be careful: the feature is changed in eledmac 1.5.1. See \reff{change151}.}
3256 %
3257 %If you don't use the \verb+stanzaindentsrepetition+ counter, make sure you have at least one more numerical
3258 % entry in \verb+\setstanzavalues+ than the number of lines in the stanza.
3259 %
3260 % If you want to disable this feature again, just put the counter to 0:
3261 % \begin{verbatim}
3262 % \setcounter{stanzaindentsrepetition}{0}
3263 % \end{verbatim}
3264 % The macro makes no restriction on the number of lines in a stanza.
3265 %
3266 % Sometime, it is useful to repeat the indents only after some lines of verse.
3267 % You can set the counter \verb+startstanzaindentsrepetition+ to do that.
3268 % Its default value is \verb+1+, that means the repetition starts with line of verse number~1.
3269 %
3270 % For example, you may want to have no indent for the first line, and all other lines been indented by 1.
3271 % So do
3272 % \begin{verbatim}
3273 % \setstanzaindents{1,0,1}
3274 % \setcounter{stanzaindentsrepetition}{1}
3275 % \setcounter{startstanzaindentsrepetition}{2}
3276 % \end{verbatim}
3277 % \subsection{Notes about the scope of the indent settings}
3278 % Stanza indentation values (and penalty values) obey \TeX's grouping
3279 % conventions, so if one stanza among several has a different structure,
3280 % its indentations (penalties) may be set within a group; the prior values
3281 % will be restored when the group ends.
3282 %
3283 % \subsection{Manual stanza indent}
3284 % \DescribeMacro{\stanzaindent}
3285 % \DescribeMacro{\stanzaindent*}
3286 % You can set the indent of some specific verse by calling \protect\cs{stanzaindent}\marg{value} at the beginning of the verse, before any other character. In this case, the indent defined by \protect\cs{setstanzaindents} for this verse is skipped, and \marg{value} is used instead.
3287 %
3288 % If you use the mechanism of indent repetition, the next verse will be printed as it should be even if the current verse would have its normal indent value.
3289 % In other words, using \protect\cs{stanzaindent} in a verse does not shift the indent repetition.
3290 %
3291 % However, if you want to shift the indent repetition, so the next verse has the indent normally used for the current verse, use \protect\cs{stanzaindent*} instead of \protect\cs{stanzaindent}.
3292 % \subsection{Stanza breaking}
3293 % \DescribeMacro{\setstanzapenalties}
3294 % When the stanzas run over several pages, it is often
3295 % desirable that page breaks should arise between certain lines in the
3296 % stanza, so a facility for including penalties after stanza lines is
3297 % provided. If you are satisfied with the page breaks, you need not set the
3298 % penalty values.
3299 %
3300 % The command \\
3301 % \verb+\setstanzapenalties{1,5000,10100,5000,0}+ \\
3302 % results in a penalty of
3303 % 5000 being placed after the first and third lines of the stanza, and a
3304 % penalty of ${-100}$ after the second.
3305 %
3306 % The first entry \enquote{1} is a control
3307 % value. If it is zero, then no penalties are passed on to \TeX,
3308 % which is the default. Values between 0 and 10000 are penalty
3309 % values; values between 10001 and 20000 have 10000 subtracted and the result
3310 % is given as a negative penalty. The mechanism used for indentations and
3311 % penalties requires unsigned values less than 32768. No penalty is placed
3312 % after the last line, so the final \verb+,0+ in the example above could
3313 % be omitted. A penalty of 10000 will prevent a page break; such a
3314 % penalty is included automatically where there is stanza hanging indentation.
3315 % A penalty of ${-10000}$ (corresponding to the entry value 20000 in this
3316 % context) forces a page break. Values in between act as suggestions as to the
3317 % desirability of a page break at a given line. There is a subtle interaction
3318 % between penalties and \emph{glue}, so it may take some adjustment of skips
3319 % and penalties to achieve the best results.
3320 % \subsection{Hanging symbol}
3321 % It is possible to insert a symbol in each line of hanging verse, as in French typography; for example, the opening bracket \enquote{[}. To insert it in \macpackage, use macro \DescribeMacro{\sethangingsymbol}\protect\cs{sethangingsymbol}\marg{h} with this code.
3322 % In the example of French typography, do
3323 % \begin{verbatim}
3324 % \sethangingsymbol{[\,}
3325 % \end{verbatim}
3326 % \label{hfillhanging} You can also use it to force hanging verse to be flush right:
3327 % \begin{verbatim}
3328 % \sethangingsymbol{\protect\hfill}
3329 % \end{verbatim}
3330 % \subsection{Long verse and page break}
3331 % If you want to prevent page breaks inside long verses, use the option \verb+nopbinverse+ when loading package, or use \protect\cs{lednopbinversetrue}.
3332 % Read \reff{lednopbinversetrue} for further details.
3333 % \subsection{Content before/after verses}\label{contentverse}
3334 % It is possible to add content, like a subtitle or a spacing, before or after verse:
3335 % \begin{itemize}
3336 % \item The \protect\cs{stanza} command can take an optional argument (in brackets). Its content will be printed before the stanza. A \cs{noindent} is inserted before the content of first optional argument.
3337 % If you don't want this \cs{noindent}, you can use the second optional argument (also in brackets):
3338 % \begin{verbatim}
3339 % \stanza[foo] % \noindent is inserted before foo.
3340 % \stanza[][foo] % There is no \noindent inserted before foo.
3341 % \end{verbatim}
3342 %
3343 % \item \DescribeMacro{\AtEveryStanza} Use \cs{AtEveryStanza}\marg{arg} to automatically add content before stanzas (not in the same paragraph).
3344 %
3345 % Note that a \cs{noindent} will be inserted before the argument, and, consequently, a \cs{parskip}. You can use the starred version of \protect\cs{AtEveryStanza} to avoid this \cs{noindent}.
3346 % \item \DescribeMacro{\AtStartEveryStanza} Use \cs{AtStartEveryStanza} to automatically add content at the beginning of stanzas (in the same paragraph).
3347 % \item \verb+&+ can be replaced by \protect\cs{newverse} with two optional arguments (in brackets). The first will be printed after the current verse, the second before the next verse.
3348 %
3349 % A \cs{noindent} is automatically inserted before the contents of these optional arguments.
3350 %
3351 % Use a third and fourth optional argument to not add these \cs{noindent}s (to add content respectively after the current verse / before the next verse).
3352 % \item Use \cs{AtEveryPend}\marg{arg} to automatically add content after verses (including the final one) and \cs{AtEveryPstart}\marg{arg} to automatically add content before verses (including the first one).
3353 % \item \verb+\&+ can take an optional argument (in brackets). Its content will be printed after the stanza.
3354 %
3355 % \item \DescribeMacro{\AtEveryStopStanza} Use \cs{AtEveryStopStanza} to automatically add content after the end of stanzas (not in the same paragraph).
3356 %
3357 % Note that a \cs{noindent} will be inserted before the argument, and, consequently, a \cs{parskip}. You can use the starred version of \protect\cs{AtEveryStopStanza} to avoid this \cs{noindent}.
3358 %
3359 % \item \DescribeMacro{\BeforeEveryStopStanza} Use \cs{BeforeEveryStopStanza} to automatically add content at the end of stanzas (in the same paragraph).
3360 % \end{itemize}
3361 %
3362 %
3363 % \subsection{Numbering stanza}\label{numbering-stanza}
3364 % \DescribeMacro{\numberstanzatrue}
3365 % \DescribeMacro{\numberstanzafalse}
3366 % If you want to automatically number stanzas, use \cs{numberstanzatrue}.
3367 % In this case, the line number will restart at each \cs{stanza}.
3368 %
3369 %
3370 % If you want to disable this feature again, use \cs{numberstanzafalse}.
3371 %
3372 % You can use this feature in combination with \cs{Xstanza} (\reff{Xstanza}).
3373 %
3374 % \DescribeMacro{thestanza}
3375 % You can redefine \cs{thestanza} to change the aspect of stanza number.
3376 % Default value is:
3377 % \begin{verbatim}
3378 % \renewcommand{\thestanza}{%
3379 % \textbf{\arabic{stanza}}%
3380 % }
3381 %
3382 % \end{verbatim}
3383 %
3384 % You can change the value of the \verb+stanza+ counter with the usual commands of \LaTeX.
3385 %
3386 % \DescribeMacro{\stanzanumwrapper}
3387 % You can redefine \cs{stanzanumwrapper} in order to modify the way the stanza number is inserted in the flow of text.
3388 % Default value is:
3389 % \begin{verbatim}
3390 % \newcommand{\stanzanumwrapper}[1]{%
3391 % \flagstanza{#1}%
3392 %}
3393 % \end{verbatim}
3394 % \DescribeMacro{\antilabe}
3395 % \subsection{Antilabe}\label{antilabe}
3396 % In dramatic text, it may happen that a line of verse is split between two speakers.
3397 % Thats is called \enquote{antilabe}.
3398 % In this case, the typesetting of the second half must start at the horizontal position where the typesetting of the first half stops.
3399 %
3400 % \Reledmac\ provides tools to cope with this problem, but you must enable them with the \option{antilabe} option when loading package, as these tools are quite ressource consuming.
3401 %
3402 % The \cs{antilabe}\marg{name} must be called at the beginning of the second half of the line of verse.
3403 %
3404 % Its \meta{name} argument is the name of the speaker.
3405 % Because of the way \TeX\ expand argument, you can use one the following syntax:
3406 % \begin{itemize}
3407 % \item \verb+\antilabe{name}+, if you typeset the character name;
3408 % \item \verb+\antilabe\command+, if the character name is defined in a command, like with the \package{thalie} package;
3409 % \item \verb+\antilabe{}+, if you do not type the character name.
3410 % \end{itemize}
3411 % See the file \href{examples/2-antilabe.tex}{examples/2-antilabe.tex} for an example of use.
3412 %
3413 % \DescribeMacro{\beforeantilabe}
3414 % \DescribeMacro{\afterantilabe}
3415 % You can execute any arbitrary code before or after \cs{antilabe} macro just with a redefinition of \cs{beforeantilabe} or \cs{afterantilabe}.
3416 % For example, to add more space, just do:
3417 % \begin{verbatim}
3418 % \renewcommand{\afterantilabe}{\hspace{1em}}
3419 % \end{verbatim}
3420 % \subsection{Various tools}
3421 % \DescribeMacro{\ampersand}
3422 % If you need to print an \& symbol in a stanza, use the \verb?\ampersand?
3423 % macro, not \verb?\&? as this will end the stanza.
3424 %
3425 % \DescribeMacro{\flagstanza}
3426 % Putting \protect\cs{flagstanza}\oarg{len}\marg{text} at the start of a line
3427 % in a stanza (or elsewhere) will typeset \meta{text} at a
3428 % distance \meta{len} before
3429 % the line. The default \meta{len} is \verb?\stanzaindentbase?.
3430 %
3431 % \subsection{Notes on empty lines}
3432 % Since v2.3.0 of \reledmac, empty lines when typesetting verses no longer produce new paragraphs, and consequently, do not insert vertical spaces.
3433 % Use optional argument of \cs{stanza} or \cs{newverse} to insert vertical space (\reff{contentverse}).
3434 % \section{Grouping}
3435 % In a \verb?minipage? environment \LaTeX\ changes \verb?\footnote? numbering from
3436 % arabic to alphabetic and puts the footnotes at the end of the minipage.
3437 %
3438 % \DescribeEnv{minipage}
3439 % You can put numbered text with critical footnotes in a minipage and
3440 % the footnotes are set at the end of the minipage.
3441 %
3442 % You can also put familiar footnotes (see section~\ref{sec:desc:familiar})
3443 % in a minipage but unlike with \verb?\footnote? the numbering scheme is
3444 % unaltered.
3445 %
3446 % \DescribeEnv{ledgroup}\label{ledgroup}
3447 % Minipages, of course, are not broken across pages. Footnotes in a \verb?ledgroup?
3448 % environment are typeset at the end of the environment, as with minipages,
3449 % but the environment includes normal page breaks. The environment makes no
3450 % change to the textwidth so it appears as normal text; it just might be that
3451 % footnotes appear in the middle of a page, with text above and below.
3452 %
3453 % \DescribeEnv{ledgroupsized}
3454 % The \verb?ledgroupsized? environment is similar to \verb?ledroup? except that
3455 % you must specify a width for the environment, as with a minipage. \\
3456 % \verb?\begin{ledgroupsized}?\oarg{pos}\marg{width}.
3457 %
3458 % The required \meta{width} argument is the text width for the environment. The
3459 % optional \meta{pos} argument is for positioning numbered text within
3460 % the normal textwidth. It may be one of the characters:
3461 % \begin{itemize}
3462 % \item[l] (left) numbered text is flush left with respect to the normal
3463 % textwidth. This is the default.
3464 % \item[c] (center) numbered text is in the center of the textwidth.
3465 % \item[r] (right) numbered text is flush right with respect to the
3466 % normal textwidth.
3467 % \end{itemize}
3468 % Note that normal text, footnotes, and so forth are all flush left.
3469 %
3470 % \verb?\begin{ledgroupsized}{\textwidth}? is effectively the same as
3471 % \verb?\begin{ledgroup}?
3472 %
3473 %
3474 %
3475 %
3476 %
3477 % \section{Cross referencing}
3478 % \changes{v1.12.0}{2014/08/05}{Add hyperlink to crossref (needs \protect\package{hyperref} package).}
3479 % \label{crossref}\relax
3480 % The package provides a simple cross-referencing facility that allows
3481 % you to mark places in the text with labels, and generate page and
3482 % line number references to those places elsewhere
3483 % using those labels.
3484 %
3485 % \subsection{Basic use}
3486 %
3487 % \DescribeMacro{\edlabel}
3488 % First you place a label in the text using the command
3489 % \protect\cs{edlabel}\marg{lab}. \meta{lab} can be almost anything you like, including
3490 % letters, numbers, punctuation, or a combination---anything but spaces;
3491 % you might type \protect\cs{edlabel}\verb+{toves-3}+, for example.\footnote{More precisely,
3492 % you should stick to characters in the \TeX\ categories of \enquote{letter}
3493 % and \enquote{other}.}
3494 %
3495 % \DescribeMacro{\edpageref}
3496 % \DescribeMacro{\edlineref}
3497 % \DescribeMacro{\sublineref}
3498 % \DescribeMacro{\pstartref}
3499 % \DescribeMacro{\annotationref}
3500 % Elsewhere in the text, either before or after the \protect\cs{edlabel},
3501 % you can refer to its location with \protect\cs{edpageref}\marg{lab},
3502 % \protect\cs{edlineref}\marg{lab}, \cs{edsublineref}\marg{lab}, \cs{pstartref}\marg{lab} or \cs{annotationref}\marg{lab},
3503 % that
3504 % will produce, respectively, the page, line, sub-line, pstart, the annotation, on which
3505 % the \protect\cs{edlabel}\marg{lab} command occurred.
3506 %
3507 % Note that the \cs{edlineref} command insert the side flag after the line number.
3508 %
3509 %
3510 % An \protect\cs{edlabel} command may appear in the main text, or in the
3511 % first argument of \protect\cs{edtext}, but not in the apparatus itself. But
3512 % \protect\cs{edpageref}, \protect\cs{edlineref}, \protect\cs{sublineref}, \protect\cs{pstartref} commands can also be used in
3513 % the apparatus to refer to \protect\cs{edlabel}s in the text.
3514 %
3515 % The \protect\cs{edlabel} command works by writing macros to \LaTeX
3516 % \file{.aux} file. You will need to process
3517 % your document through \LaTeX\ twice in order for the references to
3518 % be resolved.
3519 %
3520 % You will be warned if you use \verb"\edlabel{foo}" and \verb"foo"
3521 % has been used as a label before. The \verb"ref" commands will
3522 % return references to the last place in the file marked with this
3523 % label. You will also be warned if a reference is made to an
3524 % undefined label. (This will also happen the first time you
3525 % process a document after adding a new \protect\cs{edlabel} command: the
3526 % auxiliary file will not have been updated yet.)
3527 %
3528 % \subsection{Cross-referencing to a critical note}
3529 % If you want to refer to a word which is a lemma word, the \cs{edlabel} command should be in the first argument of \cs{edtext} command.
3530 %
3531 % If you want to refer to the content of a \cs{Xfootnote}, the line and subline number printed will be the start line.
3532 %
3533 % If you want to refer to starting and ending lines, you should use \cs{appref} and related tools (\reff{appref}).
3534 % \subsection{Cross-referencing which return a number in any case}
3535 % \DescribeMacro{\xpageref}
3536 % \DescribeMacro{\xlineref}
3537 % \DescribeMacro{\xsublineref}
3538 % \DescribeMacro{\xpstartref}
3539 % \DescribeMacro{\xannotationref}
3540 %
3541 % However, there are situations in which you will want \macpackage\ to
3542 % return a number without displaying any
3543 % warning messages about undefined labels or the like: if you want to
3544 % use the reference in a context where \LaTeX{} is looking for a
3545 % number, such a warning will lead to a complaint that the number
3546 % is missing.
3547 % This is the case for references used within the
3548 % argument to \protect\cs{linenum}, for example (see \reff{linenum}).
3549 %
3550 %For this situation,
3551 % \macpackage\ supplies variants of the reference commands, with the \verb"x"
3552 % prefix: \cs{xpageref}, \cs{xlineref}, \cs{xsublineref}, \cs{xpstartref} and \cs{xannotationref}.
3553 % They have the following limitations:
3554 % \begin{itemize}
3555 % \item They will not tell you if the label is undefined.
3556 % \item They must
3557 % be preceded in the file by at least one of the four other
3558 % cross-reference commands---e.g., a \verb"\edlabel{foo}" command,
3559 % even if you never refer to that label---since those commands can all
3560 % do the necessary processing of the \file{.aux} file, and the \protect\cs{x...}
3561 % ones cannot.
3562 % \item When \protect\package{hyperref} is loaded, the hyperref link will not be added. (Indeed,
3563 % it is not a limitation, but a feature.)
3564 % \item With \parpackage, the \cs{xlineref} does not insert the right side flag, in order to obtain a line number. Use \cs{xflagref} to obtain the side flag, depending on your flag.
3565 % \end{itemize}
3566 %
3567 % \subsubsection{Cross-referencing in order to define line number of a critical note}
3568 % \DescribeMacro{\xxref}
3569 %
3570 % The \protect\cs{xxref}\marg{lab1}\marg{lab2} command generates a reference to a sequence of
3571 % lines, for use in the second argument of \protect\cs{edtext}.
3572 % It takes two arguments, both of which are
3573 % labels: e.g., \verb"\xxref{mouse}{elephant}".
3574 %
3575 % It automatically calls \protect\cs{linenum}
3576 % (\reff{linenum}) and \cs{lineannot} (\reff{lineannot}) and sets the beginning page,
3577 % line, subline numbers and line annotations to those of the place where
3578 % \verb"\edlabel{mouse}" was placed, and the ending ones to those where
3579 % \verb"\edlabel{elephant}" occurs.
3580 %
3581 % For example, one might use the following:
3582 % \begin{verbatim}
3583 %\beginnumbering
3584 %
3585 %\pstart
3586 %\edlabel{Queritur}Queritur utrum metaphysica sit scientia una.
3587 %\pend
3588 %
3589 %\pstart
3590 %\edtext{Et videtur quod non\edlabel{non}.}{\xxref{Queritur}{non}\lemma{queritur \dots{} non}\Afootnote{om. \emph{A}}}
3591 %\pend
3592 %
3593 %\endnumbering
3594 % \end{verbatim}
3595 % \subsection{Not automatic cross-referencing}
3596 % \DescribeMacro{\edmakelabel}
3597 % Sometimes the \protect\cs{edlabel} command cannot be used to specify exactly
3598 % the page and line desired---for example, if you want to refer to a
3599 % page and line number in another volume of your edition. In such
3600 % cases, you can use the \protect\cs{edmakelabel}\marg{lab}\marg{numbers}
3601 % macro so that you can \enquote{roll your own} label.
3602 %
3603 % For example, if you type \verb"\edmakelabel{elephant}{10|25|0}"
3604 % you will create a new label, and a later call to \verb"\edpageref{elephant}" would print
3605 % \enquote{10} and \verb"\lineref{elephant}" would print \enquote{25}. The sub-line
3606 % number here is zero. It is usually best to collect your
3607 % \protect\cs{edmakelabel} statements near the top of your document, so that
3608 % you can see them at a glance.
3609 % \subsection{Normal \LaTeX\ cross-referencing}
3610 % \DescribeMacro{\label}
3611 % \DescribeMacro{\ref}
3612 % \DescribeMacro{\pageref}
3613 % \changes{v0.2.1}{2003/08/25}{Added text about normal labeling}
3614 % The normal \protect\cs{label}, \protect\cs{ref} and \protect\cs{pageref} macros may be used
3615 % within numbered text, and operate in the familiar fashion.
3616 % \subsection{References to start and end lines}
3617 % \subsubsection{Reference to main text lines}
3618 % \changes{v2.5.0}{2015/11/13}{New tools to easily make cross-reference to a passage defined by a start and an end line}
3619 % Many times, you may want to make a cross-reference to a passage that is defined by a start line and an end line.
3620 % \Macpackage\ provides specific tools for this scenario.
3621
3622 % \DescribeMacro{\edlabelS}
3623 % Use \cs{edlabelS}\marg{label} to mark the start line of the passage.
3624 %
3625 % \DescribeMacro{\edlabelE}
3626 % Use \cs{edlabelE}\marg{label} to mark the end the end line of the passage.
3627 % These two commands just create two labels which are named \meta{label}\verb+:start+ and \meta{label}\verb+:end+.
3628 %
3629 % \DescribeMacro{\edlabelSE}
3630 % Use \cs{edlabelSE}\marg{label} to mark just one location in the text. Contrary to a classical \cs{edlabel}, the \meta{label} could be use with \cs{SEref} and \cs{SErefwithpage}.
3631 %
3632 %
3633 % The main utility is to use them with three other commands.
3634 % \DescribeMacro{\SEref}
3635 % \cs{SEref}\marg{label} will make a cross-reference printed as a reference in critical footnotes.
3636 %
3637 % \DescribeMacro{\SErefwithpage}
3638 % \cs{SErefwithpage} will make a cross-reference printed as a reference in critical endnotes.
3639 %
3640 % \DescribeMacro{\SErefonlypage}
3641 % \cs{SErefonlypage} will make a cross-reference printed only with page number.
3642 %
3643 % \subsubsection{References to lines that are commented on in the apparatus}\label{appref}
3644 % \changes{v1.21.0}{2015/03/09}{Add \protect\cs{applabel} and related}
3645 % You may want to make a cross-reference to a passage that is referred to by \protect\cs{edtext}.
3646 % \Macpackage\ provides specific tools for this scenario.
3647 %
3648 % \DescribeMacro{\applabel}
3649 % If you use \protect\cs{applabel}\marg{label} inside the second argument of a \protect\cs{edtext},
3650 % \Macpackage\ will add a \protect\cs{edlabel} at the beginning and end of the marked passage.
3651 % The label at the beginning of the passage will have the title \meta{label}\verb+:start+, while the label at the end will have the title \meta{label}\verb+:end+.
3652 %
3653 % If you use \protect\cs{linenum} (\reff{linenum}) to
3654 % refer to these labels, \macpackage\ will use your line settings to refer
3655 % to the passage.
3656 %
3657 % \DescribeMacro{\appref}\DescribeMacro{\apprefwithpage}
3658 % You can also use \protect\cs{appref}\marg{label} and
3659 % \protect\cs{apprefwithpage}\marg{label} to refer to these lines.
3660 % The first one will print the lines as they are printed in the critical footnotes,
3661 % while the second will print the lines as they are printed in endnotes.
3662 %
3663 % \subsubsection{Settings}
3664 % \paragraph{Specific to these tools}
3665 % \DescribeMacro{\setapprefprefixsingle}\DescribeMacro{\setapprefprefixmore}
3666 % If you use \protect\cs{apprefprefixsingle}\marg{prefix}, \meta{prefix} will be printed
3667 % before the line numbers of a \protect\cs{appref}-reference.
3668 % If you use \protect\cs{apprefprefixmore}\marg{prefix}, \meta{prefix} will be printed
3669 % before the line numbers, if you refer to more than one line.
3670 %
3671 % For example, you may use:
3672 % \begin{verbatim}
3673 % \setapprefprefixsingle{line~}
3674 % \setapprefprefixmore{lines~}
3675 % \end{verbatim}
3676 %
3677 % Note that if you do not use \protect\cs{setapprefprefixmore}, the argument of \protect\cs{setapprefprefixsingle} will be used in any case.
3678 %
3679 %
3680 % \DescribeMacro{\setSErefprefixsingle}\DescribeMacro{\setSErefprefixmore}
3681 % \cs{setSErefprefixsingle} and \cs{setSErefprefixmore} are similar for \cs{SEref} command.
3682 %
3683 % \DescribeMacro{\setSErefonlypageprefixsingle}
3684 % \DescribeMacro{\setSErefonlypageprefixmore}
3685 % Use \cs{setSErefonlypageprefixsingle}\marg{prefix} to set the page prefix for \cs{SErefonlypage} when there is only one page.
3686 % Use \cs{setSErefonlypageprefixmore}\marg{prefix} to set it when there is more than one page.
3687 % For example:
3688 % \begin{verbatim}
3689 % \setSErefonlypageprefixsingle{p.~}
3690 % \setSErefonlypageprefixmore{pp.~}
3691 % \end{verbatim}
3692 % Note that if you do not use \cs{setSErefonlypageprefixmore}, the value of \cs{setSErefonlypageprefixsingle} is used instead.
3693 %
3694 %
3695 % \textbf{Also note that \cs{setSErefonlypageprefixsingle} is only a shortcut for \cs{XendbeforepagenumberSErefonlypage} (see \reff{crossrefsetting:linked}).
3696 % So if you use \cs{Xendbeforepagenumber} without any optional argument, it will override this setting.}
3697 % \paragraph{Linked to setting of critical footnotes and endnotes}\label{crossrefsetting:linked}
3698 % Some commands which set the appearance of line numbers in critical footnotes also set the appearance of line numbers in \cs{appref} and \cs{SEref} if called \emph{without the optional series argument}.
3699 %
3700 % These commands are the following:
3701 % \begin{itemize}
3702 % \item \cs{Xlineflag} (for \parpackage), enabled by default.
3703 % \item \cs{Xlinerangeseparator}
3704 % \item \cs{Xmorethantwolines}
3705 % \item \cs{Xsublinesep}
3706 % \item \cs{Xtwolines}
3707 % \item \cs{Xtwolinesbutnotmore}
3708 % \item \cs{Xtwolinesonlyinsamepage}
3709 % \item \cs{Xlinenumannotationposition}
3710 % \item \cs{Xwraplinenumannotation}
3711 % \item \cs{Xnoidenticallinenumannotation}
3712 % \end{itemize}
3713 %
3714 % If you want to make settings specific to \cs{appref} or \cs{SEref}, just call them with an optional argument containing a comma-separated list of command names (for example \verb+appref,SEref+) or with a suffix equal to the command name (for example \verb+appref+).
3715 %
3716 %
3717 % The same principle is available for \cs{apprefwithpage}, \cs{SErefwithpage} and \cs{SErefonlypage} with the following commands:
3718 % \begin{itemize}
3719 % \item\cs{Xendafterpagenumber} (not for \cs{SErefonlypage})
3720 % \item\cs{Xendbeforepagenumber}
3721 % \item\cs{Xendlineflag} (for \parpackage), enabled by default.
3722 % \item\cs{Xendlineprefixmore}
3723 % \item\cs{Xendlineprefixsingle}
3724 % \item\cs{Xendlinerangeseparator}
3725 % \item\cs{Xendmorethantwolines}
3726 % \item\cs{Xendsublinesep}
3727 % \item\cs{Xendtwolines}
3728 % \item\cs{Xendtwolinesbutnotmore}
3729 % \item\cs{Xendtwolinesonlyinsamepage}
3730 % \item\cs{Xendlinenumannotationposition}
3731 % \item\cs{Xendwraplinenumannotation}
3732 % \item\cs{Xendnoidenticallinenumannotation}
3733 % \end{itemize}
3734 % \paragraph{For one specific command}
3735 %
3736 % When calling \cs{appref} and \cs{SEref}, you can use as a first optional argument, in brackets (\verb+[]+), any optional argument which can be used for critical footnotes (\reff{Xfootnoteopt}).
3737 %
3738 % When calling \cs{apprefwithpage}, \cs{SErefwithpage} or \cs{SErefonlypage} you can use as a first optional argument, in brackets (\verb+[]+), any optional argument which can be used for critical endnotes (\reff{Xendnoteopt}).
3739 %
3740 % \subsubsection{Combining multiple references}
3741 %
3742 % When combining multiple cross references into a list, it is possible to prevent prefixes reappearing by adding an optional argument to \cs{appref} and \cs{SEref}. The available options are:
3743 % \begin{itemize}
3744 % \item \option{noprefix} to remove any prefix set by \cs{setapprefprefixsingle} or the equivalent for a single reference;
3745 % \item \option{prefixmore} to force the plural version of a prefix.
3746 % \end{itemize}
3747 %
3748 % For example, a reference to \enquote{lines 65--66, 72, and 75} might use \verb|\SEref[prefixmore]{ref1}, \SEref[noprefix]{ref2}, and \SEref[noprefix]{ref3}| to achieve this result.
3749 %
3750 % \subsection{Compatibility with \protect\package{xr} package}
3751 % The \cs{externaldocument} command of the \cs{xr} package allows making cross-references from an external document, with the standard \LaTeX\ commands \cs{label} and \cs{ref} (and related).
3752 %
3753 % To use it with the \macpackage\ cross-reference commands (i.e. \cs{edlabel} and related), you must do the following:
3754 % \begin{enumerate}
3755 % \item Load the \package{xr} package.
3756 % \item Load the \package{reledmac} package.
3757 % \item Use the \cs{externaldocument} document command.
3758 % \end{enumerate}
3759 % \section{Sidenotes}
3760 %
3761 % \subsection{Basics}
3762 % The \protect\cs{marginpar} command does not work in numbered text. Instead,
3763 % the package provides for non-floating sidenotes in either margin.
3764 %
3765 % \DescribeMacro{\ledinnernote}
3766 % \DescribeMacro{\ledouternote}
3767 % \protect\cs{ledinnernote}\marg{text} will put \meta{text} into the inner margin level
3768 % with where the command was issued. Similarly, \protect\cs{ledouternote}\marg{text}
3769 % puts \meta{text} in the outer margin.
3770 %
3771 % \changes{v1.12.0}{2014/08/05}{Add \protect\cs{ledinnernote} and \protect\cs{ledouternote} commands.}
3772 % \changes{v1.12.3}{2014/08/15}{Debug \protect\cs{ledinnernote} and \protect\cs{ledouternote} commands in the top of pages.}
3773 % \DescribeMacro{\ledleftnote}
3774 % \DescribeMacro{\ledrightnote}
3775 % \changes{v1.0.0}{2012/09/15}{Possibility to have commands in sidenotes.}
3776 % \DescribeMacro{\ledsidenote}
3777 % \DescribeMacro{\sidenotemargin}
3778 % \protect\cs{ledsidenote}\marg{text} will put \meta{text} into the margin specified
3779 % by the current setting of \protect\cs{sidenotemargin}\marg{location}. The
3780 % permissible value for \meta{location} is one out of the list
3781 % \texttt{left}, \texttt{right}, \texttt{inner}, or \texttt{outer}, for
3782 % example \verb?\sidenotemargin{outer}?. The package's default setting
3783 % is \\
3784 % \verb?\sidenotemargin{right}? \\
3785 % to typeset \protect\cs{ledsidenote}s in the right hand margin.
3786 % This is the opposite of the default margin for line numbers. The style for a \protect\cs{ledsidenote}
3787 % follows that for a \protect\cs{ledleftnote} or a \protect\cs{ledrightnote} depending
3788 % on the margin it is put in.
3789 %
3790 % If two note commands for the same side are called in the same line, they will
3791 % be appended and separated by a comma.
3792 %
3793 % \textbf{The notes will appear only after the second \LaTeX\ run. If the note positions change in your \texttt{.tex} file,
3794 % you need two runs to get the correction position in the output file.
3795 % You are strongly encouraged to use tools like \emph{latexmk}, to be sure to get the correct number of runs.}
3796 % \subsection{Setting}
3797 %
3798 % \subsubsection{Width}
3799 % \DescribeMacro{\ledlsnotewidth}
3800 % \DescribeMacro{\ledrsnotewidth}
3801 % The left sidenote text is put into a box of width \protect\cs{ledlsnotewidth}
3802 % and the right text into a box of width \protect\cs{ledrsnotewidth}. These
3803 % are initially set to the value of \protect\cs{marginparwidth}.
3804 %
3805 % \subsubsection{Vertical position}
3806 % \DescribeMacro{\rightnoteupfalse}
3807 % \DescribeMacro{\leftnoteupfalse}
3808 % By default, sidenotes are placed to align with the last line of the note to which it refers.
3809 % If you want they to be placed to align with the first line of the note to which it refers, use \protect\cs{leftnoteupfalse} (for left note) and/or \protect\cs{rightnoteupfalse} (for right note).
3810 %
3811 % \subsubsection{Distance to the main text }
3812 % \DescribeMacro{\ledlsnotesep}
3813 % \DescribeMacro{\ledrsnotesep}
3814 % The texts are put a distance \protect\cs{ledlsnotesep} (or \protect\cs{ledrsnotesep})
3815 % into the left (or right) margin. These lengths are initially set to
3816 % the value of \protect\cs{linenumsep}.
3817 %
3818 % \subsubsection{Font}
3819 % \DescribeMacro{\ledlsnotefontsetup}
3820 % \DescribeMacro{\ledrsnotefontsetup}
3821 % These macros specify how the sidenote texts are to be typeset. The
3822 % initial definitions are:
3823 % \begin{verbatim}
3824 % \newcommand*{\ledlsnotefontsetup}{\raggedleft\footnotesize}% left
3825 % \newcommand*{\ledrsnotefontsetup}{\raggedright\footnotesize}% right
3826 % \end{verbatim}
3827 % These can of course be changed to suit.
3828 %
3829 % \subsubsection{Separator between notes}
3830 % \DescribeMacro{\setsidenotesep}
3831 % If you have two or more sidenotes for the same line, they are separated by a comma.
3832 % But if you want to change this separator, you can use \protect\cs{setsidenotesep}\marg{sep}.
3833 %
3834 % \section{Indexing}
3835 %
3836 % \subsection{Basics}
3837 % \DescribeMacro{\edindex}
3838 % \LaTeX\ provides the |\index|\marg{item} command for specifying that \meta{item}
3839 % and the current page number should be added to the raw index (\file{idx}) file.
3840 % The |\edindex|\marg{item} macro can be used in numbered text to specify
3841 % that \meta{item} and the current page \& linenumber should be added to
3842 % the raw index file.
3843 %
3844 % Note that the file \verb+.idx+ will contain the right reference only after the third run, because of the internal indexing mechanism of \protect\macpackage.
3845 % That means you must first run (Xe/Lua)\LaTeX three times, then run \verb+makeindex+, and then finally run (Xe/Lua)\LaTeX\ again, in order to get an index with the right page numbers.
3846 %
3847 % Also note that using \cs{edtext} in familiar footnotes refers to the line where the footnotes are called
3848 % \subsection{Use with \package{imakeidx} or \package{indextools}}
3849 % If the \protect\package{imakeidx} or \protect\package{indextools} package is used then the macro takes an optional
3850 % argument, which is the name of a raw index file. For example
3851 % |\edindex[line]{item}| will use |line.idx| as the raw file instead of
3852 % |\jobname.idx|.
3853 %
3854 % The minimal version of \protect\package{imakeidx} package to be used is the version 1.3a uploaded on CTAN on 2013/07/11.
3855 %
3856 % Be careful with the order of package loading and index declaration. You must use this order:
3857 % \begin{enumerate}
3858 % \item Load \package{imakeidx} or \package{indextools} .
3859 % \item Load \macpackage.
3860 % \item Declare the index with the macro \cs{makeindex} of \package{imakeidx} and \package{indextools}.
3861 % \end{enumerate}
3862 %
3863 % \subsection{Referring to critical notes}
3864 % If you want to refer to a word inside an
3865 % \protect\cs{edtext}\marg{lemma}\marg{app} command, \protect\cs{edindex} should be defined inside
3866 % the first argument, e.g.,
3867 % \begin{verbatim}
3868 % The \edtext{creature\edindex{elephant} was quite
3869 % unafraid}{\Afootnote{Of the mouse, that is.}}
3870 % \end{verbatim}
3871 %
3872 % If you add \protect\cs{edindex} inside some \protect\cs{Xfootnote} command,
3873 % it will refer to that note, and a suffix \emph{n} will be appended to the reference.
3874 %
3875 % \DescribeMacro{\Xinnotemark}
3876 % \DescribeMacro{\innotemarkX}
3877 % You can redefine the way the reference is made using:
3878 % \begin{itemize}
3879 % \item \cs{Xinnotemark}\oarg{series}\marg{definition} for critical notes;
3880 % \item \cs{innotemarkX}\oarg{series}\marg{definition} for familiar notes;
3881 % \end{itemize}
3882 % In the \meta{definition} argument, you can use the following codes:
3883 % \begin{itemize}
3884 % \item \verb+#1+, which stands for footnote series;
3885 % \item \verb+##1+, which stands for reference (ie. page+line)
3886 % \end{itemize}
3887 % For example:
3888 % \begin{verbatim}
3889 % \Xinnotemark{##1\textsuperscript{#1}}
3890 % \end{verbatim}
3891 % \subsection{Separator between page and line numbers}
3892 % \DescribeMacro{\pagelinesep}\label{pagelinesep}
3893 % The page \& linenumber combination is written as |page\pagelinesep line|,
3894 % where the default definition is |\newcommand{\pagelinesep}{-}| so that
3895 % an item on page 3, line 5 will be noted as being at |3-5|. You can
3896 % renew |\pagelinesep| to get a different separator.
3897 %
3898 % |-| is the default
3899 % separator used by the \textsc{MakeIndex} program.
3900 %
3901 % You can reconfigure it, this example defines a colon as separator:
3902 % \begin{verbatim}
3903 % \renewcommand{\pagelinesep}{:}
3904 % \end{verbatim}
3905 %
3906 % However, you also have to configure your \verb+.ist+ index style file. For example, if you use \verb+:+ as separator\footnote{For further detail, you can read \url{http://tex.stackexchange.com/a/32783/7712}.}.
3907 % \begin{verbatim}
3908 % page_compositor ":"
3909 % \end{verbatim}
3910 %
3911 % Read the \textsc{MakeIndex} program's handbook about the \verb+.ist+ file.
3912 % \subsection{Using xindy}\label{xindy}
3913 % Should you decide to use \verb+xindy+ instead of \verb+makeindex+
3914 % to transform your \verb+.idx+ files into \verb+.ind+ files,
3915 % you must use some specific configuration file (\verb+.xdy+) so that
3916 % \verb+xindy+ can understand \protect\package{eledmac} reference syntax of which the scheme is:\\
3917 % \verb+pagenumber-linenumber+
3918 %
3919 % An example of such a file is provided in the \enquote{\href{examples/.}{examples}} folder.
3920 % Read the xindy handbook to learn how to use it.\footnote{Or, for people
3921 % who read French, read \url{http://geekographie.maieul.net/174}.}
3922 %
3923 % This file also provides, with an explanation, the settings that are needed to put
3924 % \macpackage\ lines numbers in parenthesis, in order
3925 % to make a better distinction between line numbers and page ranges.
3926 %
3927 % In any case, you must load \macpackage\ with the \verb+xindy+ option,
3928 % in order to generate a \verb|.xdy| file which is specific to your document.
3929 % This file is needed by the \verb+.xdy+ example file which is in the \enquote{\href{examples/.}{examples}} folder.
3930 % Its default name is \verb+reledmac-markup-attr.xdy+,
3931 % but you can change it by using your own as an argument of the \verb|xindy+hyperref| option.
3932 %
3933 % If you choose to use both \verb+xindy+ and the \verb+hyperref+ package,
3934 % you must do three more things:
3935 % \begin{enumerate}
3936 % \item Use \verb|xindy+hyperref| option when loading the \macpackage\ package.
3937 % When you run (Xe/Lua)\LaTeX with this option, a \verb+.xdy+ configuration file will be generated with all the settings needed to allow internal hyperlinking in each index entry which is created by \protect\cs{edindex}.
3938 % \item Use \verb+hyperindex=false+ option when loading hyperref.
3939 % \item Uncomment\,---\,by removing the semicolons at the beginning of the relevant lines\,---\,some lines in the <code>.xdy</code> file provided in the \enquote{\href{examples/.}{examples}} folder in order to restore internal links in the index to be used by the standard \verb+index+ command.\footnote{These are the recommended lines to provide the best possible compatibility between hyperref and xindy, even without using \macpackage.}.
3940 % \end{enumerate}
3941 % \subsection{Advanced setting}
3942 % \DescribeMacro{\edindexlab}
3943 % The \protect\cs{edindex} process uses a \protect\cs{label} and \protect\cs{ref} mechanism to get
3944 % the correct line number. It automatically generates labels
3945 % of the form \protect\cs{label}\verb|{\edindexlab N}|, where N is a number, and
3946 % the default definition of \protect\cs{edindexlab} is: \\
3947 % |\newcommand*{\edindexlab}{$&}| \\
3948 % in the hopes that this will not be used by any other labels
3949 % (\protect\cs{edindex}'s labels are like \protect\cs{label}\verb|{$&27}|).
3950 % You can change \protect\cs{edindexlab} to something else if you need to.
3951 %
3952 % \section{Glossary}
3953 % \Macpackage\ provides mechanism to make glossaries with the \package{glossaries} package, refering not to the page, but to the page and line.
3954 % \subsection{Preamble setting}
3955 % When using \macpackage\ with \package{glossaries}, you must use also \package{glossaries-extra}.
3956 %
3957 % The standard compositor between page and line number in \macpackage\ is a dash, while \package{glossaries} uses, by default, a dot.
3958 % Consequently, you must:
3959 % \begin{itemize}
3960 % \item Or set .
3961 % \package{glossaries}:\\ \verb+\glsSetCompositor{-}+
3962 % \item Or set \reledmac:\\ \verb+\renewcommand{\pagelinesep}{.}+\\
3963 % In this case, the above will have consequences for your use of \cs{edindex} and you should set your \verb+.ist+ file (\reff{pagelinesep}).
3964 %
3965 % \end{itemize}
3966 % \subsection{Commands}
3967 % The \cs{gls}, \cs{Gls}, and related commands of \package{glossaries} packages have a prefixed version with \verb+ed+, which refers to the page line.
3968 % The argument are the same as for the standard commands.
3969 % So for example:\\
3970 % \cs{edgls}\oarg{options}\marg{label}\oarg{insert}
3971 % \section{Tabular material}
3972 %
3973 % \LaTeX's normal |tabular| and |array| environments cannot be used where
3974 % line numbering is being done; more precisely, they can be used but with
3975 % odd results, so don't use them. However, \macpackage\ provides some simple
3976 % tabulation environments that can be line numbered. The environments
3977 % can also be used in normal unnumbered text.
3978 %
3979 % \DescribeEnv{edarrayl}
3980 % \DescribeEnv{edarrayc}
3981 % \DescribeEnv{edarrayr}
3982 % \DescribeEnv{edtabularl}
3983 % \DescribeEnv{edtabularc}
3984 % \DescribeEnv{edtabularr}
3985 % There are six environments; the |edarray*| environments are for math
3986 % and |edtabular*| for text entries. The final |l|, |c|, or |r|
3987 % in the environment names indicate that the entries will be flushleft (|l|),
3988 % centered (|c|) or flushright (|r|). There is no means of specifying
3989 % different formats for each column, nor for specifying a fixed width for
3990 % a column. The environments are centered with respect to the surrounding text.
3991 %
3992 % \egstart
3993 % \begin{verbatim}
3994 % \begin{edtabularc}
3995 % 1 & 2 & 3 \\
3996 % a & bb & ccc \\
3997 % AAA & BB & C
3998 % \end{edtabularc}
3999 % \end{verbatim}
4000 % \egmid
4001 % \centering
4002 % \begin{tabular}{ccc}
4003 % 1 & 2 & 3 \\
4004 % a & bb & ccc \\
4005 % AAA & BB & C
4006 % \end{tabular}\par
4007 % \egend
4008 %
4009 % Entries in the environments are the same as for the normal
4010 % |array| and |tabular| environments but there must be no ending
4011 % \verb?\\? at the end of the last row.
4012 % \emph{There must be the same number of column designators (the \&)
4013 % in each row.} There is no equivalent
4014 % to any line drawing commands (such as \protect\cs{hline}).
4015 % However, unlike the normal environments, the |ed...| environments
4016 % can cross page breaks.
4017 %
4018 % Macros like \protect\cs{edtext} can be used as part of an entry.
4019 %
4020 % For example:
4021 % \begin{verbatim}
4022 % \beginnumbering
4023 % \pstart
4024 % \begin{edtabularl}
4025 % \textbf{\Large I} & wish I was a little bug\edindex{bug} &
4026 % \textbf{\Large I} & eat my peas with honey\edindex{honey} \\
4027 % & With whiskers \edtext{round}{\Afootnote{around}} my tummy &
4028 % & I've done it all my life. \\
4029 % & I'd climb into a honey\edindex{honey} pot &
4030 % & It makes the peas taste funny \\
4031 % & And get my tummy gummy.\edindex{gummy} &
4032 % & But it keeps them on the knife.
4033 % \end{edtabularl}
4034 % \pend
4035 % \endnumbering
4036 % \end{verbatim}
4037 % produces the following parallel pair of verses.
4038 %
4039 % \begin{center}
4040 % \setlength{\tabcolsep}{2pt}
4041 % \begin{tabular}{p{4em}rlrl}
4042 % {\footnotesize 1} & \textbf{\Large I} & wish I was a little bug &
4043 % \textbf{\Large I} & eat my peas with honey \\
4044 % {\footnotesize 2} & & With whiskers round my tummy &
4045 % & I've done it all my life. \\
4046 % {\footnotesize 3} & & I'd climb into a honey pot &
4047 % & It makes the peas taste funny \\
4048 % {\footnotesize 4} & & And get my tummy gummy. &
4049 % & But it keeps them on the knife.
4050 % \end{tabular}
4051 % \end{center}
4052 %
4053 %
4054 %
4055 %
4056 %
4057 % \DescribeMacro{\edtabcolsep}
4058 % The distance between the columns is controlled by the length |\edtabcolsep|.
4059 %
4060 % \DescribeMacro{\spreadmath}
4061 % \DescribeMacro{\spreadtext}
4062 % |\spreadmath|\marg{math} typesets \marg{math} but the \marg{math} has
4063 % no effect on the calculation of column widths.
4064 % |\spreadtext|\marg{text} is the analagous command for use in |edtabular|
4065 % environments.
4066 %
4067 % \egstart
4068 % \begin{verbatim}
4069 % \begin{edarrayl}
4070 % 1 & 2 & 3 & 4 \\
4071 % & \spreadmath{F+G+C} & & \\
4072 % a & bb & ccc & dddd
4073 % \end{edarrayl}
4074 % \end{verbatim}
4075 % \egmid
4076 % \begin{displaymath}
4077 % \begin{array}{llll}
4078 % 1 & 2 & 3 & 4 \\
4079 % & \multicolumn{3}{l}{F+G+C} \\
4080 % a & bb & ccc & dddd
4081 % \end{array}
4082 % \end{displaymath}
4083 % \egend
4084 %
4085 % \DescribeMacro{\edrowfill}
4086 % The macro |\edrowfill|\marg{start}\marg{end}\marg{fill}
4087 % fills columns number \meta{start} to \meta{end} inclusive with
4088 % \meta{fill}. The \meta{fill} argument can be any horizontal \enquote{fill}.
4089 % For example, |\hrulefill| or |\upbracefill|.
4090 %
4091 % Note that every row must have the same number of columns, even if
4092 % some would not appear to be necessary.
4093 %
4094 % The |\edrowfill| macro can be used in both tabular and array environments.
4095 % The typeset appearance of the following code is shown below.
4096 % \begin{verbatim}
4097 % \begin{edtabularr}
4098 % 1 & 2 & 3 & 4 & 5 \\
4099 % Q & & fd & h & qwertziohg \\
4100 % v & wptz & x & y & vb \\
4101 % g & nnn & \edrowfill{3}{5}{\upbracefill} & & \\
4102 % \edrowfill{1}{3}{\downbracefill} & & & pq & dgh \\
4103 % k & & l & co & ghweropjklmnbvcxys \\
4104 % 1 & 2 & 3 & \edrowfill{4}{5}{\hrulefill} &
4105 % \end{tabularr}
4106 % \end{verbatim}
4107 %
4108 % \begin{center}
4109 % \begin{tabular}{rrrrr}
4110 % 1 & 2 & 3 & 4 & 5 \\
4111 % Q & & fd & h & qwertziohg \\
4112 % v & wptz & x & y & vb \\
4113 % g & nnn & \multicolumn{3}{c}{\upbracefill} \\
4114 % \multicolumn{3}{c}{\downbracefill} & pq & dgh \\
4115 % k & & l & co & ghweropjklmnbvcxys \\
4116 % 1 & 2 & 3 & \multicolumn{2}{c}{\hrulefill}
4117 % \end{tabular}
4118 % \end{center}
4119 %
4120 % You can also define your own \enquote{fill}. For example:
4121 % \begin{verbatim}
4122 % \newcommand*{\upbracketfill}{%
4123 % \vrule height 4pt depth 0pt\hrulefill\vrule height 4pt depth 0pt}
4124 % \end{verbatim}
4125 % is a fill like |\upbracefill| except it has the appearance of a
4126 % (horizontal) bracket instead of a brace. It can be used like
4127 % this:
4128 %
4129 % \newcommand*{\upbracketfill}{%
4130 % \vrule height 4pt depth 0pt\hrulefill\vrule height 4pt depth 0pt}
4131 %
4132 % \begin{verbatim}
4133 % \begin{edarrayc}
4134 % 1 & 2 & 3 & 4 \\
4135 % a & \edrowfill{2}{3}{\upbracketfill} & & d \\
4136 % A & B & C & D
4137 % \end{edarrayc}
4138 % \end{verbatim}
4139 %
4140 % \begin{displaymath}
4141 % \begin{array}{cccc}
4142 % 1 & 2 & 3 & 4 \\
4143 % a & \multicolumn{2}{c}{\upbracketfill} & d \\
4144 % A & B & C & D
4145 % \end{array}
4146 % \end{displaymath}
4147 %
4148 %
4149 %
4150 % \DescribeMacro{\edatleft}
4151 % \DescribeMacro{\edatright}
4152 % \protect\cs{edatleft}\oarg{math}\marg{symbol}\marg{halfheight} typesets the math
4153 % \meta{symbol} as \protect\cs{left}\marg{symbol}
4154 % with the optional \meta{math} centered before it. The \meta{symbol} is
4155 % twice \meta{halfheight} tall. The \protect\cs{edatright} macro is similar
4156 % and it typesets \protect\cs{right}\marg{symbol} with \meta{math} centered after it.
4157 %
4158 % \begin{verbatim}
4159 % \begin{edarrayc}
4160 % & 1 & 2 & 3 & \\
4161 % & 4 & 5 & 6 & \\
4162 % \edatleft[left =]{\{}{1.5\baselineskip}
4163 % & 7 & 8 & 9 &
4164 % \edatright[= right]{)}{1.5\baselineskip}
4165 % \end{edarrayc}
4166 % \end{verbatim}
4167 %
4168 % \begin{displaymath}
4169 % left = \left\{
4170 % \begin{array}{ccc}
4171 % 1 & 2 & 3 \\
4172 % 4 & 5 & 6 \\
4173 % 7 & 8 & 9
4174 % \end{array}
4175 % \right) = right
4176 % \end{displaymath}
4177 %
4178 %
4179 %
4180 % \DescribeMacro{\edbeforetab}
4181 % \DescribeMacro{\edaftertab}
4182 % \protect\cs{edbeforetab}\marg{text}\marg{entry}, where \meta{entry} is an entry in the
4183 % leftmost column, typesets \meta{text} left justified before the \meta{entry}.
4184 % Similarly \protect\cs{edaftertab}\marg{entry}\marg{text}, where \meta{entry} is an entry
4185 % in the rightmost column, typesets \meta{text} right justified after the
4186 % \meta{entry}.
4187 %
4188 % For example:
4189 % \begin{verbatim}
4190 % \begin{edarrayl}
4191 % A & 1 & 2 & 3 \\
4192 % \edbeforetab{Before}{B} & 1 & 3 & 6 \\
4193 % C & 1 & 4 & \edaftertab{8}{After} \\
4194 % D & 1 & 5 & 0
4195 % \end{edarrayl}
4196 % \end{verbatim}
4197 %
4198 %
4199 % \begin{displaymath}
4200 % \begin{array}{p{0.4\textwidth}llp{0.4\textwidth}}
4201 % \mbox{} \hfill $A$ & 1 & 2 & $3$ \\
4202 % Before \hfill $B$ & 1 & 3 & $6$ \\
4203 % \mbox{} \hfill $C$ & 1 & 4 & $8$ \hfill After \\
4204 % \mbox{} \hfill $D$ & 1 & 5 & $0$
4205 % \end{array}
4206 % \end{displaymath}
4207 %
4208 % \DescribeMacro{\edvertline}
4209 % \DescribeMacro{\edvertdots}
4210 % The macro \protect\cs{edvertline}\marg{height} draws a vertical line \meta{height} high
4211 % (contrast this with \protect\cs{edatright} where the size argument is half the desired
4212 % height).
4213 % \begin{verbatim}
4214 % \begin{edarrayr}
4215 % a & b & C & d & \\
4216 % v & w & x & y & \\
4217 % m & n & o & p & \\
4218 % k & & L & cvb & \edvertline{4pc}
4219 % \end{edarrayr}
4220 % \end{verbatim}
4221 %
4222 % \DeleteShortVerb{\|}
4223 % \begin{displaymath}
4224 % \left.
4225 % \begin{array}{rrrr}
4226 % a & b & C & d \\
4227 % v & w & x & y \\
4228 % m & n & o & p \\
4229 % k & & L & cvb
4230 % \end{array}
4231 % \right|
4232 % \end{displaymath}
4233 % \MakeShortVerb{\|}
4234 %
4235 % The \protect\cs{edvertdots} macro is similar to \protect\cs{edvertline} except that it
4236 % produces a vertical dotted instead of a solid line.
4237 %
4238 %
4239 % \section{Sectioning commands}
4240 % \changes{v1.1.0}{2012/09/25}{Sectioning commands.}
4241 % \changes{v1.12.0}{2014/08/05}{New sectioning commands.}
4242 % \subsection{Sectioning commands without line numbers or critical notes}
4243 % The standard sectioning commands (\protect\cs{chapter}, \protect\cs{section} etc.) can be used inside numbered text.
4244 % In this case, you must call them as an optional argument of \protect\cs{pstart} (\reff{pstart:optionalarg}):
4245 % \begin{verbatim}
4246 % \pstart[\section{section}]
4247 % Pstart content.
4248 % \pend
4249 % \end{verbatim}
4250 % The line which contains them will not be numbered, and you cannot add critical notes inside.
4251 % \subsection{Sectioning commands with line numbering and critical notes}
4252 % \label{eledsection}
4253 % You have to use the following commands:
4254 % \begin{itemize}
4255 % \item \protect\cs{eledchapter}\oarg{text}\marg{critical text},
4256 % \item \protect\cs{eledchapter*},
4257 % \item \protect\cs{eledsection}\oarg{text}\marg{critical text},
4258 % \item \protect\cs{eledsection*},
4259 % \item \protect\cs{eledsubsection}\oarg{text}\marg{critical text},
4260 % \item \protect\cs{eledsubsection*},
4261 % \item \protect\cs{eledsubsubsection}\oarg{text}\marg{critical text},
4262 % \item \protect\cs{eledsubsubsection*}.
4263 % \end{itemize}
4264 % These are equivalent to the \LaTeX\ commands.
4265 % Each individual command must be called alone in a \protect\cs{pstart}\,\ldots\,\protect\cs{pend}:
4266 % \begin{verbatim}
4267 %\pstart
4268 %\eledsection*{xxxx\ledsidenote{section}}
4269 %\pend
4270 %\pstart
4271 %\eledsubsection*{xxxx\ledsidenote{sub}}
4272 %\pend
4273 %\pstart
4274 %normal text
4275 %\pend
4276 % \end{verbatim}
4277 % After the first run, you will see only the text. This is normal.
4278 % After the second run, you will see the formatting.
4279 % Finally, with the third run, you will see the table of contents.
4280 %
4281 % For technical reasons, the page break before \protect\cs{elechapter} cannot be added automatically.
4282 % You have to insert it manually via \protect\cs{beforeeledchapter}, which must be called outside of a numbered section.
4283 %
4284 % \subsection{Optimization}\label{optimize}
4285 % If you are not going to have any \protect\cs{eledxxx} commands, then load \macpackage\ with \protect\option{noeledsec} option.
4286 % That will suppress the generation of unneeded \file{.eledsec} files, save memory, and make \macpackage\ run faster.
4287 %
4288 % \section{Quotation environments}
4289 % The \verb+quotation+ and \verb+quote+ environments can be used so that the same definition/note appears both inside and outside a numbered section.
4290 % The typographical consequences will resemble the outside numbered sections, based on the styles of the \emph{book} class.
4291 % However, if you use a package that redefines these environments, these redefinitions won't be available inside the numbered section.
4292 % You must open any quotation environments inside a \protect\cs{pstart}\,\ldots\,\protect\cs{pend} block, not outside.
4293 % A quotation environment MUST NOT be opened immediately after a \protect\cs{pstart}
4294 % and MUST NOT be closed immediately before a \protect\cs{pend}.
4295 %
4296 % \label{noquotation} In some cases, you do not want these environments to be redefined in numbered sections.
4297 % You can load the package with the option \verb+noquotation+ to prevent this redefinition.
4298 %
4299 % \section{Page breaks}
4300 %
4301 % \subsection{Control page breaking}
4302 % \changes{v1.7.0}{2013/11/08}{New features for managing page breaks.}
4303 % \Macpackage\ and \parpackage break pages automatically. However, you may sometimes want to either force page breaks, or prevent them.
4304 % \DescribeMacro{\ledpb} \DescribeMacro{\lednopb} The packages provide two macros:
4305 % \begin{itemize}
4306 % \item \protect\cs{ledpb} adds a page break.
4307 % \item \protect\cs{lednopb} prevents a page break, by adding one line to the current page if needed.
4308 % \end{itemize}
4309 % \textbf{These commands have effect only at the second run}.
4310 %
4311 % These two commands take effect at the beginning of line in which they are called.
4312 % For example, if you call \protect\cs{ledpb} at l.~444, then l.~443 will be at p.~$n$, and l.~444 at p.~$n+1$.
4313 % \DescribeMacro{\ledpbsetting} However, you can change the behavior and decide they will have effect after the end of the line, adding
4314 % \verb+\ledpbsetting{after}+ at the beginning of your file (better: in your preamble). With the previous example, l.~444 will be
4315 % on p.~$n$ and l.~445 will be on p.~$n+1$.
4316 %
4317 % If you are using \parpackage to typeset parallel pages, you must use \protect\cs{lednopb} on
4318 % both sides in the two corresponding lines. This is especially important when you are using
4319 % stanzas; otherwise, the pages will be out of sync.
4320 %
4321 % \subsection{Prevent page break in a long verses}
4322 % \label{lednopbinversetrue}\DescribeMacro{\lednopbinversetrue} You can also decide to prevent page breaks between two lines of a long verse. To do this, use \verb+nopbinverse+ when loading package, or add \protect\cs{lednopbinversetrue} in the beginning of your file (better: in your preamble).
4323 %
4324 % This feature works only with verse of 2 lines and no more. It works on the third run, or on the fourth run if using \reledpar.
4325 % By default, when a long verse runs between two pages, a page break will be placed at the beginning of the verse. However, if you have added \cs{ledpbsetting}\arg{after}, the page break will be placed at the end of the long verse and the page containing the long verse will have one extra line.
4326 %
4327 % \section{Miscellaneous}
4328 %
4329 % \DescribeMacro{\extensionchars}
4330 % When the package assembles the name of the auxiliary file for a
4331 % section, it prefixes \protect\cs{extensionchars} to the section number.
4332 % This is initially defined to be empty, but you can add some characters to
4333 % help distinguish these files if you like; what you use is likely
4334 % to be system-dependent. If, for example, you said
4335 % \verb"\renewcommand{\extensionchars}{!}", then you would get temporary
4336 % files called \file{jobname.!1}, \file{jobname.!2}, etc.
4337 %
4338 % \DescribeMacro{\ifledfinal}
4339 % The package can take options. The \option{final} option, which is the default
4340 % is for final typesetting; this sets \verb?\ifledfinal? to TRUE. The other
4341 % option, \option{draft}, may be useful during earlier stages and sets
4342 % \verb?\ifledfinal? to FALSE.
4343 %
4344 % \DescribeMacro{\showlemma}
4345 % The lemma within the text is printed via \verb?\showlemma{lemma}?.
4346 % Normally, or with the \option{final} option, the definition of \verb?\showlemma?
4347 % is: \\
4348 % \verb?\newcommand*{\showlemma}[1]{#1}? \\
4349 % so it just produces its argument.
4350 % With the \option{draft} option it is defined as \\
4351 % \verb?\newcommand*{\showlemma}[1]{\textbf{#1}}? \\
4352 % so that its argument is bold, which may make it
4353 % easier to check that all lemmas have been treated.
4354 %
4355 % If you would prefer some other style, you could put something like this
4356 % in the preamble:
4357 % \begin{verbatim}
4358 % \ifledfinal\else
4359 % \renewcommand{\showlemma}[1]{\textbf{#1}}% or simply ...[1]{#1}
4360 % \fi
4361 % \end{verbatim}
4362 %
4363 %
4364 % \subsection{Known and suspected limitations}
4365 % \subsubsection{Non-standard geometry}
4366 % If you use classes other than \ltxclass{article} or \ltxclass{book}, or if you use the geometry package, you should use \protect{maxhnotesX} and\slash{}or \cs{Xmaxhnotes} as explained in \reff{Xmaxhnotes} in order to prevent footnotes from overlapping the bottom margin.
4367 %
4368 % \subsubsection{\package{floatrow} package compatibility}
4369 % The \package{floatrow} package must be loaded before the \macpackage.
4370 % \subsubsection{\enquote{No room for a new}}\label{noroom}
4371 % Sometimes, especially when using \macpackage\ with other packages, you could obtain warning messages such 'no room for a new count' or 'no room for a new write'.
4372 %
4373 % In order to prevent such problems, the first thing is to use the options to optimize \macpackage.
4374 % For example, if you need only two series of notes, use the \verb+series={A,B}+ option.
4375 % Read \reff{optimize} in order to know which are the available options.
4376 %
4377 % However, if with these options you still have such messages, here are some tricks.
4378 % \begin{description}
4379 % \item['no room for a new count'] is often caused by \protect\package{biblatex} being used at the same time.
4380 % Load \macpackage\ (and \parpackage) \emph{before} \protect\package{biblatex}.
4381 % \item['no room for a new write'] can be caused by multiple indexes.
4382 % In this case, use \protect\package{indextools} of \protect\package{imakeidx} with the \verb+splitindex+ option, in order to obtain only one \verb+.idx+ file.
4383 % If that does not solve your problem, you can use \protect\package{morewrites} package.
4384 % That should solve the problem, but \LaTeX\ will be slower.
4385 %
4386 % \end{description}
4387 %
4388 % If after reading and applying these advices you have still problem, contact us with a minimal working example.
4389 %
4390 % \subsubsection{Marginal notes}
4391 % In general, \macpackage's system for adding marginal line numbers
4392 % breaks anything that makes direct use of the \LaTeX\ insert system,
4393 % which includes marginpars, footnotes and floats.
4394 %
4395 % However, you can use both \protect\cs{footnote} and the familiar footnote
4396 % series notes in numbered text. A \protect\cs{marginpar} in numbered text
4397 % will throw away its contents and send a warning message to the terminal
4398 % and log file, but will do no harm.
4399 %
4400 % \subsubsection{Paragraph shape}
4401 % \protect\cs{parshape} cannot be used within numbered text, except in a
4402 % very restricted way.
4403 %
4404 % \DescribeMacro{\ballast}
4405 % \LaTeX\ is a three-pass system, but even after a document has
4406 % been processed three times, there are some tricky situations in
4407 % which the page breaks decided by \TeX\ never settle down. At
4408 % each successive run, \macpackage\ may oscillate between two
4409 % different sets of page decisions. To stop this happening, should
4410 % it arise, Wayne Sullivan\index{Sullivan, Wayne} suggested the
4411 % inclusion of the quantity \protect\cs{ballast}. The amount of \protect\cs{ballast}
4412 % will be subtracted from the penalties which apply to the page
4413 % breaks calculated on the \emph{previous} run through \TeX, thus
4414 % reinforcing these breaks. So if you find your page breaks
4415 % oscillating, insert \\
4416 % \verb"\setcounter{ballast}{100}" \\
4417 % or some such figure, and with any
4418 % luck the page breaks will settle down. Luckily, this problem
4419 % does not crop up at all often.
4420 % \subsubsection{Paragraphed footnotes}\label{paragraphednotes:advanced}
4421 % The restriction on explicit line-breaking in paragraphed footnotes,
4422 % mentioned on \reff{nobreaks}, and
4423 % described in more detail on \reff{nobreaks-detail}, really is a
4424 % nuisance if that is something you need to do. There are some possible
4425 % solutions, described by Michael Downes\index{Downes, Michael},
4426 % but this area remains unsatisfactory.
4427 %
4428 % \label{nopenalties}If you use more than one series of paragraphed notes, it may happen, in some particular cases, that only the footnote rule, with no accompanying footnotes, be printed.
4429 % In this case use \reledmac\ package option \option{nopenalties}
4430 % which should solve the problem, but also may produce widow or orphan lines.
4431 % For the time being, we have no solution of this problem.
4432 %
4433 %
4434 %
4435 % \DescribeMacro{\footfudgefiddle}
4436 % For paragraphed footnotes \TeX{} has to estimate the amount of space
4437 % required. If it underestimates this then the notes may get too long and
4438 % run off the bottom of the text block. \protect\cs{footfudgefiddle} can be increased
4439 % from its default 64 (say, to 68) to increase the estimate. You have to use
4440 % \protect\cs{renewcommand} for this, like: \\
4441 % \verb?\renewcommand{\footfudgefiddle}{68}?\\
4442 % Note that you must call it \emph{before} \cs{Xarrangement}\arg{paragraph} or \cs{arrangementX}\arg{paragraph}.
4443 %
4444 % Any settings to \enquote{geometry} must be made before \cs{Xarrangement} / \cs{arrangementX}.
4445 %
4446 % Finally, in many cases you should use \cs{Xmaxhnotes} and / or \cs{maxhnotesX} (\reff{Xmaxhnotes}), in order to define the maximum height relative to \cs{textheight} and not to \cs{vsize}, because the \cs{vsize} value is not the same inside and outside of the preamble.
4447 %
4448 % \subsubsection{Use with other packages}
4449 %
4450 % Because of \macpackage's complexity, it may not play well with other
4451 % packages. In particular \macpackage\ is sensitive to commands in the
4452 % arguments to the \protect\cs{edtext} and \protect\cs{*footnote} macros (this is
4453 % discussed in more detail in section~\ref{text}, and in particular
4454 % the discussion about \protect\cs{no@expands} and \protect\cs{morenoexpands}). You
4455 % will have to see what works or doesn't work in your particular case.
4456 %
4457 % \DescribeMacro{\morenoexpands}
4458 % You can define the macro \protect\cs{morenoexpands} to modify macros that you
4459 % call within \protect\cs{edtext}. Because of the way \macpackage{} numbers the lines
4460 % the arguments to \protect\cs{edtext} can be processed more than once and in some
4461 % cases a macro should only be processed once. One example is the \protect\cs{colorbox}
4462 % macro from the \protect\package{color} package, which you might use like this:
4463 % \begin{verbatim}
4464 % ... \edtext{\colorbox{mycolor}{lemma}}{\Afootnote{...\colorbox...}}
4465 % \end{verbatim}
4466 % If you actually try
4467 % this\footnote{Reported by Dirk-Jan Dekker\index{Dekker, Dirk-Jan}
4468 % in the CTT thread \enquote{Incompatibility
4469 % of \enquote{color} package} on 2003/08/28.}
4470 % you will find \LaTeX\ whinging
4471 % \enquote{\texttt{Missing \{ inserted}}, and then things start to fall apart.
4472 % The trick in this case is to specify either:
4473 % \begin{verbatim}
4474 % \newcommand{\morenoexpands}{\let\colorbox=0}
4475 % \end{verbatim}
4476 % or
4477 % \begin{verbatim}
4478 % \makeatletter
4479 % \newcommand{\morenoexpands}{\let\colorbox\@secondoftwo}
4480 % \makeatother
4481 % \end{verbatim}
4482 % (\protect\cs{@secondoftwo} is an internal \LaTeX\ macro that takes two arguments and
4483 % throws away the first one.)
4484 % The first incantation lets color show in both the main text and footnotes
4485 % whereas the second one shows color in the main text but kills it
4486 % in the lemma and footnotes. On the other hand if you use
4487 % \protect\cs{textcolor} instead, like
4488 % \begin{verbatim}
4489 % ... \edtext{\textcolor{mycolor}{lemma}}{\Afootnote{...\textcolor...}}
4490 % \end{verbatim}
4491 % there is no need to fiddle with \protect\cs{morenoexpands} as the color will
4492 % naturally be displayed in both the text and footnotes. To kill the color
4493 % in the lemma and footnotes, though, you can do:
4494 % \begin{verbatim}
4495 % \makeatletter
4496 % \newcommand{\morenoexpands}{\let\textcolor\@secondoftwo}
4497 % \makeatother
4498 % \end{verbatim}
4499 % It took Peter Wilson a little while to discover all this. If you run into this sort
4500 % of problem you may have to spend some time experimenting before hitting
4501 % on a solution.
4502 %
4503 %%
4504 %
4505 % If you want to use the option \emph{bottom} of the \protect\package{footmisc} package,
4506 % you must load this package \emph{before} the \macpackage\ package.
4507 %
4508
4509 % \subsection{Parallel typesetting}\label{eledpar}
4510 %
4511 %
4512 % Peter Wilson has developed the \ledpar package
4513 % as an extension to \ledmac specifically for parallel typesetting
4514 % of critical texts. This also cooperates with the \protect\package{babel} / \protect\package{polyglossia}
4515 % packages for typesetting in multiple languages.
4516 % \Parpackage is the successor of the primitive \ledpar package.
4517 %
4518 %
4519 % Peter Wilson also developed
4520 % the \protect\package{ledarab} package for
4521 % handling parallel Arabic text in critical editions.
4522 % However, this package is not maintened by Maïeul Rouquette.
4523 % You should use the capabilities of a modern TeX processor, like Xe(La)TeX
4524 %
4525 %
4526 %
4527 %
4528 % \StopEventually{}
4529 %
4530 % \clearpage
4531 % \renewcommand{\thesection}{\Roman{section}}
4532 % \renewcommand\theHsection{\Roman{section}}
4533 % \setcounter{section}{0}
4534 %
4535 % \section{Implementation overview}\label{overview}
4536 %
4537 %
4538 % We present the \macpackage\ code in roughly the order in which it is used
4539 % during a run of \TeX. The order is \emph{exactly} that in which
4540 % it is read when you load the \macpackage{} package, because the same file
4541 % is used to generate this manual and to generate the \LaTeX\ package file.
4542 %
4543 % Most of what follows consists of macro definitions, but there
4544 % are some commands that are executed immediately---especially
4545 % at the start of the code. The documentation generally describes the
4546 % code from the point of view of what happens when the macros are
4547 % executed, though. As each macro is introduced, its name is printed
4548 % in the margin.
4549 %
4550 % After package options, we begin with the commands you use to start and
4551 % stop line numbering in a section of text (Section~\ref{preliminaries}).
4552 % Next comes the machinery for writing and reading the auxiliary file for
4553 % each section that helps us count lines, and for creating list macros
4554 % encoding the information from that file (Section~\ref{lineation}); this
4555 % auxiliary file will be read at the start of each section, to create
4556 % those list macros, and a new version of the file will be started to
4557 % collect information from the body of the section.
4558 %
4559 % Next are commands for marking sections of
4560 % the text for footnotes (Section~\ref{text}), followed by the macros
4561 % that take each paragraph apart, attach the line numbers and insertions,
4562 % and send the result to the vertical list (Section~\ref{paragraph}). The
4563 % footnote commands (Section~\ref{footnotes}) and output routine
4564 % (Section~\ref{output}) finish the main part of the processing;
4565 % cross-referencing (Section~\ref{xref}) and endnotes
4566 % (Section~\ref{endnotes}) complete the story.
4567 %
4568 % In what follows, macros with an @ in their name are more internal
4569 % to the workings of \macpackage\ than those made up just of
4570 % ordinary letters, just as in \PlainTeX\ (see \thetexbook,
4571 % p.\,344). You are meant to be able to make free with
4572 % ordinary macros, but the \enquote{@} ones should be treated with more
4573 % respect, and changed only if you are pretty sure of what you are
4574 % doing.
4575 %
4576 %
4577 % \section{Preliminaries}
4578 % \label{preliminaries}\relax
4579 % \subsection{Links with original \edmac}
4580 % Generally, these are the modifications to the original.
4581 % \edmac{} code:
4582 % \begin{itemize}
4583 % \item Replace as many \protect\cs{def}'s by \protect\cs{newcommand}'s as possible
4584 % to avoid overwriting \LaTeX\ macros.
4585 %
4586 % \item Replace user-level \TeX\ counts by \LaTeX\ counters.
4587 %
4588 % \item Use the \LaTeX\ font handling mechanisms.
4589 %
4590 % \item Use \LaTeX\ messaging and file facilities.
4591 %
4592 % \end{itemize}
4593 %
4594 %
4595 % \subsection{Package declaration}
4596 % Announce the name and version of the package, which is
4597 % targetted for LaTeX2e.
4598 %
4599 % \begin{macrocode}
4600 %<*code>
4601 \NeedsTeXFormat{LaTeX2e}
4602 \ProvidesPackage{reledmac}[2026/03/06 v2.44.4 typesetting critical editions]%
4603 % \end{macrocode}
4604 %
4605 % \subsection{Loading packages}
4606 % Loading package \protect\package{xargs} to declare commands with optional arguments.
4607 % Loading package \package{xparse} to declare fully expandable commands with optional argument. Ideally, we should use only \package{xparse} and not \package{xargs}. For historical reasons, we use both.
4608 % \protect\package{Etoolbox} is also used to make code clearer - for example, in dynamic command names (which can replace \protect\cs{csname} etc.).
4609 % Use \protect\package{suffix} to declare commands with a starred version, \protect\package{xstring} to work with strings, \protect\package{ifluatex} and \protect\package{ifxetex} to test if \LuaTeX\ or \XeTeX\ is running, and \protect\package{ragged2e} to manage ragged justification for paragraphed notes.
4610 % \begin{macrocode}
4611 \RequirePackage{xargs}%
4612 \RequirePackage{xparse}[2017/03/07]%
4613 \RequirePackage{etoolbox}%
4614 \@ifl@t@r\fmtversion{2015/10/01}%
4615 {\ifboolexpr{not test{\@ifl@t@r\fmtversion{2016/03/31}} or (test{\ifdefstring{\fmtversion}{2016/03/31}} and test {\ifnumless{\patch@level}{3}})}%
4616 {\PackageWarning{reledmac}{You are using a LaTeX version older than 2016/03/31 patch 3.%
4617 \MessageBreak You are strongly encouraged to use a newer version.}}%
4618 {}%
4619 }%
4620 {\RequirePackage{etex}%
4621 \csname reserveinserts\endcsname{32}%
4622 }%
4623 \RequirePackage{suffix}%
4624 \RequirePackage{xstring}%
4625 \RequirePackage{ifluatex}%
4626 \RequirePackage{ragged2e}%
4627 \RequirePackage{ifxetex}%
4628 % \end{macrocode}
4629 % \subsection{Package options}
4630 % \changes{v0.4.0}{2004/02/29}{Added final/draft options}
4631 % \changes{v1.13.0}{2014/09/16}{Added widthliketwocolumns option}
4632 % \begin{macro}{\ifparledgroup}
4633 % \begin{macro}{\ifsameparallelpagenumber}
4634 % \begin{macro}{\ifprevpgnotnumbered}
4635 % \begin{macro}{\ifledfinal}
4636 % \begin{macro}{\ifnocritical@}
4637 % \begin{macro}{\if@noeled@sec}
4638 % \begin{macro}{\ifnoend@}
4639 % \begin{macro}{\ifnofamiliar@}
4640 % \begin{macro}{\ifnoledgroup@}
4641 % \begin{macro}{\ifparapparatus@}
4642 % \begin{macro}{\ifnoquotation@}
4643 % \begin{macro}{\iflednopbinverse}
4644 % \begin{macro}{\ifwidthliketwocolumns}
4645 % \begin{macro}{\ifxindy@}
4646 % \begin{macro}{\ifxindyhyperref@}
4647 % \begin{macro}{\ifeledmaccompat@}
4648 % \begin{macro}{\ifnoresetlinenumannotation@}
4649 % \begin{macro}{\ifantilabe@}
4650 % Use this to remember which option is used, set and execute the options
4651 % with final as the default.
4652 % We use \protect\package{xkeyval} in order to manage options with argument.
4653 % \begin{macrocode}
4654 \RequirePackage{xkeyval}
4655 % \end{macrocode}
4656 %\subsubsection{Options of \parpackage}
4657 % Here, we define some booleans specific to \parpackage\ options, but which have consequences on \macpackage\ internal commands.
4658 % \begin{macrocode}
4659 \newif\ifparledgroup
4660 \newif\ifsameparallelpagenumber%
4661 \newif\ifprevpgnotnumbered%%
4662 % \end{macrocode}
4663 %\subsubsection{Options of \macpackage}
4664 % \begin{macrocode}
4665 \DeclareOptionX{series}[A,B,C,D,E]{\xdef\default@series{#1}}
4666 \ExecuteOptionsX{series}%
4667
4668 \newif\if@noeled@sec%
4669 \DeclareOptionX{noeledsec}{\@noeled@sectrue}
4670
4671 \newif\ifnocritical@%
4672 \DeclareOptionX{nocritical}{\nocritical@true}%
4673
4674 \newif\ifnofamiliar@%
4675 \DeclareOptionX{nofamiliar}{\nofamiliar@true}%
4676
4677 \newif\ifnoledgroup@%
4678 \DeclareOptionX{noledgroup}{\noledgroup@true}%
4679
4680 \newif\ifnoend@%
4681 \DeclareOptionX{noend}{%
4682 \let\l@dend@open\@gobble%
4683 \let\l@dend@close\relax%
4684 \global\let\l@dend@stuff=\relax%
4685 \noend@true%
4686 }%
4687
4688 \newif\ifnoquotation@
4689 \DeclareOptionX{noquotation}{\noquotation@true}
4690
4691 \newif\ifledfinal
4692 \DeclareOptionX{final}{\ledfinaltrue}
4693 \DeclareOptionX{draft}{\ledfinalfalse}
4694 \ExecuteOptionsX{final}
4695
4696 \newif\ifparapparatus@
4697 \DeclareOptionX{parapparatus}{\parapparatus@true}
4698
4699 \newif\iflednopbinverse
4700 \DeclareOptionX{nopbinverse}{\lednopbinversetrue}
4701
4702 \newif\ifwidthliketwocolumns%
4703 \DeclareOptionX{widthliketwocolumns}{\widthliketwocolumnstrue}%
4704
4705 \newif\ifcontinuousnumberingwithcolumns
4706 \DeclareOptionX{continuousnumberingwithcolumns}{\continuousnumberingwithcolumnstrue}%
4707
4708 \newif\ifxindy@
4709 \DeclareOptionX{xindy}[eledmac-markup-attr.xdy]{%
4710 \AtBeginDocument{\immediate\openout\eledmac@xindy@out=#1}%
4711 \newwrite\eledmac@xindy@out%
4712 \xindy@true%
4713 \gdef\eledmacmarkuplocrefdepth{:depth 1}%
4714 \AtEndDocument{\immediate\closeout\eledmac@xindy@out}%
4715 }%
4716
4717 \newif\ifxindyhyperref@
4718 \DeclareOptionX{xindy+hyperref}{%
4719 \xindyhyperref@true%
4720 }%
4721
4722 \newif\ifeledmaccompat@%
4723 \DeclareOptionX{eledmac-compat}{%
4724 \eledmaccompat@true%
4725 }%
4726 \DeclareOptionX{nopenalties}{%
4727 \AtBeginDocument{\let\add@penalties\relax}%
4728 }
4729 \def\l@auxdir{}%
4730 \DeclareOptionX{auxdir}{%
4731 \xdef\l@auxdir{#1/}%
4732 }%
4733
4734 \newif\ifsw@caseinsensitive%
4735 \DeclareOptionX{swcaseinsensitive}{%
4736 \sw@caseinsensitivetrue%
4737 }%
4738 \newif\ifnoresetlinenumannotation@
4739 \DeclareOptionX{noresetlinenumannotation}{%
4740 \noresetlinenumannotation@true%
4741 }%
4742 \newif\ifantilabe@%
4743 \DeclareOptionX{antilabe}{%
4744 \antilabe@true%
4745 }%
4746
4747 \newtoggle{onlyonerule@}%
4748 \DeclareOptionX{onlyonerule}{%
4749 \toggletrue{onlyonerule@}%
4750 }%
4751 % \end{macrocode}
4752 % We use the starred form of \protect\cs{ProcessOptionsX} which executes options in
4753 % the order listed in the source file: class options, then listed package
4754 % options, so a package option can override a class option with the same name.
4755 % This was suggested by Dan Luecking\index{Luecking, Dan} in the \texttt{ctt}
4756 % thread \textit{Class/package option processing}, on 27 February 2004.
4757 % \begin{macrocode}
4758 \ProcessOptionsX*\relax
4759
4760 % \end{macrocode}
4761 % \end{macro}
4762 % \end{macro}
4763 % \end{macro}
4764 % \end{macro}
4765 % \end{macro}
4766 % \end{macro}
4767 % \end{macro}
4768 % \end{macro}
4769 % \end{macro}
4770 % \end{macro}
4771 % \end{macro}
4772 % \end{macro}
4773 % \end{macro}
4774 % \end{macro}
4775 % \end{macro}
4776 % \end{macro}
4777 % \end{macro}
4778 % \end{macro}
4779 %
4780 % \subsection{Compatibility with \LuaTeX}
4781 % Here, we enable some primitives for \LuaTeX.
4782 % \begin{macrocode}
4783 \ifx\directlua\undefined\else%
4784 \directlua{tex.enableprimitives("",{"textdir","pardir","bodydir"})}
4785 \fi
4786 \ifluatex%
4787 \ifnum\luatexversion<110%
4788 \PackageWarning{reledmac}{You need to use LuaTeX 1.1.0 or higher}{\@ehc}%
4789 \fi%
4790 \fi%
4791 % \end{macrocode}
4792 % \subsection{Boolean flags}
4793 % \begin{macro}{\ifl@dmemoir}
4794 % Define a flag for if the \protect\package{memoir} class has been used.
4795 % \changes{v0.2.0}{2003/07/25}{Added \protect\cs{ifl@dmemoir} for memoir class having been used}
4796 % \begin{macrocode}
4797 \newif\ifl@dmemoir
4798 \@ifclassloaded{memoir}{\l@dmemoirtrue}{\l@dmemoirfalse}
4799
4800 % \end{macrocode}
4801 % \end{macro}
4802 % \begin{macro}{\if@ledgroup}
4803 % Flag set to true inside a \env{ledgroup} environment.
4804 % \begin{macrocode}
4805 \newif\if@ledgroup%
4806 % \end{macrocode}
4807 % \end{macro}
4808 % \begin{macro}{\ifl@imakeidx}
4809 % Define a flag for if the \protect\package{imakeidx} package has been used.
4810 % \begin{macrocode}
4811 \newif\ifl@imakeidx
4812 \@ifpackageloaded{imakeidx}{\l@imakeidxtrue}{}%False is the default value
4813 % \end{macrocode}
4814 % \end{macro}
4815
4816 % \begin{macro}{\ifl@indextools}
4817 % Define a flag for if the \protect\package{indextools} package has been used.
4818 % \begin{macrocode}
4819 \newif\ifl@indextools%
4820 \@ifpackageloaded{indextools}{%
4821 \l@indextoolstrue%
4822 \l@imakeidxtrue%
4823 \let\imki@wrindexentry\indtl@wrindexentry%
4824 }{}%
4825 % \end{macrocode}
4826 %False is the default value. We consider \protect\package{indextools} as a variant of \protect\package{imakeidx}. That is why we set \protect\cs{ifl@imakeidx} to true. We also let \protect\cs{imki@wrindexentry} to \protect\cs{indtl@wrindexentry}.
4827 % \end{macro}
4828 % \begin{macro}{\ifl@footmisc}
4829 % Define a flag if the \protect\package{footmisc} package has been loaded.
4830 % \begin{macrocode}
4831 \newif\ifl@footmisc
4832 \@ifpackageloaded{footmisc}{\l@footmisctrue}{}%False is the default value
4833 % \end{macrocode}
4834 % \end{macro}
4835 % \begin{macro}{\if@RTL}
4836 % The \protect\cs{if@RTL} is defined by the bidi package, which is sometimes loaded by \emph{polyglossia}.
4837 % But we define it as well if the \protect\package{bidi} package is not loaded.
4838 % \begin{macrocode}
4839 \ifdef{\if@RTL}{}{\newif\if@RTL}
4840 % \end{macrocode}
4841 % \end{macro}
4842 % \begin{macro}{\if@firstlineofpage}
4843 % \cs{if@firstlineofpage} is set to TRUE at the first line of every page.
4844 % \cs{if@firstlineofpageR} is for the right side.
4845 % \begin{macrocode}
4846 \newif\if@firstlineofpage%
4847 \newif\if@firstlineofpageR%
4848 % \end{macrocode}
4849 % \end{macro}
4850 % \subsection{Messages}
4851 %
4852 % All the messages are grouped here as macros. This saves \TeX's memory
4853 % when the same message is repeated and also lets them be edited easily.
4854 % \changes{v0.7.0}{2005/02/21}{Made macros of all messages}
4855 % \changes{v1.12.3}{2012/08/15}{Add macros for new messages since v0.7}
4856 %
4857 % \begin{macro}{\reledmac@warning}
4858 % Write a warning message.
4859 % \begin{macrocode}
4860 \newcommand{\reledmac@warning}[1]{\PackageWarning{reledmac}{#1}}
4861 % \end{macrocode}
4862 % \end{macro}
4863 %
4864 % \begin{macro}{\reledmac@error}
4865 % Write an error message.
4866 % \changes{v0.2.0}{2003/07/25}{Added \protect\cs{eledmac@error} and replaced error messages}
4867 % \changes{v1.12.3}{2014/08/15}{Replaced error messages}
4868 % \begin{macrocode}
4869 \newcommand{\reledmac@error}[2]{\PackageError{reledmac}{#1}{#2}}
4870 % \end{macrocode}
4871 % \end{macro}
4872 %
4873 % \begin{macro}{\led@err@NumberingStarted}
4874 % \begin{macro}{\led@err@NumberingNotStarted}
4875 % \begin{macro}{\led@err@NumberingShouldHaveStarted}
4876 % \begin{macrocode}
4877 \newcommand*{\led@err@NumberingStarted}{%
4878 \reledmac@error{Numbering has already been started}{\@ehc}}
4879 \newcommand*{\led@err@NumberingNotStarted}{%
4880 \reledmac@error{Numbering was not started}{\@ehc}}
4881 \newcommand*{\led@err@NumberingShouldHaveStarted}{%
4882 \reledmac@error{Numbering should already have been started}{\@ehc}}
4883 % \end{macrocode}
4884 % \end{macro}
4885 % \end{macro}
4886 % \end{macro}
4887 % \begin{macro}{\led@err@samewordRTL}
4888 % \begin{macrocode}
4889 \newcommand*{\led@err@samewordRTL}{%
4890 \reledmac@error{You can't use \string\sameword \MessageBreak with XeLaTeX \MessageBreak when typesetting RTL text.\MessageBreak Please use LuaTeX instead.}{\@ehc}%
4891 }%
4892 % \end{macrocode}
4893 % \end{macro}
4894 % \begin{macro}{\led@err@edtextoutsidepstart}
4895 % \begin{macro}{\led@err@PstartInEdtext}
4896 % \begin{macro}{\led@err@PendInEdtext}
4897 % \begin{macrocode}
4898 \newcommand*{\led@err@edtextoutsidepstart}{%
4899 \reledmac@error{\string\edtext\space outside numbered paragraph (\pstart\space ...\space\pend)}{\@ehc}}%
4900
4901 \newcommand{\led@err@PstartInEdtext}[1]{%
4902 \reledmac@error{\string\pstart\space in \string\edtext\space #1 argument}{\@ehc}%
4903 }%
4904
4905 \newcommand{\led@err@PendInEdtext}[1]{%
4906 \reledmac@error{\string\pend\space in \string\edtext\space #1 argument}{\@ehc}%
4907 }%
4908 % \end{macrocode}
4909 % \end{macro}
4910 % \end{macro}
4911 % \end{macro}
4912 % \begin{macro}{\led@mess@NotesChanged}
4913 % \begin{macrocode}
4914 \newcommand*{\led@mess@NotesChanged}{%
4915 \typeout{reledmac reminder: }%
4916 \typeout{ The number of the footnotes in this section
4917 has changed since the last run.}%
4918 \typeout{ You will need to run LaTeX two more times
4919 before the footnote placement}%
4920 \typeout{ and line numbering in this section are
4921 correct.}}
4922 % \end{macrocode}
4923 % \end{macro}
4924 %
4925 % \begin{macro}{\led@mess@SectionContinued}
4926 % \begin{macrocode}
4927 \newcommand*{\led@mess@SectionContinued}[1]{%
4928 \message{Section #1 (continuing the previous section)}}
4929 % \end{macrocode}
4930 % \end{macro}
4931 %
4932 % \begin{macro}{\led@err@LineationInNumbered}
4933 % \begin{macrocode}
4934 \newcommand*{\led@err@LineationInNumbered}{%
4935 \reledmac@error{You can't use \string\lineation\space within
4936 a numbered section}{\@ehc}}
4937 % \end{macrocode}
4938 % \end{macro}
4939 %
4940 %
4941 % \begin{macro}{\led@warn@BadLineation}
4942 % \begin{macro}{\led@warn@BadLinenummargin}
4943 % \begin{macro}{\led@warn@BadLockdisp}
4944 % \begin{macro}{\led@warn@BadSublockdisp}
4945 % \begin{macrocode}
4946 \newcommand*{\led@warn@BadLineation}{%
4947 \reledmac@warning{Bad \string\lineation\space argument}}
4948 \newcommand*{\led@warn@BadLinenummargin}{%
4949 \reledmac@warning{Bad \string\linenummargin\space argument}}
4950 \newcommand*{\led@warn@BadLockdisp}{%
4951 \reledmac@warning{Bad \string\lockdisp\space argument}}
4952 \newcommand*{\led@warn@BadSublockdisp}{%
4953 \reledmac@warning{Bad \string\sublockdisp\space argument}}
4954 % \end{macrocode}
4955 % \end{macro}
4956 % \end{macro}
4957 % \end{macro}
4958 % \end{macro}
4959 %
4960 % \begin{macro}{\led@warn@NoFile}
4961 % \begin{macrocode}
4962 \newcommand*{\led@warn@NoFile}[1]{%
4963 \reledmac@warning{File `#1' not found}}
4964 % \end{macrocode}
4965 % \end{macro}
4966 % \begin{macro}{\led@warn@LineFileObsolete}
4967 % \begin{macrocode}
4968 \newcommand*{\led@warn@Obsolete}[1]{%
4969 \reledmac@warning{Line-list file #1 was obsolete. We have not read it. Please run LaTeX again.}}
4970 % \end{macrocode}
4971 % \end{macro}
4972 %
4973 % \begin{macro}{\led@warn@BadAdvancelineSubline}
4974 % \begin{macro}{\led@warn@BadAdvancelineLine}
4975 % \begin{macrocode}
4976 \newcommand*{\led@warn@BadAdvancelineSubline}{%
4977 \reledmac@warning{\string\advanceline\space produced a sub-line
4978 number less than zero.}}
4979 \newcommand*{\led@warn@BadAdvancelineLine}{%
4980 \reledmac@warning{\string\advanceline\space produced a line
4981 number less than zero.}}
4982 % \end{macrocode}
4983 % \end{macro}
4984 % \end{macro}
4985 %
4986 % \begin{macro}{\led@warn@BadSetline}
4987 % \begin{macro}{\led@warn@BadSetlinenum}
4988 % \begin{macrocode}
4989 \newcommand*{\led@warn@BadSetline}{%
4990 \reledmac@warning{Bad \string\setline\space argument}}
4991 \newcommand*{\led@warn@BadSetlinenum}{%
4992 \reledmac@warning{Bad \string\setlinenum\space argument}}
4993 % \end{macrocode}
4994 % \end{macro}
4995 % \end{macro}
4996 %
4997 % \begin{macro}{\led@err@PstartNotNumbered}
4998 % \begin{macro}{\led@err@PstartInPstart}
4999 % \begin{macro}{\led@err@PendNotNumbered}
5000 % \begin{macro}{\led@err@PendNoPstart}
5001 % \begin{macro}{\led@err@AutoparNotNumbered}
5002 % \begin{macro}{\led@err@NumberingWithoutPstart}
5003 % \begin{macrocode}
5004 \newcommand*{\led@err@PstartNotNumbered}{%
5005 \reledmac@error{\string\pstart\space must be used within a
5006 numbered section %
5007 (\string\beginnumbering\space ...\space\string\endnumbering)}{\@ehc}}%
5008 \newcommand*{\led@err@PstartInPstart}{%
5009 \reledmac@error{\string\pstart\space encountered while another
5010 \string\pstart\space was in effect}{\@ehc}}
5011 \newcommand*{\led@err@PendNotNumbered}{%
5012 \reledmac@error{\string\pend\space must be used within a
5013 numbered section}{\@ehc}}
5014 \newcommand*{\led@err@PendNoPstart}{%
5015 \reledmac@error{\string\pend\space must follow a \string\pstart}{\@ehc}}
5016 \newcommand*{\led@err@AutoparNotNumbered}{%
5017 \reledmac@error{\string\autopar\space must be used within a
5018 numbered section}{\@ehc}}
5019 \newcommand*{\led@err@NumberingWithoutPstart}{%
5020 \reledmac@error{\string\beginnumbering...\string\endnumbering\space without \string\pstart}{\@ehc}}%
5021 % \end{macrocode}
5022 % \end{macro}
5023 % \end{macro}
5024 % \end{macro}
5025 % \end{macro}
5026 % \end{macro}
5027 % \end{macro}
5028 %
5029 % \begin{macro}{\led@warn@BadAction}
5030 % \begin{macrocode}
5031 \newcommand*{\led@warn@BadAction}{%
5032 \reledmac@warning{Bad action code, value \next@action.}}
5033 % \end{macrocode}
5034 % \end{macro}
5035 %
5036 % \begin{macro}{\led@warn@DuplicateLabel}
5037 % \begin{macro}{\led@warn@AppLabelOutSecondArgEdtext}
5038 % \begin{macro}{\led@warn@RefUndefined}
5039 % \begin{macro}{\led@warn@RefUndefined}
5040 % \begin{macrocode}
5041 \newcommand*{\led@warn@DuplicateLabel}[1]{%
5042 \reledmac@warning{Duplicate definition of label `#1'\@gobble}%
5043 \@latex@warning@no@line{Label `#1' multiply defined}%
5044 }%
5045 \newcommand*{\led@warn@AppLabelOutSecondArgEdtext}[1]{%
5046 \reledmac@warning{\string\applabel\space outside of the second argument of an \string\edtext\space `#1' on page \thepage.}}%
5047 \newcommand*{\led@warn@RefUndefined}[1]{%
5048 \G@refundefinedtrue%
5049 \reledmac@warning{Reference `#1' on page \thepage\space undefined.%
5050 Using `000'.}%
5051 \@latex@warning{Reference `#1' undefined\on@line}%
5052 }%
5053 \newcommand*{\led@warn@pairRefUndefined}[1]{%
5054 \G@refundefinedtrue%
5055 \reledmac@warning{Reference `#1:start' and/or `#1:end' on page \thepage\space undefined.
5056 Using `??'.}%
5057 \@latex@warning{Reference `#1:start' and/or `#1:end' undefined\on@line}%
5058 }
5059 % \end{macrocode}
5060 % \end{macro}
5061 % \end{macro}
5062 % \end{macro}
5063 % \end{macro}
5064 %
5065 % \begin{macro}{\led@warn@NoMarginpars}
5066 % \begin{macrocode}
5067 \newcommand*{\led@warn@NoMarginpars}{%
5068 \reledmac@warning{You can't use \string\marginpar\space in numbered text}}
5069 % \end{macrocode}
5070 % \end{macro}
5071 %
5072 % \begin{macro}{\led@warn@BadHookSeries}
5073 % \begin{macrocode}
5074 \newcommand{\led@warn@BadHookSeries}[2]{%
5075 \reledmac@warning{Bad series #1 for #2 hook. Skipped.}%
5076 }%
5077 % \end{macrocode}
5078 % \end{macro}
5079 % \begin{macro}{\led@warn@BadSidenotemargin}
5080 % \begin{macrocode}
5081 \newcommand*{\led@warn@BadSidenotemargin}{%
5082 \reledmac@warning{Bad \string\sidenotemmargin\space argument}}
5083 % \end{macrocode}
5084 % \end{macro}
5085 %
5086 % \begin{macro}{\led@warn@NoIndexFile}
5087 % \begin{macrocode}
5088 \newcommand*{\led@warn@NoIndexFile}[1]{%
5089 \reledmac@warning{Undefined index file #1}}
5090 % \end{macrocode}
5091 % \end{macro}
5092 %
5093 % \begin{macro}{\led@warn@SeriesStillExist}
5094 % \begin{macrocode}
5095 \newcommand{\led@warn@SeriesStillExist}[1]{%
5096 \reledmac@warning{Series #1 is still existing !}%
5097 }%
5098 % \end{macrocode}
5099 % \end{macro}
5100 % \begin{macro}{\led@err@BadAction}
5101 % \begin{macrocode}
5102 \newcommand*{\led@err@StanzaIndentNotDefined}{%
5103 \reledmac@error{You have not defined the indentation for the line \number\stanza@count}{\@ehc}}%
5104 % \end{macrocode}
5105 % \end{macro}
5106 % \begin{macro}{\led@err@ManySidenotes}
5107 % \begin{macro}{\led@err@ManyLeftnotes}
5108 % \begin{macro}{\led@err@ManyRightnotes}
5109 % \begin{macrocode}
5110 \newcommand{\led@err@ManySidenotes}{%
5111 \ifledRcol@%
5112 \reledmac@warning{\itemcount@\space sidenotes on line \the\line@numR\space p. \the\page@numR}%
5113 \else%
5114 \reledmac@warning{\itemcount@\space sidenotes on line \the\line@num\space p. \the\page@num}%
5115 \fi%
5116 }%
5117 \newcommand{\led@err@ManyLeftnotes}{%
5118 \ifledRcol@%
5119 \reledmac@warning{\itemcount@\space leftnotes on line \the\line@numR\space p. \the\page@numR}%
5120 \else%
5121 \reledmac@warning{\itemcount@\space leftnotes on line \the\line@num\space p. \the\page@num}%
5122 \fi%
5123 }%
5124 \newcommand{\led@err@ManyRightnotes}{%
5125 \ifledRcol@%
5126 \reledmac@warning{\itemcount@\space rightnotes on line \the\line@numR\space p. \the\page@numR}%
5127 \else%
5128 \reledmac@warning{\itemcount@\space rightnotes on line \the\line@num\space p. \the\page@num}%
5129 \fi%
5130 }%
5131 % \end{macrocode}
5132 % \end{macro}
5133 % \end{macro}
5134 % \end{macro}
5135 % \begin{macro}{\led@err@TooManyColumns}
5136 % \begin{macro}{\led@err@UnequalColumns}
5137 % \begin{macro}{\led@err@LowStartColumn}
5138 % \begin{macro}{\led@err@HighEndColumn}
5139 % \begin{macro}{\led@err@ReverseColumns}
5140 % \begin{macrocode}
5141 \newcommand*{\led@err@TooManyColumns}{%
5142 \reledmac@error{Too many columns}{\@ehc}}
5143 \newcommand*{\led@err@UnequalColumns}{%
5144 \reledmac@error{Number of columns is not equal to the number
5145 in the previous row (or \protect\\ \space forgotten?)}{\@ehc}}
5146 \newcommand*{\led@err@LowStartColumn}{%
5147 \reledmac@error{Start column is too low}{\@ehc}}
5148 \newcommand*{\led@err@HighEndColumn}{%
5149 \reledmac@error{End column is too high}{\@ehc}}
5150 \newcommand*{\led@err@ReverseColumns}{%
5151 \reledmac@error{Start column is greater than end column}{\@ehc}}
5152 % \end{macrocode}
5153 % \end{macro}
5154 % \end{macro}
5155 % \end{macro}
5156 % \end{macro}
5157 % \end{macro}
5158 %
5159 % \begin{macro}{\led@err@toendnotes@outsidenumbering}
5160 % \begin{macrocode}
5161 \newcommand{\led@err@toendnotes@outsidenumbering}{%
5162 \reledmac@error{\string\toendnotes\space and related commands must be called inside a numbered texte (\string\beginnumbering\space ...\space\string\endnumbering)}{\@ehc}%
5163 }%
5164 % \end{macrocode}
5165 % \end{macro}
5166 % \begin{macro}{\led@err@EdtextWithoutNote}
5167 % \begin{macrocode}
5168 \newcommand{\led@err@EdtextWithoutNote}[1]{%
5169 \reledmac@error{edtext `\unexpanded{#1}` without Xfootnote or Xendnote. Check syntaxis.}{\@ehc}%
5170 }%
5171 % \end{macrocode}
5172 % \end{macro}
5173 % \begin{macro}{\led@err@FootnoteNotInSecondArgEdtext}
5174 % \begin{macrocode}
5175 \newcommand{\led@err@FootnoteNotInSecondArgEdtext}[1]{%
5176 \reledmac@error{#1footnote outside of the second argument of an edtext. Check syntaxis.}{\@ehc}%
5177 }%
5178 % \end{macrocode}
5179 % \end{macro}
5180 % \begin{macro}{\led@error@PackageAfterEledmac}
5181 % \begin{macrocode}
5182 \newcommand{\led@error@PackageAfterEledmac}[1]{%
5183 \reledmac@error{#1 must be loaded before reledmac}{\@ehc}%
5184 }%
5185 % \end{macrocode}
5186 % \end{macro}
5187 % \begin{macro}{\led@error@require@glossariesextra}
5188 % \begin{macrocode}
5189 \newcommand{\led@error@require@glossariesextra}{%
5190 \reledmac@error{When using both reledmac and glossaries, you must also use glossaries-extra}{\@ehc}%
5191 }%
5192 % \end{macrocode}
5193 % \end{macro}
5194 % \begin{macro}{\led@error@fail@patch@@makecol}
5195 % \begin{macrocode}
5196 \newcommand{\led@error@fail@patch@@makecol}{%
5197 \reledmac@error{Fail to patch \string\@makecol\space command}{\@ehc}%
5198 }%
5199 % \end{macrocode}
5200 % \end{macro}
5201 % \begin{macro}{\led@error@fail@patch@@reinserts}
5202 % \begin{macrocode}
5203 \newcommand{\led@error@fail@patch@@reinserts}{%
5204 \reledmac@error{Fail to patch \string\@reinserts\space command}{\@ehc}%
5205 }%
5206 % \end{macrocode}
5207 % \end{macro}
5208 % \begin{macro}{\led@error@fail@patch@@doclearpage}
5209 % \begin{macrocode}
5210 \newcommand{\led@error@fail@patch@@doclearpage}{%
5211 \reledmac@error{Fail to patch \string\@doclearpage\space command}{\@ehc}%
5212 }%
5213 % \end{macrocode}
5214 % \end{macro}
5215 %
5216 % \begin{macro}{\led@error@fail@patch@@iiiminipage}
5217 % \begin{macrocode}
5218 \newcommand{\led@error@fail@patch@@iiiminipage}{%
5219 \reledmac@error{Fail to patch \string\@iiiminipage\space command}{\@ehc}%
5220 }%
5221 % \end{macrocode}
5222 % \end{macro}
5223 % \begin{macro}{\led@error@fail@patch@endminipage}
5224 % \begin{macrocode}
5225 \newcommand{\led@error@fail@patch@endminipage}{%
5226 \reledmac@error{Failed to patch the \string\endminipage\space command}{\@ehc}%
5227 }%
5228 % \end{macrocode}
5229 % \end{macro}
5230 % \begin{macro}{\led@error@fail@patch@endminipage}
5231 % \begin{macrocode}
5232 \newcommand{\led@error@fail@patch@makeindex}{%
5233 \reledmac@error{Failed to patch the \string\makeindex\space command}{\@ehc}%
5234 }%
5235 % \end{macrocode}
5236 % \end{macro}
5237 % \begin{macro}{\led@error@fail@patch@setcounter}
5238 % \begin{macrocode}
5239 \newcommand{\led@error@fail@patch@setcounter}{%
5240 \reledmac@error{Failed to patch the \string\setcounter\space command}{\@ehc}%
5241 }%
5242 % \end{macrocode}
5243 % \end{macro}
5244 % \begin{macro}{\led@error@fail@patch@stpelt}
5245 % \begin{macrocode}
5246 \newcommand{\led@error@fail@patch@stpelt}{%
5247 \reledmac@error{Failed to patch the \string\@stpelt\space command}{\@ehc}%
5248 }%
5249 % \end{macrocode}
5250 % \end{macro}
5251 % \begin{macro}{\led@error@fail@patch@addtocounter}
5252 % \begin{macrocode}
5253 \newcommand{\led@error@fail@patch@addtocounter}{%
5254 \reledmac@error{Failed to patch the \string\addtocounter\space command}{\@ehc}%
5255 }%
5256 % \end{macrocode}
5257 % \begin{macrocode}
5258 \newcommand{\led@error@fail@patch@stepcounter}{%
5259 \reledmac@error{Failed to patch the \string\stepcounter\space command}{\@ehc}%
5260 }%
5261 % \end{macrocode}
5262 % \end{macro}
5263 % \begin{macro}{\led@error@fail@patch@mempnum}
5264 % \begin{macrocode}
5265 \newcommand{\led@error@fail@patch@mempnum}{%
5266 \reledmac@error{Fail to patch \string\@mempnum\space command}{\@ehc}%
5267 }%
5268 % \end{macrocode}
5269 % \end{macro}
5270 % \begin{macro}{\led@warn@edinde@outsidenumbering}
5271 % \begin{macrocode}
5272 \newcommand{\led@warn@edinde@outsidenumbering}{%
5273 \reledmac@warning{\string\edindex\space called outside of \string\beginnumbering\space ...\space \string\endnumbering. \MessageBreak Automatically switched to \string\index.}%
5274 }%
5275 % \end{macrocode}
5276 % \end{macro}
5277 % \begin{macro}{\led@warning@hsizeX@deprecated}
5278 % \begin{macrocode}
5279 \newcommand{\led@warning@hsizeX@deprecated}{%
5280 \reledmac@warning{\string\hsizeX\space command deprecated, use \string\widthX\space instead.}%
5281 }%
5282 % \end{macrocode}
5283 % \end{macro}
5284 % \begin{macro}{\led@warning@Xhsize@deprecated}
5285 % \begin{macrocode}
5286 \newcommand{\led@warning@Xhsize@deprecated}{%
5287 \reledmac@warning{\string\Xhsize\space command deprecated, use \string\Xwidth\space instead.}%
5288 }%
5289 % \end{macrocode}
5290 % \end{macro}
5291 % \begin{macro}{\led@warning@msdatawithoutstop}
5292 % \begin{macrocode}
5293 \newcommand{\led@warning@msdatawithoutstop}{%
5294 \reledmac@warning{\string\msdata\space without corresponding \string\stopmsdata}%
5295 }%
5296 % \end{macrocode}
5297 % \end{macro}
5298 % \begin{macro}{\led@warning@preXnotes@deprecated}
5299 % \begin{macrocode}
5300 \newcommand{\led@warning@preXnotes@deprecated}{%
5301 \reledmac@warning@preXnotes@deprecated%
5302 }%
5303 % \end{macrocode}
5304 % \end{macro}
5305 % \subsection{Gobbling}
5306 % \changes{v1.14.0}{2014/10/27}{Provide \protect\cs{@gobblefour}}
5307 % \changes{v1.14.0}{2014/10/27}{Move gobbling command}
5308 % \changes{v1.21.0}{2015/04/13}{Provide \protect\cs{@gobblefive}}
5309 % \changes{v0.2.2}{2003/11/05}{Used \protect\cs{providecommand} for \protect\cs{@gobblethree}
5310 % to avoid clash with the amsfonts package}
5311 % Here, we define some commands which gobble their arguments.
5312 % \begin{macro}{\@gobblethree}
5313 % \begin{macro}{\@gobblefour}
5314 % \begin{macro}{\@gobbleseven}
5315 % \begin{macrocode}
5316 \providecommand*{\@gobblethree}[3]{}
5317 \providecommand*{\@gobblefour}[4]{}
5318 \providecommand*{\@gobbleseven}[7]{}
5319 % \end{macrocode}
5320 % \end{macro}
5321 % \end{macro}
5322 % \end{macro}
5323 % \subsection{Wrapping content}
5324 % \begin{macro}{\l@wrap@ifnotemptybox}
5325 % \begin{macro}{\l@wrapcs@ifnotemptybox}
5326 % The \cs{l@wrap@ifnotemptybox} macro wraps its second argument in the command passed as the first argument, but only if the second argument does not produce an empty box.
5327 % That is useful for example when we need to wrap something on a \cs{textsuperscript}.
5328 %
5329 %
5330 % Indeed \verb+a\textsuperscript{}b+ does not produce the same typographical result as
5331 % \verb+ab+.\footnote{Compare the distance between letters in the first case (a\textsuperscript{}b) and in the second one (ab).}
5332 % The l@wrapcs@ifnotemptybox does the same, but take as argument a control sequence name, so without backslash.
5333 %
5334 % \begin{macrocode}
5335 \newcommand{\l@wrap@ifnotemptybox}[2]{%
5336 \setbox0=\hbox{#2}%
5337 \ifdim\wd0=\z@\else%
5338 #1{#2}%
5339 \fi%
5340 }%
5341 \newcommand{\l@wrapcs@ifnotemptybox}[2]{%
5342 \l@wrap@ifnotemptybox{\csname #1\endcsname}{#2}%
5343 }%
5344 % \end{macrocode}
5345 % \end{macro}
5346 % \end{macro}
5347 % \subsection{Miscellaneous commands}
5348 % \begin{macro}{\showlemma}
5349 % \verb?\showlemma?\marg{lemma} typesets the lemma text in the body.
5350 % It depends on the option.
5351 % \changes{v0.4.0}{2004/02/29}{Added \protect\cs{showlemma}}
5352 % \begin{macrocode}
5353 \ifledfinal
5354 \global\notbool{parapparatus@}{\newcommand*}{\newcommand}{\showlemma}[1]{#1}%
5355 \else
5356 \global\notbool{parapparatus@}{\newcommand*}{\newcommand}{\showlemma}[1]{\textbf{#1}}%
5357 \fi
5358
5359 % \end{macrocode}
5360 % \end{macro}
5361 % \begin{macro}{\linenumberlist}
5362 % The code for the \protect\cs{linenumberlist} mechanism was given to Peter Wilson by Wayne
5363 % Sullivan\index{Sullivan, Wayne} on 2004/02/11.
5364 %
5365 % Initialize it as \protect\cs{empty}.
5366 %
5367 % \changes{v0.3.0}{2004/02/14}{Added \protect\cs{linenumberlist} mechanism}
5368 % \begin{macrocode}
5369 \let\linenumberlist=\empty
5370
5371 % \end{macrocode}
5372 % \end{macro}
5373 %
5374 % \begin{macro}{\@l@dtempcnta}
5375 % \begin{macro}{\@l@dtempcntb}
5376 % In imitation of \LaTeX, we create a couple of scratch counters.
5377 %
5378 % \LaTeX\ already defines \protect\cs{@tempcnta} and \protect\cs{@tempcntb} but Peter Wilson
5379 % found in the past that it can be dangerous to use these (for example
5380 % one of the AMS packages did something nasty to the \protect\package{ccaption}
5381 % package's use of one of these).
5382 % \begin{macrocode}
5383 \newcount\@l@dtempcnta \newcount\@l@dtempcntb
5384 % \end{macrocode}
5385 % \end{macro}
5386 % \end{macro}
5387 % \subsection{Prepare \parpackage}
5388 % \begin{macro}{\ifl@dpairing}
5389 % \begin{macro}{\ifl@dpaging}
5390 % \begin{macro}{\ifl@dprintingpages}
5391 % \begin{macro}{\ifl@dprintingcolumns}
5392 % \begin{macro}{\ifpst@rtedL}
5393 % \begin{macro}{\l@dnumpstartsL}
5394
5395 % In preparation for the \parpackage package, these are related to
5396 % the \enquote{right} text of parallel texts (when \protect\cs{ifl@dpairing} is TRUE).
5397 % They are explained in the \protect\parpackage
5398 % manual.
5399 % \changes{v0.7.0}{2005/02/24}{Added \protect\cs{l@dnumpstartsL}, \protect\cs{ifl@dpairing}
5400 % and \protect\cs{ifpst@rted} for/from eledpar}
5401 % \changes{v0.12.0}{2005/10/01}{Added \protect\cs{ifledRcol} and \protect\cs{ifnumberingR} for/from \protect\package{eledpar}}
5402 % \changes{v1.12.0}{2014/08/05}{Add \protect\cs{ifledRcol@} for \protect\package{eledpar}}
5403 % \changes{v1.13.2}{2014/09/31}{Add \protect\cs{ifl@dpaging} for \protect\package{eledpar}}
5404 % \changes{v1.18.0}{2015/02/23}{Add \protect\cs{ifl@dprintingpages} and \protect\cs{@dprintingcolumns} for \protect\package{eledpar}}
5405 % \begin{macrocode}
5406 \newif\ifl@dpairing
5407 \newif\ifl@dpaging%
5408 \newif\ifl@dprintingpages%
5409 \newif\ifl@dprintingcolumns%
5410 \newif\ifpst@rtedL
5411 \newcount\l@dnumpstartsL
5412 % \end{macrocode}
5413 % \end{macro}
5414 % \end{macro}
5415 % \end{macro}
5416 % \end{macro}
5417 % \end{macro}
5418 % \end{macro}
5419 % \begin{macro}{\ifledRcol}
5420 % \begin{macro}{\ifledRcol@}
5421 % \protect\cs{ifledRcol} is set to true in the \verb+Rightside+ environnement. It must be not confused with \protect\cs{ifledRcol@} which is set to true when a right line is processed, in \protect\cs{Pages} or \protect\cs{Columns}.
5422 % \begin{macrocode}
5423 \newif\ifledRcol
5424 \newif\ifledRcol@
5425 % \end{macrocode}
5426 % \end{macro}
5427 % \end{macro}
5428 % \begin{macro}{\ifnumberingR}
5429 % The \protect\cs{ifnumberingR} flag is
5430 % set to \verb"true" if we're within a right text numbered section.
5431 % \begin{macrocode}
5432 \newif\ifnumberingR
5433 % \end{macrocode}
5434 % \begin{macro}{\ifafterendnumberingR}
5435 % The \cs{ifafterendnumberingR} boolean is set to TRUE at \cs{endnumberingR} and to FALSE at next \cs{beginnumberingR} or real \cs{beginnumbering} (not \cs{resumenumbering}). It is mainly used for the \option{continuousnumberingwithcolumns}, to avoid incrementing right column line counters after a \cs{endnumberingR}.
5436 % \begin{macrocode}
5437 \newif\ifafterendnumberingR%
5438 % \end{macrocode}
5439 % \end{macro}
5440 % The \cs{ifXnote@} macro is set to true when we are typesetting a critical footnote.
5441 % \begin{macrocode}
5442 \newif\ifXnote@%
5443 % \end{macrocode}
5444 % \end{macro}
5445 % \subsection{Booleans provided by other optional packages which are required in any case}
5446 % \begin{macro}{\ifindtl@innote}
5447 % \begin{macro}{\ifindtl@notenumber}
5448 % The \cs{ifindtl@innote} and \cs{ifindtl@notenumber} are required even if \package{indextools} is not used.
5449 % \begin{macrocode}
5450 \providebool{indtl@innote}%
5451 \providebool{indtl@notenumber}%
5452 % \end{macrocode}
5453 % \end{macro}
5454 % \end{macro}
5455 % \begin{macro}{ifinstanzaL}
5456 % \begin{macro}{ifinstanzaR}
5457 % These boolean tests are switched by the \protect\cs{stanza} command, using either the left or right side.
5458 % \begin{macrocode}
5459 \newif\ifinstanzaL%
5460 \newif\ifinstanzaR%
5461 % \end{macrocode}
5462 % \end{macro}
5463 % \end{macro}
5464 % \begin{macro}{ifinastanzaL}
5465 % \begin{macro}{ifinastanzaR}
5466 % These boolean tests are switched by the \protect\env{astanza} environnement, using either the left or right side.
5467 % \begin{macrocode}
5468 \newif\ifinastanzaL%
5469 \newif\ifinastanzaR%
5470 % \end{macrocode}
5471 % \end{macro}
5472 % \end{macro}
5473 %
5474 %\section{Sectioning commands}
5475 %
5476 % \begin{macro}{\section@num}
5477 % You use \protect\cs{beginnumbering} and \protect\cs{endnumbering} to begin
5478 % and end a line-numbered section of the text; the pair of commands may
5479 % be used as many times as you like within one document to start
5480 % and end multiple, separately line-numbered sections. \LaTeX\ will
5481 % maintain and display
5482 % a \enquote{section number} as a count named
5483 % \protect\cs{section@num} that counts how many
5484 % \protect\cs{beginnumbering} and \protect\cs{resumenumbering}
5485 % commands have appeared; it need not be
5486 % related to the logical divisions of your text.
5487 %
5488 % \begin{macro}{\extensionchars}
5489 % Each section will read and write an associated \enquote{line-list
5490 % file}, containing information used to do the numbering; the file
5491 % will be called \meta{jobname}\file{.nn}, where \file{nn} is the
5492 % section number. However, you may direct that
5493 % an extra string be added before the
5494 % \file{nn} in that filename, in order to distinguish these
5495 % temporary files from others: that string is called
5496 % \protect\cs{extensionchars}. Initially it's empty, since different
5497 % operating systems have greatly varying ideas about what
5498 % characters are permitted in file names. So
5499 % \verb"\renewcommand{\extensionchars}{-}" gives temporary files called
5500 % \file{jobname.-1}, \file{jobname.-2}, etc.
5501 % \begin{macrocode}
5502 \newcount\section@num
5503 \section@num=0
5504 \let\extensionchars=\empty
5505 % \end{macrocode}
5506 % \end{macro}
5507 % \end{macro}
5508 %
5509 % \begin{macro}{\ifnumbering}
5510 % \begin{macro}{\numberingtrue}
5511 % \begin{macro}{\numberingfalse}
5512 % The \protect\cs{ifnumbering} flag is
5513 % set to \verb"true" if we are within a numbered section (that is, between
5514 % \protect\cs{beginnumbering} and \protect\cs{endnumbering}). You can use \protect\cs{ifnumbering}
5515 % in your own code to check whether you are in a numbered section, but
5516 % do not change the flag's value.
5517 % \begin{macrocode}
5518 \newif\ifnumbering
5519 % \end{macrocode}
5520 % \end{macro}
5521 % \end{macro}
5522 % \end{macro}
5523 %
5524 % \begin{macro}{\beginnumbering}
5525 % \begin{macro}{\initnumbering@reg}
5526 % \protect\cs{beginnumbering} begins a section of numbered text.
5527 % When it is executed we increment the section number,
5528 % initialize our counters, send a message to your terminal, and
5529 % call macros to start the lineation machinery and endnote files.
5530 %
5531 % The initializations here are trickier than they look.
5532 % \protect\cs{line@list@stuff} will use all of the counters
5533 % that are zeroed here when it assembles
5534 % the line-list and other lists of information about the lineation.
5535 % But it will do all of this locally and
5536 % within a group, and when it is done the
5537 % lists will remain but the counters will return to zero. Those same
5538 % counters will then be used as we process the text of this section,
5539 % but the assignments will be made globally. These initializations
5540 % actually apply to both uses, though in all other respects there
5541 % should be no direct interaction between the use of these counters
5542 % and variables in the two processing steps.
5543 % \changes{v0.7.0}{2005/02/24}{Added \protect\cs{initnumbering@reg}}
5544 % \changes{v1.12.0}{2014/08/05}{\protect\cs{beginnumbering} is defined only on \protect\package{eledmac}, not on \protect\package{eledpar}.}
5545 % For parallel processing:
5546 %\begin{itemize}
5547 % \item zero \protect\cs{l@dnumpstartsL} --- the number of chunks to be processed.
5548 % \item set \protect\cs{ifpst@rtedL} to FALSE.
5549 % \end{itemize}
5550 % \begin{macrocode}
5551 \newcommand*{\beginnumbering}{%
5552 \ifnumbering
5553 \led@err@NumberingStarted
5554 \endnumbering
5555 \fi
5556 \global\numberingtrue
5557 \global\afterendnumberingRfalse%
5558 \global\advance\section@num \@ne
5559 \initnumbering@reg
5560 \message{Section \the\section@num }%
5561 \line@list@stuff{\jobname.\extensionchars\the\section@num}%
5562 \ifcontinuousnumberingwithcolumns%
5563 \unless\ifafterendnumberingR%
5564 \unless\ifl@dpairing%
5565 \ledRcoltrue%
5566 \global\advance\section@numR \@ne%
5567 \message{Section \the\section@numR R (continuoousnumbering)}%
5568 \line@list@stuffR{\jobname.\extensionchars\the\section@numR R}%
5569 \ledRcolfalse%
5570 \fi%
5571 \fi%
5572 \fi%
5573 \l@dend@stuff
5574 \setcounter{pstart}{1}
5575 \ifl@dpairing
5576 \global\l@dnumpstartsL \z@
5577 \global\pst@rtedLfalse
5578 % \end{macrocode}
5579 % The tools for section's title commands are called:
5580 % \begin{itemize}
5581 % \item Define an empty list of pstart number where sectioning commands are called.
5582 % \item Input auxiliary file with the description of section titles.
5583 % \item Open the same auxiliary file to write in.
5584 % \end{itemize}
5585 % \begin{macrocode}
5586 \else
5587 \begingroup
5588 \global\@afterindenttrue%In order to retablish normal feature if the \begingroup was not here
5589 \initnumbering@quote
5590 \ifwidthliketwocolumns%
5591 \setwidthliketwocolumns%
5592 \csuse{setpositionliketwocolumns@\columns@position}%
5593 \fi%
5594 \fi
5595 \gdef\eled@sections@@{}%
5596 \if@noeled@sec\else%
5597 \makeatletter%
5598 \InputIfFileExists%
5599 {\l@auxdir\jobname.eledsec\the\section@num}%
5600 {}%
5601 {\led@warn@NoFile{\l@auxdir\jobname.eledsec\the\section@num}}%
5602 \makeatother%
5603 \immediate\openout\eled@sectioning@out=\l@auxdir\jobname.eledsec\the\section@num\relax%
5604 \fi%
5605 }
5606 \newcommand*{\initnumbering@reg}{%
5607 \global\pst@rtedLfalse
5608 \global\l@dnumpstartsL \z@
5609 \global\absline@num \z@
5610 \gdef\normal@page@break{}
5611 \gdef\l@prev@pb{}
5612 \gdef\l@prev@nopb{}
5613 \global\line@num \z@
5614 \global\subline@num \z@
5615 \global\@lock \z@
5616 \global\sub@lock \z@
5617 \global\sublines@false
5618 \global\let\next@page@num=\relax
5619 \global\let\this@section@next@page@num=\relax%
5620 \global\let\sub@change=\relax
5621 \global\last@page@num=-10000%
5622 \ifdefined\line@numR%
5623 \line@numR=\z@%
5624 \last@page@numR=\z@%
5625 \fi%
5626 \resetprevline@
5627 \resetprevpage@num
5628 \global\stopmsdata@inserted@true%
5629 \global\let\@msdata@list\relax%
5630 \global\old@parindent=\parindent%
5631 \global\csundef{@msdata@\add@msd@c @data}%
5632 }
5633
5634 % \end{macrocode}
5635 % \end{macro}
5636 % \end{macro}
5637 %
5638 % \begin{macro}{\endnumbering}
5639 % \protect\cs{endnumbering} must follow the last text for a numbered section.
5640 % It takes care of notifying you when changes have been noted in the
5641 % input that require running the file through again to move everything
5642 % to the right place.
5643 % \changes{v0.7.0}{2005/02/24}{Changed \protect\cs{endnumbering} for eledpar}
5644 % \changes{v1.12.5}{2014/08/31}{Allow to mix parallel columns and normal text when using \protect\cs{pausenumbering}}
5645 % We define it using \cs{def} and not \cs{newcommand} because \LaTeX\ does not allow defining command whose name starts by \enquote{end} except if we are currently creating an environment, which is not the case here.
5646 % \begin{macrocode}
5647 \def\endnumbering{%
5648 \ifnumbering
5649 \global\numberingfalse
5650 \normal@pars
5651 \ifnum\l@dnumpstartsL=0%
5652 \led@err@NumberingWithoutPstart%
5653 \fi%
5654 % \end{macrocode}
5655 % For the continuousnumberingwithcolumn options, we need to store a global value for the next \cs{endnumbering}.
5656 % We don't modify this counter globally, because that creates problem for nested \cs{edtext}.
5657 % \begin{macrocode}
5658 \global\page@num=\this@section@page@num%
5659 \global\last@page@num=\this@section@last@page@num%
5660 \global\let\next@page@num\this@section@next@page@num%
5661 \ifl@dpairing
5662 \global\pst@rtedLfalse
5663 \else
5664 \ifx\insertlines@list\empty\else
5665 \global\noteschanged@true
5666 \fi
5667 \ifx\line@list\empty\else
5668 \global\noteschanged@true
5669 \fi
5670 \fi
5671 \ifnoteschanged@
5672 \led@mess@NotesChanged
5673 \fi
5674 \else
5675 \led@err@NumberingNotStarted
5676 \fi
5677 \autoparfalse
5678 \if@noeled@sec\else%
5679 \immediate\closeout\eled@sectioning@out%
5680 \fi%
5681 \ifl@dpairing\else
5682 \global\l@dnumpstartsL=\z@%
5683 \endgroup
5684 \fi
5685 }
5686 % \end{macrocode}
5687 % \end{macro}
5688 %
5689 % \begin{macro}{\pausenumbering}
5690 % \begin{macro}{\resumenumbering}
5691 % \begin{macro}{\ifresumenumbering@start}
5692 % \begin{macro}{\pausenumbering@page@num}
5693 % The \protect\cs{pausenumbering} macro is just the same as
5694 % \protect\cs{endnumbering}, but with the \protect\cs{ifnumbering} flag set to \verb"true", to
5695 % show that numbering continues across the gap.\footnote{Peter Wilson's thanks
5696 % to Wayne Sullivan,\index{Sullivan, Wayne} who suggested the idea
5697 % behind these macros.}
5698 % The \cs{pausenumbering@page@num} counter stores the \cs{this@section@next@page@num} when the \cs{pause@numbering} is called.
5699 % \begin{macrocode}
5700 \newcount\pausenumbering@page@num%
5701 \newcommand{\pausenumbering}{%
5702 \ifx\this@section@next@page@num\relax%
5703 \global\pausenumbering@page@num=0%
5704 \else%
5705 \global\pausenumbering@page@num=\this@section@next@page@num%
5706 \fi%
5707 \ifautopar\global\autopar@pausetrue\fi%
5708 \endnumbering\global\numberingtrue}
5709 % \end{macrocode}
5710 % The \protect\cs{resumenumbering} macro is a bit more involved, but not much.
5711 % It does most of the same things as \protect\cs{beginnumbering}, but
5712 % without resetting the various counters. Note that no check is made
5713 % by \protect\cs{resumenumbering} to ensure that \protect\cs{pausenumbering} was actually
5714 % invoked.
5715 % The boolean \cs{ifresumenumbering@start} is set to true. That allows us to avoid resetting the line number at the first line of \cs{resumenumbering} if the lineation is by page.
5716 % This boolean is set to false after the first action.
5717 % \changes{v0.7.0}{2005/02/24}{Changed \protect\cs{resumenumbering} for eledpar}
5718 % \changes{v1.12.5}{2014/08/31}{Debug \protect\cs{resumenumbering}}
5719 % \begin{macrocode}
5720 \newif\ifresumenumbering@start%
5721 \newcommand*{\resumenumbering}{%
5722 \ifnumbering
5723 \ifautopar@pause\autopar\fi
5724 \global\pst@rtedLtrue
5725 \global\advance\section@num \@ne
5726 \global\resumenumbering@starttrue%
5727 \led@mess@SectionContinued{\the\section@num}%
5728 \set@continuousnumberingforL%
5729 \line@list@stuff{\jobname.\extensionchars\the\section@num}%
5730 \ifcontinuousnumberingwithcolumns%
5731 \unless\ifafterendnumberingR%
5732 \unless\ifl@dpairing%
5733 \ledRcoltrue%
5734 \global\advance\section@numR \@ne%
5735 \message{Section \the\section@numR R (continuoousnumbering)}%
5736 \line@list@stuffR{\jobname.\extensionchars\the\section@numR R}%
5737 \ledRcolfalse%
5738 \fi%
5739 \fi%
5740 \fi%
5741 \l@dend@stuff
5742 \ifl@dpairing\else%
5743 \begingroup%
5744 \initnumbering@quote%
5745 \ifwidthliketwocolumns%
5746 \setwidthliketwocolumns%
5747 \csuse{setpositionliketwocolumns@\columns@position}%
5748 \fi%
5749 \fi%
5750 \else
5751 \led@err@NumberingShouldHaveStarted
5752 \endnumbering
5753 \beginnumbering
5754 \fi}
5755
5756
5757 % \end{macrocode}
5758 % \end{macro}
5759 % \end{macro}
5760 % \end{macro}
5761 % \end{macro}
5762 % \begin{macro}{\set@continuousnumberingforL}
5763 % \cs{set@continuousnumberingforl} sets pstart counters at a \cs{beginnumbering} or a \cs{resumenumbering} in order to have continuous numbering with single column text.
5764 % \begin{macrocode}
5765 \newcommand{\set@continuousnumberingforL}{%
5766 \ifcontinuousnumberingwithcolumns%
5767 \ifl@dpairing%
5768 \unless\ifl@dpaging%
5769 \global\c@pstartL=\c@pstart%
5770 \global\c@pstartR=\c@pstart%
5771 \fi%
5772 \fi%
5773 \fi%
5774 }%
5775 % \end{macrocode}
5776 % \end{macro}
5777 %
5778 % \section{List macros}
5779 %
5780 %
5781 % We will make heavy use of lists of information, which will be built
5782 % up and taken apart by the following macros; they are
5783 % adapted from \thetexbook, pp.\,378--379, which discusses
5784 % their use in more detail.
5785 %
5786 % These macros consume a large amount of the run-time of this code.
5787 % We intend to replace them in a future version, and in anticipation
5788 % of doing so have defined their interface in such a way that it is
5789 % not sensitive to details of the underlying code.
5790 %
5791 % The historical list tools of \ledmac are keept, because in many cause there are more useful than \protect\package{etoolbox}'s lists.
5792 % They allows to get and delete the first element of a list in one operation. They also expands the items add to the list.
5793 %
5794 % However, \protect\package{etoolbox}'s lists are more useful to loop on them.
5795 % Consequently, depending on what we need, we use one or other.
5796 %
5797 % It could be nice to unify them to the \LaTeX3 list, however such migration would take quite time with some risk of error, for a gain which will be minor.
5798 %
5799 % \begin{macro}{\list@create}
5800 % The \protect\cs{list@create} macro creates a new list.
5801 % This macro does not do anything beyond initializing an empty
5802 % list macro.
5803 %
5804 % \begin{macrocode}
5805 \newcommand*{\list@create}[1]{%
5806 \global\let#1=\empty%
5807 }%
5808 % \end{macrocode}
5809 % \end{macro}
5810 %
5811 % \begin{macro}{\list@clear}
5812 % The \protect\cs{list@clear} macro just initializes a list to the empty list;
5813 % it is no different from
5814 % \protect\cs{list@create} in its effect, but it is in its semantic .
5815 % \begin{macrocode}
5816 \newcommand*{\list@clear}[1]{%
5817 \global\let#1=\empty%
5818 }
5819 % \end{macrocode}
5820 % \end{macro}
5821 %
5822 % \begin{macro}{\xright@appenditem}
5823 % \begin{macro}{\led@toksa}
5824 % \begin{macro}{\led@toksb}
5825 % \protect\cs{xright@appenditem} expands an item and appends it to the right
5826 % end of a list macro. We want the expansion because we will often
5827 % be using this to store the current value of a counter.
5828 % \protect\cs{xright@appenditem} creates global control sequences, like \protect\cs{xdef}, and uses two
5829 % temporary token-list registers, \protect\cs{@toksa} and \protect\cs{@toksb}.
5830 % \begin{macrocode}
5831 \newtoks\led@toksa \newtoks\led@toksb
5832 \global\led@toksa={\\}
5833 \long\def\xright@appenditem#1\to#2{%
5834 \global\led@toksb=\expandafter{#2}%
5835 \xdef#2{\the\led@toksb\the\led@toksa\expandafter{#1}}%
5836 \global\led@toksb={}}
5837 % \end{macrocode}
5838 % \end{macro}
5839 % \end{macro}
5840 % \end{macro}
5841 %
5842 % \begin{macro}{\xleft@appenditem}
5843 % \protect\cs{xleft@appenditem} expands an item and appends it to the left
5844 % end of a list macro; it is otherwise identical to
5845 % \protect\cs{xright@appenditem}.
5846 % \begin{macrocode}
5847 \long\def\xleft@appenditem#1\to#2{%
5848 \global\led@toksb=\expandafter{#2}%
5849 \xdef#2{\the\led@toksa\expandafter{#1}\the\led@toksb}%
5850 \global\led@toksb={}}
5851 % \end{macrocode}
5852 % \end{macro}
5853 %
5854 % \begin{macro}{\gl@p}
5855 % The \protect\cs{gl@p} macro removes the leftmost
5856 % item from a list and places it in a
5857 % control sequence. You type \verb"\gl@p\l\to\z"
5858 % (where \verb"\l" is the list macro, and
5859 % \verb"\z" receives the left item). \verb"\l" is assumed nonempty:use
5860 % \verb"\ifx\l\empty" to test for an empty \verb"\l". The control
5861 % sequences created by \protect\cs{gl@p} are all global.
5862 % \begin{macrocode}
5863 \def\gl@p#1\to#2{\expandafter\gl@poff#1\gl@poff#1#2}
5864 \long\def\gl@poff\\#1#2\gl@poff#3#4{\gdef#4{#1}\gdef#3{#2}}
5865
5866 % \end{macrocode}
5867 % \end{macro}
5868 %
5869 % \section{Line counting}
5870 % \label{lineation}\relax
5871 %
5872 % \subsection{Choosing the system of lineation}
5873 % \changes{v0.15.0}{2012/06/11}{Line numbering can be reset at each pstart.}
5874 % Line number can be reset at each section (default) ; at each page ; at each pstart.
5875 % Here we define
5876 % internal codes for these systems and the macros.
5877 %
5878 %
5879 % \begin{macro}{\ifbypstart@}
5880 % \begin{macro}{\bypstart@true}
5881 % \begin{macro}{\bypstart@false}
5882 % \begin{macro}{\ifbypage@}
5883 % \begin{macro}{\bypage@true}
5884 % \begin{macro}{\bypage@false}
5885 % The \protect\cs{ifbypage@} and \protect\cs{ifbypstart@} flag specifie the current lineation
5886 % system: \begin{itemize}
5887 % \item line-of-page: \verb|bypstart@ = false| and \verb|bypage@ = true|.
5888 % \item line-of-pstart: \verb|bypstart@ = true| and \verb|bypage@ = false|.
5889 % \end{itemize}
5890 % \Macpackage\ will use the line-of-section system unless instructed otherwise.
5891 % \begin{macrocode}
5892 \newif\ifbypage@
5893 \newif\ifbypstart@
5894 % \end{macrocode}
5895 % \end{macro}
5896 % \end{macro}
5897 % \end{macro}
5898 % \end{macro}
5899 % \end{macro}
5900 % \end{macro}
5901 %
5902 % The \protect\cs{ifbypage@R} and \protect\cs{ifbypstart@R} flag specifie the current lineation for right side in case of using \parpackage. They are now defined because they are used in some specific code.
5903 % \Parpackage will use the line-of-section system unless instructed otherwise.
5904 % \begin{macro}{\ifbypage@R}
5905 % \begin{macro}{\ifbypstart@R}
5906 % \begin{macrocode}
5907 \newif\ifbypage@R
5908 \newif\ifbypstart@R
5909 % \end{macrocode}
5910 % \end{macro}
5911 % \end{macro}
5912 % \begin{macro}{\lineation}
5913 % \protect\cs{lineation}\marg{word} is the macro you use to select the
5914 % lineation system.
5915 % Its argument is a string: either \verb+page+, \verb+section+ or \verb+pstart+.
5916 % \begin{macrocode}
5917 \newcommand*{\lineation}[1]{{
5918 % \end{macrocode}
5919 % We can't change the lineation system inside numbering section.
5920 % \begin{macrocode}
5921 \ifnumbering
5922 \led@err@LineationInNumbered
5923 \else
5924 % \end{macrocode}
5925 % If the argument is \verb+page+.
5926 % \begin{macrocode}
5927 \def\@tempa{#1}\def\@tempb{page}%
5928 \ifx\@tempa\@tempb
5929 \global\bypage@true
5930 \global\bypstart@false
5931 \unless\ifnocritical@%
5932 \Xpstart[][false]%
5933 \fi%
5934 % \end{macrocode}
5935 % If the argument is \verb+pstart+.
5936 % \begin{macrocode}
5937 \else
5938 \def\@tempb{pstart}%
5939 \ifx\@tempa\@tempb
5940 \global\bypage@false
5941 \global\bypstart@true
5942 \unless\ifnocritical@%
5943 \Xpstart%
5944 \fi%
5945 % \end{macrocode}
5946 % And finally, if the argument is \verb+section+ (default).
5947 % \begin{macrocode}
5948 \else
5949 \def\@tempb{section}
5950 \ifx\@tempa\@tempb
5951 \global\bypage@false
5952 \global\bypstart@false
5953 \unless\ifnocritical@%
5954 \Xpstart[][false]%
5955 \fi%
5956 % \end{macrocode}
5957 % In other case, it is an error.
5958 % \begin{macrocode}
5959 \else
5960 \led@warn@BadLineation
5961 \fi
5962 \fi
5963 \fi
5964 \fi}}
5965 % \end{macrocode}
5966 % \end{macro}
5967 % \subsection{Line number margin}
5968 % \begin{macro}{\linenummargin}
5969 % \begin{macro}{\line@margin}
5970 % \begin{macro}{\l@dgetline@margin}
5971 % \protect\cs{linenummargin}\marg{word} specify which margin
5972 % line numbers are in; it takes one argument, a string, which value can be
5973 % \verb+left+ ; \verb+right+; \verb+inner+ or
5974 % \verb+outer+.
5975 %
5976 % The selection is recorded in the count \protect\cs{line@margin}:
5977 % $0$ for left, $1$ for right, $2$ for outer, and $3$ for inner.
5978 % \changes{v0.7.0}{2005/02/23}{Added \protect\cs{l@dgetline@margin}}
5979 % \begin{macrocode}
5980 \newcount\line@margin%
5981 \newcount\line@margin@columns%Only for parallel typesetting
5982 \line@margin@columns=\m@ne%
5983
5984 \newcommand*{\linenummargin}[1]{{%
5985 \l@dgetline@margin{#1}%
5986 \ifnum\@l@dtempcntb>\m@ne
5987 \ifledRcol
5988 \global\line@marginR=\@l@dtempcntb
5989 \led@warn@setting@in@rightside{\linenummargin}%
5990 \else
5991 \global\line@margin=\@l@dtempcntb
5992 \fi
5993 \fi}}
5994
5995 \newcommand*{\l@dgetline@margin}[1]{%
5996 \def\@tempa{#1}\def\@tempb{left}%
5997 \ifx\@tempa\@tempb
5998 \@l@dtempcntb \z@
5999 \else
6000 \def\@tempb{right}%
6001 \ifx\@tempa\@tempb
6002 \@l@dtempcntb \@ne
6003 \else
6004 \def\@tempb{outer}%
6005 \ifx\@tempa\@tempb
6006 \@l@dtempcntb \tw@
6007 \else
6008 \def\@tempb{inner}%
6009 \ifx\@tempa\@tempb
6010 \@l@dtempcntb \thr@@
6011 \else
6012 \led@warn@BadLinenummargin
6013 \@l@dtempcntb \m@ne
6014 \fi
6015 \fi
6016 \fi
6017 \fi}
6018
6019 % \end{macrocode}
6020 % \end{macro}
6021 % \end{macro}
6022 % \end{macro}
6023 % \subsection{Line number initialization and increment}
6024 % \begin{macro}{\c@firstlinenum}
6025 % \begin{macro}{\c@linenumincrement}
6026 % The following counters tell \macpackage\ which lines should be
6027 % printed with line numbers. \verb+firstlinenum+ is the number of the
6028 % first line in each section that gets a number;
6029 % \verb+linenumincrement+
6030 % is the difference between successive numbered lines. The initial
6031 % values of these counters produce labels on lines $5$, $10$, $15$, etc.
6032 % \verb+linenumincrement+ must be at least $1$.
6033 %
6034 % \begin{macrocode}
6035 \newcounter{firstlinenum}
6036 \setcounter{firstlinenum}{5}
6037 \newcounter{linenumincrement}
6038 \setcounter{linenumincrement}{5}
6039 % \end{macrocode}
6040 % \end{macro}
6041 % \end{macro}
6042 %
6043 % \begin{macro}{\c@firstsublinenum}
6044 % \begin{macro}{\c@sublinenumincrement}
6045 % The following parameters are just like \verb+firstlinenum+ and
6046 % \verb+linenumincrement+, but for sub-line numbers.
6047 % \verb+sublinenumincrement+ must be at least $1$.
6048 %
6049 % \begin{macrocode}
6050 \newcounter{firstsublinenum}
6051 \setcounter{firstsublinenum}{5}
6052 \newcounter{sublinenumincrement}
6053 \setcounter{sublinenumincrement}{5}
6054
6055 % \end{macrocode}
6056 % \end{macro}
6057 % \end{macro}
6058 %
6059 % \begin{macro}{\firstlinenum}
6060 % \begin{macro}{\linenumincrement}
6061 % \begin{macro}{\firstsublinenum}
6062 % \begin{macro}{\sublinenumincrement}
6063 % These macros can be used to set the corresponding counters.
6064 % \changes{v0.7.0}{2005/02/18}{Added \protect\cs{firstlinenum}, \protect\cs{linenumincrement},
6065 % \protect\cs{firstsublinenum} and \protect\cs{linenumincrement}}
6066 % \begin{macrocode}
6067
6068 \newcommand*{\firstlinenum}[1]{%
6069 \ifledRcol%
6070 \setcounter{firstlinenumR}{#1}%
6071 \led@warn@setting@in@rightside{\firstlinenum}%
6072 \else%
6073 \setcounter{firstlinenum}{#1}%
6074 \fi%
6075 }
6076 \newcommand*{\linenumincrement}[1]{%
6077 \ifledRcol%
6078 \setcounter{linenumincrementR}{#1}%
6079 \led@warn@setting@in@rightside{\linenumincrement}%
6080 \else%
6081 \setcounter{linenumincrement}{#1}%
6082 \fi%
6083 }
6084 \newcommand*{\firstsublinenum}[1]{%
6085 \ifledRcol%
6086 \setcounter{firstsublinenumR}{#1}%
6087 \led@warn@setting@in@rightside{\firstsublinenum}%
6088 \else%
6089 \setcounter{firstsublinenum}{#1}%
6090 \fi%
6091 }
6092 \newcommand*{\sublinenumincrement}[1]{%
6093 \ifledRcol%
6094 \setcounter{sublinenumincrementR}{#1}%
6095 \led@warn@setting@in@rightside{\sublinenumincrement}%
6096 \else%
6097 \setcounter{sublinenumincrement}{#1}%
6098 \fi%
6099 }
6100
6101 % \end{macrocode}
6102 % \end{macro}
6103 % \end{macro}
6104 % \end{macro}
6105 % \end{macro}
6106 %
6107 % \subsection{Line number locking}
6108 % \begin{macro}{\lockdisp}
6109 % \begin{macro}{\lock@disp}
6110 % \begin{macro}{\l@dgetlock@disp}
6111 % When line locking is being used, the \protect\cs{lockdisp}\marg{word} macro
6112 % specifies whether a line number---if one is due to
6113 % appear---should be printed on the first printed line or on the
6114 % last, or by all of them.
6115 % Its argument is a word, either
6116 % \verb+first+, \verb+last+, or \verb+all+.
6117 % Initially, it is set to \verb+first+.
6118 %
6119 % \protect\cs{lock@disp} encodes the selection: $0$ for first, $1$ for last,
6120 % $2$ for all.
6121 % \changes{v0.7.0}{2005/02/23}{Added \protect\cs{l@dgetlock@disp}}
6122 % \begin{macrocode}
6123 \newcount\lock@disp
6124 \newcommand{\lockdisp}[1]{{%
6125 \l@dgetlock@disp{#1}%
6126 \ifnum\@l@dtempcntb>\m@ne
6127 \global\lock@disp=\@l@dtempcntb
6128 \else
6129 \led@warn@BadLockdisp
6130 \fi}}
6131 \newcommand*{\l@dgetlock@disp}[1]{
6132 \def\@tempa{#1}\def\@tempb{first}%
6133 \ifx\@tempa\@tempb
6134 \@l@dtempcntb \z@
6135 \else
6136 \def\@tempb{last}%
6137 \ifx\@tempa\@tempb
6138 \@l@dtempcntb \@ne
6139 \else
6140 \def\@tempb{all}%
6141 \ifx\@tempa\@tempb
6142 \@l@dtempcntb \tw@
6143 \else
6144 \@l@dtempcntb \m@ne
6145 \fi
6146 \fi
6147 \fi}
6148
6149 % \end{macrocode}
6150 % \end{macro}
6151 % \end{macro}
6152 % \end{macro}
6153 %
6154 % \begin{macro}{\sublockdisp}
6155 % \begin{macro}{\sublock@disp}
6156 % The same questions about where to print the line number apply to
6157 % sub-lines, and these are the analogous macros for dealing with
6158 % the problem.
6159 % \begin{macrocode}
6160 \newcount\sublock@disp
6161 \newcommand{\sublockdisp}[1]{{%
6162 \l@dgetlock@disp{#1}%
6163 \ifnum\@l@dtempcntb>\m@ne
6164 \global\sublock@disp=\@l@dtempcntb
6165 \else
6166 \led@warn@BadSublockdisp
6167 \fi}}
6168
6169 % \end{macrocode}
6170 % \end{macro}
6171 % \end{macro}
6172 % \subsection{Line number style}
6173 % \begin{macro}{\linenumberstyle}
6174 % \begin{macro}{\linenumrep}
6175 % \begin{macro}{\linenumr@p}
6176 % \begin{macro}{\sublinenumberstyle}
6177 % \begin{macro}{\sublinenumrep}
6178 % \begin{macro}{\sublinenumr@p}
6179 % We provide a mechanism for using different representations of the
6180 % line numbers, not just the normal arabic.
6181 %
6182 % NOTE: In v0.7 \protect\cs{linenumrep} and \protect\cs{sublinenumrep} replaced
6183 % the internal \protect\cs{linenumr@p} and \protect\cs{sublinenumr@p}.
6184 %
6185 % \protect\cs{linenumberstyle} and \protect\cs{sublinenumberstyle} are user level
6186 % macros for setting the number representation (\protect\cs{linenumrep}
6187 % and \protect\cs{sublinenumrep}) for line and sub-line numbers.
6188 % \changes{v0.3.0}{2004/02/14}{Added \protect\cs{linenumberstyle} and \protect\cs{sublinenumberstyle}}
6189 % \changes{v0.7.0}{2005/02/18}{Using \protect\cs{linenumrep} instead of \protect\cs{linenumr@p}}
6190 % \changes{v0.7.0}{2005/02/18}{Using \protect\cs{sublinenumrep} instead of \protect\cs{sublinenumr@p}}
6191 % \begin{macrocode}
6192 \newcommand*{\linenumberstyle}[1]{%
6193 \def\linenumrep##1{\@nameuse{@#1}{##1}}}
6194 \newcommand*{\sublinenumberstyle}[1]{%
6195 \def\sublinenumrep##1{\@nameuse{@#1}{##1}}}
6196 % \end{macrocode}
6197 % Initialise the number styles to arabic.
6198 % \begin{macrocode}
6199 \linenumberstyle{arabic}
6200 \let\linenumr@p\linenumrep
6201 \sublinenumberstyle{arabic}
6202 \let\sublinenumr@p\sublinenumrep
6203
6204 % \end{macrocode}
6205 % \end{macro}
6206 % \end{macro}
6207 % \end{macro}
6208 % \end{macro}
6209 % \end{macro}
6210 % \end{macro}
6211 % \subsection{Line number printing}
6212 % \begin{macro}{\leftlinenum}
6213 % \begin{macro}{\rightlinenum}
6214 % \begin{macro}{\linenumsep}
6215 % \begin{macro}{\numlabfont}
6216 % \begin{macro}{\ledlinenum}
6217 % \protect\cs{leftlinenum} and \protect\cs{rightlinenum} are the macros that are
6218 % called to print marginal line numbers on
6219 % a page, for left- and right-hand margins respectively.
6220 % They are made easy to access and change, since you may
6221 % want to change the styling in some way.
6222 % These standard versions
6223 % illustrate the general sort of thing that will be needed; they are
6224 % based on the \protect\cs{leftheadline} macro in \thetexbook, p.\,416.
6225 %
6226 % Whatever these macros output gets printed in a box that will be
6227 % put into the appropriate margin without any space between it and the
6228 % line of text.
6229 % You will generally want a kern between a line number and
6230 % the text, and \protect\cs{linenumsep} is provided as a standard way of
6231 % storing its size. Line numbers are usually printed in a smaller
6232 % font, and \protect\cs{numlabfont} is provided as a standard name for that
6233 % font. When called, these macros
6234 % will be executed within a group, so font changes and the like will
6235 % remain local.
6236 %
6237 % \protect\cs{ledlinenum} typesets the line (and subline) number.
6238 %
6239 % The original \protect\cs{numlabfont} specification is equivalent to
6240 % the \LaTeX\ \protect\cs{scriptsize} for a 10pt document.
6241 % \changes{v0.3.0}{2004/02/14}{Added \protect\cs{linenumr@p} and \protect\cs{sublinenum@rep}
6242 % to \protect\cs{leftlinenum} and \protect\cs{rightlinenum}}
6243 % \changes{v0.7.0}{2005/02/18}{Added \protect\cs{ledlinenum} for use by
6244 % \protect\cs{leftlinenum} and \protect\cs{rightlinenum}}
6245 % \begin{macrocode}
6246 \newlength{\linenumsep}
6247 \setlength{\linenumsep}{1pc}
6248 \newcommand*{\numlabfont}{\normalfont\scriptsize}
6249 \newcommand*{\ledlinenum}{%
6250 \bgroup%
6251 \ifluatex%
6252 \textdir TLT%
6253 \fi%
6254 \numlabfont%
6255 \unless\iflinenumannotationotherside%
6256 \ifdefstring{\Xlinenumannotationposition@side}{before}{%
6257 \l@wrap@ifnotemptybox{\Xwraplinenumannotation@side}{%
6258 \csuse{annot@\the\absline@num @\the\section@num}%
6259 }%
6260 }{}%
6261 \fi%
6262 \linenumrep{\line@num}%
6263 \ifsublines@
6264 \ifnum\subline@num>0\relax
6265 \unskip%
6266 \Xsublinesep@side%
6267 \sublinenumrep{\subline@num}%
6268 \fi
6269 \fi%
6270 \unless\iflinenumannotationotherside%
6271 \ifdefstring{\Xlinenumannotationposition@side}{after}{%
6272 \l@wrap@ifnotemptybox{\Xwraplinenumannotation@side}{%
6273 \csuse{annot@\the\absline@num @\the\section@num}%
6274 }%
6275 }{}%
6276 \fi%
6277 \egroup%
6278 }%
6279
6280 \newcommand*{\leftlinenum}{%
6281 \ledlinenum%
6282 \kern\linenumsep%
6283 }%
6284 \newcommand*{\rightlinenum}{%
6285 \kern\linenumsep%
6286 \ledlinenum%
6287 }%
6288
6289 % \end{macrocode}
6290 % \end{macro}
6291 % \end{macro}
6292 % \end{macro}
6293 % \end{macro}
6294 % \end{macro}
6295 %
6296 % \begin{macro}{\leftlinenumannotation}%
6297 % \begin{macro}{\rightlinenumannotation}%
6298 % The \cs{leftlinenumannotation} and \cs{rightlinenumannotation} prints the line number annotation; when user-defined it must be printed on the side opposite the main line number.
6299 % \begin{macrocode}
6300 \newcommand*{\leftlinenumannotation}{%
6301 \l@wrap@ifnotemptybox{\Xwraplinenumannotation@side}{%
6302 \csuse{annot@\the\absline@num @\the\section@num}%
6303 }%
6304 \kern\linenumsep%
6305 }%
6306 \newcommand*{\rightlinenumannotation}{%
6307 \kern\linenumsep%
6308 \l@wrap@ifnotemptybox{\Xwraplinenumannotation@side}{%
6309 \csuse{annot@\the\absline@num @\the\section@num}%
6310 }%
6311 }%
6312 % \end{macrocode}
6313 % \end{macro}
6314 % \end{macro}
6315 % \subsection{Line number counters and lists}
6316 %
6317 % Footnote references using line numbers rather than symbols can't be
6318 % generated in one pass, because we do not know the line numbers till we
6319 % ship out the pages. It would be possible if footnotes were never keyed
6320 % to more than one line; but some footnotes gloss passages that may run
6321 % for several lines, and they must be tied to the first line of the
6322 % passage glossed. And even one-line passages require two passes if we
6323 % want line-per-page numbering rather than line-per-section numbering.
6324 %
6325 % So we run \LaTeX\ over the text several times, and each time save
6326 % information about page and line numbers in a \enquote{line-list file} to
6327 % be used during the next pass. At the start of each section---whenever
6328 % \protect\cs{beginnumbering} is executed---the line-list file
6329 % for that section
6330 % is read, and the information from it is encoded into a few list
6331 % macros.
6332 %
6333 % We need first to define the different line numbers that are involved
6334 % in these macros, and the associated counters.
6335 %
6336 % \begin{macro}{\line@num}
6337 % The count \protect\cs{line@num} stores the line number that is used in
6338 % marginal line numbering and in notes: counting either by section, page or pstart, depending on your
6339 % choice for this section. This may be qualified by \protect\cs{subline@num}.
6340 % \begin{macrocode}
6341 \newcount\line@num
6342 % \end{macrocode}
6343 % \end{macro}
6344 %
6345 % \begin{macro}{\subline@num}
6346 % The count \protect\cs{subline@num} stores
6347 % a sub-line number that qualifies \protect\cs{line@num}. For example,
6348 % line $10$ might have sub-line numbers $1$, $2$ and $3$, which might be
6349 % printed as lines $10.1$, $10.2$, $10.3$.
6350 % \begin{macrocode}
6351 \newcount\subline@num
6352 % \end{macrocode}
6353 % \end{macro}
6354 %
6355 % \begin{macro}{\ifsublines@}
6356 % \begin{macro}{\ifsublines@R}
6357 % \begin{macro}{\sublines@true}
6358 % \begin{macro}{\sublines@false}
6359 % We maintain an associated flag, \protect\cs{ifsublines@},
6360 % to tell us whether we're within
6361 % a sub-line range or not (and the equivalent for right side: \cs{ifsublines@R})
6362 %
6363 % You may wonder why we do not just use the value of \protect\cs{subline@num}
6364 % to determine this---treating anything greater than $0$ as an
6365 % indication that sub-lineation is on. We need a separate flag because
6366 % sub-lineation can be used together with line-number locking in odd
6367 % ways: several pieces of a logical line might be interrupted by
6368 % pieces of sub-lineated text, and those sub-line numbers should not
6369 % return to zero until the next change in the major line number. This
6370 % is common in the typesetting of English Renaissance verse
6371 % drama\index{Middleton, Thomas}, in which stage directions are
6372 % given sub-line numbers: a single line of verse may be
6373 % interrupted by several stage directions.
6374 % \begin{macrocode}
6375 \newif\ifsublines@
6376 \newif\ifsublines@R%
6377 % \end{macrocode}
6378 % \end{macro}
6379 % \end{macro}
6380 % \end{macro}
6381 % \end{macro}
6382 %
6383 % \begin{macro}{\absline@num}
6384 % The count \protect\cs{absline@num} stores the
6385 % absolute number of lines since the start
6386 % of the section: that is, the number we have actually printed, no matter
6387 % what numbers we attached to them.
6388 % This value is never printed on an output page, though
6389 % \protect\cs{line@num} will often be equal to it. It is used internally to
6390 % keep track of where notes are to appear and where new
6391 % pages start: using this value rather than \protect\cs{line@num} is a lot
6392 % simpler, because it does not depend on the lineation system in use.
6393 % \begin{macrocode}
6394 \newcount\absline@num
6395 % \end{macrocode}
6396 % \end{macro}
6397 %
6398 % We will call \protect\cs{absline@num} numbers \enquote{absolute} numbers, and
6399 % \protect\cs{line@num} and \protect\cs{subline@num} numbers \enquote{visible} numbers.
6400 %
6401 % \subsection{Line number locking counter}
6402 % \begin{macro}{\@lock}
6403 % \begin{macro}{\sub@lock}
6404 % The counts \protect\cs{@lock} and \protect\cs{sub@lock}
6405 % tell us the state of line-number
6406 % and sub-line-number locking. $0$ means we are not within a locked set of
6407 % lines; $1$ means we are at the first line in the set; $2$, at some
6408 % intermediate line; and $3$, at the last line.
6409 % \begin{macrocode}
6410 \newcount\@lock
6411 \newcount\sub@lock
6412 % \end{macrocode}
6413 % \end{macro}
6414 % \end{macro}
6415 % \subsection{Line number associated to lemma}
6416 % \begin{macro}{\line@list}
6417 % \begin{macro}{\insertlines@list}
6418 % \begin{macro}{\actionlines@list}
6419 % \begin{macro}{\actions@list}
6420 % \begin{macro}{\annot@list}
6421 % Now we can define the list of macros which will be created from the
6422 % line-list file. We will maintain the following lists:
6423 % \begin{itemize}\addtolength{\itemsep}{-1ex}
6424 % \item \protect\cs{line@list}: the page and line numbers for every
6425 % lemma marked by \protect\cs{edtext}.
6426 % There are seven pieces of information, separated by vertical bars:
6427 % \label{linenumbers}
6428 % \begin{enumerate}\addtolength{\itemsep}{-1ex}
6429 % \item the starting page,
6430 % \item line, and
6431 % \item sub-line numbers, followed by the
6432 % \item ending page,
6433 % \item line, and
6434 % \item sub-line numbers, and then the
6435 % \item font specifier for the lemma.
6436 % \end{enumerate}
6437 %
6438 %
6439 % These line numbers are all visible numbers.
6440 % The font specifier is a set of four codes for font encoding,
6441 % family, series, and shape, separated by \verb"/" characters.
6442 % Thus a lemma that
6443 % started on page $23$, line $35$ and
6444 % went on until page $24$, line $3$
6445 % (with no sub-line numbering), and was typeset in a normal roman font
6446 % would have a line list entry like this: \\
6447 % \verb"23|35|0|24|3|0|OT1/cmr/m/n".
6448 %
6449 % There is one item in this list for every lemma marked by
6450 % \protect\cs{edtext}, even if there are several notes to that lemma, or no
6451 % notes at all. \protect\cs{edtext} reads the data in this list, making it
6452 % available for use in the text of notes.
6453 %
6454 % \item \protect\cs{insertlines@list}: the line numbers of lines that have
6455 % footnotes or other insertions.
6456 % These are the absolute numbers where the corresponding
6457 % lemmas begin. This list contains one entry for every footnote in the
6458 % section; one lemma may contribute no footnotes or many footnotes.
6459 % This list is used by \protect\cs{add@inserts} within \protect\cs{do@line}, to tell
6460 % it where to insert notes.
6461 %
6462 % \item \protect\cs{actionlines@list}: a list of absolute line numbers at
6463 % which we are to perform special
6464 % actions; these actions are specified by the \protect\cs{actions@list} list
6465 % defined below.
6466 %
6467 % \item \protect\cs{actions@list}: action codes corresponding to the line
6468 % numbers in \protect\cs{actionlines@list}. These codes tell \macpackage\ what action
6469 % it is supposed to take at each of these lines. One action, the
6470 % page-start action, is generated behind the scenes by \macpackage{} itself;
6471 % the others, for specifying sub-lineation, line-number locking, and
6472 % line-number alteration, are generated only by explicit commands in
6473 % your input file. The page-start and line-number-alteration actions
6474 % require arguments, to specify the new values for the page or line
6475 % numbers; instead of storing those arguments in another list, we have
6476 % chosen the action-code values so that they can encode both the action
6477 % and the argument in these cases. Action codes greater than $-1000$
6478 % are page-start actions, and the code value is the page number; action
6479 % codes less than $-5000$ specify line numbers, and the code value is
6480 % a transformed version of the line number; action codes between these
6481 % two values specify other actions which require no argument.
6482 %
6483 % Here is the full list of action codes and their meanings:
6484 %
6485 % Any number greater than $-1000$ is a page-start action: the line number
6486 % associated with it is the first line on a page, and the action number is
6487 % the page number. (The cutoff of $-1000$ is chosen because negative
6488 % page-number values are used by some macro packages; we assume that
6489 % page-number values less than $-1000$ are not common.)
6490 % Page-start action codes are added to the list by
6491 % the \protect\cs{page@action} macro, which is (indirectly) triggered by the
6492 % workings of the \protect\cs{page@start} macro; that macro should always be
6493 % called in the output routine, just before the page contents are
6494 % assembled. \Eledmac{} calls it in \protect\cs{pagecontents}.
6495 %
6496 % The action code $-1001$ specifies the start of sub-lineation: meaning
6497 % that, starting with the next line, we should be advancing
6498 % \protect\cs{subline@num} at each start-of-line command, rather than
6499 % \protect\cs{line@num}.
6500 %
6501 % The action code $-1002$ specifies the end of sub-lineation. At the
6502 % next start-of-line, we should clear the sub-line counter and start
6503 % advancing the line number. The action codes for starting and ending
6504 % sub-lineation are added to the list by the \protect\cs{sub@action} macro, as
6505 % called to implement the \protect\cs{startsub} and \protect\cs{endsub} macros.
6506 %
6507 % The action code $-1003$ specifies the start of line number locking.
6508 % After the number for the current line is computed, it will remain
6509 % at that value through the next line that has an action code to end
6510 % locking.
6511 %
6512 % The action code $-1004$ specifies the end of line number locking.
6513 %
6514 % The action code $-1005$ specifies the start of sub-line number locking.
6515 % After the number for the current sub-line is computed, it will remain
6516 % at that value through the next sub-line that has an action code to end
6517 % locking.
6518 %
6519 % The action code $-1006$ specifies the end of sub-line number locking.
6520 %
6521 % The four action codes for line and sub-line number locking are added
6522 % to the list by the \protect\cs{do@lockon} and \protect\cs{do@lockoff} macros, as called
6523 % to implement the \protect\cs{startlock} and \protect\cs{endlock} macros.
6524 %
6525 % An action code of $-5000$ or less sets the current visible line
6526 % number (either the line number or the sub-line number, whichever is
6527 % currently being advanced) to a specific positive value. The value of
6528 % the code is $-(5000+n)$, where $n$ is the value (always $\ge 0$)
6529 % assigned to the current line number. Action codes of this type are
6530 % added to the list by the \protect\cs{set@line@action} macro, as called to
6531 % implement the \protect\cs{advanceline} and \protect\cs{setline} macros: this action only
6532 % occurs when the user has specified some change to the line numbers
6533 % using those macros. Normally \macpackage{} computes the visible line numbers
6534 % from the absolute line numbers with reference to the other
6535 % action codes and the settings they invoke; it does not require an
6536 % entry in the action-code list for every line.
6537 % \item \cs{annot@list} stores line number annotations for the start and the end lines of each \cs{edtext}, as \cs{line@list} does for line numbers.
6538 % We don't store that in the same list as line numbers as \cs{Xprintlines} already have height arguments, and a \TeX\ macro can take at most nine arguments.
6539 % \end{itemize}
6540 % Here are the commands to create these lists:
6541 %
6542 % \begin{macrocode}
6543 \list@create{\line@list}
6544 \list@create{\insertlines@list}
6545 \list@create{\actionlines@list}
6546 \list@create{\actions@list}
6547 \list@create{\annot@list}%
6548 % \end{macrocode}
6549 %
6550 % \end{macro}
6551 % \end{macro}
6552 % \end{macro}
6553 % \end{macro}
6554 % \end{macro}
6555 %
6556 % \begin{macro}{\page@num}
6557 % \begin{macro}{\endpage@num}
6558 % \begin{macro}{\endline@num}
6559 % \begin{macro}{\endsubline@num}
6560 % We will need some counts while we read the line-list,
6561 % for the page number and the ending page, line, and sub-line numbers.
6562 % Some of these will be used again later on, when we are acting on the
6563 % data in our list macros.
6564 % \begin{macrocode}
6565 \newcount\page@num
6566 \newcount\endpage@num
6567 \newcount\endline@num
6568 \newcount\endsubline@num
6569 % \end{macrocode}
6570 % \end{macro}
6571 % \end{macro}
6572 % \end{macro}
6573 % \end{macro}
6574 % \begin{macro}{\this@section@page@num}
6575 % The \cs{this@section@page@num} stores the page number on which a numbering section ends.
6576 % \begin{macrocode}
6577 \newcount\this@section@page@num%
6578 % \end{macrocode}
6579 % \end{macro}
6580 % \begin{macro}{\ifnoteschanged@}
6581 % \begin{macro}{\noteschanged@true}
6582 % \begin{macro}{\noteschanged@false}
6583 % If the number of the footnotes in a section is different from what it was
6584 % during the last run, or if this is the very first time you've run
6585 % \LaTeX,
6586 % on this file, the information from the line-list used to place the
6587 % notes will be wrong, and some notes will probably be misplaced.
6588 % When this happens, we prefer
6589 % to give a single error message for the whole section rather than
6590 % messages at every point where we notice the problem, because
6591 % we do not really know where in the section notes were added or removed,
6592 % and the solution in any case is simply to run \LaTeX\ two more times;
6593 % there is no fix needed to the document. The
6594 % \protect\cs{ifnoteschanged@} flag is set if such
6595 % a change in the number of notes is discovered at any point.
6596 % \begin{macrocode}
6597 \newif\ifnoteschanged@
6598 % \end{macrocode}
6599 % \end{macro}
6600 % \end{macro}
6601 % \end{macro}
6602 %
6603 % \DescribeMacro{\resetprevline@}
6604 % Inside the apparatus, at each note, the line number is stored in a macro called \protect\cs{prevlineX},
6605 % where X is the letter of the current series.
6606 % This macro is called when using \protect\cs{Xnumberonlyfirstinline}.
6607 % This macro must be reset at the same time as the line number.
6608 % The \protect\cs{resetprevline@} does this resetting for every series.
6609 % \begin{macro}{\resetprevline@}
6610 % \begin{macrocode}
6611 \newcommand*{\resetprevline@}{%
6612 \def\do##1{\global\csundef{prevline##1}}%
6613 \dolistloop{\@series}%
6614 }
6615 % \end{macrocode}
6616 % \end{macro}
6617 %
6618 % \DescribeMacro{\resetprevpage@num}
6619 % Inside the apparatus, at each note, the page number is stored in a macro called \protect\cs{prevpageX@num},
6620 % where X is the letter of the current series.
6621 % This macro is called when using \protect\cs{Xparafootsep} or \protect\cs{parafootsepX}.
6622 % This macro must be reset at the beginning of each numbered section
6623 % The \protect\cs{resetprevpage@} command resets this macro for every series.
6624 % \begin{macro}{\resetprevpage@}
6625 % \begin{macrocode}
6626 \newcommand*{\resetprevpage@num}{%
6627 \def\do##1{%
6628 \ifcsdef{prevpage##1@num}{%
6629 \global\csname prevpage##1@num\endcsname=\z@%
6630 \global\csname prevpage##1@numR\endcsname=\z@%
6631 }%
6632 {}%
6633 \ifcsdef{##1prevpage@num}{%
6634 \global\csname ##1prevpage@num\endcsname=\z@%
6635 \global\csname ##1prevpage@numR\endcsname=\z@%
6636 }%
6637 {}%
6638 }%
6639 \dolistloop{\@series}%
6640 }
6641 % \end{macrocode}
6642 % \end{macro}
6643 % \subsection{Reading the line-list file}
6644 %
6645 %
6646 % \begin{macro}{\read@linelist}
6647 % \protect\cs{read@linelist}\marg{file} is the control sequence
6648 % that is called by \protect\cs{beginnumbering}
6649 % (via \protect\cs{line@list@stuff}) to open and process a
6650 % line-list file; its argument is the name of the file.
6651 % \label{readlinelist}.
6652 % First, it clear all previous line's list.
6653 % \begin{macrocode}
6654 \newread\@inputcheck
6655 \newcommand*{\read@linelist}[1]{%
6656 \ifledRcol%
6657 \list@clearing@regR%
6658 \else%
6659 \list@clearing@reg%
6660 \fi%
6661 % \end{macrocode}
6662 %
6663 % When using \parpackage, make sure that the \protect\cs{maxlinesinpar@list} is empty (otherwise things
6664 % will be thrown out of kilter if there is any old stuff still hanging
6665 % in there).
6666 % \begin{macrocode}
6667 \list@clear{\maxlinesinpar@list}
6668 % \end{macrocode}
6669 % Now get the file and interpret it.
6670 % When the file is there we start a new group and make some special
6671 % definitions we will need to process it.
6672 % It is a sequence of \TeX\
6673 % commands, but they require a few special settings.
6674 % We make [ and
6675 % ] become grouping characters: they are used that way in the
6676 % line-list file, because we need to write them out one at a time
6677 % rather than in balanced pairs, and it is easier to just use
6678 % something other than real braces. @ must become a letter, since
6679 % this is run in the ordinary \LaTeX\ context. We ignore carriage
6680 % returns, since if we are in horizontal mode they can get
6681 % interpreted as spaces to be printed.
6682 %
6683 %
6684 % Our line, page, and line-locking counters were already zeroed
6685 % by \protect\cs{line@list@stuff} if this is being called from within
6686 % \protect\cs{beginnumbering}; sub-lineation will be turned off as well
6687 % in that case. On the other hand,
6688 % if this is being called from \protect\cs{resumenumbering}, those things
6689 % should still have the values they had when \protect\cs{pausenumbering}
6690 % was executed.
6691 %
6692 % If the file is not there, we print an informative message.
6693 %
6694 % Now, after these preliminaries, we start interpreting the file.
6695 %
6696 %
6697 % \begin{macrocode}
6698 \get@linelistfile{#1}%
6699 \@stopmsd%Security if last \endms{} is forgotten
6700 \unless\ifledRcol%Get the last line of the last page
6701 \csnumgdef{@lastabsline@forpage@\the\page@num}{\the\absline@num}%
6702 \csnumgdef{@lastline@forpage@\the\page@num}{\the\line@num}%
6703 \csnumgdef{@lastsubline@forpage@\the\page@num}{\the\subline@num}%
6704 \else%
6705 \csnumgdef{@lastabsline@forpageR@\the\page@numR}{\the\absline@numR}%
6706 \csnumgdef{@lastline@forpageR@\the\page@numR}{\the\line@numR}%
6707 \csnumgdef{@lastsubline@forpageR@\the\page@numR}{\the\subline@numR}%
6708 \fi%
6709 \endgroup
6710 % \end{macrocode}
6711 %
6712 % When the reading is done, we are all through with the
6713 % line-list file. All the information we needed
6714 % from it will now be encoded in our list macros.
6715 %
6716 % Finally, we
6717 % initialize the \protect\cs{next@actionline} and \protect\cs{next@action} macros,
6718 % which specify where and what the next action to be taken is.
6719 % \begin{macrocode}
6720 \ifledRcol
6721 \global\page@numR=\m@ne
6722 \ifx\actionlines@listR\empty
6723 \gdef\next@actionlineR{1000000}%
6724 \else
6725 \gl@p\actionlines@listR\to\next@actionlineR
6726 \gl@p\actions@listR\to\next@actionR
6727 \fi
6728 \else
6729 \global\page@num=\m@ne
6730 \ifx\actionlines@list\empty
6731 \gdef\next@actionline{1000000}%
6732 \else
6733 \gl@p\actionlines@list\to\next@actionline
6734 \gl@p\actions@list\to\next@action
6735 \fi
6736 \fi
6737 }
6738 % \end{macrocode}
6739 % \end{macro}
6740 %
6741 % \begin{macro}{\list@clearing@reg}
6742 % Clears the lists for \protect\cs{read@linelist}
6743 % \changes{v0.7.0}{2005/02/22}{Added \protect\cs{list@clearing@reg}}
6744 % \begin{macrocode}
6745 \newcommand*{\list@clearing@reg}{%
6746 \list@clear{\line@list}%
6747 \list@clear{\insertlines@list}%
6748 \list@clear{\actionlines@list}%
6749 \list@clear{\actions@list}%
6750 \list@clear{\linesinpar@listL}%
6751 \list@clear{\linesonpage@listL}%
6752 }%
6753 % \end{macrocode}
6754 % \end{macro}
6755 %
6756 % \begin{macro}{\get@linelistfile}
6757 % \Macpackage{} can take advantage of the \LaTeX\ \enquote{safe file input} macros
6758 % to get the line-list file.
6759 % \changes{v0.7.0}{2005/02/22}{Added \protect\cs{get@linelistfile}}
6760 % \begin{macrocode}
6761 \newcommand*{\get@linelistfile}[1]{%
6762 \InputIfFileExists{\l@auxdir#1}{%
6763 \global\noteschanged@false
6764 \begingroup
6765 \catcode`\[=1 \catcode`\]=2
6766 \makeatletter \catcode`\^^M=9}{%
6767 \led@warn@NoFile{\l@auxdir#1}%
6768 \global\noteschanged@true
6769 \begingroup}%
6770 }
6771
6772 % \end{macrocode}
6773 % \end{macro}
6774 %
6775 % This version of \protect\cs{read@linelist} creates list macros
6776 % containing data for the entire section, so they could get rather
6777 % large. It would be no more difficult to read the line-list file
6778 % incrementally rather than all at once: we could read, at the
6779 % start of each paragraph, only the commands relating to that
6780 % paragraph. But this would require that we
6781 % have two line-lists open at once, one for reading, one for
6782 % writing, and on systems without version numbers we would have to do
6783 % some file renaming outside of \LaTeX\ for that to work. We have
6784 % retained this slower approach to avoid that sort of hacking
6785 % about, but have provided the \protect\cs{pausenumbering} and
6786 % \protect\cs{resumenumbering} macros to help you if you run into
6787 % macro memory limitations (see \reff{pause} above).
6788 %
6789 % \subsection{Commands within the line-list file}
6790 %
6791 % This section defines the commands that can appear within a
6792 % line-list file. They all have very short names because we are
6793 % likely to be writing very large numbers of them out. One macro,
6794 % \protect\cs{@nl}, is especially short, since it will be written to the
6795 % line-list file once for every line of text in a numbered section.
6796 % (Another of these commands, \protect\cs{@lab}, will be introduced in a
6797 % later section, among the cross-referencing commands it is
6798 % associated with.)
6799 %
6800 % When these commands modify the various page and line counters,
6801 % they deliberately do not use \protect\cs{global}. This is because we
6802 % want them to affect only the counter values within the current
6803 % group when nested calls of \protect\cs{@ref} occur. (The code assumes
6804 % throughout that the value of \protect\cs{globaldefs} is zero.)
6805 %
6806 % The macros with \verb"action" in their names contain all the code
6807 % that modifies the action-code list: again, this is so that they
6808 % can be turned off easily for nested calls of \protect\cs{@ref}.
6809 %
6810 % \begin{macro}{\line@list@version}
6811 % The \protect\cs{line@list@version} check if the line-list file does not refers to the older commands of \macpackage.
6812 % In this case, we stop reading the line-list file.
6813 % Consequently, \protect\cs{line@list@version} must be the first line of a line-number file.
6814 % \begin{macrocode}
6815 \newcommand{\line@list@version}[1]{%
6816 \IfStrEq{#1}{\this@line@list@version}%
6817 {}%
6818 {\ifledRcol%
6819 \led@warn@Obsolete{\jobname.\extensionchars\the\section@num}%
6820 \else%
6821 \led@warn@Obsolete{\jobname.\extensionchars\the\section@num}%
6822 \fi%
6823 \endinput%
6824 }%
6825 }%
6826 % \end{macrocode}
6827 % \end{macro}
6828 % \begin{macro}{\@nl}
6829 % \begin{macro}{\@nl@reg}
6830 % \changes{v1.12.0}{2014/08/05}{To ensure compatibility with \protect\cs{musixtex}, \protect\cs{@l} becomes \protect\cs{@l}. Consequently, \protect\cs{@l@reg} becomes \protect\cs{@nl@reg}.}
6831 % \protect\cs{@nl} does everything related to the start of a
6832 % new line of numbered text.
6833 %
6834 % In order to get the \protect\cs{setlinenum} to work Peter Wilson had to slip in some new
6835 % code at the start of the macro, to get the timing of the actions
6836 % correct. The problem was that his original naive implementation
6837 % of \protect\cs{setlinenum} had a unfortunate tendency to change the
6838 % number of the last line of the \emph{preceding} paragraph.
6839 % The new code is sort of based on the page number handling and
6840 % \protect\cs{setline}.
6841 % It seems
6842 % that a lot of fiddling with the line number internals is required.
6843 %
6844 % In November 2004 in order to accurately determine page numbers Peter Wilson added
6845 % these to the macro. It is now: \\
6846 % \protect\cs{@nl}\marg{page counter number}\marg{printed page number} \\
6847 % We do not (yet) use the printed number (i.e., the \protect\cs{thepage}) but
6848 % it may come in handy later. The macro \cs{@page} checks if a new
6849 % page has started.
6850 %
6851 % Exactly what \protect\cs{@nl} does depends
6852 % on whether right text is being processed. That's why many code is defined in \protect\cs{@nl@reg} or \protect\cs{nl@regR}.
6853 %
6854 %
6855 % \changes{v0.3.0}{2004/02/14}{Added a bunch of code to \protect\cs{@nl} for handling
6856 % \protect\cs{setlinenum}}
6857 % \changes{v0.6.0}{2004/11/16}{Extended \protect\cs{@nl} to include the page number}
6858 % \changes{v0.7.0}{2005/02/22}{Added \protect\cs{@nl@reg}}
6859 % \begin{macrocode}
6860
6861 \newcommand*{\@nl}[2]{%
6862 \@page{#1}%
6863 \ifledRcol%
6864 \@nl@regR%
6865 \csnumgdef{@page@forlineR@\the\section@numR @\the\absline@numR}{#1}%
6866 \else%
6867 \@nl@reg%
6868 \fi%
6869 }
6870 \newcommand*{\@nl@reg}{%
6871 \ifx\l@dchset@num\relax \else
6872 \advance\absline@num \@ne
6873 \csgdef{l@dchset@num@\the\absline@num}{}%To remember this line have been marked by a \setlinenum
6874 \set@line@action
6875 \let\l@dchset@num=\relax
6876 \advance\absline@num \m@ne
6877 \advance\line@num \m@ne
6878 \fi
6879 % \end{macrocode}
6880 %
6881 % First increment the absolute line-number, and perform
6882 % deferred actions relating to page starts and sub-lines.
6883 % \begin{macrocode}
6884 \reset@current@annot%
6885 \advance\absline@num \@ne
6886 \ifx\next@page@num\relax \else
6887 \page@action
6888 \let\next@page@num=\relax
6889 \fi
6890 \ifx\sub@change\relax \else
6891 \ifnum\sub@change>\z@
6892 \sublines@true
6893 \else
6894 \sublines@false
6895 \fi
6896 \sub@action
6897 \let\sub@change=\relax
6898 \fi
6899 % \end{macrocode}
6900 %
6901 % Fix the lock counters, if necessary. A value of $1$ is advanced to
6902 % $2$; $3$ advances to $0$; other values are unchanged.
6903 % \begin{macrocode}
6904 \ifcase\@lock
6905 \or
6906 \@lock \tw@
6907 \or \or
6908 \@lock \z@
6909 \fi
6910 \ifcase\sub@lock
6911 \or
6912 \sub@lock \tw@
6913 \or \or
6914 \sub@lock \z@
6915 \fi
6916 % \end{macrocode}
6917 %
6918 % Now advance the visible line number, unless it has been locked.
6919 % \begin{macrocode}
6920 \ifsublines@
6921 \ifnum\sub@lock<\tw@
6922 \advance\subline@num \@ne
6923 \fi
6924 \else
6925 \ifnum\@lock<\tw@
6926 \advance\line@num \@ne \subline@num \z@
6927 \fi
6928 \fi}
6929
6930 % \end{macrocode}
6931 % \end{macro}
6932 % \end{macro}
6933 %
6934 %
6935 % \begin{macro}{\last@page@num}
6936 % \begin{macro}{\this@section@last@page@num}
6937 % \begin{macro}{\@page}
6938 % \protect\cs{@page} determines whether or not
6939 % a new page has been started, based on the page values held by \protect\cs{@nl}.
6940 % \begin{macrocode}
6941 \newcount\last@page@num
6942 \last@page@num=-10000
6943
6944 \newcount\this@section@last@page@num%
6945 \this@section@last@page@num=-10000%
6946
6947 \newcommand*{\@page}[1]{%
6948 \ifledRcol
6949 \ifnum #1=\last@page@numR
6950 \else
6951 \csnumgdef{@lastabsline@forpageR@\the\page@numR}{\the\absline@numR}%
6952 \csnumgdef{@lastline@forpageR@\the\page@numR}{\the\line@numR}%
6953 \csnumgdef{@lastsubline@forpageR@\the\page@numR}{\the\subline@numR}%
6954 \ifbypage@R
6955 \letcs{\prevsection@last@page@num}{last@page@num@\the\numexpr\section@num-1\relax}%
6956 \ifundef{\prevsection@last@page@num}{\def\prevsection@last@page@num{-999}}{}%
6957 \ifx\l@dchset@num\relax%Not resetting if preceded by a \setlinenum
6958 \ifboolexpr{%
6959 (bool{continuousnumberingwithcolumns} or bool{resumenumberingR@start})%
6960 and test {\ifnumequal{\last@page@numR}{-10000}}%
6961 and not (%
6962 bool{continuousnumberingwithcolumns}%
6963 and test {\ifnumcomp{\prevsection@last@page@num}{<}{#1}}%
6964 )%
6965 }%
6966 {}%
6967 {%
6968 \line@numR \z@%
6969 \subline@numR \z@%
6970 \global\csdef{reset@lineR\the\numexpr\absline@numR+1\relax @\the\section@numR}{}%
6971 }%
6972 \fi%
6973 \fi
6974 \page@numR=#1%
6975 \global\this@section@page@numR=#1%
6976 \global\last@page@numR=#1%
6977 \global\this@section@last@page@numR=#1%
6978 \def\next@page@numR{#1}%
6979 \gdef\this@section@next@page@numR{#1}%
6980 \fi
6981 \else
6982 \ifnum #1=\last@page@num
6983 \else
6984 \csnumgdef{@lastabsline@forpage@\the\page@num}{\the\absline@num}%
6985 \csnumgdef{@lastline@forpage@\the\page@num}{\the\line@num}%
6986 \csnumgdef{@lastsubline@forpage@\the\page@num}{\the\subline@num}%
6987 \ifbypage@
6988 \ifx\l@dchset@num\relax%Not resetting if preceded by a \setlinenum
6989 \line@num \z@%
6990 \subline@num \z@%
6991 \global\csdef{reset@line\the\numexpr\absline@num+1\relax @\the\section@num}{}%
6992 \fi%
6993 \fi
6994 \page@num=#1%
6995 \global\this@section@page@num=#1%
6996 \last@page@num=#1%
6997 \global\this@section@last@page@num=#1%
6998 \global\csdef{last@page@num@\the\section@num}{#1}%
6999 \def\next@page@num{#1}%
7000 % \end{macrocode}
7001 % And we set a flag that tells \cs{@nl} that a new page number is
7002 % to be set, because other associated actions shouldn't occur until the
7003 % next line-start occurs.
7004 % \begin{macrocode}
7005 \gdef\this@section@next@page@num{#1}%
7006 \listxadd{\normal@page@break}{\the\absline@num}
7007 \fi
7008 \fi}
7009 % \end{macrocode}
7010 % \end{macro}
7011 % \end{macro}
7012 % \end{macro}
7013 %
7014 % \begin{macro}{\@pend}
7015 % \begin{macro}{\@pendR}
7016 % \begin{macro}{\@lopL}
7017 % \begin{macro}{\@lopR}
7018 % These do not do anything at this point, but will have been added to the
7019 % auxiliary file(s) if the \parpackage package has been used. They
7020 % are just here to stop \macpackage\ from moaning if the \parpackage
7021 % is used for one run and then not for the following one.
7022 % \changes{v0.6.0}{2004/11/16}{Added \protect\cs{@pend},\protect\cs{@pendR}, \protect\cs{@lopL} and
7023 % \protect\cs{@lopR} in anticipation of parallel processing}
7024 % \begin{macrocode}
7025 \newcommand*{\@pend}[1]{}
7026 \newcommand*{\@pendR}[1]{}
7027 \newcommand*{\@lopL}[1]{}
7028 \newcommand*{\@lopR}[1]{}
7029
7030 % \end{macrocode}
7031 % \end{macro}
7032 % \end{macro}
7033 % \end{macro}
7034 % \end{macro}
7035 %
7036 % \begin{macro}{\sub@on}
7037 % \begin{macro}{\sub@off}
7038 % The \protect\cs{sub@on} and \protect\cs{sub@off} macros
7039 % turn sub-lineation on and off\/: but not directly, since such changes
7040 % do not really take effect until the next line of text. Instead
7041 % they set a flag that notifies \protect\cs{@nl} of the necessary action.
7042 % \begin{macrocode}
7043 \newcommand*{\sub@on}{%
7044 \ifboolexpr{%
7045 bool{sublines@}%
7046 or%
7047 (bool{sublines@R} and bool{ledRcol})%
7048 }{%
7049 \let\sub@change=\relax
7050 }{%
7051 \def\sub@change{1}%
7052 }%
7053 }%
7054 \newcommand*{\sub@off}{%
7055 \ifboolexpr{%
7056 bool{sublines@}%
7057 or%
7058 (bool{sublines@R} and bool{ledRcol})%
7059 }{%
7060 \def\sub@change{-1}%
7061 }{%
7062 \let\sub@change=\relax
7063 }%
7064 }%
7065
7066 % \end{macrocode}
7067 % \end{macro}
7068 % \end{macro}
7069 %
7070 % \begin{macro}{\@adv}
7071 % The \protect\cs{@adv}\marg{num} macro advances
7072 % the current visible line number by the amount specified as
7073 % its argument. This is used to implement \protect\cs{advanceline}.
7074 % \begin{macrocode}
7075
7076 \newcommand*{\@adv}[1]{%
7077 \ifsublines@
7078 \ifledRcol
7079 \advance\subline@numR by #1\relax
7080 \ifnum\subline@numR<\z@
7081 \led@warn@BadAdvancelineSubline
7082 \subline@numR \z@
7083 \fi
7084 \else
7085 \advance\subline@num by #1\relax
7086 \ifnum\subline@num<\z@
7087 \led@warn@BadAdvancelineSubline
7088 \subline@num \z@
7089 \fi
7090 \fi
7091 \else
7092 \ifledRcol
7093 \advance\line@numR by #1\relax
7094 \ifnum\line@numR<\z@
7095 \led@warn@BadAdvancelineLine
7096 \line@numR \z@
7097 \fi
7098 \else
7099 \advance\line@num by #1\relax
7100 \ifnum\line@num<\z@
7101 \led@warn@BadAdvancelineLine
7102 \line@num \z@
7103 \fi
7104 \fi
7105 \fi
7106 \set@line@action}
7107
7108 % \end{macrocode}
7109 % \end{macro}
7110 %
7111 % \begin{macro}{\@set}
7112 % The \protect\cs{@set}\marg{num} macro sets
7113 % the current visible line number to the value specified as
7114 % its argument. This is used to implement \protect\cs{setline}.
7115 % \begin{macrocode}
7116
7117 \newcommand*{\@set}[1]{%
7118 \ifledRcol
7119 \ifsublines@R%
7120 \subline@numR=#1\relax
7121 \else
7122 \line@numR=#1\relax
7123 \fi
7124 \set@line@action
7125 \else
7126 \ifsublines@
7127 \subline@num=#1\relax
7128 \else
7129 \line@num=#1\relax
7130 \fi
7131 \set@line@action
7132 \fi}
7133
7134 % \end{macrocode}
7135 % \end{macro}
7136 %
7137 % \begin{macro}{\l@d@set}
7138 % \begin{macro}{\l@dchset@num}
7139 % The \protect\cs{l@d@set}\marg{num} macro sets
7140 % the line number for the next \protect\cs{pstart} to the value specified as
7141 % its argument. This is used to implement \protect\cs{setlinenum}.
7142 %
7143 % \protect\cs{l@dchset@num} is a flag to the \protect\cs{@nl}? macro. If it is not
7144 % \protect\cs{relax} then a linenumber change is to be done.
7145 % \begin{macrocode}
7146
7147 \newcommand*{\l@d@set}[1]{%
7148 \ifledRcol
7149 \line@numR=#1\relax
7150 \advance\line@numR \@ne
7151 \def\l@dchset@num{#1}
7152 \else
7153 \line@num=#1\relax
7154 \advance\line@num \@ne
7155 \def\l@dchset@num{#1}
7156 \fi}
7157 \let\l@dchset@num\relax
7158
7159 % \end{macrocode}
7160 % \end{macro}
7161 % \end{macro}
7162
7163 %
7164 % \begin{macro}{\page@action}
7165 % \protect\cs{page@action}
7166 % adds an entry to the action-code list to change the page number.
7167 % \begin{macrocode}
7168
7169 \newcommand*{\page@action}{%
7170 \ifledRcol
7171 \xright@appenditem{\the\absline@numR}\to\actionlines@listR
7172 \xright@appenditem{\next@page@numR}\to\actions@listR
7173 \else
7174 \xright@appenditem{\the\absline@num}\to\actionlines@list
7175 \xright@appenditem{\next@page@num}\to\actions@list
7176 \fi}
7177 % \end{macrocode}
7178 % \end{macro}
7179 %
7180 % \begin{macro}{\set@line@action}
7181 % \protect\cs{set@line@action} adds an entry to the action-code
7182 % list to change the visible line number.
7183 % \begin{macrocode}
7184
7185 \newcommand*{\set@line@action}{%
7186 \ifledRcol
7187 \xright@appenditem{\the\absline@numR}\to\actionlines@listR
7188 \ifsublines@R%
7189 \@l@dtempcnta=-\subline@numR
7190 \else
7191 \@l@dtempcnta=-\line@numR
7192 \fi
7193 \advance\@l@dtempcnta by -5000\relax
7194 \xright@appenditem{\the\@l@dtempcnta}\to\actions@listR
7195 \else
7196 \xright@appenditem{\the\absline@num}\to\actionlines@list
7197 \ifsublines@
7198 \@l@dtempcnta=-\subline@num
7199 \else
7200 \@l@dtempcnta=-\line@num
7201 \fi
7202 \advance\@l@dtempcnta by -5000\relax
7203 \xright@appenditem{\the\@l@dtempcnta}\to\actions@list
7204 \fi}
7205 % \end{macrocode}
7206 % \end{macro}
7207 %
7208 % \begin{macro}{\sub@action}
7209 % \protect\cs{sub@action}
7210 % adds an entry to the action-code list to turn sub-lineation on or
7211 % off, according to the current value of the \protect\cs{ifsublines@} flag.
7212 % \begin{macrocode}
7213
7214 \newcommand*{\sub@action}{%
7215 \ifledRcol
7216 \xright@appenditem{\the\absline@numR}\to\actionlines@listR
7217 \ifsublines@R%
7218 \xright@appenditem{-1001}\to\actions@listR
7219 \else
7220 \xright@appenditem{-1002}\to\actions@listR
7221 \fi
7222 \else
7223 \xright@appenditem{\the\absline@num}\to\actionlines@list
7224 \ifsublines@
7225 \xright@appenditem{-1001}\to\actions@list
7226 \else
7227 \xright@appenditem{-1002}\to\actions@list
7228 \fi
7229 \fi}
7230 % \end{macrocode}
7231 % \end{macro}
7232 %
7233 % \begin{macro}{\lock@on}
7234 % \begin{macro}{\do@lockon}
7235 % \begin{macro}{\do@lockonL}
7236 % \protect\cs{lock@on}
7237 % adds an entry to the action-code list to turn line number
7238 % locking on. The current setting of the sub-lineation flag tells us
7239 % whether this applies to line numbers or sub-line numbers.
7240 %
7241 % Adding commands to the action list is slow, and it is very often the
7242 % case that a lock-on command is immediately followed by a lock-off
7243 % command in the line-list file, and therefore really does nothing.
7244 % We use a look-ahead scheme here to detect such pairs, and add nothing
7245 % to the line-list in those cases.
7246 % \begin{macrocode}
7247 \newcommand*{\lock@on}{\futurelet\next\do@lockon}
7248
7249 \newcommand*{\do@lockon}{%
7250 \ifx\next\lock@off
7251 \global\let\lock@off=\skip@lockoff
7252 \else
7253 \ifledRcol
7254 \do@lockonR
7255 \else
7256 \do@lockonL
7257 \fi
7258 \fi}
7259
7260
7261 \newcommand*{\do@lockonL}{%
7262 \xright@appenditem{\the\absline@num}\to\actionlines@list
7263 \ifsublines@
7264 \xright@appenditem{-1005}\to\actions@list
7265 \ifnum\sub@lock=\z@
7266 \sub@lock \@ne
7267 \else
7268 \ifnum\sub@lock=\thr@@
7269 \sub@lock \@ne
7270 \fi
7271 \fi
7272 \else
7273 \xright@appenditem{-1003}\to\actions@list
7274 \ifnum\@lock=\z@
7275 \@lock \@ne
7276 \else
7277 \ifnum\@lock=\thr@@
7278 \@lock \@ne
7279 \fi
7280 \fi
7281 \fi}
7282
7283 % \end{macrocode}
7284 % \end{macro}
7285 % \end{macro}
7286 % \end{macro}
7287 %
7288 % \begin{macro}{\lock@off}
7289 % \begin{macro}{\do@lockoff}
7290 % \begin{macro}{\do@lockoffL}
7291 % \begin{macro}{\skip@lockoff}
7292 % \protect\cs{lock@off} adds an entry to the action-code list
7293 % to turn line number locking off.
7294 % \begin{macrocode}
7295 \newcommand*{\do@lockoffL}{%
7296 \xright@appenditem{\the\absline@num}\to\actionlines@list
7297 \ifsublines@
7298 \xright@appenditem{-1006}\to\actions@list
7299 \ifnum\sub@lock=\tw@
7300 \sub@lock \thr@@
7301 \else
7302 \sub@lock \z@
7303 \fi
7304 \else
7305 \xright@appenditem{-1004}\to\actions@list
7306 \ifnum\@lock=\tw@
7307 \@lock \thr@@
7308 \else
7309 \@lock \z@
7310 \fi
7311 \fi}
7312
7313 \newcommand*{\do@lockoff}{%
7314 \reset@current@annot%
7315 \ifledRcol
7316 \do@lockoffR
7317 \else
7318 \do@lockoffL
7319 \fi}
7320 \newcommand*{\skip@lockoff}{\global\let\lock@off=\do@lockoff}
7321 \global\let\lock@off=\do@lockoff
7322
7323 % \end{macrocode}
7324 % \end{macro}
7325 % \end{macro}
7326 % \end{macro}
7327 % \end{macro}
7328 %
7329 % \begin{macro}{\n@num}
7330 % These macros implement the \protect\cs{skipnumbering} command.
7331 % They use action code 1007.
7332 % \changes{v0.7.0}{2005/02/22}{Added \protect\cs{n@num}}
7333 % \changes{v1.21.0}{2015/04/13}{\protect\cs{n@num} defined only one time for both \Eledmac{} and \Eledpar{}}
7334 % \changes{v1.21.0}{2015/04/13}{\protect\cs{n@num@ref} deleted}
7335 % \begin{macrocode}
7336 \newcommand*{\n@num}{%
7337 \ifledRcol%
7338 \xright@appenditem{\the\absline@numR}\to\actionlines@listR
7339 \xright@appenditem{-1007}\to\actions@listR
7340 \else%
7341 \xright@appenditem{\the\absline@num}\to\actionlines@list%
7342 \xright@appenditem{-1007}\to\actions@list%
7343 \fi%
7344 }%
7345
7346 % \end{macrocode}
7347 % \end{macro}
7348 % \begin{macro}{\n@num@stanza}
7349 % This macro implements the \protect\cs{skipnumbering} for stanza command.
7350 % It uses action code 1008.
7351 % \begin{macrocode}
7352 \newcommand*{\n@num@stanza}{%
7353 \ifledRcol%
7354 \xright@appenditem{\the\absline@numR}\to\actionlines@listR%
7355 \xright@appenditem{-1008}\to\actions@listR%
7356 \else%
7357 \xright@appenditem{\the\absline@num}\to\actionlines@list%%
7358 \xright@appenditem{-1008}\to\actions@list%
7359 \fi%
7360 }
7361 % \end{macrocode}
7362 % \end{macro}
7363 % \begin{macro}{\ifl@dhidenumber}
7364 % \begin{macro}{\hidenumbering}
7365 % \begin{macro}{\hidenumberingonleftpage}
7366 % \begin{macro}{\hidenumberingonrightpage}
7367 % \protect\cs{hidenumbering} hides number in margin.
7368 % It uses action code 1009.
7369 % \cs{hidenumberingonleftpage} and \cs{hidenumberingonrightpage} ara variant, using action code only conditionnaly
7370 % \begin{macro}{\h@num}
7371 % \begin{macrocode}
7372 \newif\ifl@dhidenumber
7373 \newcommand*{\hidenumbering}{%
7374 \ifledRcol%
7375 \write\linenum@outR{\string\hide@num}%
7376 \else%
7377 \write\linenum@out{\string\hide@num}%
7378 \fi%
7379 }%
7380 \newcommand*{\hide@num}{%
7381 \ifledRcol%
7382 \xright@appenditem{\the\absline@numR}\to\actionlines@listR%
7383 \xright@appenditem{-1009}\to\actions@listR%
7384 \else%
7385 \xright@appenditem{\the\absline@num}\to\actionlines@list%%
7386 \xright@appenditem{-1009}\to\actions@list%
7387 \fi%
7388 }
7389 \newcommand*{\hidenumberingonleftpage}{%
7390 \ifledRcol%
7391 \write\linenum@outR{\string\hide@num@left}%
7392 \else%
7393 \write\linenum@out{\string\hide@num@left}%
7394 \fi%
7395 }%
7396
7397 \newcommand*{\hide@num@left}{%
7398 \ifledRcol%
7399 \ifodd\page@numR\else%
7400 \xright@appenditem{\the\absline@numR}\to\actionlines@listR%
7401 \xright@appenditem{-1009}\to\actions@listR%
7402 \fi%
7403 \else%
7404 \ifodd\page@num\else%
7405 \xright@appenditem{\the\absline@num}\to\actionlines@list%%
7406 \xright@appenditem{-1009}\to\actions@list%
7407 \fi%
7408 \fi%
7409 }%
7410
7411 \newcommand*{\hidenumberingonrightpage}{%
7412 \ifledRcol%
7413 \write\linenum@outR{\string\hide@num@right}%
7414 \else%
7415 \write\linenum@out{\string\hide@num@right}%
7416 \fi%
7417 }%
7418
7419 \newcommand*{\hide@num@right}{%
7420 \ifledRcol%
7421 \ifodd\page@numR%
7422 \xright@appenditem{\the\absline@numR}\to\actionlines@listR%
7423 \xright@appenditem{-1009}\to\actions@listR%
7424 \fi%
7425 \else%
7426 \ifodd\page@num%
7427 \xright@appenditem{\the\absline@num}\to\actionlines@list%%
7428 \xright@appenditem{-1009}\to\actions@list%
7429 \fi%
7430 \fi%
7431 }%
7432
7433 % \end{macrocode}
7434 % \end{macro}
7435 % \end{macro}
7436 % \end{macro}
7437 % \end{macro}
7438 % \end{macro}
7439 % \begin{macro}{\@ref}
7440 % \begin{macro}{\insert@count}
7441 % \protect\cs{@ref}
7442 % marks the start of a passage, for creation of a footnote reference.
7443 % It takes two arguments:
7444 % \begin{itemize}
7445 % \item \verb"#1", the number of entries to add to \protect\cs{insertlines@list}
7446 % for this reference. \SpecialMainIndex{\insert@count}
7447 % This value, here and within \protect\cs{edtext},
7448 % which computes it and writes it to the line-list file,
7449 % will be stored in the count \protect\cs{insert@count}.
7450 % \begin{macrocode}
7451 \newcount\insert@count
7452 % \end{macrocode}
7453 %
7454 % \item \verb"#2", a sequence of other line-list-file commands, executed to
7455 % determine the ending line-number. (This may also include other
7456 % \protect\cs{@ref} commands, corresponding to uses of \protect\cs{edtext}
7457 % within the first argument of another instance of \protect\cs{edtext}.)
7458 % \end{itemize}
7459 %
7460 % \begin{macro}{\dummy@ref}
7461 % When nesting of \protect\cs{@ref} commands does occur, it is necessary to
7462 % temporarily redefine \protect\cs{@ref} within \protect\cs{@ref}, so that we are only
7463 % doing one of these at a time.
7464 % \begin{macrocode}
7465 \newcommand*{\dummy@ref}[2]{#2}
7466 % \end{macrocode}
7467 % \end{macro}
7468 %
7469 % \begin{macro}{\@ref@reg}
7470 % The first thing \protect\cs{@ref} (i.e. \protect\cs{@ref@reg}) itself does is to add
7471 % the specified number
7472 % of items to the \protect\cs{insertlines@list} list.
7473 % \changes{v0.7.0}{2005/02/22}{Added \protect\cs{@ref@reg}}
7474 % \begin{macrocode}
7475 \newcommand*{\@ref}[2]{%
7476 \ifledRcol%
7477 \@ref@regR{#1}{#2}%
7478 \else%
7479 \@ref@reg{#1}{#2}%
7480 \fi%
7481 }%
7482 \newcommand*{\@ref@reg}[2]{%
7483 \global\insert@count=#1\relax
7484 \global\advance\@edtext@level by 1%
7485 \loop\ifnum\insert@count>\z@
7486 \xright@appenditem{\the\absline@num}\to\insertlines@list
7487 \global\advance\insert@count \m@ne
7488 \repeat
7489 % \end{macrocode}
7490 %
7491 % Next, process the second argument to determine the page
7492 % and line numbers for the end of this lemma.
7493 % We temporarily equate \protect\cs{@ref} to a different macro that just executes
7494 % its argument, so that nested \protect\cs{@ref} commands are just skipped
7495 % this time. Some other macros need to be temporarily redefined to
7496 % suppress their action.
7497 % \begin{macrocode}
7498 \begingroup
7499 \let\@ref=\dummy@ref
7500 \let\@lopL\@gobble
7501 \let\page@action=\relax
7502 \let\sub@action=\relax
7503 \let\set@line@action=\relax
7504 \let\@lab=\relax
7505 \let\@lemma=\relax%
7506 \let\@sw\@gobblethree%
7507 \let\store@annot@to@absline\@gobble%
7508 #2
7509 \global\endpage@num=\page@num
7510 \global\endline@num=\line@num
7511 \global\endsubline@num=\subline@num
7512 \global\let\endcurrent@annot=\current@annot%
7513 \endgroup
7514 % \end{macrocode}
7515 %
7516 % Now store all the information about the location of the lemma's
7517 % start and end in \protect\cs{line@list}.
7518 % \begin{macrocode}
7519 \xright@appenditem%
7520 {\the\page@num|\the\line@num|%
7521 \ifsublines@ \the\subline@num \else 0\fi|%
7522 \the\endpage@num|\the\endline@num|%
7523 \ifsublines@ \the\endsubline@num \else 0\fi}\to\line@list
7524 \xright@appenditem%
7525 {\current@annot|\endcurrent@annot}\to\annot@list%
7526 % \end{macrocode}
7527 % And now, call \cs{@ref@reg@parsearg}, which can be also called by \cs{@ref@later}
7528 % \begin{macrocode}
7529 \@ref@reg@parse{#2}%
7530 % \end{macrocode}
7531 % Decrease edtext level counter.
7532 % \begin{macrocode}
7533 \global\advance\@edtext@level by -1%
7534 }
7535 % \end{macrocode}
7536 % \end{macro}
7537 % \begin{macro}{\@ref@reg@parse}%
7538 % The \cs{@ref@reg@parsearg} command parses the second argument of a \cs{@ref} or the unique argument of \cs{@ref@later} written in the auxiliary fill.
7539 %
7540 % First, create a list which stores every second argument of each \protect\cs{@sw}
7541 % in this lemma, at this level.
7542 % Also set the boolean about the use of lemma in this edtext level to false.
7543 % \begin{macrocode}
7544 \newcommand{\@ref@reg@parse}[1]{%
7545 \expandafter\list@create\expandafter{\csname sw@list@edtext@tmp@\the\@edtext@level\endcsname}%
7546 \providebool{lemmacommand@\the\@edtext@level}%
7547 \boolfalse{lemmacommand@\the\@edtext@level}%
7548 % \end{macrocode}
7549 % Execute the second argument of \protect\cs{@ref} again,
7550 % to perform for real all the commands within it.
7551 % \begin{macrocode}
7552 #1%
7553 % \end{macrocode}
7554 % Now, we store the list of \protect\cs{@sw} of this current \protect\cs{edtext} as an element of
7555 % the global list of list of \protect\cs{@sw} for a \protect\cs{edtext} depth.
7556 % \begin{macrocode}
7557 \ifnum\@edtext@level>0%
7558 \def\create@this@edtext@level{\expandafter\list@create\expandafter{\csname sw@list@edtext@\the\@edtext@level\endcsname}}%
7559 \ifcsundef{sw@list@edtext@\the\@edtext@level}{\create@this@edtext@level}{}%
7560 \letcs{\@tmp}{sw@list@edtext@\the\@edtext@level}%
7561 \letcs{\@tmpp}{sw@list@edtext@tmp@\the\@edtext@level}
7562 \xright@appenditem{\expandonce\@tmpp}\to\@tmp%
7563 \global\cslet{sw@list@edtext@\the\@edtext@level}{\@tmp}%
7564 \fi%
7565 % \end{macrocode}
7566 % \begin{macrocode}
7567 }
7568
7569 % \end{macrocode}
7570 % \end{macro}
7571 % \end{macro}
7572 % \end{macro}
7573 % \begin{macro}{\ref@reg@later}
7574 % This macro is stored in the auxiliary file when using \cs{edtextlater}.
7575 % It is used only to get the correct value for the \cs{sameword} tools.
7576 % \begin{macrocode}
7577 \newcommand{\@ref@later}[1]{%
7578 \global\advance\@edtext@level by \@ne%
7579 \ifledRcol%
7580 \@ref@reg@parseR{#1}%
7581 \else%
7582 \@ref@reg@parse{#1}%
7583 \fi%
7584 \global\advance\@edtext@level by -\@ne%
7585 }%
7586 % \end{macrocode}
7587 % \end{macro}
7588 % \subsection{Writing to the line-list file}
7589 %
7590 % We have now defined all the counters, lists, and commands involved in
7591 % reading the line-list file at the start of a section. Now we will
7592 % cover the commands that \macpackage\ uses within the text of a
7593 % section to write commands out to the line-list.
7594 %
7595 % \begin{macro}{\linenum@out}
7596 % The file will be opened on output stream \protect\cs{linenum@out}.
7597 % \begin{macrocode}
7598 \newwrite\linenum@out
7599 % \end{macrocode}
7600 % \end{macro}
7601 %
7602 % \begin{macro}{\iffirst@linenum@out@}
7603 % \begin{macro}{\first@linenum@out@true}
7604 % \begin{macro}{\first@linenum@out@false}
7605 % Once any file is opened on this stream, we keep it open forever, or
7606 % else switch to another file that we keep open. The reason is that
7607 % we want the output routine to write the page number for every page
7608 % to this file; otherwise we would have to write it at the start of
7609 % every line.
7610 % But it is not very easy for the output routine to tell whether an
7611 % output stream is open or not. There is no way to test the status of
7612 % a particular output stream directly, and
7613 % the asynchronous nature of output routines makes the
7614 % status hard to determine by other means.
7615 %
7616 % We can manage pretty well by means of the \protect\cs{iffirst@linenum@out@}
7617 % flag; its inelegant name suggests the nature of the problem that
7618 % made its creation necessary. It is set
7619 % to be \verb"true" before any \protect\cs{linenum@out} file is opened. When such a file
7620 % is opened for the first time, it is done using \protect\cs{immediate}, so that
7621 % it will at once be safe for the output routine to write to it; we then
7622 % set this flag to \verb"false".
7623 % \begin{macrocode}
7624 \newif\iffirst@linenum@out@
7625 \first@linenum@out@true
7626 % \end{macrocode}
7627 % \end{macro}
7628 % \end{macro}
7629 % \end{macro}
7630 %
7631 % \begin{macro}{\this@line@list@version}
7632 % The commands allowed in the line-list file and their arguments
7633 % can change between two version of \macpackage.
7634 % The \protect\cs{this@line@list@version} command is upgraded when it happens.
7635 % It is written in the file list.
7636 % If we process a line-list file which used a older version, that means the commands used inside are deprecated, and we can't use them.
7637 % \begin{macrocode}
7638 \newcommand{\this@line@list@version}{8}%
7639 % \end{macrocode}
7640 % \end{macro}
7641 % \begin{macro}{\line@list@stuff}
7642 % \begin{macro}{\next@line@list@stuff}
7643 % The \protect\cs{line@list@stuff}\marg{file} macro, which
7644 % is called by \protect\cs{beginnumbering}, performs
7645 % all the line-list operations needed at the start of a section.
7646 % Its argument is the name of the line-list file.
7647 % \changes{v2.24.0}{2017/08/17}{Add \protect\cs{next@line@list@stuff} internal hook.}
7648 % \begin{macrocode}
7649 \let\next@line@list@stuff\relax%
7650 \newcommand*{\line@list@stuff}[1]{%
7651 % \end{macrocode}
7652 % First, define a toggle set to true when we are not in the first run.
7653 % \begin{macrocode}
7654 \global\newtoggle{notfirstrun@#1}%
7655 \IfFileExists{\l@auxdir#1}%
7656 {\global\toggletrue{notfirstrun@#1}}%
7657 {\global\togglefalse{notfirstrun@#1}}%
7658 % \end{macrocode}
7659 % A internal hook (not used yet).
7660 % \begin{macrocode}
7661 \next@line@list@stuff%
7662 \global\let\next@line@list@stuff\relax%
7663 % \end{macrocode}
7664 % Use the commands of the previous section to interpret the
7665 % line-list file from the last run.
7666 % \begin{macrocode}
7667 \read@linelist{#1}%
7668 % \end{macrocode}
7669 %
7670 % Now close the current output line-list file, if any, and open a new one.
7671 % The first time we open a line-list file for output, we do it using
7672 % \protect\cs{immediate}, and clear the \protect\cs{iffirst@linenum@out@} flag.
7673 % \changes{v0.2.2}{2003/11/09}{Added initial write of page number in
7674 % \protect\cs{line@list@stuff}}
7675 % \changes{v0.7.0}{2005/02/25}{Deleted \protect\cs{page@start} from \protect\cs{line@list@stuff}}
7676 % \changes{v1.15.1}{2015/01/16}{Revert modification of 1.5.2 which makes bug with numbering. Leave vertical mode to solve spurious space before minipage.}
7677 % \Macpackage\ and \parpackage can fill the \cs{next@line@list@stuff} hook between a \cs{endnumbering} (associated with numbered file $n$) and a \cs{beginnumbering} (associated with numbered file $n+1$). It allows adding content to the numbered file $n+1$ and not $n$.
7678 % \begin{macrocode}
7679 \iffirst@linenum@out@
7680 \global\first@linenum@out@false%
7681 \immediate\openout\linenum@out=\l@auxdir#1\relax%
7682 \immediate\write\linenum@out{\string\line@list@version{\this@line@list@version}}%
7683 \ifl@dpaging%
7684 \immediate\write\linenum@out{\string\@par@sync@option{\@par@this@sync@option}}%
7685 \fi%
7686 \else
7687 % \end{macrocode}
7688 % If we get here, then this is
7689 % not the first line-list we have seen, so we
7690 % do not open or close the files immediately.
7691 % \begin{macrocode}
7692 \if@minipage%
7693 \leavevmode%
7694 \fi%
7695 \closeout\linenum@out%
7696 \openout\linenum@out=\l@auxdir#1\relax%
7697 \write\linenum@out{\string\line@list@version{\this@line@list@version}}%
7698 \ifl@dpaging%
7699 \write\linenum@out{\string\@par@sync@option{\@par@this@sync@option}}%
7700 \fi%
7701 \fi%
7702 }%
7703
7704 % \end{macrocode}
7705 % \end{macro}
7706 % \end{macro}
7707 % \begin{macro}{\new@line}
7708 % \begin{macro}{\set@this@c@page}
7709 % The \protect\cs{new@line} macro sends the \protect\cs{@nl} command to the line-list
7710 % file, to mark the start of a new text line, and its page number.
7711 % \label{new@line@pagecounting}
7712 % It writes the two forms of the page number:
7713 % \begin{itemize}
7714 % \item Raw form (\cs{the}\cs{c@page}, which can be used for numeric tests.
7715 % \item Formatted form (for example, in Roman).
7716 % \end{itemize}
7717 % Actually, only the first form is used by \cs{@nl}.
7718 % If we use the \cs{sameparallelpagenumber} option of \parpackage, we must write not the real page number (i.e. \verb+page+ counter, defined in standard \LaTeX) but the printed page number (i.e \verb+par@page+ counter, defined only on \macpackage).
7719 % \begin{itemize}
7720 % \item For the raw form, we use \cs{the}\cs{c@page@page} macro, because the \verb+{par@page}+ counter is increased for each page.
7721 % \item For the formatted version, \cs{thepage} is patched through \cs{par@patch@thepage}. So we have nothing to change.
7722 % \end{itemize}
7723 % \changes{v0.6.0}{2004/11/16}{Extended \protect\cs{new@line} to output page numbers}
7724 % \begin{macrocode}
7725 \newcommand*{\new@line}{%
7726 \ifnumberline%
7727 \IfStrEq{\led@pb@setting}{after}%
7728 {\xifinlist{\the\absline@num}{\l@prev@nopb}%
7729 {\xifinlist{\the\absline@num}{\normal@page@break}%
7730 {\numgdef{\@next@page}{\c@par@page+\@ne}%
7731 \write\linenum@out{\string\@nl[\@next@page][\@next@page]}%
7732 }%
7733 {\write\linenum@out{\string\@nl[\the\@this@c@page][\thepage]}}%
7734 }%
7735 {\write\linenum@out{\string\@nl[\the\@this@c@page][\thepage]}}}%
7736 {}%
7737 \IfStrEq{\led@pb@setting}{before}%
7738 {\numdef{\next@absline}{\the\absline@num+\@ne}%
7739 \xifinlist{\next@absline}{\l@prev@nopb}%
7740 {\xifinlist{\the\absline@num}{\normal@page@break}%
7741 {\numgdef{\nc@page}{\c@par@page+\@ne}%
7742 \write\linenum@out{\string\@nl[\nc@page][\nc@page]}%
7743 }%
7744 {\write\linenum@out{\string\@nl[\the\@this@c@page][\thepage]}}%
7745 }%
7746 {\write\linenum@out{\string\@nl[\the\@this@c@page][\thepage]}}%
7747 }%
7748 {}%
7749 \IfStrEqCase{\led@pb@setting}%
7750 {%
7751 {before}{\relax}%
7752 {after}{\relax}%
7753 }[%
7754 \write\linenum@out{\string\@nl[\the\@this@c@page][\thepage]}%
7755 ]%
7756 \fi%
7757 }
7758
7759 \newcount\@this@c@page%%
7760 \newcommand{\set@this@c@page}{%
7761 \ifboolexpr{%
7762 bool{sameparallelpagenumber}%
7763 or bool{prevpgnotnumbered}%
7764 }%
7765 {\global\@this@c@page=\c@par@page}%
7766 {\global\@this@c@page=\c@page}%
7767 }%
7768 % \end{macrocode}
7769 % \end{macro}
7770 % \end{macro}
7771 %
7772 % \begin{macro}{\flag@start}
7773 % \begin{macro}{\flag@end}
7774 % \changes{v1.12.3}{2014/08/15}{\protect\cs{flag@start} and \protect\cs{flag@end} are now defined only one time for eledmac and eledpar}
7775 % \changes{v1.12.3}{2014/08/15}{\protect\cs{flag@start} send a error message when a \protect\cs{edtext} is done without insert (note)}
7776 % \changes{v1.12.8}{2014/09/12}{\protect\cs{flag@start} do not send a error message when a \protect\cs{edtext} is done without insert (note) but have a endnote}
7777 % We enclose a lemma marked by \protect\cs{edtext} in
7778 % \protect\cs{flag@start} and \protect\cs{flag@end}: these send the \protect\cs{@ref}
7779 % command to the line-list file. \protect\cs{edtext} is responsible for
7780 % setting the value of \protect\cs{insert@count} appropriately; it
7781 % actually gets done by the various footnote macros.
7782 % \begin{macrocode}
7783
7784 \newcommand*{\flag@start}{%
7785 \ifledRcol%
7786 \edef\next{\write\linenum@outR{%
7787 \string\@ref[\the\insert@countR][}}%
7788 \else%
7789 \edef\next{\write\linenum@out{%
7790 \string\@ref[\the\insert@count][}}%
7791 \fi%
7792 \next%
7793 }%
7794
7795 \newcommand*{\flag@end}{%
7796 \ifledRcol%
7797 \write\linenum@outR{]}%
7798 \else%
7799 \write\linenum@out{]}%
7800 \fi%
7801 }%
7802
7803
7804 % \end{macrocode}
7805 % \end{macro}
7806 % \end{macro}
7807 % \begin{macro}{\flag@start@RTL}
7808 % \begin{macro}{\flag@end@RTL}
7809 %\label{flag:start:RTL}
7810 % With \XeLaTeX, there is a problem when using RTL: the writing of a command in the numbered auxiliary files (\verb+.1+, \verb+.2+ etc) is reversed when the first argument of \cs{edtext} is typset in one line, but it is \textbf{not} reversed when this first argument is typset in two lines or more.\footnote{This problem is caused by the way \XeTeX\ manages right-to-left typsetting. David Carlisle explains it on \url{http://tex.stackexchange.com/a/333373/7712} and provides a potential solution, using \cs{vadjust}. However in some cases this adds spurious vertical spaces in reledmac. That is why we are using the solution explained below.}
7811 %
7812 % To solve this problem, we use a crossref mechanism. At the first run, we put a label, but we do not write any \cs{@ref} command. When the value of the label can be tested, that is after three runs, we're doing:
7813 % \begin{itemize}
7814 % \item If the first argument of \cs{edtext} is typeset on only one line, we first call \cs{flag@end}, at the point we normally call \cs{flag@start}, at the beginning of the content of the first argument, and we call \cs{flag@end} at the point we normally call \cs{flag@start}, at the end of the content of the first argument.
7815 % \item If the first argument of \cs{edtext} is typeset on only two lines, we use the normal order.
7816 % \end{itemize}
7817 % This system is a workaround for the problem of order when writing in auxiliary files.
7818 %
7819 % The \cs{flag@start@RTL} and \cs{flag@end@RTL} macro put the label, do the test and call the right commands.
7820 % \begin{macrocode}
7821 \newcommand{\flag@start@RTL}{%
7822 \edlabel{edtext:start:\csuse{thisedtext@\the\@edtext@level}}%
7823 \IfStrEq{\xabslineref{edtext:start:\csuse{thisedtext@\the\@edtext@level}}}%
7824 {000}%
7825 {}%
7826 {%
7827 \ifnumequal%
7828 {\xabslineref{edtext:start:\csuse{thisedtext@\the\@edtext@level}}}%
7829 {\xabslineref{edtext:end:\csuse{thisedtext@\the\@edtext@level}}}%
7830 {\flag@end}%
7831 {\flag@start}%
7832 }%
7833 }%
7834
7835 \newcommand{\flag@end@RTL}{%
7836 \edlabel{edtext:end:\csuse{thisedtext@\the\@edtext@level}}%
7837 \IfStrEq{\xabslineref{edtext:start:\csuse{thisedtext@\the\@edtext@level}}}%
7838 {000}%
7839 {}%
7840 {%
7841 \ifnumequal%
7842 {\xabslineref{edtext:start:\csuse{thisedtext@\the\@edtext@level}}}%
7843 {\xabslineref{edtext:end:\csuse{thisedtext@\the\@edtext@level}}}%
7844 {\flag@start}%
7845 {\flag@end}%
7846 }%
7847 }%
7848 % \end{macrocode}
7849 % \end{macro}
7850 % \end{macro}
7851 % \begin{macro}{\flag@start@later}
7852 % \begin{macro}{\flag@end@later}
7853 % \protect\cs{flag@start@later} and \protect\cs{flag@end@later}: these send the\cs{@ref@later} to the line-list file
7854 % command to the line-list file
7855 % \begin{macrocode}
7856 \newcommand*{\flag@start@later}{%
7857 \ifledRcol%
7858 \write\linenum@outR{\string\@ref@later[}%
7859 \else%
7860 \write\linenum@out{\string\@ref@later[}%
7861 \fi%
7862 }%
7863 \newcommand{\flag@end@later}{%
7864 \ifledRcol%
7865 \write\linenum@outR{]}%
7866 \else%
7867 \write\linenum@out{]}%
7868 \fi%
7869 }
7870 % \end{macrocode}
7871 % \end{macro}
7872 % \end{macro}
7873 % \begin{macro}{\startsub}
7874 % \begin{macro}{\endsub}
7875 % \changes{v1.15.0}{2015/01/12}{Restore subline feature (disabled by mistake in v1.8.0).}
7876 % \protect\cs{startsub} and \protect\cs{endsub}
7877 % turn sub-lineation on and off, by writing
7878 % appropriate instructions to the line-list file. When
7879 % sub-lineation is in effect, the line number counter is frozen and
7880 % the sub-line counter advances instead. If one of these commands
7881 % appears in the middle of a line, it does not take effect until the
7882 % next line; in other words, a line is counted as a line or
7883 % sub-line depending on what it started out as, even if that
7884 % changes in the middle.
7885 %
7886 % We tinker with \protect\cs{lastskip} because a command of either sort
7887 % really needs to be attached to the last word preceding the change, not
7888 % the first word that follows the change. This is because sub-lineation
7889 % will often turn on and off in mid-line---stage directions, for example,
7890 % often are mixed with dialogue in that way---and when a line is mixed
7891 % we want to label it using the system that was in effect at its start.
7892 % But when sub-lineation begins at the very start of a line we have a
7893 % problem, if we don't put in this code.
7894 % \begin{macrocode}
7895
7896
7897 \newcommand*{\startsub}{%
7898 \dimen0\lastskip%
7899 \ifdim\dimen0>0pt%
7900 \unskip%
7901 \fi%
7902 \ifledRcol%
7903 \write\linenum@outR{\string\sub@on}%
7904 \else%
7905 \write\linenum@out{\string\sub@on}%
7906 \fi%
7907 \ifdim\dimen0>0pt%
7908 \hskip\dimen0%
7909 \fi%
7910 }%
7911
7912 \def\endsub{%
7913 \dimen0\lastskip%
7914 \ifdim\dimen0>0pt%
7915 \unskip%
7916 \fi%
7917 \ifledRcol%
7918 \write\linenum@outR{\string\sub@off}%
7919 \else%
7920 \write\linenum@out{\string\sub@off}%
7921 \fi%
7922 \ifdim\dimen0>0pt%
7923 \hskip\dimen0%
7924 \fi%
7925 }%
7926
7927 % \end{macrocode}
7928 % \end{macro}
7929 % \end{macro}
7930 %
7931 % \begin{macro}{\advanceline}
7932 % You can use \protect\cs{advanceline}\marg{num}
7933 % in running text to advance the current visible
7934 % line-number by a specified value, positive or negative.
7935 % \begin{macrocode}
7936 \newcommand*{\advanceline}[1]{\leavevmode%
7937 \ifledRcol \write\linenum@outR{\string\@adv[#1]}%
7938 \else \write\linenum@out{\string\@adv[#1]}%
7939 \fi%
7940 }
7941 % \end{macrocode}
7942 % \end{macro}
7943 %
7944 % \begin{macro}{\setline}
7945 % You can use \protect\cs{setline}\marg{num}
7946 % in running text (i.e., within \protect\cs{pstart}...\protect\cs{pend}) to set the
7947 % current visible
7948 % line-number to a specified positive value.
7949 % \begin{macrocode}
7950
7951 \newcommand*{\setline}[1]{%
7952 \leavevmode%
7953 \ifnum#1<\z@
7954 \led@warn@BadSetline%
7955 \else%
7956 \ifledRcol%
7957 \write\linenum@outR{\string\@set[#1]}%
7958 \else%
7959 \write\linenum@out{\string\@set[#1]}%
7960 \fi%
7961 \fi%
7962 }%
7963
7964 % \end{macrocode}
7965 % \end{macro}
7966 %
7967 % \begin{macro}{\setlinenum}
7968 % You can use \protect\cs{setlinenum}\marg{num}
7969 % before a \protect\cs{pstart} to set the visible line-number to a specified
7970 % positive value. It writes a \protect\cs{l@d@set} command to the line-list file.
7971 % \begin{macrocode}
7972
7973 \newcommand*{\setlinenum}[1]{%
7974 \ifnum#1<\z@%
7975 \led@warn@BadSetlinenum%
7976 \else%
7977 \ifledRcol%
7978 \write\linenum@outR{\string\l@d@set[#1]}%
7979 \else%
7980 \write\linenum@out{\string\l@d@set[#1]}%
7981 \fi%
7982 \fi%
7983 }%
7984
7985 % \end{macrocode}
7986 % \end{macro}
7987 %
7988 % \begin{macro}{\startlock}
7989 % \begin{macro}{\endlock}
7990 % You can use \protect\cs{startlock} or \protect\cs{endlock}
7991 % in running text to start or end line number locking at
7992 % the current line. They decide whether line numbers or sub-line numbers
7993 % are affected, depending on the current state of the sub-lineation flags.
7994 % \begin{macrocode}
7995
7996 \newcommand*{\startlock}{%
7997 \ifledRcol \write\linenum@outR{\string\lock@on}%
7998 \else \write\linenum@out{\string\lock@on}%
7999 \fi}
8000 \def\endlock{%
8001 \ifledRcol \write\linenum@outR{\string\lock@off}%
8002 \else \write\linenum@out{\string\lock@off}%
8003 \fi}
8004 % \end{macrocode}
8005 % \end{macro}
8006 % \end{macro}
8007 %
8008 % \begin{macro}{\ifl@dskipnumber}
8009 % \begin{macro}{\ifl@dskipversenumber}
8010 % \begin{macro}{\l@dskipnumbertrue}
8011 % \begin{macro}{\l@dskipnumberfalse}
8012 % \begin{macro}{\skipnumbering}
8013 % In numbered text \protect\cs{skipnumbering} will suspend the numbering
8014 % for that particular line.
8015 % \changes{v0.7.0}{2005/02/22}{Added \protect\cs{skipnumbering} and supports}
8016 % \changes{v1.21.0}{2015/04/13}{\protect\cs{skipnumbering} defined only one time for both \Eledmac{} and \Eledpar{}.}
8017 % \changes{v1.21.0}{2015/04/13}{Correct \protect\cs{skipnumbering} for stanza.}
8018 % \changes{v1.21.0}{2015/04/13}{Delete \protect\cs{skipnumbering@reg}.}
8019 % \begin{macrocode}
8020 \newif\ifl@dskipnumber
8021 \newif\ifl@dskipversenumber%
8022 \newcommand*{\skipnumbering}{%
8023 \leavevmode%
8024 \ifledRcol%
8025 \ifinstanza%
8026 \write\linenum@outR{\string\n@num@stanza}%
8027 \else%
8028 \write\linenum@outR{\string\n@num}%
8029 \fi%
8030 \advanceline{-1}%
8031 \else%
8032 \ifinstanza%
8033 \write\linenum@out{\string\n@num@stanza}%
8034 \else%
8035 \write\linenum@out{\string\n@num}%
8036 \fi%
8037 \advanceline{-1}%
8038 \fi%
8039 }%
8040
8041 % \end{macrocode}
8042 % \end{macro}
8043 % \end{macro}
8044 % \end{macro}
8045 % \end{macro}
8046 % \end{macro}
8047 %
8048 % \section{Marking text for notes}
8049 % \label{text}\relax
8050 %
8051 % The \protect\cs{edtext} macro is used to create all
8052 % footnotes and endnotes,
8053 % as well as to print the portion of the main text to which a given note
8054 % or notes is keyed. The idea is to have that lemma appear only once in
8055 % the \file{.tex} file: all instances of it in the main text and in the
8056 % notes are copied from that one appearance.
8057 %
8058 % The \protect\cs{edtext} macro takes two arguments.
8059 % \begin{verbatim}
8060 % \edtext{#1}{#2}
8061 % \end{verbatim}
8062 %
8063 % \begin{itemize}\addtolength{\itemsep}{-1ex}
8064 % \item \verb"#1" is the piece of the main text being glossed;
8065 % it gets added to the
8066 % main text, and is also used as a lemma for notes to it.
8067 %
8068 % \item \verb"#2" is a series of subsidiary macros that generate
8069 % various kinds of notes.
8070 % \end{itemize}
8071 %
8072 % The \protect\cs{edtext} macro may be used (somewhat) recursively; that
8073 % is, \protect\cs{edtext} may be used within its own first argument. The
8074 % code would be much simpler without this feature, but nested notes
8075 % will commonly be necessary: it is quite likely that we will have an
8076 % explanatory note for a long passage and notes on variants for
8077 % individual words within that passage. The situation we can't
8078 % handle is overlapping notes that are not nested: for example, one
8079 % note covering lines 10--15, and another covering 12--18.
8080 % You can
8081 % handle such cases by using the \protect\cs{lemma} and \protect\cs{linenum}
8082 % macros within \verb"#2": they alter the copy of the lemma and the
8083 % line numbers that are passed to the notes, and hence allow you to
8084 % overcome any limitations of this system, albeit with extra
8085 % effort.
8086 %
8087 % The recursive operation of \protect\cs{edtext} will fail if you try to use a copy
8088 % that is called something other than \protect\cs{edtext}. In order to handle
8089 % recursion, \protect\cs{edtext} needs to redefine its own definition temporarily
8090 % at one point, and that does not work if the macro you are calling is
8091 % not actually named \protect\cs{edtext}. There is no problem as long as \protect\cs{edtext}
8092 % is not invoked in the first argument. If you want to call \protect\cs{edtext}
8093 % something else, it is best to create instead a macro that expands
8094 % to an invocation of \protect\cs{edtext}, rather than copying \protect\cs{edtext} and giving
8095 % it a new name; otherwise you will need to add an appropriate
8096 % definition for your new macro to \protect\cs{morenoexpands}.
8097 %
8098 % Side-effects of our line-numbering code make it impossible to use
8099 % the usual footnote macros directly within a paragraph whose lines are
8100 % numbered (see comments to
8101 % \protect\cs{do@line}, \reff{doline}).
8102 % Instead, the appropriate note-generating command
8103 % is appended to the list macro \protect\cs{inserts@list}, and when \protect\cs{pend}
8104 % completes the paragraph it inserts all the notes at the proper places.
8105 %
8106 %
8107 % Note that we do not provide previous-note information, although it is
8108 % often wanted; your own macros must handle that. We ca not do it
8109 % correctly without keeping track of what kind of notes have gone past:
8110 % it is not just a matter of remembering the line numbers associated with
8111 % the previous invocation of \protect\cs{edtext}, because that might have been for
8112 % a different kind of note. It is preferable for your footnote macros
8113 % to store and recall this kind of information if they need it.
8114 %
8115 %
8116 % \subsection{\protect\cs{edtext}
8117 % itself}
8118 %
8119 % The various note-generating macros might want to request that
8120 % commands be executed not at once, but in close connection with the
8121 % start or end of the lemma. For example, footnote numbers in the text
8122 % should be connected to the end of the lemma; or, instead of a single
8123 % macro to create a note listing variants, you might want to use
8124 % several macros in series to create individual variants, which would
8125 % each add information to a private macro or token register, which in
8126 % turn would be formatted and output when all of \verb"#2" for the lemma
8127 % has been read.
8128 %
8129 % \begin{macro}{\end@lemmas}
8130 % To accomodate this, we provide a list macro
8131 % to which macros may add commands that should subsequently
8132 % be executed at the end of the lemma when that lemma is added
8133 % to the text of the paragraph. A macro should add its contribution to
8134 % \protect\cs{end@lemmas} by using \protect\cs{xleft@appenditem}.
8135 % (Anything that needs to be done at
8136 % the \emph{start} of the lemma may be handled using \protect\cs{aftergroup}, since
8137 % the commands specified within \protect\cs{edtext}'s second argument are
8138 % executed within a group that ends just before the lemma is added to
8139 % the main text.)
8140 %
8141 % \protect\cs{end@lemmas} is intended for the few things that need to be
8142 % associated with the end of the lemma, like footnote numbers. Such
8143 % numbers are not implemented in the current version, and indeed
8144 % no use is currently made of \protect\cs{end@lemmas} or of the \protect\cs{aftergroup}
8145 % trick. The general
8146 % approach would be to define a macro to be used within the second
8147 % argument of \protect\cs{edtext} that would add the appropriate command to
8148 % \protect\cs{end@lemmas}.
8149 %
8150 % Commands that are added to this list should always take care
8151 % not to do anything that adds possible line-breaks to the output;
8152 % otherwise line numbering could be thrown off.
8153 % \begin{macrocode}
8154 \list@create{\end@lemmas}
8155 % \end{macrocode}
8156 % \end{macro}
8157 %
8158 % \begin{macro}{\dummy@edtext}
8159 % We now need to define a number of macros that allow us to weed out
8160 % nested instances of \protect\cs{edtext}, and other problematic macros, from
8161 % our lemma. This is similar to what we did in reading the line-list
8162 % file using \protect\cs{dummy@ref} and various redefinitions---and that is
8163 % because nested \protect\cs{edtext}s macros create nested \protect\cs{@ref} entries
8164 % in the line-list file.
8165 %
8166 %
8167 % \begin{macrocode}
8168 \newcommand{\dummy@edtext}[2]{#1}
8169 % \end{macrocode}
8170 %
8171 % \end{macro}
8172 % \begin{macro}{\dummy@edtext@showlemma}
8173 % Some time, we want to obtain only the first argument of \protect\cs{edtext}, while also wrapping it in \protect\cs{showlemma}. For example, when printing a \protect\cs{eledsection}.
8174 % \begin{macrocode}
8175 \newcommand{\dummy@edtext@showlemma}[2]{\showlemma{#1}}%
8176 % \end{macrocode}
8177 % \end{macro}
8178 %
8179 % We are going to need another macro that takes one argument and ignores
8180 % it entirely. This is supplied by the \LaTeX\ \protect\cs{@gobble}\marg{arg}.
8181 %
8182 % \begin{macro}{\no@expands}
8183 % \begin{macro}{\morenoexpands}
8184 % We need to turn off macro expansion for certain sorts of macros we are
8185 % likely to see within the lemma and within the notes.
8186 %
8187 % The first class is font-changing macros. We suppress expansion for
8188 % them by letting them become equal to zero.\footnote{Since \enquote{control
8189 % sequences equivalent to characters are not expandable}---\thetexbook,
8190 % answer to Exercise 20.14.} This is done because we want to
8191 % pass into our notes the generic commands to change to roman or
8192 % whatever, and not their expansions that will ask for a particular style at
8193 % a specified size. The notes may well be in a smaller font, so the
8194 % command should be expanded later, when the note's environment is in
8195 % effect.
8196 %
8197 % A second sort to turn off includes a few of the accent macros.
8198 % Most are not a problem: an accent that is expanded to an \protect\cs{accent}
8199 % command may be harder to read but it works just the same. The
8200 % ones that cause problems are: those that use alignments---\TeX\
8201 % seems to get confused about the difference between alignment
8202 % parameters and macro parameters; those that use temporary control
8203 % sequences; and those that look carefully at what the current font
8204 % is.
8205 %
8206 % (The \protect\cs{copyright} macro defined in \PlainTeX\ has this sort of
8207 % problem as well, but is not used enough to bother with. That macro,
8208 % and any other that causes trouble, will get by all right if you put
8209 % a \protect\cs{protect} in front of it in your file.)
8210 %
8211 % We also need to eliminate all \macpackage\ macros like \protect\cs{edlabel} and
8212 % \protect\cs{setline} that write things to auxiliary files: that writing
8213 % should be done only once. And we make
8214 % \protect\cs{edtext} itself, if it appears within its own
8215 % argument, do nothing but copy its first argument.
8216 %
8217 % Finally, we execute \protect\cs{morenoexpands}. The version of
8218 % \protect\cs{morenoexpands} defined here does nothing; but you may define
8219 % a version of your own when you need to add more expansion
8220 % suppressions as needed with your macros. That makes it possible
8221 % to make such additions without needing to copy or modify the
8222 % standard \macpackage\ code. If you define your own
8223 % \protect\cs{morenoexpands}, you must be very careful about spaces: if the
8224 % macro adds any spaces to the text when it runs, extra space
8225 % will appear in the main text when \protect\cs{edtext} is used.
8226 %
8227 %
8228 % The \cs{new@series} command also adds \cs{let}\cs{footnote\meta{X}}\cs{@gobble} to the end of the \cs{no@expands} macro for the series \meta{X}.
8229 %
8230 % (A related problem, not addressed by these two macros,
8231 % is that of characters whose category code are changed by any of
8232 % the macros used in the arguments to \protect\cs{edtext}. Since the
8233 % category codes are set when the arguments are scanned, macros
8234 % that depend on changing them will not work. We have most often
8235 % encountered this with characters that are made \enquote{active} within
8236 % text in some, but not all, of the languages used within the document.
8237 % One way around the problem, if it takes this form,
8238 % is to ensure that those characters are \emph{always} active. Within
8239 % languages that make no special use of them, their associated
8240 % control sequences should simply return the proper character. A simpler solution is to avoid active characters, using \LuaTeX\ or \XeLaTeX.)
8241 % \changes{v0.2.0}{2003/07/25}{Added \protect\cs{l@dtabnoexpands} to \protect\cs{no@expands}}
8242 % \changes{v0.2.1}{203/08/25}{Removed some \protect\cs{let}s from \protect\cs{no@expands}.
8243 % These were in \edmac{} but Peter Wilson feels that they should not have been as they
8244 % disabled page/line refs in a footnotes}
8245 % \changes{v1.0.0}{2012/09/15}{Change to be compatible with new features}
8246 % \begin{macrocode}
8247 \newcommand*{\no@expands}{%
8248 \let\select@@lemmafont=0%
8249 \let\startsub=\relax \let\endsub=\relax
8250 \let\startlock=\relax \let\endlock=\relax
8251 \let\edlabel=\@gobble
8252 \let\setline=\@gobble \let\advanceline=\@gobble
8253 \let\sameword\sameword@inedtext%
8254 \let\edtext=\dummy@edtext
8255 \let\edindex\dummy@edindex%
8256 \l@dtabnoexpands
8257 \l@noexpands@edgl%
8258 \let\linenumannotation=\@gobble%
8259 \morenoexpands}
8260 \let\morenoexpands=\relax
8261
8262 % \end{macrocode}
8263 % \end{macro}
8264 % \end{macro}
8265 %
8266 % \begin{macro}{\@tag}
8267 % Now, we define an empty \protect\cs{@tag} command. It will be redefine by \protect\cs{edtext}: its value is the first argument. It will be used by the \protect\cs{Xfootnote} commands.
8268 % \begin{macrocode}
8269 \newcommand{\@tag}{}
8270 % \end{macrocode}
8271 % \end{macro}
8272 % \begin{macro}{\@edtext@level}
8273 % \changes{v1.15.0}{2015/01/12}{New boolean \protect\cs{if@edtext@}.}
8274 % \changes{v1.23.0}{2015/05/18}{The boolean \protect\cs{if@edtext@} becomes the counter \protect\cs{edtext@level}.}
8275 % This counter is increased by 1 at each level of \protect\cs{edtext}.
8276 % \begin{macrocode}
8277 \newcount\@edtext@level%
8278 \@edtext@level=0%
8279 % \end{macrocode}
8280 % \end{macro}
8281 % \begin{macro}{\if@edtext@secondarg@}
8282 % This boolean is set to TRUE before reading the second argument of a \cs{edtext}.
8283 % It is tested on some macro which must be executed only inside a second argument.
8284 % \begin{macrocode}
8285 \newif\if@edtext@secondarg@%
8286 % \end{macrocode}
8287 % \end{macro}
8288 % \changes{v1.16.0}{2014/01/23}{\protect\cs{edtext} is now defined only in \eledmac, not in \eledpar. Debug wrong numbering when using \protect\cs{sameword} + \protect\package{eledpar} + \protect\cs{tag} command.}
8289 %
8290 %
8291 % \begin{macro}{\theedtext}
8292 % The \verb+edtext+ counter is increased at each \cs{edtext} command.
8293 % It is used to add to insert hyperlinks between a notes and the lemma.
8294 % \begin{macrocode}
8295 \newcounter{edtext}
8296 \renewcommand{\theedtext}{edtxt@\the\c@edtext}%
8297 % \end{macrocode}
8298 % \end{macro}
8299 % \begin{macro}{\edtext@notes}
8300 % \begin{macro}{\edtext@notes@start}
8301 % The \cs{edtext@notes} is increased each time we have a footnote required in the second argument of \cs{edtext}, that is a \cs{Xfootnote} or a \cs{Xendfootnote}.
8302 %
8303 % The \cs{edtext@notes@start} is let to \cs{edtext@notes} at the beginning of a \cs{edtext}
8304 %
8305 % \begin{macrocode}
8306 \newcount\edtext@notes%
8307 \newcount\edtext@notes@start%
8308 % \end{macrocode}
8309 % \end{macro}
8310 % \end{macro}
8311 % \begin{macro}{\if@noneed@notes}
8312 % The \cs{if@noneed@notes} macro is (locally) set to true when we read a critical note for a series with \Xnonote set to true.
8313 % \begin{macrocode}
8314 \newif\if@noneed@notes%
8315 % \end{macrocode}
8316 % \end{macro}
8317 % \begin{macro}{\edtext}
8318 % \changes{v0.4.0}{2004/02/29}{Added \protect\cs{showlemma} to \protect\cs{edtext}}
8319 % \changes{v1.4.0}{2012/11/16}{Compatibility of \protect\cs{edtext} with the right-to-left direction (with Polyglossia).}
8320 % \changes{v1.17.0}{2015/02/09}{Error message when calling \protect\cs{edtext} outside of a numbered paragraph.}
8321 % When executed, \protect\cs{edtext} first ensures that we are in
8322 % horizontal mode.
8323 % \begin{macrocode}
8324 \newcommand{\edtext}[2]{\leavevmode%
8325 % \end{macrocode}
8326 % Then, check if we are in a numbered paragraph (\protect\cs{pstart}\ldots\protect\cs{pend})..
8327 % \begin{macrocode}
8328 \ifnumberedpar@%
8329 % \end{macrocode}
8330 % Check the content of the arguments, to be certain there is no forbidden command inside.
8331 % \begin{macrocode}%
8332 \@check@edtext@args{#1}{#2}%
8333 % \end{macrocode}
8334 % We increment the \cs{@edtext@level} \TeX\ counter to know in which level of \protect\cs{edtext} we are.
8335 % \begin{macrocode}
8336 \global\advance\@edtext@level by 1%
8337 % \end{macrocode}
8338 % We let \cs{edtext@notes@start} equal to \cs{edtext@notes} to check later the number of notes associated to the edtext.
8339 % \begin{macrocode}
8340 \global\edtext@notes@start=\edtext@notes%
8341 % \end{macrocode}
8342 % We also increase the \verb+edtext+ \LaTeX\ counter to insert a hypertarget if the \package{hyperref} package is loaded, and also works with \cs{edtext} on right-to-left typesetting with \XeLaTeX.
8343 %
8344 % We store the value for the current level in a global macro. So we have one macro by level of \cs{edtext}. That is required, because \cs{edtext} can contain \cs{edtext}.
8345 % \begin{macrocode}
8346 \stepcounter{edtext}%
8347 \csxdef{thisedtext@\the\@edtext@level}{\theedtext}%
8348 % \end{macrocode}
8349 % By default, we do not use \protect\cs{lemma}
8350 % \begin{macrocode}
8351 \global\@lemmacommand@false%
8352 % \end{macrocode}
8353 % \begin{macrocode}
8354 \begingroup%
8355 % \end{macrocode}
8356 % We get the next series of samewords data in the list of samewords data for the current edtext level. We push them inside \protect\cs{sw@inthisedtext}.
8357 % \begin{macrocode}
8358 \ifledRcol%
8359 \ifcsvoid{sw@list@edtextR@\the\@edtext@level}%
8360 {\global\let\sw@inthisedtext\empty}%
8361 {\expandafter\gl@p\csname sw@list@edtextR@\the\@edtext@level\endcsname\to\sw@inthisedtext}%
8362 \else%
8363 \ifcsvoid{sw@list@edtext@\the\@edtext@level}%
8364 {\global\let\sw@inthisedtext\empty}%
8365 {\expandafter\gl@p\csname sw@list@edtext@\the\@edtext@level\endcsname\to\sw@inthisedtext}%
8366 \fi%
8367 % \end{macrocode}
8368 % \begin{macro}{\@tag}
8369 % \label{@tag}Our normal lemma is just argument \verb"#1"; but that argument could have
8370 % further invocations of \protect\cs{edtext} within it. We get a copy of the
8371 % lemma without any \protect\cs{edtext} macros within it by temporarily redefining
8372 % \protect\cs{edtext} to just copy its first argument and ignore the other,
8373 % and then expand \verb"#1" into \protect\cs{@tag}, our lemma.
8374 %
8375 % This is done within a group that starts here, in order to get the
8376 % original \protect\cs{edtext} restored; within this group we have also turned
8377 % off the expansion of those control sequences commonly found within text
8378 % that can cause trouble for us.
8379 %
8380 % \begin{macrocode}
8381 \global\renewcommand{\@tag}{%
8382 \no@expands #1%
8383 }%
8384 % \end{macrocode}
8385 % \end{macro}
8386 % \begin{macro}{\l@d@nums}
8387 % \phantomsection\label{nums}
8388 % Prepare more data for the benefit of note-generating macros: the line
8389 % references and font specifier for this lemma go to \protect\cs{l@d@nums}.
8390 % \begin{macrocode}
8391 \set@line%
8392 % \end{macrocode}
8393 % \end{macro}
8394 % \protect\cs{insert@count} will be altered by the note-generating macros:
8395 % it counts the number of deferred footnotes or other insertions
8396 % generated by this instance of \protect\cs{edtext}.
8397 % If we are in a right column (\parpackage), we use \protect\cs{insert@countR}
8398 % instead of \protect\cs{insert@count}.
8399 % \begin{macrocode}
8400 \ifledRcol \global\insert@countR \z@%
8401 \else \global\insert@count \z@ \fi%
8402 % \end{macrocode}
8403 % Now process the note-generating macros in argument \verb"#2"
8404 % (i.e., \protect\cs{Afootnote}, \protect\cs{lemma}, etc.). \protect\cs{ignorespaces} is here to
8405 % skip over any spaces that might appear at the start of \verb"#2";
8406 % otherwise they wind up in the main text. Footnote and other
8407 % macros that are used within \verb"#2" should all end with
8408 % \protect\cs{ignorespaces} as well, to skip any spaces between macros when
8409 % several are used in series.
8410 % \begin{macrocode}
8411 \@edtext@secondarg@true%
8412 \ignorespaces #2\relax%
8413 \@edtext@secondarg@false%
8414 % \end{macrocode}
8415 % Check if we inded insert footnotes or critical notes.
8416 % \begin{macrocode}
8417 \ifnum\edtext@notes=\edtext@notes@start%
8418 \unless\if@noneed@notes%
8419 \led@err@EdtextWithoutNote{#1}%
8420 \fi%
8421 \fi%
8422 % \end{macrocode}
8423 % With \XeLaTeX, you must track whether the language reads left to right (English) or right to left (Arabic). \reledmac defines an \cs{if@RTL} boolean test is not already defined.
8424 % \begin{macrocode}
8425 \if@RTL%
8426 \IfStrEq{\xabslineref{edtext:start:\csuse{thisedtext@\the\@edtext@level}}}%
8427 {000}%
8428 {}%
8429 {%
8430 \ifnumequal%
8431 {\xabslineref{edtext:start:\csuse{thisedtext@\the\@edtext@level}}}%
8432 {\xabslineref{edtext:end:\csuse{thisedtext@\the\@edtext@level}}}%
8433 {}%
8434 {\write@lemma}%
8435 }%
8436 \flag@start@RTL%
8437 \IfStrEq{\xabslineref{edtext:start:\csuse{thisedtext@\the\@edtext@level}}}%
8438 {000}%
8439 {}%
8440 {%
8441 \ifnumequal%
8442 {\xabslineref{edtext:start:\csuse{thisedtext@\the\@edtext@level}}}%
8443 {\xabslineref{edtext:end:\csuse{thisedtext@\the\@edtext@level}}}%
8444 {\write@lemma}%
8445 {}%
8446 }%
8447 \else%
8448 \flag@start%
8449 \write@lemma%
8450 \fi%
8451 % \end{macrocode}
8452 % We write in the numbered file wether the current \protect\cs{edtext} has a \protect\cs{lemma} in the the second argument.
8453 % Finally, we are ready to admit the first argument into the current
8454 % paragraph.
8455 %
8456 % It is important that we generate and output all the notes for this
8457 % chunk of text \emph{before} putting the text into the paragraph: notes
8458 % that are referenced by line number should generally be tied to the
8459 % start of the passage they gloss, not the end. That should all be done
8460 % within the expansion of \verb"#2" above, or in \protect\cs{aftergroup}
8461 % commands within that expansion.
8462 % \begin{macrocode}
8463 \endgroup%
8464 \ifdef{\hypertarget}%
8465 {%
8466 \Hy@raisedlink@left{\hypertarget{\csuse{thisedtext@\the\@edtext@level}:start}{}}%
8467 \showlemma{#1}%
8468 \Hy@raisedlink{\hypertarget{\csuse{thisedtext@\the\@edtext@level}:end}{}}%
8469 }%
8470 {%
8471 \showlemma{#1}%
8472 }%
8473 % \end{macrocode}
8474 % If using \package{hyperref} package, we put the final hypertarget for \cs{applabel}.
8475 % \begin{macrocode}
8476 \ifdef{\hypertarget}%
8477 {%
8478 \def\do##1{\Hy@raisedlink{\hypertarget{##1:end}{}}}%
8479 \ifcsdef{applabel@thisedtext@\the\@edtext@level}{%
8480 \dolistcsloop{applabel@thisedtext@\the\@edtext@level}%
8481 \global\cslet{applabel@thisedtext@\the\@edtext@level}{\empty}%
8482 }{}%
8483 }%
8484 {}%
8485 % \end{macrocode}
8486 %
8487 % Finally, we add any insertions that are
8488 % associated with the \emph{end} of
8489 % the lemma. Footnotes that are identified by symbols rather than by
8490 % where the lemma begins in the main text need to be done here, and
8491 % not above.
8492 %
8493 % \begin{macrocode}
8494 \ifx\end@lemmas\empty \else%
8495 \gl@p\end@lemmas\to\x@lemma%
8496 \x@lemma%
8497 \global\let\x@lemma=\relax%
8498 \fi%
8499 \if@RTL%
8500 \flag@end@RTL%
8501 \else%
8502 \flag@end%
8503 \fi%
8504 % \end{macrocode}
8505 % We switch some flags to false.
8506 % \begin{itemize}
8507 % \item The one that checks having footnotes inside a \protect\cs{edtext}.
8508 % \item The one that says we are inside a \protect\cs{edtext}. In fact, it is not a flag, but a counter which is increased to 1 in each leavel of \protect\cs{edtext}.
8509 % \item The one that says we are inside a \protect\cs{@lemma}.
8510 % \end{itemize}
8511 % \begin{macrocode}
8512 \global\advance\@edtext@level by -1%
8513 \global\@lemmacommand@false%
8514 % \end{macrocode}
8515 % We also reset \cs{@beforeinsertofthisedtext}
8516 % \begin{macrocode}
8517 \global\let\@beforeinsertofthisedtext\relax%
8518 % \end{macrocode}
8519 % If we are outside of a numbered paragraph,
8520 % we send an error message and print the first argument.
8521 % \begin{macrocode}
8522 \else%
8523 \showlemma{#1} (\textbf{\textsc{Edtext outside numbered paragraph}})\led@err@edtextoutsidepstart%
8524 \fi%
8525 }%
8526
8527
8528 % \end{macrocode}
8529 % \end{macro}
8530 % \begin{macro}{\@check@edtext@args}
8531 % A macro which just checks the arguments of the \cs{edtext} and let know
8532 % if there is some probleme, like, for example, \cs{pstart} inside.
8533 % \begin{macrocode}
8534 \newcommand{\@check@edtext@args}[2]{%
8535 \begingroup%
8536 \noexpandarg%
8537 \IfSubStr{#1}{\pstart}{\led@err@PstartInEdtext{first}}{}%
8538 \IfSubStr{#1}{\pend}{\led@err@PendInEdtext{first}}{}%
8539 \IfSubStr{#2}{\pstart}{\led@err@PstartInEdtext{second}}{}%
8540 \IfSubStr{#2}{\pend}{\led@err@PendInEdtext{second}}{}%
8541 \endgroup%
8542 }%
8543 %
8544 % \end{macrocode}
8545 % \end{macro}
8546 % \begin{macro}{\@beforeinsertofthisedtext}
8547 % \cs{@beforeinsertofthisedtext} is an internal macro. \macpackage\ or \parpackage can add in this macro any content required to be executed before doing any \cs{insert} related to a \cs{edtext}.
8548 % Its content is \cs{let} equal to \cs{relax} at the end of every \cs{edtext}.
8549 % \begin{macrocode}
8550 \let\@beforeinsertofthisedtext\relax
8551 % \end{macrocode}
8552 % \end{macro}
8553 % \begin{macro}{\ifnumberline}
8554 % The \protect\cs{ifnumberline} option can be set to FALSE to disable line numbering.
8555 % \begin{macrocode}
8556 \newif\ifnumberline
8557 \numberlinetrue
8558 % \end{macrocode}
8559 % \end{macro}
8560 % \begin{macro}{\set@line}
8561 % The \protect\cs{set@line} macro
8562 % is called by \protect\cs{edtext} to put the line-reference field and
8563 % font specifier for the current block of text into \protect\cs{l@d@nums}.
8564 %
8565 % One instance of \protect\cs{edtext} may generate several notes, or it
8566 % may generate none\,---\,it is legitimate for argument \verb"#2" to \protect\cs{edtext} to
8567 % be empty. But \protect\cs{flag@start} and \protect\cs{flag@end} induce the generation of
8568 % a single entry in \protect\cs{line@list} during the next run, and it is vital
8569 % to also remove one and only one \protect\cs{line@list} entry here.
8570 %
8571 % If no more lines are listed in \protect\cs{line@list}, something is
8572 % wrong\,---\,probably just some change in the input. We set all the numbers
8573 % to zeros, following an old publishing convention for numerical
8574 % references that have not yet been resolved.
8575 % \begin{macrocode}
8576 \newcommand*{\set@line}{%
8577 \ifledRcol
8578 \ifx\line@listR\empty
8579 \global\noteschanged@true
8580 \xdef\l@d@nums{000|000|000|000|000|000|\edfont@info}%
8581 \else
8582 \gl@p\line@listR\to\@tempb
8583 \xdef\l@d@nums{\@tempb|\edfont@info}%
8584 \global\let\@tempb=\undefined
8585 \fi
8586 \ifx\annot@listR\empty%
8587 \xdef\l@current@annotR{|}%
8588 \else%
8589 \gl@p\annot@listR\to\@tempb%
8590 \xdef\l@current@annotR{\@tempb}%
8591 \global\let\@tempb=\undefined%
8592 \fi%
8593 \else
8594 \ifx\line@list\empty
8595 \global\noteschanged@true
8596 \xdef\l@d@nums{000|000|000|000|000|000|\edfont@info}%
8597 \else
8598 \gl@p\line@list\to\@tempb
8599 \xdef\l@d@nums{\@tempb|\edfont@info}%
8600 \global\let\@tempb=\undefined
8601 \fi
8602 \ifx\annot@list\empty%
8603 \xdef\l@current@annot{|}%
8604 \else%
8605 \gl@p\annot@list\to\@tempb%
8606 \xdef\l@current@annot{\@tempb}%
8607 \global\let\@tempb=\undefined%
8608 \fi%
8609 \fi}
8610
8611 % \end{macrocode}
8612 % \end{macro}
8613 %
8614 % \begin{macro}{\edfont@info}
8615 % The macro \protect\cs{edfont@info} returns coded information about the
8616 % current font.
8617 %
8618 % \begin{macrocode}
8619 \newcommand*{\edfont@info}{\f@encoding/\f@family/\f@series/\f@shape}
8620
8621 % \end{macrocode}
8622 % \end{macro}
8623 %
8624 % \subsection{Substitute lemma}
8625 %
8626 % \begin{macro}{\lemma}
8627 % \changes{v1.23.0}{2015/05/18}{Fix spurious space after \protect\cs{lemma} command}
8628 % The \protect\cs{lemma}\marg{text} macro allows you to change the lemma
8629 % that is passed on to the notes.
8630 % Read about \protect\cs{@tag} in normal \protect\cs{edtext} macro for more details about \protect\cs{sw@list@inedtext} and \protect\cs{no@expands} (\reff{@tag}).
8631 % \begin{macrocode}
8632 \newcommand*{\lemma}[1]{%
8633 \global\@lemmacommand@true%
8634 \global\renewcommand{\@tag}{%
8635 \no@expands #1%
8636 }%
8637 \ignorespaces%
8638 }%
8639 % \end{macrocode}
8640 % \end{macro}
8641 %
8642 % \begin{macro}{\@lemma}
8643 % \begin{macro}{\write@lemma}
8644 % The \protect\cs{@lemma} is written in the numbered file to set which \protect\cs{edtext} has an
8645 % \protect\cs{lemma} as second argument.
8646 % \begin{macrocode}
8647 \newcommand{\@lemma}{%
8648 \booltrue{lemmacommand@\the\@edtext@level}%
8649 }%
8650 \newcommand{\write@lemma}{%
8651 \if@lemmacommand@%
8652 \ifledRcol%
8653 \write\linenum@outR{\string\@lemma}%
8654 \else%
8655 \write\linenum@out{\string\@lemma}%
8656 \fi%
8657 \fi%
8658 }%
8659 % \end{macrocode}
8660 % \end{macro}
8661 % \end{macro}
8662 % \begin{macro}{\if@lemmacommand@}
8663 % \changes{v1.15.0}{2015/01/12}{New boolean \protect\cs{iflemmacommand@}.}
8664 % This boolean is set to TRUE inside a \protect\cs{edtext} (or \protect\cs{critext}) when a \protect\cs{lemma} command is called.
8665 % That is useful for some commands which can have a different behavior if the lemma in the note is different from the lemma in the main text.
8666 % \begin{macrocode}
8667 \newif\if@lemmacommand@%
8668 % \end{macrocode}
8669 % \end{macro}
8670 % \subsection{Substitute line numbers}
8671 %
8672 % \begin{macro}{\linenum}
8673 % \label{linenumdef}
8674 % The \protect\cs{linenum} macro can change any or all of
8675 % the page and line numbers that are
8676 % passed on to the notes.
8677 %
8678 % As argument \protect\cs{linenum} takes a set of seven parameters
8679 % separated by vertical bars, in the format used internally for
8680 % \protect\cs{l@d@nums} (see \reff{linenumbers}): the starting page,
8681 % line, and sub-line numbers, followed by the ending page, line, and
8682 % sub-line numbers, and then the font specifier for the lemma.
8683 % However, you can omit any parameters you do not want to change, and
8684 % you can omit a string of vertical bars at the end of the
8685 % argument. Hence \verb"\linenum{18|4|0|18|7|1|0}" is an invocation
8686 % that changes all the parameters, but \verb"\linenum{|3}" only
8687 % changes the starting line number, and leaves the rest unaltered.
8688 %
8689 % We use \verb"\\" as an internal separator for the macro parameters.
8690 % \begin{macrocode}
8691 \newcommand*{\linenum}[1]{%
8692 \xdef\@tempa{#1|||||||\noexpand\\\l@d@nums}%
8693 \global\let\l@d@nums=\empty
8694 \expandafter\line@set\@tempa|\\\ignorespaces}
8695 % \end{macrocode}
8696 %
8697 % \begin{macro}{\line@set}
8698 % \protect\cs{linenum} calls \protect\cs{line@set} to do the actual work; it
8699 % looks at the first number in the argument to \protect\cs{linenum},
8700 % sets the corresponding value in \protect\cs{l@d@nums}, and then calls
8701 % itself to process the next number in the \protect\cs{linenum}
8702 % argument, if there are more numbers in \protect\cs{l@d@nums} to process.
8703 % \begin{macrocode}
8704 \def\line@set#1|#2\\#3|#4\\{%
8705 \gdef\@tempb{#1}%
8706 \ifx\@tempb\empty
8707 \l@d@add{#3}%
8708 \else
8709 \l@d@add{#1}%
8710 \fi
8711 \gdef\@tempb{#4}%
8712 \ifx\@tempb\empty\else
8713 \l@d@add{|}\line@set#2\\#4\\%
8714 \fi}
8715 % \end{macrocode}
8716 % \end{macro}
8717 %
8718 % \begin{macro}{\l@d@add}
8719 % \protect\cs{line@set} uses \protect\cs{l@d@add} to tack numbers or vertical bars
8720 % onto the right hand end of \protect\cs{l@d@nums}.
8721 % \begin{macrocode}
8722 \newcommand{\l@d@add}[1]{\xdef\l@d@nums{\l@d@nums#1}}
8723
8724 % \end{macrocode}
8725 % \end{macro}
8726 % \end{macro}
8727 %
8728 % \begin{macro}{\lineannot}
8729 % \begin{macro}{\lineannot@set}
8730 % Last but not least, \cs{lineannot} allows us to substitute line number annotation. It is different from \cs{linenum} for backward compatibility with older versions of \macpackage. It calls \cs{lineannot@set} to determine whether we must change only one annotation or two, or none.
8731 % \begin{macrocode}
8732 \newcommand*{\lineannot}[1]{%
8733 \lineannot@set#1|%
8734 }%
8735 \def\lineannot@set#1|#2|{%
8736 \expandafter\parse@annot#1|#2|%
8737 \IfStrEq{#1}{}%
8738 {\let\@tempa\annot@start}%
8739 {\def\@tempa{#1}}%
8740 \IfStrEq{#2}{}%
8741 {\let\@tempb\annot@start}%
8742 {\def\@tempb{#2}}%
8743 \xdef\l@current@annot{\@tempa|\@tempb}%
8744 }%
8745 % \end{macrocode}
8746 % \end{macro}
8747 % \end{macro}
8748 % \subsection{Lemma disambiguation}
8749 % The mechanism which counts the occurrence of a same word in a same line is quite complex, because, when \LaTeX\ reads a command between a \protect\cs{pstart} and a \protect\cs{pend}, it does not know yet which are the line numbers.
8750 %
8751 % The general mechanism is the following:
8752 % \begin{itemize}
8753 % \item \textbf{At the first run}, each \protect\cs{sameword} command increments an \protect\package{etoolbox} counter the name of which contains the argument of the \protect\cs{sameword} commands.
8754 % \item Then this counter associated with the argument of \protect\cs{sameword} is stored with the \protect\cs{@sw} command in the auxiliary file of the current \macpackage\ section (the \verb+.1+, \verb+.2+\ldots\ file).
8755 % \item \textbf{When this auxiliary file is read at the second run}, different operations are achieved:
8756 % \begin{enumerate}
8757 % \item Get the rank of each \protect\cs{sameword} in a line (relative rank) from the rank of each \protect\cs{sameword} in all the numbered section (absolute rank):
8758 % \begin{itemize}
8759 % \item For each paired \protect\cs{sameword} argument and absolute line number, a counter is defined. Its value corresponds to the number of times \protect\cs{sameword}\marg{argument} is called from the beginning of the lineation to the end of the current line. We also store the same data for the preceding absolute line number, if it does not have \protect\cs{sameword}\marg{argument}.
8760 % \item For each \protect\cs{sameword} having the same argument, we subtract from its absolute rank the number stored for the paired \protect\cs{sameword} argument and previous absolute line number. Consequently, we obtain the relative rank.
8761 % \item See the following example which explains how, for same \protect\cs{sameword}, absolute ranks are transformed to relative ranks.
8762 % \begin{verbatim}
8763 % At line 1:
8764 % absolute rank 1 becomes relative rank 1-0 = 1
8765 % 1 is stored for this \sameword and line 1
8766 % At line 2:
8767 % absolute rank 2 becomes relative rank 2-1 = 1
8768 % absolute rank 3 becomes relative rank 3-1 = 2
8769 % 3 is stored for this \sameword and line 2
8770 % At line 3:
8771 % no \sameword for this line.
8772 % 3 is stored for this \sameword and line 3
8773 % At line 4:
8774 % absolute rank 4 becomes relative rank 4-3 = 1
8775 % 4 is stored for this \sameword and line 4
8776 % \end{verbatim}
8777 % \end{itemize}
8778 % \item Create lists of lists of \protect\cs{sameword} by depth of \protect\cs{edtext}.
8779 % That is: create a list for \protect\cs{edtext}s of level~1, a list for \protect\cs{edtext}s of level~2, a list for \protect\cs{edtext}s of level~3 etc.
8780 % For each \protect\cs{edtext} in these lists, we store all of the relative ranks of \protect\cs{saweword} which are called as lemma information. That is: 1) either called in the first argument of \protect\cs{sameword}, or, 2) called in the \protect\cs{lemma} macro of the second argument of \protect\cs{sameword} AND marked by the optional argument of \protect\cs{saweword} in first argument of \protect\cs{edtext}.
8781 %
8782 % For example, suppose a line with nested \protect\cs{edtext}s which contains some
8783 % word marked by \protect\cs{sameword} and having the following relative rank:\\
8784 %
8785 %
8786 %\let\up\textsuperscript
8787 %bar\up{1} \fbox{%
8788 % \fbox{foo\up{1} foo\up{2} bar\up{2} foo\up{3}} (A)(B)
8789 % foo\up{4} bar\up{3}%
8790 % } (C)
8791 % \fbox{%
8792 % \fbox{foo\up{5}} (D)
8793 % bar\up{4}
8794 % } (E)
8795 %
8796 % In this example, all lemma information for \protect\cs{edtext} is framed. The text in parenthesis is the content of critical notes associated to the preceding frame.
8797 % As you can see, we have two levels of \protect\cs{edtext}.
8798 %
8799 %The list for \protect\cs{edtext}s of level~1 is $\{\{1,2,2,3,4,3\},\{5,4\}\}$.
8800 %
8801 %The list for \protect\cs{edtext}s of level~2 is $\{\{1,2,2,3\},\{5\}\}$.
8802 %
8803 % As you can see, the mandatory argument of \protect\cs{sameword} does not matter: we store the rank informations for every word potentially ambiguous.
8804 % \end{enumerate}
8805 % \item At the second run, when a critical notes is called, we associate it to the next item of the list associated to its \protect\cs{edtext} level. So, in the previous example:
8806 % \begin{itemize}
8807 % \item Critical notes (A) and (B) are associated with $\{1,2,2,3\}$.
8808 % \item Critical note (C) is associated with $\{1,2,2,3,4,3\}$.
8809 % \item Critical note (D) is associated with $\{5\}$.
8810 % \item Critical note (E) is associated with $\{5,4\}$.
8811 % \end{itemize}
8812 % \item At the second run, when a critical note is printed:
8813 % \begin{itemize}
8814 % \item The \protect\cs{sameword} command is let \protect\cs{sameword@inedtext}.
8815 % \item At each call of this \protect\cs{sameword@inedtext}, we step to the next element of the list associated to the note. Let it be $r$.
8816 % \item For the word marked by \protect\cs{sameword}, we calculate how many time it is called in its line. To do it:
8817 % \begin{itemize}
8818 % \item We get the absolute line number of the current \protect\cs{sameword}. This absolute line number was stored with a list of relative ranks for the current \protect\cs{edtext}. That means, in the previous example, that if the absolute line number of \protect\cs{edtext} was 1, that critical notes (A) and (B) were not associated with $\{1,2,2,3\}$ but with $\{(1,1),(2,1),(2,1),(3,1)\}$. Such a method of knowing the absolute line number associated to a \protect\cs{sameword} is required because a \protect\cs{edtext} can overlap many lines, but \protect\cs{sameword} can't get it.
8819 % \item When reading the auxiliary file, we get the value associated to the pair composed by the current marked word and the current absolute line number. To this value, we subtract the value associated to the pair composed by the current marked word and the previous absolute line number. Let the result be $n$.
8820 % \end{itemize}
8821 % \item If $n >1 $, that means the current word appears more than once in its line. In this case, we call \protect\cs{showwordrank} with the word as the first argument and $r$ as the second argument. If the word is called only once, we just print it.
8822 % \end{itemize}
8823 % \end{itemize}
8824 % After theory, implementation.
8825 % First, getting a sanitized form of the argument of \cs{sameword}
8826 % \begin{macro}{\get@sw@txt}
8827 % \begin{macrocode}
8828 \newcommand{\get@sw@txt}[1]{%
8829 \begingroup%
8830 \swnoexpands%
8831 %. \end{macrocode}
8832 % Using case sensibility option.
8833 % \begin{macrocode}
8834 \ifsw@caseinsensitive%
8835 \def\@tmpa##1{\lowercase{##1}}%
8836 \else%
8837 \def\@tmpa##1{##1}%
8838 \fi%
8839 % \end{macrocode}
8840 % And now, define \cs{sw@txt}.
8841 % \begin{macrocode}
8842 \@tmpa{\protected@xdef\sw@txt{#1}}%
8843 \endgroup%
8844 }%
8845 % \end{macrocode}
8846 % \end{macro}
8847 % Allow some macros inside \cs{sameword}.
8848 % We use \cs{RenewExpandableDocumentCommand} to get expandable command with optional argument.
8849 % Cf. \url{https://tex.stackexchange.com/a/384783/7712}.
8850 % \begin{macro}{\sw@noexpand}
8851 % \begin{macrocode}
8852 \newcommand{\swnoexpands}{%
8853 \let\sameword\l@secondmandarg%Allow to have nested \sameword
8854 \let\emph\@firstofone%
8855 \let\textit\@firstofone%
8856 \let\textbf\@firstofone%
8857 \let\textsc\@firstofone%
8858 \let\framebox\@firstofone%
8859 \let\edtext\dummy@edtext%
8860 \RenewExpandableDocumentCommand{\edindex}{om}{}%
8861 \ifdefined\index%
8862 \RenewExpandableDocumentCommand{\index}{om}{}%
8863 \fi%
8864 \let\selectlanguage\@gobble%
8865 \let\foreignlanguage\@secondoftwo%
8866 \ifdefined\xpg@loaded%
8867 \renewcommand\do[1]{%
8868 \expandafter\RenewExpandableDocumentCommand\expandafter{\csname text##1\endcsname}{om}{####2}%
8869 }%
8870 \expandafter\docsvlist\expandafter{\xpg@loaded}%
8871 \fi%
8872 }%
8873 % \end{macrocode}
8874 % \end{macro}
8875 % \begin{macro}{\sameword}
8876 % \changes{v1.23.0}{2015/05/18}{In order to allow use of \protect\cs{sameword} with inputenc, we detokenize its mandatory argument before using it in control sequence names.}
8877 % The hight level macro \protect\cs{sameword}, used by the editor.
8878 % \begin{macrocode}
8879 \newcommandx{\sameword}[2][1,usedefault]{%
8880 \ifxetex%
8881 \if@RTL%
8882 \led@err@samewordRTL%
8883 \fi%
8884 \fi%
8885 \leavevmode%
8886 \get@sw@txt{#2}%
8887 % \end{macrocode}
8888 % Now, the real code. First, increment the counter corresponding to the argument.
8889 % \begin{macrocode}
8890 \unless\ifledRcol%
8891 \csnumgdef{sw@\sw@txt}{\csuse{sw@\sw@txt}+\@ne}%
8892 % \end{macrocode}
8893 % Then, write its value to the numbered file.
8894 % \begin{macrocode}
8895 \protected@write\linenum@out{}{\string\@sw{\sw@txt}{\csuse{sw@\sw@txt}}{#1}}%
8896 % \end{macrocode}
8897 % Do the same thing if we are in the right column.
8898 % \begin{macrocode}
8899 \else%
8900 \csnumgdef{sw@\sw@txt}{\csuse{sw@\sw@txt}+\@ne}%
8901 \protected@write\linenum@outR{}{\string\@sw{\sw@txt}{\csuse{sw@\sw@txt}}{#1}}%
8902 \fi%
8903 % \end{macrocode}
8904 % And print the word.
8905 % \begin{macrocode}
8906 #2%
8907 }%
8908 % \end{macrocode}
8909 % \end{macro}
8910 % A flag set to true if a \protect\cs{@sw} relative rank must be added to the list of ranks for a specific \protect\cs{edtext}.
8911 % \begin{macro}{\if@addsw}
8912 % \begin{macrocode}
8913 \newif\if@addsw%
8914 % \end{macrocode}
8915 % \end{macro}
8916 % \begin{macro}{\@sw}
8917 % The command printed in the auxiliary files.
8918 % \begin{macrocode}
8919 \newcommand{\@sw}[3]{%
8920 \get@sw@txt{#1}%
8921 \unless\ifledRcol%
8922 % \end{macrocode}
8923 % First, define a counter which store the second argument as value for a each paired absolute line number/first argument
8924 % \begin{macrocode}
8925 \csxdef{sw@\sw@txt @\the\absline@num @\the\section@num}{#2}%
8926 % \end{macrocode}
8927 % If such argument was not defined for the preceding line, define it.
8928 % \begin{macrocode}
8929 \numdef{\prev@line}{\the\absline@num-1}%
8930 \ifcsundef{sw@\sw@txt @\prev@line @\the\section@num}{%
8931 \csnumgdef{sw@\sw@txt @\prev@line @\the\section@num}{#2-1}%
8932 }{}%
8933 % \end{macrocode}
8934 % Then, calculate the position of the word in the line.
8935 % \begin{macrocode}
8936 \numdef{\the@sw}{#2-\csuse{sw@\sw@txt @\prev@line @\the\section@num}}%
8937 % \end{macrocode}
8938 % And do the same thing for the right side.
8939 % \begin{macrocode}
8940 \else%
8941 \csxdef{sw@\sw@txt @\the\absline@numR @\the\section@numR @R}{#2}%
8942 \numdef{\prev@line}{\the\absline@numR-1}%
8943 \ifcsundef{sw@\sw@txt @\prev@line @\the\section@numR @R}{%
8944 \csnumgdef{sw@\sw@txt @\prev@line @\the\section@numR @R}{#2-1}%
8945 }{}%
8946 \numdef{\the@sw}{#2-\csuse{sw@\sw@txt @\prev@line @\the\section@numR @R}}%
8947 \fi%
8948 % \end{macrocode}
8949 % And now, add it to the list of \protect\cs{@sw} for the current edtext, in all depth.
8950 % \begin{macrocode}
8951 \@tempcnta=\@edtext@level
8952 \@whilenum{\@tempcnta>0}\do{%
8953 \ifcsdef{sw@list@edtext@tmp@\the\@tempcnta}%
8954 {%
8955 \@addswfalse%
8956 \notbool{lemmacommand@\the\@tempcnta}%
8957 {\@addswtrue}%
8958 {\IfStrEq{#3}{inlemma}%
8959 {\@addswtrue}%
8960 {%
8961 \def\do##1{%
8962 \ifnumequal{##1}{\the\@tempcnta}%
8963 {\@addswtrue\listbreak}%
8964 {}%
8965 }%
8966 \docsvlist{#3}%
8967 }%
8968 }%
8969 \if@addsw%
8970 \letcs{\@tmp}{sw@list@edtext@tmp@\the\@tempcnta}%
8971 \ifledRcol%
8972 \xright@appenditem{{\the@sw}{\the\absline@numR}}\to\@tmp%
8973 \else%
8974 \xright@appenditem{{\the@sw}{\the\absline@num}}\to\@tmp%
8975 \fi%
8976 \cslet{sw@list@edtext@tmp@\the\@tempcnta}{\@tmp}%
8977 \fi%
8978 }%
8979 {}%
8980 \advance\@tempcnta by -1%
8981 }%
8982 }%
8983 % \end{macrocode}
8984 % \end{macro}
8985 % \begin{macro}{\sameword@inedtext}
8986 % The command called when \protect\cs{sameword} is called in a \protect\cs{edtext}.
8987 % \begin{macrocode}
8988 \newcommandx{\sameword@inedtext}[2][1,usedefault]{%
8989 \get@sw@txt{#2}%
8990 \unless\ifledRcol@%
8991 % \end{macrocode}
8992 % Just a precaution.
8993 % \begin{macrocode}
8994 \ifx\sw@list@inedtext\empty%
8995 \def\the@sw{999}%
8996 \def\this@absline{-99}%
8997 \else%
8998 % \end{macrocode}
8999 % But in many cases, at this step, we should have some content in the list \protect\cs{sw@list@inedtext}, which contains the reference for \protect\cs{edtext}.
9000 % \begin{macrocode}
9001 \gl@p\sw@list@inedtext\to\@tmp%
9002 \edef\the@sw{\expandafter\@firstoftwo\@tmp}%
9003 \edef\this@absline{\expandafter\@secondoftwo\@tmp}%
9004 \fi%
9005 % \end{macrocode}
9006 % First, calculate the number of occurrences of the word in the current line
9007 % \begin{macrocode}
9008 \ifcsdef{sw@\sw@txt @\this@absline @\the\section@num}{%
9009 \numdef{\prev@line}{\this@absline-1}%
9010 \numdef{\sw@atthisline}{\csuse{sw@\sw@txt @\this@absline @\the\section@num}-\csuse{sw@\sw@txt @\prev@line @\the\section@num}}%
9011 }%
9012 {\numdef{\sw@atthisline}{0}}%
9013 % \end{macrocode}
9014 % Finally, print the rank, but only if there is more than one occurrence of the word in the current line.
9015 % \begin{macrocode}
9016 \ifnumgreater{\sw@atthisline}{1}%
9017 {\showwordrank{#2}{\the@sw}}%
9018 {#2}%
9019 % \end{macrocode}
9020 % And the same for right side.
9021 % \begin{macrocode}
9022 \else%
9023 \ifx\sw@list@inedtext\empty%
9024 \def\the@sw{999}%
9025 \def\this@absline{-99}%
9026 \else%
9027 \gl@p\sw@list@inedtext\to\@tmp%
9028 \edef\the@sw{\expandafter\@firstoftwo\@tmp}%
9029 \edef\this@absline{\expandafter\@secondoftwo\@tmp}%
9030 \fi%
9031 \ifcsdef{sw@\sw@txt @\this@absline @\the\section@numR @R}{%
9032 \numdef{\prev@line}{\this@absline-1}%
9033 \numdef{\sw@atthisline}{\csuse{sw@\sw@txt @\this@absline @\the\section@numR @R}-\csuse{sw@\sw@txt @\prev@line @\the\section@numR @R}}%
9034 }%
9035 {\numdef{\sw@atthisline}{0}}%
9036 \ifnumgreater{\sw@atthisline}{1}%
9037 {\showwordrank{#2}{\the@sw}}%
9038 {#2}%
9039 \fi%
9040 }%
9041 % \end{macrocode}
9042 % \end{macro}
9043 % \begin{macro}{\showwordrank}
9044 % Finally, the way the rank will be printed.
9045 % \begin{macrocode}
9046 \newcommand{\showwordrank}[2]{%
9047 #1\textsuperscript{#2}%
9048 }%
9049 % \end{macrocode}
9050 % \end{macro}
9051
9052 % \section{Paragraph decomposition and reassembly}
9053 % \label{paragraph}\relax
9054 %
9055 % In order to be able to count the lines of text and affix line
9056 % numbers, we add an extra stage of processing for each paragraph.
9057 % We send the paragraph into a box
9058 % register, rather than straight onto the vertical list, and when
9059 % the paragraph ends we
9060 % slice the paragraph into its component lines; to each line we
9061 % add any notes or line numbers, add a command to write to the
9062 % line-list, and then at last send the line to the vertical list.
9063 % This section contains all the code for this processing.
9064 %
9065 % \subsection{Boxes, counters, \protect\cs{pstart}
9066 % and \protect\cs{pend}}
9067 %
9068 % \begin{macro}{\raw@text}
9069 % \begin{macro}{\ifnumberedpar@}
9070 % \begin{macro}{\numberedpar@true}
9071 % \begin{macro}{\numberedpar@false}
9072 % \begin{macro}{\num@lines}
9073 % \begin{macro}{\one@line}
9074 % \begin{macro}{\par@line}
9075 % Here are numbers and flags that are used internally in the course
9076 % of the paragraph decomposition.
9077 %
9078 % When we first form the paragraph, it goes into a box register,
9079 % \protect\cs{raw@text}, instead of onto the current vertical list.
9080 % The \protect\cs{ifnumberedpar@} flag will be \verb"true" while a paragraph is
9081 % being processed in that way.
9082 % \protect\cs{num@lines} will store the number of lines in the paragraph
9083 % when it is complete. When we chop it up into lines, each line
9084 % in turn goes into the
9085 % \protect\cs{one@line} register, and \protect\cs{par@line} will be the number
9086 % of that line within the paragraph.
9087 % \begin{macrocode}
9088 \newbox\raw@text
9089 \newif\ifnumberedpar@
9090 \newcount\num@lines
9091 \newbox\one@line
9092 \newcount\par@line
9093 % \end{macrocode}
9094 % \end{macro}
9095 % \end{macro}
9096 % \end{macro}
9097 % \end{macro}
9098 % \end{macro}
9099 % \end{macro}
9100 % \end{macro}
9101 %
9102 % \begin{macro}{\pstarts@typeset@L}
9103 % \begin{macro}{\pstarts@read@L}
9104 % The \cs{pstarts@typeset@L} counts the number of LEFT \cs{pstart} typeset.
9105 % A left \cs{pstart} can be a \cs{pstart} typeset in normal mode, or \cs{pstart} typset in left column or page in parallel mode (with{\parpackage}).
9106 % In the first case, its value is increased at every \cs{pstart} command.
9107 % In the second case, its value is increased in \cs{Columns} or \cs{Pages} when we prepare to typeset a left \cs{pstart}.
9108 % The \cs{pstarts@readL} counts the number of LEFT \cs{pstart} read.
9109 % A left \cs{pstart} can be a \cs{pstart} typeset in normal mode, or \cs{pstart} typset in left column or page in parallel mode (with{\parpackage}).
9110 % In the first case, its value is increased at every \cs{pstart} command.
9111 % In the second case, its value is increased at every \cs{pstarL}.
9112 %
9113 % \begin{macrocode}
9114 \newcount\pstarts@typeset@L%
9115 \newcount\pstarts@read@L%
9116 % \end{macrocode}
9117 % \end{macro}
9118 % \end{macro}
9119 % \begin{macro}{\pstart}
9120 % \begin{macro}{\AtEveryPstart}
9121 % \begin{macro}{\AtStartEveryPstart}
9122 % \changes{v1.6.1}{2013/10/27}{Spurious space in \protect\cs{pstart}.}
9123 % \changes{v1.12.0}{2014/08/05}{New optional argument for \protect\cs{pstart}, to execute code before it.}
9124 % \begin{macro}{\numberpstarttrue}
9125 % \begin{macro}{\numberpstartfalse}
9126 % \begin{macro}{\labelpstarttrue}
9127 % \begin{macro}{\labelpstartfalse}
9128 % \begin{macro}{\thepstart}
9129 % \begin{macro}{\ifat@every@pstart@star@}
9130 % \protect\cs{pstart} starts the paragraph by
9131 % clearing the \protect\cs{inserts@list} list and other
9132 % relevant variables, and then arranges for the
9133 % subsequent text to go into the
9134 % \protect\cs{raw@text} box. \protect\cs{pstart} needs to appear at the start of
9135 % every paragraph that is to be numbered; the \protect\cs{autopar} command below
9136 % may be used to insert these commands automatically.
9137 %
9138 % Beware: everything that occurs between \protect\cs{pstart} and \protect\cs{pend}
9139 % is happening within a group; definitions must be global if you want
9140 % them to survive past the end of the paragraph.
9141 % \changes{v1.13.1}{2014/09/25}{Add \protect\cs{l@dzeropenalties} in \protect\cs{pstart}}
9142 % \begin{macrocode}
9143
9144 \newcommand{\AtStartEveryPstart}[1]{%
9145 \ifstrempty{#1}%
9146 {\gdef\@at@start@every@pstart{}}%
9147 {\gdef\@at@start@every@pstart{#1}}%
9148 }%
9149 \def\@at@start@every@pstart{}%
9150
9151 \newif\ifat@every@pstart@star@%
9152 \newcommand{\AtEveryPstart}[1]{%
9153 \ifstrempty{#1}%
9154 {\gdef\at@every@pstart{}}%
9155 {\gdef\at@every@pstart{\noindent#1}}%
9156 \global\at@every@pstart@star@false%
9157 }%
9158 \WithSuffix\newcommand\AtEveryPstart*[1]{%
9159 \ifstrempty{#1}%
9160 {\gdef\at@every@pstart{}}%
9161 {\gdef\at@every@pstart{#1}}%
9162 \global\at@every@pstart@star@true%
9163 }%
9164 \def\at@every@pstart{}%
9165
9166 \newcounter{pstart}
9167 \renewcommand{\thepstart}{{\bfseries\@arabic\c@pstart}. }
9168 \newif\ifnumberpstart
9169 \numberpstartfalse
9170 \newif\iflabelpstart
9171 \labelpstartfalse
9172 \newcommandx*{\pstart}[2][1,2,usedefault]{%
9173 \normal@pars%
9174 \ifboolexpr{%
9175 test {\ifstrempty{#1}}%
9176 and test {\ifstrempty{#2}}%
9177 }%
9178 {\at@every@pstart}%
9179 {%
9180 \ifstrempty{#1}{}{\noindent#1}%
9181 \ifstrempty{#2}{}{#2}%
9182 }%
9183 \ifautopar%
9184 \autopar%
9185 \fi%
9186 \ifluatex%
9187 \edef\l@luatextextdir@L{\the\textdir}%
9188 \fi%
9189 \@nobreaktrue%
9190 \ifnumbering \else%
9191 \led@err@PstartNotNumbered%
9192 \beginnumbering%
9193 \fi%
9194 \ifnumberedpar@%
9195 \led@err@PstartInPstart%
9196 \pend%
9197 \fi%
9198 \list@clear{\inserts@list}%
9199 \global\let\next@insert=\empty%
9200 \begingroup\normal@pars%
9201 \global\advance \l@dnumpstartsL\@ne
9202 \global\advance \pstarts@typeset@L\@ne%
9203 \global\advance \pstarts@read@L\@ne%
9204 \global\setbox\raw@text=\vbox\bgroup%
9205 \if@nobreak%
9206 \if@afterindent\else%
9207 \unless\ifinstanza%
9208 \noindent%
9209 \fi%
9210 \global\@afterindenttrue%
9211 \fi%
9212 \fi%
9213 \ifboolexpr{%
9214 bool{autopar}%
9215 and bool{by@autopar}%
9216 }%
9217 {}%
9218 {%
9219 \ifnumberpstart%
9220 \ifinstanza\else%
9221 \ifsidepstartnum\else%
9222 \thepstart%
9223 \fi%
9224 \fi%
9225 \fi%
9226 }%
9227 \numberedpar@true%
9228 \iflabelpstart%
9229 \protected@edef\@currentlabel{\p@pstart\thepstart}%
9230 \fi%
9231 \l@dzeropenalties%
9232 \@at@start@every@pstart%
9233 \global\by@autoparfalse%
9234 \ignorespaces%because not automatically ignored if an optional argument is used (classical TeX behavior for space after commands)
9235 }
9236 % \end{macrocode}
9237 % \end{macro}
9238 % \end{macro}
9239 % \end{macro}
9240 % \end{macro}
9241 % \end{macro}
9242 % \end{macro}
9243 % \end{macro}
9244 % \end{macro}
9245 % \end{macro}
9246 % \begin{macro}{\pend}
9247 % \changes{v1.12.0}{2014/08/05}{New optional argument for \protect\cs{pend}, to execute code after it.}
9248 % \changes{v1.6.1}{2013/10/27}{Spurious space in \protect\cs{pend}.}
9249 % \protect\cs{pend} must be used to end a numbered paragraph.
9250 %
9251 % \begin{macrocode}
9252 \newcommandx*{\pend}[2][1,2,usedefault]{\ifnumbering \else%
9253 \led@err@PendNotNumbered%
9254 \fi%
9255 \global\l@dskipversenumberfalse%
9256 \ifnumberedpar@ \else%
9257 \led@err@PendNoPstart%
9258 \fi%
9259 % \end{macrocode}
9260 % We set all the usual interline penalties to zero and then immediately
9261 % call \protect\cs{endgraf} to end the paragraph; this ensures that there will
9262 % be no large interline penalties to prevent us from slicing the
9263 % paragraph into pieces. These penalties revert to the values
9264 % that you set when the group for the \protect\cs{vbox} ends. Then we call
9265 % \protect\cs{do@line} to slice a line off the top of the
9266 % paragraph, add a line number and footnotes, and restore it to the page;
9267 % we keep doing this until there are not any more lines left.
9268 % \begin{macrocode}
9269 \l@dzeropenalties%
9270 \@at@end@every@pend%
9271 \endgraf\global\num@lines=\prevgraf\egroup%
9272 \global\par@line=0%
9273 \get@firsthalf@antilabe@wd%
9274 % \end{macrocode}
9275 % Output the lines.
9276 % \begin{macrocode}
9277 \loop\ifvbox\raw@text%
9278 \do@line%
9279 \repeat%
9280 % \end{macrocode}
9281 % Deal with any leftover notes, and then end the group that was begun
9282 % in the \protect\cs{pstart}.
9283 % \begin{macrocode}
9284 \flush@notes%
9285 \endgroup%
9286 \ignorespaces%
9287 % \end{macrocode}
9288 % Increase pstart counter.
9289 % \begin{macrocode}
9290 \ifnumberpstart%
9291 \global\pstartnumtrue%
9292 \fi%
9293 \addtocounter{pstart}{1}%
9294 \ifcontinuousnumberingwithcolumns%
9295 \addtocounter{pstartL}{1}%
9296 \addtocounter{pstartR}{1}%
9297 \fi%
9298 % \end{macrocode}
9299 % Print the optional arguments of \protect\cs{pend} or the content printed after every \protect\cs{pend}
9300 % \begin{macrocode}
9301 \normal@pars%
9302 \ifboolexpr{%
9303 test {\ifstrempty{#1}}%
9304 and test {\ifstrempty{#2}}%
9305 }%
9306 {\at@every@pend}%
9307 {%
9308 \ifstrempty{#1}{}{\noindent#1}%
9309 \ifstrempty{#2}{}{#2}%
9310 }%
9311 % \end{macrocode}
9312 % Restore standard \enquote{nobreak} and \enquote{autopar} settings.
9313 % Normally, \cs{if@nobreak} is true only immediately after a sectioning command (see latex.ltx file). As a \cs{pstart}\ldots\ \cs{pend} structure can't contain any sectioning command, we set \cs{if@nobreak} to false.
9314 % \begin{macrocode}
9315 \@nobreakfalse%
9316 \ifautopar%
9317 \autopar%
9318 \fi%
9319 % \end{macrocode}
9320 % At the very end, we check if the lineation is made by \cs{pstart}. In this case, we reset the line number, using \cs{setlinenum}, as we are, technically, already out of \cs{pstart}\cs{pend} structure.
9321 % \begin{macrocode}
9322 \ifbypstart@%
9323 \begingroup%
9324 \unless\ifinstanza%
9325 \let\leavevmode\relax%
9326 \setlinenum{0}%
9327 \fi%
9328 \endgroup%
9329 \resetprevline@%
9330 \fi%
9331 }
9332 % \end{macrocode}
9333 % \end{macro}
9334 % Here, two macros to insert content after every \protect\cs{pend}, between numbered line.
9335 % \protect\cs{AtEveryPend} is the user macro, \protect\cs{at@every@pend} is macro set by it.
9336 %
9337 % \begin{macro}{\AtEveryPend}
9338 % \begin{macro}{\at@every@pend}
9339 % \begin{macro}{\ifat@every@pend@star@}
9340 % \begin{macrocode}
9341
9342
9343 \newif\ifat@every@pend@star@%
9344 \newcommand{\AtEveryPend}[1]{%
9345 \ifstrempty{#1}%
9346 {\gdef\at@every@pend{}}%
9347 {\gdef\at@every@pend{\noindent#1}}%
9348 \global\at@every@pend@star@false%
9349 }%
9350 \WithSuffix\newcommand\AtEveryPend*[1]{%
9351 \ifstrempty{#1}%
9352 {\gdef\at@every@pend{}}%
9353 {\gdef\at@every@pend{#1}}%
9354 \global\at@every@pend@star@true%
9355 }%
9356 \xdef\at@every@pend{}%
9357
9358 % \end{macrocode}
9359 % \end{macro}
9360 % \end{macro}
9361 % \end{macro}
9362 %
9363 % \begin{macro}{\AtEndEveryPend}
9364 % Here a macro to insert automatically any content at the end of \cs{pend}, in numbered lines.
9365 % \begin{macrocode}
9366 \newcommand{\AtEndEveryPend}[1]{%
9367 \ifstrempty{#1}%
9368 {\xdef\@at@end@every@pend{}}%
9369 {\gdef\@at@end@every@pend{#1}}%
9370 }%
9371 \def\@at@end@every@pend{}%
9372 % \end{macrocode}
9373 % \end{macro}
9374 % \begin{macro}{\l@dzeropenalties}
9375 % A macro to zero penalties for \protect\cs{pend} or \protect\cs{pstart}.
9376 % \changes{v0.7.0}{2005/02/22}{Added \protect\cs{l@dzeropenalties}}
9377 % \begin{macrocode}
9378 \newcommand*{\l@dzeropenalties}{%
9379 \brokenpenalty \z@ \clubpenalty \z@
9380 \displaywidowpenalty \z@ \interlinepenalty \z@ \predisplaypenalty \z@
9381 \postdisplaypenalty \z@ \widowpenalty \z@}
9382
9383 % \end{macrocode}
9384 % \end{macro}
9385 %
9386 % \begin{macro}{\autopar}
9387 % In most cases it is only an annoyance to have to label the paragraphs
9388 % to be numbered with \protect\cs{pstart} and \protect\cs{pend}. \protect\cs{autopar} will
9389 % do that automatically, allowing you to start a paragraph with its
9390 % first word and no other preliminaries, and to end it with a blank line
9391 % or a \protect\cs{par} command. The command should be issued within a
9392 % group, after \protect\cs{beginnumbering} has been used to start the
9393 % numbering; all paragraphs within the group will be affected.
9394 %
9395 % A few situations can cause problems. One is a paragraph that begins with
9396 % a begin-group character or command: \protect\cs{pstart} will not get invoked
9397 % until after such a group beginning is processed; as a result the
9398 % character that ends the group will be mistaken for the end of the
9399 % \protect\cs{vbox} that \protect\cs{pstart} creates, and the rest of the paragraph
9400 % will not be numbered. Such paragraphs need to be started explicitly
9401 % using \protect\cs{indent}, \protect\cs{noindent}, or \protect\cs{leavevmode}\,---\,or \protect\cs{pstart}, since
9402 % you can still include your own \protect\cs{pstart} and \protect\cs{pend}
9403 % commands even with \protect\cs{autopar} on.
9404 %
9405 % Prematurely ending the group within which \protect\cs{autopar} is in
9406 % effect will cause a similar problem. You must either leave a
9407 % blank line or use \protect\cs{par} to end the last paragraph before
9408 % you end the group.
9409 %
9410 % The functioning of this macro is more tricky than the usual
9411 % \protect\cs{everypar}: we do not want anything to go onto the vertical
9412 % list at all, so we have to end the paragraph, erase any evidence
9413 % that it ever existed, and start it again using \protect\cs{pstart}.
9414 % We remove the paragraph-indentation box using \protect\cs{lastbox} and
9415 % save the width, and then skip backwards over the \protect\cs{parskip}
9416 % that has been added for this paragraph. Then we start again with
9417 % \protect\cs{pstart}, restoring the indentation that we saved, and
9418 % locally change \protect\cs{par} so that it will do our \protect\cs{pend} for us.
9419 %
9420 % The boolean \cs{ifautopar} is set to TRUE while \cs{autopar} is enabled, and the \cs{ifby@autopar} is set to TRUE at each \cs{pstart} automatically called by the \cs{autopar} feature. A manual \cs{pstart} will have a \cs{ifby@autopar} set to FALSE.
9421 %
9422 % \begin{macrocode}
9423 \newif\ifautopar
9424 \newif\ifby@autopar%
9425 \newcommand*{\autopar}{
9426 \ifledRcol
9427 \ifnumberingR \else
9428 \led@err@AutoparNotNumbered
9429 \beginnumberingR
9430 \fi
9431 \else
9432 \ifnumbering \else
9433 \led@err@AutoparNotNumbered
9434 \beginnumbering
9435 \fi
9436 \fi
9437 \autopartrue
9438 \everypar{\setbox0=\lastbox
9439 \endgraf \vskip-\parskip
9440 \global\by@autopartrue%
9441 \pstart \noindent \kern\wd0%
9442 \ifnumberpstart%
9443 \ifinstanza\else%
9444 \thepstart%
9445 \fi%
9446 \fi%
9447 \let\par=\pend}%
9448 \ignorespaces}
9449 % \end{macrocode}
9450 % \end{macro}
9451 %
9452 % \begin{macro}{\normal@pars}
9453 % We also define a macro which we can rely on to turn off the
9454 % \protect\cs{autopar} definitions at various important places, if they
9455 % are in force. We will want to do this within a footnotes, for
9456 % example.
9457 % \begin{macrocode}
9458 \newcommand*{\normal@pars}{\everypar{}\let\par\endgraf}
9459
9460 % \end{macrocode}
9461 % \end{macro}
9462 %
9463 % \begin{macro}{\ifautopar@pause}
9464 % We define a boolean test switched to true at the beginning
9465 % of the \protect\cs{pausenumbering} command if the autopar is enabled.
9466 % This boolean will be tested at the beginning of \protect\cs{resumenumbering}
9467 % to continue the autopar if neeeded.
9468 % \begin{macrocode}
9469 \newif\ifautopar@pause
9470 % \end{macrocode}
9471 % \end{macro}
9472 % \subsection{Processing one line}
9473 %
9474 % \subsubsection{General process}
9475 % \begin{macro}{\do@line}\label{doline}
9476 % \begin{macro}{\l@dunhbox@line}
9477 % The \protect\cs{do@line} macro is called by \protect\cs{pend} to
9478 % do all the processing for a single line of text.
9479 % \changes{v1.6.1}{2013/10/27}{Move the call to \protect\cs{inserthangingsymbol} to allow use \protect\cs{hfill} inside.}
9480 % \changes{v1.12.2}{2014/08/07}{Fix a bug with critical notes at the tops of pages (added by v12.0.0)}
9481 % The \cs{l@dunhbox@line} macro only \cs{unhbox}es one line, but packages like \cs{microtype} can override it as required.
9482 %
9483 % \begin{macrocode}
9484 \newcommand*{\l@dunhbox@line}[1]{\unhbox #1}
9485 \newcommand*{\do@line}{%
9486 {\vbadness=10000
9487 \splittopskip=\z@
9488 \do@linehook
9489 \l@demptyd@ta
9490 \global\setbox\one@line=\vsplit\raw@text to\baselineskip}%
9491 \unvbox\one@line \global\setbox\one@line=\lastbox
9492 \getline@num
9493 \IfStrEq{\led@pb@setting}{before}{\led@check@pb\led@check@nopb}{}
9494 \ifnum\@lock>\@ne
9495 \inserthangingsymboltrue
9496 \else
9497 \inserthangingsymbolfalse
9498 \fi
9499 \check@pb@in@verse
9500 \ifl@dhidenumber%
9501 \global\l@dhidenumberfalse%
9502 \f@x@l@cks%
9503 \else%
9504 \affixline@num%
9505 \fi%
9506 % \end{macrocode}
9507 % \changes{v1.12.0}{2014/08/05}{\protect\cs{do@line} is split in more little commands.}
9508 % Depending weither a sectioning command is called at this pstart or not
9509 % we print sectioning command or normal line,
9510 % \begin{macrocode}
9511 \xifinlist{\the\pstarts@typeset@L}{\eled@sections@@}%
9512 {\print@eledsection}%
9513 {\print@line}%
9514 \IfStrEq{\led@pb@setting}{after}{\led@check@pb\led@check@nopb}{}
9515 }%
9516 % \end{macrocode}
9517 % \end{macro}
9518 % \end{macro}
9519 %
9520 % \subsubsection{Process for \enquote{normal} line}
9521 % \begin{macro}{\print@line}
9522 % \changes{v1.13.1}{2014/09/25}{Coming back of \protect\cs{add@penalties}, mistakenly deleted in version 0.17.}
9523 % \changes{v1.18.0}{2015/02/23}{Compatibility with \LuaLaTeX\ RTL languages.}
9524 % \protect\cs{print@line} is for normal line, i. e line without sectioning command.
9525 % \begin{macrocode}
9526 \def\print@line{
9527 % \end{macrocode}
9528 % Insert the pstart number inside, if we are in the first line of a pstart.
9529 % \begin{macrocode}
9530 \affixpstart@num%
9531 % \end{macrocode}
9532 % The line will be boxed, to have the good width.
9533 % \begin{macrocode}
9534 \hb@xt@ \linewidth{%
9535 % \end{macrocode}
9536 % User hooks.
9537 % \begin{macrocode}
9538 \do@insidelinehook%
9539 \csuse{insidethis@\the\absline@num @\the\section@num}%
9540 \global\csundef{insidethis@\the\absline@num @\the\section@num}%
9541 % \end{macrocode}
9542 % Left line number
9543 % \begin{macrocode}
9544 \l@dld@ta%
9545 % \end{macrocode}
9546 % Prepare text to be inserted before notes.
9547 % \begin{macrocode}
9548 \if@firstlineofpage%
9549 \set@Xtxtbeforenotes%
9550 \set@txtbeforenotesX%
9551 \global\@firstlineofpagefalse%
9552 \fi%
9553 % \end{macrocode}
9554 % Insert footnotes made of manuscripts data and critical footnotes.
9555 % \begin{macrocode}
9556 \ifdefstring{\ms@data@position}{msdata-regular}{%
9557 \insert@msdata%
9558 \add@inserts%
9559 \add@Xgroupbyline%
9560 }{%
9561 \add@inserts%
9562 \add@Xgroupbyline%
9563 \insert@msdata%
9564 }%
9565 % \end{macrocode}
9566 % Insert marginal notes.
9567 % \begin{macrocode}
9568 \affixside@note%
9569 % \end{macrocode}
9570 % Print left notes.
9571 % \begin{macrocode}
9572 \l@dlsn@te
9573 % \end{macrocode}
9574 % Boxes the line, writes information about new line in the numbered file.
9575 % \begin{macrocode}
9576 {\ledllfill\hb@xt@ \wd\one@line{%
9577 \new@line%
9578 % \end{macrocode}
9579 % If we use the \option{continuousnumberingwithcolumns}, we increase right line number.
9580 % \begin{macrocode}
9581 \continuousnumberingwithcolumns@sync@linenumber@singletext%
9582 % \end{macrocode}
9583 % If we use \LuaLaTeX\, then restore the direction.
9584 % \begin{macrocode}
9585 \ifluatex%
9586 \textdir\l@luatextextdir@L%
9587 \fi%
9588 % \end{macrocode}
9589 % Insert, if needed, the hanging symbol.
9590 % \begin{macrocode}
9591 \inserthangingsymbol%
9592 % \end{macrocode}
9593 % And so, print the line.
9594 % \begin{macrocode}
9595 \l@dunhbox@line{\one@line}}%
9596 % \end{macrocode}
9597 % Right line number
9598 % \begin{macrocode}
9599 \ledrlfill\l@drd@ta%
9600 % \end{macrocode}
9601 % Print right notes.
9602 % \begin{macrocode}
9603 \l@drsn@te%
9604 }}%
9605 % \end{macrocode}
9606 % And reinsert penalties (for page breaking)...
9607 % \begin{macrocode}
9608 \add@penalties%
9609 }
9610 % \end{macrocode}
9611 % \end{macro}
9612 % \subsubsection{Process for line containing \protect\cs{eledsection} command}
9613 % \begin{macro}{\print@eledsection}
9614 % \protect\cs{print@eledsection} to print sectioning command with line number.
9615 % It sets the correct spacing, depending whether a sectioning command was called at previous \protect\cs{pstart}, calls the sectioning command, prints the normal line outside of the paper, to be able to have critical footnotes.
9616 % Because of how this prints, a vertical spacing correction is added.
9617 % \begin{macrocode}
9618 \def\print@eledsection{%
9619 \disable@edindex%
9620 \disable@edlabel%
9621 \if@firstlineofpage%
9622 \set@Xtxtbeforenotes%
9623 \set@txtbeforenotesX%
9624 \global\@firstlineofpagefalse%
9625 \fi%
9626 \ifdefstring{\ms@data@position}{msdata-regular}{%
9627 \insert@msdata%
9628 \add@inserts%
9629 \add@Xgroupbyline%
9630 }{%
9631 \add@inserts%
9632 \add@Xgroupbyline%
9633 \insert@msdata%
9634 }%
9635 \affixside@note%
9636 \numdef{\temp@}{\pstarts@typeset@L-1}%
9637 \xifinlist{\temp@}{\eled@sections@@}{\@nobreaktrue}{\@nobreakfalse}%
9638 \@eled@sectioningtrue%
9639 \csuse{eled@sectioning@\the\pstarts@typeset@L}%
9640 \@eled@sectioningfalse%
9641 \global\csundef{eled@sectioning@\the\pstarts@typeset@L}%
9642 \if@RTL%
9643 \hspace{-3\paperwidth}%
9644 {\hbox{\l@dunhbox@line{\one@line}} \new@line}%
9645 \else%
9646 \hspace{3\paperwidth}%
9647 {\new@line \hbox{\l@dunhbox@line{\one@line}}}%
9648 \fi%
9649 \vskip-\baselineskip%
9650 \continuousnumberingwithcolumns@sync@linenumber@singletext%
9651 \restore@edindex%
9652 \restore@edlabel%
9653 }
9654 % \end{macrocode}
9655 % \end{macro}
9656 % \subsubsection{Hooks}
9657 % \begin{macro}{\do@linehook}
9658 % \begin{macro}{\do@insidelinehook}
9659 % Two hooks into \protect\cs{do@line}. The first is called at the beginning of \protect\cs{do@line}, the second is called in the line box.
9660 % The second can, for example, have a \protect\cs{markboth} command inside, the first ca not.
9661 % \changes{v0.7.0}{2005/02/18}{Added \protect\cs{do@linehook} for use in \protect\cs{do@line}}
9662 % \changes{v1.5.0}{2013/07/11}{Added \protect\cs{do@insidelinehook} for use in \protect\cs{do@line}}
9663 % \begin{macrocode}
9664 \newcommand*{\do@linehook}{}
9665 \newcommand*{\do@insidelinehook}{}
9666 % \end{macrocode}
9667 % \end{macro}
9668 % \end{macro}
9669 %
9670 % \begin{macro}{\dolinehook}
9671 % \begin{macro}{\doinsidelinehook}
9672 % These hight level commands just redefine the low level commands.
9673 % They have to be used be user, without \protect\cs{makeatletter}.
9674 % \changes{v1.12.5}{2014/08/31}{Added \protect\cs{dolinehook} and \protect\cs{doinsidelinehook}}
9675 % \begin{macrocode}
9676 \newcommand*{\dolinehook}[1]{\gdef\do@linehook{#1}}%
9677 \newcommand*{\doinsidelinehook}[1]{\gdef\do@insidelinehook{#1}}%
9678
9679 % \end{macrocode}
9680 % \end{macro}
9681 % \end{macro}
9682 % \begin{macro}{\doinsidethislinehook}
9683 % \begin{macro}{\@insidethisline}
9684 % The \cs{doinsidethislinehook} can be called directly in the main flood of a text.
9685 % It will define a hook executed at a specific line, determined by the position of the command in the flood of the text.
9686 % \begin{macrocode}
9687 \newcommand{\doinsidethislinehook}[1]{%
9688 \leavevmode%In case it begins with a \pstart, ensure the \@insidethisline is written after \@nl
9689 \ifledRcol%
9690 \write\linenum@outR{\string\@insidethisline[\unexpanded{#1}]}%
9691 \else%
9692 \write\linenum@out{\string\@insidethisline[\unexpanded{#1}]}%
9693 \fi%
9694 }%
9695 % \end{macrocode}
9696 % The auxiliary files command just store the information to be executed
9697 % when typesseting the specific line.
9698 % \begin{macrocode}
9699 \newcommand{\@insidethisline}[1]{%
9700 \ifledRcol%
9701 \csgappto{insidethisR@\the\absline@numR @\the\section@numR}{#1}%
9702 \else%
9703 \csgappto{insidethis@\the\absline@num @\the\section@num}{#1}%
9704 \fi%
9705 }%
9706 % \end{macrocode}
9707 % \end{macro}
9708 % \end{macro}
9709 % \subsubsection{Sidenotes and marginal line number initialization}
9710 % \begin{macro}{\l@demptyd@ta}
9711 % \begin{macro}{\l@dld@ta}
9712 % \begin{macro}{\l@drd@ta}
9713 % \begin{macro}{\l@dcsnotetext}
9714 % \begin{macro}{\l@dcsnotetext@l}
9715 % \begin{macro}{\l@dcsnotetext@r}
9716 % Nulls the \protect\cs{...d@ta}, which may later hold line numbers.
9717 % Similarly for \protect\cs{l@dcsnotetext}, \protect\cs{l@dcsnotetext@l}, \protect\cs{l@dcsnotetext@r} for the texts of the sidenotes, left and right notes.
9718 % \changes{v0.7.0}{2005/02/18}{Added \protect\cs{l@demptyd@ta}}
9719 % \begin{macrocode}
9720 \newcommand*{\l@demptyd@ta}{%
9721 \gdef\l@dld@ta{}%
9722 \gdef\l@drd@ta{}%
9723 \gdef\l@dcsnotetext@l{}%
9724 \gdef\l@dcsnotetext@r{}%
9725 \gdef\l@dcsnotetext{}}
9726
9727 % \end{macrocode}
9728 % \end{macro}
9729 % \end{macro}
9730 % \end{macro}
9731 % \end{macro}
9732 % \end{macro}
9733 % \end{macro}
9734 %
9735 % \begin{macro}{\l@dlsn@te}
9736 % \begin{macro}{\l@drsn@te}
9737 % Zero width boxes of the left and right sidenotes, together with their kerns, and, eventually, with additional space if we are in parallel columns typesetting.
9738 % \changes{v0.7.0}{2005/02/18}{Added \protect\cs{l@dlsn@te} and \protect\cs{l@drsn@te}
9739 % for use in \protect\cs{do@line}}
9740 % \begin{macrocode}
9741 \newcommand{\l@dlsn@te}{%
9742 \ifboolexpr{%
9743 bool {l@dprintingcolumns}%
9744 and bool {ledRcol@}%
9745 }{% If we are on a right column
9746 \@tempdima=\@morespace@leftnote@rightcolumn%
9747 }{%
9748 \@tempdima=\z@%
9749 }%
9750 \hb@xt@ \z@{\hss\box\l@dlp@rbox\kern\ledlsnotesep\hskip\@tempdima}%
9751 }%
9752 \newcommand{\l@drsn@te}{%
9753 \ifboolexpr{%
9754 bool {l@dprintingcolumns}%
9755 and not bool {ledRcol@}%
9756 }{% If we are on a left column
9757 \@tempdima=\@morespace@rightnote@leftcolumn%
9758 }{%
9759 \@tempdima=\z@%
9760 }%
9761 \hb@xt@ \z@{\hskip\@tempdima\kern\ledrsnotesep\box\l@drp@rbox\hss}%
9762 }%
9763
9764 % \end{macrocode}
9765 % \end{macro}
9766 % \end{macro}
9767 %
9768 %
9769 % \begin{macro}{\ledllfill}
9770 % \begin{macro}{\ledrlfill}
9771 % These macros are called at the left (\protect\cs{ledllfill}) and the right
9772 % (\protect\cs{ledllfill}) of each numbered line.
9773 % \begin{macrocode}
9774 \newcommand*{\ledllfill}{\unless\if@RTL\hfil\fi}%
9775 \newcommand*{\ledrlfill}{\if@RTL\hfil\fi}%
9776
9777 % \end{macrocode}
9778 % \end{macro}
9779 % \end{macro}
9780 %
9781 % \section{Line and page number computation}
9782 %
9783 % \begin{macro}{\getline@num}
9784 % The \protect\cs{getline@num} macro
9785 % determines the page and line numbers for the line we are about to
9786 % send to the vertical list.
9787 % \begin{macrocode}
9788 \newcommand*{\getline@num}{%
9789 \global\advance\absline@num \@ne%
9790 \do@actions
9791 \do@ballast
9792 \ifnumberline
9793 \ifsublines@
9794 \ifnum\sub@lock<\tw@
9795 \global\advance\subline@num \@ne
9796 \fi
9797 \else
9798 \ifnum\@lock<\tw@
9799 \global\advance\line@num \@ne
9800 \global\subline@num \z@
9801 \fi
9802 \fi
9803 \fi
9804 }
9805 % \end{macrocode}
9806 % \end{macro}
9807 %
9808 % \begin{macro}{\do@ballast}
9809 % \phantomsection\label{do@ballast}\relax
9810 % The real work in the macro above is done in \protect\cs{do@actions}, but
9811 % before we plunge into that, let's get \protect\cs{do@ballast} out of the
9812 % way. This macro looks to see if there is an action to be
9813 % performed on the \emph{next} line, and if it is going to be a
9814 % page break action, \protect\cs{do@ballast} decreases the count \protect\cs{ballast@count}
9815 % counter
9816 % by the amount of \verb"ballast". This means, in practice, that when
9817 % \protect\cs{add@penalties} assigns penalties at this point, \TeX\ will be
9818 % given extra encouragement to break the page here (see
9819 % \reff{add@penalties}).
9820 %
9821 % \begin{macro}{\ballast@count}
9822 % \begin{macro}{\c@ballast}
9823 % First we set up the required counters; they are initially
9824 % set to zero, and will remain so unless you type
9825 % \verb"\setcounter{ballast}"\marg{some figure} in your document.
9826 % \begin{macrocode}
9827 \newcount\ballast@count
9828 \newcounter{ballast}
9829 \setcounter{ballast}{0}
9830 % \end{macrocode}
9831 % \end{macro}
9832 % \end{macro}
9833 % And here is \protect\cs{do@ballast} itself. It advances \protect\cs{absline@num}
9834 % within the protection of a group to make its check for what
9835 % happens on the next line.
9836 % \begin{macrocode}
9837 \newcommand*{\do@ballast}{\global\ballast@count \z@
9838 \begingroup
9839 \advance\absline@num \@ne
9840 \ifnum\next@actionline=\absline@num
9841 \ifnum\next@action>-1001\relax
9842 \global\advance\ballast@count by -\c@ballast
9843 \fi
9844 \fi
9845 \endgroup}
9846 % \end{macrocode}
9847 % \end{macro}
9848 %
9849 % \begin{macro}{\do@actions}
9850 % \begin{macro}{\do@actions@next}
9851 %
9852 % The \protect\cs{do@actions} macro
9853 % looks at the list of actions to take at particular absolute line
9854 % numbers, and does everything that is specified for the current line.
9855 %
9856 % It may call itself recursively, and to do this efficiently (using
9857 % \TeX's optimization for tail recursion), we define a control-sequence
9858 % called \protect\cs{do@actions@next} that is always the last thing that
9859 % \protect\cs{do@actions} does. If there could be more actions to process for
9860 % this line, \protect\cs{do@actions@next} is set equal to \protect\cs{do@actions};
9861 % otherwise it is just \protect\cs{relax}.
9862 % \changes{v0.7.0}{2005/02/22}{Added number skipping to \protect\cs{do@actions}}
9863 % \begin{macrocode}
9864 \newcommand*{\do@actions}{%
9865 \global\let\do@actions@next=\relax
9866 \ifnum\absline@num<\next@actionline\else
9867 % \end{macrocode}
9868 %
9869 % First, page number changes, which will generally be the most common
9870 % actions. If we are restarting lineation on each page, this is where it
9871 % happens.
9872 % \begin{macrocode}
9873 \ifnum\next@action>-1001
9874 \global\page@num=\next@action
9875 \ifresumenumbering@start%
9876 \setbox0=\hbox{}%Required to get the correct page number, when the \resumenumbering is just after a \newpage
9877 \ifnum\pausenumbering@page@num<\page@num%
9878 \global\resumenumbering@startfalse%
9879 \fi%
9880 \fi%
9881 \ifboolexpr{%
9882 bool{resumenumbering@start}%
9883 and test {\ifdimgreater{\pagedepth}{\z@}}%
9884 }%
9885 {}%
9886 {\global\@firstlineofpagetrue}%
9887 \ifcsdef{reset@line\the\absline@num @\the\section@num}%
9888 {%
9889 \global\line@num=\z@%
9890 \global\subline@num=\z@%
9891 \resetprevline@%
9892 }%
9893 {}%
9894 \global\resumenumbering@startfalse%
9895 \add@msdata@firstlineofpage%
9896 % \end{macrocode}
9897 %
9898 % Next, we handle
9899 % commands that change the line-number values. (We subtract $5001$ rather
9900 % than $5000$ here because the line number is going to be incremented
9901 % automatically in \protect\cs{getline@num}.)
9902 % \begin{macrocode}
9903 \else
9904 \ifnum\next@action<-4999
9905 \@l@dtempcnta=-\next@action
9906 \advance\@l@dtempcnta by -5001
9907 \ifsublines@
9908 \global\subline@num=\@l@dtempcnta
9909 \else
9910 \global\line@num=\@l@dtempcnta
9911 \fi
9912 % \end{macrocode}
9913 %
9914 % We rescale the value in
9915 % \protect\cs{@l@dtempcnta} so that we can use a case statement.
9916 % \begin{macrocode}
9917 \else
9918 \@l@dtempcnta=-\next@action
9919 \advance\@l@dtempcnta by -1000
9920 \do@actions@fixedcode
9921 \fi
9922 \fi
9923 % \end{macrocode}
9924 %
9925 % Now we get information about the next action off the list,
9926 % and then set \protect\cs{do@actions@next} so that we will
9927 % call ourself recursively: the next action might also be for this
9928 % line.
9929 %
9930 % There is no warning if we find \protect\cs{actionlines@list} empty,
9931 % since that will always happen near the end of the section.
9932 %
9933 % \begin{macrocode}
9934 \ifx\actionlines@list\empty
9935 \gdef\next@actionline{1000000}%
9936 \else
9937 \gl@p\actionlines@list\to\next@actionline
9938 \gl@p\actions@list\to\next@action
9939 \global\let\do@actions@next=\do@actions
9940 \fi
9941 \fi
9942 % \end{macrocode}
9943 %
9944 % Make the recursive call, if necessary.
9945 %
9946 % \begin{macrocode}
9947 \do@actions@next}
9948
9949 % \end{macrocode}
9950 % \end{macro}
9951 % \end{macro}
9952 % \begin{macro}{\do@actions@fixedcode}
9953 % This macro handles the fixed codes for \protect\cs{do@actions}. It is
9954 % one big case statement.
9955 % \changes{v0.7.0}{2005/02/24}{Added \protect\cs{do@actions@fixedcode}}
9956 % \changes{v2.11.0}{2016/06/02}{Add action 1010}
9957 % \begin{macrocode}
9958 \newcommand*{\do@actions@fixedcode}{%
9959 \ifcase\@l@dtempcnta
9960 \or% % 1001 = starting sublineation
9961 \global\sublines@true
9962 \or% % 1002 = ending sublineation
9963 \global\sublines@false
9964 \or% % 1003 = starting locking number
9965 \ifnum\@lock=\thr@@% If there was a \endlock (implicit or explicit) just before
9966 \global\@lock=\tw@%
9967 \else%
9968 \global\@lock=\@ne%
9969 \fi%
9970 \or% % 1004 = ending locking number
9971 \ifnum\@lock=\tw@
9972 \global\@lock=\thr@@
9973 \else
9974 \global\@lock=\z@
9975 \fi
9976 \or% % 1005 = starting locking subnumber
9977 \global\sub@lock=\@ne
9978 \or% % 1006 = ending locking subnumber
9979 \ifnum\sub@lock=\tw@
9980 \global\sub@lock=\thr@@
9981 \else
9982 \global\sub@lock=\z@
9983 \fi
9984 \or% % 1007 = skipping numbering
9985 \l@dskipnumbertrue
9986 \or% % 1008 = skipping numbering in stanza
9987 \l@dskipversenumbertrue%
9988 \or% % 1009 = hiding number
9989 \l@dhidenumbertrue
9990 \or% % 1010 = inserting msdata
9991 \add@msdata%
9992 \else
9993 \led@warn@BadAction
9994 \fi}
9995
9996
9997 % \end{macrocode}
9998 % \end{macro}
9999 % \subsection{Continuous line numbering between parallel typesetting and normal typesetting}
10000 % \begin{macro}{\continuousnumberingwithcolumns@sync@linenumber@singletext}
10001 % The \option{continuousnumberingwithcolumns}
10002 % option allows to alternate between single text and two parallel texts, keeping the same line numbers when switching from one layout to the other.
10003 % The lines counter for the text in a single column and for the text in the left column in parallel typesetting is the same.
10004 % But the lines counter for the text in the same column is the not the same.
10005 %
10006 % When typesetting single column text, if the option is enabled, we need to \enquote{simulate} typesetting right line, in order to keep the two counters synchronized.
10007 % That is the aim of the \\
10008 % \cs{continuousnumberingwithcolumns@sync@linenumber@singletext}\\
10009 % macro.
10010 % \begin{macrocode}
10011 \newcommand{\continuousnumberingwithcolumns@sync@linenumber@singletext}{%
10012 \ifcontinuousnumberingwithcolumns%
10013 \unless\ifafterendnumberingR%
10014 \new@lineR%
10015 \xappto\next@line@list@stuffR{%
10016 \unexpanded{\global\line@numR=}\the\line@num%
10017 }%
10018 \fi%
10019 \fi%
10020 }%
10021 % \end{macrocode}
10022 % \end{macro}
10023 % \section{Line number annotation}
10024 % The \cs{linenumannotation} allows users to add manual annotations to line numbers, for example to refer to line numbers from an older edition.
10025 %
10026 % That implies that annotations be added
10027 % \begin{itemize}
10028 % \item in marginal line numbers. This feature is implemented by associating annotations with the absolute line numbers when reading the auxiliary numbered files (\verb+.1+, \verb+.2+ etc.).
10029 % \item in critical footnotes. This feature is implemented by associating start / end line number annotations with each \cs{edtext} when reading the auxiliary numbered files.
10030 % \item to crossref commands which refer to line numbers (to be completed when I will have resolved this issue).
10031 % \end{itemize}
10032 % \begin{macro}{\linenumannotation}
10033 % \begin{macro}{\resetlinenumannotation}
10034 % First, the user-level commands, which only write commands to the numbered files, storing the annotation.
10035 % \begin{macrocode}
10036 \newcommand{\linenumannotation}[1]{%
10037 \leavevmode%In case it begins with a \pstart, ensure the \@annot is written after \@nl
10038 \ifledRcol%
10039 \write\linenum@outR{\string\@annot[#1]}%
10040 \else%
10041 \write\linenum@out{\string\@annot[#1]}%
10042 \fi%
10043 }%
10044
10045 \newcommand{\resetlinenumannotation}[0]{%
10046 \leavevmode%In case it begins with a \pstart, ensure the \@resetannot is written after \@nl
10047 \ifledRcol%
10048 \write\linenum@outR{\string\@resetannot}%
10049 \else%
10050 \write\linenum@out{\string\@resetannot}%
10051 \fi%
10052 }%
10053
10054 % \end{macrocode}
10055 % \end{macro}
10056 % \end{macro}
10057 % \begin{macro}{\Xlinenumannotationposition@side}
10058 % The \cs{Xlinenumannotationposition@side} macro, to determine the position of line number annotations in lines printed in the side, relative to the line number position.
10059 % The default value is \enquote{after}, but it can be changed to \enquote{before}, using the \cs{Xlinenumannotationposition} macro.
10060 % \begin{macrocode}
10061 \def\Xlinenumannotationposition@side{after}%
10062 % \end{macrocode}
10063 % \end{macro}
10064 % \begin{macro}{\Xwraplinenumannotation@ref}
10065 % \begin{macro}{\Xwraplinenumannotation@side}
10066 % The \cs{Xwraplinenumannotation@ref} macro is applied to line annotations in crossref. The \cs{Xwraplinenumannotation@side} macro is applied to line annotation in sides.
10067 % They must be modified by users using \cs{Xwraplinenumannotation}.
10068 % By default, they call \cs{textsuperscript}.
10069 %
10070 % We also define toggle \verb+Xnoidenticallinenumannotation@ref+ and \verb+Xnoidenticallinenumannotation@ref+
10071 % \begin{macrocode}
10072 \def\Xwraplinenumannotation@ref{\textsuperscript}%
10073 \def\Xwraplinenumannotation@side{\textsuperscript}%
10074 \newtoggle{Xnoidenticallinenumannotation@ref}%
10075 \newtoggle{Xnoidenticallinenumannotation@side}%
10076 % \end{macrocode}
10077 % \end{macro}
10078 % \end{macro}
10079 % \begin{macro}{\iflinenumannotationotherside}
10080 % The \cs{iflinenumannotationotherside} boolean allows to print the annotation on the side opposite the line number.
10081 % \begin{macrocode}
10082 \newif\iflinenumannotationotherside%
10083 % \end{macrocode}
10084 % \end{macro}
10085 % \begin{macro}{\@annot}
10086 % \begin{macro}{\store@annot@to@absline}
10087 % Then, the numbered files command \cs{@annot}, which
10088 % \begin{itemize}
10089 % \item associates the annotation to the absolute lines number.
10090 % \item stores the current annotation in a macro to be used by the \cs{@ref@reg} macro, which manages all things related to \cs{edtext} in numbered files. As we don't want to store it multiple times in the event of nested \cs{edtext}, we use an auxiliary macro, \cs{store@annot@to@absline}, which is set to \cs{@gobble} when we parse nested \cs{edtext} in numbered auxiliary files.
10091 % \end{itemize}
10092 % \begin{macrocode}
10093 \newcommand{\@annot}[1]{%
10094 \store@annot@to@absline{#1}%
10095 \def\current@annot{#1}%
10096 }%
10097 \newcommand{\store@annot@to@absline}[1]{%
10098 \ifledRcol%
10099 \ifcsdef{annotR@\the\absline@numR @\the\section@numR}{%
10100 \csgappto{annotR@\the\absline@numR @\the\section@numR}{\@linenumannotationsep#1}%
10101 }{%
10102 \csgdef{annotR@\the\absline@numR @\the\section@numR}{#1}%
10103 }%
10104 \else%
10105 \ifcsdef{annot@\the\absline@num @\the\section@num}{%
10106 \csgappto{annot@\the\absline@num @\the\section@num}{\@linenumannotationsep#1}%
10107 }{%
10108 \csgdef{annot@\the\absline@num @\the\section@num}{#1}%
10109 }%
10110 \fi%
10111 }%
10112 % \end{macrocode}
10113 % \end{macro}
10114 % \end{macro}
10115 % \begin{macro}{\current@annot}
10116 % By default, there is no annotation to a line number, so we store an empty \cs{current@annot}
10117 % \begin{macrocode}
10118 \let\current@annot=\empty%
10119 % \end{macrocode}
10120 % \end{macro}
10121 % \begin{macro}{\reset@current@annot}
10122 % \begin{macro}{\@resetannot}
10123 % \cs{reset@current@annot} is called at each \cs{@nl} in numbered auxiliary files.
10124 % It resets the annotation of line numbers at each line.
10125 %
10126 % The \cs{@resetannot} macro is written in the auxiliary files with \cs{resetlinenumannotation} macro. It resets the annotation.
10127 % \begin{macrocode}
10128 \newcommand{\reset@current@annot}{%
10129 \unless\ifnoresetlinenumannotation@
10130 \let\current@annot\empty%
10131 \fi
10132 }%
10133 \newcommand{\@resetannot}{%
10134 \let\current@annot\empty%
10135 }%
10136 % \end{macrocode}
10137 % \end{macro}
10138 % \end{macro}
10139 % \begin{macro}{\parse@annot}
10140 % In the \cs{annot@list} list, each individual \cs{edtext} is associated with a starting and an ending line number annotation, which is stored this way: \verb+start annotation|end annotation+
10141 % The \cs{parse@annot} reads the format and defines two global macros.
10142 % \begin{macrocode}
10143 \def\parse@annot#1|#2|{%
10144 \gdef\annot@start{#1}%
10145 \gdef\annot@end{#2}%
10146 }%
10147 % \end{macrocode}
10148 % \end{macro}
10149 % \begin{macro}{\setlinenumannotationsep}
10150 % \begin{macro}{\@linenumannotationsep}
10151 % The separator between the annotations and the way to redefine it.
10152 % \begin{macrocode}
10153 \newcommand{\setlinenumannotationsep}[1]{\gdef\@linenumannotationsep{#1}}%
10154 \def\@linenumannotationsep{, }%
10155 % \end{macrocode}
10156 % \end{macro}
10157 % \end{macro}
10158 % \section{Line number printing}
10159 %
10160 % \begin{macro}{\affixline@num}
10161 % \protect\cs{affixline@num} just puts a left line number into \protect\cs{l@dld@ta}
10162 % or a right line number into \protect\cs{l@drd@ta} as required.
10163 %
10164 % To determine whether we need to affix a line number to this line,
10165 % we compute the following:
10166 % \begin{tabbing}
10167 % \quad $m$ \= \kill
10168 % $n$ \> $= \mbox{\it int\/} ( ( \mbox{\it linenum\/} -
10169 % \mbox{\it firstlinenum\/} ) /
10170 % \mbox{\it linenumincrement\/} )$ \\
10171 % $m$ \> $= \mbox{\it firstlinenum\/} +
10172 % ( n \times \mbox{\it linenumincrement\/})$
10173 % \end{tabbing}
10174 % (where \emph{int} truncates a real number to an integer).
10175 % $m$ will be equal to \emph{linenum} only
10176 % if we are to paste a number on here.
10177 % However, the formula breaks down for the first line to number (and any
10178 % before that), so we check that case separately: if \protect\cs{line@num} $\le$
10179 % \protect\cs{firstlinenum}, we compare the two directly instead of making these
10180 % calculations.
10181 %
10182 % We compute, in the scratch counter \protect\cs{@l@dtempcnta}, the number
10183 % of the next line that should be printed with a number ($m$ in the
10184 % above discussion), and move the current line number into the
10185 % counter \protect\cs{@l@dtempcntb} for comparison.
10186 %
10187 %
10188 % First, the case when we are within a sub-line range.
10189 % \changes{v0.5.1}{2004/04/10}{Changed \protect\cs{affixline@num} to cater for sidenotes}
10190 % \changes{v0.7.0}{2005/02/22}{Added skipnumering to \protect\cs{affixline@num}}
10191 % \begin{macrocode}
10192 \newcommand*{\affixline@num}{%
10193 % \end{macrocode}
10194 % No number is attached if \protect\cs{ifl@dskipnumber} is TRUE (and then it
10195 % is set to its normal FALSE value).
10196 % No number is attached if \protect\cs{ifnumberline} is FALSE (the normal value is TRUE).
10197 % \changes{v0.15.0}{2012/06/11}{Line numbering can be disabled.}
10198 % \begin{macrocode}
10199 \ifledgroupnotesL@\else
10200 \ifnumberline
10201 \ifl@dskipnumber
10202 \global\l@dskipnumberfalse
10203 \else
10204 \ifsublines@
10205 \@l@dtempcntb=\subline@num
10206 \ifnum\subline@num>\c@firstsublinenum
10207 \@l@dtempcnta=\subline@num
10208 \advance\@l@dtempcnta by-\c@firstsublinenum
10209 \divide\@l@dtempcnta by\c@sublinenumincrement
10210 \multiply\@l@dtempcnta by\c@sublinenumincrement
10211 \advance\@l@dtempcnta by\c@firstsublinenum
10212 \else
10213 \@l@dtempcnta=\c@firstsublinenum
10214 \fi
10215 % \end{macrocode}
10216 %
10217 % That takes care of computing the values for comparison, but if line
10218 % number locking is in effect we have to make a further check. If this
10219 % check fails, then we disable the line-number display by setting the
10220 % counters to arbitrary but unequal values.
10221 % \begin{macrocode}
10222 \ch@cksub@l@ck
10223 % \end{macrocode}
10224 %
10225 % Now the line number case, which works the same way.
10226 % \begin{macrocode}
10227 \else
10228 \@l@dtempcntb=\line@num
10229 % \end{macrocode}
10230 % Check on the \protect\cs{linenumberlist}
10231 % If it is \protect\cs{empty} use the standard
10232 % algorithm.
10233 % \begin{macrocode}
10234 \ifx\linenumberlist\empty
10235 \ifnum\line@num>\c@firstlinenum
10236 \@l@dtempcnta=\line@num
10237 \advance\@l@dtempcnta by-\c@firstlinenum
10238 \divide\@l@dtempcnta by\c@linenumincrement
10239 \multiply\@l@dtempcnta by\c@linenumincrement
10240 \advance\@l@dtempcnta by\c@firstlinenum
10241 \else
10242 \@l@dtempcnta=\c@firstlinenum
10243 \fi
10244 \else
10245 % \end{macrocode}
10246 % The \protect\cs{linenumberlist} was not \protect\cs{empty}, so here is Wayne's
10247 % numbering mechanism. This takes place in \TeX's mouth.
10248 % \begin{macrocode}
10249 \@l@dtempcnta=\line@num
10250 \edef\rem@inder{,\linenumberlist,\number\line@num,}%
10251 \edef\sc@n@list{\def\noexpand\sc@n@list
10252 ####1,\number\@l@dtempcnta,####2|{\def\noexpand\rem@inder{####2}}}%
10253 \sc@n@list\expandafter\sc@n@list\rem@inder|%
10254 \ifx\rem@inder\empty%
10255 \advance\@l@dtempcnta\@ne
10256 \fi
10257 \fi
10258 % \end{macrocode}
10259 %
10260 %
10261 % A locking check for lines, just like the version for sub-line
10262 % numbers above.
10263 % \begin{macrocode}
10264 \ch@ck@l@ck
10265 \fi
10266 % \end{macrocode}
10267 %
10268 % The following tests are true if we need to print a line number.
10269 % \begin{macrocode}
10270 \ifnum\@l@dtempcnta=\@l@dtempcntb
10271 \ifl@dskipversenumber\else
10272 % \end{macrocode}
10273 %
10274 % If we got here,
10275 % we are going to print a line number; so now we need to
10276 % calculate a number that will tell us which side of the page will get
10277 % the line number. We start from \protect\cs{line@margin}, which asks for
10278 % one side always if it is less than $2$; and then if the side does
10279 % depend on the page number, we simply add the page number to this
10280 % side code---because the values of \protect\cs{line@margin} have been devised so
10281 % that this produces a number that is even for left-margin numbers and
10282 % odd for right-margin numbers.
10283 %
10284 % For \LaTeX\ we have to consider two column documents as well. In this case
10285 % Peter Wilson thought we need to put the numbers at the outside of the column ---
10286 % the left of the first column and the right of the second. Do the twocolumn
10287 % stuff before going on with the original code.
10288 % \begin{macro}{\l@dld@ta}
10289 % \begin{macro}{\l@drd@ta}
10290 % A left line number is stored in \protect\cs{l@dld@ta} and a right one in
10291 % \protect\cs{l@drd@ta}.
10292 %
10293 % \begin{macrocode}
10294 \if@twocolumn
10295 \if@firstcolumn
10296 \gdef\l@dld@ta{\llap{{\leftlinenum}}}%
10297 \iflinenumannotationotherside%
10298 \gdef\l@drd@ta{\rlap{{\rightlinenumannotation}}}%
10299 \fi%
10300 \else
10301 \gdef\l@drd@ta{\rlap{{\rightlinenum}}}%
10302 \iflinenumannotationotherside%
10303 \gdef\l@dld@ta{\llap{{\leftlinenumannotation}}}%
10304 \fi%
10305 \fi
10306 \else
10307 \ifboolexpr{bool {l@dprintingcolumns} and test {\ifnumgreater{\line@margin@columns}{\m@ne}}}%
10308 {\@l@dtempcntb=\line@margin@columns}%
10309 {\@l@dtempcntb=\line@margin}%
10310 \ifnum\@l@dtempcntb>\@ne
10311 \advance\@l@dtempcntb \page@num
10312 \fi
10313 \ifboolexpr{%
10314 bool {l@dprintingcolumns}%
10315 and (%
10316 (test {\ifdefstring{\linenum@OnlyPages@ForColumns}{left}}%
10317 and test {\ifnumodd{\page@num}}%
10318 )%
10319 or%
10320 (test {\ifdefstring{\linenum@OnlyPages@ForColumns}{right}}%
10321 and not test {\ifnumodd{\page@num}}%
10322 )%
10323 )%
10324 }%
10325 {}%
10326 {%
10327 \ifodd\@l@dtempcntb%
10328 \gdef\l@drd@ta{\rlap{{\rightlinenum}}}%
10329 \iflinenumannotationotherside%
10330 \gdef\l@dld@ta{\llap{{\leftlinenumannotation}}}%
10331 \fi%
10332 \else%
10333 \gdef\l@dld@ta{\llap{{\leftlinenum}}}%
10334 \iflinenumannotationotherside%
10335 \gdef\l@drd@ta{\rlap{{\rightlinenumannotation}}}%
10336 \fi%
10337 \fi%
10338 }%
10339 \fi
10340 \fi
10341 \fi
10342 % \end{macrocode}
10343 % \end{macro}
10344 % \end{macro}
10345 %
10346 % Now fix the lock counters, if necessary.
10347 % A value of $1$ is advanced to
10348 % $2$; $3$ advances to $0$; other values are unchanged.
10349 % \begin{macrocode}
10350 \f@x@l@cks
10351 \fi
10352 \fi
10353 \fi
10354 }
10355
10356 % \end{macrocode}
10357 % \end{macro}
10358 %
10359 % \begin{macro}{\ch@cksub@l@ck}
10360 % \begin{macro}{\ch@ck@l@ck}
10361 % \begin{macro}{\f@x@l@cks}
10362 % These macros handle line number locking for \protect\cs{affixline@num}.
10363 % \changes{v0.7.0}{2005/02/24}{Added \protect\cs{ch@cksub@l@ck}, \protect\cs{ch@ck@l@ck}
10364 % and \protect\cs{f@x@l@cks}}
10365 % \protect\cs{ch@cksub@l@ck} checks subline locking. If it fails, then we disable
10366 % the line-number display by setting the counters to arbitrary but unequal
10367 % values.
10368 % \begin{macrocode}
10369 \newcommand*{\ch@cksub@l@ck}{%
10370 \ifcase\sub@lock
10371 \or
10372 \ifnum\sublock@disp=\@ne
10373 \@l@dtempcntb=\z@ \@l@dtempcnta=\@ne
10374 \fi
10375 \or
10376 \ifnum\sublock@disp=\tw@ \else
10377 \@l@dtempcntb=\z@ \@l@dtempcnta=\@ne
10378 \fi
10379 \or
10380 \ifnum\sublock@disp=\z@
10381 \@l@dtempcntb=\z@ \@l@dtempcnta=\@ne
10382 \fi
10383 \fi}
10384 % \end{macrocode}
10385 % Similarly for line numbers.
10386 % \begin{macrocode}
10387 \newcommand*{\ch@ck@l@ck}{%
10388 \ifcase\@lock
10389 \or
10390 \ifnum\lock@disp=\@ne
10391 \@l@dtempcntb=\z@ \@l@dtempcnta=\@ne
10392 \fi
10393 \or
10394 \ifnum\lock@disp=\tw@ \else
10395 \@l@dtempcntb=\z@ \@l@dtempcnta=\@ne
10396 \fi
10397 \or
10398 \ifnum\lock@disp=\z@
10399 \@l@dtempcntb=\z@ \@l@dtempcnta=\@ne
10400 \fi
10401 \fi}
10402 % \end{macrocode}
10403 % Fix the lock counters.
10404 % A value of $1$ is advanced to
10405 % $2$; $3$ advances to $0$; other values are unchanged.
10406 % \begin{macrocode}
10407 \newcommand*{\f@x@l@cks}{%
10408 \ifcase\@lock
10409 \or
10410 \global\@lock=\tw@
10411 \or \or
10412 \global\@lock=\z@
10413 \fi
10414 \ifcase\sub@lock
10415 \or
10416 \global\sub@lock=\tw@
10417 \or \or
10418 \global\sub@lock=\z@
10419 \fi}
10420
10421 % \end{macrocode}
10422 % \end{macro}
10423 % \end{macro}
10424 % \end{macro}
10425 %
10426 %
10427 %
10428 %
10429 % \section{Pstart number printing inside}
10430 % Inside, the printing of the pstart number runs like the printing of the line number. There are only a few differences:
10431 % \begin{macro}{\affixpstart@num}
10432 % \begin{macro}{\pstartnum}
10433 % \begin{itemize}
10434 % \item The pstarts counter is upgraded in the \protect\cs{pend} command. Consequently, the \protect\cs{affixpstart@num} command has not to upgrade it, unlike the \protect\cs{affixline@num} which upgrades the lines counter.
10435 % \item To print the pstart number only at the beginning of a pstart, and not in every line, a boolean test is made. The \protect\cs{pstartnum} boolean is set to TRUE at every \protect\cs{pend}. It is tried in the \protect\cs{leftpstartnum} and \protect\cs{rightstartnum} commands. After the try, it is set to FALSE.
10436 % \end{itemize}
10437 % \begin{macro}{\leftpstartnum}
10438 % \begin{macro}{\rightstartnum}
10439 % \begin{macro}{\ifsidepstartnum}
10440 % \begin{macrocode}
10441
10442 \newif\ifsidepstartnum
10443 \newcommand*{\affixpstart@num}{%
10444 \ifsidepstartnum
10445 \if@twocolumn
10446 \if@firstcolumn
10447 \gdef\l@dld@ta{\llap{{\leftpstartnum}}}%
10448 \else
10449 \gdef\l@drd@ta{\rlap{{\rightpstartnum}}}%
10450 \fi
10451 \else
10452 \@l@dtempcntb=\line@margin%
10453 \ifnum\@l@dtempcntb>\@ne
10454 \advance\@l@dtempcntb \page@num
10455 \fi
10456 \ifodd\@l@dtempcntb
10457 \gdef\l@drd@ta{\rlap{{\rightpstartnum}}}%
10458 \else
10459 \gdef\l@dld@ta{\llap{{\leftpstartnum}}}%
10460 \fi
10461 \fi
10462 \fi
10463
10464 }
10465 %
10466
10467 \newif\ifpstartnum
10468 \pstartnumtrue
10469 \newcommand*{\leftpstartnum}{
10470 \ifpstartnum\thepstart
10471 \kern\linenumsep\fi
10472 \global\pstartnumfalse
10473 }
10474 \newcommand*{\rightpstartnum}{
10475 \ifpstartnum
10476 \kern\linenumsep
10477 \thepstart
10478 \fi
10479 \global\pstartnumfalse
10480 }
10481 % \end{macrocode}
10482 % \end{macro}
10483 % \end{macro}
10484 % \end{macro}
10485 % \end{macro}
10486 % \end{macro}
10487 % \section{Restoring footnotes and penalties}
10488 % Because of the paragraph decomposition process in order to number line, \macpackage\ must hack the standard way \TeX\ works in order to manage insertion of footnotes, both critical and familiar.
10489 %
10490 % We need to call the \protect\cs{insert} commands not when the content of \protect\cs{pstart}\ldots\protect\cs{pend} is read by \TeX\, by when each individual line is typeset.
10491 %
10492 % Consequently, when reading the content of \protect\cs{pstart}\ldots\protect\cs{pend}, we store the insertion (footnotes) in an specific \macpackage's list, and we restore them to the vertical list when printing each individual line.
10493 %
10494 % \subsection{Add insertions to the vertical list}
10495 %
10496 % \begin{macro}{\inserts@list}
10497 % \protect\cs{inserts@list} is the list macro that contains the inserts that
10498 % we save up for one paragraph.
10499 %
10500 % \begin{macrocode}
10501 \list@create{\inserts@list}
10502 % \end{macrocode}
10503 % \end{macro}
10504 %
10505 % \begin{macro}{\add@inserts}
10506 % \begin{macro}{\add@inserts@next}
10507 % \protect\cs{add@inserts}
10508 % is the penultimate macro used by \protect\cs{do@line}; it takes
10509 % insertions saved in a list macro and sends them onto the vertical list.
10510 %
10511 % It may call itself recursively, and to do this efficiently (using
10512 % \TeX's optimization for tail recursion), we define a control-sequence
10513 % called \protect\cs{add@inserts@next} that is always the last thing that
10514 % \protect\cs{add@inserts} does. If there could be more inserts to process for
10515 % this line, \protect\cs{add@inserts@next} is set equal to \protect\cs{add@inserts};
10516 % otherwise it is just \protect\cs{relax}.
10517 %
10518 % \begin{macrocode}
10519 \newcommand*{\add@inserts}{%
10520 \global\let\add@inserts@next=\relax
10521 % \end{macrocode}
10522 %
10523 % If \protect\cs{inserts@list} is empty, there are not any more notes or insertions
10524 % for this paragraph, and we need not waste our time.
10525 % \begin{macrocode}
10526 \ifx\inserts@list\empty \else
10527 % \end{macrocode}
10528 %
10529 % The \protect\cs{next@insert} macro records the number of the line that
10530 % receives the next footnote or other insert; it is empty when we start
10531 % out, and just after we have affixed a note or insert.
10532 % \begin{macrocode}
10533 \ifx\next@insert\empty
10534 \ifx\insertlines@list\empty
10535 \global\noteschanged@true
10536 \gdef\next@insert{100000}%
10537 \else
10538 \gl@p\insertlines@list\to\next@insert
10539 \fi
10540 \fi
10541 % \end{macrocode}
10542 %
10543 % If the next insert's for this line, tack it on (and then erase the
10544 % contents of the insert macro, as it could be quite large).
10545 % In that case, we also set \protect\cs{add@inserts@next} so that we will
10546 % call ourself recursively: there might be another insert for this same
10547 % line.
10548 %
10549 % \begin{macrocode}
10550 \ifnum\next@insert=\absline@num
10551 \gl@p\inserts@list\to\@insert
10552 \@insert
10553 \global\let\@insert=\undefined
10554 \global\let\next@insert=\empty
10555 \global\let\add@inserts@next=\add@inserts
10556 \fi
10557 \fi
10558 % \end{macrocode}
10559 %
10560 % Make the recursive call, if necessary.
10561 %
10562 % \begin{macrocode}
10563 \add@inserts@next}
10564
10565 % \end{macrocode}
10566 % \end{macro}
10567 % \end{macro}
10568 %
10569 % \begin{macro}{\add@Xgroupbyline}
10570 % If you use \cs{Xgroupbyline}, the insertion of the critical footnotes are not made immediately in \cs{add@inserts}, but the content to be inserted is stored, in order to be inserted later in one block.
10571 % This insertion in one block is made by \cs{add@Xgroupbyline}.
10572 % \begin{macrocode}
10573 \newcommand{\add@Xgroupbyline}{%
10574 \unless\ifnocritical@%
10575 \def\do##1{%Looping on the series
10576 \let\olddo\do%Save the old \do macro, that is this macro itself!
10577 \def\do####1{%Looping on the ##1@forinserting command
10578 \ifcsdef{##1@forinserting@####1}{%
10579 \X@beforeinsertion{##1}%
10580 \if@ledgroup%
10581 \global\setbox\@nameuse{mp##1footins}=\vbox%
10582 \else%
10583 \insert\csname ##1footins\endcsname%
10584 \fi%
10585 {%
10586 \Xsetparindent{##1}%
10587 \ifcsdef{Xhsize\csuse{series@display##1}@##1}%
10588 {\hsize \csuse{Xhsize\csuse{series@display##1}@##1}}%
10589 {}%
10590 \if@ledgroup%
10591 \unvbox\@nameuse{mp##1footins}%
10592 \fi%
10593 \X@atbegininsertion{##1}%
10594 \ifcsstring{series@display##1}{normal}%
10595 {%
10596 \Xledsetnormalparstuff{##1}%
10597 \rule\z@\splittopskip%
10598 }%
10599 {}%
10600 \csuse{##1@forinserting@####1}%
10601 \strut\par\allowbreak%
10602 }%
10603 \global\csundef{##1@forinserting@####1}%
10604 }%
10605 {}%
10606 }%
10607 \ifcsdef{##1@forinserting}{%
10608 \dolistcsloop{##1@forinserting}%
10609 }{}%
10610 \global\csundef{##1@forinserting}%
10611 \let\do\olddo%Restore old do
10612 }%
10613 \dolistloop{\@series}%
10614 \fi%
10615 }%
10616
10617
10618 % \end{macrocode}
10619 % \end{macro}
10620 % \subsection{Penalties}
10621 %
10622 % \begin{macro}{\add@penalties}
10623 % \protect\cs{add@penalties} is
10624 % the last macro used by \protect\cs{do@line}. It adds up the club,
10625 % widow, and interline penalties, and puts a single penalty
10626 % of the appropriate size
10627 % back into the paragraph; these penalties get
10628 % removed by the \protect\cs{vsplit} operation. \protect\cs{displaywidowpenalty} and
10629 % \protect\cs{brokenpenalty} are not restored, since we have no easy way to
10630 % find out where we should insert them.
10631 %
10632 % \label{add@penalties}
10633 % In this code, \protect\cs{num@lines} is the number of lines in the whole
10634 % paragraph, and \protect\cs{par@line} is the line we are working on at the
10635 % moment. The count \protect\cs{@l@dtempcnta} is used to calculate and
10636 % accumulate the penalty; it is initially set to the value of
10637 % \protect\cs{ballast@count}, which has been worked out in \protect\cs{do@ballast}
10638 % above (\reff{do@ballast}). Finally, the penalty is
10639 % checked to see that it does not go below $-10000$.
10640 % \begin{macrocode}
10641 \newcommand*{\add@penalties}{\@l@dtempcnta=\ballast@count
10642 \ifnum\num@lines>\@ne
10643 \global\advance\par@line \@ne
10644 \ifnum\par@line=\@ne
10645 \advance\@l@dtempcnta \clubpenalty
10646 \fi
10647 \@l@dtempcntb=\par@line \advance\@l@dtempcntb \@ne
10648 \ifnum\@l@dtempcntb=\num@lines
10649 \advance\@l@dtempcnta \widowpenalty
10650 \fi
10651 \ifnum\par@line<\num@lines
10652 \advance\@l@dtempcnta \interlinepenalty
10653 \fi
10654 \fi
10655 \ifnum\@l@dtempcnta=\z@
10656 \relax
10657 \else
10658 \ifnum\@l@dtempcnta>-10000
10659 \penalty\@l@dtempcnta
10660 \else
10661 \penalty -10000
10662 \fi
10663 \fi}
10664
10665 % \end{macrocode}
10666 % \end{macro}
10667 %
10668 % \subsection{Printing leftover notes}
10669 %
10670 % \begin{macro}{\flush@notes}
10671 % The \protect\cs{flush@notes}
10672 % macro is called after the entire paragraph has been sliced up
10673 % and sent on to the vertical list.
10674 % If the number of notes to this paragraph has increased since the previous
10675 % run of \TeX, then there can be leftover notes that have not yet been
10676 % printed. An appropriate error message will be printed elsewhere; but
10677 % it is best to go ahead and
10678 % print these notes somewhere, even if it is not in quite the
10679 % right place. What we do is dump them all out here, so that they should
10680 % be printed on the same page as the last line
10681 % of the paragraph. We can hope that is not
10682 % too far from the proper location, to which they will move on the next
10683 % run.
10684 % For the first run, we do not flush the notes,
10685 % as that means all the notes will be added at the end of numbered section,
10686 % and so, very far of the expected position
10687 % \begin{macrocode}
10688 \newcommand*{\flush@notes}{%
10689 \iftoggle{notfirstrun@\jobname.\extensionchars\the\section@num}{%
10690 \@xloop%
10691 \ifx\inserts@list\empty \else%
10692 \gl@p\inserts@list\to\@insert%
10693 \@insert%
10694 \global\let\@insert=\undefined%
10695 \repeat%
10696 }{}%
10697 }%
10698
10699
10700 % \end{macrocode}
10701 % \end{macro}
10702 %
10703 % \begin{macro}{\@xloop}
10704 % \protect\cs{@xloop} is
10705 % a variant of the \PlainTeX\ \protect\cs{loop} macro, useful when it's
10706 % hard to construct a positive test using the \TeX\ \verb"\if" commands---as
10707 % in \protect\cs{flush@notes} above. One types \protect\cs{@xloop} \verb"..." \verb"\if" \verb"..." \verb"\else"
10708 % \verb"..." \verb"\repeat", and the action following \verb"\else" is repeated as long
10709 % as the \verb"\if" test fails. (This macro will work wherever the \PlainTeX\
10710 % \protect\cs{loop} is used, too, so we could just call it \protect\cs{loop};
10711 % but it seems preferable not to change the definitions of any of
10712 % the standard macros.)
10713 %
10714 % This variant of \protect\cs{loop} was introduced by
10715 % Alois Kabelschacht\index{Kabelschacht, Alois} in
10716 % \textit{TUGboat} \textbf{8} (1987), pp.\,184--5.
10717 %
10718 % \begin{macrocode}
10719 \def\@xloop#1\repeat{%
10720 \def\body{#1\expandafter\body\fi}%
10721 \body}
10722
10723 % \end{macrocode}
10724 % \end{macro}
10725 % \subsection{Text before notes}
10726 % \begin{macro}{\set@Xtxtbeforenotes}
10727 % The \cs{set@Xtxtbeforenotes} macro resets the Xtxtbeforesnotes@\meta{series}@typeset boolean to false. Just before the first note of the \meta{series} in a page, the \cs{Xtextbeforenotes} will be inserted.
10728 % \begin{macrocode}
10729 \newcommand{\set@Xtxtbeforenotes}{%
10730 \unless\ifnocritical@%
10731 \def\do##1{%
10732 \nottoggle{Xtxtbeforenotesonlyonce@##1}{%
10733 \global\togglefalse{Xtxtbeforesnotes@##1@typeset}%
10734 }{}%
10735 }%
10736 \dolistloop{\@series}%
10737 \fi%
10738 }%
10739 % \end{macrocode}
10740 % \end{macro}
10741 % \begin{macro}{\set@txtbeforenotesX}
10742 % The \cs{set@txtbeforenotesX} does the same for the \cs{txtbeforenotesX}.
10743 % \begin{macrocode}
10744 \newcommand{\set@txtbeforenotesX}{%
10745 \unless\ifnofamiliar@%
10746 \def\do##1{%
10747 \nottoggle{txtbeforenotesonlyonceX@##1}{%
10748 \global\togglefalse{txtbeforesnotesX@##1@typeset}%
10749 }{}%
10750 }%
10751 \dolistloop{\@series}%
10752 \fi%
10753 }%
10754 % \end{macrocode}
10755 % \end{macro}
10756 % \begin{macro}{\insert@Xtxtbeforenotes}
10757 % \begin{macro}{\insert@txtbeforenotesX}
10758 % \cs{insert@Xtxtbeforenotes}\marg{series}, called when inserting a familiar footnote, will insert the text before the note if it is not already inserted.
10759 % For paragraphed footnotes, it will insert it as a component of the first footnote.
10760 % For other types of footnotes, it will insert it as a regular footnote.
10761 %
10762 % \cs{insert@txtbeforenotesX} is the same for familiar footnotes.
10763 % \begin{macrocode}
10764 \newcommand{\insert@Xtxtbeforenotes}[1]{%
10765 \nottoggle{Xtxtbeforesnotes@#1@typeset}{%
10766 \global\toggletrue{Xtxtbeforesnotes@#1@typeset}%
10767 \ifcsvoid{Xtxtbeforenotes@#1}{}{%
10768 \ifcsstring{series@display#1}{paragraph}%
10769 {\noindent\csuse{Xtxtbeforenotes@#1}}%
10770 {\expandafter\insert\csname#1footins\endcsname%
10771 \bgroup%
10772 \noindent%
10773 \ifcsdef{\csuse{series@display#1}@begin@insert}{%
10774 \csuse{\csuse{series@display#1}@begin@insert}{#1}%
10775 }{}%
10776 \strut\csuse{Xnotefontsize@#1}%
10777 \csuse{Xtxtbeforenotes@#1}%
10778 \egroup%
10779 }%
10780 }%
10781 }%
10782 {}%
10783 }%
10784
10785
10786 \newcommand{\insert@txtbeforenotesX}[1]{%
10787 \nottoggle{txtbeforesnotesX@#1@typeset}{%
10788 \global\toggletrue{txtbeforesnotesX@#1@typeset}%
10789 \ifcsvoid{txtbeforenotesX@#1}{}{%
10790 \ifcsstring{series@displayX#1}{paragraph}%
10791 {\noindent\csuse{txtbeforenotesX@#1}}%
10792 {\expandafter\insert\csname footins#1\endcsname%
10793 \bgroup%
10794 \noindent%
10795 \ifcsdef{\csuse{series@displayX#1}@begin@insert}{%
10796 \csuse{\csuse{series@displayX#1}@begin@insert}{#1}%
10797 }{}%
10798 \strut\csuse{notefontsizeX@#1}\csuse{txtbeforenotesX@#1}%
10799 \egroup%
10800 }%
10801 }%
10802 }%
10803 {}%
10804 }%
10805
10806
10807 % \end{macrocode}
10808 % \end{macro}
10809 % \end{macro}
10810 % \section{Critical footnotes}
10811 % \label{footnotes}
10812 %
10813 % The footnote macros are adapted from those in \PlainTeX, but they
10814 % differ in these respects: the outer-level commands must add other
10815 % commands to a list macro rather than doing insertions immediately;
10816 % there are many separate levels of the footnotes, not just one; and there
10817 % are options to reformat footnotes into paragraphs or into multiple
10818 % columns.
10819 %
10820 % \subsection{Fonts}
10821 % \label{fontcode}\relax
10822 % Before getting into the details of formatting the notes, we set
10823 % up some font macros. It is the notes that present the greatest
10824 % challenge for our font-handling mechanism, because we need to be
10825 % able to take fragments of our main text and print them in
10826 % different forms: it is common to reduce the size,
10827 % for example, without otherwise changing the fonts used.
10828 %
10829 %
10830 % \begin{macro}{\select@lemmafont}\label{notefonts}
10831 % \begin{macro}{\select@@lemmafont}
10832 % \protect\cs{select@lemmafont} is provided to set the right font for
10833 % the lemma in a note. This macro extracts the font specifier
10834 % from the line and page number cluster, and issues the associated
10835 % font-changing command, so that the lemma is printed in its
10836 % original font.
10837 % \begin{macrocode}
10838 \def\select@lemmafont#1|#2|#3|#4|#5|#6|#7|{\select@@lemmafont#7|}
10839 \def\select@@lemmafont#1/#2/#3/#4|%
10840 {\fontencoding{#1}\fontfamily{#2}\fontseries{#3}\fontshape{#4}%
10841 \selectfont}
10842
10843 % \end{macrocode}
10844 % \end{macro}
10845 % \end{macro}
10846 %
10847 %
10848 % \subsection{Individual note options}
10849 % \changes{v1.0.0}{2012/09/15}{Options of \protect\cs{Xfootnote}s.}
10850 % \begin{macro}{\footnoteoptions@}
10851 % The \protect\cs{footnoteoption@}\oarg{side}\marg{options}\marg{value} changes the value of on options of Xfootnote, to switch between true and false.
10852 % \changes{v2.4.0}{2015/10/19}{First argument of \protect\cs{footnoteoption@} is now mandatory, not optional.}
10853 % \begin{macrocode}
10854 \newcommand*{\footnoteoptions@}[3]{%
10855 \def\do##1{%
10856 \ifstrequal{#1}{L}{% On the left side
10857 \xright@appenditem{\noexpand\setkeys[mac]{#3footnoteoption}{\unexpanded{##1}}}\to\inserts@list%
10858 \global\advance\insert@count \@ne% Increment the left insert counter.
10859 }%
10860 {%
10861 \xright@appenditem{\noexpand\setkeys[mac]{#3footnoteoption}{\unexpanded{##1}}}\to\inserts@listR%
10862 \global\advance\insert@countR \@ne% Increment the right insert counter insert.
10863 }%
10864 }%
10865 \notblank{#2}{\docsvlist{#2}}{}% Parsing all options
10866 }
10867 % \end{macrocode}
10868 % \end{macro}
10869 %
10870 % \subsection{Notes language}
10871 % \begin{macro}{\footnotelang@lua}
10872 % \protect\cs{footnotelang@lua} is called to remember the information about the direction of a lemma when \LuaLaTeX\ is used.
10873 % \begin{macrocode}
10874 \newcommandx*{\footnotelang@lua}[1][1=L,usedefault]{%
10875 \ifstrequal{#1}{L}{%
10876 \xright@appenditem{{\csxdef{footnote@luatextextdir}{\the\textdir}}}\to\inserts@list%Know the dir of lemma
10877 \global\advance\insert@count \@ne%
10878 \xright@appenditem{{\csxdef{footnote@luatexpardir}{\the\pardir}}}\to\inserts@list%Know the dir of lemma
10879 \global\advance\insert@count \@ne%
10880 }%
10881 {%
10882 \xright@appenditem{{\csxdef{footnote@luatextextdir}{\the\textdir}}}\to\inserts@listR%Know the dir of lemma
10883 \global\advance\insert@countR \@ne%
10884 \xright@appenditem{{\csxdef{footnote@luatexpardir}{\the\pardir}}}\to\inserts@listR%Know the dir of lemma
10885 \global\advance\insert@countR \@ne%
10886 }%
10887 }
10888 % \end{macrocode}
10889 % \end{macro}
10890 % \begin{macro}{\footnotelang@poly}
10891 % \protect\cs{footnotelang@poly} is called to remember the information about the language of a lemma when \protect\package{polyglossia} is used.
10892 % \begin{macrocode}
10893 \newcommandx*{\footnotelang@poly}[1][1=L,usedefault]{%
10894 \ifstrequal{#1}{L}{%
10895 \if@RTL%
10896 \xright@appenditem{{\csxdef{footnote@dir}{@RTLtrue}}}\to\inserts@list%Know the language used in the lemma
10897 \global\advance\insert@count \@ne%
10898 \else
10899 \xright@appenditem{{\csxdef{footnote@dir}{@RTLfalse}}}\to\inserts@list%Know the language of lemma
10900 \global\advance\insert@count \@ne%
10901 \fi%
10902 \xright@appenditem{{\csxdef{footnote@lang}{\expandonce\languagename}}}\to\inserts@list%Know the language of lemma
10903 \global\advance\insert@count \@ne%
10904 }%
10905 {%
10906 \if@RTL
10907 \xright@appenditem{{\csxdef{footnote@dir}{@RTLtrue}}}\to\inserts@listR%Know the language of lemma
10908 \global\advance\insert@countR \@ne%
10909 \else
10910 \xright@appenditem{{\csxdef{footnote@dir}{@RTLfalse}}}\to\inserts@listR%Know the language of lemma
10911 \global\advance\insert@countR \@ne%
10912 \fi
10913 \xright@appenditem{{\csxdef{footnote@lang}{\expandonce\languagename}}}\to\inserts@listR%Know the language of lemma
10914 \global\advance\insert@countR \@ne%
10915 }%
10916 }
10917 % \end{macrocode}
10918 % \end{macro}
10919 % \subsection{General survey of the way we manage notes}
10920 %
10921 % The processing of each note is done
10922 % by four principal macros: the \protect\cs{vfootnote} macro takes the text
10923 % of the footnote and does the \protect\cs{insert}; it calls on the
10924 % \protect\cs{footfmt} macro to select the right fonts, print the line
10925 % number and lemma, and do any other formatting needed for that individual
10926 % note. Within the output routine, the two other macros, \protect\cs{footstart}
10927 % and \protect\cs{footgroup}, are called; the first prints extra vertical
10928 % space and a footnote rule, if desired; the second does any reformatting
10929 % of the whole set of the footnotes in this series for this page---such
10930 % as paragraphing or division into columns---and then sends them to the
10931 % page.
10932 %
10933 % These four macros, and the other macros and parameters shown
10934 % here, are distinguished by the \enquote{series letter}
10935 % that indicates which set of the footnotes
10936 % we are dealing with---\texttt{A}, \texttt{B}, \texttt{C}, \texttt{D}, or \texttt{E}.
10937 % The series letter always precedes the string \verb"foot" in macro
10938 % and parameter names. Hence, for the \texttt{A} series, the four macros
10939 % are called \protect\cs{vAfootnote}, \protect\cs{Afootfmt}, \protect\cs{Afootstart},
10940 % and \protect\cs{Afootgroup}.
10941 %
10942 % These macros are changed depending on the footnote arrangement: \enquote{normal}, \enquote{paragraphed}, \enquote{two columns} or \enquote{three columns}.
10943 % \subsection{General setup}
10944 % \begin{macro}{\footsplitskips}
10945 % Some setup code that is common for a variety of the footnotes.
10946 % The setup is for:
10947 % \begin{itemize}
10948 % \item \protect\cs{interlinepenalty}.
10949 % \item \protect\cs{splittopskip} (skip before last part of notes that flow from one page to another).
10950 % \item \protect\cs{splitmaxdepth}.
10951 % \item \protect\cs{floatingpenalty}, that is penalty values being added when a long note flows from one page to another.
10952 % Here, we let it to 0 when we process parallel pages in \protect\package{eledpar}, in order to allow notes to flow from left to right pages and \emph{vice-versa}.
10953 % \item\cs{parfillskip} for ending of paragraph.
10954 % Otherwise, we let it to \protect\cs{@MM}, which is the standard \LaTeX\ \protect\cs{floatingpenalty}.
10955 % \end{itemize}
10956 % \changes{v0.7.0}{2005/02/18}{Added \protect\cs{footsplitskips} for use in many
10957 % footnote styles}
10958 % \changes{v1.19.0}{2015/03/06}{\protect\cs{footsplitskips} doesn't set \protect\cs{floatingpenalty} to \protect\cs{@MM} when processing parallel pages.}
10959 % \begin{macrocode}
10960 \newcommand*{\footsplitskips}{%
10961 \interlinepenalty=\interfootnotelinepenalty
10962 \unless\ifl@dprintingpages%
10963 \floatingpenalty=\@MM%
10964 \fi%
10965 \splittopskip=\ht\strutbox%
10966 \splitmaxdepth=\dp\strutbox%
10967 \leftskip=\z@skip%
10968 \rightskip=\z@skip%
10969 \parfillskip=0pt plus 1fil%
10970 }
10971
10972 % \end{macrocode}
10973 % \end{macro}
10974 %
10975 % \begin{macro}{\normalfootnoterule}
10976 % \protect\cs{normalfootnoterule} is
10977 % a standard footnote-rule macro, for use by a \verb"footstart"
10978 % macro: just the same as the \PlainTeX\ footnote rule.
10979 % \begin{macrocode}
10980 \let\normalfootnoterule=\footnoterule
10981 % \end{macrocode}
10982 % \end{macro}
10983 % \subsection{Footnotes arrangement}
10984 %
10985 % \subsubsection{User level macro}
10986 % \begin{macro}{\Xarrangement}
10987 % \protect\cs{Xarrangement}\oarg{s}\marg{arrangement}
10988 % The command calls, for each series, a specific command which set many counters and commands in order to define specific arrangement.
10989 %
10990 % \begin{macrocode}
10991 \newcommandx{\Xarrangement}[2][1,usedefault]{%
10992 \def\do##1{%
10993 \csname Xarrangement@#2\endcsname{##1}%
10994 }%
10995 \ifstrempty{#1}%
10996 {%
10997 \dolistloop{\@series}%
10998 }%
10999 {
11000 \docsvlist{#1}%
11001 }%
11002 }%
11003 % \end{macrocode}
11004 % \end{macro}
11005 % \subsubsection{Normal footnote}
11006 %
11007 % \begin{macro}{\Xarrangement@normal}
11008 % We can now define all the parameters for the series of
11009 % footnotes; initially they use the \enquote{normal} footnote formatting.
11010 %
11011 % What we want to do here is to insert something like the following
11012 % for each footnote series. (This is an example, not part of the
11013 % actual \macpackage{} code.)
11014 % \begin{verbatim}
11015 % \skip\Afootins=12pt plus5pt minus5pt
11016 % \count\Afootins=1000
11017 % \dimen\Afootins=0.8\vsize
11018 % \let\vAfootnote=\normalvfootnote \let\Afootfmt=\normalfootfmt
11019 % \let\Afootstart=\normalfootstart \let\Afootgroup=\normalfootgroup
11020 % \let\Afootnoterule=\normalfootnoterule
11021 % \end{verbatim}
11022 % (Read \thetexbook\ in order to understand what are the counter, skip and dimen associated to an insertion.)
11023 %
11024 % Instead of repeating ourselves, we define a \protect\cs{Xarrangement@normal}
11025 % macro that makes all these assignments for us, for any given
11026 % series letter.
11027 % This command is called when people use \protect\cs{Xarrangement}\oarg{series}\verb+{normal}+
11028
11029 %
11030 % Now we set up the \protect\cs{Xarrangement@normal} macro itself. It takes
11031 % one argument: the footnote series letter.
11032 % \begin{macrocode}
11033 \newcommand*{\Xarrangement@normal}[1]{%
11034 \csgdef{series@display#1}{normal}
11035 \expandafter\let\csname #1footstart\endcsname=\normalfootstart
11036 \expandafter\let\csname v#1footnote\endcsname=\normalvfootnote
11037 \expandafter\let\csname #1footfmt\endcsname=\normalfootfmt
11038 \expandafter\let\csname #1footgroup\endcsname=\normalfootgroup
11039 \expandafter\let\csname #1footnoterule\endcsname=%
11040 \normalfootnoterule
11041 \count\csname #1footins\endcsname=1000
11042 \dimen\csname #1footins\endcsname=\csuse{Xmaxhnotes@#1}
11043 \skip\csname #1footins\endcsname=\csuse{Xbeforenotes@#1}%
11044 \advance\skip\csname #1footins\endcsname by\csuse{Xafterrule@#1}%
11045 % \end{macrocode}
11046 % The \parpackage provides tools in order to confine notes to one side.
11047 % The mechanism is explained in the \parpackage's handbook.
11048 % For now, just retain we need to store default value of the counter associated to the notes \TeX's inserts.
11049
11050 % \begin{macrocode}
11051 \csxdef{default@#1footins}{1000}%Use this to confine the notes to one side only
11052 % \end{macrocode}
11053 % Now do the setup for minipage footnotes. We use as much as possible of the
11054 % normal setup as we can (so the notes will have a similar layout).
11055 % \changes{v0.4.0}{2004/02/29}{Added minpage footnote setup to \protect\cs{footnormal}}
11056 % \begin{macrocode}
11057 \ifnoledgroup@\else%
11058 \expandafter\let\csname mpv#1footnote\endcsname=\mpnormalvfootnote
11059 \expandafter\let\csname mp#1footgroup\endcsname=\mpnormalfootgroup
11060 \count\csname mp#1footins\endcsname=1000
11061 \dimen\csname mp#1footins\endcsname=\csuse{Xmaxhnotes@#1}
11062 \skip\csname mp#1footins\endcsname=\csuse{Xbeforenotes@#1}%
11063 \advance\skip\csname mp#1footins\endcsname by\csuse{Xafterrule@#1}%
11064 \fi
11065 }
11066
11067 % \end{macrocode}
11068 % \end{macro}
11069 %
11070 %
11071 %
11072 %
11073 % \begin{macro}{\normalvfootnote}
11074 % We now begin a series of commands that do \enquote{normal} footnote
11075 % formatting: a format much like that implemented
11076 % in \PlainTeX{}, in which each footnote
11077 % is a separate paragraph.
11078 %
11079 % \protect\cs{normalvfootnote} takes the series letter as \verb"#1"
11080 % and the entire text of the footnote is \verb"#2". It does the
11081 % \protect\cs{insert} for this note, calling on the \protect\cs{footfmt} macro for
11082 % this note series to format the text of the note.
11083 % \begin{macrocode}
11084 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\normalvfootnote}[2]{%
11085 \iftoggle{Xgroupbyline@#1}{%In the case we use \Xgroupbyline, the insertion is done later, in \add@Xgroupbyline.
11086 \prepare@Xgroupbyline{#1}{#2}{\normalvfootnote@inserted}%
11087 }{%In the case we don't use \Xgroupbyline, the insertion is made directly
11088 \X@beforeinsertion{#1}%
11089 \insert\csname #1footins\endcsname{%
11090 \X@atbegininsertion{#1}%
11091 \normalvfootnote@inserted{#1}{#2}%
11092 }%
11093 }%
11094 }%
11095 % \end{macrocode}
11096 % \end{macro}
11097 %
11098 % \begin{macro}{\normalvfootnote@inserted}
11099 % The \cs{normalvfootnote@inserted} macro is expanded to the content to be added to a \cs{insert} for normal critical footnote.
11100 % \begin{macrocode}
11101 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\normalvfootnote@inserted}[2]{%
11102 \nottoggle{Xgroupbyline@#1}{\noindent}{}\csuse{Xbhooknote@#1}%
11103 \csuse{Xnotefontsize@#1}%
11104 \iftoggle{Xgroupbyline@#1}{\strut}{}%
11105 \footsplitskips
11106 \ifl@dpairing\ifl@dpaging\else%
11107 \setXnoteswidthliketwocolumns@{#1}%
11108 \fi\fi%
11109 \setXnotespositionliketwocolumns@{#1}%
11110 \spaceskip=\z@skip \xspaceskip=\z@skip%
11111 \csname #1footfmt\endcsname #2{#1}%
11112 }%
11113 % \end{macrocode}
11114 % \end{macro}
11115 % \begin{macro}{\X@beforeinsertion}
11116 % \begin{macrocode}
11117 \newcommand{\X@beforeinsertion}[1]{%
11118 \if@ledgroup\else%
11119 \insert@Xtxtbeforenotes{#1}%
11120 \fi%
11121 \csuse{Xbeforeinserting@#1}%
11122 }%
11123 % \end{macrocode}
11124 % \end{macro}
11125 % \begin{macro}{\beforeinsertion@X}
11126 % \begin{macrocode}
11127 \newcommand{\beforeinsertion@X}[1]{%
11128 \if@ledgroup\else%
11129 \insert@txtbeforenotesX{#1}%
11130 \fi%
11131 \csuse{beforeinsertingX@#1}%
11132 }%
11133 % \end{macrocode}
11134 % \end{macro}
11135 % \begin{macro}{\X@atbegininsertion}
11136 % \begin{macrocode}
11137 \newcommand{\X@atbegininsertion}[1]{%
11138 \hsize=\expandafter\dimexpr\csuse{Xwidth@#1}\relax%
11139 }%
11140 % \end{macrocode}
11141 % \end{macro}
11142 % And somewhat different versions of \cs{normalvfootnote} and \cs{normalvfootnote@inserted} for minipages.
11143 % \begin{macro}{\mpnormalvfootnote}
11144 % \changes{v0.4.0}{2004/02/29}{Added \protect\cs{mpnormalvfootnote}}
11145 % \begin{macrocode}
11146 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\mpnormalvfootnote}[2]{%
11147 \iftoggle{Xgroupbyline@#1}{%
11148 \prepare@Xgroupbyline{#1}{#2}{\mpnormalvfootnote@inserted}%
11149 }%
11150 {%
11151 \global\setbox\@nameuse{mp#1footins}%
11152 \vbox{%
11153 \unvbox\@nameuse{mp#1footins}%
11154 \mpnormalvfootnote@inserted{#1}{#2}%
11155 }%
11156 }%
11157 }%
11158
11159 % \end{macrocode}
11160 % \end{macro}
11161 % \begin{macro}{\mpnormalvfootnote@inserted}
11162 % \begin{macrocode}
11163 \newcommand{\mpnormalvfootnote@inserted}[2]{%
11164 \noindent\csuse{Xbhooknote@#1}%
11165 \csuse{Xnotefontsize@#1}%
11166 \hsize\columnwidth%
11167 \@parboxrestore%
11168 \color@begingroup%
11169 \csname #1footfmt\endcsname #2{#1}\color@endgroup%
11170 }%
11171 % \end{macrocode}
11172 % \end{macro}
11173 % \begin{macro}{\normalfootfmt}
11174 % \label{normalfootfmt}
11175 % \protect\cs{normalfootfmt} is a \enquote{normal} macro
11176 % to take the footnote line and page
11177 % number information (see \reff{linenumbers}), and the
11178 % desired text, and output what's to be printed.
11179 % Argument \verb"#1" contains the line and page number information
11180 % and lemma font specifier;
11181 % \verb"#2" is the lemma;
11182 % \verb"#3" is the note's text;
11183 % \verb"#4" is the note's series.
11184 %
11185 % \begin{macrocode}
11186 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\normalfootfmt}[4]{%
11187 \Xstorelineinfo{#1}{#4}%
11188 \nottoggle{Xgroupbyline@#4}{\Xledsetnormalparstuff{#4}}{}%
11189 \Xsethangindent{#4}%
11190 \nottoggle{Xgroupbyline@#4}{\rule\z@\splittopskip}{}%
11191 \print@Xcomponents{#1}{#2}{#3}{#4}%
11192 \nottoggle{Xgroupbyline@#4}{\strut\par}{}%
11193 }%
11194 % \end{macrocode}
11195 % \end{macro}
11196 %
11197 % \begin{macro}{\normalfootstart}\label{normalvalues}
11198 % \phantomsection\relax
11199 % \protect\cs{normalfootstart}
11200 % is a standard footnote-starting macro, called in the output
11201 % routine whenever there are footnotes of this series to be
11202 % printed: it skips a bit and then draws a rule.
11203 %
11204 % Any \protect\cs{footstart} macro must put onto the page something that
11205 % takes up space exactly equal to the \protect\cs{skip}\protect\cs{Xfootins} value for
11206 % the associated series of notes. \TeX\ makes page computations based
11207 % on that \protect\cs{skip} value, and the output pages will suffer from
11208 % spacing problems if what you add takes up a different amount of
11209 % space.
11210 %
11211 % But if the skip \protect\cs{Xprenotes@} is greater than 0~pt,
11212 % it is used instead of \protect\cs{skip}\protect\cs{footins} for the first printed series in one page.
11213 %
11214 % The \protect\cs{leftskip} and \protect\cs{rightskip} values
11215 % are both zeroed here.
11216 % \label{footskips}
11217 % Similarly, these skips are cancelled in the \protect\cs{vfootnote} macros
11218 % for the various types of notes. Strictly speaking,
11219 % this is necessary only
11220 % if you are using paragraphed footnotes, but we have put it here
11221 % and in the other \protect\cs{vfootnote} macros too so that the behavior of
11222 % \macpackage{} in this respect is general across all footnote types.
11223 % What this means is that any \protect\cs{leftskip}
11224 % and \protect\cs{rightskip} you specify applies to the main text, but not
11225 % the footnotes. The footnotes continue to be of width \protect\cs{hsize}.
11226 % \begin{macrocode}
11227 \newcommand*{\normalfootstart}[1]{%
11228 % \end{macrocode}
11229 % The first series of notes printed in a page can have a specific skip before it.
11230 % In order to insert this specific skip without overlap the bottom margin of the page, Maïeul Rouquette have defined an algorithm explained in \reff{skipfirstseries}.
11231 % Here is part of this algorithm, when the block of notes are ready to be printed.
11232 % \begin{macrocode}
11233 \ifdimequal{0pt}{\Xprenotes@}{}%
11234 {%
11235 \iftoggle{Xprenotes@}{%
11236 \togglefalse{Xprenotes@}%
11237 \skip\csname #1footins\endcsname=%
11238 \glueexpr\csuse{Xprenotes@}+\csuse{Xafterrule@#1}\relax%
11239 }%
11240 {}%
11241 }%
11242 \vskip\skip\csname #1footins\endcsname%
11243 % \end{macrocode}
11244 % And now, the problem of left and right skip for notes.
11245 % Especially when using one feature of \parpackage which allows to have the footnotes horizontal size as the size of columns printed by \protect\cs{Columns}.
11246 % Read \reff{width2columns} for the general description of the problem.
11247 % \begin{macrocode}
11248 \leftskip0pt \rightskip0pt
11249 \parfillskip=0pt plus 1fil
11250 \ifl@dpairing\else%
11251 \hsize=\old@hsize%
11252 \fi%
11253 \setXnoteswidthliketwocolumns@{#1}%
11254 \setXnotespositionliketwocolumns@{#1}%
11255 % \end{macrocode}
11256 % And now, print the footnote's rule to finish the footnote's introduction.
11257 % \begin{macrocode}
11258 \print@Xfootnoterule{#1}%
11259 }%
11260 % \end{macrocode}
11261 % \end{macro}
11262 %
11263 %
11264 % \begin{macro}{\normalfootgroup}
11265 % \protect\cs{normalfootgroup} is
11266 % a standard footnote-grouping macro: it sends the
11267 % contents of the footnote-insert box to the output page without
11268 % alteration.
11269 % \begin{macrocode}
11270 \newcommand*{\normalfootgroup}[1]{%
11271 \csuse{Xbhookgroup@#1}%
11272 \unvbox\csname #1footins\endcsname%
11273 \hsize=\old@hsize%
11274 }%
11275
11276 % \end{macrocode}
11277 % \end{macro}
11278 %
11279 % \begin{macro}{\mpnormalfootgroup}
11280 % A somewhat different version for minipages.
11281 % Note that, in this case, we do not make distinctions between the \protect\cs{Xfootgroup} and \protect\cs{Xfootstarts} macros.
11282 % \changes{v0.4.0}{2004/02/29}{Added \protect\cs{mpnormalfootgroup}}
11283 % \begin{macrocode}
11284 \unless\ifnoledgroup@
11285 \newcommand*{\mpnormalfootgroup}[1]{{
11286 \vskip\skip\@nameuse{mp#1footins}
11287 \ifl@dpairing\ifparledgroup%
11288 \leavevmode\marks\parledgroup@{begin}%
11289 \marks\parledgroup@series{#1}%
11290 \marks\parledgroup@type{Xfootnote}%
11291 \fi\fi\normalcolor%
11292 \ifparledgroup%
11293 \ifl@dpairing%
11294 \else%
11295 \setXnoteswidthliketwocolumns@{#1}%
11296 \setXnotespositionliketwocolumns@{#1}%
11297 \print@Xfootnoterule{#1}%%
11298 \fi%
11299 \else%
11300 \setXnoteswidthliketwocolumns@{#1}%
11301 \setXnotespositionliketwocolumns@{#1}%
11302 \print@Xfootnoterule{#1}%%
11303 \fi%
11304 \setlength{\parindent}{0pt}
11305 \csuse{Xbhookgroup@#1}%
11306 \unvbox\csname mp#1footins\endcsname}}
11307 \fi
11308 % \end{macrocode}
11309 % \end{macro}
11310 %
11311 % \subsubsection{Paragraphed footnotes}
11312 %
11313 % The paragraphed-footnote option
11314 % reformats all the footnotes of one series for a page into
11315 % a single paragraph; this is especially appropriate when the notes are
11316 % numerous and brief. The code is based
11317 % on \thetexbook, pp.\,398--400, with
11318 % alterations for our environment. This algorithm uses a considerable
11319 % amount of save-stack space: a \TeX\ of ordinary size may not be able
11320 % to handle more than about $100$ notes of this kind on a page.
11321 %
11322 % \begin{macro}{\Xarrangement@paragraph}
11323 % The \protect\cs{Xarrangement@paragraph} macro
11324 % sets up everything for one series of the footnotes so that
11325 % they will be paragraphed; it takes the series letter as argument.
11326 % We include the setting of \verb"\count\footins" to $1000$ for the
11327 % footnote series just in case user is switching to paragraphed
11328 % footnotes after having columnar ones, since they change this
11329 % value (see below).
11330 %
11331 % The argument of \protect\cs{Xarrangement@footparagraph} is the letter
11332 % denoting the series of notes to be paragraphed.
11333 % \begin{macrocode}
11334 \newcommand*{\Xarrangement@paragraph}[1]{%
11335 \csgdef{series@display#1}{paragraph}
11336 \expandafter\let\csname #1footstart\endcsname=\parafootstart
11337 \expandafter\let\csname v#1footnote\endcsname=\paravfootnote
11338 \expandafter\let\csname #1footfmt\endcsname=\parafootfmt
11339 \expandafter\let\csname #1footgroup\endcsname=\parafootgroup
11340 \count\csname #1footins\endcsname=1000
11341 \csxdef{default@#1footins}{1000}%Use this to confine the notes to one side only
11342 \dimen\csname #1footins\endcsname=\csuse{Xmaxhnotes@#1}
11343 \skip\csname #1footins\endcsname=\csuse{Xbeforenotes@#1}%
11344 \advance\skip\csname #1footins\endcsname by\csuse{Xafterrule@#1}%
11345 \para@footsetup{#1}
11346 % \end{macrocode}
11347 % And the extra setup for minipages.
11348 % \begin{macrocode}
11349 \ifnoledgroup@\else
11350 \expandafter\let\csname mpv#1footnote\endcsname=\mpparavfootnote
11351 \expandafter\let\csname mp#1footgroup\endcsname=\mpparafootgroup
11352 \count\csname mp#1footins\endcsname=1000
11353 \dimen\csname mp#1footins\endcsname=\csuse{Xmaxhnotes@#1}
11354 \skip\csname mp#1footins\endcsname=\csuse{Xbeforenotes@#1}%
11355 \advance\skip\csname mp#1footins\endcsname by\csuse{Xafterrule@#1}%
11356 \fi
11357 }
11358 % \end{macrocode}
11359 % \end{macro}
11360 % \begin{macro}{\footfudgefiddle}
11361 % For paragraphed footnotes \TeX{} has to estimate the amount of space
11362 % required. If it underestimates this then the notes may get too long and
11363 % run off the bottom of the text block. \protect\cs{footfudgefiddle} can be increased
11364 % from its default 64 (say, to 70) to increase the estimate.
11365 % \changes{v0.2.2}{2003/11/04}{Added \protect\cs{footfudgefiddle}}
11366 % \begin{macrocode}
11367 \providecommand{\footfudgefiddle}{64}
11368 % \end{macrocode}
11369 % \end{macro}
11370 % \begin{macro}{\para@footsetup}
11371 % \protect\cs{footparagraph} calls the
11372 % \protect\cs{para@footsetup} macro to calculate a special
11373 % fudge factor, which is the ratio of the \protect\cs{baselineskip}
11374 % to the \protect\cs{hsize}. We assume that the proper value of
11375 % \protect\cs{baselineskip} for the footnotes (normally 9\,pt) has been set
11376 % already. The argument of the macro is
11377 % again the note series letter.
11378 %
11379 % Peter Wilson thinks that \protect\cs{columnwidth} should be used here for \LaTeX\, not \protect\cs{hsize}.
11380 % Peter Wilson have also included \protect\cs{footfudgefiddle}.
11381 % \changes{v0.2.2}{2003/11/04}{Added \protect\cs{footfudgefiddle} to \protect\cs{para@footsetup}}
11382 % \begin{macrocode}
11383 \newcommand*{\para@footsetup}[1]{{\csuse{Xbhookgroup@#1}\csuse{Xnotefontsize@#1}
11384 \setXnoteswidthliketwocolumns@{#1}%
11385 \ifcsempty{Xwidth@#1}%
11386 {}%
11387 {\columnwidth=\expandafter\dimexpr\csuse{Xwidth@#1}\relax}%
11388 \dimen0=\baselineskip
11389 \unless\ifdim\dimen0>\dimexpr\maxdimen/1024\relax%Historical, use \unless > because TeX don't have <=
11390 \multiply\dimen0 by 1024%
11391 \divide \dimen0 by \columnwidth%
11392 \multiply\dimen0 by \footfudgefiddle\relax%
11393 \else%For big baseline we multiply by 512, and later by 2
11394 \multiply\dimen0 by 512%
11395 \divide \dimen0 by \columnwidth%
11396 \multiply\dimen0 by \footfudgefiddle\relax%
11397 \multiply\dimen0 by 2\relax%
11398 \fi%
11399 \csxdef{#1footfudgefactor}{%
11400 \expandafter\strip@pt\dimen0 }}}
11401
11402 % \end{macrocode}
11403 % \end{macro}
11404 %
11405 % \protect\cs{strip@pt} strip the characters \verb"pt" from a dimen value.
11406 %
11407 % \begin{macro}{\parafootstart}
11408 % \protect\cs{parafootstart} is the same as \protect\cs{normalfootstart}, but we give it
11409 % again to ensure that \protect\cs{rightskip} and \protect\cs{leftskip} are
11410 % zeroed (this needs to be done before \protect\cs{para@footgroup} in the
11411 % output routine). The size of
11412 % paragraphed notes is calculated using a fudge factor which in
11413 % turn is based on \protect\cs{hsize}. So the paragraph of notes needs to be
11414 % that wide.
11415 %
11416 % The argument of the macro is again the note series letter.
11417 % \begin{macrocode}
11418 \newcommand*{\parafootstart}[1]{%
11419 \rightskip=0pt \leftskip=0pt%
11420 \Xsetparindent{#1}%
11421 \ifdimequal{0pt}{\Xprenotes@}{}%
11422 {%
11423 \iftoggle{Xprenotes@}{%
11424 \togglefalse{Xprenotes@}%
11425 \skip\csname #1footins\endcsname=%
11426 \glueexpr\csuse{Xprenotes@}+\csuse{Xafterrule@#1}\relax%
11427 }%
11428 {}%
11429 }%
11430 \vskip\skip\csname #1footins\endcsname%
11431 \setXnoteswidthliketwocolumns@{#1}%
11432 \setXnotespositionliketwocolumns@{#1}%
11433 \print@Xfootnoterule{#1}%
11434 \let\old@bidi@RTL@everypar\bidi@RTL@everypar%
11435 \let\bidi@RTL@everypar\@empty%
11436 \noindent\leavevmode%
11437 \let\bidi@RTL@everypar\old@bidi@RTL@everypar%
11438 \parfillskip=0pt plus 1fil%
11439 }%
11440 % \end{macrocode}
11441 % \end{macro}
11442 %
11443 % \begin{macro}{\paravfootnote}
11444 % \protect\cs{paravfootnote}
11445 % is a version of the \protect\cs{vfootnote} command that is used for
11446 % paragraphed notes. It gets appended to the \protect\cs{inserts@list} list
11447 % by an outer-level footnote command like \protect\cs{Afootnote}. The first
11448 % argument is the note series letter; the second is the full text
11449 % of the printed note itself, including line numbers, lemmata, and
11450 % footnote text.
11451 %
11452 % The initial model for this insertion is, of course, the
11453 % \verb"\insert\footins" definition in \thetexbook, p.\,398.
11454 % There, the footnotes are first collected up in hboxes, and these
11455 % hboxes are later unpacked and stuck together into a paragraph.
11456 %
11457 % However, Michael Downes\index{Downes, Michael} has pointed out
11458 % that because text in hboxes gets typeset in restricted horizontal
11459 % mode, there are some undesirable side-effects if you later want
11460 % to break such text across lines. In restricted horizontal mode,
11461 % where \TeX\ does not expect to have to break lines, it does not
11462 % insert certain items like \protect\cs{discretionary}s. If you later unbox
11463 % these hboxes and stick them together, as the \texbook{}
11464 % macros do to make these footnotes, you lose the ability to
11465 % hyphenate after an explicit hyphen. This can lead to overfull
11466 % \protect\cs{hbox}es when you would not expect to find them, and to the
11467 % uninitiated it might be very hard to see why the problem had
11468 % arisen.\footnote{Michael Downes, \enquote{Line Breaking in \protect\cs{unhbox}ed
11469 % Text}, \textit{TUGboat} \textbf{11} (1990), pp.\,605--612.}
11470 %
11471 % Wayne Sullivan\index{Sullivan, Wayne} pointed out to us another
11472 % subtle problem that arises from the same cause: \TeX\ also leaves
11473 % the \protect\cs{language} whatsit nodes out of the horizontal
11474 % list.\footnote{See \thetexbook, p.\,455 (editions after
11475 % January 1990).} So changes from one language to another will not
11476 % invoke the proper hyphenation rules in such footnotes. Since
11477 % critical editions often do deal with several languages,
11478 % especially in a footnotes, we really ought to get this bit of code
11479 % right.
11480 %
11481 % To get around these problems, Wayne suggested emendations to the
11482 % \texbook{} versions of these macros which are broadly the
11483 % same as those described by Michael: the central idea (also
11484 % suggested by Donald Knuth in a letter to Michael) is to avoid collecting
11485 % the text in an \protect\cs{hbox} in the first place, but instead to collect
11486 % it in a \protect\cs{vbox} whose width is (virtually)
11487 % infinite.\label{hboxproblem} The text is therefore typeset in
11488 % unrestricted horizontal mode, as a paragraph consisting of a
11489 % single long line. Later, there is an extra level of unboxing to
11490 % be done: we have to unpack the \protect\cs{vbox}, as well as the hboxes
11491 % inside it, but that is not too hard. For details, we refer you to
11492 % Michael's article, where the issues are clearly
11493 % explained.\footnote{Wayne supplied his own macros to do this, but
11494 % since they were almost identical to Michael's, Peter Wilson have used the
11495 % latter's \protect\cs{Xunvxh} macro since it is publicly
11496 % documented.} Michael's unboxing macro is called \protect\cs{Xunvxh}: unvbox,
11497 % extract the last line, and unhbox it.
11498 %
11499 % Doing things this way has an important
11500 % consequence:\label{nobreaks-detail} as Michael
11501 % pointed out, you really can't put an explicit line-break into a
11502 % note built in a \protect\cs{vbox} the way we are doing.\footnote{\enquote{Line
11503 % Breaking}, p.\,610.} In other words, be very careful not to use
11504 % \protect\cs{break}, or \verb"\penalty-10000", or any equivalent inside your
11505 % para-footnote.\label{nobreak} If you do, most of the note will
11506 % probably disappear. You \emph{are} allowed to make strong
11507 % suggestions; in fact \verb"\penalty-9999" will be quite okay. Just
11508 % do not make the break mandatory. We have not applied any of
11509 % Michael's solutions here, since we feel that the problem is
11510 % exiguous, and \macpackage{} is quite baroque enough already. If
11511 % you think you are having this problem, look up Michael's
11512 % solutions.
11513 %
11514 % One more thing; we set \protect\cs{leftskip} and \protect\cs{rightskip} to zero.
11515 % This has the effect of neutralizing any such skips which may
11516 % apply to the main text (cf.~\reff{footskips} above).
11517 % We need to do this, since \protect\cs{footfudgefactor} is calculated on
11518 % the assumption that the notes are \protect\cs{hsize} wide.
11519 %
11520 % So, finally, here is the modified foot-paragraph code, which
11521 % sets the footnote in vertical mode so that language and
11522 % discretionary nodes are included.
11523 %
11524 % \begin{macrocode}
11525 \newcommand*{\paravfootnote}[2]{%
11526 \csuse{Xbeforeinserting@#1}%
11527 \insert\csname #1footins\endcsname
11528 \bgroup
11529 \csuse{Xnotefontsize@#1}
11530 \footsplitskips
11531 \setbox0=\vbox{\hsize=\maxdimen%
11532 \let\bidi@RTL@everypar\@empty%
11533 \insert@Xtxtbeforenotes{#1}%
11534 \noindent\csuse{Xbhooknote@#1}%
11535 \csname #1footfmt\endcsname #2{#1}}%
11536 \setbox0=\hbox{\Xunvxh{0}{#1}}%
11537 \dp0=0pt
11538 \ht0=\csname #1footfudgefactor\endcsname\wd0
11539 % \end{macrocode}
11540 % Here we produce the contents of the footnote from box $0$, and
11541 % add a penalty of $0$ between boxes in this insert.
11542 % \begin{macrocode}
11543 \if@RTL\noindent \leavevmode\fi\box0%
11544 \penalty0
11545 \egroup}
11546
11547 % \end{macrocode}
11548 % The final penalty of $0$
11549 % was added here at Wayne's\index{Sullivan, Wayne}
11550 % suggestion to avoid a weird page-breaking problem, which occurs on
11551 % those occasions when \TeX\ attempts to split foot paragraphs.
11552 % After trying out such a split (see \thetexbook, p.\,124),
11553 % \TeX\ inserts a penalty of $-10000$ here, which
11554 % nearly always forces the break at the end of the whole footnote
11555 % paragraph (since individual notes can't be split) even when this
11556 % leads to an overfull vbox. The change above results in a penalty
11557 % of $0$ instead which allows, but does not force, such breaks. This
11558 % penalty of $0$ is later removed, after page breaks have been
11559 % decided, by the \protect\cs{unpenalty} macro in \protect\cs{makehboxofhboxes}. So it
11560 % does not affect how the footnote paragraphs are typeset (the
11561 % notes still have a penalty of $-10$ between them, which is added
11562 % by \protect\cs{parafootfmt}).
11563 % \end{macro}
11564 %
11565 % \begin{macro}{\mpparavfootnote}
11566 % This version is for minipages.
11567 % \begin{macrocode}
11568 \newcommand*{\mpparavfootnote}[2]{%
11569 \global\setbox\@nameuse{mp#1footins}\vbox{%
11570 \unvbox\@nameuse{mp#1footins}%
11571 \csuse{Xnotefontsize@#1}
11572 \footsplitskips
11573 \setbox0=\vbox{\hsize=\maxdimen%
11574 \let\bidi@RTL@everypar\@empty%
11575 \insert@Xtxtbeforenotes{#1}%
11576 \noindent\color@begingroup%
11577 \csuse{Xbhooknote@#1}%
11578 \csname #1footfmt\endcsname #2{#1}\color@endgroup}%
11579 \setbox0=\hbox{\Xunvxh{0}{#1}}%
11580 \dp0=\z@
11581 \ht0=\csname #1footfudgefactor\endcsname\wd0
11582 \box0
11583 \penalty0
11584 }}
11585
11586 % \end{macrocode}
11587 % \end{macro}
11588 %
11589 % \begin{macro}{\Xunvxh}
11590 % Here is (modified) Michael's\index{Downes, Michael} definition of \protect\cs{unvxh},
11591 % used above. Michael's macro also takes care to remove some
11592 % unwanted penalties and glue that \TeX\ automatically attaches to
11593 % the end of paragraphs. When \TeX\ finishes a paragraph, it
11594 % throws away any remaining glue, and then tacks on the following
11595 % items: a \protect\cs{penalty} of $10000$, a \protect\cs{parfillskip} and a
11596 % \protect\cs{rightskip} (\thetexbook, pp.\,99--100). \protect\cs{unvxh}
11597 % cancels these unwanted paragraph-final items using \protect\cs{unskip} and
11598 % \protect\cs{unpenalty}.
11599 % \begin{macrocode}
11600 \newcommand*{\Xunvxh}[2]{%
11601 \setbox0=\vbox{\unvbox#1%
11602 \global\setbox1=\lastbox}%
11603 \unhbox1
11604 \unskip % remove \rightskip,
11605 \unskip % remove \parfillskip,
11606 \unpenalty % remove \penalty of 10000,
11607 \hskip\csuse{Xafternote@#2}\relax}% add the glue to go between the notes
11608
11609 % \end{macrocode}
11610 % \end{macro}
11611 %
11612 %
11613 %
11614 % \begin{macro}{\parafootfmt}
11615 % \protect\cs{parafootfmt} is
11616 % \protect\cs{normalfootfmt} adapted to do the special stuff
11617 % needed for paragraphed notes --- leaving out the \protect\cs{endgraf} at the
11618 % end, sticking in special penalties and kern and leaving out the
11619 % \protect\cs{footstrut}. The first argument is the line and page
11620 % number information, the second is the lemma, the third is the
11621 % text of the footnote, and the fourth is the series (optional, for backward compatibility).
11622 % \begin{macrocode}
11623 \newcommand*{\parafootfmt}[4]{%
11624 \Xstorelineinfo{#1}{#4}%
11625 \Xinsertparafootsep{#4}%
11626 \ledsetnormalparstuff@common%
11627 \print@Xcomponents{#1}{#2}{#3}{#4}%
11628 \penalty-10%
11629 }%
11630 % \end{macrocode}
11631 % Note that in the above definition, the penalty of $-10$
11632 % encourages a line break between notes, so that notes have a
11633 % slight tendency to begin on new lines.
11634 % The \protect\cs{Xinsertparafootsep} command is used to insert the \protect\cs{Xparafootsep@series} between each note in the \emph{same} page.
11635 % \end{macro}
11636 %
11637 % \begin{macro}{\parafootgroup}
11638 % This \verb"footgroup" code is modelled on the macros in
11639 % \thetexbook, p.\,399. The only difference is the \protect\cs{unpenalty}
11640 % in \protect\cs{makehboxofhboxes}, which is there to remove the penalty of
11641 % $0$ which was added to the end of each footnote by
11642 % \protect\cs{paravfootnote}.
11643 %
11644 % The call to \protect\cs{Xnotefontsize@\meta{s}} is to ensure that the correct
11645 % \protect\cs{baselineskip} for the footnotes is used. The argument is the
11646 % note series letter.
11647 % \begin{macrocode}
11648 \newcommand*{\parafootgroup}[1]{%
11649 \hsize=\expandafter\dimexpr\csuse{Xwidth@#1}\relax%
11650 \unvbox\csname #1footins\endcsname
11651 \ifcsstring{Xragged@#1}{L}{\RaggedLeft}{}%
11652 \ifcsstring{Xragged@#1}{R}{\RaggedRight}{}%
11653 \makehboxofhboxes
11654 \setbox0=\hbox{\unhbox0 \removehboxes}%
11655 \csuse{Xbhookgroup@#1}%
11656 \csuse{Xnotefontsize@#1}%
11657 \unhbox0\par%
11658 \global\hsize=\old@hsize%
11659 }%
11660
11661 % \end{macrocode}
11662 % \end{macro}
11663 %
11664 % \begin{macro}{\mpparafootgroup}
11665 % The minipage version.
11666 % \begin{macrocode}
11667 \newcommand*{\mpparafootgroup}[1]{{%
11668 \setXnoteswidthliketwocolumns@{#1}%
11669 \vskip\skip\@nameuse{mp#1footins}
11670 \ifl@dpairing\ifparledgroup%
11671 \leavevmode\marks\parledgroup@{begin}%
11672 \marks\parledgroup@series{#1}%
11673 \marks\parledgroup@type{Xfootnote}%
11674 \fi\fi\normalcolor
11675 \ifparledgroup%
11676 \ifl@dpairing%
11677 \else%
11678 \setXnoteswidthliketwocolumns@{#1}%
11679 \setXnotespositionliketwocolumns@{#1}%
11680 \print@Xfootnoterule{#1}%%
11681 \fi%
11682 \else%
11683 \setXnoteswidthliketwocolumns@{#1}%
11684 \setXnotespositionliketwocolumns@{#1}%
11685 \print@Xfootnoterule{#1}%
11686 \fi%
11687 \unvbox\csname mp#1footins\endcsname
11688 \ifcsstring{Xragged@#1}{L}{\RaggedLeft}{}%
11689 \ifcsstring{Xragged@#1}{R}{\RaggedRight}{}%
11690 \makehboxofhboxes
11691 \setbox0=\hbox{\unhbox0 \removehboxes}%
11692 \csuse{Xbhookgroup@#1}%
11693 \csuse{Xnotefontsize@#1}%
11694 \Xsetparindent{#1}%
11695 \unhbox0\par}}
11696
11697 % \end{macrocode}
11698 % \end{macro}
11699 %
11700 % And finally, the two macros which are required to transform the long horizontal box stored in the insert' box to a printable text.
11701 %
11702 % \begin{macro}{\makehboxofhboxes}
11703 % \begin{macro}{\removehboxes}
11704 % \begin{macrocode}
11705 \newcommand*{\makehboxofhboxes}{\setbox0=\hbox{}%
11706 \loop
11707 \unpenalty
11708 \setbox2=\lastbox
11709 \ifhbox2
11710 \setbox0=\hbox{\box2\unhbox0}%
11711 \repeat}
11712
11713 \newcommand*{\removehboxes}{\setbox0=\lastbox
11714 \ifhbox0{\removehboxes}\unhbox0 \fi}
11715
11716 % \end{macrocode}
11717 % \end{macro}
11718 % \end{macro}
11719 %
11720 % \paragraph{Insertion of the footnotes separator}
11721 %The command \protect\cs{Xinsertparafootsep}\marg{series} must be called at the beginning of \protect\cs{parafootftm}.
11722 % \begin{macro}{\prevpage@num}
11723 % \changes{v1.8.0}{2013/12/13}{Correct \protect\cs{parafootsep} when using with ledgroup.}
11724 % \changes{v1.22.1}{2015/04/29}{Correct double symbol when using both \protect\cs{parafootsep} and \protect\cs{Xsymlinenum}.}
11725 % \begin{macro}{\Xinsertparafootsep}
11726 % \begin{macrocode}
11727 \newcommand{\Xinsertparafootsep}[1]{%
11728 \ifledRcol@%
11729 \ifnumequal{\csuse{#1prevpage@numR}}{\page@numR}%
11730 {\ifcsdef{prevline#1}% Be sur \prevline#1 exists.
11731 {\ifcsequal{prevline#1}{lineinfo@}%
11732 {\ifcsempty{Xsymlinenum@#1}{\csuse{Xparafootsep@#1}}{}}%
11733 {\csuse{Xparafootsep@#1}}%
11734 }%
11735 {\csuse{Xparafootsep@#1}}%
11736 }%
11737 {}%
11738 \global\csname #1prevpage@numR\endcsname=\page@numR%
11739 \else%
11740 \ifnumequal{\csuse{#1prevpage@num}}{\page@num}%
11741 {\ifcsdef{prevline#1}% Be sur \prevline#1 exists.
11742 {\ifcsequal{prevline#1}{lineinfo@}%
11743 {\ifcsempty{Xsymlinenum@#1}{\csuse{Xparafootsep@#1}}{}}%
11744 {\csuse{Xparafootsep@#1}}%
11745 }%
11746 {\csuse{Xparafootsep@#1}}%
11747 }%
11748 {}%
11749 \global\csname #1prevpage@num\endcsname=\page@num%
11750 \fi%
11751 }
11752 % \end{macrocode}
11753 % \end{macro}
11754 % \end{macro}
11755 % \subsubsection{Columnar footnotes}
11756 %
11757 % \paragraph{Common tools}
11758 % \begin{macro}{\rigidbalance}
11759 % \begin{macro}{\rigidbalanceX}
11760 % \begin{macro}{\Xrigidbalance}
11761 % \begin{macro}{\dosplits}
11762 % \begin{macro}{\splitoff}
11763 % \begin{macro}{\@h}
11764 % \begin{macro}{\@k}
11765 % We will now define macros for three-column notes and two-column
11766 % notes. Both sets of macros will use \protect\cs{rigidbalance}, which splits a
11767 % box (\verb"#1") into into a number (\verb"#2") of columns, each
11768 % with a space (\verb"#3") between the top baseline and the top of
11769 % the \protect\cs{vbox}. The \protect\cs{rigidbalance} macro is taken from
11770 % \thetexbook, p.\,397, with a slight change to the syntax of
11771 % the arguments so that they do not depend on white space. Note also
11772 % the extra unboxing in \protect\cs{splitoff}, which allows the new \protect\cs{vbox} to
11773 % have its natural height as it goes into the alignment.
11774 %
11775 % Note also the use of \cs{@separator} which allows to define any
11776 % vertical rule (using \cs{Xcolseparator} and \cs{colseparatorX})
11777 % The \LaTeX\ \protect\cs{line} macro has no relationship to the
11778 % TeX \protect\cs{line}. The \LaTeX\ equivalent is \protect\cs{@@line}.
11779 % \changes{v2.7.0}{2015/11/29}{\protect\cs{rigidbalance} is split in \protect\cs{Xrigidbalance} and \protect\cs{rigidbalanceX}.}
11780 %
11781 % We do not call directly \cs{rigidbalance}, but we call \cs{Xrigidbalance} for critical notes and \cs{rigidbalanceX} for familiar notes. Both of them call \cs{rigidbalance}.
11782 % \begin{macrocode}
11783 \newcount\@k%
11784 \newcount\@k@initial%
11785 \newdimen\@h%
11786 \newcommand*{\Xrigidbalance}[3]{%
11787 \hsize=\expandafter\dimexpr\csuse{Xwidth@\@currentseries}\relax%
11788 \gdef\@separator{\csuse{Xcolseparator@\@currentseries}}%
11789 \rigidbalance{#1}{#2}{#3}%
11790 \global\undef\@separator%
11791 }%
11792
11793 \newcommand*{\rigidbalanceX}[3]{%
11794 \hsize=\expandafter\dimexpr\csuse{widthX@\@currentseries}\relax%
11795 \gdef\@separator{\csuse{colseparatorX@\@currentseries}}%
11796 \rigidbalance{#1}{#2}{#3}%
11797 \global\undef\@separator%
11798 }%
11799
11800 \newcommand*{\rigidbalance}[3]{%
11801 \setbox0=\box#1%
11802 \@k=#2%
11803 \@h=#3%
11804 \@k@initial=#2%
11805 \@@line{\splittopskip=\@h \vbadness=\@M \hfilneg
11806 \valign{##\vfil\cr\dosplits}}%
11807 }%
11808
11809 \newcommand*{\dosplits}{%
11810 \ifnum\@k>0%
11811 \noalign{%
11812 \hfil%
11813 \ifnum\@k<\@k@initial%
11814 \@separator%
11815 \fi%
11816 }%
11817 \splitoff%
11818 \global\advance\@k-1%
11819 \cr\dosplits%
11820 \fi%
11821 }%
11822
11823 \newcommand*{\splitoff}{\dimen0=\ht0
11824 \divide\dimen0 by\@k \advance\dimen0 by\@h
11825 \setbox2 \vsplit0 to \dimen0
11826 \unvbox2 }
11827
11828 % \end{macrocode}
11829 % \end{macro}
11830 % \end{macro}
11831 % \end{macro}
11832 % \end{macro}
11833 % \end{macro}
11834 % \end{macro}
11835 % \end{macro}
11836 %
11837 % \paragraph{Three columns}
11838 %
11839 % \begin{macro}{\Xarrangement@threecol}
11840 % \begin{macrocode}
11841 \newcommand*{\Xarrangement@threecol}[1]{%
11842 \csgdef{series@display#1}{threecol}
11843 \expandafter\let\csname v#1footnote\endcsname=\threecolvfootnote
11844 \expandafter\let\csname #1footfmt\endcsname=\threecolfootfmt
11845 \expandafter\let\csname #1footgroup\endcsname=\threecolfootgroup
11846 \dimen\csname #1footins\endcsname=\csuse{Xmaxhnotes@#1}%
11847 \skip\csname #1footins\endcsname=\csuse{Xbeforenotes@#1}%
11848 \advance\skip\csname #1footins\endcsname by\csuse{Xafterrule@#1}%
11849 \threecolfootsetup{#1}
11850 % \end{macrocode}
11851 % The additional setup for minipages.
11852 % \begin{macrocode}
11853 \ifnoledgroup@\else
11854 \expandafter\let\csname mpv#1footnote\endcsname=\mpnormalvfootnote
11855 \expandafter\let\csname mp#1footgroup\endcsname=\mpthreecolfootgroup
11856 \skip\csname mp#1footins\endcsname=\csuse{Xbeforenotes@#1}%
11857 \advance\skip\csname mp#1footins\endcsname by\csuse{Xafterrule@#1}%
11858 \mpthreecolfootsetup{#1}
11859 \fi
11860 }
11861
11862 % \end{macrocode}
11863 % The \protect\cs{footstart} and \protect\cs{footnoterule} macros for these notes assume
11864 % the normal values (\reff{normalvalues} above).
11865 % \end{macro}
11866 %
11867 % \begin{macro}{\threecolfootsetup}
11868 % The \protect\cs{threecolfootsetup} macro calculates and sets some numbers
11869 % for three-column footnotes.
11870 %
11871 % We set the \protect\cs{count} of the foot insert to $333$.
11872 % Each footnote can be thought of as contributing only one third of
11873 % its height to the page, since the footnote insertion has been
11874 % made as a long narrow column, which then gets trisected by the
11875 % \protect\cs{rigidbalance} routine (inside \protect\cs{threecolfootgroup}).
11876 % These new, shorter columns are saved in a box, and then that box
11877 % is \emph{put back} into the footnote insert, replacing the
11878 % original collection of the footnotes. This new box is, therefore,
11879 % only about a third of the height of the original one.
11880 %
11881 % The \protect\cs{dimen} value for this note series has to change in the
11882 % inverse way: it needs to be three times
11883 % the actual limit on the amount of space these notes are allowed to
11884 % fill on the page, because when \TeX\ is
11885 % accumulating material for the page
11886 % and checking that limit, it does not apply the \protect\cs{count} scaling.
11887 % \begin{macrocode}
11888 \newcommand*{\threecolfootsetup}[1]{%
11889 \count\csname #1footins\endcsname 333
11890 \csxdef{default@#1footins}{333}%Use this to confine the notes to one side only
11891 \multiply\dimen\csname #1footins\endcsname \thr@@}
11892 % \end{macrocode}
11893 % \end{macro}
11894 %
11895 % \begin{macro}{\mpthreecolfootsetup}
11896 % The setup for minipages.
11897 % \begin{macrocode}
11898 \newcommand*{\mpthreecolfootsetup}[1]{%
11899 \count\csname mp#1footins\endcsname 333
11900 \multiply\dimen\csname mp#1footins\endcsname \thr@@}
11901
11902 % \end{macrocode}
11903 % \end{macro}
11904 %
11905 % \begin{macro}{\threecolvfootnote}
11906 % \protect\cs{threecolvfootnote}
11907 % This is the \protect\cs{vfootnote} command for three-column notes.
11908 % However, most of the code is deported on \cs{threecolvfootnote@inserted}.
11909 % The call to \protect\cs{Xnotefontsize@\meta{s}} ensures that the
11910 % \protect\cs{splittopskip} and \protect\cs{splitmaxdepth} take their values
11911 % from the right \protect\cs{strutbox}: the one used in a footnotes.
11912 % Note especially the importance of temporarily reducing the
11913 % \protect\cs{hsize} to $0.3$ of its normal value. This determines the
11914 % widths of the individual columns. So if the normal \protect\cs{hsize}
11915 % is (say) 10\,cm, then each column will be $0.3\times10=3$\,cm
11916 % wide, leaving a gap of 1\,cm spread equally between columns
11917 % (i.e., .5\,cm between each).
11918 %
11919 % The arguments are \verb+#1+~the note series letter and \verb+#1+~the full text
11920 % of the note (including numbers, lemma and text).
11921 % \begin{macrocode}
11922 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\threecolvfootnote}[2]{%
11923 \iftoggle{Xgroupbyline@#1}{%
11924 \prepare@Xgroupbyline{#1}{#2}{\threecolvfootnote@inserted}%
11925 }%
11926 {%
11927 \let\bidi@RTL@everypar\relax%
11928 \X@beforeinsertion{#1}%
11929 \insert\csname #1footins\endcsname{%
11930 \threecolvfootnote@inserted{#1}{#2}%
11931 }%
11932 }%
11933 }%
11934 % \end{macrocode}
11935 % \end{macro}
11936 % \begin{macro}{\threecolvfootnote@inserted}%
11937 % \begin{macrocode}
11938 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\threecolvfootnote@inserted}[2]{%
11939 \hsize=\expandafter\dimexpr\csuse{Xwidth@#1}\relax%
11940 \noindent\csuse{Xbhooknote@#1}%
11941 \csuse{Xnotefontsize@#1}%
11942 \footsplitskips%
11943 \csname #1footfmt\endcsname #2{#1}%
11944 }%
11945 % \end{macrocode}
11946 % \end{macro}
11947 %
11948 % \begin{macro}{\threecolfootfmt}
11949 % \protect\cs{threecolfootfmt}
11950 % is the command that formats one note.
11951 % The arguments are \verb+#1+~the line numbers, \verb+#2+~the lemma and \verb+#4+~the
11952 % text of the \verb"-footnote" command \verb+#4+ optional (for backward compatibility): the series.
11953 %
11954 % \begin{macrocode}
11955 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\threecolfootfmt}[4]{%
11956 \Xstorelineinfo{#1}{#4}%
11957 \threecol@begin@insert{#4}%
11958 \hspace{\parindent}%
11959 \print@Xcomponents{#1}{#2}{#3}{#4}%
11960 \nottoggle{Xgroupbyline@#4}%
11961 {\strut\par\allowbreak}%
11962 {}%
11963 }%
11964 % \end{macrocode}
11965 % \end{macro}
11966 % \begin{macro}{\threecol@begin@insert}
11967 % The \cs{threecol@begin@insert} contains code used at the beginning of any \cs{insert} for critical footnotes in three columns. It is used both by \cs{threecolfootfmt} and by \cs{insert@Xtxtbeforenotes}.
11968 % \begin{macrocode}
11969 \newcommand{\threecol@begin@insert}[1]{%
11970 \normal@pars%
11971 \nottoggle{Xgroupbyline@#1}%
11972 {\hsize \csuse{Xhsizethreecol@#1}}%
11973 {}%
11974 \Xsetparindent{#1}%
11975 \tolerance=5000%
11976 \Xsethangindent{#1}%
11977 \@tempdima=\parindent%
11978 \csuse{Xcolalign@#1}%
11979 \parindent=\@tempdima%
11980 \strut%
11981 }%
11982 % \end{macrocode}
11983 % \end{macro}
11984 % \begin{macro}{\threecolfootgroup}
11985 % And here is the \verb"footgroup" macro that is called within the
11986 % output routine to regroup the notes into three columns. Once
11987 % again, the call to \protect\cs{Xnotefontsize@\meta{s}} is there to ensure that
11988 % it is the right \protect\cs{splittopskip}---the one used in
11989 % footnotes---which is used to provide the third argument for
11990 % \protect\cs{rigidbalance}. This third argument (\protect\cs{@h}) is the
11991 % \verb"topskip" for the box containing the text of the
11992 % footnotes, and does the job of making sure the top lines of the
11993 % columns line up horizontally. In \thetexbook, p.\,398,
11994 % Donald Knuth suggests retrieving the ouput of \protect\cs{rigidbalance},
11995 % putting it back into the insertion box, and then printing the
11996 % box. Here, we just print the \protect\cs{line} which comes out of
11997 % \protect\cs{rigidbalance} directly, without any re-boxing.
11998 % \begin{macrocode}
11999 \newcommand*{\threecolfootgroup}[1]{%
12000 \begingroup%
12001 \csuse{Xbhookgroup@#1}%
12002 \csuse{Xnotefontsize@#1}%
12003 \par%
12004 \splittopskip=\ht\strutbox%
12005 \expandafter%
12006 \Xrigidbalance\csname #1footins\endcsname \thr@@ \splittopskip%
12007 \endgroup%
12008 }%
12009 % \end{macrocode}
12010 % \end{macro}
12011 %
12012 % \begin{macro}{\mpthreecolfootgroup}
12013 % The setup for minipages.
12014 % \begin{macrocode}
12015 \newcommand*{\mpthreecolfootgroup}[1]{{%
12016 \vskip\skip\@nameuse{mp#1footins}
12017 \ifl@dpairing\ifparledgroup%
12018 \leavevmode\marks\parledgroup@{begin}%
12019 \marks\parledgroup@series{#1}%
12020 \marks\parledgroup@type{Xfootnote}%
12021 \fi\fi\normalcolor
12022 \ifparledgroup%
12023 \ifl@dpairing%
12024 \else%
12025 \setXnoteswidthliketwocolumns@{#1}%
12026 \setXnotespositionliketwocolumns@{#1}%
12027 \print@Xfootnoterule{#1}%
12028 \fi%
12029 \else%
12030 \setXnoteswidthliketwocolumns@{#1}%
12031 \setXnotespositionliketwocolumns@{#1}%
12032 \print@Xfootnoterule{#1}%
12033 \fi%
12034 \csuse{Xbhookgroup@#1}\par%
12035 \splittopskip=\ht\strutbox
12036 \expandafter
12037 \Xrigidbalance\csname mp#1footins\endcsname \thr@@ \splittopskip}}
12038
12039 % \end{macrocode}
12040 % \end{macro}
12041 % \paragraph{Two columns}
12042 %
12043 % \begin{macro}{\Xarrangement@twocol}
12044 % \begin{macrocode}
12045 \newcommand*{\Xarrangement@twocol}[1]{%
12046 \csgdef{series@display#1}{twocol}
12047 \expandafter\let\csname v#1footnote\endcsname=\twocolvfootnote
12048 \expandafter\let\csname #1footfmt\endcsname=\twocolfootfmt
12049 \expandafter\let\csname #1footgroup\endcsname=\twocolfootgroup
12050 \dimen\csname #1footins\endcsname=\csuse{Xmaxhnotes@#1}%
12051 \skip\csname #1footins\endcsname=\csuse{Xbeforenotes@#1}%
12052 \advance\skip\csname #1footins\endcsname by\csuse{Xafterrule@#1}%
12053 \twocolfootsetup{#1}
12054 % \end{macrocode}
12055 % The additional setup for minipages.
12056 % \begin{macrocode}
12057 \ifnoledgroup@\else
12058 \expandafter\let\csname mpv#1footnote\endcsname=\mpnormalvfootnote
12059 \expandafter\let\csname mp#1footgroup\endcsname=\mptwocolfootgroup
12060 \skip\csname mp#1footins\endcsname=\csuse{Xbeforenotes@#1}%
12061 \advance\skip\csname mp#1footins\endcsname by\csuse{Xafterrule@#1}%
12062 \mptwocolfootsetup{#1}
12063 \fi
12064 }
12065
12066 % \end{macrocode}
12067 % \end{macro}
12068 %
12069 % \begin{macro}{\twocolfootsetup}
12070 % \begin{macro}{\twocolvfootnote}
12071 % \begin{macro}{\twocolvfootnote@inserted}
12072 % \begin{macro}{\twocolfootfmt}
12073 % \begin{macro}{\twocolfootgroup}
12074 % Here is a series of macros which are very similar to their
12075 % three-column counterparts. In this case,
12076 % each note is assumed to contribute only a half a line of text.
12077 % And the notes are set in columns
12078 % giving a gap between them of one tenth
12079 % of the \protect\cs{hsize}.
12080 % \begin{macrocode}
12081 \newcommand*{\twocolfootsetup}[1]{%
12082 \count\csname #1footins\endcsname 500
12083 \csxdef{default@#1footins}{500}%
12084 \multiply\dimen\csname #1footins\endcsname \tw@}
12085 % \end{macrocode}
12086 % \begin{macrocode}
12087 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\twocolvfootnote}[2]{%
12088 \iftoggle{Xgroupbyline@#1}{%
12089 \prepare@Xgroupbyline{#1}{#2}{\twocolvfootnote@inserted}%
12090 }{%
12091 \let\bidi@RTL@everypar\relax%
12092 \X@beforeinsertion{#1}%
12093 \insert\csname #1footins\endcsname{%
12094 \twocolvfootnote@inserted{#1}{#2}%
12095 }%
12096 }%
12097 }%
12098 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\twocolvfootnote@inserted}[2]{%
12099 \hsize=\expandafter\dimexpr\csuse{Xwidth@#1}\relax%
12100 \noindent\csuse{Xbhooknote@#1}%
12101 \csuse{Xnotefontsize@#1}%
12102 \footsplitskips%
12103 \csname #1footfmt\endcsname #2{#1}%
12104 }%
12105 % \end{macrocode}
12106 % \begin{macrocode}
12107 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\twocolfootfmt}[4]{% 4th arg is optional, for backward compatibility
12108 \Xstorelineinfo{#1}{#4}%
12109 \twocol@begin@insert{#4}%
12110 \hspace{\parindent}%
12111 \print@Xcomponents{#1}{#2}{#3}{#4}%
12112 \nottoggle{Xgroupbyline@#4}%
12113 {\strut\par\allowbreak}%
12114 {}%
12115 }%
12116 % \end{macrocode}
12117 % \begin{macrocode}
12118 \newcommand{\twocol@begin@insert}[1]{%
12119 \normal@pars%
12120 \nottoggle{Xgroupbyline@#1}%
12121 {\hsize \csuse{Xhsizetwocol@#1}}%
12122 {}%
12123 \Xsetparindent{#1}%
12124 \tolerance=5000%
12125 \Xsethangindent{#1}%
12126 \@tempdima=\parindent%
12127 \csuse{Xcolalign@#1}%
12128 \parindent=\@tempdima%
12129 \strut%
12130 }%
12131
12132 \newcommand*{\twocolfootgroup}[1]{%
12133 \begingroup%
12134 \csuse{Xbhookgroup@#1}%
12135 \csuse{Xnotefontsize@#1}%
12136 \par%
12137 \splittopskip=\ht\strutbox%
12138 \expandafter%
12139 \Xrigidbalance\csname #1footins\endcsname \tw@ \splittopskip%
12140 \endgroup%
12141 }%
12142
12143 % \end{macrocode}
12144 % \end{macro}
12145 % \end{macro}
12146 % \end{macro}
12147 % \end{macro}
12148 % \end{macro}
12149 %
12150 % \begin{macro}{\mptwocolfootsetup}
12151 % \begin{macro}{\mptwocolfootgroup}
12152 % The versions for minipages.
12153 % \begin{macrocode}
12154 \newcommand*{\mptwocolfootsetup}[1]{%
12155 \count\csname mp#1footins\endcsname 500
12156 \multiply\dimen\csname mp#1footins\endcsname \tw@}
12157 % \end{macrocode}
12158 % \begin{macrocode}
12159 \newcommand*{\mptwocolfootgroup}[1]{{%
12160 \vskip\skip\@nameuse{mp#1footins}
12161 \ifl@dpairing\ifparledgroup%
12162 \leavevmode\marks\parledgroup@{begin}%
12163 \marks\parledgroup@series{#1}%
12164 \marks\parledgroup@type{Xfootnote}%
12165 \fi\fi\normalcolor
12166 \ifparledgroup%
12167 \ifl@dpairing%
12168 \else%
12169 \setXnoteswidthliketwocolumns@{#1}%
12170 \setXnotespositionliketwocolumns@{#1}%
12171 \print@Xfootnoterule{#1}%
12172 \fi%
12173 \else%
12174 \setXnoteswidthliketwocolumns@{#1}%
12175 \setXnotespositionliketwocolumns@{#1}%
12176 \print@Xfootnoterule{#1}%
12177 \fi%
12178 \csuse{Xbhookgroup@#1}\par%
12179 \splittopskip=\ht\strutbox
12180 \expandafter
12181 \Xrigidbalance\csname mp#1footins\endcsname \tw@ \splittopskip}}
12182
12183 % \end{macrocode}
12184 % \end{macro}
12185 % \end{macro}
12186 %
12187 %
12188 % \subsection{Footnote paragraph indent}
12189 % \begin{macro}{\Xsetparindent}
12190 % \begin{macro}{\setparindentX}
12191 % These two commands set the paragraph indentation of the footnotes, depending on the settings of the user.
12192 % \begin{macrocode}
12193 \newdimen\old@parindent%
12194 \AtBeginDocument{\old@parindent=\parindent}%
12195 \newcommand{\Xsetparindent}[1]{%
12196 \nottoggle{Xparindent@#1}{%
12197 \parindent=\z@%
12198 }%
12199 {%
12200 \parindent=\old@parindent%
12201 }%
12202 }%
12203 \newcommand{\setparindentX}[1]{%
12204 \nottoggle{parindentX@#1}{%
12205 \parindent=\z@%
12206 }%
12207 {%
12208 \parindent=\old@parindent%
12209 }%
12210 }%
12211 % \end{macrocode}
12212 % \end{macro}
12213 % \end{macro}
12214 % \subsection{Footnote hanging indent}
12215 % \begin{macro}{\Xsethangindent}
12216 % \begin{macro}{\sethangindentX}
12217 % \cs{Xsethangindent} sets the hangindent for a critical footnote, while \cs{sethangindentX} does it for a familiar footnote.
12218 % \begin{macrocode}
12219 \newcommand{\Xsethangindent}[1]{%
12220 \if@RTL%
12221 \hangindent=-\csuse{Xhangindent@#1}%
12222 \everypar{\hangindent=-\csuse{Xhangindent@#1}}%
12223 \else%
12224 \hangindent=\csuse{Xhangindent@#1}%
12225 \everypar{\hangindent=\csuse{Xhangindent@#1}}%
12226 \fi%
12227 }%
12228 \newcommand{\sethangindentX}[1]{%
12229 \if@RTL%
12230 \hangindent=-\csuse{hangindentX@#1}%
12231 \everypar{\hangindent=-\csuse{hangindentX@#1}}%
12232 \else%
12233 \hangindent=\csuse{hangindentX@#1}%
12234 \everypar{\hangindent=\csuse{hangindentX@#1}}%
12235 \fi%
12236 }%
12237 % \end{macrocode}
12238 % \end{macro}
12239 % \end{macro}
12240 % \subsection{Critical notes presentation}
12241 % Here, we define some commons macro which are used in order to print a critical notes, that is a note with 1) line number 2) lemma 3) lemma separator 4) text associated to the lemma.
12242
12243 % \subsubsection{Font tools}
12244 % \begin{macro}{\endashchar}
12245 % \begin{macro}{\fullstop}
12246 % \begin{macro}{\rbracket}
12247 % The fonts that are used for printing notes might not have the
12248 % character mapping we expect: for example, the Computer Modern font
12249 % that contains old-style numerals does not contain an en-dash or
12250 % square brackets, and its period and comma are in odd locations.
12251 % To allow use of the standard footnote macros with such fonts, we use
12252 % the following macros for certain characters.
12253 %
12254 % The \protect\cs{endashchar} macro is simply an en-dash from the
12255 % normal font and is immune to changes in the surrounding
12256 % font. The same goes for the full stop. These two are used in
12257 % \protect\cs{printlines}. The right bracket macro is the same again;
12258 % it crops up in \protect\cs{normalfootfmt} and the other footnote
12259 % macros for controlling the format of the footnotes.
12260 %
12261 % Note that these commands are not directly called by \macpackage, but are enclosed as default value of specific hooks.
12262 % Consequently, people should not redefine them, but use instead the \cs{Xlinerangeseparator}, \cs{Xendlinerangeseparator}, \cs{Xsublinesep}, \cs{Xendsublinesep} and \cs{Xlemmaseparator} macros.
12263 %
12264 % With \protect\package{polyglossia}, each critical note has a \protect\cs{footnote@lang} which shows the language of the lemma,
12265 % and which can be used to switch the bracket from right to left.
12266 % \changes{v1.4.0}{2012/11/16}{Switch the right bracket to a left bracket when the lemma is RTL (needs polyglossia or LuaTeX).}
12267 % \begin{macrocode}
12268 \def\endashchar{\textnormal{--}}
12269
12270 \newcommand*{\fullstop}{\textnormal{.}}
12271 \def\Xsublinesep@side{\fullstop}
12272
12273 \newcommand*{\rbracket}{\textnormal{%
12274 \csuse{text\csuse{footnote@lang}}{%
12275 \ifluatex%
12276 \ifdefstring{\footnote@luatextextdir}{TRT}{\thinspace[}{\thinspace]}%
12277 \else%
12278 \thinspace]%
12279 \fi}%
12280 }%
12281 }
12282
12283 % \end{macrocode}
12284 % \end{macro}
12285 % \end{macro}
12286 % \end{macro}
12287 %
12288 % \subsubsection{Pstart number in footnote}
12289 % \begin{macro}{\printpstart}
12290 % The \protect\cs{printpstart} macro prints the pstart number for a note.
12291 % \changes{v1.18.0}{2015/02/23}{Debug \protect\cs{Xpstart} with parallel pages and columns (eledpar)}
12292 % \begin{macrocode}
12293 \newcommand{\printpstart}[0]{%
12294 \ifboolexpr{bool{l@dpairing} or bool{l@dprintingpages} or bool{l@dprintingcolumns}}{%
12295 \ifledRcol%
12296 \thepstartR%
12297 \else%
12298 \thepstartL%
12299 \fi%
12300 }{%
12301 \thepstart%
12302 }%
12303 }
12304 % \end{macrocode}
12305 %
12306 % \end{macro}
12307 % \subsection{Print critical footnotes components}
12308 % The components of a critical footnote are :
12309 % \begin{itemize}
12310 % \item \#1 The line number information (passed in a formal form, then formatted in human form) ;
12311 % \item \#2 The lemma ;
12312 % \item \#3 The editorial content (or, in abbreviated, content)
12313 % \end{itemize}
12314 % The \protect\cs{print@Xcomponents} macro prints them, wrapping eventually in a macro depending of the series (\#4).
12315 % \begin{macro}{\print@Xcomponents}
12316 % \begin{macrocode}
12317 \newcommand{\print@Xcomponents}[4]{%
12318 \csuse{Xwrapcomponents@#4}{%
12319 \printlinefootnote{#1}{#4}%
12320 \print@lemma{#1}{#2}{#4}%
12321 \csuse{Xwrapcontent@#4}{#3}%
12322 }%
12323 }
12324 % \end{macrocode}
12325 % \end{macro}
12326 % \subsubsection{Lemma printing}
12327 %
12328 % \begin{macro}{\print@lemma}
12329 % \cs{print@lemma} is called inside critical footnotes to print the lemma and the lemma separator (\#1: line number and font information, \#2: lemma, \#3: series).
12330 % \changes{v2.10.0}{2016/05/08}{Code refactoring between \protect\cs{parafootfmt}, \protect\cs{twocolfootfmt}, \protect\cs{threecolfootfmt} and \protect\cs{normalfootfmt}.}
12331 % \begin{macrocode}
12332 %
12333 \newcommand{\print@lemma}[3]{%
12334 \bgroup%
12335 \nottoggle{Xlemmadisablefontselection@#3}%
12336 {\select@lemmafont#1|}%
12337 {}%
12338 \bgroup%
12339 \csuse{Xlemmafont@#3}%Deprecated
12340 \csuse{Xwraplemma@#3}{#2}%
12341 \egroup%
12342 \egroup%
12343 \iftoggle{nosep@}{%
12344 \hskip\csuse{Xinplaceoflemmaseparator@#3}%
12345 \relax%
12346 }%
12347 {\ifcsempty{Xlemmaseparator@#3}%
12348 {%
12349 \hskip\csuse{Xinplaceoflemmaseparator@#3}%
12350 \relax%
12351 }%
12352 {%
12353 \nobreak%
12354 \hskip\csuse{Xbeforelemmaseparator@#3}%
12355 \csuse{Xlemmaseparator@#3}%
12356 \hskip\csuse{Xafterlemmaseparator@#3}%
12357 \relax%
12358 }%
12359 }%
12360 }%
12361 % \end{macrocode}
12362 % \end{macro}
12363 % \subsubsection{Line number printing}
12364 % \begin{macro}{\Xstorelineinfo}
12365 % The \cs{Xstorelineinfo} macro is used to store some data about line number of the current critical footnote, data which will be reused later for the \cs{Xnumberonlyfirstinline} and related setting.
12366 %
12367 % \#1 footnote specification for the current footnote;
12368 % \#2 footnote series.
12369 % \begin{macrocode}
12370 \newcommand{\Xstorelineinfo}[2]{%
12371 \l@dp@rsefootspec#1|%
12372 \iftoggle{Xnumberonlyfirstintwolines@#2}{%
12373 \xdef\lineinfo@{\l@dparsedstartline - \l@dparsedstartsub - \l@dparsedendline - \l@dparsedendsub}%
12374 }%
12375 {%
12376 \xdef\lineinfo@{\l@dparsedstartline - \l@dparsedstartsub}%
12377 }%
12378 }%
12379 % \end{macrocode}
12380 % \end{macro}
12381 % \begin{macro}{\printlinefootnote}
12382 % The \protect\cs{printlinefootnote} macro is called in each \protect\cs{<type>footfmt} command.
12383 % It controls whether the line number is printed or not, according to the series options. Its first argument is the information about lines; its second is the series of the footnote.
12384 % The printing of the line number is shared in
12385 % \protect\cs{printlinefootnotenumbers}.
12386 % \changes{v1.18.0}{2015/02/23}{Code refactoring in \protect\cs{printlinefootnote}: the printing of the numbers are factorized in \protect\cs{printlinefootnotearea}}
12387 % \begin{macrocode}
12388 \newcommand{\printlinefootnote}[2]{%
12389 \xdef\@currentseries{#2}%
12390 \iftoggle{nonum@}{%Try if the line number must printed for this specific not (by default, yes)
12391 \hspace{\csuse{Xinplaceofnumber@#2}}%
12392 }%
12393 {%
12394 {%
12395 \iftoggle{Xnonumber@#2}%Try if the line number must printed (by default, yes)
12396 {%
12397 \hspace{\csuse{Xinplaceofnumber@#2}}%
12398 }%
12399 {%
12400 {\iftoggle{Xnumberonlyfirstinline@#2}% If for this series the line number must be printed only in the first time.
12401 {%
12402 \ifcsdef{prevline#2}%
12403 {%Be sure the \prevline exists.
12404 \ifcsequal{prevline#2}{lineinfo@}%Try it
12405 {%
12406 \ifcsempty{Xsymlinenum@#2}%
12407 {%
12408 \hspace{\csuse{Xinplaceofnumber@#2}}%
12409 }%
12410 {\printsymlinefootnotearea{#2}}%
12411 }%
12412 {%
12413 \printlinefootnotearea{#1}{#2}%
12414 }%
12415 }%
12416 {%
12417 \printlinefootnotearea{#1}{#2}%
12418 }%
12419 }%
12420 {%
12421 \printlinefootnotearea{#1}{#2}%
12422 }%
12423 \csxdef{prevline#2}{\lineinfo@}%
12424 }%
12425 }%
12426 }%
12427 }%
12428 }
12429 % \end{macrocode}
12430 % \end{macro}
12431 % \begin{macro}{\printsymlinefootnotearea}
12432 % This macro prints the space before the line symbol, changes the font, when prints the line symbol and the space after it.
12433 % \begin{macrocode}
12434 \newcommand{\printsymlinefootnotearea}[1]{%
12435 \hspace{\csuse{Xbeforesymlinenum@#1}}%
12436 \csuse{Xnotenumfont@#1}%
12437 \ifdimequal{\csuse{Xboxsymlinenum@#1}}{\z@}%
12438 {\csuse{Xsymlinenum@#1}}%
12439 {\hbox to \csuse{Xboxsymlinenum@#1}%
12440 {\csuse{Xsymlinenum@#1}\hfill}%
12441 }%
12442 \hspace{\csuse{Xaftersymlinenum@#1}}%
12443 }%
12444 % \end{macrocode}
12445 % \end{macro}
12446 % \begin{macro}{\printlinefootnotearea}
12447 % This macro prints the space before the line number, changes the font, then prints the line number, wrapped in custom macro, and then print the space after it.
12448 % It is called by \protect\cs{printlinefootnote}
12449 % depending on the options about repeating line numbers.
12450 % The first argument is line information, the second is the notes series (A, B, C, etc.)
12451 % \begin{macrocode}
12452 \newcommand{\printlinefootnotearea}[2]{%
12453 \printXbeforenumber{#2}%
12454 \csuse{Xnotenumfont@#2}%
12455 \boxfootnotenumbers{#1}{#2}%
12456 \printXafternumber{#2}%
12457 }%
12458 % \end{macrocode}
12459 % \end{macro}
12460 % \begin{macro}{\boxfootnotenumbers}
12461 % Depending on the user settings, this macro will box line numbers (or not).
12462 % The first argument is line information, the second is the notes series (A, B, C, etc.)
12463 % The previous \protect\cs{printlinefootnotearea} calls it.
12464 % \begin{macrocode}
12465 \newcommand{\boxfootnotenumbers}[2]{%
12466 \ifdimequal{\csuse{Xboxlinenum@#2}}{0pt}{%
12467 \printlinefootnotenumbers{#1}{#2}%
12468 }%
12469 {%
12470 \hbox to \csuse{Xboxlinenum@#2}%
12471 {%
12472 \IfSubStr{RC}{\csuse{Xboxlinenumalign@#2}}{\hfill}{}%
12473 \printlinefootnotenumbers{#1}{#2}%
12474 \IfSubStr{LC}{\csuse{Xboxlinenumalign@#2}}{\hfill}{}%
12475 }%
12476 }%
12477 }%
12478 % \end{macrocode}
12479 % \end{macro}
12480 % \begin{macro}{\printlinefootnotenumbers}
12481 % This macro prints, if needed, the pstart number and the line number.
12482 % The first argument is line information, the second is the notes series (A, B, C, etc.)
12483 % The previous \protect\cs{boxlinefootnote} calls it.
12484 % \begin{macrocode}
12485 \newcommand{\printlinefootnotenumbers}[2]{%
12486 \csuse{Xwrapnumbers@#2}{%
12487 \get@pstartcounter%
12488 \ifboolexpr{%
12489 (togl{Xpstart@#2} and bool{numberpstart})%
12490 or togl{Xpstarteverytime@#2}%
12491 and not (%
12492 togl{Xpstartonlyfirst@#2}%
12493 and test {\ifnumequal{\csuse{Xprevpstart@#2}}{\current@pstart}}%
12494 )%
12495 }%
12496 {%
12497 \printpstart%
12498 \csuse{Xpstartseparator@#2}%
12499 }{}%
12500 \global\cslet{Xprevpstart@#2}{\current@pstart}%
12501 \get@stanzacounter%
12502 \ifboolexpr{%
12503 togl{Xstanza@#2}%
12504 and bool {numberstanza}%
12505 and not (%
12506 togl{Xstanzaonlyfirst@#2}%
12507 and test {\ifnumequal{\csuse{Xprevstanza@#2}}{\current@stanza}}%
12508 )%
12509 }{%
12510 \printstanza%
12511 \csuse{Xstanzaseparator@#2}%
12512 }{}%
12513 \global\cslet{Xprevstanza@#2}{\current@stanza}%
12514 \iftoggle{Xonlypstart@#2}{}{%
12515 \csuse{Xtxtbeforenumber@#2}%
12516 \printlines#1|\ifledRcol@\@Rlineflag\fi|}%
12517 }%
12518 }%
12519 % \end{macrocode}
12520 % \end{macro}
12521 % \begin{macro}{\get@pstartcounter}
12522 % A single macro to get the current pstart counter.
12523 % \begin{macrocode}
12524 \newcommand{\get@pstartcounter}[0]{%
12525 \ifboolexpr{bool{l@dprintingpages} or bool{l@dprintingcolumns}}%
12526 {%
12527 \ifledRcol%
12528 \global\numdef\current@pstart{\the\c@pstartR}%
12529 \else%
12530 \global\numdef\current@pstart{\the\c@pstartL}%
12531 \fi%
12532 }%
12533 {%
12534 \global\numdef\current@pstart{\the\c@pstart}%
12535 }%
12536 }%
12537 % \end{macrocode}
12538 % \end{macro}
12539 % \begin{macro}{\get@stanzacounter}
12540 % The same to get the current stanza counter.
12541 % \begin{macrocode}
12542 \newcommand{\get@stanzacounter}[0]{%
12543 \ifboolexpr{bool{l@dprintingpages} or bool{l@dprintingcolumns}}%
12544 {%
12545 \ifledRcol%
12546 \global\numdef\current@stanza{\the\c@stanzaR}%
12547 \else%
12548 \global\numdef\current@stanza{\the\c@stanzaL}%
12549 \fi%
12550 }%
12551 {%
12552 \global\numdef\current@stanza{\the\c@stanza}%
12553 }%
12554 }%
12555 % \end{macrocode}
12556 % \end{macro}
12557 %
12558 % \begin{macro}{\printXbeforenumber}
12559 % This macro prints a space (before the line number) in footnote.
12560 % It is called by \protect\cs{printlinefootnotearea}.
12561 % Its only argument is the note series (A, B, C, etc.)
12562 % \begin{macrocode}
12563 \newcommand{\printXbeforenumber}[1]{%
12564 \hspace{\csuse{Xbeforenumber@#1}}%
12565 }%
12566 % \end{macrocode}
12567 % \end{macro}
12568 % \begin{macro}{\printXafternumber}
12569 % This macro prints the space, adding eventually a \protect\cs{nobreak}, after the line number, in footnote.
12570 % It is called by \protect\cs{printlinefootnotearea}.
12571 % Its only argument is the series
12572 % \begin{macrocode}
12573 \newcommand{\printXafternumber}[1]{%
12574 \iftoggle{Xnonbreakableafternumber@#1}{\nobreak}{}%
12575 \hspace{\csuse{Xafternumber@#1}}%
12576 }%
12577 % \end{macrocode}
12578 % \end{macro}
12579 %
12580 % If we have decided to print the line number in a specific notes, the \protect\cs{printlines} macro prints the line
12581 % numbers for a note---which, in the
12582 % general case, is a rather complicated task.
12583 % The seven parameters of the
12584 % argument are the line numbers as stored in \protect\cs{l@d@nums}, in the
12585 % form described on \reff{linenumbers}: the starting
12586 % page, line, and sub-line numbers, followed by the ending page,
12587 % line, and sub-line numbers, and then the font specifier for
12588 % the lemma.
12589 %
12590 % \edmac' creator have defined six boolean in order to know which component of line number description we have to print:
12591 % \begin{itemize}
12592 % \item \protect\cs{ifl@d@pnum} for page numbers;
12593 % \item \protect\cs{ifl@d@ssub} for starting sub-line;
12594 % \item \protect\cs{ifl@d@elin} for ending line;
12595 % \item \protect\cs{ifl@d@esl} for ending sub-line; and
12596 % \item \protect\cs{ifl@d@dash} for the dash between the starting and ending groups.
12597 % \end{itemize}
12598 % There was no boolean for the line number because it was always printed.
12599 %
12600 % Maïeul Rouquette has added:
12601 % \begin{itemize}
12602 % \item \protect\cs{ifl@d@Xtwolines} and \protect\cs{ifl@d@Xmorethantwolines} to print a symbol which stands for \enquote{and subsequent} when there are two, three or more lines;
12603 % \item \cs{@annot@start@print} and \cs{@annot@end@print} which define annotations associated with the starting and ending line numbers in critical footnotes;
12604 % \item \cs{ifl@d@Xlinenumber}, which value depends on the configuration of \cs{Xnolinenumber} and \cs{Xnolinenumberifannotation}.
12605 % \end{itemize}
12606 %
12607 % \begin{macro}{\ifl@d@pnum}
12608 % \begin{macro}{\ifl@d@ssub}
12609 % \begin{macro}{\ifl@d@elin}
12610 % \begin{macro}{\ifl@d@esl}
12611 % \begin{macro}{\ifl@d@dash}
12612 % \begin{macro}{\ifl@d@Xtwolines}
12613 % \begin{macro}{\ifl@d@Xmorethantwolines}
12614 % \begin{macro}{\ifl@d@Xlinenumber}
12615 % \begin{macro}{\@annot@start@print}
12616 % \begin{macro}{\@annot@end@print}
12617 % \begin{macrocode}
12618 \newif\ifl@d@pnum
12619 \newif\ifl@d@ssub
12620 \newif\ifl@d@elin
12621 \newif\ifl@d@esl
12622 \newif\ifl@d@dash
12623 \newif\ifl@d@Xtwolines%
12624 \newif\ifl@d@Xmorethantwolines%
12625 \let\@annot@start@print\relax%
12626 \let\@annot@end@print\relax%
12627 \newif\ifl@d@Xlinenumber%
12628 % \end{macrocode}
12629 % \end{macro}
12630 % \end{macro}
12631 % \end{macro}
12632 % \end{macro}
12633 % \end{macro}
12634 % \end{macro}
12635 % \end{macro}
12636 % \end{macro}
12637 % \end{macro}
12638 % \end{macro}
12639 %
12640 %
12641 % \begin{macro}{\l@dparsefootspec}
12642 % \begin{macro}{\l@dp@rsefootspec}
12643 % \begin{macro}{\l@dparsedstartpage}
12644 % \begin{macro}{\l@dparsedstartline}
12645 % \begin{macro}{\l@dparsedstartsub}
12646 % \begin{macro}{\l@dparsedendpage}
12647 % \begin{macro}{\l@dparsedendline}
12648 % \begin{macro}{\l@dparsedendsub}
12649 % \protect\cs{l@dparsefootspec}\marg{spec}\marg{lemma}\marg{text} parses a footnote
12650 % specification. \meta{lemma} and \meta{text} are the lemma and text
12651 % respectively. \meta{spec} is the line and page number and lemma font
12652 % specifier in \protect\cs{l@d@nums} style format.
12653 % The real work is done
12654 % by \protect\cs{l@dp@rsefootspec} which defines macros holding the numeric values.
12655 % In many cases, this last command is called directly.
12656 % Just a reminder of the arguments: \\
12657 % \verb?\printlines #1 | #2 | #3 | #4 | #5 | #6 | #7?\\
12658 % \verb?\printlines start-page | line | subline | end-page | line | subline | font?flag
12659 % \begin{macrocode}
12660 \newcommand*{\l@dparsefootspec}[3]{\l@dp@rsefootspec#1|}
12661 \def\l@dp@rsefootspec#1|#2|#3|#4|#5|#6|#7|{%
12662 \gdef\l@dparsedstartpage{#1}%
12663 \gdef\l@dparsedstartline{#2}%
12664 \gdef\l@dparsedstartsub{#3}%
12665 \gdef\l@dparsedendpage{#4}%
12666 \gdef\l@dparsedendline{#5}%
12667 \gdef\l@dparsedendsub{#6}%
12668 }
12669 % \end{macrocode}
12670 % Initialise the several number value macros.
12671 % \begin{macrocode}
12672 \def\l@dparsedstartpage{0}%
12673 \def\l@dparsedstartline{0}%
12674 \def\l@dparsedstartsub{0}%
12675 \def\l@dparsedendpage{0}%
12676 \def\l@dparsedendline{0}%
12677 \def\l@dparsedendsub{0}%
12678
12679 % \end{macrocode}
12680 % \end{macro}
12681 % \end{macro}
12682 % \end{macro}
12683 % \end{macro}
12684 % \end{macro}
12685 % \end{macro}
12686 % \end{macro}
12687 % \end{macro}
12688 %
12689 %
12690 %
12691 % \begin{macro}{\setprintlines}
12692 %
12693 % The macro \protect\cs{setprintlines} does the work of deciding what numbers should
12694 % be printed. Its arguments are the same as the first 6 of \protect\cs{printlines}.
12695 % \changes{v0.7.0}{2005/02/18}{Added \protect\cs{setprintlines} for use by \protect\cs{printlines}}
12696 % \begin{macrocode}
12697 \newcommand*{\setprintlines}[6]{%
12698 \let\@annot@start@print\relax%
12699 \let\@annot@end@print\relax%
12700 \l@d@pnumfalse%
12701 \l@d@dashfalse%
12702 \l@d@elinfalse%
12703 % \end{macrocode}
12704 % Should we print the line number? It depends on hooks and annotations.
12705 % \begin{macrocode}
12706 \l@d@Xlinenumbertrue%
12707 \ifboolexpr{togl{Xnolinenumber@\@currentseries}%
12708 or (%
12709 togl{Xnolinenumberifannotation@\@currentseries}%
12710 and not test{\ifdefvoid{\annot@start}}%
12711 and not test{\ifdefvoid{\annot@end}}%
12712 )%
12713 }{%
12714 \l@d@Xlinenumberfalse%
12715 }{}%
12716 % \end{macrocode}
12717 % We print the page numbers only if\/: 1)~we are doing
12718 % the lineation by page, and 2)~the ending page number is different
12719 % from the starting page number.
12720 % \begin{macrocode}
12721 \ifbypage@
12722 \ifnum#4=#1 \else
12723 \l@d@pnumtrue
12724 \l@d@dashtrue
12725 \fi
12726 \fi
12727 % \end{macrocode}
12728 %
12729 % We print the ending line number if:
12730 % \begin{enumerate}
12731 % \item we print the ending page number;
12732 % \item or the ending line number is different from the starting line number and we didn't disable the line number printing
12733 % \end{enumerate}
12734 % If either of these conditions is true, we also print the annotation linked to the ending line number annotations.
12735 % \begin{macrocode}
12736 \ifboolexpr{%
12737 bool{l@d@pnum}%
12738 or (%
12739 not test{\ifnumequal{#2}{#5}}%
12740 and bool{l@d@Xlinenumber}%
12741 )%
12742 }{%
12743 \l@d@elintrue%
12744 \l@d@dashtrue%
12745 \unless\ifx\relax\annot@end%
12746 \def\@annot@end@print{%
12747 \l@wrapcs@ifnotemptybox{Xwraplinenumannotation@\@currentseries}{\annot@end}%
12748 }%
12749 \fi%
12750 }{}%
12751 % \end{macrocode}
12752 % We define the starting line number annotation as a merge of the starting annotation and ending annotation if we don't print the ending line number.
12753 % Otherwise, it is only the starting annotation.
12754 % \begin{macrocode}
12755 \ifl@d@elin%
12756 \def\@annot@start@print{%
12757 \l@wrapcs@ifnotemptybox{Xwraplinenumannotation@\@currentseries}{\annot@start}%
12758 }%
12759 \else%
12760 \ifx\annot@start\annot@end%
12761 \unless\ifx\@annot@start\relax%
12762 \def\@annot@start@print{%
12763 \l@wrapcs@ifnotemptybox{Xwraplinenumannotation@\@currentseries}{\annot@start}%
12764 }%
12765 \fi%
12766 \else%
12767 \ifx\@annot@end@print\relax%
12768 \def\@annot@start@print{%
12769 \l@wrapcs@ifnotemptybox{Xwraplinenumannotation@\@currentseries}{%
12770 \ifx\annot@start\empty\else%
12771 \annot@start%
12772 \ifdefined\linerangesep@%
12773 \linerangesep@%
12774 \else%
12775 \csuse{Xlinerangeseparator@\@currentseries}%
12776 \fi%
12777 \fi%
12778 \annot@end%
12779 }%
12780 }%
12781 \else%
12782 \let\@annot@start@print\@annot@end@print%
12783 \let\@annot@end@print\relax%
12784 \fi%
12785 \fi%
12786 \fi%
12787 % \end{macrocode}
12788 % We print the starting sub-line if it is nonzero.
12789 % \begin{macrocode}
12790 \l@d@ssubfalse
12791 \ifnum#3=0 \else
12792 \l@d@ssubtrue
12793 \fi
12794 % \end{macrocode}
12795 % We print the ending sub-line if it is nonzero and: (1)~it is different
12796 % from the starting sub-line number, or (2)~the ending line number is
12797 % being printed.
12798 % \begin{macrocode}
12799 \l@d@eslfalse
12800 \ifnum#6=0 \else
12801 \ifnum#6=#3
12802 \ifl@d@elin \l@d@esltrue \else \l@d@eslfalse \fi
12803 \else
12804 \l@d@esltrue
12805 \l@d@dashtrue
12806 \fi
12807 \fi%
12808 % \end{macrocode}
12809 % However, if the \protect\cs{Xtwolines} is set for the current series, we do not print the last line number.
12810 % \begin{macrocode}
12811 \ifl@d@dash%
12812 \ifboolexpr{togl{fulllines@} or test{\ifcsempty{Xtwolines@\@currentseries}}}%
12813 {}%
12814 {%
12815 \setistwofollowinglines{#1}{#2}{#4}{#5}%
12816 \ifboolexpr{%
12817 (%
12818 togl {Xtwolinesbutnotmore@\@currentseries}%
12819 and not%
12820 (%
12821 bool {istwofollowinglines@}%
12822 )%
12823 )%
12824 or%
12825 (%
12826 (not test{\ifnumequal{#1}{#4}})%
12827 and togl{Xtwolinesonlyinsamepage@\@currentseries}%
12828 )%
12829 }%
12830 {}%
12831 {%
12832 \l@d@dashfalse%
12833 \l@d@Xtwolinestrue%
12834 \l@d@elinfalse%
12835 \l@d@eslfalse%
12836 \ifcsempty{Xmorethantwolines@\@currentseries}%
12837 {}%
12838 {\ifistwofollowinglines@\else%
12839 \l@d@Xmorethantwolinestrue%
12840 \fi%
12841 }%
12842 }%
12843 }%
12844 \fi%
12845 % \end{macrocode}
12846 % If the \cs{Xnoidenticallinenumannotation} is set for this series, we check if the ending annotation is identical to the starting.
12847 % If true, we don't print the ending annotation
12848 % \begin{macrocode}
12849 \iftoggle{Xnoidenticallinenumannotation@\@currentseries}{%
12850 \ifx\annot@start\annot@end%
12851 \let\@annot@end@print\relax%
12852 \ifboolexpr{%Do not print the dash if we do not print the line number
12853 test {\ifdefempty{\linenumrep}}%
12854 or not bool {l@d@Xlinenumber}%
12855 }{%
12856 \l@d@dashfalse%
12857 }{}%
12858 \fi%
12859 }{}%
12860 % \end{macrocode}
12861 % Finally, we check for \cs{Xlinenumannotationonlyfirst} and \cs{Xlinenumannotationonlyfirstintwo}, and we redefine, if required, \cs{@annot@start@print} and \cs{annot@end@print}. We also store the current line number annotations.
12862 % \begin{macrocode}
12863 \iftoggle{Xlinenumannotationonlyfirst@\@currentseries}{%
12864 \ifboolexpr{%
12865 (%
12866 togl{Xlinenumannotationonlyfirstintwo@\@currentseries}%
12867 and test{\ifcsequal{annot@start}{prevannot@start@\@currentseries}}%
12868 and test{\ifcsequal{annot@end}{prevannot@end@\@currentseries}}%
12869 )%
12870 or%
12871 (%
12872 not togl{Xlinenumannotationonlyfirstintwo@\@currentseries}%
12873 test{\ifcsequal{annot@start}{prevannot@start@\@currentseries}}%
12874 )%
12875 }{%
12876 \def\@annot@start@print{%
12877 \l@wrapcs@ifnotemptybox{Xwraplinenumannotation@\@currentseries}{\csuse{Xsymlinenumannotation@\@currentseries}}%
12878 }%
12879 \let\@annot@end@print\relax%
12880 \ifboolexpr{%Do not print the dash if we do not print the line number
12881 test {\ifdefempty{\linenumrep}}%
12882 or not bool {l@d@Xlinenumber}%
12883 }{%
12884 \l@d@dashfalse%
12885 }{}%
12886 }{}%
12887 \global\cslet{prevannot@start@\@currentseries}{\annot@start}%
12888 \global\cslet{prevannot@end@\@currentseries}{\annot@end}%
12889 }%
12890 {}%
12891 % \end{macrocode}
12892 % End of \protect\cs{setprintlines}.
12893 % \begin{macrocode}
12894 }%
12895 % \end{macrocode}
12896 % \end{macro}
12897 %
12898 % \begin{macro}{\setistwofollowinglines}
12899 % The \protect\cs{ifistwofollowinglines} boolean, used by the \protect\cs{Xtwolines} and related setting, is set to true by \protect\cs{setistwofollowinglines}.
12900 % This command takes the following arguments:
12901 % \begin{itemize}
12902 % \item \verb+#1+ First page number.
12903 % \item \verb+#2+ First line number.
12904 % \item \verb+#3+ Last page number.
12905 % \item \verb+#4+ Last line number.
12906 % \end{itemize}
12907 % If \verb+#3+-\verb+#2+ = 1, then that means the two lines are subsequent, and consequently \protect\cs{ifistwofollowinglines} is set to true.
12908 % However, if we use lineation by page, two given lines can be subsequent if:
12909 % \begin{itemize}
12910 % \item The first line number is equal to the last line number of the first page.
12911 % \item The last line number is equal to 1.
12912 % \item \verb+#3+-\verb+#1+ is equal to 1.
12913 % \end{itemize}
12914 % \begin{macrocode}
12915 \newif\ifistwofollowinglines@%
12916 \newcommand{\setistwofollowinglines}[4]{%
12917 \ifcsdef{lastlinenumberon@#1}%
12918 {\numdef{\tmp}{\csuse{lastlinenumberon@#1}}}%
12919 {\numdef{\tmp}{0}}%
12920 \istwofollowinglines@false%
12921 \ifnumequal{#4-#2}{1}%
12922 {\istwofollowinglines@true}%%
12923 {\ifbypage@%
12924 \ifnumequal{#3-#1}{1}%
12925 {%
12926 \ifnumequal{#2}{\tmp}%
12927 {\ifnumequal{#4}{1}{\istwofollowinglines@true}{}}%
12928 {}%
12929 }%
12930 {}%
12931 \fi%
12932 }%
12933 }%
12934 % \end{macrocode}
12935 % \end{macro}
12936 %
12937 % \begin{macro}{\printlines}
12938 % \begin{macro}{\printlines@count}
12939 % \changes{v2.5.0}{2015/11/13}{\protect\cs{printlines} takes an eighth argument: the line flag}
12940 % So, we have decided which part of line number sets will be printed depending on these values.
12941 % Now we are ready to print them.
12942 % If the lineation is by pstart, we print the pstart.
12943 % \changes{v0.15.0}{2012/06/11}{Line numbering can be reset at each pstart.}
12944 % Arguments are 1) start page number 2) start line number 3) start subline number 4) end page number 5) end line number 6) end subline number 7) font specification 8) side flag
12945 % \begin{macrocode}
12946 \newcount\printlines@count%
12947 \def\printlines#1|#2|#3|#4|#5|#6|#7|#8|{%
12948 \global\advance\printlines@count by 1%
12949 \begingroup%
12950 % \end{macrocode}
12951 % Decide which part of line number components we will print.
12952 % \begin{macrocode}
12953 \setprintlines{#1}{#2}{#3}{#4}{#5}{#6}%
12954 % \end{macrocode}
12955 % One subtlety left here is when to print a period between
12956 % numbers. But the only instance in which this is tricky is for the
12957 % ending sub-line number: it could come after the starting
12958 % sub-line number (in which case we want only the dash) or after an
12959 % ending line number (in which case we need to insert a period).
12960 % So, first, print the start line number.
12961 % \begin{macrocode}
12962 \ifdimequal{\csuse{Xboxstartlinenum@\@currentseries}}{0pt}%
12963 {\bgroup}%
12964 {\leavevmode\hbox to \csuse{Xboxstartlinenum@\@currentseries}\bgroup\hfill}%
12965 \ifcsstring{Xlinenumannotationposition@\@currentseries}{before}%
12966 {\@annot@start@print}%
12967 {}%
12968 % \end{macrocode}
12969 % Sometime, we need to print the page number.
12970 % However, if both the current page is equal to the page number and we use \cs{Xnopagenumberifcurrent}, we do not want to print it.
12971 % To determine the current page, we need to use crossref mechanism. See \url{https://tex.stackexchange.com/a/239457/7712} for explanation.
12972 % \begin{macrocode}
12973 \ifl@d@pnum%
12974 \iftoggle{Xnopagenumberifcurrent@\@currentseries}{%
12975 \edlabel{printlines@\the\printlines@count}%
12976 }{}%
12977 \ifboolexpr{%
12978 not test{\ifnumequal{\xpageref{printlines@\the\printlines@count}}{#1}}%
12979 or not togl{Xnopagenumberifcurrent@\@currentseries}%
12980 }%
12981 {%
12982 \csuse{Xbeforepagenumber@\@currentseries}%
12983 \wrap@edcrossref{\@this@crossref@start}{%
12984 #1%
12985 }%
12986 \ifl@d@Xlinenumber%
12987 \csuse{Xpagelinesep@\@currentseries}%
12988 \fi%
12989 }{}%
12990 \fi%
12991 \ifl@d@Xlinenumber%
12992 \wrap@edcrossref{\@this@crossref@start}{%
12993 \linenumrep{#2}%
12994 \iftoggle{Xlineflag@\@currentseries}{#8}{}%
12995 }%
12996 \iftoggle{Xnotboxingsubline@\@currentseries}{\egroup}{}%Close startline box
12997 \ifl@d@ssub%
12998 \csuse{Xsublinesep@\@currentseries}%
12999 \wrap@edcrossref{\@this@crossref@start}{\sublinenumrep{#3}}%
13000 \fi%
13001 \fi%
13002 \ifcsstring{Xlinenumannotationposition@\@currentseries}{after}%
13003 {\@annot@start@print}%
13004 {}%
13005 \iftoggle{Xnotboxingsubline@\@currentseries}{}{\egroup}%Close startline box
13006 % \end{macrocode}
13007 % Then print the dash + end line number, or the range symbol.
13008 % \changes{v0.3.0}{2004/02/14}{Added \protect\cs{linenumr@p} and \protect\cs{sublinenumr@p}
13009 % to \protect\cs{printlines}}
13010 % \changes{v1.20.0}{2015/03/22}{Added \protect\cs{ifl@d@Xmorethantwolines} and \protect\cs{ifl@d@Xmorethantwolines} to \protect\cs{printlines}}
13011 % \begin{macrocode}
13012 \ifdimequal{\csuse{Xboxendlinenum@\@currentseries}}{0pt}%
13013 {\bgroup}%
13014 {\hbox to \csuse{Xboxendlinenum@\@currentseries}\bgroup}%
13015 \ifl@d@Xtwolines%
13016 \ifl@d@Xlinenumber%
13017 \ifl@d@Xmorethantwolines%
13018 \wrap@edcrossref{\@this@crossref@end}{\csuse{Xmorethantwolines@\@currentseries}}%
13019 \else%
13020 \wrap@edcrossref{\@this@crossref@end}{\csuse{Xtwolines@\@currentseries}}%
13021 \fi%
13022 \fi%
13023 \else%
13024 \ifl@d@dash%
13025 \ifdefined\linerangesep@%
13026 \linerangesep@%
13027 \else%
13028 \csuse{Xlinerangeseparator@\@currentseries}%
13029 \fi%
13030 \fi%
13031 \ifcsstring{Xlinenumannotationposition@\@currentseries}{before}%
13032 {\@annot@end@print}%
13033 {}%
13034 \ifl@d@pnum%
13035 \ifboolexpr{%
13036 not test{\ifnumequal{\xpageref{printlines@\the\printlines@count}}{#4}}%
13037 or not togl{Xnopagenumberifcurrent@\@currentseries}%
13038 }{%
13039 \csuse{Xbeforepagenumber@\@currentseries}%
13040 \wrap@edcrossref{\@this@crossref@end}{%
13041 #4%
13042 }%
13043 \csuse{Xpagelinesep@\@currentseries}%
13044 }{}%
13045 \fi%
13046 \ifl@d@Xlinenumber%
13047 \ifl@d@elin%
13048 \wrap@edcrossref{\@this@crossref@end}{%
13049 \linenumrep{#5}%
13050 \iftoggle{Xlineflag@\@currentseries}{#8}{}%
13051 }%
13052 \fi%
13053 \ifl@d@esl%
13054 \ifl@d@elin%
13055 \csuse{Xsublinesep@\@currentseries}%
13056 \fi%
13057 \wrap@edcrossref{\@this@crossref@end}{\sublinenumrep{#6}}%
13058 \fi%
13059 \fi%
13060 \ifcsstring{Xlinenumannotationposition@\@currentseries}{after}%
13061 {\@annot@end@print}%
13062 {}%
13063 \fi%
13064 \ifdimequal{\csuse{Xboxendlinenum@\@currentseries}}{0pt}%
13065 {}%
13066 {\hfill}%Prevent underfull hbox
13067 \egroup%
13068 \endgroup%
13069 }%
13070 % \end{macrocode}
13071 % \end{macro}
13072 % \end{macro}
13073 % \subsubsection{Footnote grouped by line}
13074 % \begin{macro}{\prepare@Xgroupbyline}
13075 % \cs{prepare@Xgroupbyline} is a macro called on the \cs{meta{XXX}vfootnote} if \cs{Xgroupbyline} is set to true, instead of calling \cs{insert} directly.
13076 % \#1 The series\\
13077 % \#2 The content of the footnote, which is also the line number indication\\
13078 % \#3 This macro, which prepares the contents of the insertion \\
13079 % \begin{macrocode}
13080 \newcommand{\prepare@Xgroupbyline}[3]{%
13081 \iftoggle{Xgroupbylineseparetwolines@#1}{%
13082 \l@dparsefootspec#2%
13083 \ifcsdef{#1@forinserting@\l@dparsedendpage-\l@dparsedendline-\l@dparsedendsub}%
13084 {%
13085 \csgappto{#1@forinserting@\l@dparsedendpage-\l@dparsedendline-\l@dparsedendsub}{%
13086 \hskip\csuse{Xafternote@#1}\relax%
13087 }%
13088 }%
13089 {}%
13090 \add@hooktoggle@specific@to@cs{#1@forinserting@\l@dparsedendpage-\l@dparsedendline-\l@dparsedendsub}%
13091 \add@hookarg@specific@to@cs{#1@forinserting@\l@dparsedendpage-\l@dparsedendline-\l@dparsedendsub}%
13092 \csxappto%
13093 {#1@forinserting@\l@dparsedendpage-\l@dparsedendline-\l@dparsedendsub}%
13094 {%
13095 \keep@this@crossref@forinserting%
13096 \unexpanded{%
13097 \ifcsempty{Xsymlinenum@#1}%
13098 {\csuse{Xparafootsep@#1}}%
13099 {}%
13100 #3{#1}{#2}%
13101 }%
13102 }%
13103 \listcsxadd{#1@forinserting}{\l@dparsedendpage-\l@dparsedendline-\l@dparsedendsub}%
13104 }{%
13105 \ifcsdef{#1@forinserting@all}{%
13106 \csgappto%
13107 {#1@forinserting@all}%
13108 {\hskip\csuse{Xafternote@#1}\relax}%
13109 }{}%
13110 \add@hooktoggle@specific@to@cs{#1@forinserting@all}%
13111 \add@hookarg@specific@to@cs{#1@forinserting@all}%
13112 \csxappto%
13113 {#1@forinserting@all}%
13114 {%
13115 \keep@this@crossref@forinserting%
13116 \unexpanded{%
13117 \ifcsempty{Xsymlinenum@#1}%
13118 {\csuse{Xparafootsep@#1}}%
13119 {}%
13120 #3{#1}{#2}%
13121 }%
13122 }%
13123 }%
13124 \listcsgadd{#1@forinserting}{all}%
13125 }%
13126 % \end{macrocode}
13127 % \end{macro}
13128 % \begin{macro}{\keep@this@crossref@forinserting}
13129 % \cs{keep@this@crossref@forinserting} is called by \cs{prepare@Xgroupbyline}. It just ensures that \cs{@this@crossref@start} and \cs{this@crossref@end} value are kept in memory.
13130 % \begin{macrocode}
13131 \newcommand{\keep@this@crossref@forinserting}{%
13132 \unexpanded{\gdef\@this@crossref@start}{\@this@crossref@start}%
13133 \unexpanded{\gdef\@this@crossref@end}{\@this@crossref@end}%
13134 }%
13135 % \end{macrocode}
13136 % \end{macro}
13137 % \section{Familiar footnotes}
13138 %
13139 % \subsection{Adjacent footnotes}
13140 % The original \edmac{} provided users with five series of critical footnotes (\protect\cs{Afootnote} \protect\cs{Bfootnote} \protect\cs{Cfootnote} \protect\cs{Dfootnote} \protect\cs{Efootnote}),
13141 % and \LaTeX\ provides a single numbered footnote. The \macpackage{} package
13142 % uses the \edmac{} mechanism to provide six series of numbered footnotes.
13143 %
13144 % First, though, the \protect\package{footmisc} package has an option whereby
13145 % two or more consecutive \protect\cs{footnote}s have their marks separated
13146 % by commas. This seemed to Peter Wilson such a useful ability that it was provided
13147 % automatically by \eledmac.
13148 %
13149 % Maïeul Rouquette has maintened this feature in \macpackage, despite he thought that is not directly in relationship with the aim of \macpackage.
13150 %
13151 %
13152 % \begin{macro}{\multiplefootnotemarker}
13153 % \begin{macro}{\multfootsep}
13154 % These macros may have been defined by the \protect\ltxclass{memoir} class,
13155 % are provided by the \protect\package{footmisc} package and perhaps
13156 % by other footnote packages.
13157 % That is why we use \protect\cs{providecommand} and not \protect\cs{newcommand}.
13158 % \begin{macrocode}
13159 \providecommand*{\multiplefootnotemarker}{3sp}
13160 \providecommand*{\multfootsep}{\textsuperscript{\normalfont,}}
13161
13162 % \end{macrocode}
13163 % \end{macro}
13164 % \end{macro}
13165 %
13166 % \begin{macro}{\m@mmf@prepare}
13167 % A pair of self-cancelling kerns. This may have been defined in the
13168 % \protect\ltxclass{memoir} class.
13169 % \begin{macrocode}
13170 \providecommand*{\m@mmf@prepare}{%
13171 \kern-\multiplefootnotemarker
13172 \kern\multiplefootnotemarker\relax}
13173 % \end{macrocode}
13174 % \end{macro}
13175 %
13176 % \begin{macro}{\m@mmf@check}
13177 % This may have been defined in the \protect\ltxclass{memoir} class. If it recognises
13178 % the last kern as \protect\cs{multiplefootnotemarker} it typesets \protect\cs{multfootsep}.
13179 % \begin{macrocode}
13180 \providecommand*{\m@mmf@check}{%
13181 \ifdim\lastkern=\multiplefootnotemarker\relax
13182 \edef\@x@sf{\the\spacefactor}%
13183 \unkern
13184 \multfootsep
13185 \spacefactor\@x@sf\relax
13186 \fi}
13187
13188 % \end{macrocode}
13189 % \end{macro}
13190 %
13191 % We have to modify \protect\cs{@footnotetext} and \protect\cs{@footnotemark}. However,
13192 % if \protect\ltxclass{memoir} is used the modifications have already been made.
13193 % \changes{v0.4.1}{2004/03/25}{Only change \protect\cs{@footnotetext} and
13194 % \protect\cs{@footnotemark} if memoir not used}
13195 % \begin{macrocode}
13196 \@ifclassloaded{memoir}{}{%
13197 % \end{macrocode}
13198 % \begin{macro}{\@footnotetext}
13199 % Add \protect\cs{m@mmf@prepare} at the end of \protect\cs{@footnotetext}.
13200 % \begin{macrocode}
13201 \apptocmd{\@footnotetext}{\m@mmf@prepare}{}{}
13202 % \end{macrocode}
13203 % \end{macro}
13204 %
13205 % \changes{v2.0.0}{2015/07/19}{Patch \protect\cs{@footnotemark} instead of redefine it}
13206 % \begin{macro}{\@footnotemark}
13207 % Modify \protect\cs{@footnotemark} to cater for adjacent \protect\cs{footnote}s.
13208 % \begin{macrocode}
13209
13210 \patchcmd{\@footnotemark}
13211 {\nobreak}
13212 {\m@mmf@check
13213 \nobreak
13214 }
13215 {}{}
13216 \patchcmd{\@footnotemark}
13217 {\@makefnmark}
13218 {\@makefnmark
13219 \m@mmf@prepare
13220 }
13221 {}{}
13222 % \end{macrocode}
13223 % \end{macro}
13224 % Finished the modifications for the non-memoir case.
13225 % \begin{macrocode}
13226 }
13227
13228 % \end{macrocode}
13229 %
13230 % \subsection{Regular footnotes for numbered texts}
13231 % \begin{macro}{\l@doldold@footnotetext}
13232 % \begin{macro}{\@footnotetext}
13233 % In order to enable the regular \protect\cs{footnote}s in numbered text
13234 % we have to play around with its \protect\cs{@footnotetext}, using
13235 % different forms for when in numbered or regular text.
13236 % \changes{v0.5.0}{2004/04/03}{Enabled regular \protect\cs{footnote} in numbered text}
13237 % \begin{macrocode}
13238 \pretocmd{\@footnotetext}{%
13239 \ifnumberedpar@
13240 \edtext{}{%
13241 \advance \edtext@notes by 1%
13242 \l@dbfnote{#1}%
13243 }%
13244 \else
13245 }{}{}
13246 \apptocmd{\@footnotetext}{\fi}{}{}%
13247 % \end{macrocode}
13248 % \end{macro}
13249 % \end{macro}
13250 %
13251 % \begin{macro}{\l@dbfnote}
13252 % \begin{macro}{\vl@dbfnote}
13253 % \begin{macro}{\vl@dbfnote}
13254 % \begin{macro}{\footnote}
13255 % \begin{macro}{\get@fnmark}
13256 % \begin{macro}{\get@thisfootnote}
13257 % \protect\cs{l@dbfnote} adds the footnote to the insert list, and
13258 % \protect\cs{vl@dbfnote} calls the original \protect\cs{@footnotetext}.
13259 % \changes{v0.6.0}{2004/11/23}{Changed \protect\cs{l@dbfnote} and \protect\cs{vl@dbfnote} as
13260 % originals could give incorrect markers in the footnotes}
13261 % We also patch \cs{footnote} in order to get the correct footnote numbers when typesetting parallel texts. This is moved into a \cs{get@fnmark} command.
13262 % \changes{v1.4.1}{2012/11/16}{Compatibility of standard footnotes with \eledmac when these footnotes contain any commands.}
13263 % \begin{macrocode}
13264
13265 \patchcmd%
13266 {\footnote}%
13267 {\stepcounter\@mpfn}%
13268 {%
13269 \ifboolexpr{bool{l@dpairing} or bool{l@dprintingpages} or bool{l@dprintingcolumns}}{%
13270 \global\advance\footnote@reading by \@ne%
13271 \get@thisfootnote%
13272 \get@fnmark{\thisc@footnote}%
13273 \ifcsdef{footnotereading\the\footnote@reading=typeset}%
13274 {\setcounter{\@mpfn}{\csuse{footnotereading\the\footnote@reading=typeset}}}%
13275 {\setcounter{\@mpfn}{\footnote@reading}}%
13276 }{%
13277 \stepcounter\@mpfn%
13278 }%
13279 }%
13280 {}
13281 {}
13282
13283 \newcommand{\get@thisfootnote}{%
13284 \ifboolexpr{bool{l@dpairing} or bool{l@dprintingpages} or bool{l@dprintingcolumns}}{%
13285 \protected@xdef\thisc@footnote{\the\footnote@reading}%
13286 }{%
13287 \protected@xdef\thisc@footnote{\the\c@footnote}%
13288 }%
13289 }%
13290
13291 \newcommand{\l@dbfnote}[1]{%
13292 \get@thisfootnote%
13293 \gdef\@tag{#1\relax}%
13294 \ifledRcol%
13295 \xright@appenditem{%
13296 \ifdefined\Hy@footnote@currentHref%
13297 \noexpand\def\noexpand\Hy@footnote@currentHref{\Hy@footnote@currentHref}%
13298 \fi%
13299 \noexpand\vl@dbfnote{{\expandonce\@tag}}{\thisc@footnote}%
13300 }%
13301 \to\inserts@listR
13302 \global\advance\insert@countR \@ne%
13303 \else%
13304 \xright@appenditem{%
13305 \ifdefined\Hy@footnote@currentHref%
13306 \noexpand\def\noexpand\Hy@footnote@currentHref{\Hy@footnote@currentHref}%
13307 \fi%
13308 \noexpand\vl@dbfnote{{\expandonce\@tag}}{\thisc@footnote}%
13309 }%
13310 \to\inserts@list
13311 \global\advance\insert@count \@ne%
13312 \fi
13313 \ignorespaces%
13314 }%
13315
13316 \newcommand{\get@fnmark}[1]{%
13317 \ifboolexpr{bool{l@dpairing} or bool{l@dprintingpages} or bool{l@dprintingcolumns}}%
13318 {%
13319 \stepcounter{footnote@typeset}%
13320 \setcounter{footnote}{\c@footnote@typeset}%
13321 \immediate\write\@mainaux{%
13322 \csgdef{footnotereading#1=typeset}{\the\c@footnote@typeset}%
13323 }%
13324 \def\@thefnmark{\thefootnote}%
13325 }%
13326 {%
13327 \setcounter{footnote}{#1}%
13328 \def\@thefnmark{\thefootnote}%
13329 }%
13330 }%
13331
13332 \newcommand{\vl@dbfnote}[2]{%
13333 \get@fnmark{#2}%
13334 \@footnotetext{#1}%
13335 }%
13336 % \end{macrocode}
13337 % \end{macro}
13338 % \end{macro}
13339 % \end{macro}
13340 % \end{macro}
13341 % \end{macro}
13342 % \end{macro}
13343 %
13344 % \subsection{Footnote formats}
13345 %
13346 % Some of the code for the various formats is remarkably similar to that
13347 % in section~\ref{sec:nfootformat}.
13348 %
13349 % The following macros generally set things up for the \enquote{standard} footnote
13350 % format.
13351 %
13352 % \begin{macro}{\prebodyfootmark}
13353 % \begin{macro}{\postbodyfootmark}
13354 % Two convenience macros for use by \protect\cs{...@footnotemark...} macros.
13355 % \begin{macrocode}
13356 \newcommand*{\prebodyfootmark}{%
13357 \leavevmode
13358 \ifhmode
13359 \edef\@x@sf{\the\spacefactor}%
13360 \m@mmf@check
13361 \nobreak
13362 \fi}
13363 \newcommand{\postbodyfootmark}{%
13364 \m@mmf@prepare
13365 \ifhmode\spacefactor\@x@sf\fi\relax}
13366
13367 % \end{macrocode}
13368 % \end{macro}
13369 % \end{macro}
13370 %
13371 % \subsection{Footnote arrangement}
13372 %
13373 % \subsubsection{User level macro}
13374 % \begin{macro}{\arrangementX}
13375 % \protect\cs{arrangementX}\oarg{s}\marg{arrangement}
13376 % command calls, for each series, a specific command which set many counters and commands in order to define specific arrangement.
13377 %
13378 % \begin{macrocode}
13379 \newcommandx{\arrangementX}[2][1,usedefault]{%
13380 \def\do##1{%
13381 \csname arrangementX@#2\endcsname{##1}%
13382 }%
13383 \ifstrempty{#1}%
13384 {%
13385 \dolistloop{\@series}%
13386 }%
13387 {
13388 \docsvlist{#1}%
13389 }%
13390 }%
13391 % \end{macrocode}
13392 % \end{macro}
13393 % \subsubsection{Normal footnotes}
13394 % \begin{macro}{\normal@footnotemarkX}
13395 % \protect\cs{normal@footnotemarkX}\marg{series} sets up the typesetting of the
13396 % marker at the point where the footnote is called for.
13397 % \begin{macrocode}
13398 \newcommand*{\normal@footnotemarkX}[1]{%
13399 \prebodyfootmark
13400 \wrapped@bodyfootmarkX{#1}%
13401 \postbodyfootmark}
13402
13403 % \end{macrocode}
13404 % \end{macro}
13405 %
13406 % \begin{macro}{\normalbodyfootmarkX}
13407 % The \protect\cs{normalbodyfootmarkX}\marg{series} \emph{really} typesets the
13408 % in-text marker. The style is the normal superscript.
13409 % \begin{macrocode}
13410 \newcommand*{\normalbodyfootmarkX}[1]{%
13411 \hbox{\textsuperscript{\normalfont\@nameuse{@thefnmark#1}}}}
13412 % \end{macrocode}
13413 % \end{macro}
13414 %
13415 % \begin{macro}{\normalvfootnoteX}
13416 % \changes{v1.5.1}{2013/08/16}{Fix a bug with normal familiar footnotes when mixing RTL and LTR text.}
13417 % \protect\cs{normalvfootnoteX}\marg{series}\marg{text} does the \protect\cs{insert} for
13418 % the \meta{series} and calls the series' \protect\cs{footfmt...} to format the
13419 % \meta{text}.
13420 % \begin{macrocode}
13421 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\normalvfootnoteX}[2]{%
13422 \beforeinsertion@X{#1}%
13423 \insert\@nameuse{footins#1}\bgroup
13424 \fontseries{\seriesdefault}%
13425 \fontshape{\shapedefault}%
13426 \hsize=\expandafter\dimexpr\csuse{widthX@#1}\relax%
13427 \noindent\csuse{bhooknoteX@#1}%
13428 \csuse{notefontsizeX@#1}%
13429 \footsplitskips
13430 \ifl@dpairing\ifl@dpaging\else%
13431 \setnoteswidthliketwocolumnsX@{#1}%
13432 \fi\fi%
13433 \setnotesXpositionliketwocolumns@{#1}%
13434 \spaceskip=\z@skip \xspaceskip=\z@skip
13435 \csuse{\csuse{footnote@dir}}\@nameuse{footfmt#1}{#1}{#2}\egroup}
13436
13437 % \end{macrocode}
13438 % \end{macro}
13439 %
13440 % \begin{macro}{\mpnormalvfootnoteX}
13441 % The minipage version.
13442 % \begin{macrocode}
13443 \newcommand*{\mpnormalvfootnoteX}[3]{%
13444 \get@thisfootnoteX{#1}%
13445 \get@fnmarkX{#1}{\thisc@footnote}{#3}%
13446 \ifstrempty{#3}{%
13447 \edef\this@footnoteX@reading{\the\csname footnote#1@reading\endcsname}%
13448 }{%
13449 \edef\this@footnoteX@reading{###3}%
13450 }%
13451 \global\setbox\@nameuse{mpfootins#1}\vbox{%
13452 \unvbox\@nameuse{mpfootins#1}
13453 \noindent\csuse{bhooknoteX@#1}%
13454 \csuse{notefontsizeX@#1}%
13455 \hsize\columnwidth
13456 \@parboxrestore
13457 \color@begingroup
13458 \@nameuse{footfmt#1}{#1}{#2}\color@endgroup}}
13459
13460 % \end{macrocode}
13461 % \end{macro}
13462 %
13463 % \begin{macro}{\normalfootfmtX}
13464 % \protect\cs{normalfootfmtX}\marg{series}\marg{text} typesets the footnote text,
13465 % prepended by the marker.
13466 % \begin{macrocode}
13467 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\normalfootfmtX}[2]{%
13468 \ifluatex%
13469 \textdir\footnote@luatextextdir%
13470 \pardir\footnote@luatexpardir%
13471 \fi%
13472 \protected@edef\@currentlabel{%
13473 \@nameuse{@thefnmark#1}%
13474 }%
13475 \ledsetnormalparstuffX{#1}%
13476 \sethangindentX{#1}%
13477 \rule\z@\splittopskip%
13478 \csuse{wrapcomponentsX@#1}{%
13479 \bgroup%
13480 \csuse{notenumfontX@#1}%
13481 \wrapped@footfootmarkX{#1}%
13482 \egroup%
13483 \csuse{wrapcontentX@#1}{#2}%
13484 \strut%
13485 }%
13486 \par%
13487 }%
13488
13489 % \end{macrocode}
13490 % \end{macro}
13491 %
13492 % \begin{macro}{\normalfootfootmarkX}
13493 % \protect\cs{normalfootfootmarkX}\marg{series} is called by \protect\cs{normalfootfmtX}
13494 % to typeset the footnote marker in the footer before the footnote text.
13495 % \begin{macrocode}
13496 \newcommand*{\normalfootfootmarkX}[1]{%
13497 \textsuperscript{\@nameuse{@thefnmark#1}}}
13498
13499 % \end{macrocode}
13500 % \end{macro}
13501 %
13502 % \begin{macro}{\normalfootstartX}
13503 % \protect\cs{normalfootstartX}\marg{series} is the \meta{series} footnote
13504 % starting macro used in the output routine.
13505 % \begin{macrocode}
13506 \newcommand*{\normalfootstartX}[1]{%
13507 \ifdimequal{0pt}{\prenotesX@}{}%
13508 {%
13509 \iftoggle{prenotesX@}{%
13510 \togglefalse{prenotesX@}%
13511 \skip\csname footins#1\endcsname=%
13512 \glueexpr\csuse{prenotesX@}+\csuse{afterruleX@#1}\relax%
13513 }%
13514 {}%
13515 }%
13516 \vskip\skip\csname footins#1\endcsname%
13517 \leftskip=\z@
13518 \rightskip=\z@
13519 \ifl@dpairing\else%
13520 \hsize=\old@hsize%
13521 \fi%
13522 \setnoteswidthliketwocolumnsX@{#1}%
13523 \setnotesXpositionliketwocolumns@{#1}%
13524 \print@footnoteXrule{#1}%
13525 }%
13526
13527 % \end{macrocode}
13528 % \end{macro}
13529 %
13530 % \begin{macro}{\normalfootnoteruleX}
13531 % The rule drawn before the footnote series group.
13532 % \begin{macrocode}
13533 \let\normalfootnoteruleX=\footnoterule
13534
13535 % \end{macrocode}
13536 % \end{macro}
13537 %
13538 % \begin{macro}{\normalfootgroupX}
13539 % \protect\cs{normalfootgroupX}\marg{series} sends the contents of the \meta{series}
13540 % insert box to the output page without alteration.
13541 % \begin{macrocode}
13542 \newcommand*{\normalfootgroupX}[1]{%
13543 \csuse{bhookgroupX@#1}%
13544 \unvbox\@nameuse{footins#1}%
13545 \hsize=\old@hsize%
13546 }%
13547
13548 % \end{macrocode}
13549 % \end{macro}
13550 %
13551 % \begin{macro}{\mpnormalfootgroupX}
13552 % The minipage version.
13553 % \begin{macrocode}
13554 \newcommand*{\mpnormalfootgroupX}[1]{%
13555 \vskip\skip\@nameuse{mpfootins#1}
13556 \ifl@dpairing\ifparledgroup%
13557 \leavevmode\marks\parledgroup@{begin}%
13558 \marks\parledgroup@series{#1}%
13559 \marks\parledgroup@type{footnoteX}%
13560 \fi\fi\normalcolor
13561 \ifparledgroup%
13562 \ifl@dpairing%
13563 \else%
13564 \setnoteswidthliketwocolumnsX@{#1}%
13565 \setnotesXpositionliketwocolumns@{#1}%
13566 \print@footnoteXrule{#1}%
13567 \fi%
13568 \else%
13569 \setnoteswidthliketwocolumnsX@{#1}%
13570 \setnotesXpositionliketwocolumns@{#1}%
13571 \print@footnoteXrule{#1}%
13572 \fi%
13573 \csuse{bhookgroupX@#1}%
13574 \unvbox\@nameuse{mpfootins#1}}
13575
13576 % \end{macrocode}
13577 % \end{macro}
13578 %
13579 %
13580 % \begin{macro}{\normalbfnoteX}
13581 % \changes{v0.7.0}{2005/02/18}{Removed extraneous space from \protect\cs{normalbfnoteX}}
13582 % \changes{v1.4.9}{2013/07/10}{Allow to redefine \protect\cs{thefootnoteX} with \c{alph} when some packages are loaded.}
13583 % \#1 = footnote series, \#2 = footnote content, \#3 manual footnote number
13584 % \begin{macrocode}
13585
13586 \newcommand{\normalbfnoteX}[3]{%
13587 \get@thisfootnoteX{#1}%
13588 \ifledRcol%
13589 \ifluatex
13590 \footnotelang@lua[R]%
13591 \fi
13592 \@ifundefined{xpg@main@language}%if polyglossia
13593 {}%
13594 {\footnotelang@poly[R]}%
13595 \xright@appenditem{%
13596 \noexpand\led@set@index@fornote{#1}%
13597 \noexpand\prepare@edindex@fornote{\l@d@nums}%
13598 \unexpanded{\gdef\@currentnotetype{familiar}}%
13599 \unexpanded{\def\this@footnoteX@reading}{\the\csname footnote#1@reading\endcsname}%
13600 \noexpand\vbfnoteX{#1}{#2}{\thisc@footnote}{#3}%
13601 \noexpand\led@reinit@index@fornote%
13602 \unexpanded{\advance\@edindex@fornote@\m@ne}%
13603 }%
13604 \to\inserts@listR
13605 \global\advance\insert@countR \@ne%
13606 \else%
13607 \ifluatex
13608 \footnotelang@lua%
13609 \fi
13610 \@ifundefined{xpg@main@language}%if polyglossia
13611 {}%
13612 {\footnotelang@poly}%
13613 \xright@appenditem{%
13614 \noexpand\led@set@index@fornote{#1}%
13615 \noexpand\prepare@edindex@fornote{\l@d@nums}%
13616 \unexpanded{\gdef\@currentnotetype{familiar}}%
13617 \unexpanded{\def\this@footnoteX@reading}{\the\csname footnote#1@reading\endcsname}%
13618 \noexpand\vbfnoteX{#1}{#2}{\thisc@footnote}{#3}%
13619 \noexpand\led@reinit@index@fornote%
13620 \unexpanded{\advance\@edindex@fornote@\m@ne}%
13621 }%
13622 \to\inserts@list
13623 \global\advance\insert@count \@ne%
13624 \fi
13625 \ignorespaces}
13626
13627 % \end{macrocode}
13628 % \end{macro}
13629 %
13630 % \begin{macro}{\get@thisfootnoteX}
13631 % The macro \cs{get@thisfootnote} command just saves the footnote number in the \cs{thisfootnote} macro, depending on the use of pairing environments.
13632 % \begin{macrocode}
13633 \newcommand{\get@thisfootnoteX}[1]{%
13634 \ifboolexpr{bool{l@dpairing} or bool{l@dprintingpages} or bool{l@dprintingcolumns}}{%
13635 \protected@xdef\thisc@footnote{\the\csname footnote#1@reading\endcsname}%
13636 }{%
13637 \protected@xdef\thisc@footnote{\the\csname c@footnote#1\endcsname}%
13638 }%
13639 }%
13640 % \end{macrocode}
13641 % \end{macro}
13642 % \begin{macro}{\vbfnoteX}
13643 % This command calls the correct footnote-inserting commands.
13644 % \#1 footnote series, \#2 footnote content, \#3 footnote counter, \#4 manual footnote mark
13645 % \begin{macrocode}
13646 \newcommand{\vbfnoteX}[4]{%
13647 \get@fnmarkX{#1}{#3}{#4}\relax%
13648 \@nameuse{regvfootnote#1}{#1}{#2}%
13649 }%
13650 % \end{macrocode}
13651 % \end{macro}
13652 %
13653 % \begin{macro}{\get@fnmarkX}
13654 % This command gets the correct footnote number when typesetting parallel texts.
13655 % \#1 footnote series, \#2 footnote counter, \#3 manual footnote number.
13656 % It also gets, if required, a hyperref (almost) unique identifier for the footnote.
13657 % \begin{macrocode}
13658 \newcommand{\get@fnmarkX}[3]{%
13659 \ifstrempty{#3}{%
13660 \ifboolexpr{bool{l@dpairing} or bool{l@dprintingpages} or bool{l@dprintingcolumns}}%
13661 {%
13662 \stepcounter{footnote#1@typeset}%
13663 \setcounter{footnote#1}{\value{footnote#1@typeset}}%
13664 \immediate\write\@mainaux{%
13665 \csgdef{footnote#1reading#2=typeset}{\the\csname c@footnote#1@typeset\endcsname}%
13666 }%
13667 }%
13668 {%
13669 \setcounter{footnote#1}{#2}%
13670 }%
13671 \csdef{@thefnmark#1}{\csuse{thefootnote#1}}%
13672 \csxdef{hr@thefnmark#1}{\the\value{footnote#1}@\the\csname footnote#1@series\endcsname}%
13673 }%
13674 {%
13675 \csdef{@thefnmark#1}{#3}%
13676 \csxdef{hr@thefnmark#1}{#3@\the\csname footnote#1@series\endcsname}%
13677 }%
13678 }%
13679 %
13680 % \end{macrocode}
13681 % \end{macro}
13682 % \begin{macro}{\vnumfootnoteX}
13683 % \changes{v0.7.0}{2005/02/18}{Removed extraneous space from \protect\cs{vnumfootnoteX}}
13684 % \#1 footnote series, \#2 footnote content, \#3 manual footnote mark
13685 % \begin{macrocode}
13686
13687 \newcommand{\vnumfootnoteX}[3]{%
13688 \ifnumberedpar@
13689 \edtext{}{%
13690 \advance\edtext@notes by 1%
13691 \normalbfnoteX{#1}{#2}{#3}%
13692 }%
13693 \else
13694 \def\this@footnoteX@reading{\the\csname footnote#1@reading\endcsname}%
13695 \get@thisfootnoteX{#1}%
13696 \get@fnmarkX{#1}{\expandonce\thisc@footnote}{#3}%
13697 \@nameuse{regvfootnote#1}{#1}{#2}%
13698 \fi}
13699 % \end{macrocode}
13700 % \end{macro}
13701 %
13702 %
13703 %
13704 % \begin{macro}{arrangementX@normal}
13705 % \protect\cs{arrangementX@normal}\marg{series} initialises the settings for
13706 % the \meta{series} footnotes. This should always be called for
13707 % each series.
13708 % \begin{macrocode}
13709 \newcommand*{\arrangementX@normal}[1]{%
13710 \csgdef{series@displayX#1}{normal}
13711 \expandafter\let\csname footstart#1\endcsname=\normalfootstartX
13712 \@namedef{@footnotemark#1}{\normal@footnotemarkX{#1}}
13713 \@namedef{bodyfootmark#1}{\normalbodyfootmarkX{#1}}
13714 \expandafter\let\csname regvfootnote#1\endcsname=\normalvfootnoteX
13715 \expandafter\let\csname vfootnote#1\endcsname=\vnumfootnoteX
13716 \expandafter\let\csname footfmt#1\endcsname=\normalfootfmtX
13717 \@namedef{footfootmark#1}{\normalfootfootmarkX{#1}}
13718 \expandafter\let\csname footgroup#1\endcsname=\normalfootgroupX
13719 \expandafter\let\csname footnoterule#1\endcsname=\normalfootnoteruleX
13720 \count\csname footins#1\endcsname=1000
13721 \csxdef{default@footins#1}{1000}%Use to have note only for one side
13722 \dimen\csname footins#1\endcsname=\csuse{maxhnotesX@#1}
13723 \skip\csname footins#1\endcsname=\csuse{beforenotesX@#1}%
13724 \advance\skip\csname footins#1\endcsname by\csuse{afterruleX@#1}%
13725 % \end{macrocode}
13726 % Additions for minipages.
13727 % \begin{macrocode}
13728 \ifnoledgroup@\else%
13729 \expandafter\let\csname mpvfootnote#1\endcsname=\mpnormalvfootnoteX
13730 \expandafter\let\csname mpfootgroup#1\endcsname=\mpnormalfootgroupX
13731 \count\csname mpfootins#1\endcsname=1000
13732 \dimen\csname mpfootins#1\endcsname=\csuse{maxhnotesX@#1}
13733 \skip\csname mpfootins#1\endcsname=\csuse{beforenotesX@#1}%
13734 \advance\skip\csname mpfootins#1\endcsname by\csuse{afterruleX@#1}%
13735 \fi
13736 }
13737
13738 % \end{macrocode}
13739 % \end{macro}
13740 %
13741 % \subsubsection{Two columns footnotes}
13742 %
13743 % The following macros set footnotes in two columns. It is assumed
13744 % that the length of each footnote is less than the column width.
13745 %
13746 % \begin{macro}{\arrangementX@twocol}
13747 % \begin{macrocode}
13748 \newcommand*{\arrangementX@twocol}[1]{%
13749 \csgdef{series@displayX#1}{twocol}
13750 \expandafter\let\csname regvfootnote#1\endcsname=\twocolvfootnoteX
13751 \expandafter\let\csname footfmt#1\endcsname=\twocolfootfmtX
13752 \expandafter\let\csname footgroup#1\endcsname=\twocolfootgroupX
13753 \dimen\csname footins#1\endcsname=\csuse{maxhnotesX@#1}%
13754 \skip\csname footins#1\endcsname=\csuse{beforenotesX@#1}%
13755 \advance\skip\csname footins#1\endcsname by \csuse{afterruleX@#1}\relax%
13756 \twocolfootsetupX{#1}
13757 \ifnoledgroup@\else%
13758 \expandafter\let\csname mpvfootnote#1\endcsname=\mpnormalvfootnoteX
13759 \expandafter\let\csname mpfootgroup#1\endcsname=\mptwocolfootgroupX
13760 \skip\csname mpfootins#1\endcsname=\csuse{beforenotesX@#1}%
13761 \advance\skip\csname mpfootins#1\endcsname by\csuse{afterruleX@#1}
13762 \mptwocolfootsetupX{#1}
13763 \fi%
13764 }
13765
13766 % \end{macrocode}
13767 % \end{macro}
13768 %
13769 % \begin{macro}{\twocolfootsetupX}
13770 % \begin{macro}{\mptwocolfootsetupX}
13771 % \protect\cs{twocolfootsetupX}\marg{series}
13772 % \begin{macrocode}
13773 \newcommand*{\twocolfootsetupX}[1]{%
13774 \count\csname footins#1\endcsname 500
13775 \csxdef{default@footins#1}{500}%Use this to confine the notes to one side only
13776 \multiply\dimen\csname footins#1\endcsname by \tw@}
13777 \newcommand*{\mptwocolfootsetupX}[1]{%
13778 \count\csname mpfootins#1\endcsname 500
13779 \multiply\dimen\csname mpfootins#1\endcsname by \tw@}
13780
13781 % \end{macrocode}
13782 % \end{macro}
13783 % \end{macro}
13784 %
13785 % \begin{macro}{\twocolvfootnoteX}
13786 % \protect\cs{twocolvfootnoteX}\marg{series}
13787 % \begin{macrocode}
13788 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\twocolvfootnoteX}[2]{%
13789 \beforeinsertion@X{#1}%
13790 \let\bidi@RTL@everypar\relax%
13791 \insert\csname footins#1\endcsname\bgroup%
13792 \hsize=\expandafter\dimexpr\csuse{widthX@#1}\relax%
13793 \noindent\csuse{bhooknoteX@#1}%
13794 \csuse{notefontsizeX@#1}%
13795 \footsplitskips%
13796 \spaceskip=\z@skip \xspaceskip=\z@skip%
13797 \@nameuse{footfmt#1}{#1}{#2}\egroup}
13798
13799 % \end{macrocode}
13800 % \end{macro}
13801 %
13802 % \begin{macro}{\twocolfootfmtX}
13803 % \protect\cs{twocolfootfmtX}\marg{series}
13804 % \begin{macrocode}
13805 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\twocolfootfmtX}[2]{%
13806 \protected@edef\@currentlabel{%
13807 \@nameuse{@thefnmark#1}%
13808 }%
13809 \normal@pars%
13810 \sethangindentX{#1}%
13811 \hsize \csuse{hsizetwocolX@#1}%
13812 \setparindentX{#1}%
13813 \tolerance=5000\relax%
13814 \par%
13815 \@tempdima=\parindent%
13816 \csuse{colalignX@#1}%
13817 \parindent=\@tempdima%
13818 \csuse{wrapcomponentsX@#1}{%
13819 \hspace{\parindent}%
13820 \csuse{notenumfontX@#1}%
13821 \wrapped@footfootmarkX{#1}%
13822 \strut%
13823 \csuse{wrapcontentX@#1}{#2}%
13824 \strut\par%
13825 }%
13826 \allowbreak%
13827 }%
13828
13829 % \end{macrocode}
13830 % \end{macro}
13831 %
13832 % \begin{macro}{\twocolfootgroupX}
13833 % \begin{macro}{\mptwocolfootgroupX}
13834 % \protect\cs{twocolfootgroupX}\marg{series}
13835 % \begin{macrocode}
13836 \newcommand*{\twocolfootgroupX}[1]{{\csuse{bhookgroupX@#1}\csuse{notefontsizeX@#1}
13837 \splittopskip=\ht\strutbox
13838 \expandafter
13839 \rigidbalanceX\csname footins#1\endcsname \tw@ \splittopskip}}
13840
13841 \newcommand*{\mptwocolfootgroupX}[1]{{%
13842 \vskip\skip\@nameuse{mpfootins#1}
13843 \ifl@dpairing\ifparledgroup%
13844 \leavevmode\marks\parledgroup@{begin}%
13845 \marks\parledgroup@series{#1}%
13846 \marks\parledgroup@type{footnoteX}%
13847 \fi\fi\normalcolor
13848 \ifparledgroup%
13849 \ifl@dpairing%
13850 \else%
13851 \setnoteswidthliketwocolumnsX@{#1}%
13852 \setnotesXpositionliketwocolumns@{#1}%
13853 \print@footnoteXrule{#1}%
13854 \fi%
13855 \else%
13856 \setnoteswidthliketwocolumnsX@{#1}%
13857 \setnotesXpositionliketwocolumns@{#1}%
13858 \print@footnoteXrule{#1}%
13859 \fi%
13860 \csuse{bhookgroupX@#1}%
13861 \splittopskip=\ht\strutbox
13862 \expandafter
13863 \rigidbalanceX\csname mpfootins#1\endcsname \tw@ \splittopskip}}
13864
13865 % \end{macrocode}
13866 % \end{macro}
13867 % \end{macro}
13868 %
13869 % \subsubsection{Three columns footnotes}
13870 %
13871 % The following macros set footnotes in three columns. It is assumed
13872 % that the length of each footnote is less than the column width.
13873 %
13874 %
13875 % \begin{macro}{\arrangementX@threecol}
13876 % \begin{macrocode}
13877 \newcommand*{\arrangementX@threecol}[1]{%
13878 \csgdef{series@displayX#1}{threecol}
13879 \expandafter\let\csname regvfootnote#1\endcsname=\threecolvfootnoteX
13880 \expandafter\let\csname footfmt#1\endcsname=\threecolfootfmtX
13881 \expandafter\let\csname footgroup#1\endcsname=\threecolfootgroupX
13882 \dimen\csname footins#1\endcsname=\csuse{maxhnotesX@#1}%
13883 \skip\csname footins#1\endcsname=\csuse{beforenotesX@#1}%
13884 \advance\skip\csname footins#1\endcsname by \csuse{afterruleX@#1}\relax%
13885 \threecolfootsetupX{#1}
13886 \ifnoledgroup@\else%
13887 \expandafter\let\csname mpvfootnote#1\endcsname=\mpnormalvfootnoteX
13888 \expandafter\let\csname mpfootgroup#1\endcsname=\mpthreecolfootgroupX
13889 \skip\csname mpfootins#1\endcsname=\csuse{beforenotesX@#1}%
13890 \advance\skip\csname mpfootins#1\endcsname by\csuse{afterruleX@#1}
13891 \mpthreecolfootsetupX{#1}
13892 \fi%
13893 }
13894
13895 % \end{macrocode}
13896 % \end{macro}
13897 %
13898 % \begin{macro}{\threecolfootsetupX}
13899 % \begin{macro}{\mpthreecolfootsetupX}
13900 % \protect\cs{threecolfootsetupX}\marg{series}
13901 % \begin{macrocode}
13902 \newcommand*{\threecolfootsetupX}[1]{%
13903 \count\csname footins#1\endcsname 333
13904 \csxdef{default@footins#1}{333}%Use this to confine the notes to one side only
13905 \multiply\dimen\csname footins#1\endcsname by \thr@@}
13906 \newcommand*{\mpthreecolfootsetupX}[1]{%
13907 \count\csname mpfootins#1\endcsname 333
13908 \multiply\dimen\csname mpfootins#1\endcsname by \thr@@}
13909
13910 % \end{macrocode}
13911 % \end{macro}
13912 % \end{macro}
13913 %
13914 % \begin{macro}{\threecolvfootnoteX}
13915 % \protect\cs{threecolvfootnoteX}\marg{series}\marg{text}
13916 % \begin{macrocode}
13917 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\threecolvfootnoteX}[2]{%
13918 \let\bidi@RTL@everypar\relax%
13919 \beforeinsertion@X{#1}%
13920 \insert\csname footins#1\endcsname\bgroup%
13921 \hsize=\expandafter\dimexpr\csuse{widthX@#1}\relax%
13922 \noindent\csuse{bhooknoteX@#1}%
13923 \csuse{notefontsizeX@#1}%
13924 \footsplitskips%
13925 \@nameuse{footfmt#1}{#1}{#2}\egroup}
13926
13927 % \end{macrocode}
13928 % \end{macro}
13929 %
13930 % \begin{macro}{\threecolfootfmtX}
13931 % \protect\cs{threecolfootfmtX}\marg{series}
13932 % \begin{macrocode}
13933 \notbool{parapparatus@}{\newcommand*}{\newcommand}{\threecolfootfmtX}[2]{%
13934 \protected@edef\@currentlabel{%
13935 \@nameuse{@thefnmark#1}%
13936 }%
13937 \sethangindentX{#1}%
13938 \normal@pars%
13939 \hsize \csuse{hsizethreecolX@#1}%
13940 \setparindentX{#1}%
13941 \tolerance=5000\relax%
13942 \@tempdima=\parindent%
13943 \csuse{colalignX@#1}%
13944 \parindent=\@tempdima%
13945 \csuse{wrapcomponentsX@#1}{%
13946 \hspace{\parindent}%
13947 \csuse{notenumfontX@#1}%
13948 \wrapped@footfootmarkX{#1}%
13949 \strut%
13950 \csuse{wrapcontentX@#1}{#2}%
13951 \strut%
13952 }%
13953 \par%
13954 \allowbreak%
13955 }%
13956
13957 % \end{macrocode}
13958 % \end{macro}
13959 %
13960 % \begin{macro}{\threecolfootgroupX}
13961 % \begin{macro}{\mpthreecolfootgroupX}
13962 % \protect\cs{threecolfootgroupX}\marg{series}
13963 % \begin{macrocode}
13964 \newcommand*{\threecolfootgroupX}[1]{{\csuse{bhookgroupX@#1}\csuse{notefontsizeX@#1}
13965 \splittopskip=\ht\strutbox
13966 \expandafter
13967 \rigidbalanceX\csname footins#1\endcsname \thr@@ \splittopskip}}
13968
13969 \newcommand*{\mpthreecolfootgroupX}[1]{{%
13970 \vskip\skip\@nameuse{mpfootins#1}
13971 \ifl@dpairing\ifparledgroup
13972 \leavevmode\marks\parledgroup@{begin}%
13973 \marks\parledgroup@series{#1}%
13974 \marks\parledgroup@type{footnoteX}%
13975 \fi\fi\normalcolor
13976 \ifparledgroup%
13977 \ifl@dpairing%
13978 \else%
13979 \setnoteswidthliketwocolumnsX@{#1}%
13980 \setnotesXpositionliketwocolumns@{#1}%
13981 \print@footnoteXrule{#1}%
13982 \fi%
13983 \else%
13984 \setnoteswidthliketwocolumnsX@{#1}%
13985 \setnotesXpositionliketwocolumns@{#1}%
13986 \print@footnoteXrule{#1}%
13987 \fi%
13988 \csuse{bhookgroupX@#1}%
13989 \splittopskip=\ht\strutbox
13990 \expandafter
13991 \rigidbalanceX\csname mpfootins#1\endcsname \thr@@ \splittopskip}}
13992
13993 % \end{macrocode}
13994 % \end{macro}
13995 % \end{macro}
13996 %
13997 % \subsubsection{Paragraphed footnotes}
13998 %
13999 % The following macros set footnotes as one paragraph.
14000 %
14001 % \begin{macro}{\arrangementX@paragraph}
14002 % \changes{v1.15.0}{2015/01/12}{Correct bug with paragraphed familiar footnotes setting.}
14003 % \protect\cs{footparagraphX}\marg{series}
14004 % \begin{macrocode}
14005 \newcommand*{\arrangementX@paragraph}[1]{%
14006 \csgdef{series@displayX#1}{paragraph}%
14007 \expandafter\let\csname footstart#1\endcsname=\parafootstartX
14008 \expandafter\let\csname regvfootnote#1\endcsname=\para@vfootnoteX
14009 \expandafter\let\csname footfmt#1\endcsname=\parafootfmtX
14010 \expandafter\let\csname footgroup#1\endcsname=\para@footgroupX
14011 \expandafter\let\csname footnoterule#1\endcsname=\normalfootnoteruleX
14012 \count\csname footins#1\endcsname=1000
14013 \csxdef{default@footins#1}{1000}%Use this to confine the notes to one side only
14014 \dimen\csname footins#1\endcsname=\csuse{maxhnotesX@#1}
14015 \skip\csname footins#1\endcsname=\csuse{beforenotesX@#1}%
14016 \advance\skip\csname footins#1\endcsname by\csuse{afterruleX@#1}%
14017 \para@footsetupX{#1}
14018 \ifnoledgroup@\else
14019 \expandafter\let\csname mpvfootnote#1\endcsname=\mppara@vfootnoteX
14020 \expandafter\let\csname mpfootgroup#1\endcsname=\mppara@footgroupX
14021 \count\csname mpfootins#1\endcsname=1000
14022 \dimen\csname mpfootins#1\endcsname=\csuse{maxhnotesX@#1}
14023 \skip\csname mpfootins#1\endcsname=\csuse{beforenotesX@#1}%
14024 \advance\skip\csname mpfootins#1\endcsname by\csuse{afterruleX@#1}%
14025 \fi
14026 }
14027
14028 % \end{macrocode}
14029 % \end{macro}
14030 %
14031 % \begin{macro}{\para@footsetupX}
14032 % \protect\cs{para@footsetupX}\marg{series}
14033 % \changes{v0.2.2}{2003/11/04}{Added \protect\cs{footfudgefiddle} to \protect\cs{para@footsetupX}}
14034 % \changes{v1.13.0}{2014/09/16}{In \protect\cs{para@footsetupX}, use \protect\cs{columnwidth} instead of \protect\cs{hsize}}
14035 % \begin{macrocode}
14036 \newcommand*{\para@footsetupX}[1]{{\csuse{bhookgroupX@#1}\csuse{notefontsizeX@#1}
14037 \setnoteswidthliketwocolumnsX@{#1}%
14038 \ifcsempty{widthX@#1}%
14039 {}%
14040 {\columnwidth=\expandafter\dimexpr\csuse{widthX@#1}\relax}%
14041 \dimen0=\baselineskip
14042 \multiply\dimen0 by 1024
14043 \divide\dimen0 by \columnwidth \multiply\dimen0 by \footfudgefiddle\relax%
14044 \expandafter
14045 \xdef\csname footfudgefactor#1\endcsname{%
14046 \expandafter\strip@pt\dimen0 }}}
14047
14048 % \end{macrocode}
14049 % \end{macro}
14050 %
14051 % \begin{macro}{\parafootstartX}
14052 % \protect\cs{parafootstartX}\marg{series}
14053 % \begin{macrocode}
14054 \newcommand*{\parafootstartX}[1]{%
14055 \ifdimequal{0pt}{\prenotesX@}{}%
14056 {%
14057 \iftoggle{prenotesX@}{%
14058 \togglefalse{prenotesX@}%
14059 \skip\csname footins#1\endcsname=%
14060 \glueexpr\csuse{prenotesX@}+\csuse{afterruleX@#1}\relax%
14061 }%
14062 {}%
14063 }%
14064 \leftskip=\z@
14065 \rightskip=\z@
14066 \parfillskip=0pt plus 1fil
14067 \setparindentX{#1}%
14068 \vskip\skip\@nameuse{footins#1}%
14069 \setnoteswidthliketwocolumnsX@{#1}%
14070 \setnotesXpositionliketwocolumns@{#1}%
14071 \print@footnoteXrule{#1}%
14072 }
14073
14074 % \end{macrocode}
14075 % \end{macro}
14076 %
14077 % \begin{macro}{\para@vfootnoteX}
14078 % \begin{macro}{\mppara@vfootnoteX}
14079 % \protect\cs{para@vfootnoteX}\marg{series}\marg{text}
14080 % \begin{macrocode}
14081 \newcommand*{\para@vfootnoteX}[2]{%
14082 \csuse{beforeinsertingX@#1}%
14083 \insert\csname footins#1\endcsname%
14084 \bgroup
14085 \csuse{notefontsizeX@#1}
14086 \footsplitskips
14087 \setbox0=\vbox{\hsize=\maxdimen%
14088 \let\bidi@RTL@everypar\@empty%
14089 \insert@txtbeforenotesX{#1}%
14090 \noindent\csuse{bhooknoteX@#1}%
14091 \@nameuse{footfmt#1}{#1}{#2}}%
14092 \setbox0=\hbox{\unvxhX{0}{#1}}%
14093 \dp0=\z@
14094 \ht0=\csname footfudgefactor#1\endcsname\wd0
14095 \box0
14096 \penalty0
14097 \egroup}
14098 \newcommand*{\mppara@vfootnoteX}[3]{%
14099 \get@thisfootnoteX{#1}%
14100 \get@fnmarkX{#1}{\thisc@footnote}{#3}%
14101 \edef\this@footnoteX@reading{\the\csname footnote#1@reading\endcsname}%
14102 \global\setbox\@nameuse{mpfootins#1}\vbox{%
14103 \unvbox\@nameuse{mpfootins#1}
14104 \csuse{notefontsizeX@#1}
14105 \footsplitskips
14106 \setbox0=\vbox{\hsize=\maxdimen%
14107 \let\bidi@RTL@everypar\@empty%
14108 \noindent\color@begingroup%
14109 \csuse{bhooknoteX@#1}%
14110 \@nameuse{footfmt#1}{#1}{#2}\color@endgroup}%
14111 \setbox0=\hbox{\unvxhX{0}{#1}}%
14112 \dp0=\z@
14113 \ht0=\csname footfudgefactor#1\endcsname\wd0
14114 \box0
14115 \penalty0}}
14116
14117 % \end{macrocode}
14118 % \end{macro}
14119 % \end{macro}
14120 % \begin{macro}{\unvxhX}
14121 % \begin{macrocode}
14122 \newcommand*{\unvxhX}[2]{% 2th is optional for retro-compatibility
14123 \setbox0=\vbox{\unvbox#1%
14124 \global\setbox1=\lastbox}%
14125 \unhbox1
14126 \unskip % remove \rightskip,
14127 \unskip % remove \parfillskip,
14128 \unpenalty % remove \penalty of 10000,
14129 \hskip\csuse{afternoteX@#2}%
14130 \relax}% but add the glue to go between the notes
14131
14132 % \end{macrocode}
14133 % \end{macro}
14134 % \begin{macro}{\parafootfmtX}
14135 % \protect\cs{parafootfmtX}\marg{series}
14136 % \begin{macrocode}
14137 \newcommand*{\parafootfmtX}[2]{%
14138 \protected@edef\@currentlabel{%
14139 \@nameuse{@thefnmark#1}%
14140 }%
14141 \insertparafootsepX{#1}%
14142 \ledsetnormalparstuff@common%
14143 \csuse{wrapcomponentsX@#1}{%
14144 \csuse{notenumfontX@#1}%
14145 \wrapped@footfootmarkX{#1}%
14146 \strut%
14147 \csuse{wrapcontentX@#1}{#2}%
14148 \penalty-10%
14149 }%
14150 }%
14151
14152 % \end{macrocode}
14153 % \end{macro}
14154 %
14155 % \begin{macro}{\para@footgroupX}
14156 % \begin{macro}{\mppara@footgroupX}
14157 % \protect\cs{para@footgroupX}\marg{series}
14158 % \begin{macrocode}
14159 \newcommand*{\para@footgroupX}[1]{%
14160 \hsize=\expandafter\dimexpr\csuse{widthX@#1}\relax%
14161 \unvbox\csname footins#1\endcsname
14162 \ifcsstring{raggedX@#1}{L}{\RaggedLeft}{}%
14163 \ifcsstring{raggedX@#1}{R}{\RaggedRight}{}%
14164 \makehboxofhboxes
14165 \setbox0=\hbox{\unhbox0 \removehboxes}%
14166 \csuse{bhookgroupX@#1}
14167 \csuse{notefontsizeX@#1}
14168 \unhbox0\par}
14169
14170 \newcommand*{\mppara@footgroupX}[1]{{%
14171 \setnoteswidthliketwocolumnsX@{#1}%
14172 \vskip\skip\@nameuse{mpfootins#1}
14173 \ifl@dpairing\ifparledgroup
14174 \leavevmode%
14175 \leavevmode\marks\parledgroup@{begin}%
14176 \marks\parledgroup@series{#1}%
14177 \marks\parledgroup@type{footnoteX}%
14178 \fi\fi\normalcolor
14179 \ifparledgroup%
14180 \ifl@dpairing%
14181 \else%
14182 \setnoteswidthliketwocolumnsX@{#1}%
14183 \setnotesXpositionliketwocolumns@{#1}%
14184 \print@footnoteXrule{#1}%
14185 \fi%
14186 \else%
14187 \setnoteswidthliketwocolumnsX@{#1}%
14188 \setnotesXpositionliketwocolumns@{#1}%
14189 \print@footnoteXrule{#1}%
14190 \fi%
14191 \unvbox\csname mpfootins#1\endcsname
14192 \ifcsstring{raggedX@#1}{L}{\RaggedLeft}{}%
14193 \ifcsstring{raggedX@#1}{R}{\RaggedRight}{}%
14194 \makehboxofhboxes
14195 \setbox0=\hbox{\unhbox0 \removehboxes}%
14196 \csuse{bhookgroupX@#1}%
14197 \csuse{notefontsizeX@#1}%
14198 \setparindentX{#1}%
14199 \unhbox0\par}}
14200
14201 % \end{macrocode}
14202 % \end{macro}
14203 % \end{macro}
14204 % \paragraph{Insertion of the footnotes separator}
14205 % The command \protect\cs{insertparafootsepX}\marg{series} must be called at the beginning of \protect\cs{parafootftmX}.
14206 % \begin{macro}{\insertparafootsepX}
14207 % \begin{macrocode}
14208 \newcommand{\insertparafootsepX}[1]{%
14209 \ifledRcol@%
14210 \ifnumequal{\csuse{prevpage#1@numR}}{\page@numR}%
14211 {\csuse{parafootsepX@#1}}%
14212 {}%
14213 \global\csname prevpage#1@numR\endcsname=\page@numR%
14214 \else%
14215 \ifboolexpr{bool{l@dprintingpages} or bool{l@dprintingcolumns} or bool{numbering}}{%
14216 \ifnumequal{\csuse{prevpage#1@num}}{\page@num}%
14217 {\csuse{parafootsepX@#1}}%
14218 {}%
14219 \global\csname prevpage#1@num\endcsname=\page@num%
14220 }{%We can't use directly the page counter, see https://tex.stackexchange.com/a/239457/7712
14221 \global\expandafter\advance\csname footnote#1@parafootsepX\endcsname by 1%
14222 \edef\@tmpa{parafootsepX@#1@\the\csname footnote#1@parafootsepX\endcsname}%
14223 \expandafter\edlabel\expandafter{\@tmpa}%
14224 \edef\@tmpb{\expandafter\xpageref\expandafter{\@tmpa}}%
14225 \IfStrEq{\csuse{prevpage#1@num@outnumbering}}{\@tmpb}%
14226 {\csuse{parafootsepX@#1}}%
14227 {}%
14228 \global\cslet{prevpage#1@num@outnumbering}{\@tmpb}%
14229 }%
14230 \fi%
14231 }
14232 % \end{macrocode}
14233 % \end{macro}
14234 % \subsection{Wrapping footnote marks in hyperlink}
14235 % \begin{macro}{\wrapped@footfootmarkX}
14236 % \cs{wrapped@footfootmarkX} prints the footnote mark of the footpage, wrapped in \package{hyperref} package's commands, if needed.
14237 % \begin{macrocode}
14238 \newcommand{\wrapped@footfootmarkX}[1]{%
14239 \ifdefined\hypertarget%
14240 \hyperlink%
14241 {@bodyfootmark#1@\csuse{hr@thefnmark#1}}%
14242 {\@nameuse{footfootmark#1}}%
14243 \Hy@raisedlink{%
14244 \hypertarget%
14245 {@footnotemark#1@\csuse{hr@thefnmark#1}}%
14246 {}%
14247 }%
14248 \else%
14249 \@nameuse{footfootmark#1}%
14250 \fi%
14251 \ifdimequal{\csuse{afternumberX@#1}}{0pt}%
14252 {}%
14253 {\hspace{\csuse{afternumberX@#1}}}%
14254 }%
14255 % \end{macrocode}
14256 % \end{macro}
14257 % \begin{macro}{\wrapped@bodyfootmarkX}
14258 % \cs{wrapped@bodyfootmarkX} prints the footnote mark of the text body, wrapped in \package{hyperref} package's commands, if needed.
14259 % \begin{macrocode}
14260 \newcommand{\wrapped@bodyfootmarkX}[1]{%
14261 \ifdefined\hypertarget%
14262 \hyperlink%
14263 {@footnotemark#1@\csuse{hr@thefnmark#1}}%
14264 {\@nameuse{bodyfootmark#1}}%
14265 \Hy@raisedlink{%
14266 \hypertarget%
14267 {@bodyfootmark#1@\csuse{hr@thefnmark#1}}%
14268 {}%
14269 }%
14270 \else%
14271 \@nameuse{bodyfootmark#1}%
14272 \fi%
14273 }%
14274 % \end{macrocode}
14275 % \end{macro}
14276 % \section{Code common to both critical and familiar footnote in normal arrangement}
14277 % \protect\cs{par} should always be redefined to \protect\cs{endgraf} within
14278 % the format macro (this is what \protect\cs{normal@pars} does),
14279 % to override tricky material in the main text
14280 % to get the lines numbered automatically (as set up by
14281 % \protect\cs{autopar}, for example).
14282 %
14283 % In the case of footnote arranged in a \enquote{normal} way, we also must set some setting for paragraph indent and text direction when using \LuaLaTeX.
14284 %
14285 % That why we have defined \protect\cs{ledsetnormalparstuff@common} in order to make this setting for both familiar and critical notes.
14286 % This command is called by command to make specific setting to critical or familiar footnote.
14287 %
14288 % \begin{macro}{\ledsetnormalparstuff@common}
14289 % \begin{macro}{\Xledsetnormalparstuff}
14290 % \begin{macro}{\ledsetnormalparstuffX}
14291 %
14292 % \changes{v1.4.0}{2012/11/16}{Direction of footnotes with polyglossia.}
14293 % \changes{v1.21.0}{2015/04/13}{\protect\cs{ledsetnormalparstuff} is deprecated and becomes \protect\cs{ledsetnormalparstuffX} and \protect\cs{Xledsetnormalparstuff}.}
14294 % \changes{v2.1.3}{2015/09/05}{Replaced \protect\cs{noindent} with \protect\cs{parindent} set to 0pt.}
14295 % \begin{macrocode}
14296 \newcommand*{\ledsetnormalparstuff@common}{%
14297 \ifluatex%
14298 \ifdefstring{\footnote@luatextextdir}{TLT}{}%
14299 {\textdir\footnote@luatextextdir}%
14300 \pardir\footnote@luatexpardir%
14301 \fi%
14302 \csuse{\csuse{footnote@dir}}%
14303 \normal@pars%
14304 \parfillskip \z@ \@plus 1fil}%
14305
14306 \newcommand*{\Xledsetnormalparstuff}[1]{%
14307 \ledsetnormalparstuff@common%
14308 \Xsetparindent{#1}%
14309 \iftoggle{Xparindent@#1}{\hspace{\parindent}}{}%
14310 }%
14311
14312 \newcommand*{\ledsetnormalparstuffX}[1]{%
14313 \ledsetnormalparstuff@common%
14314 \setparindentX{#1}%
14315 \iftoggle{parindentX@#1}{\hspace{\parindent}}{}%
14316 }%
14317 % \end{macrocode}
14318 % \end{macro}
14319 % \end{macro}
14320 % \end{macro}
14321 % \section{Footnotes' width for two columns}\label{width2columns}
14322 % We define here some commands which make sense only with \parpackage, but must be called when defining notes parameters.
14323 % These commands change the width of block notes to allow them to have the same size than two parallel columns.
14324 % \begin{macro}{\old@hsize}
14325 % \begin{macro}{\setXnoteswidthliketwocolumns@}
14326 % \begin{macro}{\setnoteswidthliketwocolumnsX@}
14327 % These two commands are called at the beginning of critical or familiar notes groups.
14328 % They set, if the option is enabled, the \protect\cs{hsize}. They are also called at the on the setup for paragraphed notes.
14329 % \begin{macrocode}
14330
14331 \newdimen\old@hsize%
14332 \AtBeginDocument{\old@hsize=\hsize}%
14333
14334 \newcommand{\setXnoteswidthliketwocolumns@}[1]{%
14335 \global\let\hsize@fornote=\hsize%
14336 \global\old@hsize=\hsize%
14337 \let\old@columwidth=\columnwidth%
14338 \iftoggle{Xnoteswidthliketwocolumns@#1}%
14339 {%
14340 \setwidthliketwocolumns%
14341 \global\let\hsize@fornote=\hsize%
14342 }%
14343 {}%
14344 \let\hsize=\hsize@fornote%
14345 \let\columnwidth=\old@columwidth%
14346 }%
14347
14348 \newcommand{\setnoteswidthliketwocolumnsX@}[1]{%
14349 \global\let\hsize@fornote=\hsize%
14350 \global\old@hsize=\hsize%
14351 \let\old@columwidth=\columnwidth%
14352 \iftoggle{noteswidthliketwocolumnsX@#1}%
14353 {%
14354 \setwidthliketwocolumns%
14355 \global\let\hsize@fornote=\hsize%
14356 }%
14357 {}%
14358 \let\hsize=\hsize@fornote%
14359 \let\columnwidth=\old@columwidth%
14360 }%
14361
14362 % \end{macrocode}
14363 % \end{macro}
14364 % \end{macro}
14365 % \end{macro}
14366 % \begin{macro}{\setXnotespositionliketwocolumns@}
14367 % \begin{macro}{\setnotesXpositionliketwocolumns@}
14368 % These two commands set the position of the critical / familiar
14369 % footnotes, depending on the hooks
14370 % \verb+Xnoteswidthliketwocolumns+ and \verb+noteswidthliketwocolumnsX+.
14371 % They call commands which are defined only in \parpackage, because this feature has no sens without \parpackage.
14372 % \begin{macrocode}
14373 \newcommand{\setXnotespositionliketwocolumns@}[1]{%
14374 \iftoggle{Xnoteswidthliketwocolumns@#1}{%
14375 \csuse{setnotespositionliketwocolumns@\columns@position}%
14376 }{}%
14377 }%
14378
14379 \newcommand{\setnotesXpositionliketwocolumns@}[1]{%
14380 \iftoggle{noteswidthliketwocolumnsX@#1}{%
14381 \csuse{setnotespositionliketwocolumns@\columns@position}%
14382 }{}%
14383 }%
14384
14385 % \end{macrocode}
14386 % \end{macro}
14387 % \end{macro}
14388 % \section{Footnotes' order}
14389 % \begin{macro}{\fnpos}
14390 % \begin{macro}{\mpfnpos}
14391 % \begin{macro}{\@fnpos}
14392 % \begin{macro}{\@mpfnpos}
14393 % The \protect\cs{fnpos} and \protect\cs{mpfnpos} simply place their arguments in \protect\cs{@fnpos} and \protect\cs{@mpfnpos}, which will be used later in the output routine.
14394 % \begin{macrocode}
14395 \def\@fnpos{familiar-critical}
14396 \def\@mpfnpos{critical-familiar}
14397 \newcommand{\fnpos}[1]{\xdef\@fnpos{#1}}
14398 \newcommand{\mpfnpos}[1]{\xdef\@mpfnpos{#1}}
14399 % \end{macrocode}
14400 % \end{macro}
14401 % \end{macro}
14402 % \end{macro}
14403 % \end{macro}
14404 % \section{Footnotes' rule}
14405 % \subsection{Printing only one footnote rule}
14406 % The \cs{Xonlyonerule} and \cs{onlyoneruleX} macros allow to print only one footnote rule in each page for, respectively, critical and familiar footnotes series. They just switch the low level \cs{Xonlyonerule@} and \cs{onlyoneruleX@} toggles.
14407 % \begin{macro}{Xonlyonerule}
14408 % \begin{macro}{Xonlyonerule@}
14409 % \begin{macro}{onlyoneruleX}
14410 % \begin{macro}{onlyoneruleX@}
14411 % \begin{macrocode}
14412 \unless\ifnocritical@%
14413 \newtoggle{Xonlyonerule@}%
14414 \newcommandx{\Xonlyonerule}[1][1=true]{%
14415 \settoggle{Xonlyonerule@}{#1}%
14416 }%
14417 \fi%
14418 \unless\ifnofamiliar@%
14419 \newtoggle{onlyoneruleX@}%
14420 \newcommandx{\onlyoneruleX}[1][1=true]{%
14421 \settoggle{onlyoneruleX@}{#1}%
14422 }%
14423 \fi%
14424 % \end{macrocode}
14425 % \end{macro}
14426 % \end{macro}
14427 % \end{macro}
14428 % \end{macro}
14429 % \subsection{Dealing with multiple columns}
14430 % Because the footnotes' rules can be shifted to the right when footnotes are set like two columns, we do not print them directly, but we put them in a \protect\cs{vbox}.
14431 %
14432 % \begin{macro}{\print@Xfootnoterule}
14433 % \begin{macro}{\print@footnoteXrule}
14434 % \begin{macro}{Xfirstfootnoterule@printed}
14435 % \begin{macro}{firstfootnoteruleX@printed}
14436 % \changes{v1.21.0}{2015/04/13}{Code refactoring: the spaces after the footnote rules are directly managed in \protect\cs{print@Xfootnoterule} and \protect\cs{print@footnoteXrule}}
14437 % \begin{macrocode}
14438 \newtoggle{Xfirstfootnoterule@printed}%
14439 \newcommand{\print@Xfootnoterule}[1]{%
14440 \ifboolexpr{%
14441 (not togl{Xonlyonerule@} or not togl{Xfirstfootnoterule@printed})%
14442 and%
14443 not (togl{onlyonerule@} and (togl{firstfootnoteruleX@printed} or togl{Xfirstfootnoterule@printed}))%
14444 }{%
14445 \vskip-\csuse{Xafterrule@#1}%Because count in \dimen\csuse{#1footins}%
14446 \nointerlineskip%
14447 \moveleft-\leftskip\vbox{\csuse{#1footnoterule}}%
14448 \nointerlineskip%
14449 \vskip\csuse{Xafterrule@#1}%
14450 }{}%
14451 \global\toggletrue{Xfirstfootnoterule@printed}%
14452 }%
14453
14454 \newtoggle{firstfootnoteruleX@printed}%
14455 \newcommand{\print@footnoteXrule}[1]{%
14456 \ifboolexpr{%
14457 (not togl{onlyoneruleX@} or not togl{firstfootnoteruleX@printed})%
14458 and%
14459 not (togl{onlyonerule@} and (togl{firstfootnoteruleX@printed} or togl{Xfirstfootnoterule@printed}))%
14460 }{%
14461 \vskip-\csuse{afterruleX@#1}%Because count in \dimen\csuse{footins#1}%
14462 \nointerlineskip%
14463 \moveleft-\leftskip\vbox{\csuse{footnoterule#1}}%
14464 \nointerlineskip%
14465 \vskip\csuse{afterruleX@#1}%
14466 }{}%
14467 \global\toggletrue{firstfootnoteruleX@printed}%
14468 }%
14469
14470 % \end{macrocode}
14471 % \end{macro}
14472 % \end{macro}
14473 % \end{macro}
14474 % \end{macro}
14475 % \section{Specific skip for first series of footnotes}\label{skipfirstseries}
14476 % \subsection{Overview}
14477 % \protect\cs{Xbeforenotes} inserts a specific skip for the first series of notes in a page.
14478 % As we can't know in advance which series will be the first, we call \protect\cs{prepare@Xprenotes} before inserting any critical notes in order to prevent page number overlapping.
14479 % \begin{enumerate}
14480 % \item If it is the first note of the current page, it changes the footnote skip for the series to the value specified to \protect\cs{Xbeforenotes}. It also keeps the series of the note as the first one of the current page.
14481 % \item If it is not the first note of the current page:
14482 % \begin{itemize}
14483 % \item If the current series is printed after the series kept as the first of the current page, then nothing happens.
14484 % \item If the current series is printed before the series kept as the first of the current page, then it changes the footnote skip of the current series to the value normally used by the series which was marked as the first of the page. It also keeps the current series as the new first one of the current page.
14485 % \end{itemize}
14486 % \end{enumerate}
14487 %
14488 %
14489 % For example, suppose the series order is A,B. We call first a \protect\cs{Bfootnote} and a \protect\cs{Afootnote}. The only skips used are, finally, the skip specific to the first series of the page, and the skip for the B series. If we have not called \protect\cs{Afootnote}, the only skip used is the skip specific to the first series of the page.
14490 %
14491 % That is perfect.
14492 %
14493 %
14494 % The series skip and the first series of the current page are reset before the footnotes are printed. Then, the footstart macros manage the problem of the first series of the page.
14495 %
14496 % After the rule, the space which is defined by \protect\cs{Xafterrule} does not depend on whether the series is the first one of the page or not. So we use its normal value for each series.
14497 %
14498 % And now, implementation !
14499 % \subsection{User level command}
14500 % \begin{macro}{\Xprenotes@}
14501 % \begin{macro}{\Xprenotes}
14502 % \changes{v1.1.0}{2012/09/25}{New skip \protect\cs{Xprenotes@}}
14503 % \changes{v1.2.0}{2012/10/08}{Debug in familiar footnotes (bug introduced by v1.1).}
14504 % If user redefines \protect\cs{Xprenotes@}, via \protect\cs{Xprenotes} to a value greater than 0~pt,
14505 % this skip will be added before first series notes
14506 % instead of the notes skip.
14507 % \begin{macrocode}
14508 \newtoggle{Xprenotes@}%
14509 \toggletrue{Xprenotes@}%
14510 \newcommand{\Xprenotes@}{0pt}%
14511 \newcommand*{\Xprenotes}[1]{\renewcommand{\Xprenotes@}{#1}}%
14512 \newcommand{\preXnotes}[1]{\led@warning@preXnotes@deprecated\Xprenotes{#1}}%For compatibility
14513 % \end{macrocode}
14514 % \end{macro}
14515 % \end{macro}
14516 % The same, but for familiar footnotes.
14517 % \begin{macro}{\Xprenotes}
14518 % \begin{macro}{\Xprenotes@}
14519 % \begin{macrocode}
14520 \newtoggle{prenotesX@}
14521 \toggletrue{prenotesX@}
14522 \newcommand{\prenotesX@}{0pt}
14523 \newcommand*{\prenotesX}[1]{\renewcommand{\prenotesX@}{#1}}
14524 % \end{macrocode}
14525 % \end{macro}
14526 % \end{macro}
14527 %
14528 % \subsection{Internal commands}
14529 % \begin{macro}{firstXseries@}
14530 % \begin{macro}{prepare@Xprenotes}
14531 % \begin{macrocode}
14532 \gdef\firstXseries@{}
14533 \newcommand{\prepare@Xprenotes}[1]{%
14534 \ifdimequal{0pt}{\Xprenotes@}%
14535 {}%
14536 {%
14537 \IfStrEq{\firstXseries@}{}{%
14538 \global\skip\csuse{#1footins}=\Xprenotes@%
14539 \global\advance\skip\csname #1footins\endcsname by\csuse{Xafterrule@#1}%
14540 \gdef\firstXseries@{#1}%
14541 }%
14542 {%
14543 \ifseriesbefore{#1}{\firstXseries@}%
14544 {%
14545 \global\skip\csuse{#1footins}=\csuse{Xbeforenotes@\firstXseries@}%
14546 \global\advance\skip\csname #1footins\endcsname by\csuse{Xafterrule@#1}%
14547 \gdef\firstXseries@{#1}%
14548 }%
14549 {}%
14550 }%
14551 }%
14552 }
14553 % \end{macrocode}
14554 % \end{macro}
14555 % \end{macro}
14556 %
14557 % The same thing is required for familiar notes and \protect\cs{prenotesX}.
14558 % \begin{macro}{firstseriesX@}
14559 % \begin{macro}{prepare@prenotesX}
14560 % \begin{macrocode}
14561 \gdef\firstseriesX@{}
14562 \newcommand{\prepare@prenotesX}[1]{%
14563 \ifdimequal{0pt}{\prenotesX@}%
14564 {}%
14565 {%
14566 \IfStrEq{\firstseriesX@}{}{%
14567 \global\skip\csuse{footins#1}=\prenotesX@%
14568 \global\advance\skip\csname footins#1\endcsname by\csuse{afterruleX@#1}%
14569 \gdef\firstseriesX@{#1}%
14570 }%
14571 {%
14572 \ifseriesbefore{#1}{\firstseriesX@}%
14573 {%
14574 \global\skip\csuse{footins#1}=\csuse{beforenotesX@\firstseriesX@}%
14575 \global\advance\skip\csname footins#1\endcsname by\csuse{afterruleX@#1}%
14576 \gdef\firstseriesX@{#1}%
14577 }%
14578 {}%
14579 }%
14580 }%
14581 }
14582 % \end{macrocode}
14583 % \end{macro}
14584 % \end{macro}
14585 % \section{Endnotes}
14586 % \changes{v1.8.1}{2013/12/15}{Debug endnotes when more than one series is used (change the position where tools for endnotes are defined).}
14587 % \changes{v1.14.0}{2014/10/20}{Debug spurious characters before endnotes.}
14588 % \label{endnotes}\relax
14589 %
14590 % First, check the noend option.
14591 % \begin{macrocode}
14592 \ifbool{noend@}{}{%Used instead of \ifnoend@ to prevent expansion problem
14593 % \end{macrocode}
14594 %
14595 % \subsection{Internal commands}
14596 % \begin{macro}{\l@dend@open}
14597 % \begin{macro}{\l@dend@close}
14598 % \protect\cs{l@dend@open} and \protect\cs{l@dend@close} are the
14599 % macros that are used to open and close the endnote file. Note that
14600 % all our writing to this file is \protect\cs{immediate}: all page and
14601 % line numbers for the endnotes are generated by the same mechanism
14602 % we use for the footnotes, so that there is no need to defer any
14603 % writing to catch information from the output routine.
14604 % The argument of these two command is the series letter.
14605 % \begin{macrocode}
14606 \newcommand{\l@dend@open}[1]{%
14607 \global\booltrue{l@dend@#1}%
14608 \expandafter\immediate%
14609 \expandafter\openout%
14610 \csname l@d@#1end\endcsname%
14611 =\l@auxdir\jobname.#1end\relax%
14612 }%
14613 \newcommand{\l@dend@close}[1]{%
14614 \global\boolfalse{l@dend@#1}%
14615 \expandafter\immediate%
14616 \expandafter\closeout\csname l@d@#1end\endcsname%
14617 }%
14618
14619 % \end{macrocode}
14620 % \end{macro}
14621 % \end{macro}
14622 %
14623 % \begin{macro}{\l@dend@stuff}
14624 % \protect\cs{l@dend@stuff} is used by \protect\cs{beginnumbering} to
14625 % do everything that is necessary for the endnotes at the
14626 % start of each section: it opens the \protect\cs{l@d@end} file, if necessary,
14627 % and writes the section number to the endnote file.
14628 % \begin{macrocode}
14629 \newcommand{\l@dend@stuff}{%
14630 \def\do##1{%
14631 \ifbool{l@dend@##1}%
14632 {}%
14633 {%
14634 \l@dend@open{##1}%
14635 }%
14636 \expandafter\immediate\expandafter\write\csname l@d@##1end\endcsname{\string\l@d@section{\the\section@num}\@percentchar}%
14637 }%
14638 \dolistloop{\@series}%
14639 }%
14640
14641 % \end{macrocode}
14642 % \end{macro}
14643 %
14644 % \begin{macro}{\endprint}
14645 % \begin{macro}{\l@d@section}
14646 % The \protect\cs{endprint} here is nearly identical in its
14647 % functioning to \protect\cs{normalfootfmt}.
14648 %
14649 % The endnote file also contains \protect\cs{l@d@section} commands, which
14650 % supply the section numbers from the main text; standard \macpackage{} does
14651 % nothing with this information, but it is there if you want to write
14652 % custom macros to do something with it.
14653 % \changes{v1.18.0}{2015/02/23}{Option parapparatus works for endnotes.}
14654 % \changes{v1.21.0}{2015/04/13}{\protect\cs{endnotes} take five arguments.}
14655 % \changes{v2.5.0}{2015/11/13}{\protect\cs{endnotes} take six arguments.}
14656 % \changes{v2.7.0}{2015/11/13}{\protect\cs{endnotes} take seven arguments.}
14657 % \changes{v2.8.0}{2016/01/15}{\protect\cs{Xendhangindent} and \protect\cs{Xendafternote} can take values which are relative to the font size of the endnote.}
14658 % Arguments are:
14659 % \begin{itemize}
14660 % \item \verb+#1+ Line numbers and font selection.
14661 % \item \verb+#2+ Lemma.
14662 % \item \verb+#3+ Note content.
14663 % \item \verb+#4+ Series.
14664 % \item \verb+#5+ Optional argument of \protect\cs{Xendnote}.
14665 % \item \verb+#6+ Side (L or R).
14666 % \item \verb+#7+ Label for cross-referencing.
14667 % \end{itemize}
14668 % \begin{macrocode}
14669 \global\notbool{parapparatus@}{}{\long}\def\endprint#1#2#3#4#5#6#7{{%
14670 \iftoggle{Xendfirstnote@#4}{%
14671 \global\togglefalse{Xendfirstnote@#4}%
14672 \csuse{Xendtxtbeforenotes@#4}%
14673 }{}%
14674 \csuse{Xendbhooknote@#4}%
14675 \csuse{Xendnotefontsize@#4}%
14676 \hangindent=\csuse{Xendhangindent@#4}%
14677 \Xendstorelineinfo{#1}{#4}%
14678 \ifXendinsertsep@%
14679 \hskip\csuse{Xendafternote@#4}\relax%
14680 \ifcsdef{prevendline#4}%
14681 {\ifcsequal{prevendline#4}{lineinfo@}%
14682 {\ifcsempty{Xendsymlinenum@#4}{\csuse{Xendsep@#4}}{}}%
14683 {\csuse{Xendsep@#4}}%
14684 }%
14685 {\csuse{Xendsep@#4}}%
14686 \else%
14687 \iftoggle{Xendparagraph@#4}%
14688 {\global\Xendinsertsep@true}%
14689 {}%
14690 \fi%
14691 \xdef\@currentseries{#4}%
14692 \def\do##1{%
14693 \setkeys[mac]{truefootnoteoption}{##1}%
14694 }%
14695 \notblank{#5}{\docsvlist{#5}}{}%
14696 \IfStrEq{#6}{R}{\ledRcol@true}{}%
14697 \def\@this@crossref@start{#7:start}%
14698 \def\@this@crossref@end{#7:end}%
14699 \csuse{Xendwrapcomponents@#4}{%
14700 \printlineendnote{#1}{#4}%
14701 \IfStrEq{#6}{R}{\ledRcol@false}{}%
14702 \nottoggle{Xendlemmadisablefontselection@#4}%
14703 {\select@lemmafont#1|}%
14704 {}%
14705 \bgroup%
14706 \csuse{Xendlemmafont@#4}%
14707 \csuse{Xendwraplemma@#4}{#2}%
14708 \egroup%
14709 \ifboolexpr{%
14710 togl {nosep@}%
14711 or test{\ifcsempty{Xendlemmaseparator@#4}}%
14712 }%
14713 {\hskip\csuse{Xendinplaceoflemmaseparator@#4}\relax}%
14714 {\nobreak%
14715 \hskip\csuse{Xendbeforelemmaseparator@#4}%
14716 \csuse{Xendlemmaseparator@#4}%
14717 \hskip\csuse{Xendafterlemmaseparator@#4}%
14718 \relax%
14719 }%
14720 \csuse{Xendwrapcontent@#4}{#3}%
14721 }%
14722 \nottoggle{Xendparagraph@#4}{\par}{}%
14723 \def\do##1{%
14724 \setkeys[mac]{falsefootnoteoption}{##1}%
14725 }%
14726 \notblank{#5}{\docsvlist{#5}}{}%
14727 }}%
14728
14729 \let\l@d@section=\@gobble
14730
14731 % \end{macrocode}
14732 % \end{macro}
14733 % \end{macro}
14734 % \begin{macro}{\Xendstorelineinfo}
14735 % The \cs{Xendstorelineinfo} macro is used to store some data about line number of the current critical endnote, data which will be reused later for the \cs{Xnumberonlyfirstinline} and related setting.
14736 %
14737 % \#1 endnote specification for the current endnote;
14738 % \#2 endnote series.
14739 % \begin{macrocode}
14740 \newcommand{\Xendstorelineinfo}[2]{%
14741 \l@dp@rsefootspec#1|%
14742 \iftoggle{Xendnumberonlyfirstintwolines@#2}{%
14743 \xdef\lineinfo@{\l@dparsedstartpage - \l@dparsedstartline - \l@dparsedstartsub - \l@dparsedendpage - \l@dparsedendline - \l@dparsedendsub}%
14744 }%
14745 {%
14746 \xdef\lineinfo@{\l@dparsedstartpage - \l@dparsedstartline - \l@dparsedstartsub}%
14747 }%
14748 }%
14749 % \end{macrocode}
14750 % \end{macro}
14751 % \begin{macro}{\printlineendnote}
14752 % This macro controls, in endnote, whether the line number is printed or not, according to the series options. Its first argument is the information about lines; its second is the series of the footnote.
14753 % \begin{macrocode}
14754 \newcommand{\printlineendnote}[2]{%
14755 \ifboolexpr{%
14756 togl {nonum@}%
14757 or togl {Xendnonumber@#2}%
14758 }%
14759 {\hspace{\csuse{Xendinplaceofnumber@#2}}}%
14760 {%
14761 \iftoggle{Xendnumberonlyfirstinline@#2}%
14762 {\ifcsdef{prevendline#2}%
14763 {\ifcsequal{prevendline#2}{lineinfo@}%
14764 {%
14765 \csuse{Xendbhookinplaceofnumber@#2}%
14766 \ifcsempty{Xendsymlinenum@#2}%
14767 {\hspace{\csuse{Xendinplaceofnumber@#2}}}%
14768 {\printsymlineendnotearea{#2}}%
14769 \csuse{Xendahookinplaceofnumber@2}%
14770 }%
14771 {\printlineendnotearea{#1}{#2}}}%
14772 {\printlineendnotearea{#1}{#2}}%
14773 }%
14774 {\printlineendnotearea{#1}{#2}}%We keep every time line
14775 \csxdef{prevendline#2}{\lineinfo@}%
14776 }%
14777 }%
14778 % \end{macrocode}
14779 % \end{macro}
14780 % \begin{macro}{\printsymlineendnotearea}
14781 % \begin{macrocode}
14782 \newcommand{\printsymlineendnotearea}[1]{%
14783 \hspace{\csuse{Xendbeforesymlinenum@#1}}%
14784 \csuse{Xendnotenumfont@#1}%
14785 \ifdimequal{\csuse{Xendboxsymlinenum@#1}}{\z@}%
14786 {\csuse{Xendsymlinenum@#1}}%
14787 {\hbox to \csuse{Xendboxsymlinenum@#1}%
14788 {\csuse{Xendsymlinenum@#1}\hfill}%
14789 }%
14790 \hspace{\csuse{Xendaftersymlinenum@#1}}%
14791 }%
14792 % \end{macrocode}
14793 % \end{macro}
14794 % \begin{macro}{\printlineendnotearea}
14795 %
14796 % This macro prints the space before the line number, changes the font, then prints the line number and the space after it.
14797 % It is called by \protect\cs{endprint}
14798 % depending on the options about repeating line numbers.
14799 % The first argument is line information, the second is the notes series (A, B, C, etc.)
14800 % \begin{macrocode}
14801 \newcommand{\printlineendnotearea}[2]{%
14802 \csuse{Xendbhooklinenumber@#2}%
14803 \hspace{\csuse{Xendbeforenumber@#2}}%
14804 \bgroup%
14805 \csuse{Xendnotenumfont@#2}%
14806 \ifdimequal{\csuse{Xendboxlinenum@#2}}{0pt}%
14807 {%
14808 \csuse{Xendwrapnumbers@#2}{%
14809 \printendlines#1||\ifledRcol@\@Rlineflag\fi%
14810 }%
14811 }%
14812 {\leavevmode%
14813 \hbox to \csuse{Xendboxlinenum@#2}%
14814 {%
14815 \IfSubStr{RC}{\csuse{Xendboxlinenumalign@#2}}{\hfill}{}%
14816 \csuse{Xendwrapnumbers@#2}{%
14817 \printendlines#1||\ifledRcol@\@Rlineflag\fi%
14818 }%
14819 \IfSubStr{LC}{\csuse{Xendboxlinenumalign@#2}}{\hfill}{}%
14820 }}%
14821 \egroup%
14822 \hspace{\csuse{Xendafternumber@#2}}%
14823 \csuse{Xendahooklinenumber@#2}%
14824 }%
14825 % \end{macrocode}
14826 % \end{macro}
14827 % \subsection{User level commands}
14828 % \subsubsection{Inserting contents to endnotes}
14829 % The \cs{Xendnotes} commands are defined above, when defining apparatus commands by series.
14830 % Here, we define
14831 % only \cs{toendnotes} command not specific to a series, in order to insert arbitrary code.
14832 % The regular version writes an unexpanded argument, while the regular version writes a once-expanded argument.
14833 %
14834 % \begin{macro}{\toendnotes}
14835 % \begin{macro}{\toendnotes*}
14836 % \begin{macrocode}
14837 \newcommandx{\toendnotes}[2][1,usedefault]{%
14838 \ifboolexpr{bool{numbering} or bool{numberingR}}{%
14839 \def\do##1{%
14840 \expandafter\immediate\expandafter\write\csname l@d@##1end\endcsname%
14841 {\unexpanded{#2}\@percentchar}%
14842 }%
14843 \ifstrempty{#1}%
14844 {\dolistloop{\@series}}%
14845 {\docsvlist{#1}}%
14846 }{\led@err@toendnotes@outsidenumbering}%
14847 }%
14848 \WithSuffix\newcommandx\toendnotes*[2][1,usedefault]{%
14849 \ifboolexpr{bool{numbering} or bool{numberingR}}{%
14850 \def\do##1{%
14851 \expandafter\immediate\expandafter\write\csname l@d@##1end\endcsname%
14852 {#2\@percentchar}%
14853 }%
14854 \ifstrempty{#1}%
14855 {\dolistloop{\@series}}%
14856 {\docsvlist{#1}}%
14857 }{\led@err@toendnotes@outsidenumbering}%
14858 }%
14859 % \end{macrocode}
14860 % \end{macro}
14861 % \end{macro}
14862 % \subsubsection{Printing endnotes}
14863 % \begin{macro}{\doendnotes}
14864 % \begin{macro}{\ifXendinsertsep@}
14865 % \protect\cs{doendnotes} is
14866 % the command you use to print one series of endnotes; it
14867 % takes one argument: the series letter of the note series you want
14868 % to print.
14869 % \protect\cs{Xendinsertsep@} is set to true at the first note of the series, and to false at the last one.
14870 % \begin{macrocode}
14871 \newif\ifXendinsertsep@%
14872 \newcommand*{\doendnotes}[1]{%
14873 \l@dend@close{#1}%
14874 \begingroup
14875 \def\l@d@section##1{%
14876 \global\section@num=##1%
14877 \global\expandafter\csname #1end@bysection\endcsname=##1%
14878 }%
14879 \csxdef{prevpagenum@#1}{}%
14880 \csxdef{prevpagerange@#1}{}%
14881 \global\toggletrue{Xendfirstnote@#1}%
14882 \makeatletter
14883 \expandafter\let\csname #1end\endcsname=\endprint
14884 \input\l@auxdir\jobname.#1end%
14885 \global\Xendinsertsep@false%
14886 \endgroup}
14887 % \end{macrocode}
14888 % \end{macro}
14889 % \end{macro}
14890 % \begin{macro}{\doendnotesbysection}
14891 % \protect\cs{doendnotesbysection} is a variant of the previous macro.
14892 % While \protect\cs{doendnotes} print endnotes for all of numbered sections
14893 % \protect\cs{doendnotesbysection} print the endnotes for the first numbered section at its first call for a series, then for the second section at its second call for the same series, then for the third section at its third call for the same series, and so on.
14894 % \begin{macrocode}
14895 \newcommand*{\doendnotesbysection}[1]{%
14896 \l@dend@close{#1}%
14897 \csxdef{prevpagenum@#1}{}%
14898 \csxdef{prevpagerange@#1}{}%
14899 \global\expandafter\advance\csname #1end@bysection\endcsname by 1%
14900 \begingroup%
14901 \makeatletter%
14902 \def\l@d@section##1{%
14903 \global\section@num=##1%
14904 \global\toggletrue{Xendfirstnote@#1}%
14905 \ifnumequal{##1}{\csname #1end@bysection\endcsname}%
14906 {\cslet{#1end}{\endprint}}%
14907 {\cslet{#1end}{\@gobbleseven}}%
14908 }%
14909 \input\l@auxdir\jobname.#1end%
14910 \global\Xendinsertsep@false%
14911 \endgroup%
14912 }%
14913 % \end{macrocode}
14914 % \end{macro}
14915 % We close now the conditional period, which depends on \cs{ifnoend@}, because the following commands can be used by other commands than those speicific to endnotes.
14916 % \begin{macrocode}
14917 }%
14918 % \end{macrocode}
14919 % The \protect\cs{printendlines} macro is similar to \protect\cs{printlines} but is
14920 % for printing endnotes rather than footnotes.
14921 %
14922 % The principal difference between foot- and endnotes is that footnotes
14923 % are printed on the page where they are specified but endnotes
14924 % are printed at a different point in the document. We need an indication
14925 % of the source of an endnote; \protect\cs{setprintendlines} provides this
14926 % by always printing the page number. The coding is slightly simpler than
14927 % \protect\cs{setprintlines}.
14928 %
14929 % from the starting page number.\label{printendlines}
14930 % \changes{v0.7.0}{2005/02/18}{Added \protect\cs{setprintendlines} for use by
14931 % \protect\cs{printendlines}}
14932 % \begin{macro}{\setprintendlines}
14933 % \begin{macro}{\ifl@d@Xendlinenumber}
14934 % \begin{macrocode}
14935 \newif\ifl@d@Xendlinenumber%
14936 \newcommand*{\setprintendlines}[6]{%
14937 \let\@annot@start@print\relax%
14938 \let\@annot@end@print\relax%
14939 \l@d@pnumfalse%
14940 \l@d@dashfalse%
14941 \l@d@elinfalse%
14942 % \end{macrocode}
14943 % Should we print the line number? It depends on hooks and annotations.
14944 % \begin{macrocode}
14945 \l@d@Xendlinenumbertrue%
14946 \ifboolexpr{togl{Xendnolinenumber@\@currentseries}%
14947 or (%
14948 togl{Xendnolinenumberifannotation@\@currentseries}%
14949 and not test{\ifdefvoid{\annot@start}}%
14950 and not test{\ifdefvoid{\annot@end}}%
14951 )%
14952 }{%
14953 \l@d@Xendlinenumberfalse%
14954 }{}%
14955 % \end{macrocode}
14956 % We print the second page number only if
14957 % the ending page number is different
14958 % \begin{macrocode}
14959 \ifnum#4=#1 \else
14960 \l@d@pnumtrue
14961 \l@d@dashtrue
14962 \fi
14963 % \end{macrocode}
14964 %
14965 % We print the ending line number if:
14966 % \begin{enumerate}
14967 % \item we print the ending page number;
14968 % \item or the ending line is different from the starting line number and we didn't disable the line number printing.
14969 % \end{enumerate}
14970 % If either of these conditions is true, we also print the annotation linked to the ending line number annotations.
14971 % \begin{macrocode}
14972 \ifboolexpr{%
14973 bool{l@d@pnum}%
14974 or not test{\ifnumequal{#2}{#5}}%
14975 and bool{l@d@Xendlinenumber}%
14976 }{%
14977 \l@d@elintrue%
14978 \l@d@dashtrue%
14979 \l@d@elintrue
14980 \l@d@dashtrue
14981 \unless\ifx\relax\annot@end%
14982 \def\@annot@end@print{%
14983 \l@wrapcs@ifnotemptybox{Xendwraplinenumannotation@\@currentseries}{\annot@end}%
14984 }%
14985 \fi%
14986 }%
14987 {}%
14988 % \end{macrocode}
14989 %
14990 % We define the starting line number annotation as a merge of the starting annotation and ending annotation if we don't print the ending line number.
14991 % Otherwise, it is only the starting annotation.
14992 % \begin{macrocode}
14993 \ifl@d@elin%
14994 \def\@annot@start@print{%
14995 \l@wrapcs@ifnotemptybox{Xendwraplinenumannotation@\@currentseries}{\annot@start}%
14996 }%
14997 \else%
14998 \ifx\annot@start\annot@end%
14999 \unless\ifx\@annot@start\relax%
15000 \def\@annot@start@print{%
15001 \l@wrapcs@ifnotemptybox{Xendwraplinenumannotation@\@currentseries}{\annot@start}%
15002 }%
15003 \fi%
15004 \else%
15005 \ifx\@annot@end@print\relax%
15006 \def\@annot@start@print{%
15007 \l@wrapcs@ifnotemptybox{Xendwraplinenumannotation@\@currentseries}{%
15008 \ifx\annot@start\empty\else%
15009 \annot@start%
15010 \ifdefined\linerangesep@%
15011 \linerangesep@%
15012 \else%
15013 \csuse{Xendlinerangeseparator@\@currentseries}%
15014 \fi%
15015 \fi%
15016 \annot@end%
15017 }%
15018 }%
15019 \else%
15020 \let\@annot@start@print\@annot@end@print%
15021 \let\@annot@end@print\relax%
15022 \fi%
15023 \fi%
15024 \fi%
15025 % \end{macrocode}
15026 % We print the starting sub-line if it is nonzero.
15027 % \begin{macrocode}
15028 \l@d@ssubfalse
15029 \ifnum#3=0 \else
15030 \l@d@ssubtrue
15031 \fi
15032 % \end{macrocode}
15033 %
15034 % We print the ending sub-line if it is nonzero and: (1)~it is different
15035 % from the starting sub-line number, or (2)~the ending line number is
15036 % being printed.
15037 % \begin{macrocode}
15038 \l@d@eslfalse
15039 \ifnum#6=0 \else
15040 \ifnum#6=#3
15041 \ifl@d@elin \l@d@esltrue \else \l@d@eslfalse \fi
15042 \else
15043 \l@d@esltrue
15044 \l@d@dashtrue
15045 \fi
15046 \fi%
15047 % \end{macrocode}
15048 % \begin{macrocode}
15049 \ifl@d@dash%
15050 \ifboolexpr{togl{fulllines@} or test{\ifcsempty{Xendtwolines@\@currentseries}}}%
15051 {}%
15052 {%
15053 \setistwofollowinglines{#1}{#2}{#4}{#5}%
15054 \ifboolexpr{%
15055 (%
15056 togl {Xendtwolinesbutnotmore@\@currentseries}%
15057 and not%
15058 (%
15059 bool {istwofollowinglines@}%
15060 )%
15061 )%
15062 or%
15063 (%
15064 (not test{\ifnumequal{#1}{#4}})%
15065 and togl{Xendtwolinesonlyinsamepage@\@currentseries}%
15066 )%
15067 }%
15068 {}%
15069 {%
15070 \l@d@dashfalse%
15071 \l@d@Xtwolinestrue%
15072 \l@d@elinfalse%
15073 \l@d@eslfalse%
15074 \ifcsempty{Xendmorethantwolines@\@currentseries}%
15075 {}%
15076 {\ifistwofollowinglines@\else%
15077 \l@d@Xmorethantwolinestrue%
15078 \fi%
15079 }%
15080 }%
15081 }%
15082 \fi%
15083 % \end{macrocode}
15084 % If the \cs{Xendnoidenticallinenumannotation} is set for this series, we check if the ending annotation is identical to the starting.
15085 % If true, we don't print the ending annotation
15086 % \begin{macrocode}
15087 \iftoggle{Xendnoidenticallinenumannotation@\@currentseries}{%
15088 \ifx\annot@start\annot@end%
15089 \let\@annot@end@print\relax%
15090 \ifboolexpr{%Do not print the dash if we do not print the line number
15091 test{\ifdefempty{\linenumrep}}%
15092 or not bool {l@d@Xendlinenumber}%
15093 }{%
15094 \l@d@dashfalse%
15095 }{}%
15096 \fi%
15097 }{}%
15098 % \end{macrocode}
15099 % Finally, we check for \cs{Xendlinenumannotationonlyfirst} and \cs{Xendlinenumannotationonlyfirstintwo}, and we redefine, if required, \cs{@annot@start@print} and \cs{annot@end@print}. We also store the current line number annotations.
15100 % \begin{macrocode}
15101 \iftoggle{Xendlinenumannotationonlyfirst@\@currentseries}{%
15102 \ifboolexpr{%
15103 (%
15104 togl{Xendlinenumannotationonlyfirstintwo@\@currentseries}%
15105 and test{\ifcsequal{annot@start}{prevannot@start@\@currentseries}}%
15106 and test{\ifcsequal{annot@end}{prevannot@end@\@currentseries}}%
15107 )%
15108 or%
15109 (%
15110 not togl{Xendlinenumannotationonlyfirstintwo@\@currentseries}%
15111 test{\ifcsequal{annot@start}{prevannot@start@\@currentseries}}%
15112 )%
15113 }{%
15114 \def\@annot@start@print{%
15115 \l@wrapcs@ifnotemptybox{Xendwraplinenumannotation@\@currentseries}{\csuse{Xendsymlinenumannotation@\@currentseries}}%
15116 }%
15117 \let\@annot@end@print\relax%
15118 \ifboolexpr{%Do not print the dash if do not print the line number
15119 test{\ifdefempty{\linenumrep}}%
15120 or not bool {l@d@Xendlinenumber}%
15121 }{%
15122 \l@d@dashfalse%
15123 }{}%
15124 }{}%
15125 \global\cslet{prevannot@start@\@currentseries}{\annot@start}%
15126 \global\cslet{prevannot@end@\@currentseries}{\annot@end}%
15127 }%
15128 {}%
15129 % \end{macrocode}
15130 % End of \protect\cs{setprintendlines}.
15131 % \begin{macrocode}
15132 }%
15133 % \end{macrocode}
15134 % \end{macro}
15135 % \end{macro}
15136 %
15137 % \begin{macro}{\printendlines}
15138 % Now we are ready to print it all.
15139 % \changes{v0.3.0}{2004/02/14}{Added \protect\cs{linenumr@p} and \protect\cs{sublinenumr@p}
15140 % to \protect\cs{printendlines}}
15141 % \begin{macrocode}
15142 \def\printendlines#1|#2|#3|#4|#5|#6|#7|#8|{%
15143 \begingroup
15144 \setprintendlines{#1}{#2}{#3}{#4}{#5}{#6}%
15145 % \end{macrocode}
15146 % The only subtlety left here is when to print a period between
15147 % numbers. But the only instance in which this is tricky is for the
15148 % ending sub-line number: it could be coming after the starting
15149 % sub-line number (in which case we want only the dash) or after an
15150 % ending line number (in which case we need to insert a period).
15151 %
15152 % So, first, start the starting line box, if needed.
15153 % \begin{macrocode}
15154 \ifdimequal{\csuse{Xendboxstartlinenum@\@currentseries}}{0pt}%
15155 {\bgroup}%
15156 {\leavevmode\hbox to \csuse{Xendboxstartlinenum@\@currentseries}\bgroup\hfill}%
15157 % \end{macrocode}
15158 % Then, print the starting page number-
15159 % \begin{macrocode}
15160 \ifboolexpr{%
15161 (%
15162 test{\ifcsstring{prevpagenum@\@currentseries}{#1}}%
15163 and not%
15164 (togl{Xendpagenumberonlyfirstifsingle@\@currentseries} and bool{l@d@pnum})%
15165 )%
15166 or%
15167 (%
15168 test {\ifcsstring{prevpagerange@\@currentseries}{#1-#4}}%
15169 )%
15170 }%
15171 {%
15172 \ifcsempty{Xendsympagenum@\@currentseries}%
15173 {\hspace{\csuse{Xendinplaceofpagenumber@\@currentseries}}}%
15174 {\csuse{Xendsympagenum@\@currentseries}}%
15175 }%
15176 {%
15177 \wrap@edcrossref{\@this@crossref@start}{\printnpnum{#1}}%
15178 }%
15179 % \end{macrocode}
15180 % Then, determine what must be printed before the start line.
15181 % \begin{macrocode}
15182 \ifl@d@dash%
15183 \ifl@d@pnum%
15184 \csuse{Xendlineprefixsingle@\@currentseries}%
15185 \else%
15186 \ifcsempty{Xendlineprefixmore@\@currentseries}%
15187 {\csuse{Xendlineprefixsingle@\@currentseries}}%
15188 {\csuse{Xendlineprefixmore@\@currentseries}}%
15189 \fi%
15190 \else%
15191 \csuse{Xendlineprefixsingle@\@currentseries}%
15192 \fi%
15193 % \end{macrocode}
15194 % Then print the starting line, followed, if needed, by the side flag and the starting sub line number, then the line number annotation.
15195 % \begin{macrocode}
15196 \ifcsstring{Xendlinenumannotationposition@\@currentseries}{before}%
15197 {\@annot@start@print}%
15198 {}%
15199 \ifl@d@Xendlinenumber%
15200 \wrap@edcrossref{\@this@crossref@start}{%
15201 \ifledRcol@%
15202 \linenumrepR{#2}%
15203 \else%
15204 \linenumrep{#2}%
15205 \fi%
15206 }%
15207 \fi%
15208 \iftoggle{Xendlineflag@\@currentseries}{\ifledRcol@\@Rlineflag\fi}{}%
15209 \iftoggle{Xendnotboxingsubline@\@currentseries}{\egroup}{}%Close the box
15210 \ifl@d@Xendlinenumber%
15211 \ifl@d@ssub%
15212 \csuse{Xendsublinesep@\@currentseries}%
15213 \wrap@edcrossref{\@this@crossref@start}{%
15214 \ifledRcol@%
15215 \sublinenumrepR{#3}%
15216 \else%
15217 \sublinenumrep{#3}%
15218 \fi%
15219 }%
15220 \fi%
15221 \fi%
15222 \ifcsstring{Xendlinenumannotationposition@\@currentseries}{after}%
15223 {\@annot@start@print}%
15224 {}%
15225 % \end{macrocode}
15226 % Close the box.
15227 % \begin{macrocode}
15228 \iftoggle{Xendnotboxingsubline@\@currentseries}{}{\egroup}%
15229 % \end{macrocode}
15230 % Open the box for the ending line number.
15231 % \begin{macrocode}
15232 \ifdimequal{\csuse{Xendboxendlinenum@\@currentseries}}{0pt}%
15233 {\bgroup}%
15234 {\hbox to \csuse{Xendboxendlinenum@\@currentseries}\bgroup}%
15235 % \end{macrocode}
15236 % Print the dash + the ending line number, or the line number range symbol.
15237 % \begin{macrocode}
15238 \ifl@d@Xtwolines%
15239 \ifl@d@Xendlinenumber%
15240 \ifl@d@Xmorethantwolines%
15241 \wrap@edcrossref{\@this@crossref@end}{\csuse{Xendmorethantwolines@\@currentseries}}%
15242 \else%
15243 \wrap@edcrossref{\@this@crossref@end}{\csuse{Xendtwolines@\@currentseries}}%
15244 \fi%
15245 \fi%
15246 \else%
15247 \ifl@d@dash%
15248 \ifdefined\linerangesep@%
15249 \linerangesep@%
15250 \else%
15251 \csuse{Xendlinerangeseparator@\@currentseries}%
15252 \fi%
15253 \fi%
15254 % \end{macrocode}
15255 % Print the ending page number.
15256 % \begin{macrocode}
15257 \ifl@d@pnum%
15258 \ifcsstring{prevpagerange@\@currentseries}{#1-#4}%
15259 {%
15260 \ifcsempty{Xendsympagenum@\@currentseries}%
15261 {\hspace{\csuse{Xendinplaceofpagenumber@\@currentseries}}}%
15262 {\csuse{Xendsympagenum@\@currentseries}}%
15263 }%
15264 {%
15265 \wrap@edcrossref{\@this@crossref@end}{\printnpnum{#4}}%
15266 }%
15267 \fi%
15268 % \end{macrocode}
15269 % Print the ending line number, with, if needed, the line prefix, and followed by the side flag, the subline number, and line number annotation.
15270 % \begin{macrocode}
15271 \ifcsstring{Xendlinenumannotationposition@\@currentseries}{before}%
15272 {\@annot@end@print}%
15273 {}%
15274 \ifl@d@Xendlinenumber%
15275 \ifl@d@elin%
15276 \ifl@d@pnum\csuse{Xendlineprefixsingle@\@currentseries}\fi%
15277 \wrap@edcrossref{\@this@crossref@end}{%
15278 \ifledRcol@%
15279 \linenumrepR{#5}%
15280 \else%
15281 \linenumrep{#5}%
15282 \fi%
15283 }%
15284 \iftoggle{Xendlineflag@\@currentseries}{\ifledRcol@\@Rlineflag\fi}{}%
15285 \fi%
15286 \ifl@d@esl%
15287 \ifl@d@elin%
15288 \csuse{Xendsublinesep@\@currentseries}%
15289 \fi%
15290 \wrap@edcrossref{\@this@crossref@end}{%
15291 \ifledRcol@%
15292 \sublinenumrepR{#6}%
15293 \else%
15294 \sublinenumrep{#6}%
15295 \fi%
15296 }%
15297 \fi%
15298 \fi%
15299 \ifcsstring{Xendlinenumannotationposition@\@currentseries}{after}%
15300 {\@annot@end@print}%
15301 {}%
15302 \fi%
15303 % \end{macrocode}
15304 % Close the ending line box.
15305 % \begin{macrocode}
15306 \ifdimequal{\csuse{Xendboxendlinenum@\@currentseries}}{0pt}%
15307 {}%
15308 {\hfill}%Prevent underfull hbox
15309 \egroup%
15310 % \end{macrocode}
15311 % And, finally, save, if needed, the current page number for the Xendpagenumberonlyfirst hooks.
15312 % \begin{macrocode}
15313 \iftoggle{Xendpagenumberonlyfirst@\@currentseries}%
15314 {\iftoggle{Xendpagenumberonlyfirstintwo@\@currentseries}%
15315 {\csxdef{prevpagerange@\@currentseries}{#1-#4}}%
15316 {\csxdef{prevpagenum@\@currentseries}{#4}}%
15317 }%
15318 {}%
15319 % \end{macrocode}
15320 % Now, the end of \cs{printendlines} macro.
15321 % \begin{macrocode}
15322 \endgroup%
15323 }%
15324
15325 % \end{macrocode}
15326 % \end{macro}
15327 %
15328 % \begin{macro}{\printnpnum}
15329 % A macro to print a page number in an endnote. Should not be override anymore
15330 % \begin{macrocode}
15331 \newcommand*{\printnpnum}[1]{\csuse{Xendbeforepagenumber@\@currentseries}#1\csuse{Xendafterpagenumber@\@currentseries}}
15332
15333 % \end{macrocode}
15334 % \end{macro}
15335 %
15336 %
15337 % \section{Generate series of notes}%
15338 % In this section, X means the name of the series (A, B etc.)
15339 % \begin{macro}{\series}
15340 % \protect\cs{series}\protect\cs{series} creates one more new series. It is a public command, which just loops on the private command \protect\cs{newseries@}.
15341 % \begin{macrocode}
15342 \newcommand{\newseries}[1]{%
15343 \def\do##1{\newseries@{##1}}%
15344 \docsvlist{#1}
15345 }
15346 % \end{macrocode}
15347 % \end{macro}
15348 % \begin{macro}{\@series}
15349 % The \protect\cs{series@} macro is an \protect\package{etoolbox} list, which contains the name of all series.
15350 % \begin{macrocode}
15351 \newcommand{\@series}{}
15352 % \end{macrocode}
15353 % \end{macro}
15354 % The command \protect\cs{newseries@}\protect\cs{series} creates a new series of the footnote.
15355 % \begin{macro}{\newseries@}
15356 % \begin{macrocode}
15357 \newcommand{\newseries@}[1]{
15358 % \end{macrocode}
15359 % \subsection{Test if series is still existing}
15360 % \begin{macrocode}
15361 \xifinlist{#1}{\@series}{\led@warn@SeriesStillExist{#1}}%
15362 {%
15363 % \end{macrocode}
15364 % \subsection{Init specific to \parpackage}
15365 % When calling \protect\cs{newseries@} after having loaded \parpackage, we need to load specific setting.
15366 % \begin{macrocode}
15367 \ifdefined\newseries@par%
15368 \newseries@par{#1}%
15369 \fi%
15370 % \end{macrocode}
15371 % \subsection{For critical footnotes}
15372 % Critical footnotes are those which start with letters.
15373 % We look for the \protect\cs{nocritical} option of \macpackage.
15374 % \begin{macrocode}
15375 \unless\ifnocritical@
15376 % \end{macrocode}
15377 % \subsubsection{Options}
15378 % \begin{macrocode}
15379 \newtoggle{Xlineflag@#1}
15380 \newtoggle{Xparindent@#1}
15381 \newtoggle{Xlemmadisablefontselection@#1}
15382 \csgdef{Xwrapcontent@#1}{}%
15383 \csgdef{Xwrapnumbers@#1}{}%
15384 \csgdef{Xbeforeinserting@#1}{}%
15385 \csgdef{Xhangindent@#1}{0pt}%
15386 \csgdef{Xragged@#1}{}%
15387 \csgdef{Xhsizetwocol@#1}{0.45 \hsize}%
15388 \csgdef{Xhsizethreecol@#1}{.3 \hsize}%
15389 \csgdef{Xcolalign@#1}{\raggedright}%
15390 \csgdef{Xcolseparator@#1}{}%
15391 \csgdef{Xnotenumfont@#1}{\normalfont}%
15392 \csgdef{Xnotefontsize@#1}{\footnotesize}%
15393 \csgdef{Xbhooknote@#1}{}%
15394 \csgdef{Xbhookgroup@#1}{}%
15395
15396 \csgdef{Xboxlinenum@#1}{0pt}%
15397 \csgdef{Xboxlinenumalign@#1}{L}%
15398
15399 \csgdef{Xboxstartlinenum@#1}{0pt}%
15400 \newtoggle{Xnotboxingsubline@#1}%
15401 \csgdef{Xboxendlinenum@#1}{0pt}%
15402
15403 \csgdef{Xboxsymlinenum@#1}{0pt}%
15404 \newtoggle{Xgroupbyline@#1}%
15405 \newtoggle{Xgroupbylineseparetwolines@#1}%
15406
15407 \newtoggle{Xnumberonlyfirstinline@#1}%
15408 \newtoggle{Xnumberonlyfirstintwolines@#1}%
15409
15410 \newtoggle{Xlinenumannotationonlyfirst@#1}%
15411 \newtoggle{Xlinenumannotationonlyfirstintwo@#1}%
15412
15413 \csgdef{Xtwolines@#1}{}%
15414 \csgdef{Xmorethantwolines@#1}{}%
15415 \csgdef{Xsublinesep@#1}{\fullstop}%
15416 \csgdef{Xpagelinesep@#1}{\csname Xsublinesep@#1\endcsname}%for backward compatibility, call Xsublinesep@#1
15417 \newtoggle{Xtwolinesbutnotmore@#1}%
15418 \newtoggle{Xtwolinesonlyinsamepage@#1}%
15419 \newtoggle{Xonlypstart@#1}%
15420 \newtoggle{Xpstarteverytime@#1}%
15421
15422 \newtoggle{Xpstart@#1}%
15423 \newtoggle{Xpstartonlyfirst@#1}%
15424 \csdef{Xprevpstart@#1}{0}%Not a hook, but a tool for the hook Xpstartonlyfirst
15425 \csgdef{Xpstartseparator@#1}{}%
15426
15427 \newtoggle{Xstanza@#1}%
15428 \newtoggle{Xstanzaonlyfirst@#1}%
15429 \csdef{Xprevstanza@#1}{0}%Not a hook, but a tool for the hook Xstanzaonlyfirst
15430
15431 \csgdef{Xstanzaseparator@#1}{}%
15432
15433 \csgdef{Xsymlinenum@#1}{}%
15434 \csgdef{Xsymlinenumannotation@#1}{}%
15435
15436 \newtoggle{Xnonote@#1}%
15437
15438 \newtoggle{Xnonumber@#1}%
15439 \newtoggle{Xnolinenumber@#1}%
15440 \newtoggle{Xnolinenumberifannotation@#1}%
15441 \csgdef{Xbeforenumber@#1}{0pt}%
15442 \csgdef{Xtxtbeforenumber@#1}{}%
15443 \newtoggle{Xnopagenumberifcurrent@#1}%
15444 \csgdef{Xbeforepagenumber@#1}{}%
15445 \csgdef{Xafternumber@#1}{0.5em}%
15446 \newtoggle{Xnonbreakableafternumber@#1}%
15447 \csgdef{Xbeforesymlinenum@#1}{\csuse{Xbeforenumber@#1}}%
15448 \csgdef{Xaftersymlinenum@#1}{\csuse{Xafternumber@#1}}%
15449 \csgdef{Xinplaceofnumber@#1}{1em}%
15450 \global\cslet{Xlemmaseparator@#1}{\rbracket}%
15451 \csgdef{Xbeforelemmaseparator@#1}{0em}%
15452 \csgdef{Xafterlemmaseparator@#1}{0.5em}%
15453 \csgdef{Xinplaceoflemmaseparator@#1}{1em}%
15454 \csgdef{Xbeforenotes@#1}{1.2em \@plus .6em \@minus .6em}
15455 \csgdef{Xafterrule@#1}{0pt}
15456
15457 \csgdef{Xtxtbeforenotes@#1}{}
15458 \newtoggle{Xtxtbeforesnotes@#1@typeset}%Not directly used by user, but internal
15459 \newtoggle{Xtxtbeforenotesonlyonce@#1}%
15460
15461 \csgdef{Xmaxhnotes@#1}{0.8\vsize}
15462 \newtoggle{Xnoteswidthliketwocolumns@#1}%
15463 \csgdef{Xparafootsep@#1}{}%
15464 \csgdef{Xafternote@#1}{1em plus.4em minus.4em}
15465 \csgdef{Xlinerangeseparator@#1}{\endashchar}%
15466
15467 \csgdef{Xlemmafont@#1}{}%
15468 \csgdef{Xwrapcomponents@#1}{}%
15469 \csgdef{Xwraplemma@#1}{}
15470 \csgdef{Xwidth@#1}{\hsize}%
15471 \csgdef{Xwraplinenumannotation@#1}{\textsuperscript}%
15472 \csgdef{Xlinenumannotationposition@#1}{after}%
15473 \expandafter\csgdef{Xinnotemark@#1}##1{\ledinnotemark{##1}}%
15474 \newtoggle{Xnoidenticallinenumannotation@#1}%
15475 % \end{macrocode}
15476 % \subsubsection{Create inserts, needed to add notes in foot}
15477 % As regards inserts, see chapter 15 of \thetexbook\ by D. Knuth.
15478 % \begin{macrocode}
15479 \expandafter\newinsert\csname #1footins\endcsname%
15480 \unless\ifnoledgroup@%
15481 \expandafter\newinsert\csname mp#1footins\endcsname%
15482 \fi%
15483 % \end{macrocode}
15484 % \subsubsection{Create commands for critical apparatus, \protect\cs{Afootnote}, \protect\cs{Bfootnote} etc.}
15485 % Note the double \# in command: it is because command it is made inside another command.
15486 % \changes{v1.4.0}{2012/11/16}{Remembers the language of the lemma, in order to create a correct direction for the footnote separator.}
15487 % \changes{v1.23.0}{2015/04/29}{Prevent spurious spaces when \protect\cs{Afootnote} and similar commands are followed by spaces (bug added on 1.0.0!).}
15488 % \begin{macrocode}
15489 \global\notbool{parapparatus@}{\expandafter\newcommand\expandafter *}{\expandafter\newcommand}\csname #1footnote\endcsname[2][]{%
15490 \xdef\@currentseries{#1}%
15491 \nottoggle{Xnonote@#1}{%
15492 \advance \edtext@notes by 1%
15493 \if@edtext@secondarg@%
15494 \ifledRcol%
15495 \ifcsstring{Xonlyside@#1}{L}{\led@error@note@called@onrightside{#1footnote}}{}%
15496 \else%
15497 \ifcsstring{Xonlyside@#1}{R}{\led@error@note@called@onleftside{#1footnote}}{}%
15498 \fi%
15499 \begingroup%
15500 \newcommand{\content}{##2}%
15501 \ifcsstring{series@display#1}{paragraph}{%
15502 \patchcmd{\@tag}{\par}{\relax}{}{}%
15503 }{}%
15504 \ifnumberedpar@%
15505 \ifledRcol%
15506 \ifluatex%
15507 \footnotelang@lua[R]%
15508 \fi%
15509 \@ifundefined{xpg@main@language}%if polyglossia
15510 {}%
15511 {\footnotelang@poly[R]}%
15512 \footnoteoptions@{R}{##1}{true}%
15513 \xright@appenditem{%
15514 \ifbool{indtl@innote}%
15515 {\unexpanded{\let\index\nindex}}%
15516 {}%
15517 \ifbool{indtl@notenumber}%
15518 {\unexpanded{\let\index\nindex}}%There is no note number... so
15519 {}%
15520 \noexpand\Xnote@true%
15521 \unexpanded{\gdef\@currentnotetype{critical}}%
15522 \noexpand\prepare@Xprenotes{#1}%
15523 \noexpand\prepare@edindex@fornote{\l@d@nums}%
15524 \unexpanded{\def\sw@list@inedtext}{\expandafter\unexpanded\expandafter{\sw@inthisedtext}}%The value of the \sw@inthisedtext of current \edtext will be pushed to \sw@list@inedtext when the notes are expanded.
15525 \noexpand\setcounter{stanzaR}{\the\c@stanzaR}%Save stanzaR counter for footnote
15526 \unexpanded{\def\@this@crossref@start}{\theedtext:start}%
15527 \unexpanded{\def\@this@crossref@end}{\theedtext:end}%
15528 \expandonce{\@beforeinsertofthisedtext}% Internal for now, no reason to make it public
15529 \noexpand\parse@annot\l@current@annotR|%
15530 \noexpand\csuse{v#1footnote}{#1}%
15531 {{\l@d@nums}{\expandonce\@tag}{\expandonce\content}}%
15532 \noexpand\Xnote@false%
15533 \unexpanded{\advance\@edindex@fornote@\m@ne}%
15534 \ifbool{indtl@innote}%
15535 {\unexpanded{\let\index\orig@@index}}%
15536 {}%
15537 \ifbool{indtl@notenumber}%
15538 {\unexpanded{\let\index\orig@@index}}%
15539 {}%
15540 }\to\inserts@listR
15541 \footnoteoptions@{R}{##1}{false}%
15542 \global\advance\insert@countR \@ne%
15543 \else%
15544 \ifluatex%
15545 \footnotelang@lua%
15546 \fi%
15547 \@ifundefined{xpg@main@language}%if polyglossia
15548 {}%
15549 {\footnotelang@poly}%
15550 \footnoteoptions@{L}{##1}{true}%
15551 \xright@appenditem{%
15552 \ifbool{indtl@innote}%
15553 {\unexpanded{\let\index\nindex}}%
15554 {}%
15555 \ifbool{indtl@notenumber}%
15556 {\unexpanded{\let\index\nindex}}%There is no note number... so
15557 {}%
15558 \noexpand\Xnote@true%
15559 \unexpanded{\gdef\@currentnotetype{critical}}%
15560 \noexpand\prepare@Xprenotes{#1}%
15561 \noexpand\prepare@edindex@fornote{\l@d@nums}%
15562 \unexpanded{\def\sw@list@inedtext}{\expandafter\unexpanded\expandafter{\sw@inthisedtext}}%The value of the \sw@inthisedtext of current edtext will be pushed to \sw@list@inedtext when the notes are expanded.
15563 \ifl@dpairing%
15564 \noexpand\setcounter{stanzaL}{\the\c@stanzaL}%Save stanzaR counter for footnote
15565 \fi%
15566 \unexpanded{\def\@this@crossref@start}{\theedtext:start}%
15567 \unexpanded{\def\@this@crossref@end}{\theedtext:end}%
15568 \expandonce{\@beforeinsertofthisedtext}%Internal for now, no reason to make it public
15569 \noexpand\parse@annot\l@current@annot|%
15570 \noexpand\csuse{v#1footnote}%
15571 {#1}%
15572 {{\l@d@nums}{\expandonce\@tag}{\expandonce\content}}%
15573 \noexpand\Xnote@false%
15574 \unexpanded{\advance\@edindex@fornote@\m@ne}%
15575 \ifbool{indtl@innote}%
15576 {\unexpanded{\let\index\orig@@index}}%
15577 {}%
15578 \ifbool{indtl@notenumber}%
15579 {\unexpanded{\let\index\orig@@index}}%
15580 {}%
15581 }\to\inserts@list
15582 \global\advance\insert@count \@ne%
15583 \footnoteoptions@{L}{##1}{false}%
15584 \fi
15585 \else
15586 \csuse{v#1footnote}{#1}{{0|0|0|0|0|0|0}{}{##1}}%
15587 \fi%
15588 \endgroup%
15589 \else%
15590 \led@err@FootnoteNotInSecondArgEdtext{#1}%
15591 \fi%
15592 }{\@noneed@notestrue}% End of \nottoggle{Xnonote@#1}{%
15593 \ignorespaces%
15594 }
15595 % \end{macrocode}
15596 % Create counter used to determine on which page the previous note was called.
15597 % \begin{macrocode}
15598 \expandafter\newcount\csname #1prevpage@num\endcsname%
15599 \expandafter\newcount\csname #1prevpage@numR\endcsname%
15600 % \end{macrocode}
15601 % We need to be able to modify \macpackage's footnote macros and restore their
15602 % \begin{macrocode}
15603 \global\csletcs{#1@@footnote}{#1footnote}
15604 % \end{macrocode}
15605 % \subsubsection{Set standard display}
15606 % \begin{macrocode}
15607 \Xarrangement@normal{#1}%
15608 % \end{macrocode}
15609 % End of for critical footnotes.
15610 % \begin{macrocode}
15611 \fi
15612 % \end{macrocode}
15613 % \subsection{For familiar footnotes}
15614 % Familiar footnotes are those which end with letters.
15615 % We look for the \verb+nofamiliar+ option of \macpackage.
15616 % \begin{macrocode}
15617 \unless\ifnofamiliar@
15618 % \end{macrocode}
15619 % \subsubsection{Options}
15620 % \begin{macrocode}
15621 \newtoggle{parindentX@#1}
15622 \csgdef{wrapcontentX@#1}{}%
15623 \csgdef{wrapcomponentsX@#1}{}%
15624 \csgdef{hangindentX@#1}{0pt}%
15625 \csgdef{beforeinsertingX@#1}{}%
15626 \csgdef{raggedX@#1}{}%
15627 \csgdef{afternumberX@#1}{0pt}%
15628 \csgdef{hsizetwocolX@#1}{0.45 \hsize}%
15629 \csgdef{hsizethreecolX@#1}{.3 \hsize}%
15630 \csgdef{colalignX@#1}{\raggedright}%
15631 \csgdef{colseparatorX@#1}{}%
15632 \csgdef{notenumfontX@#1}{\normalfont}%
15633 \csgdef{notefontsizeX@#1}{\footnotesize}%
15634 \csgdef{bhooknoteX@#1}{}%
15635 \csgdef{bhookgroupX@#1}{}%
15636 \csgdef{afterruleX@#1}{0pt}
15637 \csgdef{beforenotesX@#1}{1.2em \@plus .6em \@minus .6em}
15638 \csgdef{maxhnotesX@#1}{0.8\vsize}%
15639 \newtoggle{noteswidthliketwocolumnsX@#1}%
15640 \csgdef{parafootsepX@#1}{}%
15641 \csgdef{afternoteX@#1}{1em plus.4em minus.4em}
15642 \csgdef{widthX@#1}{\hsize}%
15643 \expandafter\csgdef{innotemarkX@#1}##1{\ledinnotemark{##1}}%
15644 \csgdef{txtbeforenotesX@#1}{}%
15645 \newtoggle{nonoteX@#1}%
15646 \newtoggle{txtbeforesnotesX@#1@typeset}%Not directly used by user, but internal
15647 \newtoggle{txtbeforenotesonlyonceX@#1}%
15648 % End of for familiar footnotes.
15649 % \subsubsection{Create inserts, needed to add notes in foot}
15650 % As regards inserts, see chapter 15 of the TeXBook by D. Knuth.
15651 % \begin{macrocode}
15652 \expandafter\newinsert\csname footins#1\endcsname%
15653 \unless\ifnoledgroup@%
15654 \expandafter\newinsert\csname mpfootins#1\endcsname%
15655 \fi%
15656 % \end{macrocode}
15657 %\subsubsection{Create tools for familiar footnotes (\protect\cs{footnoteX})}
15658 % First, create the \protect\cs{footnoteX} command.
15659 % Note the double \# in command: it is because a command is called inside another command.
15660 % \begin{macrocode}
15661
15662 \global\expandafter\newcommand\csname footnote#1\endcsname[2][]{%
15663 \xdef\@currentseries{#1}%
15664 \nottoggle{nonoteX@#1}{%
15665 \begingroup%
15666 \prepare@prenotesX{#1}%
15667 \newcommand{\content}{##2}%
15668 % \end{macrocode}
15669 % If we are using the \cs{csquotes} package, we reset the quotation level.
15670 % \begin{macrocode}
15671 \ifdefined\csq@qlevel%
15672 \csq@qlevel=0\relax%
15673 \fi%
15674 % \end{macrocode}
15675 % If we prepare parallel typesetting, we cannot just increase the footnote counter.
15676 % Read \parpackage's handbook about that (\reff{reledpar-familiarfootnotenumber}).
15677 % If we have a manual footnote mark, use it.
15678 % \begin{macrocode}
15679 \global\expandafter\advance\csname footnote#1@reading\endcsname by \@ne%
15680 \ifstrempty{##1}{%
15681 \ifboolexpr{bool{l@dpairing} or bool{l@dprintingpages} or bool{l@dprintingcolumns}}{%
15682 \ifcsdef{footnote#1reading\the\csname footnote#1@reading\endcsname=typeset}%
15683 {\setcounter{footnote#1}{\csuse{footnote#1reading\the\csname footnote#1@reading\endcsname=typeset}}}%
15684 {\setcounter{footnote#1}{\the\csname footnote#1@reading\endcsname}}%
15685 }{%
15686 \stepcounter{footnote#1}%
15687 }%
15688 }{}%
15689 % \end{macrocode}
15690 % We also have to check consistency with \cs{onlysideX} setting.
15691 % \begin{macrocode}
15692 \ifledRcol%
15693 \ifcsstring{onlysideX@#1}{L}{\led@error@note@called@onrightside{footnote#1}}{}%
15694 \else%
15695 \ifcsstring{onlysideX@#1}{R}{\led@error@note@called@onleftside{footnote#1}}{}%
15696 \fi%
15697 % \end{macrocode}
15698 % And now, the feature not depending on wether we prepare parallel typesetting
15699 % \begin{macrocode}
15700 \ifstrempty{##1}%
15701 {\protected@csxdef{@thefnmark#1}{\csuse{thefootnote#1}}}%
15702 {\protected@csxdef{@thefnmark#1}{##1}}%
15703 \protected@csxdef{hr@thefnmark#1}{\the\value{footnote#1}@\the\csname footnote#1@series\endcsname}%
15704 \nottoggle{nomk@}%Nomk is set to true when using \footnoteXnomk with \parpackage
15705 {\csuse{@footnotemark#1}}%
15706 {}%
15707 \ifluatex%
15708 \xdef\footnote@luatextextdir{\the\textdir}%
15709 \xdef\footnote@luatexpardir{\the\pardir}%
15710 \fi%
15711 \if@ledgroup%
15712 \led@set@index@fornote{#1}%
15713 \fi%
15714 \csuse{vfootnote#1}{#1}{\expandonce\content}{##1}\m@mmf@prepare%
15715 \ifbool{indtl@innote}%
15716 {\let\index\orig@@index}%
15717 {}%
15718 \ifbool{indtl@notenumber}%
15719 {\let\index\orig@@index}%
15720 {}%
15721 \endgroup%
15722 }{}%End of the notoggleX@#1
15723 }
15724 % \end{macrocode}
15725 % Then define the counters.
15726 % The \LaTeX\ counter \verb+footnoteX+ is the only one manipulated by the user. This is the one which is printed.
15727 %
15728 % The \TeX\ counter \cs{footnoteX@reading} is increased at each footnote. It is used to get the correct footnote number when using parallel typesetting (\reff{reledpar-familiarfootnotenumber}).
15729 %
15730 % The \TeX\ counter \cs{footnoteX@series} is increased each time we reset the \LaTeX counter \verb+footnoteX+, either using +\verb\setcounter{footnoteX}{0}+ or because of \cs{@addtoreset}.
15731 % \begin{macrocode}
15732 \newcounter{footnote#1}
15733 \global\expandafter\renewcommand\csname thefootnote#1\endcsname{\arabic{footnote#1}}
15734 \expandafter\newcount\csname footnote#1@reading\endcsname%
15735 \expandafter\newcount\csname footnote#1@series\endcsname%
15736 \global\expandafter\csname footnote#1@series\endcsname=1%
15737 % \end{macrocode}
15738 % Create counter used to determine on which page the previous note was called.
15739 % \begin{macrocode}
15740 \expandafter\newcount\csname prevpage#1@num\endcsname%
15741 \expandafter\newcount\csname prevpage#1@numR\endcsname%
15742 \expandafter\newcount\csname footnote#1@parafootsepX\endcsname%For the case we use \parafootsepX outside of numbered section
15743 % \end{macrocode}
15744 % Add \cs{let}\cs{footnoteX}\cs{@gobble} to \cs{no@expands}.
15745 % \begin{macrocode}
15746 \expandafter\gappto\expandafter\no@expands\expandafter{\expandafter\let\csname footnote#1\endcsname\@gobble}%
15747 % \end{macrocode}
15748 % And now, define \cs{footnoteXmark} and \cs{footnoteXtext}, equivalent to classical \cs{footnotemark} and \cs{footnotetext}.
15749 % \begin{macrocode}
15750 \expandafter\newcommand\csname footnote#1mark\endcsname[1][]{%
15751 \begingroup%
15752 \prepare@prenotesX{#1}%
15753 \ifstrempty{##1}{%
15754 \stepcounter{footnote#1}%
15755 }{%
15756 \setcounter{footnote#1}{##1}%
15757 }%
15758 \protected@csxdef{@thefnmark#1}{\csuse{thefootnote#1}}%
15759 \protected@csxdef{hr@thefnmark#1}{\the\value{footnote#1}@\the\csname footnote#1@series\endcsname}%
15760 \csuse{@footnotemark#1}%
15761 \m@mmf@prepare%
15762 \endgroup%
15763 }%
15764 \expandafter\newcommand\csname footnote#1text\endcsname[2][]{%
15765 \begingroup%
15766 \ifluatex%
15767 \xdef\footnote@luatextextdir{\the\textdir}%
15768 \xdef\footnote@luatexpardir{\the\pardir}%
15769 \fi%
15770 \csuse{vfootnote#1}{#1}{\expandonce{##2}}{##1}%
15771 \endgroup%
15772 }%
15773 % \end{macrocode}
15774 % Do not forget to initialize the series.
15775 % \begin{macrocode}
15776 \arrangementX@normal{#1}%
15777 \fi
15778 % \end{macrocode}
15779 % \subsection{The endnotes}
15780 % \changes{v2.0.0}{2015/07/19}{One endnotes file by series.}
15781 % Endnotes are commands like \protect\cs{Xendnote}, where X is a series letter.
15782 % First, we check for the \verb+noend+ options.
15783 % \begin{macrocode}
15784 \unless\ifnoend@
15785 % \end{macrocode}
15786 % \subsubsection{The auxiliary file}
15787 % \begin{macro}{\l@d@Xend}
15788 % \begin{macro}{\ifl@dend@X}
15789 % \begin{macro}{\l@dend@Xtrue}
15790 % \begin{macro}{\l@dend@Xfalse}
15791 % Endnotes of all varieties are saved up in a file, one by series, typically named
15792 % \meta{jobname}\file{.Xend}.
15793 % \protect\cs{l@d@end} is the output stream number for
15794 % this file, and \protect\cs{ifl@dend@X} is a flag that is \verb"true" when the file is open.
15795 %
15796 %
15797 % \begin{macrocode}
15798 \expandafter\newwrite\csname l@d@#1end\endcsname%
15799 \expandafter\newif\csname ifl@dend@#1\endcsname%
15800 % \end{macrocode}
15801 % \end{macro}
15802 % \end{macro}
15803 % \end{macro}
15804 % \end{macro}
15805 % \subsubsection{The main macro}
15806 % The \protect\cs{Xendnote} macro functions to
15807 % write one endnote to the \file{.Xend} file. We change
15808 % \protect\cs{newlinechar} so that in the file every space becomes the
15809 % start of a new line; this generally ensures that a long note does not
15810 % exceed restrictions on the length of lines in files.
15811 % \begin{macrocode}
15812
15813 \global\expandafter\newcommandx\csname #1endnote\endcsname[2][1,usedefault]{%
15814 \advance \edtext@notes by 1%
15815 \bgroup%
15816 \newlinechar='40%
15817 \newcommand{\content}{##2}%
15818 \stepcounter{labidx}%
15819 \expandafter\immediate\expandafter\write\csname l@d@#1end\endcsname{%
15820 \unexpanded{\def\sw@list@inedtext}%
15821 {\expandafter\unexpanded\expandafter{\sw@inthisedtext}}%
15822 \@percentchar\space%Explicit space, to add a linebreak in the output file
15823 \noexpand\parse@annot\l@current@annot|\@percentchar\space%
15824 \expandafter\string\csname #1end\endcsname%
15825 {\ifnumberedpar@\l@d@nums\fi}%
15826 {\ifnumberedpar@\expandonce\@tag\fi}%
15827 {\expandonce\content}%
15828 {#1}%
15829 {\unexpanded{##1}}%
15830 {\ifledRcol R\else L\fi}%
15831 {\theedtext}%
15832 \@percentchar%
15833 }%
15834 \egroup%
15835 \ignorespaces%
15836 }%
15837 % \end{macrocode}
15838 % \subsubsection{Tools}
15839 % The \cs{Xtoendnotes} command inserts any arbitrary content into the endnote file.
15840 % It is an alias of the more generalist \cs{addtoendnotes}
15841 % \begin{macrocode}
15842
15843 \global\expandafter\newcommand\csname #1toendnotes\endcsname[1]{%
15844 \toendnotes[#1]{##1}%
15845 }%
15846
15847 \expandafter\WithSuffix\expandafter\newcommand\csname #1toendnotes\endcsname*[1]{%
15848 \toendnotes*[#1]{##1}%
15849 }%
15850
15851 % \end{macrocode}
15852 % \subsubsection{Internal commands}
15853 % \protect\cs{Xendnote} commands called \protect\cs{Xend} commands on to the endnote file; these are analogous to the various
15854 % \verb"footfmt" commands above, and they take the same arguments.
15855 % When we process this file, we want to pick out the notes of one
15856 % series and ignore all the rest. To do that, we equate the \verb"end"
15857 % command for the series we want to \protect\cs{endprint}, and leave the
15858 % rest equated to \protect\cs{@gobbleseven}, which just skips over its seven
15859 % arguments.
15860 % \begin{macrocode}
15861
15862 \global\cslet{#1end}{\@gobbleseven}
15863 % \end{macrocode}
15864 % We need to store the number of times \protect\cs{doendnotesbysection} is called for one series.
15865 % \begin{macrocode}
15866 \global\expandafter\newcount\csname #1end@bysection\endcsname%
15867 % \end{macrocode}
15868 %
15869 % \subsubsection{The options}
15870 % \begin{macrocode}
15871 \csgdef{Xendwrapcomponents@#1}{}%
15872 \csgdef{Xendwraplemma@#1}{}
15873 \csgdef{Xendwrapcontent@#1}{}%
15874 \csgdef{Xendtwolines@#1}{}%
15875 \csgdef{Xendwrapnumbers@#1}{}%
15876 \csgdef{Xendmorethantwolines@#1}{}%
15877 \newtoggle{Xendtwolinesbutnotmore@#1}{}%
15878 \newtoggle{Xendtwolinesonlyinsamepage@#1}{}%
15879 \newtoggle{Xendlemmadisablefontselection@#1}%
15880 \csgdef{Xendnotenumfont@#1}{\normalfont}%
15881 \csgdef{Xendnotefontsize@#1}{\footnotesize}%
15882 \csgdef{Xendbhooknote@#1}{}%
15883
15884 \csgdef{Xendsublinesep@#1}{\fullstop}%
15885
15886 \csgdef{Xendbeforenumber@#1}{0pt}
15887 \csgdef{Xendafternumber@#1}{0.5em}
15888
15889 \csgdef{Xendboxlinenum@#1}{0pt}%
15890 \csgdef{Xendboxlinenumalign@#1}{L}%
15891
15892 \csgdef{Xendboxstartlinenum@#1}{0pt}%
15893 \newtoggle{Xendnotboxingsubline@#1}%
15894 \csgdef{Xendboxendlinenum@#1}{0pt}%
15895
15896 \csgdef{Xendlemmaseparator@#1}{}%
15897 \csgdef{Xendbeforelemmaseparator@#1}{0em}%
15898 \csgdef{Xendafterlemmaseparator@#1}{0.5em}%
15899 \csgdef{Xendinplaceoflemmaseparator@#1}{0.5em}%
15900
15901 \newtoggle{Xendparagraph@#1}%
15902 \csgdef{Xendafternote@#1}{1em plus.4em minus.4em}%
15903 \csgdef{Xendsep@#1}{}%
15904
15905 \csgdef{Xendinplaceofnumber@#1}{0pt}%
15906 \newtoggle{Xendnonumber@#1}%
15907 \newtoggle{Xendnolinenumber@#1}%
15908 \newtoggle{Xendnolinenumberifannotation@#1}%
15909
15910 \csgdef{Xendhangindent@#1}{0pt}%
15911
15912 \newtoggle{Xendnumberonlyfirstinline@#1}%
15913 \newtoggle{Xendnumberonlyfirstintwolines@#1}%
15914
15915 \newtoggle{Xendlinenumannotationonlyfirst@#1}%
15916 \newtoggle{Xendlinenumannotationonlyfirstintwo@#1}%
15917
15918 \csgdef{Xendbeforesymlinenum@#1}{\csuse{Xendbeforenumber@#1}}%
15919 \csgdef{Xendaftersymlinenum@#1}{\csuse{Xendafternumber@#1}}%
15920
15921 \csgdef{Xendsymlinenum@#1}{}%
15922 \csgdef{Xendsymlinenumannotation@#1}{}%
15923
15924 \csgdef{Xendboxsymlinenum@#1}{0pt}%
15925
15926 \csgdef{Xendbhooklinenumber@#1}{}%
15927 \csgdef{Xendehooklinenumber@#1}{}%
15928 \csgdef{Xendbhookinplaceofnumber@#1}{}%
15929 \csgdef{Xendehookinplaceofnumber@#1}{}%
15930
15931 \csgdef{Xendlinerangeseparator@#1}{\endashchar}%
15932
15933 \csgdef{Xendbeforepagenumber@#1}{p.}%
15934 \csgdef{Xendafterpagenumber@#1}{) }%
15935 \csgdef{Xendlineprefixsingle@#1}{}%
15936 \csgdef{Xendlineprefixmore@#1}{}%
15937
15938 \newtoggle{Xendlineflag@#1}
15939
15940 \csgdef{Xendlemmafont@#1}{}%
15941
15942 \csgdef{Xendlinenumannotationposition@#1}{after}%
15943 \csgdef{Xendwraplinenumannotation@#1}{\textsuperscript}%
15944 \newtoggle{Xendnoidenticallinenumannotation@#1}%
15945
15946 \newtoggle{Xendpagenumberonlyfirst@#1}%
15947 \newtoggle{Xendpagenumberonlyfirstifsingle@#1}%
15948 \newtoggle{Xendpagenumberonlyfirstintwo@#1}%
15949 \csgdef{Xendsympagenum@#1}{}%
15950 \csgdef{Xendinplaceofpagenumber@#1}{0pt}%
15951
15952 \csgdef{Xendtxtbeforenotes@#1}{}%
15953 \newtoggle{Xendfirstnote@#1}%Not a hook, but used to apply Xendtxtbeforenotes
15954
15955 % \end{macrocode}
15956 % End of endnotes declaration
15957 % \begin{macrocode}
15958 \fi%
15959 % \end{macrocode}
15960 % Dump series in \protect\cs{@series}
15961 % \begin{macrocode}
15962 \listxadd{\@series}{#1}
15963 }
15964 }% End of \newseries
15965 % \end{macrocode}
15966 % \end{macro}
15967 % \subsection{Init standards series (A,B,C,D,E)}
15968 % \begin{macrocode}
15969 \expandafter\newseries\expandafter{\default@series}
15970 % \end{macrocode}
15971 % \section{Setting series display}
15972 % \subsection{Change series order}
15973 % \changes{v1.1.0}{2012/09/25}{New tools to change order of series}
15974 % \changes{v1.21.0}{2015/04/13}{\protect\cs{seriesatbegin} and \protect\cs{seriesatbegin} more efficient}
15975 % \begin{macro}{\seriesatbegin}
15976 % \protect\cs{seriesatbegin}\marg{s} changes the order of series, to put the series \meta{s} at the beginning of the list.
15977 % The series can be the result of a command.
15978 % \begin{macrocode}
15979 \newcommand{\seriesatbegin}[1]{%
15980 \StrDel{\@series}{#1}[\@series]%
15981 \edef\@new{}%
15982 \listeadd{\@new}{#1}%
15983 \listeadd{\@new}{\@series}%
15984 \xdef\@series{\@new}%
15985 }
15986 % \end{macrocode}
15987 % \end{macro}
15988 % \begin{macro}{\seriesatend}
15989 % \changes{v1.21.0}{2015/04/13}{Fix spurious space in \protect\cs{seriesatend}}
15990 % And \protect\cs{seriesatend} moves the series to the end of the list.
15991 % \begin{macrocode}
15992 \newcommand{\seriesatend}[1]{%
15993 \StrDel{\@series}{#1}[\@series]%
15994 \edef\@new{}%
15995 \listeadd{\@new}{\@series}%
15996 \listeadd{\@new}{#1}%
15997 \xdef\@series{\@new}%
15998 }
15999 % \end{macrocode}
16000 % \end{macro}
16001 % \subsection{Test series order}
16002 % \begin{macro}{\ifseriesbefore}
16003 % \protect\cs{ifseriesbefore}\marg{seriesA}\marg{seriesB}\marg{true}\marg{false} expands to \meta{true} if \meta{seriesA} is printed before \meta{seriesB}, or to \meta{false} otherwise.
16004 % \begin{macrocode}
16005 \newcommand{\ifseriesbefore}[4]{%
16006 \StrPosition{\@series}{#1}[\@first]%
16007 \StrPosition{\@series}{#2}[\@second]%
16008 \ifnumgreater{\@second}{\@first}{#3}{#4}%
16009 }
16010 % \end{macrocode}
16011 % \end{macro}
16012 % \subsubsection{Get the first series}
16013 % In some specific case, we need to know the first series of the list of series.
16014 % \begin{macro}{\@getfirstseries}
16015 % \begin{macrocode}
16016 \newcommand{\@getfirstseries}{%
16017 \ifdefempty{\@series}%
16018 {\xdef\@firstseries{}}%
16019 {\StrChar{\@series}{1}[\@firstseries]}%
16020 }%
16021 % \end{macrocode}
16022 % \end{macro}
16023 % \changes{v1.0.0}{2012/09/15}{New generic commands to customize footnote display.}
16024 % \subsection{Series setting}
16025 % \subsubsection{General way of working}
16026 % The setting's command (like \protect\cs{numberonlyfirstinline}), also called \enquote{hooks} can be divided in two categories: those which require a string values and those which require a boolean value.
16027 % The first category includes those which require a length value, because we store the length's expression send by user and we evaluate it only in the commands which requires to know the setting.
16028 % The second category require boolean value only when it is set to FALSE.
16029 % Otherwise, we understand the insinuated value is TRUE.
16030 %
16031 % For each \enquote{hook} command, we store the value in commands (first category) or a \protect\package{etoolbox}'s toggle (second category) which names are in the form \protect\cs{<hook>@<series>}.
16032 % For example, when calling \protect\cs{twolines}\marg{sq.}, we store \verb+sq.+ in commands \protect\cs{twolines@A}, \protect\cs{twolines@B}, \protect\cs{twolines@C}\ldots for each series defined for use with \macpackage, or, if the \oarg{series} optional argument was send, for each series of this argument.
16033 %
16034 % These values are tested in some specific places, scattered throughout the code, depending on their effects.
16035 % The default values are defined by the \protect\cs{newseries@} command.
16036 %
16037 %
16038 % In order to prevent code duplication, we have created some generic commands.
16039 % Some of them change the value of any hook send as argument.
16040 % Some other, getting a hook name, generate the user level commands.
16041 %
16042 %
16043 %
16044 % \subsubsection{Tools to set options}
16045 % \begin{macro}{\settoggle@series}
16046 % \changes{v1.1.0}{2012/09/25}{\protect\cs{settoggle@series} switch the global value of the toggle, not only the local value.}
16047 % \changes{v1.13.0}{2014/09/16}{\protect\cs{settoggle@series} can take an optional arguments to reload series setup.}
16048 % \protect\cs{settoggle@series}\marg{series}\marg{toggle}\marg{value} is a generic command to switch toggles for some series.
16049 % The arguments are:
16050 % \begin{itemize}
16051 % \item \verb+#1+ (mandatory): the series for which the hooks should be set. If empty, all the series will be affected.
16052 % \item \verb+#2+ (mandatory): the name of the hook.
16053 % \item \verb+#3+ (mandatory): the new value of toggle (true or false).
16054 % \item \verb+#4+ (optional): if equal to \verb+reload+, reload the footnote setting (call again \protect\cs{Xarrangement} or \protect\cs{arrangementX} or \ldots\ depending on the footnote display).
16055 % \item \verb+#5+ (optional): if not empty, and if \verb+#1+ is empty, change the hook setting for pseudo-series, as \verb+appref+.
16056 % \end{itemize}
16057 % \begin{macrocode}
16058 \newcommandx{\settoggle@series}[5][4,5,usedefault]{%
16059 \def\do##1{%
16060 \ifcsdef{etb@tgl@#2@##1}{%
16061 \global\settoggle{#2@##1}{#3}%
16062 }{%
16063 \led@warn@BadHookSeries{##1}{#2}%
16064 }%
16065 \ifstrequal{#4}{critical}{
16066 \csuse{Xarrangement@\csuse{series@display##1}}{##1}%
16067 }{}
16068 \ifstrequal{#4}{familiar}{%
16069 \csuse{arrangementX@\csuse{series@displayX##1}}{##1}%
16070 }{}%
16071 }%
16072 \ifstrempty{#1}{%
16073 \dolistloop{\@series}%
16074 \ifstrempty{#5}{}{%
16075 \docsvlist{#5}%
16076 }
16077 }%
16078 {%
16079 \docsvlist{#1}%
16080 }%
16081 }
16082 % \end{macrocode}
16083 % \end{macro}
16084 % \begin{macro}{\setcommand@series}
16085 % \protect\cs{setcommand@series}\marg{series}\marg{command}\marg{value} is a generic command to store a hook's value into commands specific to some series.
16086 % The arguments are:
16087 % \begin{itemize}
16088 % \item \verb+#1+ (mandatory): the series for which the hooks should be set. If empty, all the series will be affected.
16089 % \item \verb+#2+ (mandatory): the name of the hook.
16090 % \item \verb+#3+ (mandatory): the new value of the hook/command.
16091 % \item \verb+#4+ (optional): if equal to \verb+reload+, reload the footnote setting (call \protect\cs{footnormal} or \protect\cs{footparagraph} or \ldots\ depending on the footnote display).
16092 % \item \verb+#5+ (optional): if not empty, and if \verb+#1+ is empty, change the hook setting for pseudo-series, as \verb+appref+.
16093 % \item \verb+#6+ (optional): the number of arguments of the hook.
16094 % \end{itemize}
16095 % \begin{macrocode}
16096 \newcommandx{\setcommand@series}[6][4,5,6=0,usedefault]{%
16097 \def\do##1{
16098 \ifcsdef{#2@##1}{%
16099 \expandafter\global\expandafter\renewcommand\csname#2@##1\endcsname[#6]{#3}%
16100 }{%
16101 \led@warn@BadHookSeries{##1}{#2}%
16102 }%
16103 \ifstrequal{#4}{critical}{%
16104 \csuse{Xarrangement@\csuse{series@display##1}}{##1}%
16105 }{}
16106 \ifstrequal{#4}{familiar}{%
16107 \csuse{arrangementX@\csuse{series@displayX##1}}{##1}%
16108 }{}%
16109 }%
16110 \ifstrempty{#1}{%
16111 \dolistloop{\@series}%
16112 \ifstrempty{#5}{}{%
16113 \docsvlist{#5}
16114 }
16115 }%
16116 {%
16117 \docsvlist{#1}%
16118 }%
16119 }%
16120 % \end{macrocode}
16121 % \end{macro}
16122 % \subsubsection{Tools to generate options commands}
16123 % \begin{macro}{\newhookcommand@series}
16124 % \protect\cs{newhookcommand@series}\protect\cs{command names} is a generic command to add new commands for hooks, like \protect\cs{Xhsizetwocol}.
16125 % The first argument is the name of the hook, the second a comma-separated list of pseudo-series where the hook can be used, like \verb+appref+ in the case of \protect\cs{Xtwolines}.
16126 % The second argument is also used to create commands named \protect\cs{<hookname><pseudoseries>},
16127 % like \protect\cs{Xtwolinesappref}.
16128 % The third argument
16129 % \changes{v2.33.0}{2020/05/31}{\protect\cs{newhookcommand@series} can take an second optional argument (third argument).}
16130 % \changes{v1.21.0}{2015/04/13}{\protect\cs{newhookcommand@series} can take an optional argument.}
16131 % \begin{macrocode}
16132 \newcommandx{\newhookcommand@series}[3][2,3=0,usedefault]{%
16133 \global\expandafter\newcommand\expandafter*\csname #1\endcsname[2][]{%
16134 \setcommand@series{##1}{#1}{##2}[][#2][#3]%
16135 }%
16136 \ifstrempty{#2}{}{%
16137 \def\do##1{%
16138 \global\expandafter\newcommand\expandafter*\csname #1##1\endcsname[1]{%
16139 \csuse{#1}[##1]{####1}%
16140 }%
16141 }%
16142 \docsvlist{#2}%
16143 }%
16144 }
16145 % \end{macrocode}
16146 % \end{macro}
16147 % \begin{macro}{\newhooktoggle@series}
16148 %\protect\cs{newhooktoggle@series}\protect\cs{command names} is a generic command to add new commands for a new toggle hook, like \protect\cs{Xnumberonlyfirstinline}.
16149 % The second argument is also used to create commands named \protect\cs{<hookname><pseudoseries>},
16150 % like \protect\cs{Xtwolinesbutnotmoreappref}.
16151 % \changes{v1.21.0}{2015/04/13}{\protect\cs{newhooktoggle@series} can take an optional argument.}
16152 % \begin{macrocode}
16153 \newcommandx{\newhooktoggle@series}[2][2,usedefault]{%
16154 \global\expandafter\newcommandx\expandafter*\csname #1\endcsname[2][1,2={true},usedefault]{%
16155 \settoggle@series{##1}{#1}{##2}[][#2]%
16156 }%
16157 \ifstrempty{#2}{}{%
16158 \def\do##1{%
16159 \global\expandafter\newcommand\expandafter*\csname #1##1\endcsname{%
16160 \csuse{#1}[##1]%
16161 }%
16162 }%
16163 \docsvlist{#2}%
16164 }%
16165 }
16166 % \end{macrocode}
16167 % \end{macro}
16168 % \begin{macro}{\newhooktoggle@series@reload}
16169 % \changes{v1.13.0}{2014/09/16}{Add \protect\cs{newhookcommand@toggle@reload}}
16170 % \protect\cs{newhookcommand@toggle@reload} does the same thing as \protect\cs{newhooktoggle@series}
16171 % but the commands created by this macro also reload the series arrangement, depending on the type of notes
16172 % \begin{macrocode}
16173 \newcommand{\newhooktoggle@series@reload}[2]{%
16174 \global\expandafter\newcommandx\expandafter*\csname #1\endcsname[2][1,2={true},usedefault]{%
16175 \settoggle@series{##1}{#1}{##2}[#2]%
16176 }%
16177 }%
16178 % \end{macrocode}
16179 % \end{macro}
16180 % \begin{macro}{\newhookcommand@series@reload}
16181 % \changes{v1.8.0}{2013/11/24}{Debug \protect\cs{beforenotesX} and \protect\cs{maxhnotesX} which did not work.}
16182 % \changes{v1.12.0}{2014/08/05}{Debug \protect\cs{beforenotesX} and \protect\cs{maxhnotesX} which did not work when called after \protect\cs{footparagraphX}.}
16183 % \changes{v1.12.0}{2014/08/05}{Debug \protect\cs{Xbeforenotes} and \protect\cs{Xmaxhnotes} which did not work when called after \protect\cs{footparagraph}.}
16184 % \protect\cs{newhookcommand@series@reload} does the same thing as \protect\cs{newhookcommand@series}
16185 % but the commands created by this macro also reload the series' arrangement.
16186 %
16187 % \begin{macrocode}
16188 \newcommand{\newhookcommand@series@reload}[2]{%
16189 \global\expandafter\newcommand\expandafter*\csname #1\endcsname[2][]{%
16190 \setcommand@series{##1}{#1}{##2}[#2]%
16191 }%
16192 }
16193 % \end{macrocode}
16194 % \end{macro}
16195 % \subsubsection{Options for critical notes}
16196 % Before generating the commands that are used to set the critical notes, such as \protect\cs{Xnumberonlyfirstinline}, \protect\cs{Xlemmaseparator} and the like, we check the \verb+nocritical+ option.
16197 % \begin{macrocode}
16198 \unless\ifnocritical@
16199 \newhookcommand@series{Xwrapcontent}%
16200 \newhookcommand@series{Xbeforeinserting}%
16201 \newhookcommand@series{Xlemmafont}%
16202 \newhookcommand@series{Xwrapcomponents}%
16203 \newhookcommand@series{Xwraplemma}%
16204 \newhookcommand@series{Xwrapnumbers}%
16205 \newhooktoggle@series{Xparindent}
16206 \newhookcommand@series{Xhangindent}
16207 \newhookcommand@series{Xragged}
16208 \newhookcommand@series{Xhsizetwocol}
16209 \newhookcommand@series{Xhsizethreecol}
16210 \newhookcommand@series{Xcolalign}%
16211 \newhookcommand@series{Xcolseparator}%
16212 \newhookcommand@series{Xnotenumfont}
16213 \newhookcommand@series{Xbhooknote}
16214 \newhookcommand@series@reload{Xbhookgroup}{critical}
16215 \newhookcommand@series{Xboxsymlinenum}%
16216 \newhookcommand@series{Xsymlinenum}
16217 \newhookcommand@series{Xsymlinenumannotation}%
16218 \newhookcommand@series{Xbeforenumber}
16219 \newhookcommand@series{Xtxtbeforenumber}
16220 \newhooktoggle@series{Xnopagenumberifcurrent}%
16221 \newhookcommand@series{Xbeforepagenumber}%
16222 \newhookcommand@series{Xafternumber}
16223 \newhookcommand@series{Xbeforesymlinenum}
16224 \newhookcommand@series{Xaftersymlinenum}
16225 \newhookcommand@series{Xinplaceofnumber}
16226 \newhookcommand@series{Xlemmaseparator}
16227 \newhookcommand@series{Xbeforelemmaseparator}
16228 \newhookcommand@series{Xafterlemmaseparator}
16229 \newhookcommand@series{Xinplaceoflemmaseparator}
16230 \newhookcommand@series{Xtxtbeforenotes}
16231 \newhooktoggle@series{Xtxtbeforenotesonlyonce}%
16232 \newhookcommand@series@reload{Xafterrule}{critical}
16233 \newhooktoggle@series{Xnumberonlyfirstinline}
16234 \newhooktoggle@series{Xnumberonlyfirstintwolines}
16235 \newhooktoggle@series{Xlinenumannotationonlyfirst}%
16236 \newhooktoggle@series{Xlinenumannotationonlyfirstintwo}%
16237 \newhooktoggle@series{Xgroupbyline}%
16238 \newhooktoggle@series{Xgroupbylineseparetwolines}%
16239 \newhooktoggle@series{Xnonumber}
16240 \newhooktoggle@series{Xnolinenumber}%
16241 \newhooktoggle@series{Xnolinenumberifannotation}%
16242
16243 \newhooktoggle@series{Xpstart}
16244 \newhooktoggle@series{Xpstartonlyfirst}%
16245 \newhooktoggle@series{Xpstarteverytime}%
16246 \newhookcommand@series{Xpstartseparator}%
16247
16248 \newhooktoggle@series{Xstanza}%
16249 \newhooktoggle@series{Xstanzaonlyfirst}%
16250 \newhookcommand@series{Xstanzaseparator}%
16251
16252 \newhooktoggle@series{Xnonote}%
16253
16254 \newhooktoggle@series{Xonlypstart}
16255 \newhooktoggle@series{Xnonbreakableafternumber}
16256 \newhooktoggle@series{Xlemmadisablefontselection}
16257 \newhookcommand@series@reload{Xmaxhnotes}{critical}
16258 \newhookcommand@series@reload{Xbeforenotes}{critical}
16259 \newhooktoggle@series@reload{Xnoteswidthliketwocolumns}{critical}%
16260 \newhookcommand@series@reload{Xnotefontsize}{critical}
16261
16262 \newhookcommand@series{Xboxlinenum}%
16263 \newhookcommand@series{Xboxlinenumalign}%
16264
16265 \newhookcommand@series{Xboxstartlinenum}%
16266 \newhooktoggle@series{Xnotboxingsubline}%
16267 \newhookcommand@series{Xboxendlinenum}%
16268
16269 \newhookcommand@series{Xafternote}%
16270 \newhookcommand@series{Xparafootsep}
16271 \newhookcommand@series@reload{Xwidth}{critical}%
16272
16273 \newhookcommand@series{Xinnotemark}[][1]%
16274
16275 \ifundef{\Xhsize}%
16276 {%
16277 \newcommandx{\Xhsize}[2][1,usedefault]{%
16278 \led@warning@Xhsize@deprecated%
16279 \Xwidth[#1]{#2}%
16280 }%
16281 }%
16282 {}%
16283 \fi
16284 % \end{macrocode}
16285 % Now, hooks for critical notes which also apply to crossreferencing and line numbering at the sides of the page.
16286 % \begin{macrocode}
16287 \newhooktoggle@series{Xlineflag}[appref,SEref]
16288 \newhookcommand@series{Xtwolines}[appref,SEref]
16289 \newhookcommand@series{Xmorethantwolines}[appref,SEref]
16290 \newhookcommand@series{Xsublinesep}[appref,SEref,side]%
16291 \newhookcommand@series{Xpagelinesep}[appref,SEref,side]%
16292 \newhooktoggle@series{Xtwolinesbutnotmore}[appref,SEref]
16293 \newhooktoggle@series{Xtwolinesonlyinsamepage}[appref,SEref]
16294 \newhookcommand@series{Xlinerangeseparator}[appref,SEref]
16295 \newhookcommand@series{Xlinenumannotationposition}[side,appref,SEref]%
16296 \newhookcommand@series{Xwraplinenumannotation}[side,ref,appref,SEref]%
16297 \newhooktoggle@series{Xnoidenticallinenumannotation}[side,ref,appref,SEref]%
16298 % \end{macrocode}
16299 % \subsubsection{Options for familiar notes}
16300 % Before generating the optional commands for familiar notes, we check the \protect\cs{nofamiliar} option.
16301 % \begin{macrocode}
16302 \unless\ifnofamiliar@
16303 \newhookcommand@series{afternumberX}%
16304 \newhookcommand@series{wrapcontentX}%
16305 \newhookcommand@series{wrapcomponentsX}%
16306 \newhookcommand@series{beforeinsertingX}%
16307 \newhooktoggle@series{parindentX}
16308 \newhookcommand@series{hangindentX}
16309 \newhookcommand@series{raggedX}
16310 \newhookcommand@series{hsizetwocolX}
16311 \newhookcommand@series{hsizethreecolX}
16312 \newhookcommand@series{colalignX}%
16313 \newhookcommand@series{colseparatorX}%
16314 \newhookcommand@series{notenumfontX}
16315 \newhookcommand@series{bhooknoteX}
16316 \newhookcommand@series@reload{bhookgroupX}{familiar}
16317 \newhookcommand@series@reload{beforenotesX}{familiar}
16318 \newhookcommand@series@reload{maxhnotesX}{familiar}
16319 \newhooktoggle@series@reload{noteswidthliketwocolumnsX}{familiar}%
16320 \newhookcommand@series@reload{afterruleX}{familiar}
16321 \newhookcommand@series@reload{notefontsizeX}{familiar}
16322 \newhookcommand@series{afternoteX}
16323 \newhookcommand@series{parafootsepX}
16324 \newhookcommand@series{txtbeforenotesX}%
16325 \newhooktoggle@series{txtbeforenotesonlyonceX}%
16326 \newhookcommand@series@reload{widthX}{familiar}%
16327 \newhookcommand@series{innotemarkX}[][1]%
16328 \newhooktoggle@series{nonoteX}%
16329 \ifundef{\hsizeX}%
16330 {%
16331 \newcommandx{\hsizeX}[2][1,usedefault]{%
16332 \led@warning@hsizeX@deprecated%
16333 \widthX[#1]{#2}%
16334 }%
16335 }%
16336 {}%
16337 \fi
16338 % \end{macrocode}
16339 % \subsubsection{Options for endnotes}
16340 % Before generating the commands that are used to set the endnotes, such as \protect\cs{Xnumberonlyfirstinline}, \protect\cs{Xlemmaseparator}+ and the like, we check the \verb+noend+ option.
16341 % \begin{macrocode}
16342 \unless\ifnoend@
16343 \newhookcommand@series{Xendwrapcomponents}%
16344 \newhookcommand@series{Xendwraplemma}
16345 \newhookcommand@series{Xendwrapcontent}
16346 \newhookcommand@series{Xendnotenumfont}
16347 \newhookcommand@series{Xendlemmafont}%
16348 \newhookcommand@series{Xendbhooknote}
16349
16350 \newhookcommand@series{Xendboxlinenum}%
16351 \newhookcommand@series{Xendboxlinenumalign}%
16352
16353 \newhookcommand@series{Xendboxstartlinenum}%
16354 \newhooktoggle@series{Xendnotboxingsubline}%
16355 \newhookcommand@series{Xendboxendlinenum}%
16356
16357 \newhookcommand@series{Xendnotefontsize}
16358 \newhooktoggle@series{Xendlemmadisablefontselection}
16359 \newhookcommand@series{Xendlemmaseparator}
16360 \newhookcommand@series{Xendbeforelemmaseparator}
16361 \newhookcommand@series{Xendafterlemmaseparator}
16362 \newhookcommand@series{Xendinplaceoflemmaseparator}
16363
16364 \newhookcommand@series{Xendbeforenumber}%
16365 \newhookcommand@series{Xendafternumber}%
16366
16367 \newhooktoggle@series{Xendparagraph}
16368 \newhookcommand@series{Xendafternote}
16369 \newhookcommand@series{Xendsep}
16370
16371 \newhookcommand@series{Xendinplaceofnumber}%
16372 \newhooktoggle@series{Xendnonumber}%
16373 \newhooktoggle@series{Xendnolinenumber}%
16374 \newhooktoggle@series{Xendnolinenumberifannotation}%
16375
16376 \newhooktoggle@series{Xendnumberonlyfirstinline}%
16377 \newhooktoggle@series{Xendnumberonlyfirstintwolines}%
16378
16379 \newhooktoggle@series{Xendlinenumannotationonlyfirst}%
16380 \newhooktoggle@series{Xendlinenumannotationonlyfirstintwo}%
16381
16382 \newhookcommand@series{Xendsymlinenum}%
16383 \newhookcommand@series{Xendbeforesymlinenum}%
16384 \newhookcommand@series{Xendaftersymlinenum}%
16385 \newhookcommand@series{Xendboxsymlinenum}%
16386
16387 \newhookcommand@series{Xendsymlinenumannotation}%
16388
16389 \newhookcommand@series{Xendbhooklinenumber}%
16390 \newhookcommand@series{Xendahooklinenumber}%
16391 \newhookcommand@series{Xendbhookinplaceofnumber}%
16392 \newhookcommand@series{Xendahookinplaceofnumber}%
16393
16394 \newhookcommand@series{Xendhangindent}%
16395
16396 \newhooktoggle@series{Xendpagenumberonlyfirst}%
16397 \newhooktoggle@series{Xendpagenumberonlyfirstifsingle}%
16398 \newhooktoggle@series{Xendpagenumberonlyfirstintwo}%
16399 \newhookcommand@series{Xendsympagenum}%
16400 \newhookcommand@series{Xendinplaceofpagenumber}%
16401
16402 \newhookcommand@series{Xendtxtbeforenotes}%
16403
16404 \fi
16405 \newhookcommand@series{Xendwrapnumbers}[apprefwithpage,SErefwithpage]
16406 \newhooktoggle@series{Xendlineflag}[apprefwithpage,SErefwithpage]
16407 \newhookcommand@series{Xendtwolines}[apprefwithpage,SErefwithpage]
16408 \newhookcommand@series{Xendmorethantwolines}[apprefwithpage,SErefwithpage]
16409 \newhooktoggle@series{Xendtwolinesbutnotmore}[apprefwithpage,SErefwithpage]
16410 \newhooktoggle@series{Xendtwolinesonlyinsamepage}[apprefwithpage,SErefwithpage]
16411 \newhookcommand@series{Xendlinerangeseparator}[apprefwithpage,SErefwithpage]
16412 \newhookcommand@series{Xendbeforepagenumber}[apprefwithpage,SErefwithpage,SErefonlypage]
16413 \newhookcommand@series{Xendafterpagenumber}[apprefwithpage,SErefwithpage]
16414 \newhookcommand@series{Xendlineprefixsingle}[apprefwithpage,SErefwithpage]
16415 \newhookcommand@series{Xendlineprefixmore}[apprefwithpage,SErefwithpage]
16416 \newhookcommand@series{Xendsublinesep}[apprefwithpage,SErefwithpage]
16417
16418 \newhookcommand@series{Xendlinenumannotationposition}[apprefwithpage,SErefwithpage]%
16419 \newhookcommand@series{Xendwraplinenumannotation}[apprefwithpage,SErefwithpage]%
16420 \newhooktoggle@series{Xendnoidenticallinenumannotation}[apprefwithpage,SErefwithpage]%
16421 % \end{macrocode}
16422 % \subsection{Hooks for a particular footnote}
16423 % \begin{macro}{\newhooktoggle@specific}
16424 % \cs{newhooktoggle@specific} is a generic command to create boolean hook specific to a note.
16425 % \begin{macrocode}
16426 \newcommand{\newhooktoggle@specific}[1]{%
16427 \newtoggle{#1@}%
16428 \listgadd{\hooktoggle@specific}{#1}%
16429 \define@key[mac]{truefootnoteoption}{#1}[]{\global\settoggle{#1@}{true}}%When enabling footnote option
16430 \define@key[mac]{falsefootnoteoption}{#1}[]{\global\settoggle{#1@}{false}}
16431 }
16432 % \end{macrocode}
16433 % \end{macro}
16434 % \begin{macro}{\newhookarg@specific}
16435 % \cs{newhookarg@specific} is a generic command to create argumen hook specific to a note.
16436 % \begin{macrocode}
16437 \newcommand{\newhookarg@specific}[1]{%
16438 \listgadd{\hookarg@specific}{#1}%
16439 \define@key[mac]{truefootnoteoption}{#1}{\csgdef{#1@}{##1}}%When enabling footnote option
16440 \define@key[mac]{falsefootnoteoption}{#1}{\global\csundef{#1@}}%When disabling footnote option
16441 }
16442 % \end{macrocode}
16443 % \end{macro}
16444 % \begin{macro}{\hooktoggle@specific}
16445 % \begin{macro}{\add@hooktoggle@specific@to@cs}
16446 % The \cs{add@hooktoggle@specific@to@cs} macro stores to a macro
16447 % all the current values of hook toggle specific to a command.
16448 % It is useful for the \cs{Xgroupbyline} option, which does not immediately add notes to the inserts list.
16449 % It uses the \cs{hooktoggle@specific} list.
16450 % \begin{macrocode}
16451 \def\hooktoggle@specific{}%
16452 \newcommand{\add@hooktoggle@specific@to@cs}[1]{%
16453 \def\do##1{%
16454 \iftoggle{##1@}{%
16455 \ifcsdef{#1}{%
16456 \csgappto{#1}{\toggletrue{##1@}}%
16457 }{%
16458 \csgdef{#1}{\toggletrue{##1@}}%
16459 }%
16460 }{%
16461 \ifcsdef{#1}{%
16462 \csgappto{#1}{\togglefalse{##1@}}%
16463 }{%
16464 \csgdef{#1}{\togglefalse{##1@}}%
16465 }%
16466 }%
16467 }%
16468 \dolistloop{\hooktoggle@specific}%
16469 }%
16470 % \end{macrocode}
16471 % \end{macro}
16472 % \end{macro}
16473 % \begin{macro}{\hookarg@specific}
16474 % \begin{macro}{\add@hookarg@specific@to@cs}
16475 % The same, but for optional argument of critical footnotes with assigned value.
16476 % \begin{macrocode}
16477 \def\hookarg@specific{}%
16478 \newcommand{\add@hookarg@specific@to@cs}[1]{%
16479 \def\do##1{%
16480 \ifcsvoid{##1@}{}{%
16481 \ifcsdef{#1}{%
16482 \csxappto{#1}{%
16483 \noexpand\csdef%
16484 {##1@}{\csname##1@\endcsname}%
16485 }%
16486 }{%
16487 \csxdef{#1}{%
16488 \noexpand\csdef%
16489 {##1@}{\csname##1@\endcsname}%
16490 }%
16491 }%
16492 }%
16493 }%
16494 \dolistloop{\hookarg@specific}%
16495 }%
16496 % \end{macrocode}
16497 % \end{macro}
16498 % \end{macro}
16499 % And now, we define some hooks specific to a note.
16500 % \begin{macrocode}
16501 \newhooktoggle@specific{fulllines}%
16502 \newhooktoggle@specific{nonum}
16503 \newhooktoggle@specific{nosep}
16504 \newhooktoggle@specific{noprefix}%
16505 \newhooktoggle@specific{prefixmore}%
16506 \newhookarg@specific{linerangesep}
16507 % \end{macrocode}
16508 % \begin{macro}{linerangesep@}
16509 % \cs{linerangesep@} is defined by the option \option{linerangesep} of critical notes to change temporarily the line range separator for a specific line.
16510 % As we have to define it before typesetting the line and undefine it after, we use the family of \package{xkeyval} package's key.
16511 % \begin{macrocode}
16512 % \end{macrocode}
16513 %
16514 %
16515 % \end{macro}
16516 % \begin{macro}{\nomk@}
16517 %\protect\cs{nomk@} toggle is used by \parpackage{} to remove the footnote mark in the text when using \protect\cs{footnoteXmk}. Read \parpackage handbook.
16518 % \begin{macrocode}
16519 \newtoggle{nomk@}%
16520 % \end{macrocode}
16521 % \end{macro}
16522 % \subsection{Alias}
16523 % \begin{macro}{\Xnolemmaseparator}
16524 %\protect\cs{Xnolemmaseparator}\oarg{series} is just an alias for \protect\cs{Xlemmaseparator}\oarg{series}\verb|{}|.
16525 % \begin{macrocode}
16526 \newcommandx*{\Xnolemmaseparator}[1][1]{\Xlemmaseparator[#1]{}}
16527 % \end{macrocode}
16528 % \end{macro}
16529 %
16530 %
16531 % \section{Output routine}\label{output}
16532 %
16533 %
16534 % Now we begin the output routine and associated things.
16535 %
16536 %
16537 %
16538 %
16539 % \subsection{Extra footnotes output}
16540 %
16541 % With luck we might only have to change \protect\cs{@makecol} and
16542 % \protect\cs{@reinserts} of \LaTeX's kernel.
16543 % Since \reledmac, we use \protect\package{etoolbox}'s patching commands instead of overriding.
16544 % It should provides better compatibility with other package which modify these commands
16545
16546 %
16547 % \begin{macro}{\l@ddoxtrafeet}
16548 % \protect\cs{l@ddoxtrafeet} is the code extending \protect\cs{@makecol} to cater for
16549 % the extra \macpackage\ feet. We have two categories of extra footnotes.
16550 % By default, we order the footnote inserts so that the regular footnotes of \LaTeX\ are first,
16551 % then familiar familiar footnotes and finally
16552 % the critical footnotes.
16553 % \changes{v0.2.1}{2003/09/13}{Renamed \protect\cs{doxtrafeet} to \protect\cs{l@ddoxtrafeet}}
16554 % \changes{v1.9.0}{2014/02/05}{Add \protect\cs{fnpos} to choice the order of footnotes.}
16555 % \begin{macrocode}
16556 \newcommand*{\l@ddoxtrafeet}{%
16557 \global\togglefalse{firstfootnoteruleX@printed}%
16558 \global\togglefalse{Xfirstfootnoterule@printed}%
16559 \IfStrEq{familiar-critical}{\@fnpos}
16560 {\do@feetX\do@Xfeet}%
16561 {%
16562 \IfStrEq{critical-familiar}{\@fnpos}%
16563 {\do@Xfeet\do@feetX}%
16564 {%
16565 \setbox\@outputbox \vbox{%
16566 \unvbox\@outputbox%
16567 \do@feet@custom@order{}{\@fnpos}%
16568 }%
16569 }%
16570 }%
16571 }%
16572
16573 % \end{macrocode}
16574 % \end{macro}
16575 % \begin{macro}{\do@feet@custom@order}
16576 % \cs{do@feet@custom@order} is called when \cs{@fnpos} is neither \enquote{familiar-critical}, nor \enquote{critical-familiar}, that is, when the order is more complex.
16577 % In this case, people must define the order for all footnote series.
16578 % If they don't, \LaTeX\ could perform an infinite run.
16579 % \begin{macrocode}
16580 \newcommand{\do@feet@custom@order}[2]{%
16581 \def\do##1{%
16582 \edef\@@notesseries{\@firstoftwo##1}%
16583 \edef\@@notetype{\@secondoftwo##1}%
16584 \ifdefstring{\@@notetype}{critical}%
16585 {\csuse{#1append@Xnotes}{\@@notesseries}}%
16586 {\ifdefstring{\@@notetype}{familiar}%
16587 {\csuse{#1append@notesX}{\@@notesseries}}%
16588 {}%
16589 }%
16590 }%
16591 \expandafter\docsvlist\expandafter{#2}%
16592 }%
16593 % \end{macrocode}
16594 % \end{macro}
16595 % \begin{macro}{\do@Xfeet}
16596 % \protect\cs{do@Xfeet} is the code extending \protect\cs{@makecol} to cater to
16597 % the extra critical feet.
16598 % \changes{v0.4.1}{2004/03/06}{Changed \protect\cs{do@Xfeet} code for easier extensions}
16599 % \begin{macrocode}
16600 \newcommand*{\do@Xfeet}{%
16601 \setbox\@outputbox \vbox{%
16602 \unvbox\@outputbox
16603 \@opXfeet}}
16604 % \end{macrocode}
16605 % \end{macro}
16606 %
16607 % \begin{macro}{\@opXfeet}
16608 % \begin{macro}{\append@Xnotes}
16609 % \begin{macro}{\print@Xnotes}
16610 % The extra critical feet to be added to the output.
16611 % \changes{v0.4.1}{2004/03/06}{Added \protect\cs{@opXfeet}}.
16612 % A macro which appends critical notes to the output's routine, also adding vertical space before notes
16613 % \begin{macrocode}
16614 \newcommand{\append@Xnotes}[1]{%
16615 \ifvoid\csuse{#1footins}\else%
16616 \global\skip\csuse{#1footins}=\csuse{Xbeforenotes@#1}%
16617 \global\advance\skip\csuse{#1footins} by\csuse{Xafterrule@#1}%
16618 \print@Xnotes{#1}%
16619 \fi%
16620 }%
16621 % \end{macrocode}
16622 % The normal way to add one series,
16623 % \protect\cs{print@Xnotes}, is replaced by \parpackage when using \protect\cs{Pages}.
16624 % \begin{macrocode}
16625 \newcommand\print@Xnotes[1]{%
16626 \xdef\@currentseries{#1}%
16627 \csuse{#1footstart}{#1}%
16628 \csuse{#1footgroup}{#1}%%
16629 }%
16630 % \end{macrocode}
16631 % We print all series of notes by looping on them.
16632 % We check before printing them that they are not voided.
16633 % \begin{macrocode}
16634 \newcommand*{\@opXfeet}{%
16635 \unless\ifnocritical@%
16636 \gdef\firstXseries@{}%
16637 \def\do##1{%
16638 \append@Xnotes{##1}%
16639 }%
16640 \dolistloop{\@series}%
16641 \fi%
16642 }%
16643 % \end{macrocode}
16644 % \end{macro}
16645 % \end{macro}
16646 % \end{macro}
16647 %
16648 %
16649 % \begin{macro}{\l@ddodoreinxtrafeet}
16650 % \protect\cs{l@ddodoreinxtrafeet} is the code catering for the extra footnotes
16651 % within \protect\cs{@reinserts}.
16652 % We use the same category and ordering as in \protect\cs{l@ddoxtrafeet}.
16653 % \changes{v0.2.1}{203/09/13}{Renamed \protect\cs{dodoreinxtrafeet} to \protect\cs{l@ddodoreinxtrafeet}}
16654 % \begin{macrocode}
16655 \newcommand*{\l@ddodoreinxtrafeet}{%
16656 \IfStrEq{familiar-critical}{\@fnpos}
16657 {\@doreinfeetX\X@doreinfeet}%
16658 {%
16659 \IfStrEq{critical-familiar}{\@fnpos}%
16660 {\X@doreinfeet\@doreinfeetX}%
16661 {\@doreinfeetX\X@doreinfeet}%
16662 }%
16663 }
16664
16665 % \end{macrocode}
16666 % \end{macro}
16667 %
16668 % \begin{macro}{\X@doreinfeet}
16669 % \protect\cs{X@doreinfeet} is the code for catering for the
16670 % extra critical footnotes
16671 % within \protect\cs{@reinserts}.
16672 % \begin{macrocode}
16673 \newcommand*{\X@doreinfeet}{%
16674 \unless\ifnocritical@%
16675 \def\do##1{%
16676 \ifvoid\csuse{##1footins}\else%
16677 \insert\csuse{##1footins}{\unvbox\csuse{##1footins}}%
16678 \fi}%
16679 \dolistloop{\@series}
16680 \fi%
16681 }
16682
16683 % \end{macrocode}
16684 % \end{macro}
16685 %
16686 % \begin{macro}{\print@notesX}
16687 % \begin{macro}{\append@notesX}
16688 % \begin{macro}{\do@feetX}
16689 % \begin{macro}{\@doreinfeetX}
16690 % We have to add all the new kinds of familiar footnotes to the output
16691 % routine.
16692 % A macro which appends the familiar footnotes of one series onto the output routine, also adding vertical skip before notes.
16693 % \begin{macrocode}
16694 \newcommand{\append@notesX}[1]{%
16695 \ifvoid\csuse{footins#1}\else%
16696 \global\skip\csuse{footins#1}=\csuse{beforenotesX@#1}%
16697 \global\advance\skip\csuse{footins#1} by\csuse{afterruleX@#1}%
16698 \print@notesX{#1}%
16699 \fi%
16700 }%
16701 % \end{macrocode}
16702 % The normal way to print one series of notes.
16703 % \protect\cs{print@Xnotes} is replaced by \parpackage when using \protect\cs{Pages}.
16704 % \begin{macrocode}
16705 \newcommand\print@notesX[1]{%
16706 \xdef\@currentseries{#1}%
16707 \csuse{footstart#1}{#1}%
16708 \csuse{footgroup#1}{#1}%
16709 }%
16710 % \end{macrocode}
16711 % We print all the series of notes by looping over them.
16712 % We check before printing them that they are not voided.
16713 % \begin{macrocode}
16714 \newcommand*{\do@feetX}{%
16715 \unless\ifnofamiliar@%
16716 \gdef\firstseriesX@{}%
16717 \setbox\@outputbox \vbox{%
16718 \unvbox\@outputbox%
16719 \def\do##1{%
16720 \append@notesX{##1}%
16721 }%
16722 \dolistloop{\@series}}%
16723 \fi%
16724 }%
16725
16726 \newcommand{\@doreinfeetX}{%
16727 \unless\ifnofamiliar@%
16728 \def\do##1{%
16729 \ifvoid\csuse{footins##1}\else
16730 \insert%
16731 \csuse{footins##1}
16732 {\unvbox\csuse{footins##1}}%
16733 \fi%
16734 }%
16735 \dolistloop{\@series}%
16736 \fi%
16737 }%
16738
16739 % \end{macrocode}
16740 % \end{macro}
16741 % \end{macro}
16742 % \end{macro}
16743 % \end{macro}
16744 %
16745 % \subsection{Patching standard output's commands}
16746 % The \protect\ltxclass{memoir} class does not use the \enquote{standard} versions of
16747 % \protect\cs{@makecol} and \protect\cs{@reinserts}, due to its sidebar insert.
16748 % We had better add that code if \protect\ltxclass{memoir} is used. (It can
16749 % be awkward dealing with |\if| code within |\if| code, so don't use
16750 % |\ifl@dmemoir| here.)
16751 % \changes{v0.2.1}{2003/09/13}{Major changes to insert code when memoir is loaded}
16752 % \changes{v2.0.0}{2015/07/19}{\protect\cs{@makecol}, \protect\cs{@reinserts} and \protect\cs{@doclearpage} are patched instead of begin redefined}
16753 % \changes{v2.0.0}{2015/07/19}{\protect\cs{doxtrafeeti} becomes \protect\cs{Xdo@feet};
16754 % \protect\cs{doxtrafeetii} becomes \protect\cs{do@Xfeet};
16755 % \protect\cs{@opxtrafeeti} becomes \protect\cs{@opfeetX};
16756 % \protect\cs{doreinxtrafeetii} becomes \protect\cs{X@doreinfeet};
16757 % \protect\cs{doreinxtrafeeti} becomes \protect\cs{@doreinfeetX}.}
16758 % \changes{v2.16.0}{2016/10/02}{\protect\cs{Xdo@feet} becomes \protect\cs{do@Xfeet}}
16759 % \changes{v2.16.0}{2016/10/02}{More explicit error message in case the stanza indentation is not defined.}
16760 % \begin{macrocode}
16761 \@ifclassloaded{memoir}{%
16762 % \end{macrocode}
16763 % \protect\ltxclass{memoir} is loaded so we use \protect\ltxclass{memoir}'s built in hooks.
16764 % \begin{macrocode}
16765 \g@addto@macro{\m@mdoextrafeet}{\l@ddoxtrafeet}%
16766 \g@addto@macro{\m@mdodoreinextrafeet}{\l@ddodoreinxtrafeet}%
16767 }{%
16768 % \end{macrocode}
16769 % \protect\ltxclass{memoir} has not been loaded, so patch \protect\cs{@makecol} and
16770 % \protect\cs{@reinserts}.
16771 % If the \package{fancyhdr} package $<$ version 3.8 has been loaded, we patch the \cs{latex@makecol} command, because this package redefines the standard \cs{@makecol} in the preamble to call \cs{latex@makecol}, which has been \cs{let} to \cs{@makecol}.
16772 % If this package is not loaded, we directly patch \cs{@makecol}.
16773 % If the \package{fancyhdr} package $\geq$ version 3.8, we also directly patch \cs{@makecol}, because \package{fancyhdr} does its own patch \cs{AtBeginDocument}.
16774 % \begin{macrocode}
16775 \ifboolexpr{%
16776 test{\@ifpackageloaded{fancyhdr}}%
16777 and test {\ifdef{\latex@makecol}}%
16778 }{%
16779 \patchcmd%
16780 {\latex@makecol}%
16781 {\xdef\@freelist{\@freelist\@midlist}}%
16782 {\xdef\@freelist{\@freelist\@midlist}\l@ddoxtrafeet}%
16783 {}%
16784 {\led@error@fail@patch@@makecol}%
16785 }{%
16786 \patchcmd%
16787 {\@makecol}%
16788 {\ifvbox\@kludgeins}%
16789 {\l@ddoxtrafeet\ifvbox\@kludgeins}%
16790 {}%
16791 {\led@error@fail@patch@@makecol}%
16792 }%
16793
16794 \patchcmd%
16795 {\@reinserts}%
16796 {\ifvbox}%
16797 {\l@ddodoreinxtrafeet\ifvbox}%
16798 {}%
16799 {\led@error@fail@patch@@reinserts}%
16800 }
16801
16802 % \end{macrocode}
16803 %
16804 %
16805
16806 % It turns out that \protect\cs{@doclearpage} also needs modifying.
16807 % \changes{v0.4.1}{2004/03/25}{Added code for changing \protect\cs{@doclearpage}}
16808 % \begin{macro}{\if@led@nofoot}
16809 % We have to check if there are any leftover feet.
16810 % \begin{macrocode}
16811 \newif\if@led@nofoot
16812
16813 % \end{macrocode}
16814 % \end{macro}
16815 %
16816 % \begin{macrocode}
16817 \@ifclassloaded{memoir}{%
16818 % \end{macrocode}
16819 % If the \protect\ltxclass{memoir} class is loaded, we hook into its modified
16820 % \verb?\@doclearpage?.
16821 % \begin{macro}{\@mem@extranofeet}
16822 % \begin{macrocode}
16823 \g@addto@macro{\@mem@extranofeet}{%%
16824 \def\do#1{%
16825 \unless\ifnocritical@%
16826 \ifvoid\csuse{#1footins}\else\@mem@nofootfalse\fi%
16827 \fi%
16828 \unless\ifnofamiliar@%
16829 \ifvoid\csuse{footins#1}\else\@mem@nofootfalse\fi%
16830 \fi%
16831 }
16832 \dolistloop{\@series}%
16833 }%
16834 }{%
16835 % \end{macrocode}
16836 % \end{macro}
16837 % As \protect\ltxclass{memoir} is not loaded we have patch \protect\cs{@doclearpage}.
16838 % \begin{macro}{\@led@testifnofoot}
16839 % \begin{macro}{\@doclearpage}
16840 % \begin{macrocode}
16841 \newcommand*{\@led@testifnofoot}{%
16842 \@led@nofoottrue%
16843 \ifvoid\footins\else%
16844 \@led@nofootfalse%
16845 \fi%
16846 \def\do##1{%
16847 \unless\ifnocritical@%
16848 \ifvoid\csuse{##1footins}\else%
16849 \@led@nofootfalse%
16850 \fi%
16851 \fi%
16852 \unless\ifnofamiliar@%
16853 \ifvoid\csuse{footins##1}\else%
16854 \@led@nofootfalse%
16855 \fi%
16856 \fi%
16857 }%
16858 \dolistloop{\@series}%
16859 }%
16860
16861 \pretocmd%
16862 {\@doclearpage}%
16863 {\@led@testifnofoot}%
16864 {}%
16865 {\led@error@fail@patch@@doclearpage}%
16866
16867 \patchcmd%
16868 {\@doclearpage}%
16869 {\ifvoid\footins}%
16870 {\if@led@nofoot}%
16871 {}%
16872 {\led@error@fail@patch@@doclearpage}%
16873
16874 }
16875
16876 % \end{macrocode}
16877 % \end{macro}
16878 % \end{macro}
16879 %
16880 % \section{Page numbering in parallel typsetting}
16881 % The \parpackage\ package has two options which change the way page numbering works.
16882 % We need to implement these options on \macpackage and not on \parpackage because they have some consequences for the \macpackage auxiliary files (numbered file; see~\reff{new@line@pagecounting}).
16883 % The \verb+sameparallelpagenumber+ option allows the same page number on both left and right side
16884 % The \verb+prevpgnotnumbered+ option allows an empty (not numbered) right-side page before \cs{Pages}.
16885 %
16886 %
16887 % We cannot implement these two options by changing the value of the \verb|page| counter, since its value is used by many \LaTeX\ features to determine whether a page is left (even numbered) or right (odd numbered).
16888 % Consequently, we have to do it by patching \cs{thepage}, in order to use the value of the \verb+par@page+ counter instead of the value of the \verb+page+ counter.
16889 %
16890 % This counter will be increased in a patched version of \LaTeX's \protect\cs{@outputpage} macro, as is the \verb+page+ counter in this macro. However, this increase will take account of the options.
16891 %
16892
16893 %
16894
16895 % \begin{macro}{\par@patch@thepage}
16896 % \begin{macro}{\par@patch@pagenumbering}
16897 % \cs{par@patch@thepage} patches \cs{thepage} in order to use the value of \verb+par@page+ counter and not the value of \verb+page+.
16898 % It must be called after any redefinition of \cs{thepage}.
16899 % That is why we insert it at the end of the \LaTeX\ macro \cs{pagenumbering}, which is called by some \cs{xxxmatter} commands.
16900 % In cases when we are using the \ltxclass{memoir} class, we insert it at the end of \cs{@mempnum}.
16901 % When using \cs{pagenumbering}, we also need to reset the \verb+par@page+ counter. Consequently, we put \cs{par@patch@thepage} and counter reset in \cs{par@patch@pagenumbering}
16902 % We also call \cs{par@patch@thepage} at the beginning of the document.
16903 % \begin{macrocode}
16904
16905 \newcommand{\par@patch@thepage}{%
16906 \ifboolexpr{%
16907 bool{sameparallelpagenumber}%
16908 or bool{prevpgnotnumbered}%
16909 }%
16910 {%
16911 \patchcmd{\thepage}%
16912 {page}{par@page}%
16913 {}%
16914 {\led@error@fail@patch@thepage}%
16915 }{}%
16916 }%
16917
16918 \newcommand{\par@patch@pagenumbering}{%
16919 \setcounter{par@page}{1}%
16920 \par@patch@thepage%
16921 }%
16922
16923 \ifbool{l@dmemoir}{%
16924 \ifdef{\@mempnum}{%Only with memoir < 3.8
16925 \apptocmd{\@mempnum}%
16926 {\par@patch@pagenumbering}%
16927 {}%%
16928 {\led@error@fail@patch@mempnum}%
16929 }{%
16930 \pretocmd{\pagenumbering}%
16931 {\par@patch@pagenumbering}%
16932 {}%
16933 {\led@error@fail@patch@pagenumbering}%
16934 }%
16935 }%
16936 {%
16937 \apptocmd{\pagenumbering}%
16938 {\par@patch@pagenumbering}%
16939 {}%
16940 {\led@error@fail@patch@pagenumbering}%
16941 }%
16942
16943 \AtBeginDocument{\par@patch@thepage}%
16944 % \end{macrocode}
16945 % \end{macro}
16946 % \end{macro}
16947 % \begin{macro}{\@outputpage}
16948 % As its name says, \cs{@outputpage} is a \LaTeX\ macro called in the output routine. It is this macro which increases the \verb+page+ counter.
16949 % We patch it in order to increase, conditionally, the \verb+par@page+ counter, and to set correctly the page number sent to the auxiliary files (\verb+.1+, \verb+.2+, etc.).
16950 % \begin{macrocode}
16951 \AtBeginDocument{%
16952 \set@this@c@page%
16953 \apptocmd{\@outputpage}{%
16954 \ifsameparallelpagenumber%
16955 \ifl@dprintingpages%
16956 \ifodd\c@page\else%
16957 \stepcounter{par@page}%
16958 \fi%
16959 \else%
16960 \stepcounter{par@page}%
16961 \fi%
16962 \else%
16963 \stepcounter{par@page}%
16964 \fi%
16965 }%
16966 {}%
16967 {\led@error@fail@patch@@outputpage}%
16968 }%
16969 \catcode`\#=12%
16970 \AtBeginDocument{%
16971 \apptocmd{\setcounter}{%
16972 \IfStrEq{#1}{page}{\set@this@c@page}{}%
16973 }%
16974 {}%
16975 {\led@error@fail@patch@setcounter}%
16976 \apptocmd{\addtocounter}{%
16977 \IfStrEq{#1}{page}{\set@this@c@page}{}%
16978 }%
16979 {}%
16980 {\led@error@fail@patch@addtocounter}%
16981 \@ifpackageloaded{calc}{%
16982 \apptocmd{\stepcounter}{%Because calc.sty does not use addtocounter in stepcounter
16983 \IfStrEq{#1}{page}{\set@this@c@page}{}%
16984 }%
16985 {}%
16986 {\led@error@fail@patch@steptocounter}%
16987 }{}%
16988 }%
16989 \catcode`\#=6%
16990 % \end{macrocode}
16991 % \end{macro}
16992 %
16993 % \begin{macro}{\thepar@page}
16994 % The \verb+par@page+ counter.
16995 % \begin{macrocode}
16996 \newcounter{par@page}%
16997 \setcounter{par@page}{1}%
16998 % \end{macrocode}
16999 % \end{macro}
17000 %
17001 % \section{Cross referencing}
17002 % \label{xref}\relax
17003 %
17004 %
17005 %
17006 % You can mark a place in the text using a command of the form
17007 % \protect\cs{edlabel}\marg{foo}, and later refer to it using the label
17008 % \meta{foo} by typing \protect\cs{edpageref}\marg{foo}, or \protect\cs{lineref}\marg{foo} or
17009 % \protect\cs{sublineref}\marg{foo} or \protect\cs{pstartref}. These reference commands will produce,
17010 % respectively, the page, line sub-line and pstart on which the
17011 % \protect\cs{edlabel}\marg{foo} command occurred.
17012 %
17013 % The reference macros warn you if a reference is made to an
17014 % undefined label.
17015 % If \marg{foo} has been used as a label before,
17016 % the \protect\cs{edlabel}\marg{foo} command will issue a complaint; subsequent
17017 % \protect\cs{edpageref} and \protect\cs{edlineref} commands will refer to the
17018 % latest occurrence of \protect\cs{edlabel}\marg{foo}.
17019 %
17020 % \begin{macro}{\labelref@list}
17021 % Set up a new list, \protect\cs{labelref@list}, to hold the page, line and
17022 % sub-line numbers for each label.
17023 % \begin{macrocode}
17024 \list@create{\labelref@list}
17025 % \end{macrocode}
17026 % \end{macro}
17027 %
17028 %
17029 % \begin{macro}{\zz@@@}
17030 % \begin{macro}{\zz@@@@}
17031 % Two convenience macros to zero three / four labeling counters in one go.
17032 % \begin{macrocode}
17033 \newcommand*{\zz@@@}{000|000|000}% Set three counters to zero in one go
17034 \newcommand*{\zz@@@@}{000|000|000|000}% Set four counters to zero in one go
17035
17036 % \end{macrocode}
17037 % \end{macro}
17038 % \end{macro}
17039 %
17040 % \begin{macro}{\edlabel}
17041 % The \protect\cs{edlabel} command first writes a \protect\cs{@lab} macro to
17042 % the \protect\cs{linenum@out} file. It then checks to see that the
17043 % \protect\cs{labelref@list} actually has something in it (if not, it
17044 % creates a dummy entry), and pops the next value for the current
17045 % label, storing it in \protect\cs{label@refs}. Finally it defines the
17046 % label to be \protect\cs{empty} so that any future check will turn up
17047 % the fact that it has been used.\footnote{The remaining macros
17048 % in this section were kindly revised by Wayne
17049 % Sullivan,\index{Sullivan, Wayne} who
17050 % substantially improved their efficiency and flexibility.}
17051 %
17052 % This version of the original \edmac{} \protect\cs{label} uses \protect\cs{@bsphack}
17053 % and \protect\cs{@esphack} to eliminate extra space problems and also use the \LaTeX\
17054 % write methods for the \file{.aux} file.
17055 %
17056 % Jesse Billett\footnote{(\url{[email protected]}) via the \texttt{ctt}
17057 % thread \enquote{ledmac cross referencing}, 25 August 2003.}
17058 % found that the original code could be off by several pages. This version,
17059 % hopefully cures that, and also allows for non-arabic page numbering.
17060 %
17061 % \changes{v0.2.1}{2003/08/26}{Tweaked \protect\cs{edlabel} to get correct page numbers}
17062 % \changes{v0.14.0}{2012/04/04}{Tweaked \protect\cs{edlabel} to get correct line number if the command is first element of a paragraph.}
17063 % \changes{v1.18.0}{2015/02/23}{\protect\cs{edlabel} is now defined only one time for both \eledmac and \eledpar}
17064 % \changes{v2.5.0}{2015/11/13}{Fix a bug when calling\protect\cs{edlabel} in a footnotes of the right side}
17065 % \begin{macrocode}
17066 \newcommand*{\edlabel}[1]{%
17067 \leavevmode%
17068 \@bsphack%
17069 \ifboolexpr{bool{ledRcol} or bool{ledRcol@}}{%
17070 \ifXnote@%
17071 \protected@write\@auxout{}%
17072 {\string\l@dmake@labelsR\space\thepage|\l@dparsedstartline|\l@dparsedstartsub||\annot@start|\the\c@pstartR|{#1}}%
17073 \ifdef{\hypertarget}%
17074 {\Hy@raisedlink{\hypertarget{#1}{}}}%
17075 {}%
17076 \else%
17077 \write\linenum@outR{\string\@lab}%
17078 \ifx\labelref@listR\empty%
17079 \xdef\label@refs{\zz@@@@}%
17080 \else%
17081 \gl@p\labelref@listR\to\label@refs%
17082 \fi%
17083 \ifvmode%
17084 \advancelabel@refs%
17085 \fi%
17086 % \end{macrocode}
17087 % Use code from the kernel \protect\cs{label} command to write the correct
17088 % page number.
17089 % Also define an hypertarget if \protect\package{hyperref} package is loaded.
17090 % \begin{macrocode}
17091 \protected@write\@auxout{}%
17092 {\string\l@dmake@labelsR\space\thepage|\label@refs|\the\c@pstartR|{#1}}%
17093 \ifdef{\hypertarget}%
17094 {\Hy@raisedlink{\hypertarget{#1}{}}}%
17095 {}%
17096 \fi%
17097 }{%
17098 \ifXnote@%
17099 \ifl@dpairing%pstart or pstartL?
17100 \protected@write\@auxout{}%
17101 {\string\l@dmake@labels\space\thepage|\l@dparsedstartline|\l@dparsedstartsub||\annot@start|\the\c@pstartL|{#1}}%
17102 \ifdef{\hypertarget}%
17103 {\Hy@raisedlink{\hypertarget{#1}{}}}%
17104 {}%
17105 \else%
17106 \protected@write\@auxout{}%
17107 {\string\l@dmake@labels\space\thepage|\l@dparsedstartline|\l@dparsedstartsub||\annot@start|\the\c@pstart|{#1}}%
17108 \ifdef{\hypertarget}%
17109 {\Hy@raisedlink{\hypertarget{#1}{}}}%
17110 {}%
17111 \fi%
17112 \else%
17113 \write\linenum@out{\string\@lab}%
17114 \ifx\labelref@list\empty%
17115 \xdef\label@refs{\zz@@@@}%
17116 \else%
17117 \gl@p\labelref@list\to\label@refs%
17118 \fi%
17119 \ifvmode%
17120 \advancelabel@refs%
17121 \fi%
17122 \ifl@dpairing%Pstart or PstartL?
17123 \protected@write\@auxout{}%
17124 {\string\l@dmake@labels\space\thepage|\label@refs|\the\c@pstartL|{#1}}%
17125 \ifdef{\hypertarget}%
17126 {\Hy@raisedlink{\hypertarget{#1}{}}}%
17127 {}%
17128 \else%
17129 \protected@write\@auxout{}%
17130 {\string\l@dmake@labels\space\thepage|\label@refs|\the\c@pstart|{#1}}%
17131 \ifdef{\hypertarget}%
17132 {\Hy@raisedlink{\hypertarget{#1}{}}}%
17133 {}%
17134 \fi%
17135 \fi%
17136 }%
17137 \@esphack}%
17138
17139 % \end{macrocode}
17140 % \end{macro}
17141 %
17142 %
17143 %\begin{macro}{\advancelabel@refs}
17144 %\begin{macro}{\labelrefsparseline}
17145 %\begin{macro}{\labelrefsparsesubline}
17146 % \changes{v1.4.1}{2012/11/16}{Fix a bug with \protect\cs{edlabel}.}
17147 %In cases where \protect\cs{edlabel} is the first element in a paragraph, we have a problem with line counts, because line counts change only at the first horizontal box of the paragraph.
17148 %Hence, we need to test \protect\cs{edlabel} if it occurs at the start of a paragraph. To do so, we use \protect\cs{ifvmode}. If the test is true, we must advance by one unit the amount of text we write into the \verb].aux] file.
17149 % We do so with the \protect\cs{advancelabel@refs} command.
17150 % \begin{macrocode}
17151 \newcounter{line}%
17152 \newcounter{subline}%
17153 \newcounter{absline}%
17154 \newcommand{\advancelabel@refs}{%
17155 \setcounter{line}{\expandafter\labelrefsparseline\label@refs}%
17156 \stepcounter{line}%
17157 \setcounter{absline}{\expandafter\labelrefsparseabsline\label@refs}%
17158 \stepcounter{absline}%
17159 \ifsublines@%
17160 \setcounter{subline}{\expandafter\labelrefsparsesubline\label@refs}%
17161 \stepcounter{subline}{1}%
17162 \def\label@refs{\theline|\thesubline|\theabsline}%
17163 \else%
17164 \def\label@refs{\theline|0|\theabsline}%
17165 \fi%
17166 }
17167 \def\labelrefsparseline#1|#2|#3{#1}%
17168 \def\labelrefsparsesubline#1|#2|#3{#2}%
17169 \def\labelrefsparseabsline#1|#2|#3{#3}%
17170 % \end{macrocode}
17171 % \end{macro}
17172 % \end{macro}
17173 % \end{macro}
17174 % \begin{macro}{\l@dmake@labels}
17175 % The \protect\cs{l@dmake@labels} macro gets executed when the labels file is
17176 % read. For each label it defines a macro, whose name is made up
17177 % partly from the label you supplied, that contains the page, line
17178 % and sub-line numbers. But first it checks to see whether the
17179 % label has already been used (and complains if it has).
17180 %
17181 % The initial use of \protect\cs{newcommand} is to catch if \protect\cs{l@dmake@labels}
17182 % has been previously defined (by a class or package).
17183 %
17184 % \verb+#1+ page number, \verb+#2+ line number, \verb-#3- sub-line number, \verb+#4+ absolute line number, \verb+#5+ line number annotation, \verb+#6+ pstart number, \verb+#7+ label.
17185 %
17186 % \begin{macrocode}
17187 \newcommand*{\l@dmake@labels}{}
17188 \def\l@dmake@labels#1|#2|#3|#4|#5|#6|#7{%
17189 \expandafter\ifx\csname the@label\csuse{XR@prefix}#7\endcsname%
17190 \relax%
17191 \else%
17192 \led@warn@DuplicateLabel{\csuse{XR@prefix}#7}%
17193 \fi
17194 \global\providetoggle{label@#7@ledRcol}%False is the default value of this toggle, which tells us whether a label is linked to the right or left side
17195 \csgdef{the@label\csuse{XR@prefix}#7}{#1|#2|#3|#4|#5|#6|\relax}%
17196 \ignorespaces}
17197
17198 % \end{macrocode}
17199 % \end{macro}
17200 %
17201 % \LaTeX\ reads the \verb+aux+ file at both the beginning and end of
17202 % the document, so we have to switch off duplicate label checking
17203 % after the first time the file is read.
17204 %
17205 % \begin{macrocode}
17206 \AtBeginDocument{%
17207 \def\l@dmake@labels#1|#2|#3|#4|#5|#6|#7{}%
17208 }
17209
17210 % \end{macrocode}
17211 %
17212 % \begin{macro}{\@lab}
17213 % The \protect\cs{@lab} command, which appears in the \protect\cs{linenum@out} file,
17214 % appends the current value of page, line, sub-line, and absolute line to the
17215 % \protect\cs{labelref@list}.
17216 % These values are defined by the earlier
17217 % \protect\cs{@page}, \protect\cs{@nl}, and the \protect\cs{sub@on} and \protect\cs{sub@off} commands
17218 % appearing in the \protect\cs{linenum@out} file.
17219 %
17220 % \LaTeX\ uses the \texttt{page} counter for page numbers. However,
17221 % it appears that this is not the right place to grab the page number.
17222 % That task is now done in the \protect\cs{edlabel} macro. This version
17223 % of \protect\cs{@lab} appends just the current line and sub-line numbers
17224 % to \protect\cs{labelref@list}.
17225 % \changes{v0.2.1}{2003/08/26}{Removed page setting from \protect\cs{@lab}}
17226 % \changes{v0.3.0}{2004/02/14}{Replaced \protect\cs{the}\protect\cs{line@num} by
17227 % \protect\cs{linenumr@p}\protect\cs{line@num} in
17228 % \protect\cs{@lab}, and similar for sub-lines}
17229 % \begin{macrocode}
17230
17231 \newcommand*{\@lab}{%
17232 \ifledRcol
17233 \xright@appenditem{\linenumr@p{\line@numR}|%
17234 \ifsublines@ \sublinenumr@p{\subline@numR}\else 0\fi|%
17235 \the\absline@numR|%
17236 \current@annot%
17237 }%
17238 \to\labelref@listR
17239 \else
17240 \xright@appenditem{%
17241 \linenumr@p{\line@num}|%
17242 \ifsublines@ \sublinenumr@p{\subline@num}\else 0\fi|%
17243 \the\absline@num|%
17244 \current@annot%
17245 }%
17246 \to\labelref@list
17247 \fi}
17248 % \end{macrocode}
17249 % \end{macro}
17250 % \begin{macro}{\applabel}
17251 % \protect\cs{applabel}, if called in \protect\cs{edtext} will insert automatically both a starting and an ending label for the current edtext lines.
17252 % \begin{macrocode}
17253 \newcommand*{\applabel}[1]{%
17254 \if@edtext@secondarg@%
17255 % \end{macrocode}
17256 % Label should not be already defined.
17257 % \begin{macrocode}
17258 \ifcsundef{the@label#1}{%
17259 \csdef{the@label#1}{applabel}%
17260 }%
17261 {%
17262 \led@warn@DuplicateLabel{#1 (applabel)}%
17263 }%
17264 % \end{macrocode}
17265 % Parse the \protect\cs{edtext} line numbers and annotations.
17266 % \begin{macrocode}
17267 \expandafter\l@dp@rsefootspec\l@d@nums|%
17268 \expandafter\parse@annot\l@current@annot|%
17269 % \end{macrocode}
17270 % Use the \LaTeX\ standard hack for label.
17271 % \begin{macrocode}
17272 \@bsphack%
17273 % \end{macrocode}
17274 % And now, write the data in the auxiliary file.
17275 % \begin{macrocode}
17276 \ifledRcol%
17277 \protected@write\@auxout{}%
17278 {\string\l@dmake@labelsR\space\l@dparsedstartpage|\l@dparsedstartline|\l@dparsedstartsub||\annot@start|\the\c@pstartR|{#1:start}}%
17279 \ifdef{\hypertarget}%
17280 {\Hy@raisedlink{\hypertarget{#1:start}{}}}%
17281 {}%
17282 \protected@write\@auxout{}%
17283 {\string\l@dmake@labelsR\space\l@dparsedendpage|\l@dparsedendline||\l@dparsedendsub||\annot@end|\the\c@pstartR|{#1:end}}%
17284 \else%
17285 \ifl@dpairing%pstart or pstartL?
17286 \protected@write\@auxout{}%
17287 {\string\l@dmake@labels\space\l@dparsedstartpage|\l@dparsedstartline|\l@dparsedstartsub||\annot@start|\the\c@pstartL|{#1:start}}%
17288 \ifdef{\hypertarget}%
17289 {\Hy@raisedlink{\hypertarget{#1:start}{}}}%
17290 {}%
17291 \protected@write\@auxout{}%
17292 {\string\l@dmake@labels\space\l@dparsedendpage|\l@dparsedendline|\l@dparsedendsub||\annot@end|\the\c@pstartL|{#1:end}}%
17293 \else%
17294 \protected@write\@auxout{}%
17295 {\string\l@dmake@labels\space\l@dparsedstartpage|\l@dparsedstartline|\l@dparsedstartsub||\annot@start|\the\c@pstart|{#1:start}}%
17296 \ifdef{\hypertarget}%
17297 {\Hy@raisedlink{\hypertarget{#1:start}{}}}%
17298 {}%
17299 \protected@write\@auxout{}%
17300 {\string\l@dmake@labels\space\l@dparsedendpage|\l@dparsedendline|\l@dparsedendsub||\annot@end|\the\c@pstart|{#1:end}}%
17301 \fi%
17302 \fi%
17303 % \end{macrocode}
17304 % Use the \LaTeX\ standard hack for label.
17305 % \begin{macrocode}
17306 \@esphack%
17307 % \end{macrocode}
17308 % If using \package{hyperref}, store the label in a list for the current edtext, to call later an hypertarget for the end of the lemma.
17309 % \begin{macrocode}
17310 \ifdef{\hypertarget}%
17311 {%
17312 \ifcsundef{applabel@thisedtext@\the\@edtext@level}{\global\cslet{applabel@thisedtext@\the\@edtext@level}{\relax}}{}%
17313 \listcsgadd{applabel@thisedtext@\the\@edtext@level}{#1}%
17314 }%
17315 {}%
17316 % \end{macrocode}
17317 % Warning if \protect\cs{applabel} is called outside of \protect\cs{edtext}.
17318 % \begin{macrocode}
17319 \else%
17320 \led@warn@AppLabelOutSecondArgEdtext{#1}%
17321 \fi%
17322 % \end{macrocode}
17323 % End of \protect\cs{applabel}
17324 % \begin{macrocode}
17325 }%
17326 % \end{macrocode}
17327 % \end{macro}
17328 % \begin{macro}{\edlabelS}
17329 % \begin{macro}{\edlabelE}
17330 % \begin{macro}{\edlabelSE}
17331 % \cs{edlabelS} and \cs{edlabelE} are just used to mark the beginning and the end of a passage.
17332 % \begin{macrocode}
17333 \newcommand{\edlabelS}[1]{%
17334 \edlabel{#1:start}%
17335 }
17336 \newcommand{\edlabelE}[1]{%
17337 \edlabel{#1:end}%
17338 }
17339 \newcommand{\edlabelSE}[1]{%
17340 \edlabelS{#1}%
17341 \edlabelE{#1}%
17342 }
17343 % \end{macrocode}
17344 % \end{macro}
17345 % \end{macro}
17346 % \begin{macro}{\wrap@edcrossref}
17347 % \changes{v1.12.1}{2014/08/06}{Fix spurious spaces.}
17348 % \changes{v1.12.7}{2014/09/07}{\protect\cs{wrap@edcrossref} is now robust}
17349 % \protect\cs{wrap@edcrossref} is called around all \macpackage\ crossref commands, except those which start with x.
17350 % It adds the hyperlink.
17351 % \begin{macrocode}
17352 \newrobustcmd{\wrap@edcrossref}[2]{%
17353 \ifdef{\hyperlink}%
17354 {\hyperlink{#1}{#2}}%
17355 {#2}%
17356 }
17357 % \end{macrocode}
17358 % \end{macro}
17359 % \begin{macro}{\edpageref}
17360 % \begin{macro}{\xpageref}
17361 % If the specified label exists, \protect\cs{edpageref} gives its page number.
17362 %
17363 % For this reference command, as for the other two, a special
17364 % version with prefix \verb"x" is provided for use in places where the
17365 % command is to be scanned as a number, as in \protect\cs{linenum}. These
17366 % special versions have two limitations: they do not print error
17367 % messages if the reference is unknown, and they can't appear as
17368 % the first label or reference command in the file; you must ensure
17369 % that a \protect\cs{edlabel} or a normal reference command appears first, or
17370 % these x-commands will always return zeros.
17371 %
17372 % \LaTeX\ already defines a \protect\cs{pageref}, so changing the name
17373 % to \protect\cs{edpageref}.
17374 % \begin{macrocode}
17375 \newcommand*{\edpageref}[1]{\l@dref@undefined{#1}\wrap@edcrossref{#1}{\l@dgetref@num{1}{#1}}}
17376 \newcommand*{\xpageref}[1]{\l@dgetref@num{1}{#1}}
17377
17378 % \end{macrocode}
17379 % \end{macro}
17380 % \end{macro}
17381 %
17382 % \begin{macro}{\edlineref}
17383 % \begin{macro}{\xlineref}
17384 % \changes{v1.16.1}{2015/02/05}{\protect\cs{lineref} is not defined if defined by some other package, like lineno.
17385 % \Eledmac provides \protect\cs{edlineref} instead.}
17386 % \changes{v2.5.0}{2015/11/13}{\protect\cs{xlineref} does not include anymore the side flag. Use \protect\cs{xflagref} to get it. Not that \protect\cs{edlineref} still contains the flag.}
17387 % If the specified label exists, \protect\cs{lineref} gives its line number.
17388 % \begin{macrocode}
17389 \newcommand*{\edlineref}[1]{%
17390 \l@dref@undefined{#1}%
17391 \wrap@edcrossref{#1}{%
17392 \providetoggle{label@#1@ledRcol}%Required for the first run, when the label has not yet been parsed on the .aux file
17393 \iftoggle{label@#1@ledRcol}%
17394 {\linenumrepR{\l@dgetref@num{2}{#1}}}%
17395 {\linenumrep{\l@dgetref@num{2}{#1}}}%
17396 \xflagref{#1}%
17397 }%
17398 }%
17399 \newcommand*{\xlineref}[1]{\l@dgetref@num{2}{#1}}%
17400
17401 % \end{macrocode}
17402 % \end{macro}
17403 % \end{macro}
17404 %
17405 % \begin{macro}{\sublineref}
17406 % \begin{macro}{\xsublineref}
17407 % If the specified label exists, \protect\cs{sublineref} gives its sub-line number.
17408 % \begin{macrocode}
17409 \newcommand*{\sublineref}[1]{%
17410 \l@dref@undefined{#1}%
17411 \wrap@edcrossref{#1}{%
17412 \providetoggle{label@#1@ledRcol}%Required for the first run, when the label has not yet been parsed on the .aux file
17413 \iftoggle{label@#1@ledRcol}%
17414 {\sublinenumrepR{\l@dgetref@num{3}{#1}}}%
17415 {\sublinenumrep{\l@dgetref@num{3}{#1}}}%
17416 }%
17417 }%
17418 \newcommand*{\xsublineref}[1]{\l@dgetref@num{3}{#1}}
17419
17420 % \end{macrocode}
17421 % \end{macro}
17422 % \end{macro}
17423 %
17424 % \begin{macro}{\xabslineref}
17425 % If the specified label exists, \cs{xabslineref} gives its absolute line number.
17426 % This is generally used only by \macpackage\ internal macros.
17427 % \begin{macrocode}
17428 \newcommand*{\xabslineref}[1]{\l@dgetref@num{4}{#1}}%
17429 % \end{macrocode}
17430 % \end{macro}
17431 % \begin{macro}{\annotationref}
17432 % \begin{macro}{\xannotationref}
17433 % If the specified label exists, \cs{edannotationref} gives the line number annotation with which it is associated.
17434 % \begin{macrocode}
17435 \newcommand*{\annotationref}[1]{%
17436 \l@dref@undefined{#1}%
17437 \wrap@edcrossref{#1}{%
17438 \l@wrap@ifnotemptybox{\Xwraplinenumannotation@ref}{%
17439 \l@dgetref@num{5}{#1}%
17440 }%
17441 }%
17442 }%
17443 \newcommand*{\xannotationref}[1]{%
17444 \l@dgetref@num{5}{#1}%
17445 }%
17446 % \end{macrocode}
17447 % \end{macro}
17448 % \end{macro}
17449 % \begin{macro}{\pstarteref}
17450 % \begin{macro}{\xpstartref}
17451 % If the specified label exists, \protect\cs{pstartref} gives its pstart number.
17452 % \begin{macrocode}
17453 \newcommand*{\pstartref}[1]{\l@dref@undefined{#1}\wrap@edcrossref{#1}{\l@dgetref@num{6}{#1}}}%
17454 \newcommand*{\xpstartref}[1]{\l@dgetref@num{6}{#1}}%
17455
17456 % \end{macrocode}
17457 % \end{macro}
17458 % \end{macro}
17459 % \begin{macro}{\xflagref}
17460 % \cs{xflagref} finds the side flag of any ref defined with \cs{edlabel}.
17461 % \begin{macrocode}
17462 \newcommand*{\xflagref}[1]{\l@dgetref@num{7}{#1}}%
17463 % \end{macrocode}
17464 % \end{macro}
17465 % The next three macros are used by the referencing commands above,
17466 % and do the job of extracting the right numbers from the label
17467 % macro that contains the page, line, and sub-line number.
17468 %
17469 % \begin{macro}{\l@dref@undefined}
17470 % The \protect\cs{l@dref@undefined} macro is called when you refer to a label with
17471 % the normal referencing macros. Its argument is a label, and it
17472 % just checks that the label has been defined.
17473 %
17474 % \begin{macrocode}
17475 \newcommand*{\l@dref@undefined}[1]{%
17476 \expandafter\ifx\csname the@label#1\endcsname\relax
17477 \led@warn@RefUndefined{#1}%
17478 \fi}
17479
17480 % \end{macrocode}
17481 % \end{macro}
17482 %
17483 % \begin{macro}{\l@dgetref@num}
17484 % Next, \protect\cs{l@dgetref@num} fetches the number we want. It has two
17485 % arguments: the first is simply a digit, specifying whether to
17486 % fetch a page (1), line (2), sub-line (3), (4) pstart number or (5) side flag. (This
17487 % switching is done by calling \protect\cs{l@dlabel@parse}.) The second argument
17488 % is the label-macro, which because of the \protect\cs{@lab} macro above is
17489 % defined to be a string of the type \verb"123|456|789".
17490 % \begin{macrocode}
17491 \newcommand*{\l@dgetref@num}[2]{%
17492 \expandafter
17493 \ifx\csname the@label#2\endcsname \relax
17494 000%
17495 \else
17496 \expandafter\expandafter\expandafter
17497 \l@dlabel@parse\csname the@label#2\endcsname|#1%
17498 \fi}
17499
17500 % \end{macrocode}
17501 % \end{macro}
17502 %
17503 % \begin{macro}{\l@dlabel@parse}
17504 % Notice that we slipped another \verb"|" delimiter into the
17505 % penultimate line of \protect\cs{l@dgetref@num}, to
17506 % keep the \enquote{switch-number} separate from the reference numbers. This
17507 % \verb"|" is used as another parameter delimiter by \protect\cs{l@dlabel@parse},
17508 % which extracts the appropriate number from its first argument.
17509 % The \verb"|"-delimited arguments consist of the expanded label-macro
17510 % (three reference numbers), followed by the switch-number (1,
17511 % 2, 3, 4, 5, 6) which defines which of the former seven numbers to
17512 % extract. (It was given earlier as the first argument of
17513 % \protect\cs{l@dgetref@num}.)
17514 % \begin{macrocode}
17515 \newcommand*{\l@dlabel@parse}{}
17516 \def\l@dlabel@parse#1|#2|#3|#4|#5|#6|#7|#8{%
17517 \ifcase #8%
17518 \or #1%
17519 \or #2%
17520 \or #3%
17521 \or #4%
17522 \or #5%
17523 \or #6%
17524 \or #7%
17525 \fi}
17526 % \end{macrocode}
17527 % \end{macro}
17528 %
17529 % \begin{macro}{\xxref}
17530 % \changes{v1.19.0}{2015/03/06}{\protect\cs{xxref} works also with right side numbers, when \protect\cs{@Rlineflag} is not empty.}
17531 % \changes{v1.20.0}{2015/03/22}{Debug \protect\cs{xxref} when not loading \eledpar (Fix a bug added in 1.19.0).}
17532 % The \protect\cs{xxref} command takes two arguments, both of which are
17533 % labels, e.g., \protect\cs{xxref}\verb+{mouse}{elephant}+. It first does some
17534 % checking to make sure that the labels do exist (if one does not,
17535 % those numbers are set to zero). Then it calls \protect\cs{linenum} and sets
17536 % the beginning page, line, and sub-line numbers to those of the
17537 % place where \protect\cs{label}\verb+{mouse}+ was placed, and the ending
17538 % numbers to those at \verb+{elephant}+. The point of this is
17539 % to be able to manufacture footnote line references to passages
17540 % which cannot be specified in the normal way as the first argument
17541 % to \protect\cs{edtext} for one reason or another. Using \protect\cs{xxref} in the
17542 % second argument of \protect\cs{edtext} lets you set things up at least
17543 % semi-automatically.
17544 % \begin{macrocode}
17545 \newcommand*{\xxref}[2]{%
17546 {%
17547 \expandafter\ifx\csname the@label#1\endcsname\relax%
17548 \let\@tempa\zz@@@%
17549 \def\@tempc{}%
17550 \else%
17551 \def\@tempa{%
17552 \l@dgetref@num{1}{#1}|%
17553 \l@dgetref@num{2}{#1}|%
17554 \l@dgetref@num{3}{#1}%
17555 }%
17556 \edef\@tempc{%
17557 \l@dgetref@num{5}{#1}%
17558 }%
17559 \fi%
17560 \expandafter\ifx\csname the@label#2\endcsname\relax%
17561 \let\@tempb\zz@@@%
17562 \def\@tempd{}%
17563 \else%
17564 \def\@tempb{%
17565 \l@dgetref@num{1}{#2}|%
17566 \l@dgetref@num{2}{#2}|%
17567 \l@dgetref@num{3}{#2}%
17568 }%
17569 \edef\@tempd{%
17570 \l@dgetref@num{5}{#2}%
17571 }%
17572 \fi%
17573 \global\appto\@beforeinsertofthisedtext{%
17574 \def\@this@crossref@start{#1}%
17575 }%
17576 \global\appto\@beforeinsertofthisedtext{%
17577 \def\@this@crossref@end{#2}%
17578 }%
17579 \linenum{\@tempa|\@tempb}%
17580 \edef\@tempe{\@tempc|\@tempd}%
17581 \expandafter\lineannot\expandafter{\@tempe}%
17582 }%
17583 }%
17584
17585
17586 % \end{macrocode}
17587 % \end{macro}
17588 %
17589 % \begin{macro}{\appref}
17590 % \begin{macro}{\apprefwithpage}
17591 % \begin{macro}{\SEref}
17592 % \begin{macro}{\SErefwithpage}
17593 % \begin{macro}{\SErefwithpage}
17594 % \protect\cs{appref}, \cs{SEref}, \cs{apprefwithpage}, \cs{SErefwithpage} and \cs{SEonlypage} print crossref to some start / end lines defined by specific commands.
17595 % It prints the lines as they should be printed in the apparatus (critical notes for not suffixed versions, endnotes for suffixed versions).
17596 %
17597 % Here we define hooks similar to some those related to critical footnotes or endnotes.
17598 %
17599 % So, first declare the default value of the hooks for the pseudo-series.
17600 % Also declare the internal toggle which are switch by \macpackage{}.
17601 % \begin{macrocode}
17602 \def\Xtwolines@appref{}%
17603 \def\Xtwolines@SEref{}%
17604
17605 \def\Xmorethantwolines@appref{}%
17606 \def\Xmorethantwolines@SEref{}%
17607
17608 \def\Xlinerangeseparator@appref{\endashchar}%
17609 \def\Xlinerangeseparator@SEref{\endashchar}%
17610
17611 \def\Xsublinesep@appref{\fullstop}%
17612 \def\Xsublinesep@SEref{\fullstop}%
17613
17614 \def\Xpagelinesep@appref{\fullstop}%
17615 \def\Xpagelinesep@SEref{\fullstop}%
17616
17617
17618 \newtoggle{Xtwolinesbutnotmore@appref}%
17619 \newtoggle{Xtwolinesbutnotmore@SEref}%
17620
17621 \newtoggle{Xtwolinesonlyinsamepage@appref}%
17622
17623 \newtoggle{Xtwolinesonlyinsamepage@SEref}%
17624
17625 \newtoggle{Xlineflag@appref}%
17626 \toggletrue{Xlineflag@appref}%Here exception
17627 \newtoggle{Xlineflag@SEref}%
17628 \toggletrue{Xlineflag@SEref}%%Here exception
17629
17630 \newtoggle{Xlinenumannotationonlyfirst@SEref}%Never changed, just for the test in \setprintlines
17631 \newtoggle{Xlinenumannotationonlyfirst@appref}%Idem
17632 \newtoggle{Xnolinenumber@SEref}%Idem
17633 \newtoggle{Xnolinenumber@appref}%Idem
17634 \newtoggle{Xnolinenumberifannotation@SEref}%Idem
17635 \newtoggle{Xnolinenumberifannotation@appref}%Idem
17636 \newtoggle{Xnopagenumberifcurrent@SEref}%Idem
17637
17638 \def\Xlinenumannotationposition@appref{after}%
17639 \def\Xlinenumannotationposition@SEref{after}%
17640
17641 \def\Xwraplinenumannotation@appref{\textsuperscript}%
17642 \def\Xwraplinenumannotation@SEref{\textsuperscript}%
17643 \newtoggle{Xnoidenticallinenumannotation@appref}%
17644 \newtoggle{Xnoidenticallinenumannotation@SEref}%
17645
17646 \def\Xendtwolines@apprefwithpage{}%
17647 \def\Xendtwolines@SErefwithpage{}%
17648
17649 \def\Xendmorethantwolines@apprefwithpage{}%
17650 \def\Xendmorethantwolines@SErefwithpage{}%
17651
17652 \def\Xendlinerangeseparator@apprefwithpage{\endashchar}
17653 \def\Xendlinerangeseparator@SErefwithpage{\endashchar}
17654 \def\Xendlinerangeseparator@SErefonlypage{\endashchar}
17655
17656 \def\Xendbeforepagenumber@apprefwithpage{p.}%
17657 \def\Xendbeforepagenumber@SErefwithpage{p.}%
17658 \def\Xendbeforepagenumber@SEonlypage{p.}%
17659
17660 \def\Xendafterpagenumber@apprefwithpage{) }%
17661 \def\Xendafterpagenumber@SErefwithpage{) }%
17662
17663
17664 \def\Xendlineprefixsingle@apprefwithpage{}%
17665 \def\Xendlineprefixsingle@SErefwithpage{}%
17666
17667 \def\Xendlineprefixmore@apprefwithpage{}%
17668 \def\Xendlineprefixmore@SErefwithpage{}%
17669
17670 \newtoggle{Xendtwolinesbutnotmore@apprefwithpage}%
17671 \newtoggle{Xendtwolinesbutnotmore@SErefwithpage}%
17672
17673 \def\Xendsublinesep@apprefwithpage{\fullstop}%
17674 \def\Xendsublinesep@SErefwithpage{\fullstop}%
17675
17676 \newtoggle{Xendtwolinesonlyinsamepage@apprefwithpage}%
17677 \newtoggle{Xendtwolinesonlyinsamepage@SErefwithpage}%
17678
17679 \newtoggle{Xendlineflag@apprefwithpage}
17680 \toggletrue{Xendlineflag@apprefwithpage}%Here, exception
17681 \newtoggle{Xendlineflag@SErefwithpage}
17682 \toggletrue{Xendlineflag@SErefwithpage}%Here, exception
17683
17684
17685 \def\Xendlinenumannotationposition@apprefwithpage{after}%
17686 \def\Xendlinenumannotationposition@SErefwithpage{after}%
17687
17688 \def\Xendlinenumannotationposition@apprefwithpage{after}%
17689 \def\Xendlinenumannotationposition@apprefwithpage@SErefwithpage{after}%
17690
17691 \def\Xendwraplinenumannotation@apprefwithpage{\textsuperscript}%
17692 \def\Xendwraplinenumannotation@SErefwithpage{\textsuperscript}%
17693
17694 \newtoggle{Xendnoidenticallinenumannotation@apprefwithpage}%
17695 \newtoggle{Xendnoidenticallinenumannotation@SErefwithpage}%
17696
17697
17698 \newtoggle{Xendnolinenumber@SErefwithpage}%Never changed, only for test in \setprintendlines
17699 \newtoggle{Xendnolinenumber@apprefwithpage}%Idem
17700 \newtoggle{Xendnolinenumberifannotation@SErefwithpage}%Idem
17701 \newtoggle{Xendnolinenumberifannotation@apprefwithpage}%Idem
17702
17703 % \end{macrocode}
17704 % Note that some of these hooks are declared but no user command can change their values. Such hooks are not pertinent for \verb+appref+ and \verb+apprefwithpage+ pseudo-series, but their values are nonetheless tested in some macros.
17705 % \begin{macrocode}
17706
17707 \newtoggle{Xendlinenumannotationonlyfirst@SEref}%Never changed, just for the test in \setprintendlines
17708 \newtoggle{Xendlinenumannotationonlyfirst@SErefwithpage}%Idem
17709 \newtoggle{Xendlinenumannotationonlyfirst@appref}%Idem
17710 \newtoggle{Xendlinenumannotationonlyfirst@apprefwithpage}%Idem
17711
17712 \gdef\Xboxstartlinenum@appref{0pt}
17713 \gdef\Xboxstartlinenum@SEref{0pt}
17714 \newtoggle{Xnotboxingsubline@appref}%
17715 \newtoggle{Xnotboxingsubline@SEref}%
17716
17717 \gdef\Xboxendlinenum@appref{0pt}
17718 \gdef\Xboxendlinenum@SEref{0pt}
17719
17720 \gdef\Xendboxstartlinenum@apprefwithpage{0pt}
17721 \gdef\Xendboxstartlinenum@SErefwithpage{0pt}
17722 \newtoggle{Xendnotboxingsubline@apprefwithpage}%
17723 \newtoggle{Xendnotboxingsubline@SErefwithpage}%
17724
17725 \gdef\Xendboxendlinenum@apprefwithpage{0pt}
17726 \gdef\Xendboxendlinenum@SErefwithpage{0pt}
17727
17728 \newtoggle{Xendpagenumberonlyfirst@apprefwithpage}
17729 \newtoggle{Xendpagenumberonlyfirst@SErefwithpage}
17730
17731 \newtoggle{Xendpagenumberonlyfirstifsingle@apprefwithpage}
17732 \newtoggle{Xendpagenumberonlyfirstifsingle@SErefwithpage}
17733
17734 \newtoggle{Xendpagenumberonlyfirstintwo@apprefwithpage}
17735 \newtoggle{Xendpagenumberonlyfirstintwo@SErefwithpage}
17736
17737 \gdef\Xendsympagenum@apprefwithpage{}
17738 \gdef\Xendsympagenum@SErefwithpage{}
17739
17740 \gdef\Xendinplaceofpagenumber@apprefwithpage{}
17741 \gdef\Xendinplaceofpagenumber@SErefwithpage{}
17742
17743 % \end{macrocode}
17744 % Now, declare the default values of \protect\cs{@apprefprefixsingle} and \protect\cs{@apprefprefixmore}, \cs{@SErefprefix}, \cs{@SErefprefixmore} and the commands which defines them.
17745 % \changes{v2.5.0}{2015/11/13}{Debug \protect\cs{setapprefprefixsingle}}
17746 % \begin{macrocode}
17747 \newcommand\@apprefprefixsingle{}%
17748 \newcommand\@SErefprefixsingle{}%
17749
17750 \newcommand\@apprefprefixmore{}%
17751 \newcommand\@SErefprefixmore{}%
17752
17753 \newcommand{\setapprefprefixsingle}[1]{%
17754 \gdef\@apprefprefixsingle{#1}%
17755 }
17756 \newcommand{\setSErefprefixsingle}[1]{%
17757 \gdef\@SErefprefixsingle{#1}%
17758 }
17759
17760 \newcommand{\setapprefprefixmore}[1]{%
17761 \gdef\@apprefprefixmore{#1}%
17762 }
17763 \newcommand{\setSErefprefixmore}[1]{%
17764 \gdef\@SErefprefixmore{#1}%
17765 }
17766
17767 % \end{macrocode}
17768 % And not \cs{setSErefonlypageprefixsingle} and \cs{setSErefonlypageprefixmore}.
17769 % \begin{macrocode}
17770 \newcommand{\setSErefonlypageprefixsingle}[1]{%
17771 \gdef\SErefonlypage@prefixsingle{#1}%
17772 }%
17773 \newcommand{\setSErefonlypageprefixmore}[1]{%
17774 \gdef\SErefonlypage@prefixmore{#1}%
17775 }%
17776 % \end{macrocode}
17777 % \changes{v1.23.0}{2015/05/18}{Debug \protect\cs{Xendtwolines}, \protect\cs{Xendmorethantwolines}, \protect\cs{Xendtwolinesbutnotmore} and \protect\cs{Xendtwolinesonlyinsamepage} when using \protect\cs{apprefwithpage}.}
17778 % And now, the main commands: \protect\cs{appref}, \protect\cs{apprefwithpage}, \cs{SEref} and \cs{SErefwithpage}.
17779 % These commands call \cs{refformated@} and \protect\cs{refformatedwithpage}, which calls \cs{printlines} and \cs{printendlines} . That is why we have previously declared all hooks values tested inside these last commands.
17780 % \begin{macrocode}
17781
17782 \newcommandx{\appref}[2][1,usedefault]{\refformated@{#1}{#2}{appref}}
17783 \newcommandx{\SEref}[2][1,usedefault]{\refformated@{#1}{#2}{SEref}}
17784
17785 \newcommandx{\apprefwithpage}[2][1,usedefault]{\refformatedwithpage@{#1}{#2}{appref}}
17786 \newcommandx{\SErefwithpage}[2][1,usedefault]{\refformatedwithpage@{#1}{#2}{SEref}}
17787 \newcommandx{\SErefonlypage}[2][1,usedefault]{\refformatedonlypage@{#1}{#2}{SEref}}
17788
17789
17790 \newcommand{\refformated@}[3]{%
17791 \def\do##1{%
17792 \setkeys[mac]{truefootnoteoption}{##1}%
17793 }%
17794 \notblank{#1}{\docsvlist{#1}}{}%
17795 \xdef\@currentseries{#3}%
17796 \iftoggle{noprefix@}{}%
17797 {%
17798 \ifcsempty{@#3prefixmore}%
17799 {\@apprefprefixsingle}%
17800 {%
17801 \IfEq{\xlineref{#2:start}}{\xlineref{#2:end}}%
17802 {\iftoggle{prefixmore@}%
17803 {\csuse{@#3prefixmore}}%
17804 {\csuse{@#3prefixsingle}}%
17805 }%
17806 {\csuse{@#3prefixmore}}%
17807 }%
17808 }%
17809 \ifboolexpr{%
17810 test{\ifcsundef{the@label#2:start}}%
17811 or test{\ifcsundef{the@label#2:end}}%
17812 }%
17813 {\led@warn@pairRefUndefined{#2}\nfss@text{\reset@font\bfseries ??}}%
17814 {%
17815 \def\@this@crossref@start{#2:start}%
17816 \def\@this@crossref@end{#2:end}%
17817 \xdef\annot@start{\xannotationref{#2:start}}%
17818 \xdef\annot@end{\xannotationref{#2:end}}%
17819 \printlines\xpageref{#2:start}|\xlineref{#2:start}|\xsublineref{#2:start}|\xpageref{#2:end}|\xlineref{#2:end}|\xsublineref{#2:end}|\relax|\xflagref{#2:start}|%
17820 }%
17821 \def\do##1{%
17822 \setkeys[mac]{falsefootnoteoption}{##1}%
17823 }%
17824 \notblank{#1}{\docsvlist{#1}}{}%
17825 }%
17826
17827 \newcommand{\refformatedwithpage@}[3]{%
17828 \def\do##1{%
17829 \setkeys[mac]{truefootnoteoption}{##1}%
17830 }%
17831 \notblank{#1}{\docsvlist{#1}}{}%
17832 \xdef\@currentseries{#3withpage}%
17833 \ifboolexpr{%
17834 test{\ifcsundef{the@label#2:start}}%
17835 or test{\ifcsundef{the@label#2:end}}%
17836 }%
17837 {\led@warn@pairRefUndefined{#2}\nfss@text{\reset@font\bfseries ??}}%
17838 {%
17839 \def\@this@crossref@start{#2:start}%
17840 \def\@this@crossref@end{#2:end}%
17841 \xdef\annot@start{\xannotationref{#2:start}}%
17842 \xdef\annot@end{\xannotationref{#2:end}}%
17843 \printendlines\xpageref{#2:start}|\xlineref{#2:start}|\xsublineref{#2:start}|\xpageref{#2:end}|\xlineref{#2:end}|\xsublineref{#2:end}|\relax|\xflagref{#2:start}|%
17844 }%
17845 \def\do##1{%
17846 \setkeys[mac]{falsefootnoteoption}{##1}%
17847 }%
17848 \notblank{#1}{\docsvlist{#1}}{}%
17849 }%
17850
17851 \newcommand{\refformatedonlypage@}[3]{%
17852 \def\do##1{%
17853 \setkeys[mac]{truefootnoteoption}{##1}%
17854 }%
17855 \notblank{#1}{\docsvlist{#1}}{}%
17856 \xdef\@currentseries{#3onlypage}%
17857 \ifboolexpr{%
17858 test{\ifcsundef{the@label#2:start}}%
17859 or test{\ifcsundef{the@label#2:end}}%
17860 }%
17861 {\led@warn@pairRefUndefined{#2}\nfss@text{\reset@font\bfseries ??}}%
17862 {\ifnumequal{\xpageref{#2:end}}{\xpageref{#2:start}}%
17863 {%
17864 \ifcsvoid{#3onlypage@prefixsingle}%
17865 {}%
17866 {\csletcs{Xendbeforepagenumber@#3onlypage}{#3onlypage@prefixsingle}}%
17867 \printnpnum{%
17868 \wrap@edcrossref{#2:start}{\xpageref{#2:start}}%
17869 }%
17870 }%
17871 {%
17872 \ifcsvoid{#3onlypage@prefixmore}%
17873 {}%
17874 {\csletcs{Xendbeforepagenumber@#3onlypage}{#3onlypage@prefixmore}}%
17875 \ifdefined\linerangesep@%
17876 \printnpnum{%
17877 \wrap@edcrossref{#2:start}{\xpageref{#2:start}}%
17878 \linerangesep@%
17879 \wrap@edcrossref{#2:end}{\xpageref{#2:end}}%
17880 }%
17881 \else%
17882 \printnpnum{%
17883 \wrap@edcrossref{#2:start}{\xpageref{#2:start}}%
17884 \csuse{Xendlinerangeseparator@\@currentseries}%
17885 \wrap@edcrossref{#2:end}{\xpageref{#2:end}}%
17886 }%
17887 \fi%
17888 }%
17889 }%
17890 \def\do##1{%
17891 \setkeys[mac]{falsefootnoteoption}{##1}%
17892 }%
17893 \notblank{#1}{\docsvlist{#1}}{}%
17894 }%
17895 % \end{macrocode}
17896 % \end{macro}
17897 % \end{macro}
17898 % \end{macro}
17899 % \end{macro}
17900 % \end{macro}
17901 % \end{macro}
17902 % \begin{macro}{\edmakelabel}
17903 % Sometimes the \protect\cs{edlabel} command cannot be used to specify
17904 % exactly the page and line desired; you can use the \protect\cs{edmakelabel} macro
17905 % make your own label. For example, if you insert
17906 % \protect\cs{edmakelabel}\verb+{elephant}{10|25|0}+ you will have created a
17907 % new label, and a later call to \protect\cs{edpageref}\verb+{elephant}+ would
17908 % print \enquote{10} and \protect\cs{lineref}\verb+{elephant}+ would print \enquote{25}.
17909 % The sub-line number here is zero.
17910 % \protect\cs{edmakelabel} takes a label, followed by a page and a line number(s)
17911 % as arguments.
17912 % \LaTeX\ defines a \protect\cs{makelabel} macro which is used in lists.
17913 % Peter Wilson has changed the name to \protect\cs{edmakelabel}.
17914 % \begin{macrocode}
17915 \newcommand*{\edmakelabel}[2]{\expandafter\xdef\csname the@label#1\endcsname{#2}}
17916
17917 % \end{macrocode}
17918 % (If you are only going to refer to such a label using
17919 % \protect\cs{xxref}, then you can omit entries in the same way as with
17920 % \protect\cs{linenum} (see \reff{linenumdef} and
17921 % \reff{linenumbers}), since \protect\cs{xxref} makes a call to
17922 % \protect\cs{linenum} in order to do its work.)
17923 % \end{macro}
17924 %
17925 %
17926 % \subsection{Compatibility with \package{xref}}
17927 % Here, we provide compatibility with the \package{xref} to enable \macpackage's cross-referencing to external documents.
17928 % We assume that the user loads \package{xref} \emph{before} \package{reledmac}, but uses \cs{externaldocument} \emph{after} loading \package{reledmac}.
17929 %
17930 % \begin{macro}{\XR@test}
17931 % First, we patch the \package{xr} macro \cs{XR@test}, which is called on every line of the external \verb+.aux+ file, in order to also call macros specific to \macpackage.
17932 % \begin{macrocode}
17933 \pretocmd{\XR@test}%
17934 {\XR@test@mac+++#1#2#3#4+++}%
17935 {}%
17936 {}%
17937 % \end{macrocode}
17938 % \end{macro}
17939 % \begin{macro}{\XR@test@mac}
17940 % The \cs{XR@test@mac} takes the full content of a line of the external \verb+.aux+ files, with the three final dots added by \package{xr}.
17941 % \begin{macrocode}
17942 \long\def\XR@test@mac+++#1+++{\XR@test@mac@test#1}
17943 % \end{macrocode}
17944 % \end{macro}
17945 % \begin{macro}{\XR@test@mac@test}
17946 % And finally, \cs{XR@test@mac@test} does the job.
17947 % This code is based on the \cs{XR@test} macro of the \package{xr} package. However, not that the \cs{XR@prefix} is not called here, but it is integrated directly in \cs{l@dmake@labels} and \cs{l@dmake@labelsR}.
17948 % \begin{macrocode}
17949 \long\def\XR@test@mac@test#1#2...{%The triple dots (NOT \ldots) are because of the line 22 of xr.sty v5.02 1994/05/28
17950 \ifx#1\l@dmake@labels%
17951 \l@dmake@labels#2%
17952 \else
17953 \ifx#1\l@dmake@labelsR%
17954 \l@dmake@labelsR #2%
17955 \fi%
17956 \fi%
17957 }%
17958 % \end{macrocode}
17959 % \end{macro}
17960 % \section{Sidenotes}
17961 %
17962 % Regular \protect\cs{marginpar}s do not work inside numbered text\,---\,they
17963 % do not produce any note but do put an extra unnumbered blank line into
17964 % the text.
17965 %
17966 % \begin{macro}{\@xympar}
17967 % Changing \protect\cs{@xympar} a little at least ensures that \protect\cs{marginpar}s
17968 % in numbered text do not disturb the flow.
17969 % \changes{v0.5.0}{2004/04/01}{Eliminated \protect\cs{marginpar} disturbance}
17970 % \changes{v2.0.0}{2104/06/28}{Patching \protect\cs{@xympar} instead of redefining it}
17971 %
17972 % \begin{macrocode}
17973 \pretocmd{\@xympar}%
17974 {\ifnumberedpar@
17975 \led@warn@NoMarginpars
17976 \@esphack
17977 \else}%
17978 {}%
17979 {}%
17980
17981 \apptocmd{\@xympar}%
17982 {\fi}%
17983 {}
17984 {}
17985
17986 % \end{macrocode}
17987 % \end{macro}
17988 %
17989 % We provide sidenotes as replacement for \protect\cs{marginpar} in numbered text.
17990 % \changes{v0.5.0}{2004/04/03}{Added left and right sidenotes}
17991 % \changes{v0.5.1}{2004/04/10}{Added moveable sidenote}
17992 %
17993 % \begin{macro}{\sidenote@margin}
17994 % \begin{macro}{\sidenotemargin}
17995 % \begin{macro}{\l@dgetsidenote@margin}
17996 % These are the sidenote equivalents to \protect\cs{line@margin} and \protect\cs{linenummargin}
17997 % for specifying which margin. The default is the right margin (opposite to
17998 % the default for line numbers).
17999 % \protect\cs{l@dgetsidenote@margin} returns the number associated to sidenote margin:
18000 % \begin{description}
18001 % \item[left:] 0
18002 % \item[right:] 1
18003 % \item[outer:] 2
18004 % \item[inner:] 3
18005 % \end{description}
18006 % \changes{v0.5.1}{2004/04/10}{Added \protect\cs{sidenotemargin} and \protect\cs{sidenote@margin}}
18007 % \changes{v0.7.0}{2005/02/23}{Added \protect\cs{l@dgetsidenote@margin}}
18008 % \changes{v1.12.0}{2014/08/05}{\protect\cs{sidenotemargin} is now directly defined in \protect\package{eledmac} to be able to manage \protect\package{eledpar}.}
18009 % \begin{macrocode}
18010 \newcount\sidenote@margin
18011 \newcommand*{\sidenotemargin}[1]{{%
18012 \l@dgetsidenote@margin{#1}%
18013 \ifnum\@l@dtempcntb>\m@ne
18014 \ifledRcol
18015 \global\sidenote@marginR=\@l@dtempcntb
18016 \else
18017 \global\sidenote@margin=\@l@dtempcntb
18018 \fi
18019 \fi}}
18020 \newcommand*{\l@dgetsidenote@margin}[1]{%
18021 \def\@tempa{#1}\def\@tempb{left}%
18022 \ifx\@tempa\@tempb
18023 \@l@dtempcntb \z@
18024 \else
18025 \def\@tempb{right}%
18026 \ifx\@tempa\@tempb
18027 \@l@dtempcntb \@ne
18028 \else
18029 \def\@tempb{outer}%
18030 \ifx\@tempa\@tempb
18031 \@l@dtempcntb \tw@
18032 \else
18033 \def\@tempb{inner}%
18034 \ifx\@tempa\@tempb
18035 \@l@dtempcntb \thr@@
18036 \else
18037 \led@warn@BadSidenotemargin
18038 \@l@dtempcntb \m@ne
18039 \fi
18040 \fi
18041 \fi
18042 \fi}
18043 \sidenotemargin{right}
18044
18045 % \end{macrocode}
18046 % \end{macro}
18047 % \end{macro}
18048 % \end{macro}
18049 %
18050 % \begin{macro}{\l@dlp@rbox}
18051 % \begin{macro}{\l@drp@rbox}
18052 % We need two boxes to store sidenote texts.
18053 % \begin{macrocode}
18054 \newbox\l@dlp@rbox
18055 \newbox\l@drp@rbox
18056
18057 % \end{macrocode}
18058 % \end{macro}
18059 % \end{macro}
18060 %
18061 %
18062 % \begin{macro}{\ledlsnotewidth}
18063 % \begin{macro}{\ledrsnotewidth}
18064 % \begin{macro}{\ledlsnotesep}
18065 % \begin{macro}{\ledrsnotesep}
18066 % \begin{macro}{\ledlsnotefontsetup}
18067 % \begin{macro}{\ledrsnotefontsetup}
18068 % These specify the width of the left/right boxes (initialised to
18069 % \protect\cs{marginparwidth}), their distance from
18070 % the text (initialised to \protect\cs{linenumsep}), and the fonts used.
18071 % \begin{macrocode}
18072 \newdimen\ledlsnotewidth \ledlsnotewidth=\marginparwidth
18073 \newdimen\ledrsnotewidth \ledrsnotewidth=\marginparwidth
18074 \newdimen\ledlsnotesep \ledlsnotesep=\linenumsep
18075 \newdimen\ledrsnotesep \ledrsnotesep=\linenumsep
18076 \newcommand*{\ledlsnotefontsetup}{\raggedleft\footnotesize}
18077 \newcommand*{\ledrsnotefontsetup}{\raggedright\footnotesize}
18078
18079 % \end{macrocode}
18080 % \end{macro}
18081 % \end{macro}
18082 % \end{macro}
18083 % \end{macro}
18084 % \end{macro}
18085 % \end{macro}
18086 %
18087 %
18088 % \begin{macro}{\ledleftnote}
18089 % \begin{macro}{\ledrightnote}
18090 % \begin{macro}{\ledinnernote}
18091 % \begin{macro}{\ledouternote}
18092 % \begin{macro}{\ledsidenote}
18093 % \begin{macro}{\ledsidenote@}
18094 % \protect\cs{ledleftnote}, \protect\cs{ledrightnote}, \protect\cs{ledinnernote}, \protect\cs{ledouternote} are the
18095 % user commands for left, right, inner and outer sidenotes.
18096 % The two last ones are just alias for the two first ones, depending on the page number.
18097 % \protect\cs{ledsidenote}\marg{text} is the command for a moveable sidenote.
18098 %
18099 % All these macro call the macro \cs{ledsidenote@}, as they have the same structure.
18100 % \begin{macrocode}
18101 \newcommand*{\ledleftnote}[1]{%
18102 \ledsidenote@{\l@dlsnote{#1}}%
18103 }%
18104 \newcommand*{\ledrightnote}[1]{%
18105 \ledsidenote@{\l@drsnote{#1}}%
18106 }%
18107 \newcommand*{\ledsidenote}[1]{%
18108 \ledsidenote@{\l@dcsnote{#1}}%
18109 }%
18110 \newcommand*{\ledinnernote}[1]{%
18111 \ledsidenote@{\l@disnote{#1}}%
18112 }%
18113 \newcommand*{\ledouternote}[1]{%
18114 \ledsidenote@{\l@dosnote{#1}}%
18115 }%
18116 \newcommand*{\ledsidenote@}[1]{%
18117 \edtext{}{%
18118 \advance\edtext@notes@start by 1%
18119 #1%
18120 }%+
18121 }%
18122 % \end{macrocode}
18123 % \end{macro}
18124 % \end{macro}
18125 % \end{macro}
18126 % \end{macro}
18127 % \end{macro}
18128 % \end{macro}
18129 %
18130 %
18131 % \begin{macro}{\l@dlsnote}
18132 % \begin{macro}{\l@drsnote}
18133 % \begin{macro}{\l@dcsnote}
18134 % \begin{macro}{\l@desnote}
18135 % \begin{macro}{\l@disnote}
18136 % \changes{v1.12.0}{2014/08/05}{\protect\cs{l@dlsnote},\protect\cs{l@drsnote} and \protect\cs{l@dcsnote} defined only one time, in \eledmac, including needs for eledpar case.}.
18137 % The \enquote{footnotes} for left, right, and moveable sidenotes. The whole
18138 % scheme is reminiscent of the critical footnotes code.
18139 % \begin{macrocode}
18140 \newif\ifrightnoteup
18141 \rightnoteuptrue
18142
18143 \newcommand*{\l@dlsnote}[1]{%
18144 \begingroup%
18145 \newcommand{\content}{#1}%
18146 \ifnumberedpar@
18147 \ifledRcol%
18148 \xright@appenditem{\noexpand\vl@dlsnote{\expandonce\content}}%
18149 \to\inserts@listR
18150 \global\advance\insert@countR \@ne%
18151 \else%
18152 \xright@appenditem{\noexpand\vl@dlsnote{\expandonce\content}}%
18153 \to\inserts@list
18154 \global\advance\insert@count \@ne%
18155 \fi
18156 \fi%
18157 \ignorespaces%
18158 \endgroup%
18159 }%
18160
18161 \newcommand*{\l@drsnote}[1]{%
18162 \begingroup%
18163 \newcommand{\content}{#1}%
18164 \ifnumberedpar@
18165 \ifledRcol%
18166 \xright@appenditem{\noexpand\vl@drsnote{\expandonce\content}}%
18167 \to\inserts@listR
18168 \global\advance\insert@countR \@ne%
18169 \else%
18170 \xright@appenditem{\noexpand\vl@drsnote{\expandonce\content}}%
18171 \to\inserts@list
18172 \global\advance\insert@count \@ne%
18173 \fi
18174 \fi\ignorespaces%
18175 \endgroup%
18176 }%
18177
18178 \newcommand*{\l@dcsnote}[1]{%
18179 \begingroup%
18180 \newcommand{\content}{#1}%
18181 \ifnumberedpar@
18182 \ifledRcol%
18183 \xright@appenditem{\noexpand\vl@dcsnote{\expandonce\content}}%
18184 \to\inserts@listR
18185 \global\advance\insert@countR \@ne%
18186 \else%
18187 \xright@appenditem{\noexpand\vl@dcsnote{\expandonce\content}}%
18188 \to\inserts@list
18189 \global\advance\insert@count \@ne%
18190 \fi
18191 \fi\ignorespaces%
18192 \endgroup%
18193 }%
18194
18195 \newcommand*{\l@disnote}[1]{%
18196 \begingroup%
18197 \newcommand{\content}{#1}%
18198 \ifnumberedpar@%
18199 \ifledRcol%
18200 \xright@appenditem{\noexpand\vl@disnote{\expandonce\content}}%
18201 \to\inserts@listR%
18202 \global\advance\insert@countR \@ne%
18203 \else%
18204 \xright@appenditem{\noexpand\vl@disnote{\expandonce\content}}%
18205 \to\inserts@list%
18206 \global\advance\insert@count \@ne%
18207 \fi%
18208 \fi\ignorespaces%
18209 \endgroup%
18210 }%
18211
18212 \newcommand*{\l@dosnote}[1]{%
18213 \begingroup%
18214 \newcommand{\content}{#1}%
18215 \ifnumberedpar@%
18216 \ifledRcol%
18217 \xright@appenditem{\noexpand\vl@dosnote{\expandonce\content}}%
18218 \to\inserts@listR%
18219 \global\advance\insert@countR \@ne%
18220 \else%
18221 \xright@appenditem{\noexpand\vl@dosnote{\expandonce\content}}%
18222 \to\inserts@list%
18223 \global\advance\insert@count \@ne%
18224 \fi%
18225 \fi\ignorespaces%
18226 \endgroup%
18227 }%
18228
18229 % \end{macrocode}
18230 % \end{macro}
18231 % \end{macro}
18232 % \end{macro}
18233 % \end{macro}
18234 % \end{macro}
18235 %
18236 % \begin{macro}{\vl@dlsnote}
18237 % \begin{macro}{\vl@drsnote}
18238 % \begin{macro}{\vl@dcsnote}
18239 % \begin{macro}{\vl@disnote}
18240 % \begin{macro}{\vl@dosnote}
18241 % Put the left/right text into boxes, but just save the moveable text.
18242 % \protect\cs{l@dcsnotetext}, \protect\cs{l@dcsnotetext@l} and \protect\cs{l@dcsnotetext@r} are \protect\package{etoolbox}'s lists which will store the content of sidenotes.
18243 % We store the content in lists, because we need to loop later on them, in case many sidenote co-exist for the same line.
18244 % That is there some special test to do, in order to:
18245 % \begin{itemize}
18246 % \item Store the content of \protect\cs{ledsidenote} to \protect\cs{l@dcsnotetext} in any cases.
18247 % \item Store the content of \protect\cs{rightsidenote} to:
18248 % \begin{itemize}
18249 % \item \protect\cs{l@dcsnotetext} if \protect\cs{ledsidenote} is to be put on right.
18250 % \item \protect\cs{l@dcsnotetext@r} if \protect\cs{ledsidenote} is to be put on left.
18251 % \end{itemize}
18252 % \item Store the content of \protect\cs{leftsidenote} to:
18253 % \begin{itemize}
18254 % \item \protect\cs{l@dcsnotetext} if \protect\cs{ledsidenote} is to be put on left.
18255 % \item \protect\cs{l@dcsnotetext@l} if \protect\cs{ledsidenote} is to be put on right.
18256 % \end{itemize}
18257 % \end{itemize}
18258 % \cs{vl@disnote} and \cs{vl@dosnote} just call \cs{vl@dlsnote} or \cs{vl@drsnote}, depending on the page.
18259 % \begin{macrocode}
18260 \newcommand*{\vl@dlsnote}[1]{%
18261 \ifledRcol@%
18262 \@l@dtempcntb=\sidenote@marginR%
18263 \ifnum\@l@dtempcntb>\@ne%
18264 \advance\@l@dtempcntb by\page@numR%
18265 \fi%
18266 \else%
18267 \@l@dtempcntb=\sidenote@margin%
18268 \ifnum\@l@dtempcntb>\@ne%
18269 \advance\@l@dtempcntb by\page@num%
18270 \fi%
18271 \fi%
18272 \ifodd\@l@dtempcntb%
18273 \listgadd{\l@dcsnotetext@l}{#1}%
18274 \else%
18275 \listgadd{\l@dcsnotetext}{#1}%
18276 \fi
18277 }
18278 \newcommand*{\vl@drsnote}[1]{%
18279 \ifledRcol@%
18280 \@l@dtempcntb=\sidenote@marginR%
18281 \ifnum\@l@dtempcntb>\@ne%
18282 \advance\@l@dtempcntb by\page@numR%
18283 \fi%
18284 \else%
18285 \@l@dtempcntb=\sidenote@margin%
18286 \ifnum\@l@dtempcntb>\@ne%
18287 \advance\@l@dtempcntb by\page@num%
18288 \fi%
18289 \fi%
18290 \ifodd\@l@dtempcntb%
18291 \listgadd{\l@dcsnotetext}{#1}%
18292 \else%
18293 \listgadd{\l@dcsnotetext@r}{#1}%
18294 \fi%
18295 }
18296 \newcommand*{\vl@dcsnote}[1]{\listgadd{\l@dcsnotetext}{#1}}
18297
18298 \newcommand{\vl@disnote}[1]{%
18299 \ifledRcol@%
18300 \@tempcnta=\page@numR%
18301 \else%
18302 \@tempcnta=\page@num%
18303 \fi%
18304 \ifodd\@tempcnta% ODD => right page => inner side = left side
18305 \vl@dlsnote{#1}%
18306 \else%
18307 \vl@drsnote{#1}%
18308 \fi%
18309 }%
18310
18311 \newcommand{\vl@dosnote}[1]{%
18312 \ifledRcol@%
18313 \@tempcnta=\page@numR%
18314 \else%
18315 \@tempcnta=\page@num%
18316 \fi%
18317 \ifodd\@tempcnta% ODD => right page => outer side = right side
18318 \vl@drsnote{#1}%
18319 \else%
18320 \vl@dlsnote{#1}%
18321 \fi%
18322 }%
18323
18324 % \end{macrocode}
18325 % \end{macro}
18326 % \end{macro}
18327 % \end{macro}
18328 % \end{macro}
18329 % \end{macro}
18330 %
18331 %
18332 % \begin{macro}{\setl@dlp@rbox}
18333 % \begin{macro}{\setl@drpr@box}
18334 % \protect\cs{setl@dlprbox}\marg{lednums}\marg{tag}\marg{text} puts \meta{text}
18335 % into the \protect\cs{l@dlp@rbox} box. And similarly for the right side box.
18336 % It is these boxes that finally
18337 % get displayed in the margins.
18338 % \begin{macrocode}
18339 \newcommand*{\setl@dlp@rbox}[1]{%
18340 \begingroup%
18341 \parindent\z@\hsize=\ledlsnotewidth%
18342 \ledlsnotefontsetup%We kept it outside of the vbox, because can affect the ragging
18343 \global\setbox\l@dlp@rbox%
18344 \ifleftnoteup%
18345 =\vbox to\z@{{\ledlsnotefontsetup\vss #1}}%We put \ledlsnotefontsetup inside footnote because required for color command. Note the {} to keep setting local.
18346 \else%
18347 =\vbox to 0.70\baselineskip{{\ledlsnotefontsetup\strut#1\vss}}%
18348 \fi%
18349 \endgroup%
18350 }
18351
18352 \newcommand*{\setl@drp@rbox}[1]{%
18353 \begingroup%
18354 \parindent\z@\hsize=\ledrsnotewidth%
18355 \ledrsnotefontsetup%We kept it outside of the vbox, because can affect the ragging
18356 \global\setbox\l@drp@rbox%
18357 \ifrightnoteup%
18358 =\vbox to\z@{{\ledrsnotefontsetup\vss#1}}%We put \ledrsnotefontsetup inside footnote because required for color command. Note the {} to keep setting local.
18359 \else%
18360 =\vbox to0.7\baselineskip{{\ledrsnotefontsetup\strut#1\vss}}%
18361 \fi%
18362 \endgroup%
18363 }%
18364 \newif\ifleftnoteup
18365 \leftnoteuptrue
18366 % \end{macrocode}
18367 % \end{macro}
18368 % \end{macro}
18369 %
18370 % \begin{macro}{\@sidenotesep}
18371 % This macro is used to separate sidenotes of the same line.
18372 % \begin{macrocode}
18373 \newcommand{\setsidenotesep}[1]{\gdef\@sidenotesep{#1}}
18374 \newcommand{\@sidenotesep}{, }
18375 % \end{macrocode}
18376 % \end{macro}
18377 % \begin{macro}{\affixside@note}
18378 % This macro puts any moveable sidenote text into the left or right sidenote
18379 % box, depending on which margin it is meant to go in. It's a very much
18380 % stripped down version of \protect\cs{affixline@num}.
18381 %
18382 % Before do it, we concatenate all moveable sidenotes of the line, using \protect\cs{@sidenotesep} as separator.
18383 % It is the result that we put on the sidenote.
18384 % \changes{v1.4.1}{2012/11/16}{Remove spurious spaces.}
18385 % \begin{macrocode}
18386 \newcommand*{\affixside@note}{%
18387 \prepare@edindex@fornote{\the\page@num|\the\line@num|\the\subline@num|\the\page@num|\the\line@num|\the\subline@num|}%
18388 \def\sidenotecontent@{}%
18389 \numgdef{\itemcount@}{0}%
18390 \def\do##1{%
18391 \ifnumequal{\itemcount@}{0}%
18392 {%
18393 \appto\sidenotecontent@{##1}}% Not print not separator before the 1st note
18394 {\appto\sidenotecontent@{\@sidenotesep ##1}%
18395 }%
18396 \numgdef{\itemcount@}{\itemcount@+\@ne}%
18397 }%
18398 \dolistloop{\l@dcsnotetext}%
18399 \ifnumgreater{\itemcount@}{1}{\led@err@ManySidenotes}{}%
18400 % \end{macrocode}
18401 % And we do the same for left and right notes (not movable).
18402 % \begin{macrocode}
18403 \gdef\@templ@d{}%
18404 \gdef\@templ@n{\l@dcsnotetext\l@dcsnotetext@l\l@dcsnotetext@r}%
18405 \ifx\@templ@d\@templ@n \else%
18406 \if@twocolumn%
18407 \if@firstcolumn%
18408 \setl@dlp@rbox{##1}{\sidenotecontent@}%
18409 \else%
18410 \setl@drp@rbox{\sidenotecontent@}%
18411 \fi%
18412 \else%
18413 \@l@dtempcntb=\sidenote@margin%
18414 \ifnum\@l@dtempcntb>\@ne%
18415 \advance\@l@dtempcntb by\page@num%
18416 \fi%
18417 \ifodd\@l@dtempcntb%
18418 \setl@drp@rbox{\sidenotecontent@}%
18419 \gdef\sidenotecontent@{}%
18420 \numgdef{\itemcount@}{0}%
18421 \dolistloop{\l@dcsnotetext@l}%
18422 \ifnumgreater{\itemcount@}{1}{\led@err@ManyLeftnotes}{}%
18423 \setl@dlp@rbox{\sidenotecontent@}%
18424 \else%
18425 \setl@dlp@rbox{\sidenotecontent@}%
18426 \gdef\sidenotecontent@{}%
18427 \numgdef{\itemcount@}{0}%
18428 \dolistloop{\l@dcsnotetext@r}%
18429 \ifnumgreater{\itemcount@}{1}{\led@err@ManyRightnotes}{}%
18430 \setl@drp@rbox{\sidenotecontent@}%
18431 \fi%
18432 \fi%
18433 \fi%
18434 \advance\@edindex@fornote@\m@ne%
18435 }
18436 % \end{macrocode}
18437 % \end{macro}%
18438 %
18439 %
18440 %
18441 %
18442 % \section{Minipages and such}
18443 %
18444 % We can put footnotes into minipages. The preparatory code has
18445 % been set up earlier, all that remains is to ensure that it is available
18446 % inside a minipage box. This requires some alteration to the kernel code,
18447 % specifically the \protect\cs{@iiiminipage} and \protect\cs{endminipage} macros.
18448 % We will arrange this so that additional series can be easily added.
18449 %
18450 % \begin{macro}{\l@dfeetbeginmini}
18451 % \begin{macro}{\l@dfeetendmini}
18452 % \changes{v1.9.0}{2014/02/05}{Add \protect\cs{mpfnpos} to choice the order of footnotes in minipage / ledgroup.}
18453 % These will be the hooks in \protect\cs{@iiiminpage} and \protect\cs{endminipage}.
18454 %
18455 % They can be extended to handle other things if necessary.
18456 % \changes{v0.4.0}{2004/02/29}{Added \protect\cs{l@dfeetbeginmini}, \protect\cs{l@dfeetendmini}
18457 % and all their supporting code}
18458 % \begin{macrocode}
18459 \ifnoledgroup@\else%
18460 \newcommand*{\l@dfeetbeginmini}{\@ledgrouptrue\l@dedbeginmini\l@dfambeginmini}
18461 \newcommand*{\l@dfeetendmini}{%
18462 \IfStrEq{critical-familiar}{\@mpfnpos}%
18463 {\l@dedendmini\l@dfamendmini}%
18464 {%
18465 \IfStrEq{familiar-critical}{\@mpfnpos}%
18466 {\l@dfamendmini\l@dedendmini}%
18467 {\do@feet@custom@order{mp@}{\@mpfnpos}}%
18468 }%
18469 }%
18470 % \end{macrocode}
18471 % \end{macro}
18472 % \end{macro}
18473 %
18474 % \begin{macro}{\l@dedbeginmini}
18475 % \begin{macro}{\l@dedendmini}
18476 % \begin{macro}{\mp@append@Xnotes}
18477 % These handle the initiation and closure of critical footnotes in a
18478 % minipage environment.
18479 % \begin{macrocode}
18480 \newcommand*{\l@dedbeginmini}{%
18481 \unless\ifnocritical@%
18482 \def\do##1{%
18483 \csletcs{v##1footnote}{mpv##1footnote}%
18484 }%
18485 \dolistloop{\@series}%
18486 \fi%
18487 }
18488 \newcommand*{\l@dedendmini}{%
18489 \unless\ifnocritical@%
18490 \ifl@dpairing%
18491 \ifledRcol%
18492 \flush@notesR%
18493 \else%
18494 \flush@notes%
18495 \fi%
18496 \fi
18497 \def\do##1{%
18498 \mp@append@Xnotes{##1}%
18499 }%
18500 \dolistloop{\@series}%
18501 \fi%
18502 }%
18503 \newcommand{\mp@append@Xnotes}[1]{%
18504 \ifvoid\csuse{mp#1footins}\else%
18505 \ifl@dpairing%
18506 \ifparledgroup%
18507 \ifledRcol%
18508 \dimgdef{\parledgroup@beforenotesR}{\parledgroup@beforenotesR+\skip\@nameuse{mp#1footins}}%
18509 \else%
18510 \dimgdef{\parledgroup@beforenotesL}{\parledgroup@beforenotesL+\skip\@nameuse{mp#1footins}}%
18511 \fi%
18512 \fi%
18513 \fi%
18514 \ifcsstring{series@display#1}{paragraph}{}{%
18515 \setbox\@nameuse{mp#1footins}=\vbox{%
18516 \csuse{Xnotefontsize@#1}%
18517 \ifcsdef{Xhsize\csuse{series@display#1}@#1}{%
18518 \hsize\csuse{Xhsize\csuse{series@display#1}@#1}%
18519 }{}%
18520 \noindent\csuse{Xtxtbeforenotes@#1}%
18521 \unvbox\@nameuse{mp#1footins}%
18522 \@parboxrestore%
18523 }%
18524 }%
18525 \csuse{mp#1footgroup}{#1}%
18526 \fi%
18527 }%
18528 % \end{macrocode}
18529 % \end{macro}
18530 % \end{macro}
18531 % \end{macro}
18532 %
18533 % \begin{macro}{\l@dfambeginmini}
18534 % \begin{macro}{\l@dfamendmini}
18535 % \begin{macro}{\mp@append@notesX}
18536 % These handle the initiation and closure of familiar footnotes in a
18537 % minipage environment.
18538 % \begin{macrocode}
18539 \newcommand*{\l@dfambeginmini}{%
18540 \unless\ifnofamiliar@%
18541 \def\do##1{\csletcs{vfootnote##1}{mpvfootnote##1}}%
18542 \dolistloop{\@series}%
18543 \fi%
18544 }%
18545
18546 \newcommand*{\l@dfamendmini}{%
18547 \unless\ifnofamiliar@%
18548 \def\do##1{%
18549 \mp@append@notesX{##1}%
18550 }%
18551 \dolistloop{\@series}%
18552 \fi%
18553 }%
18554 \newcommand{\mp@append@notesX}[1]{%
18555 \ifvoid\csuse{mpfootins#1}\else%
18556 \ifcsstring{series@displayX#1}{paragraph}{}{%
18557 \setbox\@nameuse{mpfootins#1}=\vbox{%
18558 \csuse{notefontsizeX@#1}%
18559 \ifcsdef{hsize\csuse{series@display#1}X@#1}{%
18560 \hsize\csuse{hsize\csuse{series@display#1}X@#1}%
18561 }{}%
18562 \noindent\csuse{txtbeforenotesX@#1}%
18563 \unvbox\@nameuse{mpfootins#1}%
18564 \@parboxrestore%
18565 }%
18566 }%
18567 \csuse{mpfootgroup#1}{#1}%
18568 \fi%
18569 }%
18570 % \end{macrocode}
18571 % \end{macro}
18572 % \end{macro}
18573 % \end{macro}
18574 %
18575 % \begin{macro}{\@iiiminipage}
18576 % This is our extended form of the kernel \protect\cs{@iiiminipage} defined in
18577 % \file{ltboxes.dtx}.
18578 % \changes{v0.4.0}{2004/02/29}{Modified kernel \protect\cs{@iiiminipage} and
18579 % \protect\cs{endminipage} to cater for critical footnotes}
18580 % \changes{v2.0.0}{2015/07/19}{Patch \protect\cs{@iiiminipage} instead of redefining it.}
18581 % \begin{macrocode}
18582 \patchcmd%
18583 {\@iiiminipage}%
18584 {\let\@footnotetext\@mpfootnotetext}%
18585 {\let\@footnotetext\@mpfootnotetext\l@dfeetbeginmini}%
18586 {}%
18587 {\led@error@fail@patch@@iiiminipage}%
18588 % \end{macrocode}
18589 % \end{macro}
18590 %
18591 % \begin{macro}{\endminipage}
18592 % This is our extended form of the kernel \protect\cs{endminipage} defined in
18593 % \file{ltboxes.dtx}.
18594 % \changes{v2.0.0}{2015/07/19}{Patch \protect\cs{endminipage} instead of redefining it.}
18595 % \begin{macrocode}
18596 \patchcmd%
18597 {\endminipage}%
18598 {\footnoterule}%
18599 {\footnoterule\l@advance@parledgroup@beforenormalnotes}%
18600 {}%
18601 {\led@error@fail@patch@endminipage}
18602
18603 \patchcmd%
18604 {\endminipage}%
18605 {\@minipagefalse}%
18606 {\l@dfeetendmini\@minipagefalse}%
18607 {}%
18608 {\led@error@fail@patch@endminipage}
18609
18610 % \end{macrocode}
18611 % \end{macro}
18612 % \begin{macro}{\l@dunboxmpfoot}%
18613 % \begin{macro}{\l@advance@parledgroup@beforenormalnotes}%
18614 % \changes{v0.7.0}{2005/02/18}{Added \protect\cs{l@dunboxmpfoot} containing
18615 % some common code}
18616 % \changes{v2.0.0}{2015/07/19}{Some conde of \protect\cs{l@dumboxmpfoot} moved to \protect\cs{l@advance@parledegroup@beforenormalnotes}}
18617 % \protect\cs{@ldunboxmpfoot} insert normal footnotes for ledgroup.
18618 % \begin{macrocode}
18619 \newcommand*{\l@dunboxmpfoot}{%
18620 \vskip\skip\@mpfootins
18621 \normalcolor
18622 \footnoterule
18623 \l@advance@parledgroup@beforenormalnotes
18624 \unvbox\@mpfootins%
18625 }
18626 % \end{macrocode}
18627 % When using parallel ledgroup, we need to store the vertical space added before footnote, in order to compensate them between left and right pages.
18628 % \begin{macrocode}
18629 \newcommand{\l@advance@parledgroup@beforenormalnotes}{%
18630 \ifparledgroup
18631 \ifl@dpairing
18632 \ifledRcol
18633 \dimgdef{\parledgroup@beforenotesR}{\parledgroup@beforenotesR+\skip\@mpfootins}
18634 \else
18635 \dimgdef{\parledgroup@beforenotesL}{\parledgroup@beforenotesL+\skip\@mpfootins}
18636 \fi
18637 \fi
18638 \fi
18639 }
18640 % \end{macrocode}
18641 % \end{macro}
18642 % \end{macro}
18643 %
18644 % \begin{environment}{ledgroup}
18645 % This environment puts footnotes at the end, even if that happens to
18646 % be in the middle of a page, or crossing a page boundary. It is a sort
18647 % of unboxed, fixed width minipage.
18648 % \changes{v0.4.0}{2004/02/29}{Added ledgroup environment}
18649 % \begin{macrocode}
18650
18651 \newenvironment{ledgroup}{%
18652 \resetprevpage@num%
18653 \def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c@mpfootnote\z@%
18654 \let\@footnotetext\@mpfootnotetext
18655 \l@dfeetbeginmini%
18656 }{%
18657 \par
18658 \unskip
18659 \ifvoid\@mpfootins\else
18660 \l@dunboxmpfoot
18661 \fi
18662 \l@dfeetendmini%
18663 \@ledgroupfalse%
18664 }
18665
18666
18667 % \end{macrocode}
18668 % \end{environment}
18669 %
18670 % \begin{environment}{ledgroupsized}
18671 % \verb?\begin{ledgroupsized}?\oarg{pos}\marg{width} \\
18672 % This environment puts footnotes at the end, even if that happens to
18673 % be in the middle of a page, or crossing a page boundary. It is a sort
18674 % of unboxed, variable \meta{width} minipage. The optional \meta{pos}
18675 % controls the sideways position of numbered text.
18676 % \changes{v0.4.0}{2004/02/29}{Added ledgroupsized environment}
18677 % \changes{v0.5.1}{2004/04/10}{Only change \protect\cs{hsize} in ledgroupsized
18678 % environment otherwise page number can be in wrong place}
18679 % \begin{macrocode}
18680 \newenvironment{ledgroupsized}[2][l]{%
18681 % \end{macrocode}
18682 % Set the various text measures.
18683 % \begin{macrocode}
18684 \hsize #2\relax
18685 % \end{macrocode}
18686 % Initialize fills for centering.
18687 % \begin{macrocode}
18688 \let\ledllfill\hfil
18689 \let\ledrlfill\hfil
18690 \def\@tempa{#1}\def\@tempb{l}%
18691 % \end{macrocode}
18692 % Left adjusted numbered lines
18693 % \begin{macrocode}
18694 \ifx\@tempa\@tempb
18695 \let\ledllfill\relax
18696 \else
18697 \def\@tempb{r}%
18698 \ifx\@tempa\@tempb
18699 % \end{macrocode}
18700 % Right adjusted numbered lines
18701 % \begin{macrocode}
18702 \let\ledrlfill\relax
18703 \fi
18704 \fi
18705 % \end{macrocode}
18706 % Set up the footnoting.
18707 % \begin{macrocode}
18708 \def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c@mpfootnote\z@
18709 \let\@footnotetext\@mpfootnotetext
18710 \l@dfeetbeginmini%
18711 }{%
18712 \par
18713 \unskip
18714 \ifvoid\@mpfootins\else
18715 \l@dunboxmpfoot
18716 \fi
18717 \l@dfeetendmini%
18718 }
18719
18720 % \end{macrocode}
18721 % \end{environment}
18722 %
18723 % Close the \protect\cs{ifnoledgroup@}\protect\cs{else}.
18724 % \begin{macrocode}
18725 \fi%
18726 % \end{macrocode}
18727 % \begin{macro}{\ifledgroupnotesL@}
18728 % \begin{macro}{\ifledgroupnotesR@}
18729 % These boolean tests check if we are in the notes of a ledgroup.
18730 % If we are, we do not number the lines.
18731 % It could be useful for parallel ledgroup of \parpackage.
18732 %
18733 % \begin{macrocode}
18734 \newif\ifledgroupnotesL@
18735 \newif\ifledgroupnotesR@
18736 % \end{macrocode}
18737 % \end{macro}
18738 % \end{macro}
18739 % \section{Indexing}
18740 % \changes{v1.5.0}{2013/07/11}{Correct indexing when the call is made in critical notes.}
18741 % \changes{v1.8.0}{2014/07/21}{If \protect\package{imakeidx} and \protect\package{hyperref} are loaded, adds hyperref in the index.}
18742 % \changes{v1.8.5}{2014/08/28}{Debug indexing in right column, with eledpar.}
18743 % Here is some code for indexing using page and line numbers.
18744 %
18745 % \subsection{Looking on package order}
18746 % First, ensure that \protect\package{imakeidx} or \protect\package{indextools} is loaded \emph{before} \protect\package{eledmac}.
18747 % \changes{v1.12.0}{2014/08/05}{Ensure that \protect\package{imakeidx} is loaded \emph{before} \protect\package{eledmac}}
18748 % \begin{macrocode}
18749 \AtBeginDocument{%
18750 \unless\ifl@imakeidx%
18751 \@ifpackageloaded{imakeidx}{\led@error@PackageAfterEledmac{imakeidx}}{}%
18752 \fi%
18753 \unless\ifl@indextools%
18754 \@ifpackageloaded{indextools}{\led@error@PackageAfterEledmac{indextools}}{}%
18755 \fi%
18756 \unless\ifl@footmisc%
18757 \@ifpackageloaded{footmisc}{\led@error@PackageAfterEledmac{footmisc}}{}%
18758 \fi%
18759 }
18760 % \end{macrocode}
18761 % \subsection{Auxiliary macros for \cs{edindex}}
18762 % \begin{macro}{\pagelinesep}
18763 % \begin{macro}{\edindexlab}
18764 % \begin{macro}{\c@labidx}
18765 % In order to get a correct line number we have to use the label/ref
18766 % mechanism. These macros are for that.
18767 % \begin{macrocode}
18768 \newcommand{\pagelinesep}{-}
18769 \newcommand{\edindexlab}{$&}
18770 \newcounter{labidx}
18771 \setcounter{labidx}{0}
18772
18773 % \end{macrocode}
18774 % \end{macro}
18775 % \end{macro}
18776 % \end{macro}
18777 %
18778 % \begin{macro}{\doedindexlabel}
18779 % This macro sets an \protect\cs{edlabel}.
18780 % \begin{macrocode}
18781 \newcommand{\doedindexlabel}{%
18782 \stepcounter{labidx}%
18783 \edlabel{\edindexlab\thelabidx}%
18784 }
18785
18786 % \end{macrocode}
18787 % \end{macro}
18788 %
18789 % \begin{macro}{\thepageline}
18790 % This macro makes up the page/line number combo from the label/ref.
18791 % The associated counter is never directly used, but it is required in order to not have any error message with \cs{edgls}.
18792 % \begin{macrocode}
18793 \newcounter{pageline}%
18794 \renewcommand{\thepageline}{%
18795 \thepage%
18796 \pagelinesep%
18797 \xlineref{\edindexlab\thelabidx}%
18798 }
18799 % \end{macrocode}
18800 % \end{macro}
18801 %
18802 % \begin{macro}{\thestartpageline}
18803 % \begin{macro}{\theendpageline}
18804 % These macros make up the page/line start/end number when the \protect\cs{edindex} command is called in critical notes.
18805 % \begin{macrocode}
18806 \newcommand{\thestartpageline}{%
18807 \l@dparsedstartpage%
18808 \pagelinesep%
18809 \l@dparsedstartline%
18810 }
18811 \newcommand{\theendpageline}{%
18812 \l@dparsedendpage%
18813 \pagelinesep%
18814 \l@dparsedendline%
18815 }
18816 % \end{macrocode}
18817 % \end{macro}
18818 % \end{macro}
18819 %
18820 % \subsection{Code specific to \cs{edindex} in critical footnotes}
18821 % \begin{macro}{\@edindex@fornote@}
18822 % This counter is incremented at the beginning of each note (either a footnote or a sidenote), and decremented at the end of each note.
18823 % If its value is greater than 0, that means we are inside a note.
18824 % \begin{macrocode}
18825 \newcount\@edindex@fornote@
18826 % \end{macrocode}
18827 % \end{macro}
18828 % \begin{macro}{\prepare@edindex@fornote}
18829 % This macro is called at the beginning of each critical note.
18830 % It switches some parameters,
18831 % to allow index referring to this note, with reference to page and line number.
18832 % It also defines \protect\cs{@ledinnote@command} which will be printed as an encapsulating command after the \verb+|+.
18833 % \begin{macrocode}
18834 \newcommand{\prepare@edindex@fornote}[1]{%
18835 \l@dp@rsefootspec#1|%
18836 \advance\@edindex@fornote@\@ne%
18837 }
18838 % \end{macrocode}
18839 % \end{macro}
18840 % \begin{macro}{\get@edindex@ledinnote@command}
18841 % The \protect\cs{get@edindex@ledinnote@command} macro defines
18842 % a \protect\cs{@ledinnote@command} command which is added as an attribute (text inserted after \verb+|+) of the next index entry.
18843 %
18844 % Consequently, we write the definition of the location reference attribute in the \verb+.xdy+ file.
18845 % \begin{macrocode}
18846 \newcommand{\get@edindex@ledinnote@command}{%
18847 \ifxindy@%
18848 \gdef\@ledinnote@command{%
18849 ledinnote\thelabidx%
18850 }%
18851 \ifxindyhyperref@%
18852 \immediate\write\eledmac@xindy@out{%
18853 (define-attributes ("ledinnote\thelabidx"))^^J
18854 \space\space(markup-locref^^J
18855 \eledmacmarkuplocrefdepth^^J
18856 :open "\string\ledinnote[\edindexlab\thelabidx]{\@index@command}{\@currentseries}{\@currentnotetype}{"^^J
18857 :close "}"^^J
18858 :attr "ledinnote\thelabidx"^^J
18859 )
18860 }%
18861 \else%
18862 \immediate\write\eledmac@xindy@out{%
18863 (define-attributes ("ledinnote\thelabidx"))^^J
18864 \space\space(markup-locref^^J
18865 \eledmacmarkuplocrefdepth^^J
18866 :open "\string\ledinnote{\@index@command}{\@currentseries}{\@currentnotetype}{"^^J
18867 :close "}"^^J
18868 :attr "ledinnote\thelabidx"^^J
18869 )
18870 }%
18871 \fi%
18872 % \end{macrocode}
18873 % If we do not use \verb+xindy+ option, \protect\cs{@ledinnote@command} will produce
18874 % something like \verb+ledinnote{formattingcommand}+.
18875 % \begin{macrocode}
18876 \else%
18877 \gdef\@ledinnote@command{%
18878 ledinnote[\edindexlab\thelabidx]{\@index@command}{\@currentseries}{\@currentnotetype}%
18879 }%
18880 \fi%
18881 }
18882 % \end{macrocode}
18883 % \end{macro}
18884 % \subsection{Analysis of command in indexed text}
18885 % \begin{macro}{\get@index@command}
18886 % This macro is used to analyze if a text to be indexed has a command after a \verb+|+.
18887 % \changes{v1.8.0}{2014/07/21}{Debug \protect\cs{get@index@command} and compatibility with \protect\package{hyperref} package.}
18888 % \begin{macrocode}
18889 \def\get@index@command#1|#2+{%
18890 \gdef\@index@txt{#1}%
18891 \gdef\@index@command{#2}%
18892 \xdef\@index@parenthesis{}%
18893 \IfBeginWith{\@index@command}{(}{%
18894 \StrGobbleLeft{\@index@command}{1}[\@index@command@]%
18895 \global\let\@index@command\@index@command@%
18896 \xdef\@index@parenthesis{(}%
18897 }{}%
18898 \IfBeginWith{\@index@command}{)}{%
18899 \StrGobbleLeft{\@index@command}{1}[\@index@command@]%
18900 \global\let\@index@command\@index@command@%
18901 \xdef\@index@parenthesis{)}%
18902 }{}%
18903 }
18904 % \end{macrocode}
18905 % \end{macro}
18906 % \subsection{Code for the formatted index}
18907 % \begin{macro}{\ledinnote}
18908 % \changes{v1.22.0}{2015/04/25}{\protect\cs{ledinnote} takes a first optional argument, which is the label for hyperlinks.}
18909 % \begin{macro}{\ledinnotemark}
18910 % \changes{v1.21.0}{2015/04/13}{Add \protect\cs{ledinnotemark}.}
18911 % \changes{v2.33.0}{2020/05/31}{\protect\cs{ledinnotemark} redefinition is deprecated, use \protect\cs{Xinnotemark} and \protect\cs{innotemarkX} instead.}
18912 % These macros are used to specify that an index reference points to a note.
18913 % Arguments of \protect\cs{ledinnote} are:
18914 % \begin{itemize}
18915 % \item \verb+#1+ (optional): the label for the hyperlink;
18916 % \item \verb+#2+: command applied to the number;
18917 % \item \verb+#3+: the note series;
18918 % \item \verb+#4+: the type of note (critical/familiar).
18919 % \item \verb+#5+: the number itself.
18920 % \end{itemize}
18921 % \begin{macrocode}
18922 \newcommandx{\ledinnote}[5][1,usedefault]{%
18923 \IfStrEq{#4}{critical}{%
18924 \def\tmp{Xinnotemark}%
18925 }{%
18926 \def\tmp{innotemarkX}%
18927 }%
18928 \ifboolexpr{%
18929 test{\ifdefequal{\iftrue}{\ifHy@hyperindex}}%
18930 or%
18931 bool {xindyhyperref@}%
18932 }%
18933 {%
18934 \csuse{#2}{\hyperlink{#1}{\csuse{\tmp @#3}{#5}}}%
18935 }%
18936 {%
18937 \csuse{#2}{\csuse{\tmp @#3}{#5}}%
18938 }%
18939 }%
18940 \newcommand{\ledinnotemark}[1]{#1\emph{n}}%
18941 % \end{macrocode}
18942 % \end{macro}
18943 % \end{macro}
18944 % \subsection{Main code}
18945 % \changes{v2.0.0}{2015/07/19}{Suppress indexing command specific to \protect\ltxclass{memoir}.}
18946 % \Eledmac and \ledmac were using the specific indexing tools of the \protect\ltxclass{memoir} in order to allow multiple index.
18947 % However, \eledmac used \protect\package{imakeidx} or \protect\package{indextools} tools when one these two package was loaded.
18948 % This system forced to maintained a double code, which was not very useful.
18949 % Since \reledmac, we use only the \protect\package{imakeidx} or \protect\package{indextools} tools.
18950 %
18951 % The \protect\package{memoir} class provides more flexible indexing than the
18952 % standard classes. We need different code if the \protect\package{memoir}
18953 % class is being used, except if \protect\package{imakeidx} or \protect\package{indextools} is used.
18954 % \begin{macro}{\edindex}
18955 % \changes{v0.4.1}{2003/03/29}{Let eledmac take advantage of memoir's indexing}
18956 % \changes{v1.5.0}{2013/07/11}{Compatibility with \protect\package{imakeidx} package, and possibility to use multiple index with \protect\cs{edindex}.}
18957 % \changes{v1.12.0}{2014/08/05}{Use correctly default index when \protect\package{imakeidx} is loaded.}
18958 % \changes{v1.14.0}{2014/10/27}{Let eledmac take advantage of imakeidx even when memoir class is used}
18959 % \begin{macro}{\@wredindex}
18960 % \begin{macro}{\dummy@edindex}
18961 % Write the index information to the \file{idx} file.
18962 % \begin{macrocode}
18963 \newcommandx{\@wredindex}[2][1=\expandonce\jobname,usedefault]{%#1 = the index name, #2 = the text
18964 \begingroup%
18965 \let\emph\@firstofone%
18966 \let\textbf\@firstofone%
18967 \let\textit\@firstofone%
18968 \let\textmd\@firstofone%
18969 \let\textnormal\@firstofone%
18970 \let\textrm\@firstofone%
18971 \let\textsc\@firstofone%
18972 \let\textsf\@firstofone%
18973 \let\textsl\@firstofone%
18974 \let\texttt\@firstofone%
18975 \let\textup\@firstofone%
18976 \xdef\@tmp{#2}%To be used in IfSubStr instead of #2 directly. Avoid some expansion bugs (for example with \edindex{textsc{something}})
18977 \endgroup%
18978 \ifl@imakeidx%
18979 \ifnum\@edindex@fornote@>\z@%
18980 \IfSubStr[1]{\@tmp}{|}{\get@index@command#2+}{\get@index@command#2|+}%
18981 \get@edindex@ledinnote@command%
18982 \expandafter\imki@wrindexentry{#1}{\@index@txt|(\@ledinnote@command}{\thestartpageline}%
18983 \expandafter\imki@wrindexentry{#1}{\@index@txt|)\@ledinnote@command}{\theendpageline}%
18984 \else%
18985 \get@edindex@hyperref{#2}%
18986 \imki@wrindexentry{#1}{\@index@txt\@edindex@hyperref}{\thepageline}%
18987 \fi%
18988 \else%
18989 \ifnum\@edindex@fornote@>\z@%
18990 \IfSubStr[1]{\@tmp}{|}{\get@index@command#2+}{\get@index@command#2|+}%
18991 \get@edindex@ledinnote@command%
18992 \expandafter\protected@write\@indexfile{}%
18993 {\string\indexentry{\@index@txt|(\@ledinnote@command}{\thestartpageline}
18994 }%
18995 \expandafter\protected@write\@indexfile{}%
18996 {\string\indexentry{\@index@txt|)\@ledinnote@command}{\theendpageline}
18997 }%
18998 \else%
18999 \protected@write\@indexfile{}%
19000 {\string\indexentry{#2}{\thepageline}
19001 }%
19002 \fi%
19003 \fi%
19004 \endgroup
19005 \@esphack%
19006 }
19007 % \end{macrocode}
19008 % Need to add the definition of \protect\cs{edindex} to \protect\cs{makeindex}, and initialise
19009 % \protect\cs{edindex} to do nothing.
19010 % \begin{macrocode}
19011 \pretocmd{\makeindex}{%
19012 \def\edindex{%
19013 \ifboolexpr{bool{numbering} or bool{numberingR} or bool{l@dprintingpages} or bool{l@dprintingcolumns}}{%
19014 \@bsphack%
19015 \doedindexlabel%
19016 \begingroup%
19017 \@sanitize%
19018 \@wredindex%
19019 }%
19020 {%
19021 \led@warn@edinde@outsidenumbering%
19022 \index%
19023 }%
19024 }%
19025 }%
19026 {}%
19027 {\led@error@fail@patch@makeindex}%
19028 \newcommand{\edindex}[1]{\@bsphack\@esphack}
19029 \newcommandx{\dummy@edindex}[2][1=\expandonce\jobname,usedefault]{}%
19030 \newcommand{\disable@edindex}{\let\old@edindex\edindex\let\edindex\dummy@edindex}%
19031 \newcommand{\restore@edindex}{\let\edindex\old@edindex}%
19032 % \end{macrocode}
19033 % \end{macro}
19034 % \end{macro}
19035 % \end{macro}
19036 % \subsection{Hyperlink}
19037 % \begin{macro}{\hyperlinkformat}
19038 % \protect\cs{hyperlinkformat} command is to be used to have both a internal hyperlink and a format, when indexing.
19039 % \begin{macrocode}
19040 \newcommand{\hyperlinkformat}[3]{%
19041 \ifstrempty{#1}%
19042 {\hyperlink{#2}{#3}}%
19043 {\csuse{#1}{\hyperlink{#2}{#3}}%
19044 }}
19045 % \end{macrocode}
19046 % \end{macro}
19047 % \begin{macro}{\hyperlinkR}
19048 % \protect\cs{hyperlinkR} command is to be used to create a internal hyperlink and \protect\cs{ledRflag}, when indexing.
19049 % \begin{macrocode}
19050 \newcommand{\hyperlinkR}[2]{%
19051 \hyperlink{#1}{#2\@Rlineflag}%
19052 }%
19053
19054 % \end{macrocode}
19055 % \end{macro}
19056 % \begin{macro}{\hyperlinkformatR}
19057 % \protect\cs{hyperlinkformatR} command is to be used to create a internal hyperlink, a format and a \protect\cs{@Rlineflag}, when indexing.
19058 % \begin{macrocode}
19059 \newcommand{\hyperlinkformatR}[3]{%
19060 \hyperlinkformat{#1}{#2}{#3\@Rlineflag}%
19061 }%
19062
19063 % \end{macrocode}
19064 % \end{macro}
19065 % \begin{macro}{\get@edindex@hyperref}
19066 % \begin{macro}{\@edindex@hyperref}
19067 % \changes{v1.12.5}{2014/08/28}{Debug \protect\cs{edindex} when \protect\package{hyperref} is not loaded}
19068 % \protect\cs{get@edindex@hyperref} is to be used to define the \protect\cs{@edindex@hyperref} macro, which, in index, links to the point where the index was called (with \protect\package{hyperref}.
19069 % \changes{v1.18.0}{2014/08/21}{Fix spurious space with \protect\cs{edindex} when using \protect\package{imakeidx}/\protect\package{indextools} + hyperref.}
19070 % \changes{v1.21.0}{2015/0}{Look at the hyperindex option of hyperref before inserting hyperref}
19071 % \begin{macrocode}
19072 \newcommand{\get@edindex@hyperref}[1]{%
19073 % \end{macrocode}
19074 % We have to disable temporary spaces to work through a \protect\package{xstring} bug (or feature?)
19075 % \begin{macrocode}
19076 \edef\temp@{%
19077 \catcode`\ =9 %space need for catcode
19078 \detokenize{#1}%For active character in unicode
19079 \catcode`\ =10 % space need for catcode
19080 }%
19081 % \end{macrocode}
19082 % Now, we define \protect\cs{@edindex@hyperref} if the \verb+hyperindex+ of \protect\package{hyperref} is enabled.
19083 % \begin{macrocode}
19084 \ifdefequal{\iftrue}{\ifHy@hyperindex}{%
19085 \IfSubStr{\temp@}{|}%
19086 {\get@index@command#1+%
19087 \ifledRcol%
19088 \gdef\@edindex@hyperref{|\@index@parenthesis %space kept
19089 hyperlinkformatR{\@index@command}%
19090 {\edindexlab\thelabidx}}%
19091 \else%
19092 \gdef\@edindex@hyperref{|\@index@parenthesis %space kept
19093 hyperlinkformat{\@index@command}%
19094 {\edindexlab\thelabidx}}%
19095 \fi%
19096 }%
19097 {\get@index@command#1|+%
19098 \ifledRcol%
19099 \gdef\@edindex@hyperref{|hyperlinkR{\edindexlab\thelabidx}}%
19100 \else%
19101 \gdef\@edindex@hyperref{|hyperlink{\edindexlab\thelabidx}}%
19102 \fi%
19103 }%
19104 }%
19105 % \end{macrocode}
19106 % \begin{macrocode}
19107 % If we use both xindy and hyperref, first get the \protect\cs{index@command} command.
19108 % Then define \protect\cs{@edindex@hyperref} in the form \verb+eledmacXXX+
19109 % \begin{macrocode}
19110 {\ifxindyhyperref@%
19111 \IfSubStr{\temp@}{|}%
19112 {\get@index@command#1+}%
19113 {\get@index@command#1|+}%
19114 \gdef\@edindex@hyperref{|eledmac\thelabidx}%
19115 % \end{macrocode}
19116 % If we start a reference range by a opening parenthesis,
19117 % store the \protect\cs{thelabidx} for the current \protect\cs{edindex}, then define \protect\cs{@edindex@hyperref} in the form \verb+|(eledmac\thelabidx+.
19118 % \begin{macrocode}
19119 \IfStrEq{\@index@parenthesis}{(}%
19120 {%
19121 \csxdef{xindyparenthesis@\@index@txt}{\thelabidx}%
19122 \gdef\@edindex@hyperref{|(eledmac\thelabidx}%
19123 }%
19124 {}%
19125 % \end{macrocode}
19126 % This \protect\cs{thelabidx} will be called back at the closing parenthesis, to have the same number in
19127 % \protect\cs{@edindex@hyperref} command that we had at the opening parenthesis.
19128 % \protect\cs{@edindex@hyperref} start by a closing parenthesis, then followed by \verb+eledmacXXX+ where \verb+XXX+ is the \protect\cs{thelabidx} of the opening \protect\cs{edindex}.
19129 % \begin{macrocode}
19130 \IfStrEq{\@index@parenthesis}{)}%
19131 {%
19132 \xdef\@edindex@hyperref{|)eledmac\csuse{xindyparenthesis@\@index@txt}}%
19133 \global\csundef{xindyparenthesis@\@index@txt}%
19134 }%
19135 % \end{macrocode}
19136 % Write in the .xdy file the attributes of the location.
19137 % \begin{macrocode}
19138 {%
19139 \immediate\write\eledmac@xindy@out{%
19140 (define-attributes ("eledmac\thelabidx"))^^J
19141 \space\space(markup-locref^^J
19142 \eledmacmarkuplocrefdepth^^J
19143 :open "\string\hyperlink%
19144 \ifledRcol R\fi%
19145 {\edindexlab\thelabidx}%
19146 {\ifdefempty{\@index@command}%
19147 {}%
19148 {\@backslashchar\@index@command}%
19149 {"^^J
19150 :close "}}"^^J
19151 :attr "eledmac\thelabidx"^^J
19152 )
19153 }%
19154 }%
19155 % \end{macrocode}
19156 % And now, in any other case.
19157 % \begin{macrocode}
19158 \else%
19159 \gdef\@index@txt{#1}%
19160 \gdef\@edindex@hyperref{}%
19161 \fi%
19162 }%
19163 }
19164 % \end{macrocode}
19165 % \end{macro}
19166 % \end{macro}
19167 % \changes{v1.14.0}{2014/10/27}{Delete previous override of \protect\cs{l@d@@wrindexhyp} at the beginning of a document when hyperref is not loaded.}
19168 %
19169 % \subsection{\enquote{innote} and \enquote{notenumber} option of \package{indextols} package}
19170 % \begin{macro}{\led@set@index@fornote}
19171 % The \cs{led@set@index@fornote} is called when a familiar footnote is inserted --- and not when it is read --- and changes the \cs{index} command depending on the option of the \package{indextools} package.
19172 % Its only argument is the note series.
19173 % \begin{macrocode}
19174 \newcommand{\led@set@index@fornote}[1]{%
19175 \ifbool{indtl@innote}%
19176 {\let\index\nindex}%
19177 {}%
19178 \ifbool{indtl@notenumber}%
19179 {%
19180 \renewcommand{\index}[2][\indtl@jobname]{%
19181 \orig@@index[##1]{%
19182 ##2|innotenumber{\this@footnoteX@reading}%
19183 }%
19184 }%
19185 }%
19186 {}%
19187 }%
19188 % \end{macrocode}
19189 % \end{macro}
19190 % \begin{macro}{\led@reinit@index@fornote}
19191 % The \cs{led@reinit@index@fornote} just reset the default value of \cs{index}.
19192 % \begin{macrocode}
19193 \newcommand{\led@reinit@index@fornote}{%
19194 \ifbool{indtl@innote}%
19195 {\let\index\orig@@index}%
19196 {}%
19197 \ifbool{indtl@notenumber}%
19198 {\let\index\orig@@index}%
19199 {}%
19200 }%
19201 % \end{macrocode}
19202 % \end{macro}
19203 % \section{Glossaries}
19204 % Here, we define the \cs{gls}-like commands prefixed by \verb+ed+, only if the package \package{glossaries} is loaded.
19205 % \begin{macrocode}
19206 \AtBeginDocument{%
19207 \@ifpackageloaded{glossaries}{%
19208 \@ifpackageloaded{glossaries-extra}{}{\led@error@require@glossariesextra}%
19209 \newif\ifl@noexpands@edgl%A boolean switched to true in \no@expands
19210 % \end{macrocode}
19211 % First those which arguments are \oarg{options}\marg{label}\oarg{insert}.
19212 % \begin{macrocode}
19213 \gdef\edglsomo{}%
19214 \listgadd{\edglsomo}{gls}%
19215 \listgadd{\edglsomo}{Gls}%
19216 \listgadd{\edglsomo}{GLS}%
19217 \listgadd{\edglsomo}{glspl}%
19218 \listgadd{\edglsomo}{Glspl}%
19219 \listgadd{\edglsomo}{GLSpl}%
19220 \listgadd{\edglsomo}{glstext}%
19221 \listgadd{\edglsomo}{Glstext}%
19222 \listgadd{\edglsomo}{GLStext}%
19223 \listgadd{\edglsomo}{Glsfirst}%
19224 \listgadd{\edglsomo}{GLSfirst}%
19225 \listgadd{\edglsomo}{glsplural}%
19226 \listgadd{\edglsomo}{Glsplural}%
19227 \listgadd{\edglsomo}{GLSplural}%
19228 \listgadd{\edglsomo}{glsfirstplural}%
19229 \listgadd{\edglsomo}{Glsfirstplural}%
19230 \listgadd{\edglsomo}{GLSfirstplural}%
19231 \listgadd{\edglsomo}{glsname}%
19232 \listgadd{\edglsomo}{Glsname}%
19233 \listgadd{\edglsomo}{GLSname}%
19234 \listgadd{\edglsomo}{glssymbol}%
19235 \listgadd{\edglsomo}{Glssymbol}%
19236 \listgadd{\edglsomo}{GLSsymbol}%
19237 \listgadd{\edglsomo}{glsdesc}%
19238 \listgadd{\edglsomo}{Glsdesc}%
19239 \listgadd{\edglsomo}{GLSdesc}%
19240 \listgadd{\edglsomo}{glsuseri}%
19241 \listgadd{\edglsomo}{Glsuseri}%
19242 \listgadd{\edglsomo}{GLSuseri}%
19243 \listgadd{\edglsomo}{glsuserii}%
19244 \listgadd{\edglsomo}{Glsuserii}%
19245 \listgadd{\edglsomo}{GLSuserii}%
19246 \listgadd{\edglsomo}{glsuseriii}%
19247 \listgadd{\edglsomo}{Glsuseriii}%
19248 \listgadd{\edglsomo}{GLSuseriii}%
19249 \listgadd{\edglsomo}{glsuseriv}%
19250 \listgadd{\edglsomo}{Glsuseriv}%
19251 \listgadd{\edglsomo}{GLSuseriv}%
19252 \listgadd{\edglsomo}{glsuserv}%
19253 \listgadd{\edglsomo}{Glsuserv}%
19254 \listgadd{\edglsomo}{GLSuserv}%
19255 \listgadd{\edglsomo}{glsuservi}%
19256 \listgadd{\edglsomo}{Glsuservi}%
19257 \listgadd{\edglsomo}{GLSuservi}%
19258 \renewcommand{\do}[1]{%
19259 \expandafter\DeclareRobustCommandx\csname ed#1\endcsname[3][1,3,usedefault]{%
19260 \doedindexlabel%
19261 \ifl@noexpands@edgl%
19262 \csname#1\endcsname[counter=pageline,noindex,##1]{##2}[##3]%
19263 \else%
19264 \ifdef{\hypertarget}{%
19265 \Hy@raisedlink@left{\hypertarget{pageline.\thepageline}{}}%
19266 }{}%
19267 \csname#1\endcsname[counter=pageline,##1]{##2}[##3]%
19268 \fi%
19269 }%
19270 \expandafter\WithSuffix\expandafter\DeclareRobustCommandx\csname ed#1\endcsname*[3][1,3,usedefault]{%
19271 \doedindexlabel%
19272 \ifl@noexpands@edgl%
19273 \csname#1\endcsname*[counter=pageline,noindex,##1]{##2}[##3]%
19274 \else%
19275 \csname#1\endcsname*[counter=pageline,##1]{##2}[##3]%
19276 \ifdef{\hypertarget}{%
19277 \Hy@raisedlink@left{\hypertarget{pageline.\thepageline}{}}%
19278 }{}%
19279 \fi%
19280 }%
19281 }%
19282 \dolistloop{\edglsomo}%
19283 % \end{macrocode}
19284 % Then those which arguments are \oarg{options}\marg{label}\marg{link text}.
19285 % \begin{macrocode}
19286 \gdef\edglsomm{}%
19287 \listgadd\edglsomm{glsdisp}%
19288 \listgadd\edglsomm{glslink}%
19289 \renewcommand{\do}[1]{%
19290 \expandafter\DeclareRobustCommandx\csname ed#1\endcsname[3][1,usedefault]{%
19291 \doedindexlabel%
19292 \ifl@noexpands@edgl%
19293 \csname#1\endcsname[counter=pageline,noindex,##1]{##2}{##3}%
19294 \else%
19295 \ifdef{\hypertarget}{%
19296 \Hy@raisedlink@left{\hypertarget{pageline.\thepageline}{}}%
19297 }{}%
19298 \csname#1\endcsname[counter=pageline,##1]{##2}{##3}%
19299 \fi%
19300 }%
19301 \expandafter\WithSuffix\expandafter\DeclareRobustCommandx\csname ed#1\endcsname*[3][1,usedefault]{%
19302 \doedindexlabel%
19303 \ifl@noexpands@edgl%
19304 \csname#1\endcsname*[counter=pageline,noindex,##1]{##2}{##3}%
19305 \else%
19306 \ifdef{\hypertarget}{%
19307 \Hy@raisedlink@left{\hypertarget{pageline.\thepageline}{}}%
19308 }{}%
19309 \csname#1\endcsname*[counter=pageline,##1]{##2}{##3}%
19310 \fi%
19311 }%
19312 }%
19313 \dolistloop{\edglsomm}%
19314 % \end{macrocode}
19315 % Then those which arguments are \oarg{options}\marg{label}.
19316 % \begin{macrocode}
19317 \gdef\edglsom{}%
19318 \listgadd\edglsom{glsadd}%
19319 \renewcommand{\do}[1]{%
19320 \expandafter\DeclareRobustCommandx\csname ed#1\endcsname[2][1,usedefault]{%
19321 \doedindexlabel%
19322 \ifl@noexpands@edgl%
19323 \csname#1\endcsname[counter=pageline,noindex,##1]{##2}%
19324 \else%
19325 \ifdef{\hypertarget}{%
19326 \Hy@raisedlink@left{\hypertarget{pageline.\thepageline}{}}%
19327 }{}%
19328 \csname#1\endcsname[counter=pageline,##1]{##2}%
19329 \fi%
19330 }%
19331 \expandafter\WithSuffix\expandafter\DeclareRobustCommandx\csname ed#1\endcsname*[2][1,usedefault]{%
19332 \doedindexlabel%
19333 \ifl@noexpands@edgl%
19334 \csname#1\endcsname*[counter=pageline,noindex,##1]{##2}%
19335 \else%
19336 \ifdef{\hypertarget}{%
19337 \Hy@raisedlink@left{\hypertarget{pageline.\thepageline}{}}%
19338 }{}%
19339 \csname#1\endcsname*[counter=pageline,##1]{##2}%
19340 \fi%
19341 }%
19342 }%
19343 \dolistloop{\edglsom}%
19344 % \end{macrocode}
19345 % \cs{l@noexpands@edgl} is a macro to switch \cs{ifl@noexpands@edgl} to true in \cs{no@expands}.
19346 % Its definition is made dynamically.
19347 % \begin{macro}{\l@noexpands@edgl}
19348 % \begin{macrocode}
19349 \def\l@noexpands@edgl{\l@noexpands@edgltrue}%
19350 }{\let\l@noexpands@edgl\relax}%
19351 }%
19352 % \end{macrocode}
19353 % \end{macro}
19354 % \section{Verse}
19355 %
19356 % The original code is principally Wayne Sullivan's\index{Sullivan, Wayne}
19357 % code from \edstanza.
19358 % However, the code has been many time modified by Maïeul Rouquette in order to obtain new features and improved compatibility with \parpackage.
19359 %
19360 % \subsection{Hanging symbol management}
19361 %
19362 % \begin{macro}{\@hangingsymbol}
19363 % \begin{macro}{\sethangingsymbol}
19364 % \begin{macro}{\ifinstanza}
19365 % The macro \protect\cs{@hangingsymbol} is used to insert a symbol on each hanging of verses. It is set by user level macro \protect\cs{sethangingsymbol}.
19366 %
19367 % For example, in French typography, the symbol is \enquote{[}. We obtain it by means of the following code:
19368 %\begin{verbatim}
19369 %\sethangingsymbol{[\,}
19370 %\end{verbatim}
19371 % The \protect\cs{ifinstanza} boolean is used to ensure that we are in a stanza part.
19372 % \begin{macrocode}
19373 \def\@hangingsymbol{}
19374 \newcommand*{\sethangingsymbol}[1]{%
19375 \gdef\@hangingsymbol{#1}%
19376 }%
19377 \newif\ifinstanza
19378 % \end{macrocode}
19379 % \end{macro}
19380 % \end{macro}
19381 % \end{macro}
19382 % \begin{macro}{\inserthangingymbol}
19383 % \begin{macro}{\ifinserthangingsymbol}
19384 % The boolean \protect\cs{ifinserthangingsymbol} is set to TRUE when \protect\cs{@lock} is greater than 1, i.e. when we are not in the first line of a verse. The switch of \protect\cs{ifinserthangingsymbol} is made in \protect\cs{do@line} before the printing of line but after the line number calculation.
19385 %\changes{v0.15.0}{2012/06/11}{New management of hangingsymbol insertion, preventing undesirable insertions.}
19386 %\changes{v0.17.0}{2012/08/03}{New new management of hangingsymbol insertion, preventing undesirable insertions.}
19387 % \changes{v1.6.1}{2013/10/27}{Hang verse is now not automatically flush right.}
19388 % \begin{macrocode}
19389 \newif\ifinserthangingsymbol
19390 \newcommand{\inserthangingsymbol}{%
19391 \ifinserthangingsymbol%
19392 \ifinstanza%
19393 \@hangingsymbol%
19394 \fi%
19395 \fi%
19396 }
19397 % \end{macrocode}
19398 % \end{macro}
19399 % \end{macro}
19400 % \subsection{Using \& character}
19401 % \begin{macro}{\ampersand}
19402 % Within a stanza the \verb?\&? macro is going to be usurped.
19403 % We need an
19404 % alias in case an \& needs to be typeset in a stanza. Define it rather
19405 % than letting it in case some other package has already defined it.
19406 % \begin{macrocode}
19407 \newcommand*{\ampersand}{\char`\&}
19408
19409 % \end{macrocode}
19410 % \end{macro}
19411 %
19412 % \subsection{Code category setting}
19413 % \begin{macro}{\stanza@count}
19414 % \begin{macro}{\stanzaindentbase}
19415 % Before we can define the main macros we need to save and reset
19416 % some category codes. To save the current values we use
19417 % \protect\cs{next} and \protect\cs{body} from the \protect\cs{loop} macro.
19418 % \begin{macrocode}
19419 \chardef\body=\catcode`\@
19420 \catcode`\@=11
19421 \chardef\next=\catcode`\&
19422 \catcode`\&=\active
19423
19424 % \end{macrocode}
19425 % \subsection{Stanza count and indent}
19426 % A count register is allocated for counting lines in a stanza; also allocated
19427 % is a dimension register which is used to specify the base value for
19428 % line indentation; all stanza indentations are multiples of this
19429 % value. The default value of \protect\cs{stanzaindentbase} is 20pt.
19430 % \begin{macrocode}
19431 \newcount\stanza@count
19432 \newlength{\stanzaindentbase}
19433 \setlength{\stanzaindentbase}{20pt}
19434
19435 % \end{macrocode}
19436 % \end{macro}
19437 % \end{macro}
19438 %
19439 % \begin{macro}{\strip@szacnt}
19440 % \begin{macro}{\setstanzavalues}
19441 % The indentations of stanza lines are non-negative integer multiples of the
19442 % unit called
19443 % \protect\cs{stanzaindentbase}. To make it easier for the user to specify these
19444 % numbers, some list macros are defined. These take numerical values
19445 % in a list separated by commas and assign the values to special control
19446 % sequences using \protect\cs{mathchardef}. Though this does limit the range
19447 % from 0 to 32767, it should suffice for most applications,
19448 % including \emph{penalties}, which will be discussed below.
19449 % \begin{macrocode}
19450 \def\strip@szacnt#1,#2|{\def\@tempb{#1}\def\@tempa{#2|}}
19451 \newcommand*{\setstanzavalues}[2]{\def\@tempa{#2,,|}%
19452 \stanza@count\z@
19453 \def\next{\expandafter\strip@szacnt\@tempa
19454 \ifx\@tempb\empty\let\next\relax\else
19455 \expandafter\mathchardef\csname #1@\number\stanza@count
19456 @\endcsname\@tempb\relax
19457 \advance\stanza@count\@ne\fi\next}%
19458 \next}
19459
19460 % \end{macrocode}
19461 % \end{macro}
19462 % \end{macro}
19463 % \begin{macro}{\setstanzaindents}
19464 % \begin{macro}{\setstanzapenalties}
19465 % In the original \edmac, \protect\cs{setstanzavalues}\verb+{sza}+\marg{...} had to be called to
19466 % set the indents, and similarly \protect\cs{setstanzavalues}\verb+{szp}+\marg{...}.
19467 % to set the penalties.
19468 % \protect\cs{setstanzaindents} and \protect\cs{setstanzapenalties} macros are a convenience to give
19469 % the user one less thing to worry about (misspelling the first argument).
19470 %
19471 % \begin{macrocode}
19472 \newcommand*{\setstanzaindents}[1]{\setstanzavalues{sza}{#1}}
19473 \newcommand*{\setstanzapenalties}[1]{\setstanzavalues{szp}{#1}}
19474 %
19475 % \end{macrocode}
19476 % \end{macro}
19477 % \end{macro}
19478 % \begin{macro}{\managestanza@modulo}
19479 % Since the \verb+stanzaindentsrepetition+ counter can be used when the indentation is repeated every $n$ verses.
19480 %
19481 % The \verb+startstanzaindentsrepetition+ counter tells in which line of verse the repetition of indent starts.
19482 %
19483 % The \protect\cs{managestanza@modulo} macro modifies the counter stanza@modulo. The command adds 1 to stanza@modulo, but if stanza@modulo is equal to the stanzaindentsrepetition counter, the command restarts it.
19484 %\changes{v0.13.0}{2011/11/08}{New stanzaindentsrepetition counter to repeat stanza indents every \emph{n} verses.}
19485 % % \changes{v1.5.1}{2013/08/16}{Correct stanzaindentsrepetition counter}
19486 % \begin{macrocode}
19487 \newcounter{stanzaindentsrepetition}
19488 \newcounter{startstanzaindentsrepetition}%
19489 \setcounter{startstanzaindentsrepetition}{1}%
19490 \newcount\stanza@modulo
19491
19492 \newcommand*{\managestanza@modulo}[0]{%
19493 \advance\stanza@modulo\@ne%
19494 \ifnum\stanza@modulo>\value{stanzaindentsrepetition}%
19495 \stanza@modulo\@ne%
19496 \fi%
19497 }
19498 % \end{macrocode}
19499 % \end{macro}
19500 % \begin{macro}{\stanzaindent}
19501 % \begin{macro}{\stanzaindent*}
19502 % The macro \protect\cs{stanzaindent}, when called at the beginning of a verse, changes the indentation normally defined for this verse by \protect\cs{setstanzaindent}.
19503 % The starred version skips the current verse for the repetition of stanza indent.
19504 % \begin{macrocode}
19505 \newcommand{\stanzaindent}[1]{%
19506 \hspace{\dimexpr#1\stanzaindentbase-\parindent\relax}%
19507 \ignorespaces%
19508 }%
19509 \WithSuffix\newcommand\stanzaindent*[1]{%
19510 \stanzaindent{#1}%
19511 \global\advance\stanza@modulo-\@ne%
19512 \ifnum\stanza@modulo=0%
19513 \global\stanza@modulo=\value{stanzaindentsrepetition}%
19514 \fi%
19515 \ignorespaces%
19516 }%
19517 % \end{macrocode}
19518 % \end{macro}
19519 % \end{macro}
19520 % \subsection{Numbering stanza}
19521 % Here, macro for numbering stanza.
19522 % First, the stanza counter.
19523 % \begin{macro}{\thestanza}
19524 % \begin{macrocode}
19525 \newcounter{stanza}
19526 \renewcommand{\thestanza}{%
19527 \textbf{\arabic{stanza}}%
19528 }
19529 % \end{macrocode}
19530 % \end{macro}
19531 % \begin{macro}{\ifnumberstanza}
19532 % Then, macro to activate automatically numbering of stanza.
19533 % \begin{macrocode}
19534 \newif\ifnumberstanza%
19535 % \end{macrocode}
19536 % \end{macro}
19537 % \begin{macro}{\@insertstanzanumber}
19538 % Now, macro called at the first line of of verse of a stanza.
19539 % \begin{macrocode}
19540 \newcommand{\@insertstanzanumber}[0]{%
19541 \ifnumberstanza%
19542 \ifl@dpairing%
19543 \ifledRcol%
19544 \stanzanumwrapper{\thestanzaR}%
19545 \else%
19546 \stanzanumwrapper{\thestanzaL}%
19547 \fi%
19548 \else%
19549 \stanzanumwrapper{\thestanza}%
19550 \fi%
19551 \setline{1}%
19552 \fi%
19553 }%
19554 % \end{macrocode}
19555 % \end{macro}
19556 % \begin{macro}{\@advancestanzanumber}
19557 % Also a command to advance the counter of stanza.
19558 % \begin{macrocode}
19559 \newcommand{\@advancestanzanumber}[0]{%
19560 \ifnumberstanza%
19561 \ifl@dpairing%
19562 \ifledRcol%
19563 \addtocounter{stanzaR}{1}%
19564 \else%
19565 \addtocounter{stanzaL}{1}%
19566 \fi%
19567 \else%
19568 \addtocounter{stanza}{1}%
19569 \fi%
19570 \fi%
19571 }%
19572 % \end{macrocode}
19573 % \end{macro}
19574 % \begin{macro}{\stanzanumwrapper}
19575 % And finally, the wrapper for stanza number
19576 % \begin{macrocode}
19577 \newcommand{\stanzanumwrapper}[1]{%
19578 \flagstanza{#1}%
19579 }%
19580 % \end{macrocode}
19581 % \end{macro}
19582 % \subsection{Stanza number in note}
19583 % Here, the command called when printing stanza number in notes.
19584 % \begin{macrocode}
19585 \newcommand{\printstanza}[0]{%
19586 \ifboolexpr{bool{l@dpairing} or bool{l@dprintingpages} or bool{l@dprintingcolumns}}{%
19587 \ifledRcol@%
19588 \thestanzaR%
19589 \else%
19590 \thestanzaL%
19591 \fi%
19592 }{%
19593 \thestanza%
19594 }%
19595 }
19596 % \end{macrocode}
19597 % \subsection{Main work}
19598 % \begin{macro}{\stanza@line}
19599 % \begin{macro}{\stanza@hang}
19600 % \begin{macro}{\stanza@indent}
19601 % \begin{macro}{\sza@penalty}
19602 % Now we arrive at the main works. \protect\cs{stanza@line} sets the
19603 % indentation for the line and starts a numbered paragraph---each
19604 % line is treated as a paragraph. \protect\cs{stanza@hang} sets the
19605 % hanging indentation to be used if the stanza line requires
19606 % more than one print line.
19607
19608 %If it is known that each stanza line
19609 % will fit on one print line, it is advisable to set the
19610 % hanging indentation to zero. \protect\cs{sza@penalty} places the
19611 % specified penalty following each stanza line.
19612 % By default, this
19613 % facility is turned off so that no penalty is included. However,
19614 % the user may initiate these penalties to indicate good and bad
19615 % places in the stanza for page breaking.
19616 % \begin{macrocode}
19617 \newcommandx{\stanza@line}[2][1,2,usedefault]{%
19618 \stanza@indent%
19619 \pstart[#1][#2]\stanza@hang\ignorespaces%
19620 }%
19621 \newcommand{\stanza@indent}{%
19622 \ifboolexpr{%
19623 test {\ifnumequal{\value{stanzaindentsrepetition}}{0}}%
19624 or%
19625 test {\ifnumless{\number\stanza@count}{\value{startstanzaindentsrepetition}}}%
19626 }{%
19627 \ifcsdef{sza@\number\stanza@count @}%
19628 {%
19629 \parindent=\csname sza@\number\stanza@count @\endcsname\stanzaindentbase%
19630 }{%
19631 \led@err@StanzaIndentNotDefined%
19632 }%
19633 }{%
19634 \ifcsdef{sza@\number\stanza@modulo @}{%
19635 \parindent=\csname sza@%
19636 \the\numexpr%
19637 \stanza@modulo%
19638 - 1%
19639 + \value{startstanzaindentsrepetition}%
19640 \relax%
19641 @\endcsname\stanzaindentbase%
19642 \managestanza@modulo%
19643 }%
19644 {%
19645 \led@err@StanzaIndentNotDefined%
19646 }%
19647 }%
19648 }%
19649
19650 \def\stanza@hang{%
19651 \leavevmode\stanzastartlock%
19652 \hangindent\if@RTL-\fi\expandafter%
19653 \csname sza@0@\endcsname\stanzaindentbase%
19654 \hangafter\@ne%
19655 }%
19656
19657 \def\sza@penalty{\count@\csname szp@\number\stanza@count @\endcsname
19658 \ifnum\count@>\@M\advance\count@-\@M\penalty-\else
19659 \penalty\fi\count@}
19660 % \end{macrocode}
19661 % \end{macro}
19662 % \end{macro}
19663 % \end{macro}
19664 % \end{macro}
19665 %
19666 % \begin{macro}{\@startstanza}
19667 % \begin{macro}{\stanza}
19668 % \changes{v1.12.0}{2014/08/05}{Add \protect\cs{newverse} macro, \protect\cs{falseverse} deprecated.}
19669 % \changes{v1.12.0}{2014/08/05}{\protect\cs{Stanza} can have an optional argument: content to be printed before.}
19670 % \changes{v1.12.0}{2014/08/05}{\ampersand can have an optional argument: content to be printed after.}
19671 % \changes{v1.20.0}{2015/03/22}{\ampersand\ and \textbackslash\ampersand\ can be preceded by spaces.}
19672 % \begin{macro}{\@stopstanza}
19673 % \begin{macro}{\AtEveryStopStanza}
19674 % \begin{macro}{\AtEveryStanza}
19675 % \begin{macro}{\AtStartEveryStanza}
19676 % \begin{macro}{\BeforeEveryStopStanza}
19677 % \begin{macro}{\newverse}
19678 % \changes{v1.6.0}{2013/10/09}{Add \protect\cs{falseverse} macro.}
19679 % Now we have the components of the \protect\cs{stanza} macro,
19680 % which appears at the start of a group of lines. This macro
19681 % initializes the count and checks to see if hanging indentation
19682 % and penalties are to be included. Hanging indentation suspends
19683 % the line count, so that the enumeration is by verse line
19684 % rather than by print line. If the print line count is desired,
19685 % invoke \protect\cs{let}\protect\cs{startlock}\protect\cs{relax} and do the same for
19686 % \protect\cs{endlock}. Here and above we have used \protect\cs{xdef} to
19687 % make the stored macros take up a bit less space, but it also
19688 % makes them more obscure to the reader. Lines of the stanza are
19689 % delimited by ampersands \&.
19690 % The last line of the stanza must
19691 % end with \verb+\&+.
19692 %
19693 %
19694 %
19695 % \begin{macrocode}
19696 \xdef\@startstanza[#1][#2]{%
19697 \noexpand\instanzatrue\expandafter
19698 \begingroup%
19699 \catcode`\noexpand\&\active%
19700 \global\stanza@count\@ne\stanza@modulo\@ne
19701 \noexpand\ifnum\expandafter\noexpand\csname sza@0@\endcsname=\z@%
19702 \def\noexpand\stanza@hang{\unexpanded{\leavevmode\null}}%
19703 \let\noexpand\endlock\relax%
19704 \noexpand\else%
19705 \interlinepenalty\@M%
19706 \unexpanded{%
19707 \ifboolexpr{bool {@RTL} and bool{xetex}}{%
19708 \leftskip\z@ plus 1fil\relax%
19709 }{%
19710 \rightskip\z@ plus 1fil\relax%
19711 }%
19712 }%
19713 \noexpand\fi%
19714 \noexpand\ifnum\expandafter\noexpand\csname szp@0@\endcsname=\z@%
19715 \let\noexpand\sza@penalty%
19716 \relax\noexpand\fi%
19717 \def\noexpand&{%
19718 \noexpand\newverse[][]}%
19719 \def\noexpand\&{\noexpand\@stopstanza}%
19720 \noexpand\@advancestanzanumber%
19721 \noexpand\stanza@line[#1][#2]%
19722 \noexpand\@insertstanzanumber%
19723 \let\par\relax\ignorespaces%No paragraph in verses
19724 }
19725
19726 \newcommandx{\stanza}[2][1,2,usedefault]{%
19727 \ifboolexpr{%
19728 not test{\ifdefvoid{\at@every@stanza}}%
19729 and test{\ifstrempty{#1}}%
19730 and test{\ifstrempty{#2}}}%
19731 {\@startstanza[][\at@every@stanza]\at@start@every@stanza}%
19732 {\@startstanza[#1][#2]\at@start@every@stanza}%
19733 }%
19734
19735 \newcommandx{\@stopstanza}[2][1,2,usedefault]{%
19736 \unskip%
19737 \stanzaendlock%
19738 \ifboolexpr{%
19739 not test{\ifdefvoid{\at@every@stop@stanza}}%
19740 and test{\ifstrempty{#1}}%
19741 and test{\ifstrempty{#2}}}%
19742 {\before@every@stop@stanza\pend[][\at@every@stop@stanza]}%
19743 {\before@every@stop@stanza\pend[#1][#2]}%
19744 \endgroup%
19745 \instanzafalse%
19746 }
19747
19748 \newcommand{\AtEveryStopStanza}[1]{%
19749 \ifstrempty{#1}%
19750 {\gdef\at@every@stop@stanza{}}%
19751 {\gdef\at@every@stop@stanza{\noindent#1}}%
19752 }%
19753 \WithSuffix\newcommand\AtEveryStopStanza*[1]{%
19754 \ifstrempty{#1}%
19755 {\gdef\at@every@stop@stanza{}}%
19756 {\gdef\at@every@stop@stanza{#1}}%
19757 }%
19758 \def\at@every@stop@stanza{}%
19759
19760 \newcommand{\AtEveryStanza}[1]{%
19761 \ifstrempty{#1}%
19762 {\gdef\at@every@stanza{}}%
19763 {\gdef\at@every@stanza{\noindent#1}}%
19764 }%
19765 \WithSuffix\newcommand\AtEveryStanza*[1]{%
19766 \ifstrempty{#1}%
19767 {\gdef\at@every@stanza{}}%
19768 {\gdef\at@every@stanza{#1}}%
19769 }%
19770
19771
19772
19773 \newcommand{\AtStartEveryStanza}[1]{%
19774 \ifstrempty{#1}%
19775 {\gdef\at@start@every@stanza{}}%
19776 {\gdef\at@start@every@stanza{#1}}%
19777 }%
19778 \def\at@start@every@stanza{}%
19779
19780 \newcommand{\BeforeEveryStopStanza}[1]{%
19781 \ifstrempty{#1}%
19782 {\gdef\before@every@stop@stanza{}}%
19783 {\gdef\before@every@stop@stanza{#1}}%
19784 }%
19785 \def\before@every@stop@stanza{}%
19786
19787 \newcommandx*{\newverse}[4][1,2,3,4,usedefault]{%
19788 \unskip%
19789 \stanzaendlock\pend[#1][#3]\sza@penalty\global%
19790 \advance\stanza@count\@ne\stanza@line[#2][#4]%
19791 }
19792
19793 % \end{macrocode}
19794 % \end{macro}
19795 % \end{macro}
19796 % \end{macro}
19797 % \end{macro}
19798 % \end{macro}
19799 % \end{macro}
19800 % \end{macro}
19801 % \end{macro}
19802 % \begin{macro}{\flagstanza}
19803 % Use \verb?\flagstanza[len]{text}? at the start of a line to put \texttt{text}
19804 % a distance \texttt{len} before the start of the line. The default for
19805 % \texttt{len} is \verb?\stanzaindentbase?.
19806 % \begin{macrocode}
19807 \newcommand*{\flagstanza}[2][\stanzaindentbase]{%
19808 \hskip -#1\llap{#2}\hskip #1\ignorespaces}
19809
19810 % \end{macrocode}
19811 % \end{macro}
19812 %
19813 % In order to avoid increasing line number when a line of verse is typeset on two typographical line, we use \protect\cs{startlock} and \protect\cs{endlock} inserted automatically at the begin / end (respectivly) of a verse. But when using \XeTeX\ to typeset RTL text, the result are not good in the auxiliary numbered file\footnote{It is a \enquote{bug} of \XeTeX\ model of RTL, see\url{https://tex.stackexchange.com/questions/333365/bidi-rtl-and-write}.}, we must inverse in some case.
19814 % That is why we use auxiliary macros, in order to fix this issue.
19815 % The mechanism used is similar to \protect\cs{flag@start@RTL} and \protect\cs{flag@end@RTL}, described on §~\ref{flag:start:RTL} (p.~\pageref{flag:start:RTL}).
19816 % \begin{macro}{\stanzastartlock}
19817 % \begin{macro}{\stanzaendlock}
19818 % \begin{macro}{\stanza@startlock@RTL}
19819 % \begin{macro}{\stanza@endlock@RTL}
19820 % \begin{macrocode}
19821 \newcommand{\stanzastartlock}{%
19822 \ifboolexpr{%
19823 bool{xetex}%
19824 and bool {@RTL}%
19825 }{%
19826 \stanza@startlock@RTL% RTL with xetex : first endlock for auxiliary file
19827 }%
19828 {%
19829 \startlock%
19830 }%
19831 }%
19832 \newcommand{\stanzaendlock}{%
19833 \ifboolexpr{%
19834 bool{xetex}%
19835 and bool {@RTL}%
19836 }{%
19837 \stanza@endlock@RTL% RTL with xetex : finally starlock for auxiliary file
19838 }%
19839 {%
19840 \endlock%
19841 }%
19842 }%
19843 \newcount\stanza@lock@RTL@count%
19844 \newcommand{\stanza@startlock@RTL}{%
19845 \global\advance\stanza@lock@RTL@count\@ne%
19846 \edlabel{stanza@startlock@\the\stanza@lock@RTL@count}%
19847 \ifnumequal{\xabslineref{stanza@startlock@\the\stanza@lock@RTL@count}}{0}%
19848 {}%
19849 {%
19850 \ifnumequal{\xabslineref{stanza@startlock@\the\stanza@lock@RTL@count}}{\xabslineref{stanza@endlock@\the\stanza@lock@RTL@count}}%
19851 {\endlock}% If in same typographical line, we start by \endlock, in order to write \end@lock in last position in the numbered auxiliary file
19852 {\startlock}%
19853 }%
19854 }%
19855 \newcommand{\stanza@endlock@RTL}{%
19856 \edlabel{stanza@endlock@\the\stanza@lock@RTL@count}%
19857 \ifnumequal{\xabslineref{stanza@startlock@\the\stanza@lock@RTL@count}}{0}%
19858 {}%
19859 {%
19860 \ifnumequal{\xabslineref{stanza@startlock@\the\stanza@lock@RTL@count}}{\xabslineref{stanza@endlock@\the\stanza@lock@RTL@count}}%
19861 {\startlock}% If in same typographical line, we finish by \startlock, in order to write \start@lock in first position in the numbered auxiliary file
19862 {\endlock}%
19863 }%
19864 }%
19865 % \end{macrocode}
19866 % \end{macro}
19867 % \end{macro}
19868 % \end{macro}
19869 % \end{macro}
19870 % \subsection{Restore catcode and penalties}
19871 % The ampersand \& is used to mark the end of each stanza line, except the
19872 % last, which is marked with \verb+\&+. This means that \verb+\halign+ may
19873 % not be used directly within a stanza line. This does not affect macros
19874 % involving alignments defined outside \verb+\stanza \&+. Since these
19875 % macros usurp the control sequence \verb+\&+, the replacement
19876 % \verb+\ampersand+ is defined to be used if this symbol is needed in a
19877 % stanza. Also we reset the modified category codes and initialize the
19878 % penalty default.
19879 % \begin{macrocode}
19880 \catcode`\&=\next
19881 \catcode`\@=\body
19882 \setstanzavalues{szp}{0}
19883
19884 % \end{macrocode}
19885 % \subsection{Dealing with antilabe}
19886 % \begin{macro}{\firsthalf@antilabe@wd}
19887 % \begin{macro}{\get@firsthalf@antilabe@wd}
19888 % \begin{macro}{\antilabe}
19889 % If the \option{antilabe} option is enabled, after having vboxded
19890 % the content of \cs{pstart}\ldots{pend} structure, we get
19891 % the width of the last line of the \cs{pend}.
19892 % \begin{macrocode}
19893 \ifantilabe@%
19894 \newdimen\firsthalf@antilabe@wd%
19895 \newcommand\get@firsthalf@antilabe@wd{%
19896 \ifboolexpr{bool {instanza} or bool {inastanzaL} or bool {inastanzaR}}{%
19897 \vbadness=10000%
19898 \splittopskip=\z@%
19899 \ifl@dpairing%
19900 \ifledRcol%
19901 \setbox0=\copy\csname l@dRcolrawbox\the\l@dnumpstartsR\endcsname%
19902 \else%
19903 \setbox0=\copy\csname l@dLcolrawbox\the\l@dnumpstartsL\endcsname%
19904 \fi%
19905 \else%
19906 \setbox0=\copy\raw@text%
19907 \fi%
19908 \dimen0=\dimexpr\ht0+\dp0-\baselineskip\relax%
19909 \ifdim\dimen0>0pt%
19910 \setbox1=\vsplit0 to \dimen0%
19911 \fi%
19912 \setbox0=\vbox{\unvbox0\global\setbox1=\lastbox}%
19913 \setbox1=\hbox{\noindent\unhbox1}%
19914 \global\firsthalf@antilabe@wd=\wd1%
19915 }{}%
19916 }%
19917 \def\beforeantilabe{}%
19918 \def\afterantilabe{}%
19919 \newcommand{\antilabe}[1]{%
19920 \beforeantilabe\hbox to\firsthalf@antilabe@wd{#1\hfill}\afterantilabe%
19921 }%
19922 \else%
19923 \let\get@firsthalf@antilabe@wd\relax%
19924 \fi%
19925 % \end{macrocode}
19926 % \end{macro}
19927 % \end{macro}
19928 % \end{macro}
19929 %
19930 % \section{Apparatus of Manuscripts}
19931 % \subsection{User level macro}
19932 % \begin{macro}{\msdata}
19933 % \begin{macro}{\msdata@c}
19934 % \begin{macro}{\msdata@cR}
19935 % The user level \cs{msdata} command only writes the manuscripts data in a numbered auxiliary file. There are two associated etoolbox counters.
19936 % \begin{macrocode}
19937 \def\msdata@c{}%
19938 \def\msdata@cR{}%
19939 \newcommand{\msdata}[1]{%
19940 \leavevmode%
19941 \unless\ifstopmsdata@inserted@%
19942 \stopmsdata%
19943 \led@warning@msdatawithoutstop%
19944 \fi%
19945 \global\stopmsdata@inserted@false%
19946 \unless\ifledRcol%
19947 \numgdef{\msdata@c}{\msdata@c+1}%
19948 \ifdef{\hypertarget}{%
19949 \edlabel{\msdata@c:start:msdata}%
19950 }{}%
19951 \protected@write\linenum@out{}{%
19952 \string\@msd{#1}%
19953 }%
19954 \else%
19955 \numgdef{\msdata@cR}{\msdata@cR+1}%
19956 \ifdef{\hypertarget}{%
19957 \edlabel{\msdata@cR:start:msdata}%
19958 }{}%
19959 \protected@write\linenum@outR{}{%
19960 \string\@msd{#1}%
19961 }%
19962 \fi%
19963 }%
19964 % \end{macrocode}
19965 % \end{macro}
19966 % \end{macro}
19967 % \end{macro}
19968 % \begin{macro}{\stopmsdata}
19969 % The user level \cs{stopmsdata} command only writes information about the end of manuscripts data in numbered auxiliary file.
19970 % \begin{macrocode}
19971 \newcommand{\stopmsdata}[0]{%
19972 \leavevmode%
19973 \unless\ifledRcol%
19974 \protected@write\linenum@out{}{%
19975 \string\@stopmsd%
19976 }%
19977 \ifdef{\hypertarget}{%
19978 \edlabel{\msdata@c:end:msdata}%
19979 }{}%
19980 \else%
19981 \protected@write\linenum@outR{}{%
19982 \string\@stopmsd%
19983 }%
19984 \ifdef{\hypertarget}{%
19985 \edlabel{\msdata@cR:end:msdata}%
19986 }{}%
19987 \fi%
19988 \global\stopmsdata@inserted@true%
19989 }%
19990 % \end{macrocode}
19991 % \end{macro}
19992 % \begin{macro}{\ifstopmsdata@inserted@}
19993 % The \cs{ifstopmsdata@inserted@} boolean is set to TRUE at every \cs{stopmsdata} and reset to FALSE at all \cs{msdata}. It also set to TRUE at every \cs{beginnumbering}.
19994 % It is used to automatically insert \cs{stopmsdata} if forgotten before \cs{msdata}
19995 % \begin{macrocode}
19996 \newif\ifstopmsdata@inserted@%
19997 % \end{macrocode}
19998 % \end{macro}
19999 % \subsection{Setting macro}
20000 % Setting macros for the manuscripts apparatus tools is very easy: they just save their argument in an internal macro.
20001 % \begin{macro}{\setmsdataseries}
20002 % In which series of notes will be printed the apparatus of manuscripts?
20003 % \begin{macrocode}
20004 \newcommand{\setmsdataseries}[1]{%
20005 \gdef\@msdata@series{#1}%
20006 }%
20007 \def\@msdata@series{A}%
20008 % \end{macrocode}
20009 % \end{macro}
20010 % \begin{macro}{\setmsdataposition}
20011 % The label for the manuscripts data.
20012 % \begin{macrocode}
20013 \def\ms@data@position{msdata-regular}%
20014 \newcommand{\setmsdataposition}[1]{%
20015 \gdef\ms@data@position{#1}%
20016 }%
20017 % \end{macrocode}
20018 % \end{macro}
20019 % \begin{macro}{\setmsdatalabel}
20020 % The label for the manuscripts data.
20021 % \begin{macrocode}
20022 \def\ms@data@label{Ms.}%
20023 \newcommand{\setmsdatalabel}[1]{%
20024 \gdef\ms@data@label{#1}%
20025 }%
20026 % \end{macrocode}
20027 % \end{macro}
20028 % \subsection{Counters and lists}
20029 % \begin{macro}{\@msd@c}
20030 % \cs{@msd@c} is a counter incremented at each \cs{@msd} read in auxiliary file.
20031 % \begin{macrocode}
20032 \numdef{\@msd@c}{0}
20033 \numdef{\@msd@cR}{0}
20034 % \end{macrocode}
20035 % \end{macro}
20036 % \begin{macro}{\add@msd@}
20037 % \cs{add@msd@} is a counter incremented at each \cs{add@msddata}, that is at each time we prepare the insertion of manuscripts data footnote.
20038 % \begin{macrocode}
20039 \numdef{\add@msd@c}{0}%
20040 \numdef{\add@msd@cR}{0}%
20041 % \end{macrocode}
20042 % \end{macro}
20043 % \begin{macro}{\@msdata@list}
20044 % The \cs{@msdata@list} will contain, for each line, the lists of command to be executed to insert the manuscripts apparatus.
20045 % It will be filled on \cs{add@msdata} and looped on \cs{insert@msdata}, then emptied.
20046 % \begin{macrocode}
20047 \def\@msdata@list{}%
20048 % \end{macrocode}
20049 % \end{macro}
20050 % \subsection{Auxiliary file macros}
20051 % \begin{macro}{\@msd}
20052 % The \cs{@msd} macro is written in the auxiliary file.
20053 % It just defines three macros by \cs{msdata} macro, which allow us to know the manuscripts data, the line number and the absolute line number where it was called
20054 %
20055 % It also stores the action code $1010$ in the list of actions by line.
20056 % \begin{macrocode}
20057 \newcommand{\@msd}[1]{%
20058 \unless\ifledRcol%
20059 \global\numdef{\@msd@c}{\@msd@c+\@ne}%
20060 \csgdef{@msdata@\@msd@c @data}{#1}%
20061 \csxdef{@msdata@\@msd@c @linenumber}{\the\line@num}%
20062 \csxdef{@msdata@\@msd@c @sublinenumber}{\the\subline@num}%
20063 \csxdef{@msdata@\@msd@c @abslinenumber}{\the\absline@num}%
20064 \xright@appenditem{\the\absline@num}\to\actionlines@list%
20065 \xright@appenditem{-1010}\to\actions@list%
20066 \else%
20067 \global\numdef{\@msd@cR}{\@msd@cR+\@ne}%
20068 \csgdef{@msdata@\@msd@cR @dataR}{#1}%
20069 \csxdef{@msdata@\@msd@cR @linenumberR}{\the\line@numR}%
20070 \csxdef{@msdata@\@msd@cR @sublinenumberR}{\the\subline@numR}%
20071 \csxdef{@msdata@\@msd@cR @abslinenumberR}{\the\absline@numR}%
20072 \xright@appenditem{\the\absline@numR}\to\actionlines@listR%
20073 \xright@appenditem{-1010}\to\actions@listR%
20074 \fi%
20075 }%
20076 % \end{macrocode}
20077 % \end{macro}
20078 % \begin{macro}{\@stopmsd}
20079 % Inserted in the auxiliary file by \cs{stopmsd}, the \cs{@stopmsd} macro will store in two commands the line number and the absolute line number on which it is called.
20080 % \begin{macrocode}
20081 \newcommand{\@stopmsd}[0]{%
20082 \unless\ifledRcol%
20083 \ifcsundef{@msdata@\@msd@c @stoplinenumber}{%
20084 \csxdef{@msdata@\@msd@c @stopabslinenumber}{\the\absline@num}%
20085 \csxdef{@msdata@\@msd@c @stoplinenumber}{\the\line@num}%
20086 \csxdef{@msdata@\@msd@c @stopsublinenumber}{\the\subline@num}%
20087 }{}%
20088 \else%
20089 \ifcsundef{@msdata@\@msd@cR @stoplinenumberR}{%
20090 \csxdef{@msdata@\@msd@cR @stopabslinenumberR}{\the\absline@numR}%
20091 \csxdef{@msdata@\@msd@cR @stoplinenumberR}{\the\line@numR}%
20092 \csxdef{@msdata@\@msd@cR @stopsublinenumberR}{\the\subline@numR}%
20093 }%
20094 {}%
20095 \fi%
20096 }%
20097 % \end{macrocode}
20098 % \end{macro}
20099 % \subsection{Action macro}
20100 % \begin{macro}{\add@msdata}
20101 % \cs{add@msdata} is executed on each line when action code $1010$ is seen.
20102 % It will not insert immediately the manuscript data footnote, as action code are executed before the line be typeset, and, consequently, could be on the previous page.
20103 % So it just stores the manuscript data footnote to \cs{@msdata@list}.
20104 % \begin{macrocode}
20105 \newcommand{\add@msdata}{%
20106 \bgroup%
20107 \normalfont%
20108 \unless\ifledRcol@%
20109 \numgdef{\add@msd@c}{\add@msd@c+\@ne}%
20110 \ifcsdef{@msdata@\add@msd@c @data}{%
20111 \letcs{\@data}{@msdata@\add@msd@c @data}%
20112 \edef\l@d@nums{%
20113 000|% Start page = we don't print it
20114 \csuse{@msdata@\add@msd@c @linenumber}|% Start line number
20115 \csuse{@msdata@\add@msd@c @sublinenumber}|% Start subline number
20116 000|% End page number, we don't print it
20117 \ifnumless{\csuse{@msdata@\add@msd@c @stopabslinenumber}}{\csuse{@lastabsline@forpage@\the\page@num}}%
20118 {\csuse{@msdata@\add@msd@c @stoplinenumber}}%End line number if in the same page
20119 {\csuse{@lastline@forpage@\the\page@num}}%Otherwise, last number of the page
20120 |%
20121 \ifnumless{\csuse{@msdata@\add@msd@c @stopabslinenumber}}{\csuse{@lastabsline@forpage@\the\page@num}}%
20122 {\csuse{@msdata@\add@msd@c @stopsublinenumber}}%End subline number if in the same page
20123 {\csuse{@lastsubline@forpage@\the\page@num}}%Otherwise, last subnumber of the page
20124 |%
20125 \edfont@info%Font
20126 }%
20127 \@msd@options@fullpagefalse%
20128 \if@firstlineofpage%Try if the data are for the full page. If yes, will add options to the list.
20129 \unless\if@msdata@insertedfrompreviouspage%
20130 \ifnumless{\csuse{@lastabsline@forpage@\the\page@num}}{\csuse{@msdata@\add@msd@c @stopabslinenumber}+\@ne}%
20131 {%
20132 \numdef{\@tmp}{\add@msd@c+\@ne}%
20133 \ifcsdef{@msdata@\@tmp @abslinenumber}%
20134 {\ifnumequal{\csuse{@msdata@\@tmp @abslinenumber}}{\csuse{@lastabsline@forpage@\the\page@num}}%
20135 {}%
20136 {\@msd@options@fullpagetrue}%
20137 }%
20138 {\@msd@options@fullpagetrue}%
20139 }%
20140 {}%
20141 \fi%
20142 \fi%
20143 \listxadd{\@msdata@list}{%
20144 \@msd@options@iffullpage%
20145 \ifluatex%
20146 \xdef\footnote@luatextextdir{\the\textdir}%
20147 \xdef\footnote@luatexpardir{\the\pardir}%
20148 \fi%
20149 \csdef{@this@crossref@start}{\add@msd@c:start:msdata}%
20150 \csdef{@this@crossref@end}{\add@msd@c:end:msdata}%
20151 \unexpanded{%
20152 \def\annot@start{}%
20153 \def\annot@end{}%
20154 }%
20155 \noexpand\csuse{v\@msdata@series footnote}{\@msdata@series}{{\expandonce\l@d@nums}{\ms@data@label}{\expandonce\@data}}%
20156 \reset@msd@options@iffullpage%
20157 }%
20158 }%
20159 {}%
20160 \else%
20161 \numgdef{\add@msd@cR}{\add@msd@cR+\@ne}%
20162 \ifcsdef{@msdata@\add@msd@cR @dataR}{%
20163 \letcs{\@data}{@msdata@\add@msd@cR @dataR}%
20164 \edef\l@d@nums{%
20165 000|% Start page = we don't print it
20166 \csuse{@msdata@\add@msd@cR @linenumberR}|% Start line number
20167 \csuse{@msdata@\add@msd@cR @sublinenumberR}|% Start subline number, for now, not used
20168 000|% End page number, we don't print it
20169 \ifnumless{\csuse{@msdata@\add@msd@cR @stopabslinenumberR}}{\csuse{@lastline@forpageR@\the\page@numR}}%
20170 {\csuse{@msdata@\add@msd@cR @stoplinenumberR}}%End line number if in the same page
20171 {\csuse{@lastline@forpageR@\the\page@numR}}%Otherwise, last number of the page
20172 |%
20173 \ifnumless{\csuse{@msdata@\add@msd@cR @stopabslinenumberR}}{\csuse{@lastline@forpageR@\the\page@numR}}%
20174 {\csuse{@msdata@\add@msd@cR @stopsublinenumberR}}%End subline number if in the same page
20175 {\csuse{@lastsubline@forpageR@\the\page@numR}}%Otherwise, last number of the page
20176 000|% End sub line number, for now, not used
20177 \edfont@info%Font
20178 }%
20179 \@msd@options@fullpagefalse%
20180 \if@firstlineofpageR%
20181 \unless\if@msdata@insertedfrompreviouspage%
20182 \ifnumless{\csuse{@lastabsline@forpageR@\the\page@numR}}{\csuse{@msdata@\add@msd@c @stopabslinenumberR}+\@ne}%
20183 {%
20184 \numdef{\@tmp}{\add@msd@cR+\@ne}%
20185 \ifcsdef{@msdata@\@tmp @abslinenumberR}%
20186 {\ifnumequal{\csuse{@msdata@\@tmp @abslinenumberR}}{\csuse{@lastabsline@forpageR@\the\page@numR}}%
20187 {}%
20188 {\@msd@options@fullpagetrue}%
20189 }%
20190 {\@msd@options@fullpagetrue}%
20191 }%
20192 {}%
20193 \fi%
20194 \fi%
20195 \listxadd{\@msdata@list}{%
20196 \@msd@options@iffullpage%
20197 \ifluatex%
20198 \csxdef{footnote@luatextextdir}{\the\textdir}%
20199 \csxdef{footnote@luatexpardir}{\the\pardir}%
20200 \fi%
20201 \csdef{@this@crossref@start}{\add@msd@cR:start:msdata}%
20202 \csdef{@this@crossref@end}{\add@msd@cR:end:msdata}%
20203 \unexpanded{%
20204 \def\annot@start{}%
20205 \def\annot@end{}%
20206 }%
20207 \noexpand\csuse{v\@msdata@series footnote}{\@msdata@series}{{\expandonce\l@d@nums}{\ms@data@label}{\expandonce\@data}}%
20208 \reset@msd@options@iffullpage%
20209 }%
20210 }%
20211 {}%
20212 \fi%
20213 \egroup%
20214 }%
20215 % \end{macrocode}
20216 % \end{macro}
20217 %
20218 % \begin{macro}{\if@msdata@insertedfrompreviouspage}
20219 % The \cs{if@msdata@insertedfrompreviouspage} boolean is set to TRUE if \macpackage\ automatically inserts data from previous page in the first line of a page.
20220 % \begin{macrocode}
20221 \newif\if@msdata@insertedfrompreviouspage%
20222 % \end{macrocode}
20223 % \end{macro}
20224 % \begin{macro}{\add@msdata@firstlineofpage}
20225 % \cs{add@msdata@firstlineofpage} is called at the first line of every page. It inserts manuscript data which start on one of the previous pages and continue on this page.
20226 % \begin{macrocode}
20227 \newcommand{\add@msdata@firstlineofpage}{%
20228 \bgroup%
20229 \normalfont%
20230 \unless\ifledRcol@%
20231 \ifcsdef{@msdata@\add@msd@c @data}{%
20232 \ifnumless{\the\absline@num-\@ne}{\csuse{@msdata@\add@msd@c @stopabslinenumber}}%
20233 {%
20234 \global\@msdata@insertedfrompreviouspagetrue%
20235 \letcs{\@data}{@msdata@\add@msd@c @data}%
20236 \edef\l@d@nums{%
20237 000|% Start page = we don't print it
20238 \numexpr\the\line@num+\@ne\relax|% Start line number = first line of the page. As \add@msdata@firstlineofpage is called before line number has been incremented, we increment it for printing
20239 000|% Start subline number, for now, not used
20240 000|% End page number, we don't print it
20241 \ifnumless{\csuse{@msdata@\add@msd@c @stopabslinenumber}}{\csuse{@lastabsline@forpage@\the\page@num}}%
20242 {\csuse{@msdata@\add@msd@c @stoplinenumber}}%End line number if in the same page
20243 {\csuse{@lastline@forpage@\the\page@num}}%Otherwise, last number of the page
20244 |%
20245 000|% End sub line number, for now, not used
20246 \edfont@info%Font
20247 }%
20248 \@msd@options@fullpagefalse%
20249 \ifnumless{\csuse{@lastabsline@forpage@\the\page@num}}{\csuse{@msdata@\add@msd@c @stopabslinenumber}+\@ne}%We will test if the ms data is for the full page
20250 {%
20251 \numdef{\@tmp}{\add@msd@c+\@ne}%
20252 \ifcsdef{@msdata@\@tmp @abslinenumber}%
20253 {\ifnumequal{\csuse{@msdata@\@tmp @abslinenumber}}{\csuse{@lastabsline@forpage@\the\page@num}}%
20254 {}%
20255 {\@msd@options@fullpagetrue}%
20256 }%
20257 {\@msd@options@fullpagetrue}%
20258 }%
20259 {}%
20260 \listxadd{\@msdata@list}{%
20261 \@msd@options@iffullpage%
20262 \ifluatex%
20263 \csxdef{footnote@luatextextdir}{\the\textdir}%
20264 \csxdef{footnote@luatexpardir}{\the\pardir}%
20265 \fi%
20266 \csdef{@this@crossref@start}{\add@msd@c:start:msdata}%
20267 \csdef{@this@crossref@end}{\add@msd@c:end:msdata}%
20268 \unexpanded{%
20269 \def\annot@start{}%
20270 \def\annot@end{}%
20271 }%
20272 \noexpand\csuse{v\@msdata@series footnote}{\@msdata@series}{{\expandonce\l@d@nums}{\ms@data@label}{\expandonce\@data}}%
20273 \reset@msd@options@iffullpage%
20274 }%
20275 }%
20276 {\global\@msdata@insertedfrompreviouspagefalse}%
20277 }{}%
20278 \else%
20279 \ifcsdef{@msdata@\add@msd@cR @dataR}{%
20280 \ifnumless{\the\absline@numR-\@ne}{\csuse{@msdata@\add@msd@cR @stopabslinenumberR}}%
20281 {%
20282 \global\@msdata@insertedfrompreviouspagetrue%
20283 \letcs{\@data}{@msdata@\add@msd@cR @dataR}%
20284 \edef\l@d@nums{%
20285 000|% Start page = we don't print it
20286 \numexpr\the\line@numR+\@ne\relax|% Start line number = first line of the page. As \add@msdata@firstlineofpage is called before line number has been incremented, we increment it for printing
20287 000|% Start subline number, for now, not used
20288 000|% End page number, we don't print it
20289 \ifnumless{\csuse{@msdata@\add@msd@cR @stopabslinenumberR}}{\csuse{@lastline@forpageR@\the\page@numR}}%
20290 {\csuse{@msdata@\add@msd@cR @stoplinenumberR}}%End line number if in the same page
20291 {\csuse{@lastline@forpageR@\the\page@numR}}%Otherwise, last number of the page
20292 |%
20293 000|% End sub line number, for now, not used
20294 \edfont@info%Font
20295 }%
20296 \@msd@options@fullpagefalse%
20297 \ifnumless{\csuse{@lastabsline@forpageR@\the\page@numR}}{\csuse{@msdata@\add@msd@cR @stopabslinenumberR}+\@ne}%
20298 {%
20299 \numdef{\@tmp}{\add@msd@cR+\@ne}%
20300 \ifcsdef{@msdata@\@tmp @abslinenumberR}%
20301 {\ifnumequal{\csuse{@msdata@\@tmp @abslinenumberR}}{\csuse{@lastabsline@forpageR@\the\page@numR}}%
20302 {}%
20303 {\@msd@options@fullpagetrue}%
20304 }%
20305 {\@msd@options@fullpagetrue}%
20306 }%
20307 {}%
20308 \listxadd{\@msdata@list}{%
20309 \@msd@options@iffullpage%
20310 \ifluatex%
20311 \csxdef{footnote@luatextextdir}{\the\textdir}%
20312 \csxdef{footnote@luatexpardir}{\the\pardir}%
20313 \fi%
20314 \csdef{@this@crossref@start}{\add@msd@cR:start:msdata}%
20315 \csdef{@this@crossref@end}{\add@msd@cR:end:msdata}%
20316 \unexpanded{%
20317 \def\annot@start{}%
20318 \def\annot@end{}%
20319 }%
20320 \noexpand\csuse{v\@msdata@series footnote}{\@msdata@series}{{\expandonce\l@d@nums}{\ms@data@label}{\expandonce\@data}}%
20321 \reset@msd@options@iffullpage%
20322 }%
20323 }%
20324 {\global\@msdata@insertedfrompreviouspagefalse}%
20325 }{}%
20326 \fi%
20327 \egroup%
20328 }%
20329 % \end{macrocode}
20330 % \end{macro}
20331 % \subsection{Inserting footnote}
20332 % Just before inserting standard insert (familiar and critical footnotes, sidenotes), we call \cs{insert@msdata} to insert manuscripts data's footnotes.
20333 % \begin{macro}{\insert@msdata}
20334 % \begin{macrocode}
20335 \newcommand{\insert@msdata}{%
20336 \def\do##1{##1}%
20337 \dolistloop{\@msdata@list}%
20338 \global\let\@msdata@list\relax%
20339 }%
20340 % \end{macrocode}
20341 % \end{macro}
20342 % \subsection{Other}
20343 % \begin{macro}{\@msd@options@iffullpage}
20344 % \begin{macro}{\reset@msd@options@iffullpage}
20345 % \cs{@msd@options@iffullpage} sets some options if the manuscripts data are for all the page.
20346 % \cs{reset@msd@options@iffullpage} resets them after the footnote.
20347 % \cs{if@msd@options@fullpage} is switch to true in \protect{add@msdata@firstlineofpage} if these option must be inserted.
20348 % \begin{macrocode}
20349 \newif\if@msd@options@fullpage%
20350 \newcommand{\@msd@options@iffullpage}[0]{%
20351 \if@msd@options@fullpage%
20352 \noexpand\toggletrue{nonum@}%
20353 \ifdefvoid{\ms@data@label}%
20354 {\noexpand\toggletrue{nosep@}}%
20355 {}%
20356 \fi%
20357 }%
20358 \newcommand{\reset@msd@options@iffullpage}[0]{%
20359 \noexpand\togglefalse{nonum@}%
20360 \noexpand\togglefalse{nosep@}%
20361 }%
20362 % \end{macrocode}
20363 % \end{macro}
20364 % \end{macro}
20365 % \section{Arrays and tables}
20366 % \subsection{Preamble: macro as environment}
20367 %
20368 %
20369 % The following is borrowed, and renamed, from the \protect\package{amsmath}
20370 % package. See also the CTT thread \enquote{eeq and amstex}, 1995/08/31, started
20371 % by Keith Reckdahl and ended definitively by David M. Jones.
20372 %
20373 %
20374 % Several of the [math] macros scan their body twice. This means we must
20375 % collect all text in the body of an environment form before calling
20376 % the macro.
20377 %
20378 % \begin{macro}{\@emptytoks}
20379 % This is actually defined in the \protect\package{amsgen} package.
20380 % \begin{macrocode}
20381 \newtoks\@emptytoks
20382
20383 % \end{macrocode}
20384 % \end{macro}
20385 %
20386 % The rest is from \protect\package{amsmath}.
20387 %
20388 % \begin{macro}{\l@denvbody}
20389 % A token register to contain the body.
20390 % \begin{macrocode}
20391 \newtoks\l@denvbody
20392
20393 % \end{macrocode}
20394 % \end{macro}
20395 %
20396 % \begin{macro}{\addtol@denvbody}
20397 % |\addtol@denvdody{arg}| adds |arg| to the token register |\l@denvbody|.
20398 % \begin{macrocode}
20399 \newcommand{\addtol@denvbody}[1]{%
20400 \global\l@denvbody\expandafter{\the\l@denvbody#1}}
20401 % \end{macrocode}
20402 % \end{macro}
20403 %
20404 % \begin{macro}{\if@edtabular}
20405 % A boolean set to true inside a \macpackage' tabular environnment.
20406 % \begin{macrocode}
20407 \newif\if@edtabular%
20408 % \end{macrocode}
20409 % \end{macro}
20410 %
20411 % \begin{macro}{\l@dcollect@body}
20412 % The macro \protect\cs{l@dcollect@body} starts the scan for the \protect\cs{end}\marg{env} command
20413 % of the current environment. It takes a macro name as argument. This macro
20414 % is supposed to take the whole body of the environment as its argument.
20415 % For example, given |cenv#1{...}| as a macro that processes |#1|, then
20416 % the environment form, |\begin{env}| would call |\l@dcollect@body\cenv|.
20417 %
20418 % \begin{macrocode}
20419 \newcommand{\l@dcollect@body}[1]{%
20420 \ifvmode\else%
20421 \\%Ensure that we do not have spurious indentation at the very first line, caused by some text before.
20422 \fi%
20423 \l@denvbody{\expandafter#1\expandafter{\the\l@denvbody}}%
20424 \edef\processl@denvbody{\the\l@denvbody\noexpand\end{\@currenvir}}%
20425 \l@denvbody\@emptytoks \def\l@dbegin@stack{b}%
20426 \begingroup
20427 \@edtabulartrue%
20428 \expandafter\let\csname\@currenvir\endcsname\l@dcollect@@body
20429 \edef\processl@denvbody{\expandafter\noexpand\csname\@currenvir\endcsname}%
20430 \processl@denvbody%
20431 }%
20432
20433 % \end{macrocode}
20434 % \end{macro}
20435 %
20436 % \begin{macro}{\l@dpush@begins}
20437 % When adding a piece of the current environment's contents to \protect\cs{l@denvbody},
20438 % we scan it to check for additional \protect\cs{begin} tokens, and add a \enquote{b} to the
20439 % stack for any that we find.
20440 % \begin{macrocode}
20441 \def\l@dpush@begins#1\begin#2{%
20442 \ifx\end#2\else b\expandafter\l@dpush@begins\fi}
20443
20444 % \end{macrocode}
20445 % \end{macro}
20446 %
20447 % \begin{macro}{\l@dcollect@@body}
20448 % \protect\cs{l@dcollect@@body} takes two arguments: the first will consist of all text
20449 % up to the next |\end| command, and the second will be the \protect\cs{end} command's
20450 % argument. If there are any extra \protect\cs{begin} commands in the body text,
20451 % a marker is pushed onto a stack by the \protect\cs{l@dpush@begins} function.
20452 % Empty state for this stack means we have reached the \protect\cs{end} that matches
20453 % our original \protect\cs{begin}. Otherwise we need to include the \protect\cs{end} and its
20454 % argument in the material we are adding to the environment body accumulator.
20455 % \begin{macrocode}
20456 \def\l@dcollect@@body#1\end#2{%
20457 \edef\l@dbegin@stack{\l@dpush@begins#1\begin\end
20458 \expandafter\@gobble\l@dbegin@stack}%
20459 \ifx\@empty\l@dbegin@stack
20460 \endgroup
20461 \@checkend{#2}%
20462 \addtol@denvbody{#1}%
20463 \else
20464 \addtol@denvbody{#1\end{#2}}%
20465 \fi
20466 \processl@denvbody % A little tricky! Note the grouping
20467 }
20468
20469 % \end{macrocode}
20470 % \end{macro}
20471 %
20472 % There was a question on CTT about how to use \protect\cs{collect@body} for a macro
20473 % taking an argument. The following is part of that thread.
20474 % \begin{verbatim}
20475 % From: Heiko Oberdiek <[email protected]>
20476 % Newsgroups: comp.text.tex
20477 % Subject: Re: Using \collect@body with commands that take >1 argument
20478 % Date: Fri, 08 Aug 2003 09:03:20 +0200
20479 %
20480 % [email protected] (Evan) wrote:
20481 % > I'm trying to make a new Latex environment that acts like the>
20482 % \colorbox command that is part of the color package. I looked through
20483 % > the FAQ and ran across this bit about using the \collect@body command
20484 % > that is part of AMSLaTeX:
20485 % > http://www.tex.ac.uk/cgi-bin/texfaq2html?label=cmdasenv
20486 % >
20487 % > It almost works. If I do something like the following:
20488 % > \newcommand{\redbox}[1]{\colorbox{red}{#1}}
20489 % >
20490 % > \makeatletter
20491 % > \newenvironment{redbox}{\collect@body \redbox}{}
20492 %
20493 % You will get an error message: Command \redbox already defined.
20494 % Thus you must rename either the command \redbox or the environment
20495 % name.
20496 %
20497 % > \begin{coloredbox}{blue}
20498 % > Yadda yadda yadda... this is on a blue background...
20499 % > \end{coloredbox}
20500 % > and can't figure out how to make the \collect@body take this.
20501 %
20502 % > \collect@body \colorbox{red}
20503 % > \collect@body {\colorbox{red}}
20504 %
20505 % The argument of \collect@body has to be one token exactly.
20506 %
20507 % \documentclass{article}
20508 % \usepackage{color}
20509 % \usepackage{amsmath}
20510 %
20511 % \newcommand{\redbox}[1]{\colorbox{red}{#1}}
20512 % \makeatletter
20513 % \newenvironment{coloredbox}[1]{%
20514 % \def\next@{\colorbox{#1}}%
20515 % \collect@body\next@
20516 % }{}
20517 %
20518 % % ignore spaces at begin and end of environment
20519 % \newenvironment{coloredboxII}[1]{%
20520 % \def\next@{\mycoloredbox{#1}}%
20521 % \collect@body\next@
20522 % }{}
20523 % \newcommand{\mycoloredbox}[2]{%
20524 % \colorbox{#1}{\ignorespaces#2\unskip}%
20525 % }
20526 %
20527 % % support of optional color model argument
20528 % \newcommand\coloredboxIII\endcsname{}
20529 % \def\coloredboxIII#1#{%
20530 % \@coloredboxIII{#1}%
20531 % }
20532 % \def\@coloredboxIII#1#2{%
20533 % \def\next@{\mycoloredboxIII{#1}{#2}}%
20534 % \collect@body\next@
20535 % }
20536 % \newcommand{\mycoloredboxIII}[3]{%
20537 % \colorbox#1{#2}{\ignorespaces#3\unskip}%
20538 % }
20539 %
20540 % \makeatother
20541 %
20542 % \begin{document}
20543 % Black text before
20544 % \begin{coloredbox}{blue}
20545 % Hello World
20546 % \end{coloredbox}
20547 % Black text after
20548 %
20549 % Black text before
20550 % \begin{coloredboxII}{blue}
20551 % Hello World
20552 % \end{coloredboxII}
20553 % Black text after
20554 %
20555 % Black text before
20556 % \begin{coloredboxIII}[rgb]{0,0,1}
20557 % Hello World
20558 % \end{coloredboxIII}
20559 % Black text after
20560 %
20561 % \end{document}
20562 %
20563 % Yours sincerely
20564 % Heiko <[email protected]>
20565 % \end{verbatim}
20566 %
20567 %
20568 % \subsection{Tabular environments}
20569 % This is based on the work by Herbert Breger\index{Breger, Herbert}
20570 % in developing \file{tabmac.tex}.
20571 %
20572 % The original \file{tabmac.tex} file was void of comments or any explanatory
20573 % text other than the above notice. The algorithm is Breger's. Peter Wilson have made
20574 % some cosmetic changes to the original code and reimplemented some things
20575 % so they are more LaTeX-like. All the commentary are from Peter Wilson, as are any mistake
20576 % or errors.
20577 %
20578 % However, Maïeul Rouquette has modified code in order to add new features of \eledmac and \reledmac.
20579 % \subsubsection{Disabling and restoring commands}
20580 % \begin{macro}{\l@dtabnoexpands}
20581 % More no expansion for critical and familiar footnotes in tabular environment.
20582 %
20583 % \begin{macrocode}
20584 \newcommand*{\l@dtabnoexpands}{%
20585 \let\rtab=0%
20586 \let\ctab=0%
20587 \let\ltab=0%
20588 \let\rtabtext=0%
20589 \let\ltabtext=0%
20590 \let\ctabtext=0%
20591 \let\edbeforetab=0%
20592 \let\edaftertab=0%
20593 \let\edatleft=0%
20594 \let\edatright=0%
20595 \let\edvertline=0%
20596 \let\edvertdots=0%
20597 \let\edrowfill=0%
20598 }
20599
20600 % \end{macrocode}
20601 % \end{macro}
20602 % \begin{macro}{\disable@familiarnotes}
20603 % \begin{macro}{\restore@familiarnotes}
20604 % Macros to disable and restore familiar notes, to prevent them from printing multiple times in edtabularx and edarrayx environments.
20605 % \begin{macrocode}
20606 \newcommand{\disable@familiarnotes}{%
20607 \unless\ifnofamiliar@%
20608 \def\do##1{%
20609 \csletcs{footnote@@##1}{footnote##1}%
20610 \expandafter\renewcommand \csname footnote##1\endcsname[1]{%
20611 \protected@csxdef{@thefnmark##1}{\csuse{thefootnote##1}}%
20612 \csuse{@footnotemark##1}%
20613 }%
20614 }%
20615 \dolistloop{\@series}%
20616 \fi%
20617 }%
20618 \newcommand{\restore@familiarnotes}{%
20619 \unless\ifnofamiliar@%
20620 \def\do##1{%
20621 \csletcs{footnote##1}{footnote@@##1}%
20622 }%
20623 \dolistloop{\@series}%
20624 \fi%
20625 }%
20626
20627 % \end{macrocode}
20628 % \end{macro}
20629 % \end{macro}
20630 % \begin{macro}{\disable@sidenotes}
20631 % \begin{macro}{\restore@sidenotes}
20632 % The same for sidenotes.
20633 % \begin{macrocode}
20634 \newcommand{\disable@sidenotes}{%
20635 \let\@@ledrightnote\ledrightnote%
20636 \let\@@ledleftnote\ledleftnote%
20637 \let\@@ledsidenote\ledsidenote%
20638 \let\ledrightnote\@gobble%
20639 \let\ledleftnote\@gobble%
20640 \let\ledsidenote\@gobble%
20641 }%
20642 \newcommand{\restore@sidenotes}{%
20643 \let\ledrightnote\@@ledrightnote%
20644 \let\ledleftnote\@@ledleftnote%
20645 \let\ledsidenote\@@ledsidenote%
20646 }%
20647 % \end{macrocode}
20648 % \end{macro}
20649 % \end{macro}
20650 % \begin{macro}{\disable@endnotes}
20651 % \begin{macro}{\restore@endnotes}
20652 % The same for endnotes.
20653 % \begin{macrocode}
20654 \newcommand{\disable@endnotes}{%
20655 \unless\ifnoend@%
20656 \def\do##1{%
20657 \csletcs{##1@@endnote}{##1endnote}%
20658 \expandafter\renewcommand \csname ##1endnote\endcsname[1]{}%
20659 }%
20660 \dolistloop{\@series}%
20661 \fi%
20662 }%
20663 \newcommand{\restore@endnotes}{%
20664 \unless\ifnofamiliar@%
20665 \def\do##1{%
20666 \csletcs{##1endnote}{##1@@endnote}%
20667 }%
20668 \dolistloop{\@series}%
20669 \fi%
20670 }%
20671 % \end{macrocode}
20672 % \end{macro}
20673 % \end{macro}
20674 % \begin{macro}{\disable@notes}
20675 % \begin{macro}{\restore@notes}
20676 % Disable/restore side, familiar and end notes.
20677 % \begin{macrocode}
20678 \newcommand{\disable@notes}{%
20679 \disable@sidenotes%
20680 \disable@familiarnotes%
20681 \disable@endnotes%
20682 }%
20683 \newcommand{\restore@notes}{%
20684 \restore@sidenotes%
20685 \restore@familiarnotes%
20686 \restore@endnotes%
20687 }%
20688 % \end{macrocode}
20689 % \end{macro}
20690 % \end{macro}
20691 % \begin{macro}{\EDTEXT}
20692 % \begin{macro}{\xedtext}
20693 % We need to be able to modify the \protect\cs{edtext} macros
20694 % and also restore their original definitions.
20695 % \begin{macrocode}
20696 \let\EDTEXT=\edtext
20697 \newcommand{\xedtext}[2]{\EDTEXT{#1}{#2}}
20698 % \end{macrocode}
20699 % \end{macro}
20700 % \end{macro}
20701 %
20702 % \begin{macro}{\disable@edlabel}
20703 % \begin{macro}{\restore@edlabel}
20704 % We need to be able to modify and restore the \protect\cs{edlabel} macro.
20705 % \begin{macrocode}
20706 \let\original@edlabel\edlabel%
20707 \newcommand{\disable@edlabel}{%
20708 \let\edlabel\@gobble%
20709 }%
20710 \newcommand{\restore@edlabel}{%
20711 \let\edlabel\original@edlabel%
20712 }%
20713 % \end{macrocode}
20714 % \end{macro}
20715 % \end{macro}
20716 %
20717 % \begin{macro}{\xedindex}
20718 % \begin{macro}{\nulledindex}
20719 % Macros supporting modification and restoration of \protect\cs{edindex}.
20720 % \begin{macrocode}
20721 \AtBeginDocument{\let\xedindex\edindex}%
20722 \newcommand{\nulledindex}[2][\jobname]{\@bsphack\@esphack}
20723
20724 % \end{macrocode}
20725 % \end{macro}
20726 % \end{macro}
20727 %
20728 %
20729 % \begin{macro}{\@line@@num}
20730 % Macro supporting restoration of |\linenum|.
20731 % \begin{macrocode}
20732 \let\@line@@num=\linenum
20733 % \end{macrocode}
20734 % \end{macro}
20735 %
20736 % \begin{macro}{\l@dgobbleoptarg}
20737 % \protect\cs{l@dgobbleoptarg}\oarg{arg}\marg{arg} replaces these two arguments (first is optional) by \protect\cs{relax}.
20738 % \changes{v1.12.5}{2014/08/28}{\protect\cs{l@dgobblearg} becomes \protect\cs{l@dgobbeloptarg}}
20739 % \begin{macrocode}
20740 \newcommand*{\l@dgobbleoptarg}[2][]{\relax}%
20741
20742 % \end{macrocode}
20743 % \end{macro}
20744 % \begin{macro}{\l@secondmandarg}
20745 % \protect\cs{l@secondoptarg}\oarg{arg}\marg{arg} gobble the first (optional) argument, and expand to the second (mandatory) argument.
20746 % \begin{macrocode}
20747 \NewExpandableDocumentCommand{\l@secondmandarg}{om}{#2}%
20748 % \end{macrocode}
20749 % \end{macro}
20750 %
20751 % \begin{macro}{\Relax}
20752 % \begin{macro}{\NEXT}
20753 % \begin{macrocode}
20754 \let\Relax=\relax
20755 \let\NEXT=\next
20756
20757 % \end{macrocode}
20758 % \end{macro}
20759 % \end{macro}
20760 % \begin{macro}{\l@dmodforedtext}
20761 % \begin{macro}{\l@drestoreforedtext}
20762 % Modify and restore various macros for when |\edtext| is used.
20763 % \changes{v1.12.5}{2014/08/28}{Debug optional arguments of \protect\cs{Xfootnote} in tabular context}
20764 % \begin{macrocode}
20765 \newcommand{\l@dmodforedtext}{%
20766 \let\edtext\relax
20767 \def\do##1{\global\csletcs{##1footnote}{l@dgobbleoptarg}}%
20768 \dolistloop{\@series}%
20769 \let\edindex\nulledinde%
20770 \disable@edlabel%
20771 \let\linenum\@gobble}
20772 \newcommand{\l@drestoreforedtext}{%
20773 \def\do##1{\global\csletcs{##1footnote}{##1@@footnote}}
20774 \dolistloop{\@series}%
20775 \let\edindex\xedindex}
20776 % \end{macrocode}
20777 % \end{macro}
20778 % \end{macro}
20779 %
20780 % \begin{macro}{\l@dnullfills}
20781 % \begin{macro}{\l@drestorefills}
20782 % Nullify and restore some column fillers, etc.
20783 % \begin{macrocode}
20784 \newcommand{\l@dnullfills}{%
20785 \disable@edlabel%
20786 \def\edrowfill##1##2##3{}%
20787 }
20788 \newcommand{\l@drestorefills}{%
20789 \def\edrowfill##1##2##3{\@EDROWFILL@{##1}{##2}{##3}}%
20790 }
20791
20792 % \end{macrocode}
20793 % \end{macro}
20794 % \end{macro}
20795 %
20796 %
20797 % \begin{macro}{\letsforverteilen}
20798 % Gathers some lets and other code that is common to the |*verteilen*| macros.
20799 % \begin{macrocode}
20800 \newcommand{\letsforverteilen}{%
20801 \let\edtext\xedtext
20802 \let\edindex\xedindex
20803 \def\do##1{\global\csletcs{##1footnote}{##1@@footnote}}
20804 \dolistloop{\@series}%
20805 \let\linenum\@line@@num
20806 \hilfsskip=\l@dcolwidth%
20807 \advance\hilfsskip by -\wd\hilfsbox
20808 \restore@edlabel%
20809 }%
20810 % \end{macrocode}
20811 % \end{macro}
20812 % \begin{macro}{\disablel@dtabfeet}
20813 % \begin{macro}{\enablel@dtabfeet}
20814 % Declarations for using or using \protect\cs{edtext} inside
20815 % tabulars.
20816 % The default at this point is for \protect\cs{edtext}.
20817 % \begin{macrocode}
20818 \newcommand\disablel@dtabfeet{\l@dmodforedtext}%
20819 \newcommand\enablel@dtabfeet{\l@drestoreforedtext}%
20820 % \end{macrocode}
20821 % \end{macro}
20822 % \end{macro}
20823 % \subsubsection{Counters, boxes and lengths}
20824 % \begin{macro}{\l@dampcount}
20825 % \begin{macro}{\l@dcolcount}
20826 % \protect\cs{l@dampcount} is a counter for the \& column dividers and
20827 % \protect\cs{l@dcolcount} is a counter for the columns.
20828 % \begin{macrocode}
20829 \newcount\l@dampcount
20830 \l@dampcount=1\relax
20831 \newcount\l@dcolcount
20832 \l@dcolcount=0\relax
20833
20834 % \end{macrocode}
20835 % \end{macro}
20836 % \end{macro}
20837 %
20838 % \begin{macro}{\hilfsbox}
20839 % \begin{macro}{\hilfsskip}
20840 % \begin{macro}{\Hilfsbox}
20841 % \begin{macro}{\hilfscount}
20842 % Some (temporary) helper items.
20843 % \begin{macrocode}
20844 \newbox\hilfsbox
20845 \newskip\hilfsskip
20846 \newbox\Hilfsbox
20847 \newcount\hilfscount
20848
20849 % \end{macrocode}
20850 % \end{macro}
20851 % \end{macro}
20852 % \end{macro}
20853 % \end{macro}
20854 %
20855 % 30 columns should be adequate (compared to the original 60).
20856 % These are the column widths. (Originally these were German spelled numbers
20857 % e.g., |\eins|, |\zwei|, etc).
20858 % \begin{macrocode}
20859 \newdimen\dcoli
20860 \newdimen\dcolii
20861 \newdimen\dcoliii
20862 \newdimen\dcoliv
20863 \newdimen\dcolv
20864 \newdimen\dcolvi
20865 \newdimen\dcolvii
20866 \newdimen\dcolviii
20867 \newdimen\dcolix
20868 \newdimen\dcolx
20869 \newdimen\dcolxi
20870 \newdimen\dcolxii
20871 \newdimen\dcolxiii
20872 \newdimen\dcolxiv
20873 \newdimen\dcolxv
20874 \newdimen\dcolxvi
20875 \newdimen\dcolxvii
20876 \newdimen\dcolxviii
20877 \newdimen\dcolxix
20878 \newdimen\dcolxx
20879 \newdimen\dcolxxi
20880 \newdimen\dcolxxii
20881 \newdimen\dcolxxiii
20882 \newdimen\dcolxxiv
20883 \newdimen\dcolxxv
20884 \newdimen\dcolxxvi
20885 \newdimen\dcolxxvii
20886 \newdimen\dcolxxviii
20887 \newdimen\dcolxxix
20888 \newdimen\dcolxxx
20889 \newdimen\dcolerr % added for error handling
20890
20891 % \end{macrocode}
20892 %
20893 % \begin{macro}{\l@dcolwidth}
20894 % This is a cunning way of storing the columnwidths indexed by
20895 % the column number \protect\cs{l@dcolcount}, like an array. (was |\Dimenzuordnung|)
20896 % \begin{macrocode}
20897 \newcommand{\l@dcolwidth}{\ifcase \the\l@dcolcount \dcoli %???
20898 \or \dcoli \or \dcolii \or \dcoliii
20899 \or \dcoliv \or \dcolv \or \dcolvi
20900 \or \dcolvii \or \dcolviii \or \dcolix \or \dcolx
20901 \or \dcolxi \or \dcolxii \or \dcolxiii
20902 \or \dcolxiv \or \dcolxv \or \dcolxvi
20903 \or \dcolxvii \or \dcolxviii \or \dcolxix \or \dcolxx
20904 \or \dcolxxi \or \dcolxxii \or \dcolxxiii
20905 \or \dcolxxiv \or \dcolxxv \or \dcolxxvi
20906 \or \dcolxxvii \or \dcolxxviii \or \dcolxxix \or \dcolxxx
20907 \else \dcolerr \fi}
20908
20909 % \end{macrocode}
20910 % \end{macro}
20911 %
20912 % \begin{macro}{\stepl@dcolcount}
20913 % This increments the column counter, and issues an error message
20914 % if it is too large.
20915 % \begin{macrocode}
20916 \newcommand*{\stepl@dcolcount}{\advance\l@dcolcount\@ne
20917 \ifnum\l@dcolcount>30\relax
20918 \led@err@TooManyColumns
20919 \fi}
20920
20921 % \end{macrocode}
20922 % \end{macro}
20923 %
20924 % \begin{macro}{\l@dsetmaxcolwidth}
20925 % Sets the column width to the maximum value seen so far.
20926 % \begin{macrocode}
20927 \newcommand{\l@dsetmaxcolwidth}{%
20928 \ifdim\l@dcolwidth < \wd\hilfsbox
20929 \l@dcolwidth = \wd\hilfsbox
20930 \else \relax \fi}
20931
20932 % \end{macrocode}
20933 % \end{macro}
20934 %
20935 %
20936 % \begin{macro}{\measuremcell}
20937 % Measure (recursively) the width required for a math cell.
20938 % \begin{macrocode}
20939 \def\measuremcell #1&{%
20940 \ifx #1\\ \ifnum\l@dcolcount=0\let\NEXT\relax%
20941 \else\l@dcheckcols%
20942 \l@dcolcount=0%
20943 \let\NEXT\measuremcell%
20944 \fi%
20945 \else\setbox\hilfsbox=\hbox{$\displaystyle{#1}$}%
20946 \stepl@dcolcount%
20947 \l@dsetmaxcolwidth%
20948 \let\NEXT\measuremcell%
20949 \fi\NEXT}
20950
20951 % \end{macrocode}
20952 % \end{macro}
20953 %
20954 % \begin{macro}{\measuretcell}
20955 % Measure (recursively) the width required for a text cell.
20956 % \begin{macrocode}
20957 \def\measuretcell #1&{%
20958 \ifx #1\\ \ifnum\l@dcolcount=0\let\NEXT\relax%
20959 \else\l@dcheckcols%
20960 \l@dcolcount=0%
20961 \let\NEXT\measuretcell%
20962 \fi%
20963 \else\setbox\hilfsbox=\hbox{#1}%
20964 \stepl@dcolcount%
20965 \l@dsetmaxcolwidth%
20966 \let\NEXT\measuretcell%
20967 \fi\NEXT}
20968
20969 % \end{macrocode}
20970 % \end{macro}
20971 %
20972 % \begin{macro}{\measuremrow}
20973 % Measure (recursively) the width required for a math row.
20974 % \begin{macrocode}
20975 \def\measuremrow #1\\{%
20976 \ifx #1&\let\NEXT\relax%
20977 \else\measuremcell #1&\\&\\&%
20978 \let\NEXT\measuremrow%
20979 \fi\NEXT}
20980 % \end{macrocode}
20981 % \end{macro}
20982 %
20983 % \begin{macro}{\measuretrow}
20984 % Measure (recursively) the width required for a text row.
20985 % \begin{macrocode}
20986 \def\measuretrow #1\\{%
20987 \ifx #1&\let\NEXT\relax%
20988 \else\measuretcell #1&\\&\\&%
20989 \let\NEXT\measuretrow%
20990 \fi\NEXT}
20991
20992 % \end{macrocode}
20993 % \end{macro}
20994 %
20995 % \begin{macro}{\edtabcolsep}
20996 % The length \protect\cs{edtabcolsep} controls the distance between columns.
20997 % \begin{macrocode}
20998 \newskip\edtabcolsep
20999 \global\edtabcolsep=10pt
21000
21001 % \end{macrocode}
21002 % \end{macro}
21003 %
21004 %
21005 % \begin{macro}{\variab}
21006 % \begin{macrocode}
21007 \newcommand{\variab}{\relax}
21008
21009 % \end{macrocode}
21010 % \end{macro}
21011 %
21012 % \begin{macro}{\l@dcheckcols}
21013 % Check that the number of columns is consistent.
21014 % \begin{macrocode}
21015 \newcommand*{\l@dcheckcols}{%
21016 \ifnum\l@dcolcount=1\relax
21017 \else
21018 \ifnum\l@dampcount=1\relax
21019 \else
21020 \ifnum\l@dcolcount=\l@dampcount\relax
21021 \else
21022 \l@d@err@UnequalColumns
21023 \fi
21024 \fi
21025 \l@dampcount=\l@dcolcount
21026 \fi}
21027
21028 % \end{macrocode}
21029 % \end{macro}
21030 %
21031 %
21032 %
21033 % \begin{macro}{\edfilldimen}
21034 % A length.
21035 % \begin{macrocode}
21036 \newdimen\edfilldimen
21037 \edfilldimen=0pt
21038
21039 % \end{macrocode}
21040 % \end{macro}
21041 %
21042 % \begin{macro}{\c@addcolcount}
21043 % \begin{macro}{\theaddcolcount}
21044 % A counter to hold the number of a column. We use a roman number so
21045 % that we can grab the column dimension from \protect\cs{dcol}.
21046 % We do not use the \cs{roman} \LaTeX\ command, because some packages, like \package{babel} can override it in some specific cases (Greek, for example).
21047 % \begin{macrocode}
21048 \newcounter{addcolcount}
21049 \renewcommand{\theaddcolcount}{\romannumeral \c@addcolcount}
21050 % \end{macrocode}
21051 % \end{macro}
21052 % \end{macro}
21053 % \subsubsection{Tabular typesetting}
21054 % \begin{macro}{\setmcellright}
21055 % Typeset (recursively) cells of display math right justified.
21056 % \begin{macrocode}
21057 \def\setmcellright #1&{%
21058 \disable@edlabel%
21059 \let\edindex\nulledindex
21060 \ifx #1\\ \ifnum\l@dcolcount=0%\removelastskip
21061 \let\Next\relax%
21062 \else\l@dcolcount=0%
21063 \let\Next=\setmcellright%
21064 \fi%
21065 \else%
21066 \disablel@dtabfeet%
21067 \stepl@dcolcount%
21068 \disable@notes%
21069 \setbox\hilfsbox=\hbox{$\displaystyle{#1}$}%
21070 \restore@notes%
21071 \letsforverteilen%
21072 \hskip\hilfsskip$\displaystyle{#1}$%
21073 \hskip\edtabcolsep%
21074 \let\Next=\setmcellright%
21075 \fi\Next}
21076
21077 % \end{macrocode}
21078 % \end{macro}
21079 %
21080 % \begin{macro}{\settcellright}
21081 % Typeset (recursively) cells of text right justified.
21082 % \begin{macrocode}
21083 \def\settcellright #1&{%
21084 \disable@edlabel%
21085 \let\edindex\nulledindex
21086 \ifx #1\\ \ifnum\l@dcolcount=0%\removelastskip
21087 \let\Next\relax%
21088 \else\l@dcolcount=0%
21089 \let\Next=\settcellright%
21090 \fi%
21091 \else%
21092 \disablel@dtabfeet%
21093 \stepl@dcolcount%
21094 \disable@notes%
21095 \setbox\hilfsbox=\hbox{#1}%
21096 \restore@notes%
21097 \letsforverteilen%
21098 \hskip\hilfsskip#1%
21099 \hskip\edtabcolsep%
21100 \let\Next=\settcellright%
21101 \fi\Next}
21102 % \end{macrocode}
21103 % \end{macro}
21104 %
21105 % \begin{macro}{\setmcellleft}
21106 % Typeset (recursively) cells of display math left justified.
21107 % \begin{macrocode}
21108 \def\setmcellleft #1&{%
21109 \disable@edlabel%
21110 \let\edindex\nulledindex
21111 \ifx #1\\ \ifnum\l@dcolcount=0 \let\Next\relax%
21112 \else\l@dcolcount=0%
21113 \let\Next=\setmcellleft%
21114 \fi%
21115 \else \disablel@dtabfeet%
21116 \stepl@dcolcount%
21117 \disable@notes%
21118 \setbox\hilfsbox=\hbox{$\displaystyle{#1}$}%
21119 \restore@notes%
21120 \letsforverteilen%
21121 $\displaystyle{#1}$\hskip\hilfsskip\hskip\edtabcolsep%
21122 \let\Next=\setmcellleft%
21123 \fi\Next}
21124
21125 % \end{macrocode}
21126 % \end{macro}
21127 %
21128 % \begin{macro}{\settcellleft}
21129 % Typeset (recursively) cells of text left justified.
21130 % \begin{macrocode}
21131 \def\settcellleft #1&{%
21132 \disable@edlabel%
21133 \let\edindex\nulledindex
21134 \ifx #1\\ \ifnum\l@dcolcount=0 \let\Next\relax%
21135 \else\l@dcolcount=0%
21136 \let\Next=\settcellleft%
21137 \fi%
21138 \else \disablel@dtabfeet%
21139 \stepl@dcolcount%
21140 \disable@notes%
21141 \setbox\hilfsbox=\hbox{#1}%
21142 \restore@notes%
21143 \letsforverteilen%
21144 #1\hskip\hilfsskip\hskip\edtabcolsep%
21145 \let\Next=\settcellleft%
21146 \fi\Next}
21147 % \end{macrocode}
21148 % \end{macro}
21149 %
21150 % \begin{macro}{\setmcellcenter}
21151 % Typeset (recursively) cells of display math centered.
21152 % \begin{macrocode}
21153 \def\setmcellcenter #1&{%
21154 \disable@edlabel%
21155 \let\edindex\nulledindex
21156 \ifx #1\\ \ifnum\l@dcolcount=0\let\Next\relax%
21157 \else\l@dcolcount=0%
21158 \let\Next=\setmcellcenter%
21159 \fi%
21160 \else \disablel@dtabfeet%
21161 \stepl@dcolcount%
21162 \disable@notes%
21163 \setbox\hilfsbox=\hbox{$\displaystyle{#1}$}%
21164 \restore@notes%
21165 \letsforverteilen%
21166 \hskip 0.5\hilfsskip$\displaystyle{#1}$\hskip0.5\hilfsskip%
21167 \hskip\edtabcolsep%
21168 \let\Next=\setmcellcenter%
21169 \fi\Next}
21170
21171 % \end{macrocode}
21172 % \end{macro}
21173 %
21174 % \begin{macro}{\settcellcenter}
21175 % Typeset (recursively) cells of text centered.
21176 % \begin{macrocode}
21177 \def\settcellcenter #1&{%
21178 \disable@edlabel%
21179 \let\edindex\nulledindex
21180 \ifx #1\\ \ifnum\l@dcolcount=0 \let\Next\relax%
21181 \else\l@dcolcount=0%
21182 \let\Next=\settcellcenter%
21183 \fi%
21184 \else \disablel@dtabfeet%
21185 \stepl@dcolcount%
21186 \disable@notes%
21187 \setbox\hilfsbox=\hbox{#1}%
21188 \restore@notes%
21189 \letsforverteilen%
21190 \hskip 0.5\hilfsskip #1\hskip 0.5\hilfsskip%
21191 \hskip\edtabcolsep%
21192 \let\Next=\settcellcenter%
21193 \fi\Next}
21194
21195 % \end{macrocode}
21196 % \end{macro}
21197 %
21198 % \begin{macro}{\NEXT}
21199 % \begin{macrocode}
21200 \let\NEXT=\relax
21201
21202 % \end{macrocode}
21203 % \end{macro}
21204 %
21205 % \begin{macro}{\setmrowright}
21206 % Typeset (recursively) rows of right justified math.
21207 % \begin{macrocode}
21208 \def\setmrowright #1\\{%
21209 \ifx #1& \let\NEXT\relax
21210 \else \centerline{\setmcellright #1&\\&\\&}
21211 \let\NEXT=\setmrowright
21212 \fi\NEXT}
21213 % \end{macrocode}
21214 % \end{macro}
21215 %
21216 % \begin{macro}{\settrowright}
21217 % Typeset (recursively) rows of right justified text.
21218 % \begin{macrocode}
21219 \def\settrowright #1\\{%
21220 \ifx #1& \let\NEXT\relax
21221 \else \centerline{\settcellright #1&\\&\\&}
21222 \let\NEXT=\settrowright
21223 \fi\NEXT}
21224
21225 % \end{macrocode}
21226 % \end{macro}
21227 %
21228 % \begin{macro}{\setmrowleft}
21229 % Typeset (recursively) rows of left justified math.
21230 % \begin{macrocode}
21231 \def\setmrowleft #1\\{%
21232 \ifx #1&\let\NEXT\relax
21233 \else \centerline{\setmcellleft #1&\\&\\&}
21234 \let\NEXT=\setmrowleft
21235 \fi\NEXT}
21236 % \end{macrocode}
21237 % \end{macro}
21238 %
21239 % \begin{macro}{\settrowleft}
21240 % Typeset (recursively) rows of left justified text.
21241 % \begin{macrocode}
21242 \def\settrowleft #1\\{%
21243 \ifx #1& \let\NEXT\relax
21244 \else \centerline{\settcellleft #1&\\&\\&}
21245 \let\NEXT=\settrowleft
21246 \fi\NEXT}
21247
21248 % \end{macrocode}
21249 % \end{macro}
21250 %
21251 % \begin{macro}{\setmrowcenter}
21252 % Typeset (recursively) rows of centered math.
21253 % \begin{macrocode}
21254 \def\setmrowcenter #1\\{%
21255 \ifx #1& \let\NEXT\relax%
21256 \else \centerline{\setmcellcenter #1&\\&\\&}
21257 \let\NEXT=\setmrowcenter
21258 \fi\NEXT}
21259 % \end{macrocode}
21260 % \end{macro}
21261 %
21262 % \begin{macro}{\settrowcenter}
21263 % Typeset (recursively) rows of centered text.
21264 % \begin{macrocode}
21265 \def\settrowcenter #1\\{%
21266 \ifx #1& \let\NEXT\relax
21267 \else \centerline{\settcellcenter #1&\\&\\&}
21268 \let\NEXT=\settrowcenter
21269 \fi\NEXT}
21270
21271 % \end{macrocode}
21272 % \end{macro}
21273 %
21274 % \begin{macro}{\nullsetzen}
21275 %
21276 % \begin{macrocode}
21277 \newcommand{\nullsetzen}{%
21278 \stepl@dcolcount%
21279 \l@dcolwidth=0pt%
21280 \ifnum\l@dcolcount=30\let\NEXT\relax%
21281 \l@dcolcount=0\relax
21282 \else\let\NEXT\nullsetzen%
21283 \fi\NEXT}
21284
21285 % \end{macrocode}
21286 % \end{macro}
21287 %
21288 % \begin{macro}{\edatleft}
21289 % \protect\cs{edatleft}\oarg{math}\marg{symbol}\marg{len}.
21290 % Left \meta{symbol}, 2\meta{len} high with prepended \meta{math} vertically centered.
21291 % \begin{macrocode}
21292 \newcommand{\edatleft}[3][\@empty]{%
21293 \ifx#1\@empty
21294 \vbox to 10pt{\vss\hbox{$\left#2\vrule width0pt height #3
21295 depth 0pt \right. $\hss}\vfil}
21296 \else
21297 \vbox to 4pt{\vss\hbox{$#1\left#2\vrule width0pt height #3
21298 depth 0pt \right. $}\vfil}
21299 \fi}
21300 % \end{macrocode}
21301 % \end{macro}
21302 %
21303 %
21304 % \begin{macro}{\edatright}
21305 % \protect\cs{edatright}\oarg{math}\marg{symbol}\marg{len}.
21306 % Right \meta{symbol}, 2\meta{len} high with appended \meta{math} vertically centered.
21307 % \begin{macrocode}
21308 \newcommand{\edatright}[3][\@empty]{%
21309 \ifx#1\@empty
21310 \vbox to 10pt{\vss\hbox{$\left.\vrule width0pt height #3
21311 depth 0pt \right#2 $\hss}\vfil}
21312 \else
21313 \vbox to 4pt{\vss\hbox{$\left.\vrule width0pt height #3
21314 depth 0pt \right#2 #1 $}\vfil}
21315 \fi}
21316
21317 % \end{macrocode}
21318 % \end{macro}
21319 %
21320 %
21321 % \begin{macro}{\edvertline}
21322 % \protect\cs{edvertline}\marg{len} vertical line \meta{len} high.
21323 % \begin{macrocode}
21324 \newcommand{\edvertline}[1]{\vbox to 8pt{\vss\hbox{\vrule height #1}\vfil}}
21325
21326 % \end{macrocode}
21327 % \end{macro}
21328 %
21329 % \begin{macro}{\edvertdots}
21330 % \protect\cs{edvertdots}\marg{len} vertical dotted line \meta{len} high.
21331 % \begin{macrocode}
21332 \newcommand{\edvertdots}[1]{\vbox to 1pt{\vss\vbox to #1%
21333 {\cleaders\hbox{$\m@th\hbox{.}\vbox to 0.5em{ }$}\vfil}}}
21334
21335 % \end{macrocode}
21336 % \end{macro}
21337 %
21338 %
21339 %
21340 % \begin{macro}{\l@dtabaddcols}
21341 % \protect\cs{l@dtabaddcols}\marg{startcol}\marg{endcol} adds the widths of
21342 % the columns \meta{startcol} through \meta{endcol} to \protect\cs{edfilldimen}.
21343 % It is a \LaTeX\ style
21344 % reimplementation of the original \protect\cs{@add@}.
21345 % \begin{macrocode}
21346 \newcommand{\l@dtabaddcols}[2]{%
21347 \l@dcheckstartend{#1}{#2}%
21348 \ifl@dstartendok
21349 \setcounter{addcolcount}{#1}%
21350 \@whilenum \value{addcolcount}<#2\relax \do
21351 {\advance\edfilldimen by \the \csname dcol\theaddcolcount\endcsname
21352 \advance\edfilldimen by \edtabcolsep
21353 \stepcounter{addcolcount}}%
21354 \advance\edfilldimen by \the \csname dcol\theaddcolcount\endcsname
21355 \fi
21356 }
21357
21358 % \end{macrocode}
21359 % \end{macro}
21360 %
21361 % \begin{macro}{\ifl@dstartendok}
21362 % \begin{macro}{\l@dcheckstartend}
21363 % \protect\cs{l@dcheckstartend}\marg{startcol}\marg{endcol} checks that the values
21364 % of \meta{startcol} and \meta{endcol} are sensible. If they are then
21365 % \protect\cs{ifl@dstartendok} is set TRUE, otherwise it is set FALSE.
21366 % \begin{macrocode}
21367 \newif\ifl@dstartendok
21368 \newcommand{\l@dcheckstartend}[2]{%
21369 \l@dstartendoktrue
21370 \ifnum #1<\@ne
21371 \l@dstartendokfalse
21372 \led@err@LowStartColumn
21373 \fi
21374 \ifnum #2>30\relax
21375 \l@dstartendokfalse
21376 \led@err@HighEndColumn
21377 \fi
21378 \ifnum #1>#2\relax
21379 \l@dstartendokfalse
21380 \led@err@ReverseColumns
21381 \fi
21382 }
21383
21384 % \end{macrocode}
21385 % \end{macro}
21386 % \end{macro}
21387 %
21388 % \begin{macro}{\edrowfill}
21389 % \begin{macro}{\@edrowfill@}
21390 % \begin{macro}{\@EDROWFILL@}
21391 % \protect\cs{edrowfill}\marg{startcol}\marg{endcol}{fill}
21392 % fills columns \meta{startcol} to \meta{endcol} inclusive with
21393 % \meta{fill} (e.g. \protect\cs{hrulefill}, \protect\cs{upbracefill}).
21394 % This is a \LaTeX\ style reimplementation and generalization of the
21395 % original \protect\cs{waklam}, \protect\cs{Waklam}, \protect\cs{waklamec}, \protect\cs{wastricht}
21396 % and \protect\cs{wapunktel} macros.
21397 % \begin{macrocode}
21398 \newcommand*{\edrowfill}[3]{%
21399 \l@dtabaddcols{#1}{#2}%
21400 \hb@xt@ \the\l@dcolwidth{\hb@xt@ \the\edfilldimen{#3}\hss}}
21401 \let\@edrowfill@=\edrowfill
21402 \def\@EDROWFILL@#1#2#3{\@edrowfill@{#1}{#2}{#3}}
21403
21404 % \end{macrocode}
21405 % \end{macro}
21406 % \end{macro}
21407 % \end{macro}
21408 %
21409 %
21410 % \DescribeMacro{\edbeforetab}
21411 % \DescribeMacro{\edaftertab}
21412 % The macro \protect\cs{edbeforetab}\marg{text}\marg{math} puts \meta{text} at
21413 % the left margin before array cell entry \meta{math}. Conversely,
21414 % the macro \protect\cs{edaftertab}\marg{math}\marg{text} puts \meta{text}
21415 % at the right margin after array cell entry \meta{math}.
21416 % \protect\cs{edbeforetab} should be in the first column and \protect\cs{edaftertab} in the
21417 % last column.
21418 % The following macros support these.
21419 %
21420 % \begin{macro}{\leftltab}
21421 % \protect\cs{leftltab}\marg{text} for \protect\cs{edbeforetab} in \protect\cs{ltab}.
21422 % \begin{macrocode}
21423 \newcommand{\leftltab}[1]{%
21424 \hb@xt@\z@{\vbox{\edtabindent%
21425 \moveleft\Hilfsskip\hbox{\ #1}}\hss}}
21426
21427 % \end{macrocode}
21428 % \end{macro}
21429 %
21430 % \begin{macro}{\leftrtab}
21431 % \protect\cs{leftrtab}\marg{text}\marg{math} for \protect\cs{edbeforetab} in \protect\cs{rtab}.
21432 % \begin{macrocode}
21433 \newcommand{\leftrtab}[2]{%
21434 #2\hb@xt@\z@{\vbox{\edtabindent%
21435 \advance\Hilfsskip by\dcoli%
21436 \moveleft\Hilfsskip\hbox{\ #1}}\hss}}
21437
21438 % \end{macrocode}
21439 % \end{macro}
21440 %
21441 % \begin{macro}{\leftctab}
21442 % \protect\cs{leftctab}\marg{text}\marg{math} for \protect\cs{edbeforetab} in \protect\cs{ctab}.
21443 % \begin{macrocode}
21444 \newcommand{\leftctab}[2]{%
21445 \hb@xt@\z@{\vbox{\edtabindent\l@dcolcount=\l@dampcount%
21446 \advance\Hilfsskip by 0.5\dcoli%
21447 \setbox\hilfsbox=\hbox{%
21448 \disable@edlabel%
21449 \disablel@dtabfeet$\displaystyle{#2}$}%
21450 \advance\Hilfsskip by -0.5\wd\hilfsbox%
21451 \moveleft\Hilfsskip\hbox{\ #1}}\hss}%
21452 #2}
21453
21454 % \end{macrocode}
21455 % \end{macro}
21456 %
21457 % \begin{macro}{\rightctab}
21458 % \protect\cs{rightctab}\marg{math}\marg{text} for \protect\cs{edaftertab} in \protect\cs{ctab}.
21459 % \begin{macrocode}
21460 \newcommand{\rightctab}[2]{%
21461 \setbox\hilfsbox=\hbox{%
21462 \disable@edlabel%
21463 \disablel@dtabfeet#2}\l@dampcount=\l@dcolcount%
21464 #1\hb@xt@\z@{\vbox{\edtabindent\l@dcolcount=\l@dampcount%
21465 \advance\Hilfsskip by 0.5\l@dcolwidth%
21466 \advance\Hilfsskip by -\wd\hilfsbox%
21467 \setbox\hilfsbox=\hbox{%
21468 \disable@edlabel%
21469 \disablel@dtabfeet$\displaystyle{#1}$}%
21470 \advance\Hilfsskip by -0.5\wd\hilfsbox%
21471 \advance\Hilfsskip by \edtabcolsep%
21472 \moveright\Hilfsskip\hbox{ #2}}\hss}%
21473 }
21474
21475 % \end{macrocode}
21476 % \end{macro}
21477 %
21478 % \begin{macro}{\rightltab}
21479 % \protect\cs{rightltab}\marg{math}\marg{text} for \protect\cs{edaftertab} in \protect\cs{ltab}.
21480 % \begin{macrocode}
21481 \newcommand{\rightltab}[2]{%
21482 \setbox\hilfsbox=\hbox{%
21483 \disable@edlabel%
21484 \disablel@dtabfeet#2}\l@dampcount=\l@dcolcount%
21485 #1\hb@xt@\z@{\vbox{\edtabindent\l@dcolcount=\l@dampcount%
21486 \advance\Hilfsskip by\l@dcolwidth%
21487 \advance\Hilfsskip by-\wd\hilfsbox%
21488 \setbox\hilfsbox=\hbox{%
21489 \disable@edlabel%
21490 \disablel@dtabfeet$\displaystyle{#1}$}%
21491 \advance\Hilfsskip by-\wd\hilfsbox%
21492 \advance\Hilfsskip by\edtabcolsep%
21493 \moveright\Hilfsskip\hbox{ #2}}\hss}%
21494 }
21495
21496 % \end{macrocode}
21497 % \end{macro}
21498 %
21499 % \begin{macro}{\rightrtab}
21500 % \protect\cs{rightrtab}\marg{math}\marg{text} for \protect\cs{edaftertab} in \protect\cs{rtab}.
21501 % \begin{macrocode}
21502 \newcommand{\rightrtab}[2]{%
21503 \setbox\hilfsbox=\hbox{%
21504 \disable@edlabel%
21505 \disablel@dtabfeet#2}%
21506 #1\hb@xt@\z@{\vbox{\edtabindent%
21507 \advance\Hilfsskip by-\wd\hilfsbox%
21508 \advance\Hilfsskip by\edtabcolsep%
21509 \moveright\Hilfsskip\hbox{ #2}}\hss}%
21510 }
21511
21512 % \end{macrocode}
21513 % \end{macro}
21514 %
21515 % \begin{macro}{\rtab}
21516 % \begin{macro}{\edbeforetab}
21517 % \begin{macro}{\edaftertab}
21518 % \protect\cs{rtab}\marg{body} typesets \meta{body} as an array with the
21519 % entries right justified.
21520 %
21521 %
21522 % The process is first to measure the \meta{body} to get the column
21523 % widths, and then in a second pass to typeset the body.
21524 % \begin{macrocode}
21525 \newcommand{\rtab}[1]{%
21526 \l@dnullfills
21527 \def\edbeforetab##1##2{\leftrtab{##1}{##2}}%
21528 \def\edaftertab##1##2{\rightrtab{##1}{##2}}%
21529 \measurembody{#1}%
21530 \l@drestorefills
21531 \variab
21532 \setmrowright #1\\&\\%
21533 \enablel@dtabfeet}
21534
21535 % \end{macrocode}
21536 % \end{macro}
21537 % \end{macro}
21538 % \end{macro}
21539 %
21540 % \begin{macro}{\measurembody}
21541 % \protect\cs{measurembody}\marg{body} measures the array \meta{body}.
21542 % \begin{macrocode}
21543 \newcommand{\measurembody}[1]{%
21544 \disablel@dtabfeet%
21545 \l@dcolcount=0%
21546 \nullsetzen%
21547 \l@dcolcount=0
21548 \measuremrow #1\\&\\%
21549 \global\l@dampcount=1}
21550
21551 % \end{macrocode}
21552 % \end{macro}
21553 %
21554 % \begin{macro}{\rtabtext}
21555 % \protect\cs{rtabtext}\marg{body} typesets \meta{body} as a tabular with the
21556 % entries right justified.
21557 % \begin{macrocode}
21558 \newcommand{\rtabtext}[1]{%
21559 \l@dnullfills
21560 \measuretbody{#1}%
21561 \l@drestorefills
21562 \variab
21563 \settrowright #1\\&\\%
21564 \enablel@dtabfeet}
21565
21566 % \end{macrocode}
21567 % \end{macro}
21568 %
21569 % \begin{macro}{\measuretbody}
21570 % \protect\cs{measuretbody}\marg{body} measures the tabular \meta{body}.
21571 % \begin{macrocode}
21572 \newcommand{\measuretbody}[1]{%
21573 \disable@notes%
21574 \disablel@dtabfeet%
21575 \l@dcolcount=0%
21576 \nullsetzen%
21577 \l@dcolcount=0
21578 \measuretrow #1\\&\\%
21579 \restore@notes%
21580 \global\l@dampcount=1}
21581
21582 % \end{macrocode}
21583 % \end{macro}
21584 %
21585 % \begin{macro}{\ltab}
21586 % \begin{macro}{\edbeforetab}
21587 % \begin{macro}{\edaftertab}
21588 % Array with entries left justified.
21589 % \begin{macrocode}
21590 \newcommand{\ltab}[1]{%
21591 \l@dnullfills
21592 \def\edbeforetab##1##2{\leftltab{##1}{##2}}%
21593 \def\edaftertab##1##2{\rightltab{##1}{##2}}%
21594 \measurembody{#1}%
21595 \l@drestorefills
21596 \variab
21597 \setmrowleft #1\\&\\%
21598 \enablel@dtabfeet}
21599
21600 % \end{macrocode}
21601 % \end{macro}
21602 % \end{macro}
21603 % \end{macro}
21604 %
21605 % \begin{macro}{\ltabtext}
21606 % Tabular with entries left justified.
21607 % \begin{macrocode}
21608 \newcommand{\ltabtext}[1]{%
21609 \l@dnullfills
21610 \measuretbody{#1}%
21611 \l@drestorefills
21612 \variab
21613 \settrowleft #1\\&\\%
21614 \enablel@dtabfeet}
21615
21616 % \end{macrocode}
21617 % \end{macro}
21618 %
21619 % \begin{macro}{\ctab}
21620 % \begin{macro}{\edbeforetab}
21621 % \begin{macro}{\edaftertab}
21622 % Array with centered entries.
21623 % \begin{macrocode}
21624 \newcommand{\ctab}[1]{%
21625 \l@dnullfills
21626 \def\edbeforetab##1##2{\leftctab{##1}{##2}}%
21627 \def\edaftertab##1##2{\rightctab{##1}{##2}}%
21628 \measurembody{#1}%
21629 \l@drestorefills
21630 \variab
21631 \setmrowcenter #1\\&\\%
21632 \enablel@dtabfeet}
21633
21634 % \end{macrocode}
21635 % \end{macro}
21636 % \end{macro}
21637 % \end{macro}
21638 %
21639 % \begin{macro}{\ctabtext}
21640 % Tabular with entries centered.
21641 % \begin{macrocode}
21642 \newcommand{\ctabtext}[1]{%
21643 \l@dnullfills
21644 \measuretbody{#1}%
21645 \l@drestorefills
21646 \variab
21647 \settrowcenter #1\\&\\%
21648 \enablel@dtabfeet}
21649
21650 % \end{macrocode}
21651 % \end{macro}
21652 %
21653 % \begin{macro}{\spreadtext}
21654 %
21655 % \begin{macrocode}
21656 \newcommand{\spreadtext}[1]{%\l@dcolcount=\l@dampcount%
21657 \hb@xt@ \the\l@dcolwidth{\hbox{#1}\hss}}
21658 % \end{macrocode}
21659 % \end{macro}
21660 %
21661 % \begin{macro}{\spreadmath}
21662 %
21663 % \begin{macrocode}
21664 \newcommand{\spreadmath}[1]{%
21665 \hb@xt@ \the\l@dcolwidth{\hbox{$\displaystyle{#1}$}\hss}}
21666
21667 % \end{macrocode}
21668 % \end{macro}
21669 %
21670 %
21671 %
21672 %
21673 % \begin{macro}{\HILFSskip}
21674 % \begin{macro}{\Hilfsskip}
21675 % More helpers.
21676 % \begin{macrocode}
21677 \newskip\HILFSskip
21678 \newskip\Hilfsskip
21679
21680 % \end{macrocode}
21681 % \end{macro}
21682 % \end{macro}
21683 %
21684 % \begin{macro}{\EDTABINDENT}
21685 %
21686 % \begin{macrocode}
21687 \newcommand{\EDTABINDENT}{%
21688 \ifnum\l@dcolcount=30\let\NEXT\relax\l@dcolcount=0%
21689 \else\stepl@dcolcount%
21690 \advance\Hilfsskip by\l@dcolwidth%
21691 \ifdim\l@dcolwidth=0pt\advance\hilfscount\@ne
21692 \else\advance\Hilfsskip by \the\hilfscount\edtabcolsep%
21693 \hilfscount=1\fi%
21694 \let\NEXT=\EDTABINDENT%
21695 \fi\NEXT}%
21696 % \end{macrocode}
21697 % \end{macro}
21698 %
21699 % \begin{macro}{\edtabindent}
21700 % (was |\tabindent|)
21701 % \begin{macrocode}
21702 \newcommand{\edtabindent}{%
21703 \l@dcolcount=0\relax
21704 \Hilfsskip=0pt%
21705 \hilfscount=1\relax
21706 \EDTABINDENT%
21707 \hilfsskip=\hsize%
21708 \advance\hilfsskip -\Hilfsskip%
21709 \Hilfsskip=0.5\hilfsskip%
21710 }%
21711
21712 % \end{macrocode}
21713 % \end{macro}
21714 %
21715 % \begin{macro}{\EDTAB}
21716 % (was |\TAB|)
21717 % \begin{macrocode}
21718 \def\EDTAB #1|#2|{%
21719 \setbox\tabhilfbox=\hbox{$\displaystyle{#1}$}%
21720 \setbox\tabHilfbox=\hbox{$\displaystyle{#2}$}%
21721 \advance\tabelskip -\wd\tabhilfbox%
21722 \advance\tabelskip -\wd\tabHilfbox%
21723 \unhbox\tabhilfbox\hskip\tabelskip%
21724 \unhbox\tabHilfbox}%
21725
21726 % \end{macrocode}
21727 % \end{macro}
21728 %
21729 % \begin{macro}{\EDTABtext}
21730 % (was |\TABtext|)
21731 % \begin{macrocode}
21732 \def\EDTABtext #1|#2|{%
21733 \setbox\tabhilfbox=\hbox{#1}%
21734 \setbox\tabHilfbox=\hbox{#2}%
21735 \advance\tabelskip -\wd\tabhilfbox%
21736 \advance\tabelskip -\wd\tabHilfbox%
21737 \unhbox\tabhilfbox\hskip\tabelskip%
21738 \unhbox\tabHilfbox}%
21739 % \end{macrocode}
21740 % \end{macro}
21741 %
21742 % \begin{macro}{\tabhilfbox}
21743 % \begin{macro}{\tabHilfbox}
21744 % Further helpers.
21745 % \begin{macrocode}
21746 \newbox\tabhilfbox
21747 \newbox\tabHilfbox
21748
21749 % \end{macrocode}
21750 % \end{macro}
21751 % \end{macro}
21752 % \subsubsection{Environments}
21753 % \begin{environment}{edarrayl}
21754 % \begin{environment}{edarrayc}
21755 % \begin{environment}{edarrayr}
21756 % The environment forms for \protect\cs{ltab}, \protect\cs{ctab} and \protect\cs{rtab}.
21757 % \begin{macrocode}
21758 \newenvironment{edarrayl}{\l@dcollect@body\ltab}{}
21759 \newenvironment{edarrayc}{\l@dcollect@body\ctab}{}
21760 \newenvironment{edarrayr}{\l@dcollect@body\rtab}{}
21761
21762 % \end{macrocode}
21763 % \end{environment}
21764 % \end{environment}
21765 % \end{environment}
21766 %
21767 % \begin{environment}{edtabularl}
21768 % \begin{environment}{edtabularc}
21769 % \begin{environment}{edtabularr}
21770 % The environment forms for \protect\cs{ltabtext}, \protect\cs{ctabtext} and \protect\cs{rtabtext}.
21771 % \begin{macrocode}
21772 \newenvironment{edtabularl}{\l@dcollect@body\ltabtext}{}
21773 \newenvironment{edtabularc}{\l@dcollect@body\ctabtext}{}
21774 \newenvironment{edtabularr}{\l@dcollect@body\rtabtext}{}
21775
21776 % \end{macrocode}
21777 % \end{environment}
21778 % \end{environment}
21779 % \end{environment}
21780 %
21781 %
21782 % \section{Quotation's commands}
21783 % \begin{macro}{\initnumbering@quote}
21784 % This macro, called at the beginning of any numbered section, locally redefines the \verb+quotation+ and \verb+quote+ environments, in order to allow their use inside of numbered sections.
21785 % \changes{v2.0.0}{2015/07/19}{\protect\cs{initnumbering@sectcmd} becomes \protect\cs{initnumbering@quote}}
21786 % \begin{macro}{\quotation}
21787 % \begin{macro}{\endquotation}
21788 % \begin{macro}{\quote}
21789 % \begin{macro}{\endquote}
21790 % \changes{v1.12.0}{2014/08/05}{\protect\cs{ledxxx} sectioning commands are deprecated and replaced by \protect\cs{eledxxx} commands.}
21791 % \changes{v1.2.0}{2012/10/08}{Compatibility of \protect\cs{ledchapter} with the \emph{memoir} class.}
21792 % \changes{v1.3.0}{2012/11/01}{\emph{Quotation} and {quote} environment inside numbered sections.}
21793 % \changes{v1.4.1}{2012/11/16}{New option \emph{noquotation}.}
21794 % \changes{v1.4.7}{2012/06/07}{Compatibility of sectioning commands with \protect\cs{autopar}.}
21795 % \changes{v1.8.0}{2013/12/13}{Correction of sectioning commands in parallel texts.}
21796 % \changes{v1.10.0}{2014/02/27}{Correction of sectioning commands in parallel texts.}
21797 % \protect\cs{initnumbering@quote} defines quotation environment.
21798 % \begin{macrocode}
21799 \newcommand{\initnumbering@quote}{
21800 \ifnoquotation@\else
21801 \renewcommand{\quotation}{\par\leavevmode%
21802 \parindent=1.5em%
21803 \skipnumbering%
21804 \ifautopar%
21805 \vskip-\parskip%
21806 \else%
21807 \vskip\topsep%
21808 \fi%
21809 \global\leftskip=\leftmargin%
21810 \global\rightskip=\leftmargin%
21811 }
21812 \renewcommand{\endquotation}{\par%
21813 \global\leftskip=0pt%
21814 \global\rightskip=0pt%
21815 \leavevmode%
21816 \skipnumbering%
21817 \ifautopar%
21818 \vskip-\parskip%
21819 \else%
21820 \vskip\topsep%
21821 \fi%
21822 }
21823 \renewcommand{\quote}{\par\leavevmode%
21824 \parindent=0pt%
21825 \skipnumbering%
21826 \ifautopar%
21827 \vskip-\parskip%
21828 \else%
21829 \vskip\topsep%
21830 \fi%
21831 \global\leftskip=\leftmargin%
21832 \global\rightskip=\leftmargin%
21833 }
21834 \renewcommand{\endquote}{\par%
21835 \global\leftskip=0pt%
21836 \global\rightskip=0pt%
21837 \leavevmode%
21838 \skipnumbering%
21839 \ifautopar%
21840 \vskip-\parskip%
21841 \else%
21842 \vskip\topsep%
21843 \fi%
21844 }
21845 \fi
21846 }
21847 % \end{macrocode}
21848 % \end{macro}
21849 % \end{macro}
21850 % \end{macro}
21851 % \end{macro}
21852 % \end{macro}
21853 % \section{Section's title commands}
21854 % \subsection{Commands to disable some feature}
21855 % \begin{macro}{\ledsectnotoc}
21856 % The \protect\cs{ledsectnotoc} only disables the \protect\cs{addcontentsline} macro.
21857 % \begin{macrocode}
21858 \newcommand{\ledsectnotoc}{\let\addcontentsline\@gobblethree}
21859 % \end{macrocode}
21860 % \end{macro}
21861 % \begin{macro}{\ledsectnomark}
21862 % The \protect\cs{ledsectnomark} only disables the \protect\cs{chaptermark}, \protect\cs{sectionmark} and \protect\cs{subsectionmark} macros.
21863 % \begin{macrocode}
21864 \newcommand{\ledsectnomark}{%
21865 \let\chaptermark\@gobble%
21866 \let\sectionmark\@gobble%
21867 \let\subsectionmark\@gobble%
21868 }
21869 % \end{macrocode}
21870 % \end{macro}
21871 % \subsection{General overview}
21872 % The system of \protect\cs{eledxxxx} commands to section text work like this:
21873 % \begin{enumerate}
21874 % \item When one of these commands is called, \macpackage\ writes to an auxiliary files:
21875 % \begin{itemize}
21876 % \item The section level.
21877 % \item The section title.
21878 % \item The side (when \parpackage\ is used).
21879 % \item The pstart where the command is called.
21880 % \item If we have starred version or not.
21881 % \end{itemize}
21882 % \item \macpackage\ adds the title of the section to pstart, as normal content. This is to enable critical notes.
21883 % \item When \LaTeX\ is run a other time, this file is read. That:
21884 % \begin{itemize}
21885 % \item Adds the pstart number to a list of pstarts where a sectioning command is used.
21886 % \item Defines a command, the name of which contains the pstart number, and which calls the normal \LaTeX\ sectioning command.
21887 % \end{itemize}
21888 % \item This last command is called when the pstart is effectively printed.
21889 % \end{enumerate}
21890 % \subsection{\protect\cs{beforeeledchapter} command}
21891 % We do not define commands for \protect\cs{eledsection} and related if the \verb+noeledsec+ option is loaded.
21892 % We use \protect\package{etoolbox} tests and not the \protect\cs{ifxxx}\ldots\protect\cs{else}\ldots\protect\cs{fi} structure to prevent problem of expansions with command after the \protect\cs{ifxxx} which contains \protect\cs{fi}.
21893 % As we patch command inside this test, we need to change the category code of \# character \emph{before} \protect\cs{notbool} statement, because the second argument is read with the standard catcode (read \thetexbook to understand when the catcode's change has effect).
21894 % \begin{macrocode}
21895 \catcode`\#=12
21896 \notbool{@noeled@sec}{%
21897 % \end{macrocode}
21898 % \begin{macro}{\beforeeledchapter}
21899 % For technical reasons, not yet solved, page-breaking before chapters can't be made automatically by eledmac. Users have to use \protect\cs{beforeeledchapter}.
21900 % \begin{macrocode}
21901 \ifl@dmemoir
21902 \newcommand\beforeeledchapter{%
21903 \clearforchapter%
21904 }
21905 \else
21906 \newcommand\beforeeledchapter{%
21907 \if@openright%
21908 \cleardoublepage%
21909 \else%
21910 \clearpage%
21911 \fi%
21912 }
21913 \fi
21914 % \end{macrocode}
21915 % \end{macro}
21916 % \subsection{Auxiliary commands}
21917 % \begin{macro}{\print@leftmargin@eledsection}
21918 % \begin{macro}{\print@rightmargin@eledsection}
21919 % \protect\cs{print@leftmargin@eledsection} and \protect\cs{print@rightmargin@eledsection} are added by \macpackage\ inside the code of sectioning command, in order to affix lines numbers.
21920 % They include tests for RTL languages.
21921 % \begin{macrocode}
21922 \def\print@rightmargin@eledsection{%
21923 \if@eled@sectioning%
21924 \begingroup%
21925 \if@RTL%
21926 \let\llap\rlap%
21927 \let\leftlinenum\rightlinenum%
21928 \let\leftlinenumR\rightlinenumR%
21929 \let\l@drd@ta\l@dld@ta%
21930 \let\l@drsn@te\l@dlsn@te%
21931 \fi%
21932 \hfill\l@drd@ta \csuse{LR}{\l@drsn@te}%
21933 \endgroup%
21934 \fi%
21935 }%
21936
21937 \def\print@leftmargin@eledsection{%
21938 \if@eled@sectioning%
21939 \leavevmode%
21940 \begingroup%
21941 \if@RTL%
21942 \let\rlap\llap%
21943 \let\rightlinenum\leftlinenum%
21944 \let\rightlinenumR\leftlinenumR%
21945 \let\l@dld@ta\l@drd@ta%
21946 \let\l@dlsn@te\l@drsn@te%
21947 \fi%
21948 \l@dld@ta\csuse{LR}{\l@dlsn@te}%
21949 \endgroup%
21950 \fi%
21951 }%
21952
21953 % \end{macrocode}
21954 % \end{macro}
21955 % \end{macro}
21956 % \subsection{Patching standard commands}
21957 % \begin{macro}{\M@sect}
21958 % \begin{macro}{\@mem@old@ssect}
21959 % \begin{macro}{\@makechapterhead}
21960 % \begin{macro}{\@makechapterhead}
21961 % \begin{macro}{\@makeschapterhead}
21962 % \begin{macro}{\@sect}
21963 % \begin{macro}{\@ssect}
21964 % \changes{v1.12.5}{2014/08/28}{Debug \protect\cs{eledchapter} in parallel with \protect\package{memoir}}
21965 % \changes{v1.14.2}{2014/12/17}{Debug \protect\cs{edtext} after starred sectioning commands when using \protect\ltxclass{memoir} class.}
21966 % We have to patch \LaTeX, \protect\ltxclass{book} and \protect\ltxclass{memoir} sectioning commands in order to:
21967 % \begin{itemize}
21968 % \item Disable \protect\cs{edtext} inside.
21969 % \item Disable page breaking (for \protect\cs{chapter}).
21970 % \item Add line numbers and sidenotes.
21971 % \end{itemize}
21972 % Unfortunately, Maïeul Rouquette was not able to try if \protect\ltxclass{memoir} is loaded. That is why \protect\package{eledmac} tries to define for both standard class and \protect\ltxclass{memoir} class.
21973 %
21974 %
21975 % \begin{macrocode}
21976 \AtBeginDocument{%
21977
21978
21979 \pretocmd{\M@sect}
21980 {\let\old@edtext=\edtext%
21981 \let\edtext=\dummy@edtext@showlemma%
21982 }
21983 {}
21984 {}
21985
21986 \apptocmd{\M@sect}
21987 {\let\edtext=\old@edtext}
21988 {}
21989 {}
21990
21991 \patchcmd{\M@sect}
21992 { #9}
21993 { #9%
21994 \print@rightmargin@eledsection%
21995 }
21996 {}
21997 {}
21998
21999 \patchcmd{\M@sect}
22000 {\hskip #3\relax}
22001 {\hskip #3\relax%
22002 \print@leftmargin@eledsection%
22003 }
22004 {}
22005 {}
22006
22007 \patchcmd{\@mem@old@ssect}
22008 {#5}
22009 {#5%
22010 \print@leftmargin@eledsection%
22011 }
22012 {}
22013 {}
22014
22015 \patchcmd{\@mem@old@ssect}
22016 {\hskip #1}
22017 {\hskip #1%
22018 \print@rightmargin@eledsection%
22019 }
22020 {}
22021 {}
22022
22023
22024
22025 \patchcmd{\scr@startchapter}{\if@openright\cleardoublepage\else\clearpage\fi}{%
22026 \if@eled@sectioning\else%
22027 \ifl@dprintingpages\else%
22028 \if@openright\cleardoublepage\else\clearpage\fi%No clearpage inside a \Pages: will keep critical notes from printing on the title page. Here for scrbook.
22029 \fi%
22030 \fi%
22031 }
22032 {}
22033 {}
22034
22035 \patchcmd{\@makechapterhead}
22036 {#1}
22037 {\print@leftmargin@eledsection%
22038 #1%
22039 \print@rightmargin@eledsection%
22040 }
22041 {}
22042 {}
22043
22044 \patchcmd{\@makechapterhead}% For BIDI
22045 {\if@RTL\raggedleft\else\raggedright\fi}%
22046 {\if@eled@sectioning\else%
22047 \if@RTL\raggedleft\else\raggedright\fi%
22048 \fi%
22049 }%
22050 {}%
22051 {}%
22052
22053 \patchcmd{\@makeschapterhead}
22054 {#1}
22055 {\print@leftmargin@eledsection%
22056 #1%
22057 \print@rightmargin@eledsection%
22058 }
22059 {}
22060 {}
22061
22062 \pretocmd{\@sect}
22063 {\let\old@edtext=\edtext
22064 \let\edtext=\dummy@edtext@showlemma%
22065 }
22066 {}
22067 {}
22068
22069 \apptocmd{\@sect}
22070 {\let\edtext=\old@edtext}
22071 {}
22072 {}
22073
22074 \pretocmd{\@ssect}
22075 {\let\old@edtext=\edtext%
22076 \let\edtext=\dummy@edtext@showlemma%
22077 }
22078 {}
22079 {}
22080
22081 \apptocmd{\@ssect}
22082 {\let\edtext=\old@edtext}
22083 {}
22084 {}
22085
22086 % \end{macrocode}
22087 % \changes{v1.14.1}{2014/12/15}{Debug sectioning commands when using both \protect\package{handout} and \protect\package{hyperref} package.}
22088 % \protect\package{hyperref} also redefines \protect\cs{@sect}. That is why, when manipulating arguments, we patch \protect\cs{@sect} and the same only if \protect\package{hyperref} is not used. If it is, we patch the \protect\cs{H@old} commands.
22089 % \begin{macrocode}
22090 \ifdef{\H@old@sect}{%
22091
22092 \patchcmd{\H@old@sect}%
22093 {#8}
22094 {#8%
22095 \print@rightmargin@eledsection%
22096 }
22097 {}
22098 {}
22099
22100 \patchcmd{\H@old@sect}%
22101 {\hskip #3\relax}
22102 {\hskip #3\relax%
22103 \print@leftmargin@eledsection%
22104 }
22105 {}
22106 {}
22107
22108 \patchcmd{\H@old@@sect}%
22109 {#5}
22110 {#5%
22111 \print@rightmargin@eledsection%
22112 }
22113 {}
22114 {}
22115
22116 \patchcmd{\H@old@@sect}%
22117 {\hskip #1}
22118 {\hskip #1%
22119 \print@leftmargin@eledsection%
22120 }
22121 {}
22122 {}
22123 }%
22124 {
22125 \patchcmd{\@sect}
22126 {#8}
22127 {#8%
22128 \print@rightmargin@eledsection%
22129 }
22130 {}
22131 {}
22132
22133 \patchcmd{\@sect}
22134 {\hskip #3\relax}
22135 {\hskip #3\relax%
22136 \print@leftmargin@eledsection%
22137 }
22138 {}
22139 {}
22140
22141 \patchcmd{\@ssect}
22142 {#5}
22143 {#5%
22144 \print@rightmargin@eledsection%
22145 }
22146 {}
22147 {}
22148
22149 \patchcmd{\@ssect}
22150 {\hskip #1}
22151 {\hskip #1%
22152 \print@leftmargin@eledsection%
22153 }
22154 {}
22155 {}
22156 }%
22157 }%
22158 % \end{macrocode}
22159 % Close the \verb+\notbool{@noeled@sec}+ statement.
22160 % Also, we have finished patching the commands, using \# with a catcode equal to 12, so we are restoring the normal catcode for \#.
22161 % \begin{macrocode}
22162 {}}%
22163 \protect\catcode`\#=6 %Space NEEDS by \catcode
22164 % \end{macrocode}
22165 % \end{macro}
22166 % \end{macro}
22167 % \end{macro}
22168 % \end{macro}
22169 % \end{macro}
22170 % \end{macro}
22171 % \end{macro}
22172 % \begin{macro}{\chapter}
22173 % We patch the \protect\cs{chapter} command even if the \option{noeledsec} option is called, because we can use \cs{chapter} in the optional argument of a \cs{pstart} in parallel typesetting.
22174 % \begin{macrocode}
22175 \AtBeginDocument{%
22176 \patchcmd{\chapter}{\clearforchapter}{%
22177 \if@eled@sectioning\else%
22178 \ifl@dprintingpages\else%
22179 \clearforchapter%
22180 \fi%
22181 \fi%
22182 }%
22183 {}%
22184 {}%
22185
22186 \patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}{%
22187 \if@eled@sectioning\else%
22188 \ifl@dprintingpages%
22189 \endgraf%
22190 \else%
22191 \if@openright\cleardoublepage\else\clearpage\fi%No clearpage inside a \Pages: will keep critical notes from printing on the title page. Here for classical classes
22192 \fi%
22193 \fi%
22194 }%
22195 {}%
22196 {}%
22197 }%
22198 % \end{macrocode}
22199 % \end{macro}
22200 % \begin{macro}{\if@eled@sectioning}
22201 % The boolean \protect\cs{if@eled@sectioning} is set to true when a sectioning command is called by a \protect\cs{eledxxx} command, and set to false after. It is used to enable/disable line number printing.
22202 % \begin{macrocode}
22203 \newif\if@eled@sectioning%
22204 % \end{macrocode}
22205 % \end{macro}
22206 % We reopen a new \verb+\notbool{@noeled@sec}+ statement, as we will define the \cs{elesection} commands.
22207 % \begin{macrocode}
22208 \notbool{@noeled@sec}{%
22209 % \end{macrocode}
22210 % \subsection{Main code of \protect\cs{eledxxx} commands}
22211 % \begin{macro}{\eled@sectioning@out}
22212 % \protect\cs{eled@sectioning@out} is the output file, to dump the pstarts where a sectioning command is used.
22213 % \begin{macrocode}
22214 \newwrite\eled@sectioning@out
22215 % \end{macrocode}
22216 % \end{macro}
22217 % \begin{macro}{\eledchapter}
22218 % \begin{macro}{\eledsection}
22219 % \begin{macro}{\eledsubsection}
22220 % \begin{macro}{\eledsubsubsection}
22221 % \begin{macro}{\eledchapter*}
22222 % \begin{macro}{\eledsection*}
22223 % \begin{macro}{\eledsubsection*}
22224 % \begin{macro}{\eledsubsubsection*}
22225 % And now, the user sectioning commands, which write to the file, and also add content as a \enquote{normal} line.
22226 % \begin{macrocode}
22227 \newcommand{\eledchapter}[2][]{%
22228 \disable@familiarnotes%
22229 #2%
22230 \restore@familiarnotes%
22231 \ifledRcol%
22232 \immediate\write\eled@sectioningR@out{%
22233 \string\eled@chapter{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{}{R}
22234 }%
22235 \else%
22236 \immediate\write\eled@sectioning@out{%
22237 \string\eled@chapter{#1}{\unexpanded{#2}}{\the\pstarts@read@L}{}{}%
22238 }%
22239 \fi%
22240 }
22241
22242 \newcommand{\eledsection}[2][]{%
22243 \disable@familiarnotes%
22244 #2%
22245 \restore@familiarnotes%
22246 \ifledRcol%
22247 \immediate\write\eled@sectioningR@out{%
22248 \string\eled@section{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{}{R}
22249 }%
22250 \else%
22251 \immediate\write\eled@sectioning@out{%
22252 \string\eled@section{#1}{\unexpanded{#2}}{\the\pstarts@read@L}{}{}%
22253 }%
22254 \fi%
22255 }
22256
22257 \newcommand{\eledsubsection}[2][]{%
22258 \disable@familiarnotes%
22259 #2%
22260 \restore@familiarnotes%
22261 \ifledRcol%
22262 \immediate\write\eled@sectioningR@out{%
22263 \string\eled@subsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{}{R}
22264 }%
22265 \else%
22266 \immediate\write\eled@sectioning@out{%
22267 \string\eled@subsection{#1}{\unexpanded{#2}}{\the\pstarts@read@L}{}{}%
22268 }%
22269 \fi%
22270 }
22271 \newcommand{\eledsubsubsection}[2][]{%
22272 \disable@familiarnotes%
22273 #2%
22274 \restore@familiarnotes%
22275 \ifledRcol%
22276 \immediate\write\eled@sectioningR@out{%
22277 \string\eled@subsubsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{}{R}
22278 }%
22279 \else%
22280 \immediate\write\eled@sectioning@out{%
22281 \string\eled@subsubsection{#1}{\unexpanded{#2}}{\the\pstarts@read@L}{}{}%
22282 }%
22283 \fi%
22284 }
22285
22286
22287 \WithSuffix\newcommand\eledchapter*[2][]{%
22288 \disable@familiarnotes%
22289 #2%
22290 \restore@familiarnotes%
22291 \ifledRcol%
22292 \immediate\write\eled@sectioningR@out{%
22293 \string\eled@chapter{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{*}{R}
22294 }%
22295 \else%
22296 \immediate\write\eled@sectioning@out{%
22297 \string\eled@chapter{#1}{\unexpanded{#2}}{\the\pstarts@read@L}{*}{}%
22298 }%
22299 \fi%
22300 }
22301
22302 \WithSuffix\newcommand\eledsection*[2][]{%
22303 \disable@familiarnotes%
22304 #2%
22305 \restore@familiarnotes%
22306 \ifledRcol%
22307 \immediate\write\eled@sectioningR@out{%
22308 \string\eled@section{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{*}{R}
22309 }%
22310 \else%
22311 \immediate\write\eled@sectioning@out{%
22312 \string\eled@section{#1}{\unexpanded{#2}}{\the\pstarts@read@L}{*}{}%
22313 }%
22314 \fi%
22315 }
22316
22317 \WithSuffix\newcommand\eledsubsection*[2][]{%
22318 \disable@familiarnotes%
22319 #2%
22320 \restore@familiarnotes%
22321 \ifledRcol%
22322 \immediate\write\eled@sectioningR@out{%
22323 \string\eled@subsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{*}{R}
22324 }%
22325 \else%
22326 \immediate\write\eled@sectioning@out{%
22327 \string\eled@subsection{#1}{\unexpanded{#2}}{\the\pstarts@read@L}{*}{}%
22328 }%
22329 \fi%
22330 }
22331
22332 \WithSuffix\newcommand\eledsubsubsection*[2][]{%
22333 \disable@familiarnotes%
22334 #2%
22335 \restore@familiarnotes%
22336 \ifledRcol%
22337 \immediate\write\eled@sectioningR@out{%
22338 \string\eled@subsubsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{*}{R}
22339 }%
22340 \else%
22341 \immediate\write\eled@sectioning@out{%
22342 \string\eled@subsubsection{#1}{\unexpanded{#2}}{\the\pstarts@read@L}{*}{}%
22343 }%
22344 \fi%
22345 }
22346 % \end{macrocode}
22347 % \end{macro}
22348 % \end{macro}
22349 % \end{macro}
22350 % \end{macro}
22351 % \end{macro}
22352 % \end{macro}
22353 % \end{macro}
22354 % \end{macro}
22355 % \subsection{Macros written in the auxiliary file}
22356 % \begin{macro}{\eled@chapter}
22357 % \begin{macro}{\eled@section}
22358 % \begin{macro}{\eled@subsection}
22359 % \begin{macro}{\eled@subsubsection}
22360 % The sectioning macros, called in the auxiliary file. They have five arguments:
22361 % \begin{enumerate}
22362 % \item Optional arguments of \LaTeX\ sectioning command.
22363 % \item Mandatory arguments of \LaTeX\ sectioning command.
22364 % \item Pstart number.
22365 % \item Side: \verb+R+ if right, nothing if left.
22366 % \item Starred or not.
22367 % \end{enumerate}
22368 % \begin{macrocode}
22369 \def\eled@chapter#1#2#3#4#5{%
22370 \ifstrempty{#4}%
22371 {%
22372 \ifstrempty{#1}%
22373 {%
22374 \csgdef{eled@sectioning@#3#5}{\let\edtext=\dummy@edtext@showlemma\chapter{#2}}%
22375 \csgdef{eled@sectmark@#3#5}{\let\edtext=\dummy@edtext{}\chaptermark{#2}}%
22376 }%Need for \pairs, because of using parbox.
22377 {%
22378 \csgdef{eled@sectioning@#3#5}{\let\edtext=\dummy@edtext@showlemma\chapter[#1]{#2}}%
22379 \csgdef{eled@sectmark@#3#5}{\let\edtext=\dummy@edtext{}\chaptermark{#2}}%Need for \pairs, because of using parbox.
22380 }%
22381 }%
22382 {%
22383 \ifstrempty{#1}%
22384 {\csgdef{eled@sectioning@#3#5}{\let\edtext=\dummy@edtext@showlemma\chapter*{#2}}}%
22385 {\csgdef{eled@sectioning@#3#5}{\let\edtext=\dummy@edtext@showlemma\chapter*[#1]{#2}}}%Bug in LaTeX!
22386 }%
22387 \listcsgadd{eled@sections#5@@}{#3}%
22388 }
22389 \def\eled@section#1#2#3#4#5{%
22390 \ifstrempty{#4}%
22391 {\ifstrempty{#1}%
22392 {%
22393 \csgdef{eled@sectioning@#3#5}{\section{#2}}%
22394 \csgdef{eled@sectmark@#3#5}{\let\edtext=\dummy@edtext{}\sectionmark{#2}}%Need for \pairs, because of using parbox.
22395 }%
22396 {%
22397 \csgdef{eled@sectioning@#3#5}{\section[#1]{#2}}%
22398 \csgdef{eled@sectmark@#3#5}{\let\edtext=\dummy@edtext{}\sectionmark{#1}}%Need for \pairs, because of using parbox.
22399 }%
22400 }%
22401 {\ifstrempty{#1}%
22402 {\csgdef{eled@sectioning@#3#5}{\section*{#2}}}%
22403 {\csgdef{eled@sectioning@#3#5}{\section*[#1]{#2}}}%Bug in LaTeX!
22404 }
22405 \listcsgadd{eled@sections#5@@}{#3}%
22406 }
22407 \def\eled@subsection#1#2#3#4#5{%
22408 \ifstrempty{#4}%
22409 {\ifstrempty{#1}%
22410 {%
22411 \csgdef{eled@sectioning@#3#5}{\subsection{#2}}%
22412 \csgdef{eled@sectmark@#3#5}{\let\edtext=\dummy@edtext{}\csuse{subsectionmark}{#2}}%Need for \pairs, because of using parbox. \csuse in case of \subsectionmark is not defined (book)
22413 }%
22414 {%
22415 \csgdef{eled@sectioning@#3#5}{\subsection[#1]{#2}}%
22416 \csgdef{eled@sectmark@#3#5}{\let\edtext=\dummy@edtext{}\csuse{subsectionmark}{#1}}%Need for \pairs, because of using parbox. \csuse in case of \subsectionmark is not defined (book)
22417 }%
22418 }%
22419 {\ifstrempty{#1}%
22420 {\csgdef{eled@sectioning@#3#5}{\subsection*{#2}}}%
22421 {\csgdef{eled@sectioning@#3#5}{\subsection*[#1]{#2}}}%Bug in LaTeX!
22422 }
22423 \listcsgadd{eled@sections#5@@}{#3}%
22424 }
22425 \def\eled@subsubsection#1#2#3#4#5{%
22426 \ifstrempty{#4}%
22427 {\ifstrempty{#1}%
22428 {\csgdef{eled@sectioning@#3#5}{\subsubsection{#2}}}%
22429 {\csgdef{eled@sectioning@#3#5}{\subsubsection[#1]{#2}}}%
22430 }%
22431 {\ifstrempty{#1}%
22432 {\csgdef{eled@sectioning@#3#5}{\subsubsection*{#2}}}%
22433 {\csgdef{eled@sectioning@#3#5}{\subsubsection*[#1]{#2}}}%Bug in LaTeX!
22434 }
22435 \listcsgadd{eled@sections#5@@}{#3}%
22436 }
22437
22438 % \end{macrocode}
22439 % \end{macro}
22440 % \end{macro}
22441 % \end{macro}
22442 % \end{macro}
22443 % End of the conditional test about \verb+noeledsec+ option.
22444 % \begin{macrocode}
22445 }{}
22446 % \end{macrocode}
22447 % \section{Page breaking or no page breaking depending on specific lines}
22448 % By default, page breaks are automatic. However, the user can define lines which will force page breaks, or prevent page breaks around one specific line.
22449 % On the first run, the line-list file records the line number of where the page break is being changed (either forced, or prevented).
22450 % On the next run, page breaks occur either before or after this line, depending on how the user sets the command. The default setting is after the line.
22451 % \begin{macro}{\normal@page@break}
22452 % \protect\cs{normal@page@break} is an \protect\package{etoolbox} list which contains the absolute line number of the last line, for each page.
22453 % \begin{macrocode}
22454 \def\normal@page@break{}
22455 % \end{macrocode}
22456 % \end{macro}
22457 % \begin{macro}{\prev@pb}
22458 % \begin{macro}{\prev@nopb}
22459 % The \protect\cs{l@prev@pb} macro is a \protect\package{etoolbox} list, which contains the lines in which page breaks occur (before or after).
22460 % The \protect\cs{l@prev@nopb} macro is a \protect\package{etoolbox} list, which contains the lines with NO page break before or after.
22461 % \begin{macrocode}
22462 \def\l@prev@pb{}
22463 \def\l@prev@nopb{}
22464 % \end{macrocode}
22465 % \end{macro}
22466 % \end{macro}
22467 % \begin{macro}{\ledpb}
22468 % \begin{macro}{\ledpbnum}
22469 % \begin{macro}{\lednopb}
22470 % \begin{macro}{\lednopbnum}
22471 % The \protect\cs{ledpb} macro writes the call to \protect\cs{led@pb} in line-list file.
22472 % The \protect\cs{ledpbnum} macro writes the call to \protect\cs{led@pbnum} in line-list file.
22473 % The \protect\cs{lednopb} macro writes the call to \protect\cs{led@nopb} in line-list file.
22474 % The \protect\cs{lednopbnum} macro writes the call to \protect\cs{led@nopbnum} in line-list file.
22475 % \begin{macrocode}
22476 \newcommand{\ledpb}{\write\linenum@out{\string\led@pb}}
22477 \newcommand{\ledpbnum}[1]{\write\linenum@out{\string\led@pbnum{#1}}}
22478 \newcommand{\lednopb}{\write\linenum@out{\string\led@nopb}}
22479 \newcommand{\lednopbnum}[1]{\write\linenum@out{\string\led@nopbnum{#1}}}
22480 % \end{macrocode}
22481 % \end{macro}
22482 % \end{macro}
22483 % \end{macro}
22484 % \end{macro}
22485 % \begin{macro}{\led@pb}
22486 % \begin{macro}{\led@pbnum}
22487 % \begin{macro}{\led@nopb}
22488 % \begin{macro}{\led@nopbnum}
22489 % The \protect\cs{led@pb} adds the absolute line number in the \protect\cs{prev@pb} list.
22490 % The \protect\cs{led@pbnum} adds the argument in the \protect\cs{prev@pb} list.
22491 % The \protect\cs{led@nopb} adds the absolute line number in the \protect\cs{prev@nopb} list.
22492 % The \protect\cs{led@nopbnum} adds the argument in the \protect\cs{prev@nopb} list.
22493 % \begin{macrocode}
22494 \newcommand{\led@pb}{\listxadd{\l@prev@pb}{\the\absline@num}}
22495 \newcommand{\led@pbnum}[1]{\listxadd{\l@prev@pb}{#1}}
22496 \newcommand{\led@nopb}{\listxadd{\l@prev@nopb}{\the\absline@num}}
22497 \newcommand{\led@nopbnum}[1]{\listxadd{\l@prev@nopb}{#1}}
22498 % \end{macrocode}
22499 % \end{macro}
22500 % \end{macro}
22501 % \end{macro}
22502 % \end{macro}
22503 % \begin{macro}{\ledpbsetting}
22504 % \begin{macro}{\led@pb@setting}
22505 % The \protect\cs{ledpbsetting} macro only changes the value of \protect\cs{led@pb@macro}, for which the default value is \verb+before+.
22506 % \begin{macrocode}
22507 \def\led@pb@setting{before}
22508 \newcommand{\ledpbsetting}[1]{\gdef\led@pb@setting{#1}}
22509 % \end{macrocode}
22510 % \end{macro}
22511 % \end{macro}
22512 % \begin{macro}{\led@check@pb}
22513 % \begin{macro}{\led@check@nopb}
22514 % The \protect\cs{led@check@pb} and \protect\cs{led@check@nopb} are called before or after each line.
22515 % They check if a page break must occur, depending on the current line and on the content of \protect\cs{l@pb}.
22516 % \begin{macrocode}
22517 \newcommand{\led@check@pb}{\xifinlist{\the\absline@num}{\l@prev@pb}{\pagebreak[4]}{}}
22518 \newcommand{\led@check@nopb}{%
22519 \IfStrEq{\led@pb@setting}{before}{%
22520 \xifinlist{\the\absline@num}{\l@prev@nopb}%
22521 {\numdef{\abs@prevline}{\the\absline@num-1}%
22522 \xifinlist{\abs@prevline}{\normal@page@break}%
22523 {\nopagebreak[4]\enlargethispage{\baselineskip}}%
22524 {}}%
22525 {}}%
22526 {}%
22527 {}%
22528 \IfStrEq{\led@pb@setting}{after}{%
22529 \xifinlist{\the\absline@num}{\l@prev@nopb}{%
22530 \xifinlist{\the\absline@num}{\normal@page@break}%
22531 {\nopagebreak[4]\enlargethispage{\baselineskip}}%
22532 {}%
22533 }%
22534 {}}%
22535 {}%
22536 {}%
22537 }
22538 % \end{macrocode}
22539 % \end{macro}
22540 % \end{macro}
22541 % \section{Long verse: prevents being separated by a page break}
22542 % \begin{macro}{\iflednopbinverse}
22543 % The \protect\cs{lednopbinverse} boolean is set to false by default.
22544 % If set to true, \macpackage\ will automatically prevent page breaks inside verse.
22545 % The declaration is made at the beginning of the file, because it is used as a package option.
22546 % \end{macro}
22547 % \begin{macro}{\check@pb@in@verse}
22548 % The \protect\cs{check@pb@in@verse} checks if a verse is broken in two page.
22549 % If true, it adds:
22550 % \begin{itemize}
22551 % \item The absolute line number of the first line of the verse -1 in the \protect\cs{led@pb} list, if the page break must occur before the verse.
22552 % \item The absolute line number of the first line of the verse -1 in the \protect\cs{led@nopb} list, if the page break must occur after the verse.
22553 % \end{itemize}
22554 % \begin{macrocode}
22555 \newcommand{\check@pb@in@verse}{%
22556 \ifinstanza\iflednopbinverse\ifinserthangingsymbol% Using stanzas and enabling page breaks in verse control, while on a hanging verse.
22557 \ifnum\page@num=\last@page@num\else%If we have change page
22558 \IfStrEq{\led@pb@setting}{before}{%
22559 \numgdef{\abs@line@verse}{\the\absline@num-1}%
22560 \ledpbnum{\abs@line@verse}%
22561 }{}%
22562 \IfStrEq{\led@pb@setting}{after}{%
22563 \numgdef{\abs@line@verse}{\the\absline@num-1}%
22564 \lednopbnum{\abs@line@verse}%
22565 }{}%
22566 \fi%
22567 \fi\fi\fi%
22568 }
22569 % \end{macrocode}
22570 % \end{macro}
22571 % \section{Tools for \package{hyperref} package}
22572 % \begin{macro}{\Hy@raisedlink@left}
22573 % The \package{hyperref} package provides a \cs{Hy@raisedlink} command, to be used to add an anchor to the top of a line and not to the bottom of it.\footnote{\url{http://tex.stackexchange.com/a/17138/7712}.}
22574 %
22575 % However, this command disrupts the line breaking mechanism when it is called before any word.
22576 % This is why \macpackage\ defines \cs{Hy@raisedlink@left} that is called to the left of words, at the beginning of \cs{edtext} or inside the \cs{edlabel} commands.\footnote{The code is inspired by an answer given by @unbonpetit.
22577 % Thanks to him.
22578 % \url{http://texnique.fr:80/osqa/questions/781/hyraisedlink-perturbe-la-maniere-dont-se-fait-la-coupure-de-ligne/801}.}
22579 %
22580 % \begin{macrocode}
22581 \def\Hy@raisedlink@left#1{%
22582 \ifvmode
22583 #1%
22584 \else
22585 \Hy@SaveSpaceFactor
22586 \llap{\smash{%
22587 \begingroup
22588 \let\HyperRaiseLinkLength\@tempdima
22589 \setlength\HyperRaiseLinkLength\HyperRaiseLinkDefault
22590 \HyperRaiseLinkHook
22591 \expandafter\endgroup
22592 \expandafter\raise\the\HyperRaiseLinkLength\hbox{%
22593 \Hy@RestoreSpaceFactor
22594 #1%
22595 \Hy@SaveSpaceFactor
22596 }%
22597 }}%
22598 \Hy@RestoreSpaceFactor
22599 \penalty\@M\hskip\z@\relax
22600 \fi
22601 }
22602 % \end{macrocode}
22603 % \end{macro}
22604 % To deal with \verb+footnotemarkX+ and \verb+\footnoteXtext+ commandes in relation with hyperref, we need to generate unique identfier for footnote, called \verb+hr@thefnmarkX+ (where X stands for the footnote series letter).
22605 %
22606 % But to generate this unique number, we need to know when the footnoteX counter is reset.
22607 % So we need to patch both \cs{setcounter} and \cs{@stpelt} macros.
22608 % \begin{macrocode}
22609
22610 \apptocmd{\setcounter}{%
22611 \ifboolexpr{%
22612 test {\ifnumequal{#2}{0}}%
22613 and%
22614 test {\ifcsdef{#1@series}}%
22615 }%
22616 {%
22617 \global\advance\expandafter\csname #1@series\endcsname by 1%
22618 }%
22619 {}%
22620 }%
22621 {}%
22622 {\led@error@fail@patch@setcounter}%
22623 \apptocmd{\@stpelt}{%
22624 \ifcsdef{#1@series}{%
22625 \global\advance\expandafter\csname #1@series\endcsname by 1%
22626 }%
22627 {}%
22628 }%
22629 {}%
22630 {\led@error@fail@patch@stpelt}%
22631 % \end{macrocode}
22632 % \section{Compatibility with \eledmac}
22633 %
22634 % Here, we define some commands for the \verb+eledmac-compat+ option.
22635 %
22636 % \begin{macrocode}
22637 \ifeledmaccompat@%
22638
22639 \newcommand{\footnormalX}[1]{\arrangementX[#1]{normal}}%
22640 \newcommand{\footparagraphX}[1]{\arrangementX[#1]{paragraph}}%
22641 \newcommand{\foottwocolX}[1]{\arrangementX[#1]{twocol}}%
22642 \newcommand{\footthreecolX}[1]{\XarrangementX[#1]{threecol}}%
22643
22644 \unless\ifnocritical@
22645 \newcommand{\footnormal}[1]{\Xarrangement[#1]{normal}}%
22646 \newcommand{\footparagraph}[1]{\Xarrangement[#1]{paragraph}}%
22647 \newcommand{\foottwocol}[1]{\Xarrangement[#1]{twocol}}%
22648 \newcommand{\footthreecol}[1]{\Xarrangement[#1]{threecol}}%
22649 \let\hsizetwocol\Xhsizetwocol
22650 \let\hsizethreecol\Xhsizethreecol
22651 \let\bhookXnote\Xbhooknote
22652 \let\boxsymlinenum\Xboxsymlinenum
22653 \let\symlinenum\Xsymlinenum
22654 \let\beforenumberinfootnote\Xbeforenumber
22655 \let\afternumberinfootnote\Xafternumber
22656 \let\beforeXsymlinenum\Xbeforesymlinenum
22657 \let\afterXsymlinenum\Xaftersymlinenum
22658 \let\inplaceofnumber\Xinplaceofnumber
22659 \let\Xlemmaseparator\lemmaseparator
22660 \let\afterlemmaseparator\Xafterlemmaseparator
22661 \let\beforelemmaseparator\Xbeforelemmaseparator
22662 \let\inplaceoflemmaseparator\Xinplaceoflemmaseparator
22663 \let\txtbeforeXnotes\Xtxtbeforenotes
22664 \let\afterXrule\Xafterrule
22665 \let\numberonlyfirstinline\Xnumberonlyfirstinline
22666 \let\numberonlyfirstintwolines\Xnumberonlyfirstintwolines
22667 \let\nonumberinfootnote\Xnonumberinfootnote
22668 \let\pstartinfootnote\Xpstart
22669 \let\pstartinfootnoteeverytime\Xpstarteverytime
22670 \let\onlyXpstart\Xonlypstart
22671 \let\Xnonumberinfootnote\Xnonumber
22672 \let\nonbreakableafternumber\Xnonbreakableafternumber
22673 \let\maxhXnotes\Xmaxhnotes
22674 \let\beforeXnotes\Xbeforenotes
22675 \let\boxlinenum\Xboxlinenum
22676 \let\boxlinenumalign\Xboxlinenumaligm
22677 \let\boxstartlinenum\Xboxstartlinenum
22678 \let\boxendlinenum\Xboxendlinenum
22679 \let\twolines\Xtwolines
22680 \let\morethantwolines\Xmorethantwolines
22681 \let\twolinesbutnotmore\Xtwolinesbutnotmore
22682 \let\twolinesonlyinsamepage\Xtwolinesonlyinsamepage
22683 \fi
22684
22685 \unless\ifnofamiliar@
22686 \let\notesXwidthliketwocolumns\noteswidthliketwocolumnsX
22687 \fi
22688 \newcommandx{\parafootsep}[2][1,usedefault]{%
22689 \Xparafootsep[#1]{#2}%
22690 \parafootsepX[#1]{#2}
22691 }%
22692
22693 \newcommandx{\afternote}[2][1,usedefault]{%
22694 \Xafternote[#1]{#2}%
22695 \afternoteX[#1]{#2}%
22696 }%
22697
22698 \unless\ifnoend@
22699 \let\XendXtwolines\Xendtwolines
22700 \let\XendXmorethantwolines\Xendmorethantwolines
22701 \let\bhookXendnote\Xendbhooknote
22702 \let\boxXendlinenum\Xendboxlinenum%
22703 \let\boxXendlinenumalign\Xendboxlinenumalign%
22704 \let\boxXendstartlinenum\Xendboxstartlinenum%
22705 \let\boxXendendlinenum\Xendboxendlinenum%
22706 \let\XendXlemmaseparator\Xendlemmaseparator
22707 \let\XendXbeforelemmaseparator\Xendbeforelemmaseparator
22708 \let\XendXafterlemmaseparator\Xendafterlemmaseparator
22709 \let\XendXinplaceoflemmaseparator\Xendinplaceoflemmaseparator
22710 \fi
22711
22712 \AtBeginDocument{%
22713 \ifdef\lineref{}{\let\lineref\edlineref}%
22714 }%
22715
22716
22717 \fi%
22718 % \end{macrocode}
22719 %
22720 %</code>
22721 % \newpage
22722 % \appendix
22723 % \let\oldthesection\thesection
22724 % \renewcommand{\thesection}{Appendix \oldthesection}
22725 % \renewcommand{\thesubsection}{\oldthesection.\arabic{subsection}}
22726 % \section{Things to do when changing versions}
22727 % \input{doc-include/migrate-mac.dtx}
22728 % \section{Auxiliary softwares}
22729 % This appendix lists some software and tools related to \package{reledmac} that may be useful.
22730 % \subsection{\emph{samewords}}
22731 % The \emph{samewords} program (Michael Stenskjær Christensen) automatically adds \cs{sameword} commands (\reff{sameword}) into a \verb+.tex+ file. \\
22732 % \url{https://samewords.readthedocs.io/en/latest/}
22733 % \subsection{critical-keys for \emph{Emacs}}
22734 % The \emph{Emacs} editor has a package to help inserting \macpackage's commands (Juan Manuel Macías Chaín).\\
22735 % \url{https://gitlab.com/maciaschain/critical-keys}
22736 % \subsection{org-critical-edition for \emph{Emacs} and \emph{Org Mode}}
22737 % This \emph{Emacs} library lets you prepare a critical edition in Org Mode
22738 % with \LaTeX and \macpackage output (Juan Manuel Macías Chaín)
22739 % \url{https://gitlab.com/maciaschain/org-critical-edition}
22740 %\subsection{Import from TEI}
22741 % \subsection{Import from TEI}
22742 % There are multiple tools to convert from XML-TEI to \emph{reledmac}. Here is a non exhaustive-list:
22743 % \begin{itemize}
22744 % \item \url{http://ciham-digital.huma-num.fr/teicat/}
22745 % \item \url{https://github.com/fizzbucket/tei_transformer}
22746 % \item \url{https://github.com/TEIC/Stylesheets}
22747 % \item \url{http://lombardpress.org/print/}
22748 % \item \url{https://github.com/Jean-Baptiste-Camps/TEItoLaTeX}
22749 % \end{itemize}
22750 % Please, tell us if you know of other tools.
22751 % \clearpage
22752 % \bibliographystyle{alpha}
22753 % \phantomsection
22754 % \addcontentsline{toc}{section}{References}
22755 % \begin{thebibliography}{WWW99}
22756 %
22757 % \bibitem[Bre96]{TABMAC}
22758 % Herbert Breger.
22759 % \newblock \tabmac.
22760 % \newblock October 1996.
22761 % \newblock (Available from CTAN in
22762 % \texttt{macros/plain/contrib/tabmac})
22763 %
22764 % \bibitem[Bur01]{POEMSCOLTUG}
22765 % John Burt.
22766 % \newblock \enquote{Typesetting critical editions of poetry}.
22767 % \newblock \emph{TUGboat}, \textbf{22}, 4, pp 353--361, December 2001.
22768 % \newblock (Code available from CTAN in
22769 % \texttt{macros/latex/contrib/poemscol})
22770 %
22771 % \bibitem[Eck03]{PARALLEL}
22772 % Matthias Eckermann.
22773 % \newblock \emph{The \protect\package{Parallel}-Package}.
22774 % \newblock April 2003.
22775 % \newblock (Available from CTAN in
22776 % \texttt{macros/latex/contrib/parallel})
22777 %
22778 % \bibitem[Fai03]{FOOTMISC}
22779 % Robin Fairbairns.
22780 % \newblock \emph{\protect\package{footmisc}\,---\,a portmanteau package for
22781 % customising footnotes in \LaTeX}.
22782 % \newblock February 2003.
22783 % \newblock (Available from CTAN in
22784 % \texttt{macros/latex/contrib/footmisc})
22785 %
22786 %
22787 % \bibitem[LW90]{EDMACTUG}
22788 % John Lavagnino and Dominik Wujastyk.
22789 % \newblock \enquote{An overview of \edmac: a \textsc{Plain} TeX format for
22790 % critical editions}.
22791 % \newblock \emph{TUGboat}, \textbf{11}, 4, pp. 623--643, November 1990.
22792 % \newblock (Code available from CTAN in
22793 % \texttt{macros/plain/contrib/edmac})
22794 %
22795 % \bibitem[L\"{u}c03]{EDNOTES}
22796 % Uwe L\"{u}ck.
22797 % \newblock \enquote{\textsf{ednotes}\,---\,critical edition typesetting with LaTeX}.
22798 % \newblock \emph{TUGboat}, \textbf{24}, 2, pp. 224--236, 2003.
22799 % \newblock (Code available from CTAN in
22800 % \texttt{macros/latex/contrib/ednotes})
22801 %
22802 % \bibitem[Sul92]{EDSTANZA}
22803 % Wayne G.~Sullivan.
22804 % \newblock \emph{The file \texttt{edstanza.doc}}.
22805 % \newblock June 1992.
22806 % \newblock (Available from CTAN in
22807 % \texttt{macros/plain/contrib/edmac})
22808 %
22809 % \bibitem[Wil02]{MEMOIR}
22810 % Peter Wilson.
22811 % \newblock \emph{The \protect\package{memoir} class for configurable typesetting}.
22812 % \newblock November 2002.
22813 % \newblock (Available from CTAN in
22814 % \texttt{macros/latex/contrib/memoir})
22815 %
22816 % \bibitem[Wil04]{ELEDPAR}
22817 % Peter Wilson and Maïeul Rouquette.
22818 % \newblock \emph{Parallel typesetting for critical editions:
22819 % the \protect\package{eledpar} package}.
22820 % \newblock December 2004.
22821 % \newblock (Available from CTAN in
22822 % \texttt{macros/latex/contrib/ledmmac})
22823 %
22824 % \end{thebibliography}
22825 %
22826 % \Finale
22827 % \phantomsection
22828 % \addcontentsline{toc}{section}{Index}
22829 % \PrintIndex
22830 %
22831 % \phantomsection
22832 % \addcontentsline{toc}{section}{Change History}
22833 % \PrintChanges
22834 % \endinput
22835 \endinput
22836
22837 % \CharacterTable
22838 % {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
22839 % 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
22840 % Digits \0\1\2\3\4\5\6\7\8\9
22841 % Exclamation \! Double quote \" Hash (number) \#
22842 % Dollar \$ Percent \% Ampersand \&
22843 % Acute accent \' Left paren \( Right paren \)
22844 % Asterisk \* Plus \+ Comma \,
22845 % Minus \- Point \. Solidus \/
22846 % Colon \: Semicolon \; Less than \<
22847 % Equals \= Greater than \> Question mark \?
22848 % Commercial at \@ Left bracket \[ Backslash \\
22849 % Right bracket \] Circumflex \^ Underscore \_
22850 % Grave accent \` Left brace \{ Vertical bar \|
22851 % Right brace \} Tilde \~}
22852 %