diff options
author | Karl Berry <karl@freefriends.org> | 2021-03-01 22:39:52 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-03-01 22:39:52 +0000 |
commit | 6df23e6dac0dcc83bb0f3d7efd43fcc41b62a965 (patch) | |
tree | 4b628876c73447a553577261061797f227424e0f /Master/texmf-dist/source/latex/reledmac | |
parent | bf8f176f04e36ea6cf1beccef81651084084cfad (diff) |
reledmac (1mar21)
git-svn-id: svn://tug.org/texlive/trunk@58027 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/reledmac')
-rw-r--r-- | Master/texmf-dist/source/latex/reledmac/reledmac.dtx | 126 |
1 files changed, 86 insertions, 40 deletions
diff --git a/Master/texmf-dist/source/latex/reledmac/reledmac.dtx b/Master/texmf-dist/source/latex/reledmac/reledmac.dtx index af00ef41de0..7fe954be7f8 100644 --- a/Master/texmf-dist/source/latex/reledmac/reledmac.dtx +++ b/Master/texmf-dist/source/latex/reledmac/reledmac.dtx @@ -573,7 +573,10 @@ % \changes{v2.35.1}{2020/12/20}{Fix a bug when printing ending page number in endnotes and using the \protect\package{hyperref} package.} % \changes{v2.36.0}{2021/01/21}{Fix bug with sublineation on right side of parallel typesetting.} % \changes{v2.36.0}{2021/01/21}{Add \protect\cs{Xnonote} and \protect\cs{nonoteX}.} -% \changes{v2.36.0}{2021/02/14}{Fix bug with crossreferecing in parallel typesetting (added in v2.34.4)} +% \changes{v2.36.1}{2021/02/14}{Fix bug with crossreferencing in parallel typesetting (added in v2.34.4)} +% \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.} +% \changes{v2.37.0}{2021/02/28}{Fix bug with \protect\cs{Xnonote}} +% \changes{v2.37.0}{2021/02/28}{Improve syntaxis check.} % Typeset scholarly editions with \LaTeX\thanks{This file (\dtxfilename) % has version number \fileversion, last revised \filedate.}} % @@ -4460,7 +4463,7 @@ % \begin{macrocode} %<*code> \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{reledmac}[2021/02/14 v2.36.1 typesetting critical editions]% +\ProvidesPackage{reledmac}[2021/02/28 v2.37.0 typesetting critical editions]% % \end{macrocode} % % \subsection{Package options} @@ -5019,17 +5022,17 @@ }% % \end{macrocode} % \end{macro} -% \begin{macro}{\led@err@EdtextWithoutFootnote} +% \begin{macro}{\led@err@EdtextWithoutNote} % \begin{macrocode} -\newcommand{\led@err@EdtextWithoutFootnote}{% - \reledmac@error{edtext without Xfootnote. Check syntaxis}{\@ehc}% +\newcommand{\led@err@EdtextWithoutNote}[1]{% + \reledmac@error{edtext `\unexpanded{#1}` without Xfootnote or Xendnote. Check syntaxis.}{\@ehc}% }% % \end{macrocode} % \end{macro} % \begin{macro}{\led@err@FootnoteNotInSecondArgEdtext} % \begin{macrocode} \newcommand{\led@err@FootnoteNotInSecondArgEdtext}[1]{% - \reledmac@error{#1footnote outside of the second argument of an edtext. Check syntax}{\@ehc}% + \reledmac@error{#1footnote outside of the second argument of an edtext. Check syntaxis.}{\@ehc}% }% % \end{macrocode} % \end{macro} @@ -7593,8 +7596,6 @@ % \end{macrocode} % \end{macro} % \end{macro} -% \begin{macro}{\if@noneed@Footnote} -% \protect\cs{if@noneed@Footnote} is a boolean to check if we have to print a error message when a \protect\cs{edtext} is called without any critical notes. % % \begin{macro}{\flag@start} % \begin{macro}{\flag@end} @@ -7607,41 +7608,30 @@ % setting the value of \protect\cs{insert@count} appropriately; it % actually gets done by the various footnote macros. % \begin{macrocode} -\newif\if@noneed@Footnote% \newcommand*{\flag@start}{% \ifledRcol% \edef\next{\write\linenum@outR{% \string\@ref[\the\insert@countR][}}% - \next% - \ifnum\insert@countR<1% - \if@noneed@Footnote\else% - \led@err@EdtextWithoutFootnote% - \fi% - \fi% \else% \edef\next{\write\linenum@out{% \string\@ref[\the\insert@count][}}% - \next% - \ifnum\insert@count<1% - \if@noneed@Footnote\else% - \led@err@EdtextWithoutFootnote% - \fi% - \fi% - \fi}% + \fi% + \next% +}% \newcommand*{\flag@end}{% \ifledRcol% \write\linenum@outR{]}% \else% \write\linenum@out{]}% - \fi}% + \fi% +}% % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} % \begin{macro}{\flag@start@RTL} % \begin{macro}{\flag@end@RTL} % 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.} @@ -8133,6 +8123,24 @@ \renewcommand{\theedtext}{edtxt@\the\c@edtext}% % \end{macrocode} % \end{macro} +% \begin{macro}{\edtext@notes} +% \begin{macro}{\edtext@notes@start} +% 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}. +% +% The \cs{edtext@notes@start} is let to \cs{edtext@notes} at the beginning of a \cs{edtext} +% +% \begin{macrocode} +\newcount\edtext@notes% +\newcount\edtext@notes@start% +% \end{macrocode} +% \end{macro} +% \end{macro} +% \begin{macro}{\if@noneed@notes} +% 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. +% \begin{macrocode} +\newif\if@noneed@notes% +% \end{macrocode} +% \end{macro} % \begin{macro}{\edtext} % \changes{v0.4.0}{2004/02/29}{Added \protect\cs{showlemma} to \protect\cs{edtext}} % \changes{v1.4.0}{2012/11/16}{Compatibility of \protect\cs{edtext} with the right-to-left direction (with Polyglossia).} @@ -8154,6 +8162,10 @@ % \begin{macrocode} \global\advance\@edtext@level by 1% % \end{macrocode} +% We let \cs{edtext@notes@start} equal to \cs{edtext@notes} to check later the number of notes associated to the edtext. +% \begin{macrocode} + \global\edtext@notes@start=\edtext@notes% +% \end{macrocode} % 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. % % 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}. @@ -8227,6 +8239,14 @@ \ignorespaces #2\relax% \@edtext@secondarg@false% % \end{macrocode} +% Check if we inded insert footnotes or critical notes. +% \begin{macrocode} + \ifnum\edtext@notes=\edtext@notes@start% + \unless\if@noneed@notes% + \led@err@EdtextWithoutNote{#1}% + \fi% + \fi% +% \end{macrocode} % 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. % \begin{macrocode} \if@RTL% @@ -8292,7 +8312,6 @@ % \item The one that says we are inside a \protect\cs{@lemma}. % \end{itemize} % \begin{macrocode} - \global\@noneed@Footnotefalse% \global\advance\@edtext@level by -1% \global\@lemmacommand@false% % \end{macrocode} @@ -12923,7 +12942,10 @@ % \begin{macrocode} \pretocmd{\@footnotetext}{% \ifnumberedpar@ - \edtext{}{\l@dbfnote{#1}}% + \edtext{}{% + \advance \edtext@notes by 1% + \l@dbfnote{#1}% + }% \else }{}{} \apptocmd{\@footnotetext}{\fi}{}{}% @@ -13360,7 +13382,10 @@ \newcommand{\vnumfootnoteX}[3]{% \ifnumberedpar@ - \edtext{}{\normalbfnoteX{#1}{#2}{#3}}% + \edtext{}{% + \advance\edtext@notes by 1% + \normalbfnoteX{#1}{#2}{#3}% + }% \else \def\this@footnoteX@reading{\the\csname footnote#1@reading\endcsname}% \get@thisfootnoteX{#1}% @@ -15074,6 +15099,7 @@ % \begin{macrocode} \global\notbool{parapparatus@}{\expandafter\newcommand\expandafter *}{\expandafter\newcommand}\csname #1footnote\endcsname[2][]{% \nottoggle{Xnonote@#1}{% + \advance \edtext@notes by 1% \if@edtext@secondarg@% \ifledRcol% \ifcsstring{Xonlyside@#1}{L}{\led@error@note@called@onrightside{#1footnote}}{}% @@ -15170,7 +15196,7 @@ \else% \led@err@FootnoteNotInSecondArgEdtext{#1}% \fi% - }{\@noneed@Footnotetrue}% End of \nottoggle{Xnonote@#1}{% + }{\@noneed@notestrue}% End of \nottoggle{Xnonote@#1}{% \ignorespaces% } % \end{macrocode} @@ -15377,9 +15403,9 @@ % \begin{macrocode} \global\expandafter\newcommandx\csname #1endnote\endcsname[2][1,usedefault]{% + \advance \edtext@notes by 1% \bgroup% \newlinechar='40% - \global\@noneed@Footnotetrue% \newcommand{\content}{##2}% \stepcounter{labidx}% \expandafter\immediate\expandafter\write\csname l@d@#1end\endcsname{% @@ -17619,22 +17645,42 @@ % \begin{macro}{\ledinnernote} % \begin{macro}{\ledouternote} % \begin{macro}{\ledsidenote} +% \begin{macro}{\ledsidenote@} % \protect\cs{ledleftnote}, \protect\cs{ledrightnote}, \protect\cs{ledinnernote}, \protect\cs{ledouternote} are the % user commands for left, right, inner and outer sidenotes. % The two last ones are just alias for the two first ones, depending on the page number. % \protect\cs{ledsidenote}\marg{text} is the command for a moveable sidenote. +% +% All these macro call the macro \cs{ledsidenote@}, as they have the same structure. % \begin{macrocode} -\newcommand*{\ledleftnote}[1]{\edtext{}{\l@dlsnote{#1}}} -\newcommand*{\ledrightnote}[1]{\edtext{}{\l@drsnote{#1}}} -\newcommand*{\ledsidenote}[1]{\edtext{}{\l@dcsnote{#1}}}% -\newcommand*{\ledinnernote}[1]{\edtext{}{\l@disnote{#1}}}% -\newcommand*{\ledouternote}[1]{\edtext{}{\l@dosnote{#1}}}% +\newcommand*{\ledleftnote}[1]{% + \ledsidenote@{\l@dlsnote{#1}}% +}% +\newcommand*{\ledrightnote}[1]{% + \ledsidenote@{\l@drsnote{#1}}% +}% +\newcommand*{\ledsidenote}[1]{% + \ledsidenote@{\l@dcsnote{#1}}% +}% +\newcommand*{\ledinnernote}[1]{% + \ledsidenote@{\l@disnote{#1}}% +}% +\newcommand*{\ledouternote}[1]{% + \ledsidenote@{\l@dosnote{#1}}% +}% +\newcommand*{\ledsidenote@}[1]{% + \edtext{}{% + \advance\edtext@notes@start by 1% + #1% + }%+ +}% % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % % \begin{macro}{\l@dlsnote} @@ -21505,11 +21551,11 @@ % \end{macrocode} % \changes{v1.14.1}{2014/12/15}{Debug sectioning commands when using both \protect\package{handout} and \protect\package{hyperref} package.} -% \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{NR} commands. +% \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. % \begin{macrocode} -\@ifpackageloaded{nameref}{ +\ifdef{\H@old@sect}{% - \patchcmd{\NR@sect} + \patchcmd{\H@old@sect}% {#8} {#8% \print@rightmargin@eledsection% @@ -21517,7 +21563,7 @@ {} {} - \patchcmd{\NR@sect} + \patchcmd{\H@old@sect}% {\hskip #3\relax} {\hskip #3\relax% \print@leftmargin@eledsection% @@ -21525,7 +21571,7 @@ {} {} - \patchcmd{\NR@ssect} + \patchcmd{\H@old@@sect}% {#5} {#5% \print@rightmargin@eledsection% @@ -21533,7 +21579,7 @@ {} {} - \patchcmd{\NR@ssect} + \patchcmd{\H@old@@sect}% {\hskip #1} {\hskip #1% \print@leftmargin@eledsection% |