From 7fedc07f5bf2af21c86a237957790cb6fdce78a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=AFeul=20Rouquette?= Date: Thu, 16 Jul 2015 22:05:23 +0200 Subject: [PATCH] =?UTF-8?q?pour=20r=C3=A9soudre=20#348,=20on=20cr=C3=A9e?= =?UTF-8?q?=20un=20fichier=20par=20s=C3=A9rie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- doc-include/migrate-mac.dtx | 2 + reledmac.dtx | 84 ++++++++++++++++++++++--------------- 3 files changed, 54 insertions(+), 34 deletions(-) diff --git a/.gitignore b/.gitignore index 4510e301..e2bf8288 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ *.out *.toc *.gz -*.end +*.?end *.xdy *.eledsec1* *.eledsec2* diff --git a/doc-include/migrate-mac.dtx b/doc-include/migrate-mac.dtx index 85a69e62..99fdebe2 100644 --- a/doc-include/migrate-mac.dtx +++ b/doc-include/migrate-mac.dtx @@ -348,3 +348,5 @@ % \hline % \cs{lineref} & \cs{edlineref} \\ % \end{longtable} +% \subsubsection{Endnotes} +% With \reledmac, there are now one auxiliary files by endnotes (.Aend, .Bend, .Cend etc.). If you have overriden \cs{doendnotes}, that you should not have, you should adapt it. \ No newline at end of file diff --git a/reledmac.dtx b/reledmac.dtx index 9e5f48c6..c5e93608 100644 --- a/reledmac.dtx +++ b/reledmac.dtx @@ -308,6 +308,7 @@ % \changes{v2.0.0}{2015/06/28}{Add nonum option for endnotes.} % \changes{v2.0.0}{2015/06/28}{Add \cs{Xendinplaceofnumber} hook.} % \changes{v2.0.0}{2015/06/28}{Add \cs{Xendnonumber} hook.} +% \changes{v2.0.0}{2015/06/28}{Fix bug when printing only one series of endnotes, but wanted to keep endnotes for other series.} % \hyphenation{man-u-script man-u-scripts} % % @@ -670,7 +671,7 @@ % the second section, and so on), and then creates a new version of % this auxiliary file to collect information during this run. The % first instance of \cs{beginnumbering} also opens a file called -% \meta{jobname}\file{.end} to receive the text of the endnotes. +% \meta{jobname}\file{.\meta{series}end} to receive the text of the endnotes. % \cs{endnumbering} closes the \meta{jobname}.\file{nn} file. % % If the line numbering of a text is to be continuous from start to end, @@ -3264,10 +3265,8 @@ \newif\ifnoend@% \DeclareOptionX{noend}{% \let\l@dend@open\@gobble% - \let\l@d@end\relax \let\l@dend@close\relax% \global\let\l@dend@stuff=\relax% - \global\chardef\l@d@end=16% \noend@true% }% @@ -10818,22 +10817,6 @@ % \begin{macrocode} \ifbool{noend@}{}{%Used instead of \ifnoend@ to prevent expansion problem % \end{macrocode} -% \begin{macro}{\l@d@end} -% \begin{macro}{\ifl@dend@} -% \begin{macro}{\l@dend@true} -% \begin{macro}{\l@dend@false} -% Endnotes of all varieties are saved up in a file, typically named -% \meta{jobname}\file{.end}. -% \cs{l@d@end} is the output stream number for -% this file, and \cs{ifl@dend@} is a flag that is \verb"true" when the file is open. -% \begin{macrocode} -\newwrite\l@d@end -\newif\ifl@dend@ -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % % \begin{macro}{\l@dend@open} % \begin{macro}{\l@dend@close} @@ -10843,9 +10826,20 @@ % line numbers for the endnotes are generated by the same mechanism % we use for the footnotes, so that there is no need to defer any % writing to catch information from the output routine. -% \begin{macrocode} -\newcommand{\l@dend@open}[1]{\global\l@dend@true\immediate\openout\l@d@end=#1\relax} -\newcommand{\l@dend@close}{\global\l@dend@false\immediate\closeout\l@d@end} +% The argument of these two command is the series letter. +% \begin{macrocode} +\newcommand{\l@dend@open}[1]{% + \global\booltrue{l@dend@#1}% + \expandafter\immediate% + \expandafter\openout% + \csname l@d@#1end\endcsname% + =\jobname.#1end\relax% +}% +\newcommand{\l@dend@close}[1]{% + \global\boolfalse{l@dend@#1}% + \expandafter\immediate% + \expandafter\closeout\csname l@d@#1end\endcsname% +}% % \end{macrocode} % \end{macro} @@ -10858,10 +10852,13 @@ % and writes the section number to the endnote file. % \begin{macrocode} \newcommand{\l@dend@stuff}{% - \ifl@dend@\relax\else - \l@dend@open{\jobname.end}% - \fi - \immediate\write\l@d@end{\string\l@d@section{\the\section@num}}} + \def\do##1{% + \ifbool{l@dend@##1}{}% + {\l@dend@open{##1}}% + \expandafter\immediate\expandafter\write\csname l@d@##1end\endcsname{\string\l@d@section{\the\section@num}}% + }% + \dolistloop{\@series}% +}% % \end{macrocode} % \end{macro} @@ -11126,11 +11123,12 @@ % \cs{Xendinsertsep@} is set to true at the first note of the series, and to false at the last one. % \begin{macrocode} \newif\ifXendinsertsep@% -\newcommand*{\doendnotes}[1]{\l@dend@close +\newcommand*{\doendnotes}[1]{% + \l@dend@close{#1}% \begingroup \makeatletter \expandafter\let\csname #1end\endcsname=\endprint - \input\jobname.end + \input\jobname.#1end% \global\Xendinsertsep@false% \endgroup} % \end{macrocode} @@ -11142,7 +11140,7 @@ % \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. % \begin{macrocode} \newcommand*{\doendnotesbysection}[1]{% - \l@dend@close% + \l@dend@close{#1}% \global\expandafter\advance\csname #1end@bysection\endcsname by 1% \begingroup% \makeatletter% @@ -11151,7 +11149,7 @@ {\cslet{#1end}{\endprint}}% {\cslet{#1end}{\@gobblefive}}% }% - \input\jobname.end% + \input\jobname.#1end% \global\Xendinsertsep@false% \endgroup% }% @@ -11390,16 +11388,36 @@ \fi % \end{macrocode} % \subsection{The endnotes} +% \changes{v2.0.0}{2015/06/28}{One endnotes file by series.} % Endnotes are commands like \cs{Xendnote}, where X is a series letter. % First, we check for the \verb+noend+ options. % \begin{macrocode} \unless\ifnoend@ % \end{macrocode} +% \subsubsection{The auxiliary file} +% \begin{macro}{\l@d@Xend} +% \begin{macro}{\ifl@dend@X} +% \begin{macro}{\l@dend@Xtrue} +% \begin{macro}{\l@dend@Xfalse} +% Endnotes of all varieties are saved up in a file, one by series, typically named +% \meta{jobname}\file{.Xend}. +% \cs{l@d@end} is the output stream number for +% this file, and \cs{ifl@dend@X} is a flag that is \verb"true" when the file is open. +% +% +% \begin{macrocode} + \expandafter\newwrite\csname l@d@#1end\endcsname% + \expandafter\newif\csname ifl@dend@#1\endcsname% +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % \subsubsection{The main macro} % The \cs{Xendnote} macro functions to -% write one endnote to the \file{.end} file. We change +% write one endnote to the \file{.Xend} file. We change % \cs{newlinechar} so that in the file every space becomes the -% start of a new line; this generally ensures that a long note doesn't +% start of a new line; this generally ensures that a long note does not % exceed restrictions on the length of lines in files. % \begin{macrocode} @@ -11408,7 +11426,7 @@ \newlinechar='40% \global\@noneed@Footnotetrue% \newcommand{\content}{##2}% - \immediate\write\l@d@end{% + \expandafter\immediate\expandafter\write\csname l@d@#1end\endcsname{% \expandafter\string\csname #1end\endcsname% {\ifnumberedpar@\l@d@nums\fi}% {\ifnumberedpar@\expandonce\@tag\fi}%