From e3c6e657f396096f4406658bd2917dd46b7aa9f5 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 12 Jul 2012 21:41:28 +0000 Subject: ledmac (21jun12) git-svn-id: svn://tug.org/texlive/trunk@27016 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/ledmac/ledmac.dtx | 276 +++++++++++++++++------ Master/texmf-dist/source/latex/ledmac/ledpar.dtx | 269 +++++++++++++++++----- 2 files changed, 426 insertions(+), 119 deletions(-) (limited to 'Master/texmf-dist/source/latex/ledmac') diff --git a/Master/texmf-dist/source/latex/ledmac/ledmac.dtx b/Master/texmf-dist/source/latex/ledmac/ledmac.dtx index 229f1f57553..14e385e1538 100644 --- a/Master/texmf-dist/source/latex/ledmac/ledmac.dtx +++ b/Master/texmf-dist/source/latex/ledmac/ledmac.dtx @@ -3,7 +3,7 @@ % ledmac.dtx % Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net % Maintainer:Maïeul Rouquette maieul at maieul dot net -% Copyright 2003 -- 2005 Peter R. Wilson +% Copyright 2003 -- 2005 Peter R. Wilson / 2011-.. Maïeul Rouquette % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either @@ -50,7 +50,7 @@ % % \fi % -% \CheckSum{9200} +% \CheckSum{9324} % % \makeatletter % \newcommand*{\DescribeIt}{\leavevmode\@bsphack\begingroup\MakePrivateLetters @@ -138,6 +138,8 @@ % \def\fileversion{v0.13} \def\filedate{2011/11/08} % \def\fileversion{v0.13.1} \def\filedate{2011/11/18} % \def\fileversion{v0.14} \def\filedate{2012/04/04} +% \def\fileversion{v0.15} \def\filedate{2012/06/11} +% \def\fileversion{v0.16} \def\filedate{2012/06/21} % \changes{v0.1}{2003/03/25}{First public release} % \changes{v0.2}{2003/08/16}{Added tabmac code, and extended indexing} % \changes{v0.2.1}{2003/09/13}{Bug fixes and match with mempatch v1.8} @@ -169,7 +171,7 @@ % \changes{v0.12.1}{2011/10/02}{The numbering of \cs{pstarts} restarts on each \cs{beginnumbering}.} % \changes{v0.12.1}{2011/10/02}{Don't number \cs{pstarts} of stanza.} %\changes{v0.13}{2011/11/08}{New stanzaindentsrepetition counter to repeat stanza indents every \emph{n} verses.} -% \changes{v0.13.1}{2011/11/18}{\cs{thepstartL} and \cs{thepstartR} use now \cs{bfseries} and not \cs{bf}, which is deprecated and make conflicts with memoir class.} +% \changes{v0.13.1}{2011/11/18}{\cs{thepstartL} and \cs{thepstartR} use now \cs{bfseries} and not \cs{bf}, which is deprecated and makes conflicts with memoir class.} % \changes{v0.14}{2012/04/04}{Tweaked \cs{edlabel} to get correct line number if the command is first element of a paragraph.} % \hyphenation{man-u-script man-u-scripts} % @@ -796,17 +798,20 @@ % %\changes{v0.12}{2011/10/01}{Possibilty to number \cs{pstart}.} % It's possible to insert a number at every \cs{pstart} command. You must use the \DescribeMacro{\numberpstarttrue}\cs{numberpstarttrue} command to have it. You can stop the numbering with \DescribeMacro{\numberpstartfalse}\cs{numberpstartfalse}. You can redefine the command \DescribeMacro{\thepstart}\cs{thepstart} to change style. On each \cs{beginnumbering} the numbering restarts. +% \changes{v0.15}{2012/06/11}{Possibilty to print \cs{pstart} number in side.} +% With the \cs{sidepstartnumtrue} command, the number of \cs{pstart} will be printed in side. In this case, the line number will be not printed. % \subsection{Lineation commands} -% +% \DescribeMacro{\numberlinefalse} \DescribeMacro{\numberlinetrue} +% Line numbering can be disabled with \cs{numberlinefalse}. It can be enabled again with \cs{numberlinetrue}. % \DescribeMacro{\lineation} -% Lines can be numbered either by page or by section; you specify +% Lines can be numbered either by page, by pstart or by section; you specify % this using the \cs{lineation}\marg{arg} % macro, where \meta{arg} is either -% \texttt{page} or \texttt{section}. You may only use this command at places +% \texttt{page}, \texttt{pstart} or \texttt{section}. You may only use this command at places % where numbering is not in effect; you can't change the lineation system % within a section. You can change it between sections: they don't all % have to use the same lineation system. -% The package's standard setting is \verb"\lineation{section}". +% 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. % % \DescribeMacro{\linenummargin} % The command \cs{linenummargin}\meta{location} specifies the margin @@ -1576,7 +1581,7 @@ % \end{verbatim} % \end{PW} %\begin{PW} -%It's possible to insert a symbol on each line of verse's hanging, as in French typography for `]'. To insert in ledmac, redefine macro \DescribeMacro{\hangingsymbol}\cmd{\hangingsymbol} with this code : +%It's possible to insert a symbol on each line of verse's hanging, as in French typography for `['. To insert in ledmac, redefine macro \DescribeMacro{\hangingsymbol}\cmd{\hangingsymbol} with this code : %\begin{verbatim} %\renewcommand{\hangingsymbol}{[\,} %\end{verbatim} @@ -2974,7 +2979,7 @@ % \begin{macrocode} %<*code> \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{ledmac}[2012/04/04 v0.14 LaTeX port of EDMAC] +\ProvidesPackage{ledmac}[2012/06/21 v0.16 LaTeX port of EDMAC] % \end{macrocode} % @@ -3413,6 +3418,7 @@ \line@list@stuff{\jobname.\extensionchars\the\section@num}% \l@dend@stuff \setcounter{pstart}{1} + \firstpstarttrue } \newcommand*{\initnumbering@reg}{% \global\pst@rtedLfalse @@ -3502,9 +3508,9 @@ % \label{lineation}\relax % % \subsection{Choosing the system of lineation} -% +% \changes{v0.15}{2012/06/11}{Line numbering can be reset at each pstart.} % Sometimes you want line numbers that start at $1$ at the top of each -% page; other times you want line numbers that start at $1$ at the start +% page; sometimes you want line numbers that start at $1$ at each \cs{pstart}; other times you want line numbers that start at $1$ at the start % of each section and increase regardless of page breaks. % \Ledmac{} can do it either way, and you can switch from one to the % other within one work. @@ -3512,23 +3518,33 @@ % line references within each section. Here we will define % internal codes for these systems and the macros you use to select them. % +% \begin{macro}{\ifbypstart@} +% \begin{macro}{\bypstart@true} +% \begin{macro}{\bypstart@false} % \begin{macro}{\ifbypage@} % \begin{macro}{\bypage@true} % \begin{macro}{\bypage@false} -% The \cs{ifbypage@} flag specifies the current lineation -% system: \verb"false" for line-of-section, \verb"true" for line-of-page. +% The \cs{ifbypage@} and \cs{ifbypstart@} flag specifie the current lineation +% system: \begin{itemize} +% \item line-of-page : \verb|bypstart@ = false| and \verb|bypage@ = true|. +% \item line-of-pstart : \verb|bypstart@ = true| and \verb|bypage@ = false|. +% \end{itemize} % \Ledmac{} will use the line-of-section system unless instructed otherwise. % \begin{macrocode} \newif\ifbypage@ +\newif\ifbypstart@ % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\lineation} % \cs{lineation}\marg{word} is the macro you use to select the % lineation system. -% Its argument is a string: either \texttt{page} or \texttt{section}. +% Its argument is a string: either \texttt{page} or \texttt{section} or \texttt{pstart}. % \begin{macrocode} \newcommand*{\lineation}[1]{{% \ifnumbering @@ -3537,16 +3553,23 @@ \def\@tempa{#1}\def\@tempb{page}% \ifx\@tempa\@tempb \global\bypage@true + \global\bypstart@false \else - \def\@tempb{section}% + \def\@tempb{pstart}% \ifx\@tempa\@tempb \global\bypage@false + \global\bypstart@true \else - \led@warn@BadLineation + \def@tempb{section} + \ifx\@tempa\@tempb + \global\bypage@false + \global\bypstart@false + \else + \led@warn@BadLineation + \fi \fi \fi \fi}} - % \end{macrocode} % \end{macro} % @@ -5405,6 +5428,13 @@ % % \end{PW} % +% \begin{macro}{\ifnumberline} +% The \cs{ifnumberline} option can be set to FALSE to disable line numbering. +% \begin{macrocode} +\newif\ifnumberline +\numberlinetrue +% \end{macrocode} +% \end{macro} % \begin{macro}{\set@line} % The \cs{set@line} macro % is called by \cs{critext} to put the line-reference field and @@ -5568,6 +5598,7 @@ % \begin{macro}{numberpstarttrue} % \begin{macro}{numberpstartfalse} % \begin{macro}{thepstart} +% \begin{macro}{\firstpstart} % \cs{pstart} starts the paragraph by % clearing the \cs{inserts@list} list and other % relevant variables, and then arranges for the @@ -5590,9 +5621,16 @@ \newcounter{pstart} \renewcommand{\thepstart}{{\bfseries\@arabic\c@pstart}. } \newif\ifnumberpstart +\newif\iffirstpstart +\firstpstarttrue \numberpstartfalse \newcommand*{\pstart}{ -\managehangingsymbol +\ifbypstart@\iffirstpstart + \firstpstartfalse + \else + \setline{0} + \fi +\fi \if@nobreak \let\@oldnobreak\@nobreaktrue \else @@ -5610,13 +5648,14 @@ \list@clear{\inserts@list}% \global\let\next@insert=\empty \begingroup\normal@pars - \global\setbox\raw@text=\vbox\bgroup\ifautopar\else\ifnumberpstart\ifinstanza\else\thepstart\fi\fi\fi + \global\setbox\raw@text=\vbox\bgroup\ifautopar\else\ifnumberpstart\ifinstanza\else\ifsidepstartnum\else\thepstart\fi\fi\fi\fi \numberedpar@true} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % \begin{macro}{\pend} % \cs{pend} must be used to end a numbered paragraph. % @@ -5627,9 +5666,6 @@ \ifnumberedpar@ \else \led@err@PendNoPstart \fi -\ifnumberpstart -\addtocounter{pstart}{1} -\fi % \end{macrocode} % We set all the usual interline penalties to zero and then immediately % call \cs{endgraf} to end the paragraph; this ensures that there'll @@ -5653,6 +5689,10 @@ \flush@notes \endgroup \ignorespaces + \ifnumberpstart + \addtocounter{pstart}{1} + \pstartnumtrue + \fi \@oldnobreak} % \end{macrocode} @@ -5757,11 +5797,16 @@ \unvbox\one@line \global\setbox\one@line=\lastbox \getline@num \affixline@num - \hb@xt@ \linewidth{\l@dld@ta\add@inserts\affixside@note + \affixpstart@num + \hb@xt@ \linewidth{\inserthangingsymbol\l@dld@ta\add@inserts\affixside@note \l@dlsn@te {\ledllfill\hb@xt@ \wd\one@line{\new@line\l@dunhbox@line{\one@line}}\ledrlfill\l@drd@ta% \l@drsn@te - }} + }}% +%\end{macrocode} +% The \cs{prevline@num} counter is used to check the insertion of hanging symbol. +%\begin{macrocode} + \prevline@num=\line@num% \add@penalties} % \end{macrocode} @@ -5836,9 +5881,12 @@ % send to the vertical list. % \begin{macrocode} \newcommand*{\getline@num}{% - \global\advance\absline@num \@ne + \ifnumberline + \global\advance\absline@num \@ne + \fi \do@actions \do@ballast + \ifnumberline \ifsublines@ \ifnum\sub@lock<\tw@ \global\advance\subline@num \@ne @@ -5848,8 +5896,9 @@ \global\advance\line@num \@ne \global\subline@num \z@ \fi - \fi} - + \fi + \fi + } % \end{macrocode} % \end{macro} % @@ -6015,7 +6064,6 @@ % \end{macrocode} % \end{macro} -% % \subsection{Line number printing} % % \begin{macro}{\affixline@num} @@ -6062,7 +6110,10 @@ % \end{macrocode} % No number is attached if \cs{ifl@dskipnumber} is TRUE (and then it % is set to its normal FALSE value). +% No number is attached if \cs{ifnumberline} is FALSE (the normal value is TRUE). +% \changes{v0.15}{2012/06/11}{Line numbering can be disabled.} % \begin{macrocode} +\ifnumberline \ifl@dskipnumber \global\l@dskipnumberfalse \else @@ -6200,7 +6251,9 @@ % $2$; $3$ advances to $0$; other values are unchanged. % \begin{macrocode} \f@x@l@cks -\fi} +\fi +\fi +} % \end{macrocode} % \end{macro} @@ -6290,6 +6343,64 @@ % \end{macro} % \end{PW} % +% \subsection{Pstart number printing in side} +% In side, the printing of pstart number is running like the printing of line number. There is only some differences : +% \begin{macro}{\affixpstart@num} +% \begin{macro}{\pstartnum} +% \begin{itemize} +% \item The pstarts counter is upgrade in the \cs{pend} command. Consequently, the \cs{affixpstart@num} command has not to upgrade it, unlike the \cs{affixline@num} which upgrades the lines counter. +% \item To print the pstart number only at the begining of a pstart, and not in every line, a boolean test is made. The \cs{pstartnum} boolean is set to TRUE at every \cs{pend}. It's tried in the \cs{leftpstartnum} and \cs{rightstartnum} commands. After the try, it is set to FALSE. +% \end{itemize} +% \begin{macro}{\leftpstartnum} +% \begin{macro}{\rightstartnum} +% \begin{macro}{\ifsidepstartnum} +% \begin{macrocode} + +\newif\ifsidepstartnum +\newcommand*{\affixpstart@num}{% + \ifsidepstartnum + \if@twocolumn + \if@firstcolumn + \gdef\l@dld@ta{\llap{{\leftpstartnum}}}% + \else + \gdef\l@drd@ta{\rlap{{\rightpstartnum}}}% + \fi + \else + \@l@dtempcntb=\line@margin + \ifnum\@l@dtempcntb>\@ne + \advance\@l@dtempcntb \page@num + \fi + \ifodd\@l@dtempcntb + \gdef\l@drd@ta{\rlap{{\rightpstartnum}}}% + \else + \gdef\l@dld@ta{\llap{{\leftpstartnum}}}% + \fi + \fi + \fi + +} +% + +\newif\ifpstartnum +\pstartnumtrue +\newcommand*{\leftpstartnum}{ + \ifpstartnum\thepstart + \kern\linenumsep\fi + \global\pstartnumfalse +} +\newcommand*{\rightpstartnum}{ + \ifpstartnum + \kern\linenumsep + \thepstart + \fi + \global\pstartnumfalse +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % \subsection{Add insertions to the vertical list} % % \begin{macro}{\inserts@list} @@ -7018,9 +7129,21 @@ % \end{macro} % % \begin{macro}{\printlines} -% Now we're ready to print it all. +% Now we're ready to print it all. If the lineation is by pstart, we print the pstart. +% \changes{v0.15}{2012/06/11}{Line numbering can be reset at each pstart.} % \begin{macrocode} \def\printlines#1|#2|#3|#4|#5|#6|#7|{\begingroup + \ifbypstart@% + \ifl@dpairing% + \ifledRcol% + \thepstartR% + \else% + \thepstartL% + \fi% + \else% + \thepstart% + \fi% + \fi% \setprintlines{#1}{#2}{#3}{#4}{#5}{#6}% % \end{macrocode} % One subtlety left here is when to print a period between @@ -7268,7 +7391,11 @@ % \end{macrocode} % \end{macro} -% +% \changes{v0.16}{2012/06/21}{\cs{parafootftmsep} command is printed between each paragraphed footnote} +% You can redefine the \cs{parafootftmsep} command to print a separator between each paragraphed footnote (on the same page). A usual separator is a double pipe ($\|$). To add double-pipe separators: +% \begin{verbatim} +% \renewcommand{\parafootftmsep}{\thinspace$||$\enspace} +% \end{verbatim} % \begin{macro}{\footfudgefiddle} % \begin{PW} % For paragraphed footnotes \TeX{} has to estimate the amount of space @@ -7564,6 +7691,7 @@ % text of the footnote. % \begin{macrocode} \newcommand*{\parafootfmt}[3]{% + \insertparafootftmsep% \ledsetnormalparstuff {\notenumfont\printlines#1|}\enspace {\select@lemmafont#1|#2}\rbracket\enskip @@ -7572,6 +7700,7 @@ % Note that in the above definition, the penalty of $-10$ % encourages a line break between notes, so that notes have a % slight tendency to begin on new lines. +% The \cs{insertparafootftmsep} command is used to insert the \cs{parafootftmsep} between each note in the \emph{same} page. % \end{macro} % % \begin{macro}{\para@footgroup} @@ -7631,6 +7760,27 @@ % \end{macro} % \end{macro} % +% \subsubsection{Insertion of footnotes separator} +% \begin{macro}{\parafootftmsep} +% The \cs{parafootftmsep} macro is inserted between each paragraphed footnote. The default value is empty, but the user can redefine it via \cs{renewcommand}. +% \begin{macrocode} +\newcommand{\parafootftmsep}{} +% \end{macrocode} +% \end{macro} +%The command \cs{insertparafootftmsep} must be called at the begining of \cs{parafootftm} (and like commands). \cs{insertparafootftmsep} checks to see if the page number has changed since the previous note. If not, \cs{insertparafootftmsep} calls \cs{parafootftmsep}. +% \begin{macro}{\prevpage@num} +% \begin{macro}{\insertparafootftmsep} +% \begin{macrocode} +\newcount\prevpage@num +\newcommand{\insertparafootftmsep}{% + \ifnum\prevpage@num=\page@num% + \parafootftmsep% + \fi% + \global\prevpage@num=\page@num% +} +% \end{macrocode} +% \end{macro} +% \end{macro} % \subsection{Columnar footnotes} % % \begin{macro}{\rigidbalance} @@ -8474,8 +8624,10 @@ %\begin{macro}{\advancelabel@refs} %\begin{macro}{\labelrefsparseline} %\begin{macro}{\labelrefsparsesubline} -% \begin{macrocode} -% In case which \cs{edlabel} is the first in a paragraph, we have a problem, because line's number changes only at first horizontal box of the paragraph. And so, we need test in \cs{edlable} if we are at the top of paragraph, with \cs{ifvmode}. If true, we need advance of on unity text that we write in .aux file. We do it with \cs{advancelabel@refs} command. +% \begin{macrocode} +%In cases where \cs{edlabel} is the first element in a paragraph, we have a problem with line counts, because line counts change only at the first horizontal box of the paragraph. +%Hence, we need to test \cs{edlabel} if it occurs at the start of a paragraph. To do so, we use \cs{ifvmode}. If the test is true, we must advance by one unit the amount of text we write into the \verb].aux] file. +%We do so using \cs[advancelabel@refs} command. \newcommand{\advancelabel@refs}{% \newcount\line% \ledmac@warning{\label@refs} @@ -9100,9 +9252,9 @@ % user commands for left and right sidenotes. \verb?\ledsidenote?\marg{text} % is the command for a moveable sidenote. % \begin{macrocode} -\newcommand*{\ledleftnote}[1]{\setcounter{hboxmodulo}{-1}\edtext{}{\l@dlsnote{#1}}} -\newcommand*{\ledrightnote}[1]{\setcounter{hboxmodulo}{-1}\edtext{}{\l@drsnote{#1}}} -\newcommand*{\ledsidenote}[1]{\setcounter{hboxmodulo}{-1}\edtext{}{\l@dcsnote{#1}}} +\newcommand*{\ledleftnote}[1]{\edtext{}{\l@dlsnote{#1}}} +\newcommand*{\ledrightnote}[1]{\edtext{}{\l@drsnote{#1}}} +\newcommand*{\ledsidenote}[1]{\edtext{}{\l@dcsnote{#1}}} % \end{macrocode} @@ -9912,6 +10064,7 @@ % \cs{parafootfmtX}\marg{series} % \begin{macrocode} \newcommand*{\parafootfmtX}[2]{% + \insertparafootftmsep \ledsetnormalparstuff {\notenumfont\@nameuse{footfootmark#1}\strut%\enspace #2\penalty-10}} @@ -10042,7 +10195,7 @@ % % Don't forget to initialise the series. % -% \begin{macrocode} +% \begin{macrocode} \footnormalX{A} \footnormalX{B} \footnormalX{C} @@ -10678,43 +10831,30 @@ % % \begin{PW} % The macro \cmd{\hangingsymbol} is used to insert a symbol on each hanging of verses. -%For example, in french typographie the symbol is `]'. We obtain it by the next code: +%For example, in french typographie the symbol is `['. We obtain it by the next code: %\begin{verbatim} %\renewcommand{\hangingsymbol}{[\,} %\end{verbatim} -% We use the fact that ledmac run with hbox. Every 3 hbox we insert this command. To know the number of hbox, we use the counter `hboxmodulo' -%\begin{macro}{\hangingsymbol} -%\begin{macrocode} +% The \cs{ifinstanza} boolean is used to be sure that we are in a stanza part. +% \begin{macro}{\hangingsymbol} +% \begin{macro}{\ifinstanza} +% \begin{macrocode} \newcommand*{\hangingsymbol}{} -\newcounter{hbox} -\newcounter{hboxmodulo} -\newif\ifhangingsymbol -\hangingsymbolfalse \newif\ifinstanza \instanzafalse -\newcommand{\managehangingsymbol}{\ifinstanza% - \setcounter{hbox}{0}% - \setcounter{hboxmodulo}{0}% - \everyhbox{% -\ifnum \value{hbox}>2% - \addtocounter{hboxmodulo}{1}% - \ifnum \value{hboxmodulo}=2 - \ifhangingsymbol% - \hangingsymbol% - \hangingsymbolfalse% - \else% - \hangingsymboltrue% - \fi% - \setcounter{hboxmodulo}{0}% - \fi% -\else% -\addtocounter{hbox}{1}% -\fi% -} -\fi} - -%\end{macrocode} -%\end{macro} +% \end{macrocode} +% \end{macro} +% \end{macro} +%\changes{v0.15}{2012/06/11}{New management of hangingsymbol insertion, preventing undesirable insertions.} +% \begin{macro}{\inserthangingymbol} +% \begin{macro}{\prevline@num} +% After each insertion of true line, the value of \cs{line@num} counter is put into the \cs{prevline@num} counter. When we change verse, the \cs{line@num} is not equal to the \cs{prevline@num}. But if a verse is in two ore more lines, the second line (and next) has the same number as the first line of the verse. Consequently, the \cs{line@num} is equal to the \cs{prevline@num}. This property is used by the \cs{inserthangingsymbol} command to insert the hanging symbol at each verse's hanging. +% \begin{macrocode} +\newcount\prevline@num +\newcommand{\inserthangingsymbol}{\ifinstanza\ifnum\line@num=\prevline@num\hfill\hangingsymbol\fi\fi} +% \end{macrocode} +% \end{macro} +% \end{macro} % \begin{macro}{\ampersand} % Within a stanza the \verb?\&? macro is going to be usurped. We need an % alias in case an \& needs to be typeset in a stanza. Define it rather diff --git a/Master/texmf-dist/source/latex/ledmac/ledpar.dtx b/Master/texmf-dist/source/latex/ledmac/ledpar.dtx index 4e02ab0fb9f..bae3e9fb942 100644 --- a/Master/texmf-dist/source/latex/ledmac/ledpar.dtx +++ b/Master/texmf-dist/source/latex/ledmac/ledpar.dtx @@ -3,7 +3,7 @@ % ledpar.dtx % Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net % Maintainer:Maïeul Rouquette maieul at maieul dot net -% Copyright 2004, 2005 Peter R. Wilson +% Copyright 2004, 2005 Peter R. Wilson / 2011-.. Maïeul Rouquette % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either @@ -50,7 +50,7 @@ % % \fi % -% \CheckSum{4564} +% \CheckSum{4813} % % \makeatletter % \newcommand*{\DescribeIt}{\leavevmode\@bsphack\begingroup\MakePrivateLetters @@ -132,6 +132,7 @@ % \def\fileversion{v0.9.2}\def\filedate{2011/11/08} % \def\fileversion{v0.9.3}\def\filedate{2011/11/18} % \def\fileversion{v0.10}\def\filedate{2012/04/04} +% \def\fileversion{v0.11}\def\filedate{2012/06/11} % \changes{v0.1}{2004/12/10}{First public release} % \changes{v0.2}{2005/01/01}{Fix babel problems} % \changes{v0.3}{2005/03/24}{Reorganize for ledarab} @@ -146,9 +147,9 @@ % \changes{v0.9}{2011/10/01}{Possibilty to number the pstart with the commands \cs{numberpstarttrue}.} % \changes{v0.9.1}{2011/10/02}{The numbering of the pstarts restarts on each \cs{beginnumbering}.} % \changes{v0.9.2}{2011/11/08}{Debug : with \cs{Columns}, the hanging indentation now runs on the left columns and the hanging symbol is shown only when \cs{stanza} is used.} -% \changes{v0.9.3}{2011/11/18}{\cs{thepstartL} and \cs{thepstartR} use now \cs{bfseries} and not \cs{bf}, which is deprecated and make conflicts with memoir class.} -% \changes{v0.10}{2011/04/04}{\cs{edlabel} which start a paragraph are now put in the right place.} -% \changes{v0.10}{2011/04/04}{\cs{edlabel} on the right side are now correctly indicated.} +% \changes{v0.9.3}{2011/11/18}{\cs{thepstartL} and \cs{thepstartR} use now \cs{bfseries} and not \cs{bf}, which is deprecated and makes conflicts with memoir class.} +% \changes{v0.10}{2011/04/04}{\cs{edlabel} commands which start a paragraph are now put in the right place.} +% \changes{v0.10}{2011/04/04}{\cs{edlabel} commands on the right side are now correctly indicated.} % \hyphenation{man-u-script man-u-scripts} % % \newcommand{\Lpack}[1]{\textsf{#1}} @@ -358,6 +359,7 @@ % is invisible. For a visible rule between the columns you could try: \\ % \verb?\setlength{\columnrulewidth}{0.4pt}? \\ % You can also modify \cs{columnseparator} if you want more control. +% When you use \cs{stanza}, the visible rule may shift when a verse has a hanging indent. To prevent shifting, use \cs{setstanzaindents} outside the \verb|Leftside| or \verb|Rightside| environment. % % % \section{Facing pages}\label{pages} @@ -704,7 +706,7 @@ % \begin{macrocode} %<*code> \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{ledpar}[2012/04/04 v0.10 ledmac extension for parallel texts] +\ProvidesPackage{ledpar}[2012/06/11 v0.11 ledmac extension for parallel texts] % \end{macrocode} % With the option `shiftedverses' a long verse one the left side (or in the right side) don't make a blank on the corresponding verse, but the blank is put on the bottom of the page. Consequently, the verses on the parallel pages are shifted, but the shifted stop at every end of pages. @@ -962,49 +964,66 @@ % \label{lineation}\relax % % \subsection{Choosing the system of lineation} -% +%% \changes{v0.11}{2012/06/11}{Lineation can be by pstart (like in ledmac 0.15).} % Sometimes you want line numbers that start at $1$ at the top of each -% page; other times you want line numbers that start at $1$ at the start +% page; sometimes you want line numbers that start at $1$ at each \cs{pstart}; other times you want line numbers that start at $1$ at the start % of each section and increase regardless of page breaks. % \Ledpar{} lets you choose different schemes for the left and right texts. % +% \begin{macro}{\ifbypstart@R} +% \begin{macro}{\bypstart@Rtrue} +% \begin{macro}{\bypstart@Rfalse} % \begin{macro}{\ifbypage@R} % \begin{macro}{\bypage@Rtrue} % \begin{macro}{\bypage@Rfalse} -% The \cs{ifbypage@R} flag specifies the current lineation -% system for right texts: \verb"false" for line-of-section, \verb"true" -% for line-of-page. +% The \cs{ifbypage@R} and \cs{ifbypstart@R} flag specifie the current lineation +% system: \begin{itemize} +% \item line-of-page : \verb|bypstart@R = false| and \verb|bypage@R = true|. +% \item line-of-pstart : \verb|bypstart@R = true| and \verb|bypage@R = false|. +% \end{itemize} % \Ledpar{} will use the line-of-section system unless instructed otherwise. % \begin{macrocode} \newif\ifbypage@R +\newif\ifbypstart@R \bypage@Rfalse + \bypstart@Rfalse % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\lineationR} % \cs{lineationR}\marg{word} is the macro used to select the % lineation system for right texts. -% Its argument is a string: either \texttt{page} or \texttt{section}. +% Its argument is a string: either \texttt{page}, \texttt{pstart} or \texttt{section}. % \begin{macrocode} \newcommand*{\lineationR}[1]{{% - \ifnumberingR + \ifnumbering \led@err@LineationInNumbered \else \def\@tempa{#1}\def\@tempb{page}% \ifx\@tempa\@tempb \global\bypage@Rtrue + \global\bypstart@Rfalse \else - \def\@tempb{section}% + \def\@tempb{pstart}% \ifx\@tempa\@tempb \global\bypage@Rfalse + \global\bypstart@Rtrue \else - \led@warn@BadLineation + \def@tempb{section} + \ifx\@tempa\@tempb + \global\bypage@Rfalse + \global\bypstart@Rfalse + \else + \led@warn@BadLineation + \fi \fi \fi \fi}} - % \end{macrocode} % \end{macro} % @@ -2266,13 +2285,15 @@ % them to survive past the end of the paragraph. % % We have to have specific left and right \cs{pstart} when parallel processing; -% among other things because of potential changes in the linewidth. +% among other things because of potential changes in the linewidth. The \verb|old| counters are used to have the good reset of the pstart counters at the begining of the \cs{Pages} command. % % \begin{macrocode} \newcounter{pstartL} +\newcounter{pstartLold} \renewcommand{\thepstartL}{{\bfseries\@arabic\c@pstartL}. } \newcounter{pstartR} +\newcounter{pstartRold} \renewcommand{\thepstartR}{{\bfseries\@arabic\c@pstartR}. } \newcommand*{\pstartL}{ @@ -2292,9 +2313,10 @@ \fi % \end{macrocode} % If this is the first \cs{pstart} in a numbered section, clear any inserts -% and set \cs{ifpst@rtedL} to FALSE. +% and set \cs{ifpst@rtedL} to FALSE. Save the pstartL counter. % \begin{macrocode} \ifpst@rtedL\else + \setcounter{pstartLold}{\value{pstartL}}% \list@clear{\inserts@list}% \global\let\next@insert=\empty \global\pst@rtedLtrue @@ -2310,7 +2332,7 @@ \led@err@TooManyPstarts \global\l@dnumpstartsL=\l@dc@maxchunks \fi - \global\setnamebox{l@dLcolrawbox\the\l@dnumpstartsL}=\vbox\bgroup\ifautopar\else\ifnumberpstart\thepstartL\fi\fi% + \global\setnamebox{l@dLcolrawbox\the\l@dnumpstartsL}=\vbox\bgroup\ifautopar\else\ifnumberpstart\ifsidepstartnum\else\thepstartL\fi\fi\fi% \hsize=\Lcolwidth \numberedpar@true} % \end{macrocode} @@ -2332,6 +2354,7 @@ \pendR \fi \ifpst@rtedR\else + \setcounter{pstartRold}{\value{pstartR}}% \list@clear{\inserts@listR}% \global\let\next@insertR=\empty \global\pst@rtedRtrue @@ -2342,7 +2365,7 @@ \led@err@TooManyPstarts \global\l@dnumpstartsR=\l@dc@maxchunks \fi - \global\setnamebox{l@dRcolrawbox\the\l@dnumpstartsR}=\vbox\bgroup\ifautopar\else\ifnumberpstart\thepstartR\fi\fi% + \global\setnamebox{l@dRcolrawbox\the\l@dnumpstartsR}=\vbox\bgroup\ifautopar\else\ifnumberpstart\ifsidepstartnum\else\thepstartR\fi\fi\fi% \hsize=\Rcolwidth \numberedpar@true} % \end{macrocode} @@ -2461,6 +2484,7 @@ % \end{macro} % % +% \changes{v0.11}{2012/06/11}{Change \cs{do@lineL} and \cs{do@lineR} to allow line numbering by pstart(like in ledmac 0.15).} % \begin{macro}{\do@lineL} % The \cs{do@lineL} macro is called to % do all the processing for a single line of left text. @@ -2469,7 +2493,6 @@ % some common code} % \begin{macrocode} \newcommand*{\do@lineL}{% -\ifinstanzaL\manageparhangingsymbol\fi \advance\countLline \@ne \ifvbox\namebox{l@dLcolrawbox\the\l@dpscL}% {\vbadness=10000 @@ -2482,14 +2505,16 @@ \getline@numL \setbox\l@dleftbox \hb@xt@ \Lcolwidth{% + \affixpstart@numL \affixline@num \l@dld@ta \add@inserts \affixside@note \l@dlsn@te - {\ledllfill\hb@xt@ \wd\one@line{\new@line\l@dunhbox@line{\one@line}}\ledrlfill\l@drd@ta% + {\ledllfill\hb@xt@ \wd\one@line{\inserthangingsymbolL\new@line\l@dunhbox@line{\one@line}}\correcthangingL\ledrlfill\l@drd@ta% \l@drsn@te }}% + \prevline@num=\line@num% \add@penaltiesL \global\advance\@donereallinesL\@ne \global\advance\@donetotallinesL\@ne @@ -2520,7 +2545,6 @@ % \changes{v0.3}{2005/02/10}{Changed \cs{do@lineR} similarly to \cs{do@lineL}} % \begin{macrocode} \newcommand*{\do@lineR}{% -\ifinstanzaR\manageparhangingsymbol\fi \advance\countRline \@ne \ifvbox\namebox{l@dRcolrawbox\the\l@dpscR}% {\vbadness=10000 @@ -2533,14 +2557,16 @@ \getline@numR \setbox\l@drightbox \hb@xt@ \Rcolwidth{% + \affixpstart@numR \affixline@numR \l@dld@ta \add@insertsR \affixside@noteR \l@dlsn@te - {\ledllfill\hb@xt@ \wd\one@lineR{\new@lineR\l@dunhbox@line{\one@lineR}}\ledrlfill\l@drd@ta% + {\correcthangingR\ledllfill\hb@xt@ \wd\one@lineR{\inserthangingsymbolR\new@lineR\l@dunhbox@line{\one@lineR}}\ledrlfill\l@drd@ta% \l@drsn@te }}% + \prevline@numR=\line@numR% \add@penaltiesR \global\advance\@donereallinesR\@ne \global\advance\@donetotallinesR\@ne @@ -2562,24 +2588,31 @@ % send to the vertical list. % \begin{macrocode} \newcommand*{\getline@numR}{% +\ifnumberline \global\advance\absline@numR \@ne +\fi \do@actionsR \do@ballastR +\ifnumberline \ifsublines@ \ifnum\sub@lockR<\tw@ \global\advance\subline@numR \@ne \fi \else \ifnum\@lockR<\tw@ - \addtocounter{hbox}{10}% - \global\advance\line@numR \@ne + \global\advance\line@numR \@ne \global\subline@numR \z@ \fi - \fi} + \fi +\fi +} \newcommand*{\getline@numL}{% - \global\advance\absline@num \@ne +\ifnumberline + \global\advance\absline@num \@ne +\fi \do@actions \do@ballast +\ifnumberline \ifsublines@ \ifnum\sub@lock<\tw@ \global\advance\subline@num \@ne @@ -2587,10 +2620,11 @@ \else \ifnum\@lock<\tw@ \global\advance\line@num \@ne - \addtocounter{hbox}{10}% \global\subline@num \z@ \fi - \fi} + \fi +\fi +} % \end{macrocode} @@ -2705,6 +2739,7 @@ % \cs{affixline@numR} is the right text version of the % \cs{affixline@num} macro. % \changes{v0.3}{2005/02/24}{Changed \cs{affixline@numR} to match new ledmac} +% \changes{v0.11}{2012/06/11}{Changed \cs{affixline@numR} to allow to disable line numbering (like in ledmac 0.15).} % \begin{macrocode} \providecommand*{\l@dcalcnum}[3]{% @@ -2768,6 +2803,7 @@ \newcommand*{\affixline@numR}{% +\ifnumberline \ifl@dskipnumber \global\l@dskipnumberfalse \else @@ -2809,15 +2845,102 @@ \fi \fi \f@x@l@cksR +\fi \fi} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \subsection{Pstart number printing in side} +% The printing of the pstart number is like in ledmac, with two differences : +%\begin{itemize} +%\item Some commands have versions suffixed by R or L. +%\item The \cs{affixpstart@num} and \cs{affixpstart@numR} commands are called in the \cs{Pages} command. Consequently, the \verb|pstartL| and \verb|pstartR| counters must be reset at the begining of this command. +%\end{itemize} +% \begin{macro}{\affixpstart@numL} +% \begin{macro}{\affixpstart@numR} +% \begin{macro}{\leftpstartnumR} +% \begin{macro}{\rightpstartnumR} +% \begin{macro}{\leftpstartnumL} +% \begin{macro}{\rightpstartnumL} +% \begin{macro}{\ifpstartnumR} +% \begin{macrocode} + +\newcommand*{\affixpstart@numL}{% +\ifsidepstartnum +\if@twocolumn + \if@firstcolumn + \gdef\l@dld@ta{\llap{{\leftpstartnumL}}}% + \else + \gdef\l@drd@ta{\rlap{{\rightpstartnumL}}}% + \fi + \else + \@l@dtempcntb=\line@margin + \ifnum\@l@dtempcntb>\@ne + \advance\@l@dtempcntb \page@num + \fi + \ifodd\@l@dtempcntb + \gdef\l@drd@ta{\rlap{{\rightpstartnumL}}}% + \else + \gdef\l@dld@ta{\llap{{\leftpstartnumL}}}% + \fi + \fi +\fi +} +\newcommand*{\affixpstart@numR}{% +\ifsidepstartnum +\if@twocolumn + \if@firstcolumn + \gdef\l@dld@ta{\llap{{\leftpstartnumR}}}% + \else + \gdef\l@drd@ta{\rlap{{\rightpstartnumR}}}% + \fi + \else + \@l@dtempcntb=\line@marginR + \ifnum\@l@dtempcntb>\@ne + \advance\@l@dtempcntb \page@numR + \fi + \ifodd\@l@dtempcntb + \gdef\l@drd@ta{\rlap{{\rightpstartnumR}}}% + \else + \gdef\l@dld@ta{\llap{{\leftpstartnumR}}}% + \fi + \fi +\fi +} +\newcommand*{\leftpstartnumL}{ +\ifpstartnum +\thepstartL +\kern\linenumsep\global\pstartnumfalse\fi +} +\newcommand*{\rightpstartnumL}{ +\ifpstartnum\kern\linenumsep +\thepstartL +\global\pstartnumfalse\fi +} +\newif\ifpstartnumR +\pstartnumRtrue +\newcommand*{\leftpstartnumR}{ +\ifpstartnumR +\thepstartR +\kern\linenumsep\global\pstartnumRfalse\fi +} +\newcommand*{\rightpstartnumR}{ +\ifpstartnumR\kern\linenumsep +\thepstartR +\global\pstartnumRfalse\fi +} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} -% +% \end{macro} +% \end{macro} % \subsection{Add insertions to the vertical list} % % \begin{macro}{\inserts@listR} @@ -3450,19 +3573,32 @@ % % \section{Verse} -% -% -% The \cmd{\manageparhangingsymbol} command is made to insert the hanging symbol (like in the french typography). -%\begin{macrocode} +%\changes{v0.11}{2012/06/11}{New management of hangingsymbol insertion, preventing undesirable insertions.} +% Like in ledmac, the insertion of hangingsymbol is base on a control of the change of line's numbers. But we need different macros for left and right sides. +% \begin{macro}{\prevline@numR} +% \begin{macro}{\inserthangingsymbolL} +% \begin{macro}{\inserthangingsymbolR} +% \begin{macrocode} +\newcount\prevline@numR +\newcommand{\inserthangingsymbolL}{\ifinstanzaL\ifnum\line@num=\prevline@num\hfill\hangingsymbol\fi\fi} +\newcommand{\inserthangingsymbolR}{\ifinstanzaR\ifnum\line@numR=\prevline@numR\hfill\hangingsymbol\fi\fi} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +%\changes{v0.11}{2012/06/11}{Prevent shift of column separator when a verse is hanged} +% When a verse is hanged, the column separator is shifted. To prevent it, the \cs{do@lineL} and \cs{do@lineR} commands call \cs{correcthangingL} and \cs{correcthangingR} commands. These commands insert horizontal skip which length is equal to the hang indent. +% \begin{macro}{\correcthangingL} +% \begin{macro}{\correcthangingR} +% \begin{macrocode} +\newcommand{\correcthangingL}{\ifl@dpaging\else\ifinstanzaL\ifnum\line@num=\prevline@num\hskip \@ifundefined{sza@0@}{0}{\expandafter% + \noexpand\csname sza@0@\endcsname}\stanzaindentbase\fi\fi\fi} -\newcommand{\manageparhangingsymbol}{% - \setcounter{hbox}{0}% - \everyhbox{% - \ifnum \value{hbox}=-2% - \hangingsymbol% - \fi% - \addtocounter{hbox}{-1}}} -%\end{macrocode} +\newcommand{\correcthangingR}{\ifl@dpaging\else\ifinstanzaR\ifnum\line@numR=\prevline@numR\hskip \@ifundefined{sza@0@}{0}{\expandafter% + \noexpand\csname sza@0@\endcsname}\stanzaindentbase\fi\fi\fi} +% \end{macrocode} +% \end{macro} +% \end{macro} % Before we can define the main stanza macros we need to be able to save % and reset % the category code for \&. To save the current value we use @@ -3842,6 +3978,8 @@ % % \begin{macrocode} \newcommand*{\Columns}{% + \setcounter{pstartL}{\value{pstartLold}} + \setcounter{pstartR}{\value{pstartRold}} \ifnum\l@dnumpstartsL=\l@dnumpstartsR\else \led@err@BadLeftRightPstarts{\the\l@dnumpstartsL}{\the\l@dnumpstartsR}% \fi @@ -3861,7 +3999,9 @@ % two by two (left and right pairs). % \begin{macrocode} \check@pstarts - \loop\if@pstarts + \loop\if@pstarts + \global\pstartnumtrue + \global\pstartnumRtrue % \end{macrocode} % Increment \cs{l@dpscL} and \cs{l@dpscR} which here count % the numbers of left and right chunks. @@ -3900,11 +4040,20 @@ \repeat} % \end{macrocode} % Having completed a pair of chunks, write the number of lines -% in each chunk to the respective section files. +% in each chunk to the respective section files. Increment pstart counters and reset line numbering if it's by pstart. +% \changes{v0.11}{2012/06/11}{Line numbering by pstart.} % \begin{macrocode} \@writelinesinparL \@writelinesinparR \check@pstarts + \ifbypstart@ + \write\linenum@out{\string\@set[1]} + \fi + \ifbypstart@R + \write\linenum@outR{\string\@set[1]} + \fi + \addtocounter{pstartL}{1} + \addtocounter{pstartR}{1} \repeat % \end{macrocode} % Having output all chunks, make sure all notes have been output, @@ -4042,6 +4191,8 @@ % % \begin{macrocode} \newcommand*{\Pages}{% + \setcounter{pstartL}{\value{pstartLold}} + \setcounter{pstartR}{\value{pstartRold}} \typeout{} \typeout{*************************** PAGES ***************************} \ifnum\l@dnumpstartsL=\l@dnumpstartsR\else @@ -4132,6 +4283,7 @@ \l@duselanguage{\theledlanguageL}% %%% \begingroup { \loop\ifl@dsamepage + % \end{macrocode} % Process the next (left) text line, adding it to the page. % \changes{v0.3}{2005/02/10}{Added \cs{ledstrutL} to \cs{Pages}} @@ -4139,7 +4291,6 @@ \do@lineL \advance\numpagelinesL \@ne \ifshiftedverses - \addtocounter{hbox}{-1} \ifdim\ht\l@dleftbox>0pt\hb@xt@ \hsize{\ledstrutL\unhbox\l@dleftbox}\fi% \else \hb@xt@ \hsize{\ledstrutL\unhbox\l@dleftbox}% @@ -4148,6 +4299,7 @@ % Perhaps we have to move to the next (left) box. Check if we have got all % we can onto the page. If not, repeat for the next line. % \begin{macrocode} + \get@nextboxL \checkpageL \repeat @@ -4159,8 +4311,6 @@ % impossibly large number. % \begin{macrocode} \ifl@dpagefull -% \end{macrocode} -% \begin{macrocode} \@writelinesonpageL{\the\numpagelinesL}% \else \@writelinesonpageL{1000}% @@ -4180,8 +4330,7 @@ { \loop\ifl@dsamepage \do@lineR \advance\numpagelinesR \@ne - \ifshiftedverses - \addtocounter{hbox}{-1} + \ifshiftedverses \ifdim\ht\l@drightbox>0pt\hb@xt@ \hsize{\ledstrutR\unhbox\l@drightbox}\fi% \else \hb@xt@ \hsize{\ledstrutR\unhbox\l@drightbox}% @@ -4490,6 +4639,7 @@ % % \begin{macro}{\get@nextboxL} % \begin{macro}{\get@nextboxR} +% \changes{v0.11}{2012/06/11}{Change \cs{get@nextboxL} and \cs{get@nextboxR} to allow to disable line numbering (like in ledmac 0.15).} % If the current box is not empty (i.e., still contains some lines) % nothing is done. Otherwise if and only if a synchronisation point is % reached the next box is started. @@ -4521,10 +4671,19 @@ \fi \ifnum\l@dnumpstartsL>\l@dpscL % \end{macrocode} +% \changes{v0.11}{2012/06/11}{Pstart number can be printed in side} % There are still unprocessed boxes. Recalculate the maximum number of -% lines needed, and move onto the next box (by incrementing \cs{l@dpscL}). +% lines needed, and move onto the next box (by incrementing \cs{l@dpscL}). If needed, restart the line numbering. Increment the pstartL counter. % \begin{macrocode} \writtenlinesLfalse + \ifbypstart@ + \ifnum\value{pstartL}<\value{pstartLold} + \else + \setline{0} + \fi + \fi + \addtocounter{pstartL}{1} + \global\pstartnumtrue \l@dcalc@maxoftwo{\the\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}% {\the\@donetotallinesL}% {\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}% @@ -4548,6 +4707,14 @@ \fi \ifnum\l@dnumpstartsR>\l@dpscR \writtenlinesRfalse + \ifbypstart@R + \ifnum\value{pstartR}<\value{pstartRold} + \else + \write\linenum@outR{\string\@set[0]} + \fi + \fi + \addtocounter{pstartR}{1} + \global\pstartnumRtrue \l@dcalc@maxoftwo{\the\usenamecount{l@dmaxlinesinpar\the\l@dpscR}}% {\the\@donetotallinesR}% {\usenamecount{l@dmaxlinesinpar\the\l@dpscR}}% -- cgit v1.2.3