diff options
author | Karl Berry <karl@freefriends.org> | 2014-08-06 22:49:21 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-08-06 22:49:21 +0000 |
commit | 6dbec9cf98c5cc99c45848bbb37a207c2ae21160 (patch) | |
tree | 9a852286da25707be4379a9c2170ffe30783b8be /Master/texmf-dist/source/latex/eledmac | |
parent | ff1845c8557690d905ecb126d40c90e611602de5 (diff) |
eledmac (6aug14)
git-svn-id: svn://tug.org/texlive/trunk@34854 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/eledmac')
-rw-r--r-- | Master/texmf-dist/source/latex/eledmac/eledmac.dtx | 1648 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/eledmac/eledpar.dtx | 616 |
2 files changed, 1683 insertions, 581 deletions
diff --git a/Master/texmf-dist/source/latex/eledmac/eledmac.dtx b/Master/texmf-dist/source/latex/eledmac/eledmac.dtx index c4b008167d2..82d8cd98d8b 100644 --- a/Master/texmf-dist/source/latex/eledmac/eledmac.dtx +++ b/Master/texmf-dist/source/latex/eledmac/eledmac.dtx @@ -51,7 +51,7 @@ % % \fi % -% \CheckSum{8925} +% \CheckSum{9904} % % \makeatletter % \newcommand*{\DescribeIt}{\leavevmode\@bsphack\begingroup\MakePrivateLetters @@ -135,6 +135,17 @@ % \my@changes#1.\@nil % }% %\makeatother +% \newcommand{\Lpack}[1]{\textsf{#1}} +% \newcommand{\Lclass}[1]{\textsf{#1}} +% \newcommand{\file}[1]{\texttt{#1}} +% \newcommand{\eledmac}{eledmac} +% \newcommand{\Eledmac}{\Lpack{\eledmac}} +% \newcommand{\edmac}{\texttt{EDMAC}} +% \newcommand{\tabmac}{\texttt{TABMAC}} +% \newcommand{\edstanza}{\texttt{EDSTANZA}} +% \newcommand{\texbook}{\textit{TeXbook}} +% \newcommand{\thetexbook}{\textit{The TeXbook}} +% % \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} @@ -188,19 +199,11 @@ % \changes{v1.10.5}{2014/04/14}{Debug of \cs{xxref}.} % \changes{v1.10.5}{2014/04/14}{Debug of \cs{pausenumbering}.} % \changes{v1.10.6}{2014/05/01}{Debug of interaction between \cs{autopar} and\cs{pausenumbering}.} -% \changes{v1.11.1}{2014/05/29}{Correct a bug when a critical note starts by plus or minus.} +% \changes{v1.11.1}{2014/05/29}{Correct a bug when a critical note starts with plus or minus.} +% \changes{v1.12.0}{2014/08/05}{Compatibility with \Lpack{musixtex}.} +% \changes{v1.12.0}{2014/08/05}{Debug eledmac sectioning command after using \cs{resumenumbering}.} % \hyphenation{man-u-script man-u-scripts} % -% \newcommand{\Lpack}[1]{\textsf{#1}} -% \newcommand{\Lclass}[1]{\textsf{#1}} -% \newcommand{\file}[1]{\texttt{#1}} -% \newcommand{\eledmac}{eledmac} -% \newcommand{\Eledmac}{\Lpack{\eledmac}} -% \newcommand{\edmac}{\texttt{EDMAC}} -% \newcommand{\tabmac}{\texttt{TABMAC}} -% \newcommand{\edstanza}{\texttt{EDSTANZA}} -% \newcommand{\texbook}{\textit{TeXbook}} -% \newcommand{\thetexbook}{\textit{The TeXbook}} % % ^^A PW added following as the definitions are at some unknown elsewhere % \newcommand{\egstart}{} @@ -293,10 +296,8 @@ % Other LaTeX packages for critical editions include EDNOTES, and % \Lpack{poemscol} for poetical works. % -% In October 2012, Maïeul Rouquette released the \emph{eledform} package\footnote{\url{http://www.ctan.org/eledform}.}. -% Based on eledmac, this package provides tools for creating a formal description (formalism) of textual variants. % -% To report bugs, please go to ledmac's GitHub page and click "New Issue": \url{https://github.com/maieul/ledmac/issues/}. You must open an account with github.com to access my page (maieul/ledmac). GitHub accounts are free for open-source users. You can report bug in English or in French. +% To report bugs, please go to ledmac's GitHub page and click "New Issue": \url{https://github.com/maieul/ledmac/issues/}. You must open an account with github.com to access my page (maieul/ledmac). GitHub accounts are free for open-source users. You can report bugs in English or in French. % % You can subscribe to the eledmac mail list in:\\ \url{https://lists.berlios.de/pipermail/ledmac-users/} % \end{abstract} @@ -560,9 +561,11 @@ % Since July~2011, ledmac is maintained by Ma\"ieul Rouquette. % % Important changes were put in version 1.0, to make eledmac more easily extensible (see \ref{displayoptions} p.\pageref{displayoptions}). -% They can make some little troubles with old customization. +% These changes can trigger small problems with the old customization. % That is why a new name was selected: \emph{eledmac}. To migrate from ledmac to eledmac, please read Appendix \ref{migration} (p.\pageref{migration}). % +% \subsubsection{List of works edited with (e)ledmac} +% A collaborative list of works edited with (e)ledmac is available on \url{https://www.zotero.org/groups/critical_editions_typeset_with_edmac_ledmac_and_eledmac/items}. Please add your own edition made with (e)ledmac. % % \section{The \Eledmac{} package}\label{howto} % @@ -678,6 +681,14 @@ % begins again.\par} % \egend % +% \changes{v1.12.0}{2014/08/05}{Optional arguments for \cs{pstart} and \cs{pend}.} +% Both \cs{pstart} and \cs{pend} can take a optional argument, in brackets. +% Its content will be printed before the beginning of the \cs{pstart} / after the end of the \cs{pend}. +% +% This feature is not needed for normal use of \Lpack{eledmac}, but it is needed when using verse (see~\ref{verse} p.~\pageref{verse}) or \Lpack{eledpar} (see~\ref{eledpar} p.~\pageref{eledpar}). +% +% A \cs{noindent} is automatically added before this argument. +% % \DescribeMacro{\autopar} % You can use \cs{autopar} to avoid the nuisance of this paragraph markup % and still have every paragraph automatically numbered. The scope of the @@ -734,6 +745,10 @@ % There are similar commands, \cs{firstsublinenum}\marg{num} and % \cs{sublinenumincrement}\marg{num} for controlling sub-line numbering. % +% \DescribeMacro{\numberpstarttrue}You can use the command \cs{numberpstarttrue} to insert a number on every \cs{pstart}. To stop the numbering, you must use \cs{numberpstartfalse}. To reset the numebering of \cs{pstarts}, insert +% \begin{verbatim} +%\setcounter{pstart}{0} +% \end{verbatim} % % \DescribeMacro{\pausenumbering} % \DescribeMacro{\resumenumbering} @@ -965,7 +980,6 @@ % the numbering of that particular line to be skipped; that is, the line % number is unchanged and no line number will be printed. % -% If you want to use the feature in a stanza, you should look at the \cs{falseverse} macro (p.~\pageref{falseverse}). % % \section{The apparatus} % \subsection{Commands} @@ -1162,15 +1176,6 @@ % \let\testimonia=\Cfootnote % \end{verbatim} % -% \paragraph{Formalism for textual criticism} -% -% If your notes are for textual criticism, you should -% use the \emph{eledform} package\footnote{\url{http://www.ctan.org/pkg/eledform}.}. -% -% This package provides tools to describes the textual variants in a -% formal way. -% -% It is based on eledmac for the typographical aspect. % % \subsection{Alternate footnote formatting} % If you just launch into \Eledmac{} using the commands outlined @@ -1323,13 +1328,13 @@ % \DescribeMacro{\Xendnotefontsize} % \cs{Xendnotefontsize}\oarg{s}\marg{l} is used to define the font size of end critical footnotes of the series. The default value is \cs{footnotesize}. % The \meta{command} must not be a size in pt, but a standard LaTeX size, like \cs{small}. -% \subsection{Font of the lemma} +% \subsubsection{Font of the lemma} % \changes{v1.11.0}{2014/05/09}{Add hooks to disable the font selection for lemma in footnote.} % \DescribeMacro{\Xlemmadisablefontselection} -% 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 command \cs{Xlemmadisablefontselection}\oarg{s} allows to disable it for a specific series. +% 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 \cs{Xlemmadisablefontselection}\oarg{s} command allows to disable it for a specific series. % % \DescribeMacro{\Xendlemmadisablefontselection} -% 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 \cs{Xendlemmadisablefontselection}\oarg{s} allows to disable it for a specific series. +% 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 \cs{Xendlemmadisablefontselection}\oarg{s} to disable it for a specific series. % % % \subsubsection{Styles of notes content} @@ -1382,6 +1387,13 @@ % \DescribeMacro{\parafootsep} % For paragraphed footnotes (see below), you can chooce the separator between each note by \cs{parafootsep}\oarg{s}\marg{l}. A common separator is a double pipe (\verb+$||$+), which you can set by \cs{parafootsep}\verb+{$||$}+. % +% \changes{v1.12.0}{2014/08/05}{New options to ragg paragraphed notes.} +% \DescribeMacro{\Xragged} +% Text in paragraphed critical notes is justified, but you can use \cs{Xragged}\oarg{s}+{L}+ if you want it to be ragged left, or \cs{Xragged}\oarg{s}+{R} if you want it to be ragged right. + +% \DescribeMacro{\raggedX} +% Text in paragraphed footnotes is justified, but you can use \cs{raggedX}\oarg{s}+{L}+ if you want it to be ragged left, or \cs{raggedX}\oarg{s}+{R} if you want it to be ragged right. +% %\subsubsection{Options for block of notes} % \changes{v1.1}{2012/09/12}{New options for block of notes.} % \DescribeMacro{\txtbeforeXnotes} @@ -1391,21 +1403,46 @@ % You can change the vertical space printed before the rule of the critical notes with \cs{beforeXnotes}\oarg{s}\marg{l}. % The default value is \verb|1.2em plus .6em minus .6em|. % +% \textbf{Be careful, the standard \LaTeX\ footnote rule, which is used by \Lpack{eledmac}, decreases 3pt. These 3pt are not changed by this command.} % \DescribeMacro{\beforenotesX} +% % You can change the vertical space printed before the rule of the familiar notes with \cs{beforenotesX}\oarg{s}\marg{l}. % The default value is \verb|1.2em plus .6em minus .6em|. % +% \textbf{Be careful, the standard \LaTeX\ footnote rule, which is used by \Lpack{eledmac}, decreases 3pt. These 3pt are not changed by this command.} +% +% \changes{v1.12.0}{2014/08/05}{New hooks: \cs{afterXrule} and \cs{afterruleX}} +% \DescribeMacro{\afterXrule} +% You can change the vertical space printed after the rule of the critical notes with \cs{afterXrule}\oarg{s}\marg{l}. +% The default value is \verb|0pt|. +% +% \textbf{Be careful, the standard \LaTeX\ footnote rule, which is used by \Lpack{eledmac}, adds 2.6pt. These 2.6pt are not changed by this command.} +% +% Be careful with this setting: it can place notes by the page number, at the bottom of the page. +% \DescribeMacro{\afterruleX} +% You can change the vertical space printed after the rule of the familiar notes with \cs{beforenotesX}\oarg{s}\marg{l}. +% % The default value is \verb|0pt|. +% +% \textbf{Be careful, the standard \LaTeX\ footnote rule, which is used by \Lpack{eledmac}, adds 2.6pt. These 2.6pt are not changed by this command.} +% +% Be careful with this setting: it can place notes by the page number, at the bottom of the page. +% % \DescribeMacro{\preXnotes} % You can set the space before the first series of critical notes printed on each page % and set a different amount of space for subsequent the series on the page. -% You can do it with \cs{preXnotes}\marg{l}. -% You can disable this feature by setting the length to 0~pt. +% You can do it with \cs{preXnotes}\marg{l}. Default value is \verb+0pt+. +% You can disable this feature by setting the length to 0pt. +% +% +% Be careful with this setting: it can place notes by the page number, at the bottom of the page. % % \DescribeMacro{\prenotesX} -% You can want the space before the first printed (in a page) series of familiar notes not to be the same as before other series. +% You can want the space before the first printed (in a page) series of familiar notes not to be the same as before other series. Default value is \verb+0pt+. % You can do it with \cs{prenotesX}\marg{l}. -% You can disable this feature by setting the length to 0~pt. +% You can disable this feature by setting the length to 0~pt. % +% +% Be careful with this setting: it could make the notes be written on the bottom pages number. % \DescribeMacro{\maxhXnotes} % By default, one series of critical notes can take 80\% of the page size, before being broken to the next page. % If you want to change the size use \cs{maxhXnotes}\oarg{s}\marg{l}. @@ -1532,7 +1569,7 @@ % If you need more than 5 series of critical footnotes you can % create extra series, using \cs{newseries} command. For example to create G and H series \cs{newseries}\verb+G,H+. % -% \section{Verse} +% \section{Verse}\label{verse} % % % In 1992 Wayne Sullivan\footnote{Department of Mathematics, @@ -1545,8 +1582,8 @@ % % With Wayne Sullivan's\index{Sullivan, Wayne} permission the majority % of this section has -% been taken from~\cite{EDSTANZA}. I have made a few changes to enable his -% macros to be used in the LaTeX \Lpack{eledmac} +% been taken from~\cite{EDSTANZA}. Peter has made a few changes to enable his +% macros to be used in the LaTeX \Lpack{ledmac}, and now in \Lpack{eledmac}. % package. % % @@ -1648,25 +1685,8 @@ % desirability of a page break at a given line. There is a subtle interaction % between penalties and \textit{glue}, so it may take some adjustment of skips % and penalties to achieve the best results. -% \subsection{False verse} -% \label{falseverse}In some special cases, you want to add false verse after true verse. -% This false verse: -% \begin{enumerate} -% \item Won't be numbered. -% \item Won't affect the indent of the next verse. -% \end{enumerate} -% It could be used, for example, to add some space between verses. -% To add this type of false verse, you have to finish the previous verse with \cs{falseverse} (and not with \verb+&+). -% For example: -% \begin{verbatim} -% True verse& -% True verse\falseverse -% \vspace{3ex}& -% True verse& -% True verse -% \end{verbatim} % \subsection{Hanging symbol} -% It's possible to insert a symbol in each line of hanging verse, as in French typography for `['., as in French typography for `['. To insert in eledmac, redefine macro \DescribeMacro{\hangingsymbol}\cmd{\hangingsymbol} with this code: +% It's possible to insert a symbol in each line of hanging verse, as in French typography for `['. To insert in eledmac, redefine macro \DescribeMacro{\hangingsymbol}\cmd{\hangingsymbol} with this code: % \begin{verbatim} % \renewcommand{\hangingsymbol}{[\,} % \end{verbatim} @@ -1720,6 +1740,13 @@ %\begin{verbatim} %\renewcommand{\hangingsymbol}{[\,} %\end{verbatim} +% \subsection{Text before/after verses} +% It is possible to add text, like a subtitle, before or after verse: +% \begin{itemize} +% \item \cs{stanza} command can take a optional argument (in brackets). Its content will be printed before the stanza. +% \item \verb+&+ can be replaced by \cs{newverse} with two optional arguments (in brackets). The first will be printed after the current verse, the second before the next verse. +% \item \verb+\&+ can take a optional argument (in brackets). Its content will be printed after the stanza. +% \end{itemize} % \section{Grouping} % In a \verb?minipage? environment LaTeX changes \verb?\footnote? numbering from % arabic to alphabetic and puts the footnotes at the end of the minipage. @@ -1795,6 +1822,7 @@ % generation of an unneeded \file{.end} file. % % \section{Cross referencing} +% \changes{v1.12.0}{2014/08/05}{Add hyperlink to crossref (needs \Lpack{hyperref} package).} % \label{crossref}\relax % The package provides a simple cross-referencing facility that allows % you to mark places in the text with labels, and generate page and @@ -1861,12 +1889,17 @@ % three variants of the reference commands, with the \verb"x" % prefix, are supplied: \cs{xpageref}, \cs{xlineref}, \cs{xsublineref} and \cs{xpstartref}. % They have these limitations: -% they will not tell you if the label is undefined, and they must +% \begin{itemize} +% \item They will not tell you if the label is undefined. +% \item They must % be preceded in the file by at least one of the four other % cross-reference commands---e.g., a \verb"\edlabel{foo}" command, % even if you never refer to that label---since those commands can all % do the necessary processing of the \file{.aux} file, and the \cs{x...} % ones cannot. +% \item When \Lpack{hyperref} is loaded, the hyperref link won't be added. (Indeed, +% it's not a limitation, but a feature. +% \end{itemize} % % \DescribeMacro{\xxref} % The macros \cs{xxref} and @@ -1910,11 +1943,15 @@ % The \cs{marginpar} command does not work in numbered text. Instead % the package provides for non-floating sidenotes in either margin. % +% \DescribeMacro{\ledinnernote} +% \DescribeMacro{\ledouternote} +% \cs{ledleftnote}\marg{text} will put \meta{text} into the inner margin level +% with where the command was issued. Similarly, \cs{ledouternote}\marg{text} +% puts \meta{text} in the outer margin. +% +% \changes{v1.12.0}{2014/08/05}{Add \cs{ledinnernote} and \cs{ledouternote} commands.} % \DescribeMacro{\ledleftnote} % \DescribeMacro{\ledrightnote} -% \cs{ledleftnote}\marg{text} will put \meta{text} into the left margin level -% with where the command was issued. Similarly, \cs{ledrightnote}\marg{text} -% puts \meta{text} in the right margin. % \changes{v1.0}{2012/09/15}{Possibility to have commands in sidenotes.} % \DescribeMacro{\ledsidenote} % \DescribeMacro{\sidenotemargin} @@ -2348,11 +2385,12 @@ % % % \section{Sectioning commands} -% \changes{v1.1}{2012/09/25}{sectioning commands} +% \changes{v1.1.0}{2012/09/25}{Sectioning commands.} +% \changes{v1.12.0}{2014/08/05}{New sectioning commands.}\label{eledsection} % The standard sectioning command (\cs{chapter}, \cs{section} etc.) can be used inside a numbered text. % But the line which contains it won't be numbered, and you can't add critical notes inside. -% -% However, eledmac provides the following commands: +% In the past (between versions 1.1.0 and 1.12.0), +% these following commands were provided: % \begin{itemize} % \item \cs{ledchapter}\oarg{text}\marg{critical text} % \item \cs{ledchapter*} @@ -2363,29 +2401,35 @@ % \item \cs{ledsubsubsection}\oarg{text}\marg{critical text} % \item \cs{ledsubsubsection*} % \end{itemize} -% Which are the equivalent of the standard LaTeX commands, but be careful. -% Note the following points: -% \begin{enumerate} -% \item All these commands close a \cs{pstart}, and open a new one. The content of the command itself is between \cs{pstart} and \cs{pend}. -% \item Don't try to make \verb|\let\chapter\ledchapter|, or other things like it: the \cs{led}section commands call the standard commands. -% \item For the non-starred sections, use the optional argument \meta{text} to provide the text to the table of contents. -% \item The \cs{ledchapter} doesn't open a new page. You must use \cs{beforeledchapter} before. This also closes a \cs{pstart} and opens a new. -% \end{enumerate} -% -% \changes{v1.8.0}{2013/12/13}{Add \cs{ledsecnolinenumber} option.} -% If you use \Lpack{eledpar}, you must use these commands to have parallel sectioning. -% However, if you don't want lineation in sectioning command, use the \verb+ledsecnolinenumber+ option when loading eledmac. Or add \cs{ledsecnolinenumbertrue} in your preamble. -% \changes{v1.2}{2012/10/13}{Add \cs{ledsectnotoc} command.} -% \DescribeMacro{\ledsectnotoc} -% You can create a table of contents that indexes only the titles that appear on the left side of the edition: -% for instance, titles from the original language, not the translation. -% You could use \cs{ledsectnotoc} at the beginning of the side environnment : +% These commands are deprecated, and won't be maintened anymore, because of a bad conception. +% Since version 1.12.0, you have to use the following commands: +% \begin{itemize} +% \item \cs{eledchapter}\oarg{text}\marg{critical text} +% \item \cs{eledchapter*} +% \item \cs{eledsection}\oarg{text}\marg{critical text} +% \item \cs{eledsection*} +% \item \cs{eledsubsection}\oarg{text}\marg{critical text} +% \item \cs{eledsubsection*} +% \item \cs{eledsubsubsection}\oarg{text}\marg{critical text} +% \item \cs{eledsubsubsection*} +% \end{itemize} +% Which are equivalent to the \LaTeX\ commands. Each indivual command must be called alone in a \cs{pstart}\ldots\cs{pend}: % \begin{verbatim} -% \begin{Rightside} -% \ledsectnotoc -% ... -% \end{Rightside} +%\pstart +%\eledsection*{xxxx\ledsidenote{section}} +%\pend +%\pstart +%\eledsubsection*{xxxx\ledsidenote{sub}} +%\pend +%\pstart +%normal text +%\pend % \end{verbatim} +% At the first run, you will see only the text. It's normal. +% At the second run, you will see the formating. +% And consequently, at the third run, you will see the table of contents. +% +% For technical reason, the page break before \cs{elechapter} can't be add automatically. You have to insert it manually via \cs{beforeeledchapter}, which must be called outside of a numbering section. % \section{Quotation environments} % The \verb+quotation+ and \verb+quote+ environment can be used so that same definition/note appears both inside and outside a numbered section. % The typographical consequences will resemble the outside numbered sections, based on the styles of the \emph{book} class. @@ -2406,12 +2450,12 @@ % \textbf{These commands have effect only at the second run}. % % These two commands take effect at the beginning of line in which they are called. For example, if you call \cs{ledpb} at l.~444, the l.~443 will be at the p.~$n$, and the l.~444 at the p.~$n+1$. -% \DescribeMacro{\ledpbsetting} However you can change the behavior, and decide they will have effect after the end of the line, adding \verb+\ledpbsetting{after}+ at the begining of your file (better: in your preamble). With the previous example, the l.~444 will be at the p.~$n$ and the l.~445 will be at the p.~$n+1$. +% \DescribeMacro{\ledpbsetting} However you can change the behavior, and decide they will have effect after the end of the line, adding \verb+\ledpbsetting{after}+ at the beginning of your file (better: in your preamble). With the previous example, the l.~444 will be at the p.~$n$ and the l.~445 will be at the p.~$n+1$. % % If you are using \Lpack{eledpar} to typeset parallel pages you must use \cs{lednopb} on % both sides in the two corresponding lines. This is especially important when you are using % stanzas; otherwise the pages will run out of sync. -% \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 \cs{lednopbinversetrue} in the begining of your file (better: in your preamble). This feature works only with verse of 2 lines, not more. It works at the third run, or at fourth run with \Lpack{eledpar}. +% \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 \cs{lednopbinversetrue} in the beginning of your file (better: in your preamble). This feature works only with verse of 2 lines, not more. It works at the third run, or at fourth run with \Lpack{eledpar}. % By default, when a long verse runs normally between two pages, a page break will be placed at the beginning of the verse. However, if you have added\verb+ledpbsetting{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. % \section{Miscellaneous} % @@ -2590,7 +2634,7 @@ % on a solution. % % -% \subsection{Parallel typesetting} +% \subsection{Parallel typesetting}\label{eledpar} % % % Peter Wilson has developed the Ledpar package @@ -2786,7 +2830,7 @@ % \begin{macrocode} %<*code> \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{eledmac}[2014/05/29 v1.11.1 LaTeX port of EDMAC] +\ProvidesPackage{eledmac}[2014/08/05 v1.12.0 LaTeX port of EDMAC]% % \end{macrocode} % % Generally, these are the modifications to the original. @@ -2838,7 +2882,7 @@ % \end{macro} % Loading package \emph{xargs} to declare commands with optional arguments. % \emph {Etoolbox} is also used to make code clearer - for example, in dynamic command names (which can replace \cs{csname} etc.). -% Use \emph{suffix} to declare commands with a starred version, \Lpack{xstring} to work with strings and \emph{iflutex} to test if LuaLaTeX is running. +% Use \emph{suffix} to declare commands with a starred version, \Lpack{xstring} to work with strings and \emph{iflutex} to test if LuaLaTeX is running, and \Lpack{ragged2e} to manage ragging for paragraphed notes. % \changes{v1.4}{2012/11/16}{Compatibility with LuaTeX of RTL notes.} % \begin{macrocode} \RequirePackage{xargs} @@ -2847,6 +2891,7 @@ \RequirePackage{suffix} \RequirePackage{xstring} \RequirePackage{ifluatex} +\RequirePackage{ragged2e} % \end{macrocode} % \begin{macro}{\if@RTL} % The \cs{if@RTL} is defined by the bidi package, which is sometimes loaded by \emph{polyglossia}. @@ -3181,20 +3226,26 @@ % \begin{macro}{\pst@rtedLfalse} % \begin{macro}{\l@dnumpstartsL} % \begin{macro}{\ifledRcol} +% \begin{macro}{\ifledRcol@} % In preparation for the \Lpack{eledpar} package, these are related to % the `left' text of parallel texts (when \cs{ifl@dpairing} is TRUE). % They are explained in the \Lpack{eledpar} % manual. % \changes{v0.7}{2005/02/24}{Added \cs{l@dnumpstartsL}, \cs{ifl@dpairing} % and \cs{ifpst@rted} for/from eledpar} -% \changes{v0.12}{2005/10/01}{Added \cs{ifledRcol} and \cs{ifnumberingR} for/from eledpar} +% \changes{v0.12}{2005/10/01}{Added \cs{ifledRcol} and \cs{ifnumberingR} for/from \Lpack{eledpar}} +% \changes{v1.12.0}{2014/08/05}{Add \cs{ifledRcol@} for \Lpack{eledpar}} % \begin{macrocode} \newif\ifl@dpairing \l@dpairingfalse \newif\ifpst@rtedL \pst@rtedLfalse \newcount\l@dnumpstartsL +% \end{macrocode} +% \cs{ifledRcol} is set to true in the \verb+Rightside+ environnement. It must be distingued from \cs{ifledRcol@} which is set to true when a right line is processed, in \cs{Pages} or \cs{Columns}. +% \begin{macrocode} \newif\ifledRcol +\newif\ifledRcol@ % \end{macrocode} % The \cs{ifnumberingR} flag is % set to \verb"true" if we're within a right text numbered section. @@ -3210,6 +3261,7 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % \begin{macro}{\beginnumbering} % \begin{macro}{\initnumbering@reg} % \cs{beginnumbering} begins a section of numbered text. @@ -3230,6 +3282,12 @@ % should be no direct interaction between the use of these counters % and variables in the two processing steps. % \changes{v0.7}{2005/02/24}{Added \cs{initnumbering@reg}} +% \changes{v1.12.0}{2014/08/05}{\cs{beginnumbering} is defined only on \Lpack{eledmac}, not on \Lpack{eledpar}.} +% For parallel processing : +%\begin{itemize} +% \item zero \cs{l@dnumpstartsL} --- the number of chunks to be processed. +% \item set \cs{ifpst@rtedL} to FALSE. +% \end{itemize} % \begin{macrocode} \newcommand*{\beginnumbering}{% \ifnumbering @@ -3243,8 +3301,25 @@ \line@list@stuff{\jobname.\extensionchars\the\section@num}% \l@dend@stuff \setcounter{pstart}{1} - \ifl@dpairing\else\begingroup\fi - \initnumbering@sectcmd + \ifl@dpairing + \global\l@dnumpstartsL \z@ + \global\pst@rtedLfalse +% \end{macrocode} +% The tools for section's title commands are called: +% \begin{itemize} +% \item Define old (deprecated) sectioning commands. +% \item Define an empty list of pstart number where sectioning commands are called. +% \item Input auxiliary file with the description of section titles. +% \item Open the same auxiliary file to write in. +% \end{itemize} +% \begin{macrocode} + \else + \begingroup + \initnumbering@sectcmd + \fi + \gdef\eled@sections@@{} + \makeatletter\InputIfFileExists{\jobname.eledsec\the\section@num}{}{}\makeatother + \immediate\openout\eled@sectioning@out=\jobname.eledsec\the\section@num\relax } \newcommand*{\initnumbering@reg}{% \global\pst@rtedLfalse @@ -3268,155 +3343,6 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\initnumbering@sectcmd} -% \begin{macro}{\ledsection} -% \begin{macro}{\ledsection*} -% \begin{macro}{\ledsubsection} -% \begin{macro}{\ledsubsection*} -% \begin{macro}{\ledsubsubsection} -% \begin{macro}{\ledsubsubsection*} -% \begin{macro}{\ledchapter} -% \begin{macro}{\ledchapter*} -% \begin{macro}{\quotation} -% \begin{macro}{\endquotation} -% \begin{macro}{\quote} -% \begin{macro}{\endquote} -% \changes{v1.2}{2012/10/08}{Compatibility of \cs{ledchapter} with the \emph{memoir} class.} -% \changes{v1.3}{2012/11/01}{\emph{Quotation} and {quote} environment inside the numbering sections.} -% \changes{v1.4.1}{2012/11/16}{New option \emph{noquotation}.} -% \changes{v1.4.7}{2012/06/07}{Compatibility of sectioning commands with \cs{autopar}.} -% \changes{v1.8.0}{2013/12/13}{Correction of sectioning commands in parallel texts.} -% \changes{v1.10.0}{2014/02/27}{Correction of sectioning commands in parallel texts.} -% \cs{initnumbering@sectcmd} defines sectioning commands inside numbered section. -% It also defines quotation environment. -% Note: this assumes that the user didn't change \cs{chapter}. -% If he did, he should redefine \cs{initnumbering@sectcmd}. -% \begin{macrocode} -\newcommand{\initnumbering@sectcmd}{ - \newcommand{\ledsection}[2][]{% - \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi%% - \pstart% - \leavevmode\ifledsecnolinenumber\skipnumbering\fi\section[##1]{##2}\leavevmode\vspace{2.3ex \@plus.2ex}\skipnumbering\pend% - \vspace{-2\parskip}\vspace{-2\baselineskip}% - \ifautopar\else\pstart\fi - } - \WithSuffix\newcommand\ledsection*[1]{% - \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi% - \pstart% - \leavevmode\ifledsecnolinenumber\skipnumbering\fi\section*{##1}\leavevmode\vspace{2.3ex \@plus.2ex}\skipnumbering\pend% - \vspace{-2\parskip}\vspace{-2\baselineskip}% - \ifautopar\else\pstart\fi - } - \newcommand{\ledsubsection}[2][]{% - \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi% - \pstart% - \leavevmode\ifledsecnolinenumber\skipnumbering\fi\subsection[##1]{##2}\leavevmode\vspace{1.5ex \@plus .2ex}\skipnumbering\pend% - \vspace{-2\parskip}\vspace{-2\baselineskip}% - \ifautopar\else\pstart\fi - } - \WithSuffix\newcommand\ledsubsection*[1]{% - \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi% - \pstart% - \leavevmode\ifledsecnolinenumber\skipnumbering\fi\subsection*{##1}\leavevmode\vspace{1.5ex \@plus .2ex}\skipnumbering\pend% - \vspace{-2\parskip}\vspace{-2\baselineskip}% - \ifautopar\else\pstart\fi - } - \newcommand{\ledsubsubsection}[2][]{% - \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi% - \pstart% - \leavevmode\ifledsecnolinenumber\skipnumbering\fi\subsubsection[##1]{##2}\leavevmode\vspace{1.5ex \@plus .2ex}\skipnumbering\pend% - \vspace{-2\parskip}\vspace{-2\baselineskip}% - \ifautopar\else\pstart\fi - } - \WithSuffix\newcommand\ledsubsubsection*[1]{% - \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi% - \pstart% - \leavevmode\ifledsecnolinenumber\skipnumbering\fi\subsubsection*{##1}\leavevmode\vspace{1.5ex \@plus .2ex}\skipnumbering\pend% - \vspace{-2\parskip}\vspace{-2\baselineskip}% - \ifautopar\else\pstart\fi - } - \newcommand\ledchapter[2][]{\ifl@dmemoir\gdef\ch@pt@c{##1}\fi~\pend\skipnumbering\pstart\chapter[##1]{##2}\pend\pstart} - \WithSuffix\newcommand\ledchapter*[1]{~\pend\skipnumbering\pstart\chapter*{##1}\pend\pstart} - \patchcmd{\@makeschapterhead}{1\par}{1}{}{} - \pretocmd{\@makeschapterhead}{\par}{}{} - \apptocmd{\@makeschapterhead}{\par}{}{} - \patchcmd{\@makeschapterhead}{\vskip 40\p@}{}{}{} - \patchcmd{\@makechapterhead}{1\par}{1}{}{} - \pretocmd{\@makechapterhead}{\par}{}{} - \apptocmd{\@makechapterhead}{\par}{}{} - \patchcmd{\@makechapterhead}{\vskip 40\p@}{}{}{} - \apptocmd{\@chapter}{\par\leavevmode\vspace{40 \p@}\skipnumbering}{}{} - \apptocmd{\@schapter}{\par\leavevmode\vspace{40 \p@}\skipnumbering}{}{} - \newcommand\beforeledchapter{\pend\cleardoublepage\pstart} - \patchcmd{\chapter}{\cleardoublepage}{\relax}{}{} - \patchcmd{\chapter}{\clearpage}{\relax}{}{} - \ifnoquotation@\else - \renewcommand{\quotation}{\par\leavevmode% - \parindent=1.5em% - \skipnumbering% - \ifautopar% - \vskip-\parskip% - \else% - \vskip\topsep% - \fi% - \global\leftskip=\leftmargin% - \global\rightskip=\leftmargin% - } - \renewcommand{\endquotation}{\par% - \global\leftskip=0pt% - \global\rightskip=0pt% - \leavevmode% - \skipnumbering% - \ifautopar% - \vskip-\parskip% - \else% - \vskip\topsep% - \fi% - } - \renewcommand{\quote}{\par\leavevmode% - \parindent=0pt% - \skipnumbering% - \ifautopar% - \vskip-\parskip% - \else% - \vskip\topsep% - \fi% - \global\leftskip=\leftmargin% - \global\rightskip=\leftmargin% - } - \renewcommand{\endquote}{\par% - \global\leftskip=0pt% - \global\rightskip=0pt% - \leavevmode% - \skipnumbering% - \ifautopar% - \vskip-\parskip% - \else% - \vskip\topsep% - \fi% - } - \fi -} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \begin{macro}{\ledsectnotoc} -% The \cs{ledsectnotoc} only disables the \cs{addcontentsline} macro. -% \begin{macrocode} -\newcommand{\ledsectnotoc}{\let\addcontentsline\@gobblethree} -% \end{macrocode} -% \end{macro} % \begin{macro}{\endnumbering} % \cs{endnumbering} must follow the last text for a numbered section. % It takes care of notifying you when changes have been noted in the @@ -3444,7 +3370,12 @@ \else \led@err@NumberingNotStarted \fi - \autoparfalse\ifl@dpairing\else\endgroup\fi} + \autoparfalse + \immediate\closeout\eled@sectioning@out + \ifl@dpairing\else + \endgroup + \fi +} % \end{macrocode} % \end{macro} % @@ -3476,6 +3407,7 @@ \line@list@stuff{\jobname.\extensionchars\the\section@num}% \l@dend@stuff \begingroup + \initnumbering@sectcmd \else \led@err@NumberingShouldHaveStarted \endnumbering @@ -3487,7 +3419,6 @@ % \end{macro} % \end{macro} % -% % \section{Line counting} % \label{lineation}\relax % @@ -4201,7 +4132,7 @@ % Inside the apparatus, at each note, the page number is stored in a macro called \cs{prevpageX@num}, % where X is the letter of the current series. % This macro is called when using \cs{parafootsep}. -% This macro must be reset at the begining of each numbered section +% This macro must be reset at the beginning of each numbered section % The \cs{resetprevpage@} command resets this macro for every series. % \begin{macro}{\resetprevpage@} % \begin{macrocode} @@ -4325,7 +4256,7 @@ % This section defines the commands that can appear within a % line-list file. They all have very short names because we are % likely to be writing very large numbers of them out. One macro, -% \cs{@l}, is especially short, since it will be written to the +% \cs{@nl}, is especially short, since it will be written to the % line-list file once for every line of text in a numbered section. % (Another of these commands, \cs{@lab}, will be introduced in a % later section, among the cross-referencing commands it is @@ -4341,9 +4272,10 @@ % that modifies the action-code list: again, this is so that they % can be turned off easily for nested calls of \cs{@ref}. % -% \begin{macro}{\@l} -% \begin{macro}{\@l@reg} -% \cs{@l} does everything related to the start of a +% \begin{macro}{\@nl} +% \begin{macro}{\@nl@reg} +% \changes{v1.12.0}{2014/08/05}{To ensure compatibility with \cs{musixtex}, \cs{@l} becomes \cs{@l}. Consequently, \cs{@l@reg} becomes \cs{@nl@reg}.} +% \cs{@nl} does everything related to the start of a % new line of numbered text. % % In order to get the \verb?\setlinenum? to work Peter Wilson had to slip in some new @@ -4357,21 +4289,21 @@ % % In November 2004 in order to accurately determine page numbers Peter Wilson added % these to the macro. It is now: \\ -% \cs{@l}\marg{page counter number}\marg{printed page number} \\ +% \cs{@nl}\marg{page counter number}\marg{printed page number} \\ % I don't (yet) use the printed number (i.e., the \verb?\thepage?) but % it may come in handy later. The macro \cs{fix@page} checks if a new % page has started. % -% \changes{v0.3}{2004/02/14}{Added a bunch of code to \cs{@l} for handling +% \changes{v0.3}{2004/02/14}{Added a bunch of code to \cs{@nl} for handling % \cs{setlinenum}} -% \changes{v0.6}{2004/11/16}{Extended \cs{@l} to include the page number} -% \changes{v0.6}{2004/11/16}{Added \cs{fix@page} to \cs{@l}} -% \changes{v0.7}{2005/02/22}{Added \cs{@l@reg}} +% \changes{v0.6}{2004/11/16}{Extended \cs{@nl} to include the page number} +% \changes{v0.6}{2004/11/16}{Added \cs{fix@page} to \cs{@nl}} +% \changes{v0.7}{2005/02/22}{Added \cs{@nl@reg}} % \begin{macrocode} -\newcommand{\@l}[2]{% +\newcommand{\@nl}[2]{% \fix@page{#1}% - \@l@reg} -\newcommand*{\@l@reg}{% + \@nl@reg} +\newcommand*{\@nl@reg}{% \ifx\l@dchset@num\relax \else \advance\absline@num \@ne \set@line@action @@ -4437,7 +4369,7 @@ % \begin{macro}{\last@page@num} % \begin{macro}{\fix@page} % \cs{fix@page} basically replaces \cs{@page}. It determines whether or not -% a new page has been started, based on the page values held by \cs{@l}. +% a new page has been started, based on the page values held by \cs{@nl}. % \changes{v0.6}{2004/11/16}{Added \cs{last@page@num} and \cs{fix@page}} % \begin{macrocode} \newcount\last@page@num @@ -4485,7 +4417,7 @@ % The \cs{sub@on} and \cs{sub@off} macros % turn sub-lineation on and off\/: but not directly, since such changes % don't really take effect until the next line of text. Instead -% they set a flag that notifies \cs{@l} of the necessary action. +% they set a flag that notifies \cs{@nl} of the necessary action. % \begin{macrocode} \newcommand*{\sub@on}{\ifsublines@ \let\sub@change=\relax @@ -4878,7 +4810,7 @@ % \end{macro} % % \begin{macro}{\new@line} -% The \cs{new@line} macro sends the \cs{@l} command to the line-list +% The \cs{new@line} macro sends the \cs{@nl} command to the line-list % file, to mark the start of a new text line, and its page number. % \changes{v0.6}{2004/11/16}{Extended \cs{new@line} to output page numbers} % \begin{macrocode} @@ -4887,27 +4819,25 @@ {\xifinlistcs{\the\absline@num}{l@prev@nopb}% {\xifinlistcs{\the\absline@num}{normal@page@break}% {\numgdef{\@next@page}{\thepage+1}% - \write\linenum@out{\string\@l[\@next@page][\@next@page]}% + \write\linenum@out{\string\@nl[\@next@page][\@next@page]}% }% - {\write\linenum@out{\string\@l[\the\c@page][\thepage]}}% + {\write\linenum@out{\string\@nl[\the\c@page][\thepage]}}% }% - {\write\linenum@out{\string\@l[\the\c@page][\thepage]}}}% + {\write\linenum@out{\string\@nl[\the\c@page][\thepage]}}}% {}% \IfStrEq{\led@pb@setting}{before}% - {% -\numdef{\next@absline}{\the\absline@num+1}% -\xifinlistcs{\next@absline}{l@prev@nopb}% - {\xifinlistcs{\the\absline@num}{normal@page@break}% - {% - \numgdef{\nc@page}{\c@page+1}% - \write\linenum@out{\string\@l[\nc@page][\nc@page]}% + {\numdef{\next@absline}{\the\absline@num+1}% + \xifinlistcs{\next@absline}{l@prev@nopb}% + {\xifinlistcs{\the\absline@num}{normal@page@break}% + {\numgdef{\nc@page}{\c@page+1}% + \write\linenum@out{\string\@nl[\nc@page][\nc@page]}% + }% + {\write\linenum@out{\string\n@l[\the\c@page][\thepage]}}% + }% + {\write\linenum@out{\string\@nl[\the\c@page][\thepage]}}% }% - {\write\linenum@out{\string\@l[\the\c@page][\thepage]}}% - }% - {\write\linenum@out{\string\@l[\the\c@page][\thepage]}}% -}% - {}% - \IfStrEqCase{\led@pb@setting}{{before}{\relax}{after}{\relax}}[\write\linenum@out{\string\@l[\the\c@page][\thepage]}]% + {}% + \IfStrEqCase{\led@pb@setting}{{before}{\relax}{after}{\relax}}[\write\linenum@out{\string\@nl[\the\c@page][\thepage]}]% } % \end{macrocode} @@ -5609,7 +5539,7 @@ % \begin{macro}{\numberpstartfalse} % \begin{macro}{\labelpstarttrue} % \begin{macro}{\labelpstartfalse} -% \begin{macro}{thepstart} +% \begin{macro}{\thepstart} % \cs{pstart} starts the paragraph by % clearing the \cs{inserts@list} list and other % relevant variables, and then arranges for the @@ -5622,11 +5552,7 @@ % is happening within a group; definitions must be global if you want % them to survive past the end of the paragraph. % -%You can use the command \cs{numberpstarttrue} to insert a number on every \cs{pstart}. To stop the numbering, you must use \cs{numberpstartfalse}. To reset the numebering of \cs{pstarts}, insert -% \begin{verbatim} -%\setcounter{pstart}{0} -% \end{verbatim} -% +% \changes{v1.12.0}{2014/08/05}{New optional argument for \cs{pstart}, to execute code before it.} % \begin{macrocode} \newcounter{pstart} @@ -5635,14 +5561,15 @@ \numberpstartfalse \newif\iflabelpstart \labelpstartfalse -\newcommand*{\pstart}{% -\if@nobreak% - \let\@oldnobreak\@nobreaktrue% -\else% - \let\@oldnobreak\@nobreakfalse% -\fi% -\@nobreaktrue% -\ifnumbering \else% +\newcommandx*{\pstart}[1][1]{% + \ifstrempty{#1}{}{\noindent#1}% + \if@nobreak% + \let\@oldnobreak\@nobreaktrue% + \else% + \let\@oldnobreak\@nobreakfalse% + \fi% + \@nobreaktrue% + \ifnumbering \else% \led@err@PstartNotNumbered% \beginnumbering% \fi% @@ -5653,6 +5580,7 @@ \list@clear{\inserts@list}% \global\let\next@insert=\empty% \begingroup\normal@pars% + \global\advance \l@dnumpstartsL\@ne \global\setbox\raw@text=\vbox\bgroup% \ifautopar\else% \ifnumberpstart% @@ -5665,7 +5593,8 @@ \fi% \numberedpar@true% \iflabelpstart\protected@edef\@currentlabel% - {\p@pstart\thepstart}\fi% + {\p@pstart\thepstart} + \fi% } % \end{macrocode} % \end{macro} @@ -5675,11 +5604,12 @@ % \end{macro} % \end{macro} % \begin{macro}{\pend} +% \changes{v1.12.0}{2014/08/05}{New optional argument for \cs{pend}, to execute code after it.} % \changes{v1.6.1}{2013/10/27}{Spurious space in \cs{pend}.} % \cs{pend} must be used to end a numbered paragraph. % % \begin{macrocode} -\newcommand*{\pend}{\ifnumbering \else% +\newcommandx*{\pend}[1][1]{\ifnumbering \else% \led@err@PendNotNumbered% \fi% \ifnumberedpar@ \else% @@ -5720,7 +5650,9 @@ \pstartnumtrue% \fi% \@oldnobreak% - \addtocounter{pstart}{1}} + \addtocounter{pstart}{1}% + \ifstrempty{#1}{}{\noindent#1}% +} % \end{macrocode} % \end{macro} @@ -5808,7 +5740,7 @@ % \begin{macro}{\ifautopar@pause} % We define a boolean test switched to true at the beginning % of the \cs{pausenumbering} command if the autopar is enabled. -% This boolean will be tested at the begining of \cs{resumenumbering} +% This boolean will be tested at the beginning of \cs{resumenumbering} % to continue the autopar if neeeded. % \begin{macrocode} \newif\ifautopar@pause @@ -5839,18 +5771,57 @@ \fi \check@pb@in@verse \affixline@num - \affixpstart@num - \hb@xt@ \linewidth{\do@insidelinehook\l@dld@ta\add@inserts\affixside@note - \l@dlsn@te - {\ledllfill\hb@xt@ \wd\one@line{\new@line\inserthangingsymbol\l@dunhbox@line{\one@line}}\ledrlfill\l@drd@ta% - \l@drsn@te - }} + \add@inserts\affixside@note +% \end{macrocode} +% \changes{v1.12.0}{2014/08/05}{\cs{do@line} is splitted in more little commands.} +% Depending wether a sectioning command is called at this pstart or not +% we print sectioning command or normal line, +% \begin{macrocode} + \xifinlist{\the\l@dnumpstartsL}{\eled@sections@@}% + {\print@eledsection}% + {\print@line}% \IfStrEq{\led@pb@setting}{after}{\led@check@pb\led@check@nopb}{} }% % \end{macrocode} % \end{macro} % \end{macro} % +% \begin{macro}{\print@line} +% \begin{macrocode} +% \cs{print@line} is for normal line, i. e line without sectioning command. +\def\print@line{ + \affixpstart@num% + \hb@xt@ \linewidth{\do@insidelinehook\l@dld@ta + \l@dlsn@te + {\ledllfill\hb@xt@ \wd\one@line{\new@line\inserthangingsymbol \l@dunhbox@line{\one@line}}\ledrlfill\l@drd@ta% + \l@drsn@te + }}% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\print@eledsection} +% \cs{print@eledsection} to print sectioning command with line number. +% It sets the correct spacing, depending whether a sectioning command was called at previous \cs{pstart}, calls the sectioning command, prints the normal line outside of the paper, to be able to have critical footnotes. +% Because of this printing, a vertical spacing correction is added. +% \begin{macrocode} +\def\print@eledsection{% + \numdef{\temp@}{\l@dnumpstartsL-1}% + \xifinlist{\temp@}{\eled@sections@@}{\@nobreaktrue}{\@nobreakfalse}% + \@eled@sectioningtrue% + \csuse{eled@sectioning@\the\l@dnumpstartsL}% + \@eled@sectioningfalse% + \global\csundef{eled@sectioning@\the\l@dnumpstartsL}% + \if@RTL% + \hspace{-\paperwidth}% + {\hbox{\l@dunhbox@line{\one@line}}\new@line}% + \else% + \hspace{\paperwidth}% + {\new@line \hbox{\l@dunhbox@line{\one@line}}}% + \fi% + \vskip-\baselineskip% +} +% \end{macrocode} +% \end{macro} % \begin{macro}{\do@linehook} % \begin{macro}{\do@insidelinehook} % Two hooks into \cs{do@line}. The first is called at the beginning of \cs{do@line}, the second is called in the line box. @@ -5868,13 +5839,17 @@ % \begin{macro}{\l@dld@ta} % \begin{macro}{\l@drd@ta} % \begin{macro}{\l@dcsnotetext} +% \begin{macro}{\l@dcsnotetext@l} +% \begin{macro}{\l@dcsnotetext@r} % Nulls the \cs{...d@ta}, which may later hold line numbers. -% Similarly for \cs{l@dcsnotetext} for the texts of the sidenotes. +% Similarly for \cs{l@dcsnotetext}, \cs{l@dcsnotetext@l}, \cs{l@dcsnotetext@r} for the texts of the sidenotes, left and right notes. % \changes{v0.7}{2005/02/18}{Added \cs{l@demptyd@ta}} % \begin{macrocode} \newcommand*{\l@demptyd@ta}{% \gdef\l@dld@ta{}% \gdef\l@drd@ta{}% + \gdef\l@dcsnotetext@l{}% + \gdef\l@dcsnotetext@r{}% \gdef\l@dcsnotetext{}} % \end{macrocode} @@ -5882,6 +5857,8 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\l@dlsn@te} % \begin{macro}{\l@drsn@te} @@ -7102,7 +7079,9 @@ }% \vskip\skip\csname #1footins\endcsname% \leftskip0pt \rightskip0pt - \csname #1footnoterule\endcsname\noindent\leavevmode} + \csname #1footnoterule\endcsname% + \vskip\csuse{afterXrule@#1}% + \noindent\leavevmode} % \end{macrocode} % \end{macro} % @@ -7141,9 +7120,11 @@ \ifl@dpairing% \else% \@nameuse{#1footnoterule}% + \vskip\csuse{afterXrule@#1}% \fi% \else% \@nameuse{#1footnoterule}% + \vskip\csuse{afterXrule@#1}% \fi% \setlength{\parindent}{0pt} {\csuse{Xnotefontsize@#1}\csuse{txtbeforeXnotes@#1}} @@ -7296,6 +7277,8 @@ \expandafter\let\csname #1footfmt\endcsname=\parafootfmt \expandafter\let\csname #1footgroup\endcsname=\para@footgroup \count\csname #1footins\endcsname=1000 + \dimen\csname #1footins\endcsname=\csuse{maxhXnotes@#1} + \skip\csname #1footins\endcsname=\csuse{beforeXnotes@#1} \para@footsetup{#1} % \end{macrocode} % And the extra setup for minipages. @@ -7303,6 +7286,8 @@ \expandafter\let\csname mpv#1footnote\endcsname=\mppara@vfootnote \expandafter\let\csname mp#1footgroup\endcsname=\mppara@footgroup \count\csname mp#1footins\endcsname=1000 + \dimen\csname mp#1footins\endcsname=\csuse{maxhXnotes@#1} + \skip\csname mp#1footins\endcsname=\csuse{beforeXnotes@#1} } % \end{macrocode} % \end{macro} @@ -7365,7 +7350,9 @@ {}% }% \vskip\skip\csname #1footins\endcsname% - \csname #1footnoterule\endcsname\noindent\leavevmode} + \csname #1footnoterule\endcsname% + \vskip\csuse{afterXrule@#1}% + \noindent\leavevmode} % \end{macrocode} % \end{macro} % @@ -7573,6 +7560,8 @@ % \begin{macrocode} \newcommand*{\para@footgroup}[1]{% \unvbox\csname #1footins\endcsname + \ifcsstring{Xragged@#1}{L}{\RaggedLeft}{}% + \ifcsstring{Xragged@#1}{R}{\RaggedRight}{}% \makehboxofhboxes \setbox0=\hbox{{\csuse{Xnotefontsize@#1}\csuse{txtbeforeXnotes@#1}}\unhbox0 \removehboxes}% \csuse{Xnotefontsize@#1} @@ -7595,11 +7584,15 @@ \ifl@dpairing% \else% \@nameuse{#1footnoterule}% + \vskip\csuse{afterXrule@#1}% \fi% \else% \@nameuse{#1footnoterule}% + \vskip\csuse{afterXrule@#1}% \fi% \unvbox\csname mp#1footins\endcsname + \ifcsstring{Xragged@#1}{L}{\RaggedLeft}{}% + \ifcsstring{Xragged@#1}{R}{\RaggedRight}{}% \makehboxofhboxes \setbox0=\hbox{{\csuse{Xnotefontsize@#1}\csuse{txtbeforeXnotes@#1}}\unhbox0 \removehboxes}% \csuse{Xnotefontsize@#1} @@ -7842,9 +7835,11 @@ \ifl@dpairing% \else% \@nameuse{#1footnoterule}% + \vskip\csuse{afterXrule@#1}% \fi% \else% \@nameuse{#1footnoterule}% + \vskip\csuse{afterXrule@#1}% \fi% {\csuse{Xnotefontsize@#1}\noindent\csuse{txtbeforeXnotes@#1}}\par \splittopskip=\ht\strutbox @@ -7949,9 +7944,11 @@ \ifl@dpairing% \else% \@nameuse{#1footnoterule}% + \vskip\csuse{afterXrule@#1}% \fi% \else% \@nameuse{#1footnoterule}% + \vskip\csuse{afterXrule@#1}% \fi% {\csuse{Xnotefontsize@#1}\noindent\csuse{txtbeforeXnotes@#1}}\par \splittopskip=\ht\strutbox @@ -8219,7 +8216,8 @@ \vskip\skip\csname footins#1\endcsname% \leftskip=\z@ \rightskip=\z@ - \@nameuse{footnoterule#1}} + \@nameuse{footnoterule#1}% + \vskip\csuse{afterruleX@#1}} % \end{macrocode} % \end{macro} @@ -8256,9 +8254,11 @@ \ifl@dpairing% \else% \@nameuse{footnoterule#1}% + \vskip\csuse{afterruleX@#1}% \fi% \else% \@nameuse{footnoterule#1}% + \vskip\csuse{afterruleX@#1}% \fi% \unvbox\@nameuse{mpfootins#1}} @@ -8428,9 +8428,11 @@ \ifl@dpairing% \else% \@nameuse{footnoterule#1}% + \vskip\csuse{afterruleX@#1}% \fi% \else% \@nameuse{footnoterule#1}% + \vskip\csuse{afterruleX@#1}% \fi% \splittopskip=\ht\strutbox \expandafter @@ -8529,9 +8531,11 @@ \ifl@dpairing% \else% \@nameuse{footnoterule#1}% + \vskip\csuse{afterruleX@#1}% \fi% \else% \@nameuse{footnoterule#1}% + \vskip\csuse{afterruleX@#1}% \fi% \splittopskip=\ht\strutbox \expandafter @@ -8557,9 +8561,13 @@ \expandafter\let\csname footgroup#1\endcsname=\para@footgroupX \expandafter\let\csname footnoterule#1\endcsname=\normalfootnoteruleX \count\csname footins#1\endcsname=1000 + \dimen\csname footins#1\endcsname=\csuse{maxhnotesX@#1} + \skip\csname footins#1\endcsname=\csuse{beforenotesX@#1} \expandafter\let\csname mpvfootnote#1\endcsname=\mppara@vfootnoteX \expandafter\let\csname mpfootgroup#1\endcsname=\mppara@footgroupX \count\csname mpfootins#1\endcsname=1000 + \dimen\csname mpfootins#1\endcsname=\csuse{maxhnotesX@#1} + \skip\csname mpfootins#1\endcsname=\csuse{beforenotesX@#1} \para@footsetupX{#1}} % \end{macrocode} @@ -8595,7 +8603,9 @@ \rightskip=\z@ \parindent=\z@ \vskip\skip\@nameuse{footins#1}% - \@nameuse{footnoterule#1}} + \@nameuse{footnoterule#1}% + \vskip\csuse{afterruleX@#1}% + } % \end{macrocode} % \end{macro} @@ -8657,6 +8667,8 @@ % \begin{macrocode} \newcommand*{\para@footgroupX}[1]{% \unvbox\csname footins#1\endcsname + \ifcsstring{raggedX@#1}{L}{\RaggedLeft}{}% + \ifcsstring{raggedX@#1}{R}{\RaggedRight}{}% \makehboxofhboxes \setbox0=\hbox{\unhbox0 \removehboxes}% \csuse{notefontsizeX@#1} @@ -8673,11 +8685,15 @@ \ifl@dpairing% \else% \@nameuse{footnoterule#1}% + \vskip\csuse{afterruleX@#1}% \fi% \else% \@nameuse{footnoterule#1}% + \vskip\csuse{afterruleX@#1}% \fi% \unvbox\csname mpfootins#1\endcsname + \ifcsstring{raggedX@#1}{L}{\RaggedLeft}{}% + \ifcsstring{raggedX@#1}{R}{\RaggedRight}{}% \makehboxofhboxes \setbox0=\hbox{\unhbox0 \removehboxes}% \csuse{notefontsizeX@#1} @@ -8978,10 +8994,12 @@ % \end{macrocode} % \subsection{Create all commands to memorize display options} % \begin{macrocode} - \newtoggle{Xlemmadisablefontselection@#1} - \newtoggle{Xendlemmadisablefontselection@#1} + \newtoggle{Xlemmadisablefontselection@#1} + \newtoggle{Xendlemmadisablefontselection@#1} \csgdef{Xhangindent@#1}{0pt}% - \csgdef{hangindentX@#1}{0pt} + \csgdef{hangindentX@#1}{0pt}% + \csgdef{Xragged@#1}{}% + \csgdef{raggedX@#1}{}% \csgdef{hsizetwocol@#1}{0.45 \hsize}% \csgdef{hsizetwocolX@#1}{0.45 \hsize}% \csgdef{hsizethreecol@#1}{.3 \hsize}% @@ -9017,6 +9035,8 @@ \csgdef{parafootsep@#1}{\parafootftmsep}% \csgdef{beforeXnotes@#1}{1.2em \@plus .6em \@minus .6em} \csgdef{beforenotesX@#1}{1.2em \@plus .6em \@minus .6em} + \csgdef{afterXrule@#1}{0pt} + \csgdef{afterruleX@#1}{0pt} \csgdef{txtbeforeXnotes@#1}{} \csgdef{maxhnotesX@#1}{\ledfootinsdim}% \csgdef{maxhXnotes@#1}{\ledfootinsdim} @@ -9221,6 +9241,10 @@ \newhookcommand@series{hangindentX} +\newhookcommand@series{Xragged} + +\newhookcommand@series{raggedX} + \newhookcommand@series{hsizetwocol} \newhookcommand@series{hsizethreecol} @@ -9277,10 +9301,16 @@ \newhookcommand@series{txtbeforeXnotes} +\newhookcommand@series{afterruleX} + +\newhookcommand@series{afterXrule} + % \end{macrocode} % \end{macro} % \begin{macro}{\newhookcommand@series@reload} -% \changes{v1.8.0}{2013/11/24}{Debug \cs{beforenotesX} and \cs{maxhnotesX} which didn'nt work.} +% \changes{v1.8.0}{2013/11/24}{Debug \cs{beforenotesX} and \cs{maxhnotesX} which did'nt work.} +% \changes{v1.12.0}{2014/08/05}{Debug \cs{beforenotesX} and \cs{maxhnotesX} which did'nt work when called after \cs{footparagraphX}.} +% \changes{v1.12.0}{2014/08/05}{Debug \cs{beforeXnotes} and \cs{maxhXnotes} which did'nt work when called after \cs{footparagraph}.} % \cs{newhookcommand@series@reload} does the same thing as \cs{newhookcommand@series} % but the commands created by this macro also reload the series displaying (normal, paragraph, twocol) % \begin{macrocode} @@ -9796,7 +9826,7 @@ % \end{macrocode} % If the \Lclass{memoir} class is loaded we hook into its modified % \verb?\@doclearpage?. -% \begin{macro}{\@mem@extranofeet} +% \begin{macro}{\@mem@extranofeet} % \begin{macrocode} \g@addto@macro{\@mem@extranofeet}{% \def\do#1{\ifvoid\csuse{#1footins}\else\@mem@nofootfalse\fi% @@ -9948,9 +9978,11 @@ % Use code from the kernel \cs{label} command to write the correct % page number (it seems possible that the original \edmac's \cs{page@num} % scheme might also have had problems in this area). +% Also define an hypertarget if \Lpack{hyperref} package is loaded. % \begin{macrocode} \protected@write\@auxout{}% {\string\l@dmake@labels\space\thepage|\label@refs|\the\c@pstart|{#1}}% + \ifcsdef{hypertarget}{\hypertarget{#1}{}}{}% \@esphack} % \end{macrocode} @@ -10020,7 +10052,7 @@ % The \cs{@lab} command, which appears in the \cs{linenum@out} file, % appends the current values of page, line and sub-line to the % \cs{labelref@list}. These values are defined by the earlier -% \cs{@page}, \cs{@l}, and the \cs{sub@on} and \cs{sub@off} commands +% \cs{@page}, \cs{@nl}, and the \cs{sub@on} and \cs{sub@off} commands % appearing in the \cs{linenum@out} file. % % LaTeX uses the \texttt{page} counter for page numbers. However, @@ -10039,7 +10071,16 @@ % \end{macrocode} % \end{macro} -% +% \begin{macro}{\wrap@edcrossref} +% \cs{wrap@edcrossref} is called around all eledmac crossref command, except those which start by x. It adds the hyperlink. +% \begin{macrocode} +\newcommand{\wrap@edcrossref}[2]{% + \ifdef{\hyperlink}% + {\hyperlink{#1}{#2}}% + {#2} +} +% \end{macrocode} +% \end{macro} % \begin{macro}{\edpageref} % \begin{macro}{\xpageref} % If the specified label exists, \cs{edpageref} gives its page number. @@ -10054,7 +10095,7 @@ % LaTeX already defines a \cs{pageref}, so changing the name % to \cs{edpageref}. % \begin{macrocode} -\newcommand*{\edpageref}[1]{\l@dref@undefined{#1}\l@dgetref@num{1}{#1}} +\newcommand*{\edpageref}[1]{\l@dref@undefined{#1}\wrap@edcrossref{#1}{\l@dgetref@num{1}{#1}}} \newcommand*{\xpageref}[1]{\l@dgetref@num{1}{#1}} % \end{macrocode} @@ -10065,7 +10106,7 @@ % \begin{macro}{\xlineref} % If the specified label exists, \cs{lineref} gives its line number. % \begin{macrocode} -\newcommand*{\lineref}[1]{\l@dref@undefined{#1}\l@dgetref@num{2}{#1}} +\newcommand*{\lineref}[1]{\l@dref@undefined{#1}\wrap@edcrossref{#1}{\l@dgetref@num{2}{#1}}} \newcommand*{\xlineref}[1]{\l@dgetref@num{2}{#1}} % \end{macrocode} @@ -10076,7 +10117,7 @@ % \begin{macro}{\xsublineref} % If the specified label exists, \cs{sublineref} gives its sub-line number. % \begin{macrocode} -\newcommand*{\sublineref}[1]{\l@dref@undefined{#1}\l@dgetref@num{3}{#1}} +\newcommand*{\sublineref}[1]{\l@dref@undefined{#1}\wrap@edcrossref{#1}{\l@dgetref@num{3}{#1}}} \newcommand*{\xsublineref}[1]{\l@dgetref@num{3}{#1}} % \end{macrocode} @@ -10087,8 +10128,9 @@ % \begin{macro}{\xpstartref} % If the specified label exists, \cs{pstartref} gives its pstart number. % \begin{macrocode} -\newcommand*{\pstartref}[1]{\l@dref@undefined{#1}\l@dgetref@num{4}{#1}} +\newcommand*{\pstartref}[1]{\l@dref@undefined{#1}\wrap@edcrossref{#1}{\l@dgetref@num{4}{#1}}} \newcommand*{\xpstartref}[1]{\l@dgetref@num{4}{#1}} + % \end{macrocode} % \end{macro} % \end{macro} @@ -10245,14 +10287,26 @@ % These are the sidenote equivalents to \cs{line@margin} and \cs{linenummargin} % for specifying which margin. The default is the right margin (opposite to % the default for line numbers). +% \cs{l@dgetsidenote@margin} returns the number associated to side note margin: +% \begin{description} +% \item[left] : 0 +% \item[right] : 1 +% \item[outer] : 2 +% \item[inner] : 3 +% \end{description} % \changes{v0.5.1}{2004/04/10}{Added \cs{sidenotemargin} and \cs{sidenote@margin}} % \changes{v0.7}{2005/02/23}{Added \cs{l@dgetsidenote@margin}} +% \changes{v1.12.0}{2014/08/05}{\cs{sidenotemargin} is now directly defined in \Lpack{eledmac} to be able to manage \Lpack{eledpar}.} % \begin{macrocode} \newcount\sidenote@margin \newcommand*{\sidenotemargin}[1]{{% \l@dgetsidenote@margin{#1}% \ifnum\@l@dtempcntb>\m@ne - \global\sidenote@margin=\@l@dtempcntb + \ifledRcol + \global\sidenote@marginR=\@l@dtempcntb + \else + \global\sidenote@margin=\@l@dtempcntb + \fi \fi}} \newcommand*{\l@dgetsidenote@margin}[1]{% \def\@tempa{#1}\def\@tempb{left}% @@ -10324,52 +10378,95 @@ % % \begin{macro}{\ledleftnote} % \begin{macro}{\ledrightnote} +% \begin{macro}{\ledinnernote} +% \begin{macro}{\ledouterote} % \begin{macro}{\ledsidenote} -% \verb?\ledleftnote?\marg{text} and \verb?\ledrightnote?\marg{text} are the -% user commands for left and right sidenotes. \verb?\ledsidenote?\marg{text} -% is the command for a moveable sidenote. +% \cs{ledleftnote}, \cs{ledrightnote}, \cs{ledinnernote}, \cs{ledouternote} are the +% user commands for left, right, inner and outer sidenotes. +% The two last one are just alias for the two first one, depending of the page number. +% \verb?\ledsidenote?\marg{text} is the command for a moveable sidenote. % \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]{% + \ifodd\page@num% + \ledleftnote{#1}% + \else% + \ledrightnote{#1}% + \fi% +} + +\newcommand*{\ledouternote}[1]{% + \ifodd\page@num% + \ledrightnote{#1}% + \else% + \ledleftnote{#1}% + \fi% +} +\newcommand*{\ledsidenote}[1]{\edtext{}{\l@dcsnote{#1}}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} % % % \begin{macro}{\l@dlsnote} % \begin{macro}{\l@drsnote} % \begin{macro}{\l@dcsnote} +% \changes{v1.12.0}{2014/08/05}{\cs{l@dlsnote},\cs{l@drsnote} and \cs{l@dcsnote} defined only one time, in \Lpack{eledmac}, including needs for eledpar case.}. % The `footnotes' for left, right, and moveable sidenotes. The whole % scheme is reminiscent of the critical footnotes code. % \begin{macrocode} \newif\ifrightnoteup \rightnoteuptrue + \newcommand*{\l@dlsnote}[1]{% \begingroup% \newcommand{\content}{#1}% \ifnumberedpar@ - \xright@appenditem{\noexpand\vl@dlsnote{\csexpandonce{content}}}% - \to\inserts@list - \global\advance\insert@count \@ne + \ifledRcol% + \xright@appenditem{\noexpand\vl@dlsnote{\csexpandonce{content}}}% + \to\inserts@listR + \global\advance\insert@countR \@ne% + \else% + \xright@appenditem{\noexpand\vl@dlsnote{\csexpandonce{content}}}% + \to\inserts@list + \global\advance\insert@count \@ne% + \fi \fi\ignorespaces\endgroup} + \newcommand*{\l@drsnote}[1]{% \begingroup% \newcommand{\content}{#1}% \ifnumberedpar@ - \xright@appenditem{\noexpand\vl@drsnote{\csexpandonce{content}}}% - \to\inserts@list - \global\advance\insert@count \@ne + \ifledRcol% + \xright@appenditem{\noexpand\vl@drsnote{\csexpandonce{content}}}% + \to\inserts@listR + \global\advance\insert@countR \@ne% + \else% + \xright@appenditem{\noexpand\vl@drsnote{\csexpandonce{content}}}% + \to\inserts@list + \global\advance\insert@count \@ne% + \fi \fi\ignorespaces\endgroup} -\newcommand*{\l@dcsnote}[1]{\begingroup% + +\newcommand*{\l@dcsnote}[1]{% + \begingroup% \newcommand{\content}{#1}% \ifnumberedpar@ - \xright@appenditem{\noexpand\vl@dcsnote{\csexpandonce{content}}}% - \to\inserts@list - \global\advance\insert@count \@ne + \ifledRcol% + \xright@appenditem{\noexpand\vl@dcsnote{\csexpandonce{content}}}% + \to\inserts@listR + \global\advance\insert@countR \@ne% + \else% + \xright@appenditem{\noexpand\vl@dcsnote{\csexpandonce{content}}}% + \to\inserts@list + \global\advance\insert@count \@ne% + \fi \fi\ignorespaces\endgroup} % \end{macrocode} @@ -10381,10 +10478,59 @@ % \begin{macro}{\vl@drsnote} % \begin{macro}{\vl@dcsnote} % Put the left/right text into boxes, but just save the moveable text. -% \cs{l@dcsnotetext} is a etoolbox list (comma separated) +% \cs{l@dcsnotetext}, \cs{l@dcsnotetext@l} and \cs{l@dcsnotetext@r} are etoolbox lists which will store the content of side notes. +% We store the content in lists, because we need to loop later on them, in case many sidenote co-exist for the same line. +% That is there some special test to do, in order to: +% \begin{itemize} +% \item Store the content of \cs{ledsidenote} to \cs{l@dcsnotetext} in any cases. +% \item Store the content of \cs{rightsidenote} to: +% \begin{itemize} +% \item \cs{l@dcsnotetext} if \cs{ledsidenote} is to be put on right. +% \item \cs{l@dcsnotetext@r} if \cs{ledsidenote} is to be put on left. +% \end{itemize} +% \item Store the content of \cs{leftsidenote} to: +% \begin{itemize} +% \item \cs{l@dcsnotetext} if \cs{ledsidenote} is to be put on left. +% \item \cs{l@dcsnotetext@l} if \cs{ledsidenote} is to be put on right. +% \end{itemize} +% \end{itemize} % \begin{macrocode} -\newcommand*{\vl@dlsnote}[1]{\setl@dlp@rbox{#1}} -\newcommand*{\vl@drsnote}[1]{\setl@drp@rbox{#1}} +\newcommand*{\vl@dlsnote}[1]{% + \ifledRcol@% + \@l@dtempcntb=\sidenote@marginR% + \ifnum\@l@dtempcntb>\@ne% + \advance\@l@dtempcntb by\page@numR% + \fi% + \else% + \@l@dtempcntb=\sidenote@margin% + \ifnum\@l@dtempcntb>\@ne% + \advance\@l@dtempcntb by\page@num% + \fi% + \fi% + \ifodd\@l@dtempcntb% + \listgadd{\l@dcsnotetext@l}{#1}% + \else% + \listgadd{\l@dcsnotetext}{#1}% + \fi +} +\newcommand*{\vl@drsnote}[1]{% + \ifledRcol@% + \@l@dtempcntb=\sidenote@marginR% + \ifnum\@l@dtempcntb>\@ne% + \advance\@l@dtempcntb by\page@numR% + \fi% + \else% + \@l@dtempcntb=\sidenote@margin% + \ifnum\@l@dtempcntb>\@ne% + \advance\@l@dtempcntb by\page@num% + \fi% + \fi% + \ifodd\@l@dtempcntb% + \listgadd{\l@dcsnotetext}{#1}% + \else% + \listgadd{\l@dcsnotetext@r}{#1}% + \fi% +} \newcommand*{\vl@dcsnote}[1]{\listgadd{\l@dcsnotetext}{#1}} % \end{macrocode} @@ -10451,7 +10597,7 @@ \dolistloop{\l@dcsnotetext}% \ifnumgreater{\itemcount@}{1}{\eledmac@warning{\itemcount@\space sidenotes on line \the\line@num\space p. \the\page@num,}}{}% % \end{macrocode} -% And now, the main part of the macro +% And we do the same for left and right notes (not movable). % \begin{macrocode} \gdef\@templ@d{}% \ifx\@templ@d\l@dcsnotetext \else% @@ -10468,14 +10614,24 @@ \fi% \ifodd\@l@dtempcntb% \setl@drp@rbox{\sidenotecontent@}% + \gdef\sidenotecontent@{}% + \numdef{\itemcount@}{0}% + \dolistloop{\l@dcsnotetext@l}% + \ifnumgreater{\itemcount@}{1}{\eledmac@warning{\itemcount@\space leftnotes on line \the\line@num\space p. \the\page@num,}}{}% + \setl@dlp@rbox{\sidenotecontent@}% \else% \setl@dlp@rbox{\sidenotecontent@}% + \gdef\sidenotecontent@{}% + \numdef{\itemcount@}{0}% + \dolistloop{\l@dcsnotetext@r}% + \ifnumgreater{\itemcount@}{1}{\eledmac@warning{\itemcount@\space rightnotes on line \the\line@num\space p. \the\page@num,}}{}% + \setl@drp@rbox{\sidenotecontent@}% \fi% \fi% -\fi} + \fi% +} % \end{macrocode} -% \end{macro} -% +% \end{macro}% % % % @@ -10498,14 +10654,14 @@ % \begin{macrocode} \newcommand*{\l@dfeetbeginmini}{\l@dedbeginmini\l@dfambeginmini} \newcommand*{\l@dfeetendmini}{% - \IfStrEq{critical-familiar}{\@mpfnpos}% - {\l@dedendmini\l@dfamendmini}% - {% - \IfStrEq{familiar-critical}{\@mpfnpos}% - {\l@dfamendmini\l@dedendmini}% - {\l@dedendmini\l@dfamendmini}% - }% - }% + \IfStrEq{critical-familiar}{\@mpfnpos}% + {\l@dedendmini\l@dfamendmini}% + {% + \IfStrEq{familiar-critical}{\@mpfnpos}% + {\l@dfamendmini\l@dedendmini}% + {\l@dedendmini\l@dfamendmini}% + }% + }% % \end{macrocode} % \end{macro} % \end{macro} @@ -10729,8 +10885,22 @@ % \section{Indexing} % % \changes{v1.5}{2013/07/11}{Correct indexing when the call is made in critical notes.} +% \changes{v1.8.0}{2014/07/21}{If \Lpack{imakeidx} and \Lpack{hyperref} are loaded, adds hyperref in the index.} % Here's some code for indexing using page \& line numbers. % +% \begin{macro}{\ifeledmac@check@imakeidx@} +% First, ensure that \Lpack{imakeidx} is loaded \emph{before} \Lpack{eledmac}. +% \changes{v1.12.0}{2014/08/05}{Ensure that \Lpack{imakeidx} is loaded \emph{before} \Lpack{eledmac}} +% \begin{macrocode} +\newif\ifeledmac@after@imakeidx@ +\@ifpackageloaded{imakeidx}{\eledmac@after@imakeidx@true}{} +\AtBeginDocument{% + \ifeledmac@after@imakeidx@\else% + \@ifpackageloaded{imakeidx}{\eledmac@error{Imakeidx must be loaded before eledmac.}}{}% + \fi +} +% \end{macrocode} +% \end{macro} % \begin{macro}{\pagelinesep} % \begin{macro}{\edindexlab} % \begin{macro}{\c@labidx} @@ -10760,7 +10930,7 @@ % This macro makes up the page/line number combo from the label/ref. % \begin{macrocode} \newcommand{\thepageline}{% - \thepage\pagelinesep\lineref{\edindexlab\thelabidx}} + \thepage\pagelinesep\xlineref{\edindexlab\thelabidx}} % \end{macrocode} % \end{macro} % @@ -10793,9 +10963,24 @@ % \end{macrocode} % \end{macro} % \begin{macro}{\get@index@command} -% This macro is used to analyse if a text to be indexed has a command after a \verb+|+. -% \begin{macrocode} -\def\get@index@command#1|#2{\gdef\@index@command{#2}\gdef\@index@txt{#1}} +% This macro is used to analyse if a text to be indexed has a command after a \verb+|+. +% \changes{v1.8.0}{2014/07/21}{Debug \cs{get@index@command} and compatibility with \Lpack{hyperref} package.} +% \begin{macrocode} +\def\get@index@command#1|#2+{% + \gdef\@index@txt{#1}% + \gdef\@index@command{#2}% + \xdef\@index@parenthesis{}% + \IfBeginWith{\@index@command}{(}{% + \StrGobbleLeft{\@index@command}{1}[\@index@command@]% + \global\let\@index@command\@index@command@% + \xdef\@index@parenthesis{(}% + }{}% + \IfBeginWith{\@index@command}{)}{% + \StrGobbleLeft{\@index@command}{1}[\@index@command@]% + \global\let\@index@command\@index@command@% + \xdef\@index@parenthesis{)}% + }{}% +} % \end{macrocode} % \end{macro} % \begin{macro}{\ledinnote} @@ -10926,19 +11111,21 @@ % % \begin{macro}{\@wredindex} % Write the index information to the \file{idx} file. +% \changes{v1.12.0}{2014/08/05}{Use correctly default index when \Lpack{imakeidx} is loaded.} % \begin{macrocode} - \newcommandx{\@wredindex}[2][1=\jobname,usedefault]{%#1 = the index name, #2 = the text + \newcommandx{\@wredindex}[2][1=\expandonce\jobname,usedefault]{%#1 = the index name, #2 = the text \ifl@imakeidx% \if@edindex@fornote@% - \IfSubStr[1]{#2}{|}{\get@index@command#2}{\get@index@command#2|}% + \IfSubStr[1]{#2}{|}{\get@index@command#2+}{\get@index@command#2|+}% \expandafter\imki@wrindexentry{#1}{\@index@txt|(ledinnote{\@index@command}}{\thestartpageline}% \expandafter\imki@wrindexentry{#1}{\@index@txt|)ledinnote{\@index@command}}{\theendpageline}% \else% - \imki@wrindexentry{#1}{#2}{\thepageline}% + \get@edindex@hyperref{#2}% + \imki@wrindexentry{#1}{\@index@txt\@edindex@hyperref}{\thepageline}% \fi% \else% \if@edindex@fornote@% - \IfSubStr[1]{#2}{|}{\get@index@command#2}{\get@index@command#2|}% + \IfSubStr[1]{#2}{|}{\get@index@command#2+}{\get@index@command#2|+}% \expandafter\protected@write\@indexfile{}% {\string\indexentry{\@index@txt|(ledinnote{\@index@command}}{\thestartpageline} }% @@ -10962,6 +11149,36 @@ % \end{macrocode} % +% \subsection{Hyperref compatibility} +% \begin{macro}{\hyperlinkformat} +% \cs{hyperlinkformat} command is to be used to have both a internal hyperlink and a format, when indexding. +% \begin{macrocode} +\newcommand{\hyperlinkformat}[3]{% + \ifstrempty{#1}% + {\hyperlink{#2}{#3}}% + {\csuse{#1}{\hyperlink{#2}{#3}}% + }} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\get@edindex@hyperref} +% \begin{macro}{\@edindex@hyperref} +% \cs{get@edindex@hyperref} is to be used to define the \cs{@edindex@hyperref} macro, which, in index, links to the point where the index was called (with \Lpack{hyperref}. +% \begin{macrocode} +\newcommand{\get@edindex@hyperref}[1]{% + \ifcsdef{hyperlink}% + {\IfSubStr{#1}{|}% + {\get@index@command#1+% + \gdef\@edindex@hyperref{|\@index@parenthesis % + hyperlinkformat{\@index@command} + {\edindexlab\thelabidx}}}% + {\get@index@command#1|+ + \gdef\@edindex@hyperref{|hyperlink{\edindexlab\thelabidx}}}% + }% + {\gdef\@edindex@hyperref{}}% +} +% \end{macrocode} +% \end{macro} +% \end{macro} % \begin{macro}{\l@d@@wrindexhyp} % If the \Lpack{hyperref} package is not loaded, it doesn't make sense % to clutter up the index with hyperreffing things. @@ -10969,7 +11186,7 @@ \AtBeginDocument{\@ifpackageloaded{hyperref}{}{% \def\l@d@@wrindexhyp#1||\\{% \ifshowindexmark\@showidx{#1}\fi - \IfSubStr[1]{#1}{|}{\get@index@command#1}{\get@index@command#1|}% + \IfSubStr[1]{#1}{|}{\get@index@command#1+}{\get@index@command#1|+}% \if@edindex@fornote@% \protected@write\@auxout{}% {\string\@@wrindexm@m{\@idxfile}{\@index@txt|(ledinnote{\@index@command}}{\thestartpageline}}% @@ -11322,7 +11539,7 @@ % the user may initiate these penalties to indicate good and bad % places in the stanza for page breaking. % \begin{macrocode} -\def\stanza@line{ +\newcommandx{\stanza@line}[1][1]{ \ifnum\value{stanzaindentsrepetition}=0 \parindent=\csname sza@\number\stanza@count @\endcsname\stanzaindentbase @@ -11331,7 +11548,7 @@ @\endcsname\stanzaindentbase \managestanza@modulo \fi - \pstart\stanza@hang\ignorespaces} + \pstart[#1]\stanza@hang\ignorespaces} \xdef\stanza@hang{\noexpand\leavevmode\noexpand\startlock \hangindent\expandafter \noexpand\csname sza@0@\endcsname\stanzaindentbase @@ -11346,9 +11563,15 @@ % % \begin{macro}{\startstanzahook} % \begin{macro}{\endstanzaextra} +% \begin{macro}{\@startstanza} % \begin{macro}{\stanza} +% \begin{macro}{\@stopstanza} +% \begin{macro}{\newverse} % \begin{macro}{\falseverse} % \changes{v1.6.0}{2013/10/09}{Add \cs{falseverse} macro.} +% \changes{v1.12.0}{2014/08/05}{Add \cs{newverse} macro, \cs{falseverse} deprecated.} +% \changes{v1.12.0}{2014/08/05}{\cs{Stanza} can have a optional argument: content to be printed before.} +% \changes{v1.12.0}{2014/08/05}{\ampersand can have a optional argument: content to be printed after.} % Now we have the components of the \verb+\stanza+ macro, % which appears at the start of a group of lines. This macro % initializes the count and checks to see if hanging indentation @@ -11359,8 +11582,7 @@ % \verb+\endlock+. Here and above we have used \verb+\xdef+ to % make the stored macros take up a bit less space, but it also % makes them more obscure to the reader. Lines of the stanza are -% delimited by ampersands \&. The macro \cs{falseverse} can be -% use to add stanza not numbered and with no impact on the next indent. +% delimited by ampersands \&. % The last line of the stanza must % end with \verb+\&+. % For convenience the macro @@ -11375,32 +11597,50 @@ % \begin{macrocode} \let\startstanzahook\relax \let\endstanzaextra\relax -\xdef\stanza{\noexpand\instanzatrue\expandafter - \begingroup\startstanzahook% - \catcode`\noexpand\&\active% - \global\stanza@count\@ne\stanza@modulo\@ne - \noexpand\ifnum\expandafter\noexpand - \csname sza@0@\endcsname=\z@\let\noexpand\stanza@hang\relax - \let\noexpand\endlock\relax\noexpand\else\interlinepenalty - \@M\rightskip\z@ plus 1fil\relax\noexpand\fi\noexpand\ifnum - \expandafter\noexpand\csname szp@0@\endcsname=\z@ - \let\noexpand\sza@penalty\relax\noexpand\fi% +\xdef\@startstanza[#1]{% + \noexpand\instanzatrue\expandafter + \begingroup\startstanzahook% + \catcode`\noexpand\&\active% + \global\stanza@count\@ne\stanza@modulo\@ne + \noexpand\ifnum\expandafter\noexpand + \csname sza@0@\endcsname=\z@\let\noexpand\stanza@hang\relax + \let\noexpand\endlock\relax\noexpand\else\interlinepenalty + \@M\rightskip\z@ plus 1fil\relax\noexpand\fi\noexpand\ifnum + \expandafter\noexpand\csname szp@0@\endcsname=\z@ + \let\noexpand\sza@penalty\relax\noexpand\fi% \def\noexpand\falseverse{% + \noexpand\eledmac@warning{\string\falseverse\space deprecated. Look at \string\newverse\space instead.} \global\advance\stanza@modulo-\@ne% \global\advance\stanza@count-\@ne% \relax\noexpand&\leavevmode\skipnumbering} - \def\noexpand&{% - \noexpand\endlock\noexpand\pend\noexpand\sza@penalty\global% - \advance\stanza@count\@ne\noexpand\stanza@line}% - \def\noexpand% - \&{\noexpand\endlock\noexpand\pend\endgroup\noexpand\instanzafalse\expandafter\endstanzaextra}% - \noexpand\stanza@line} + \def\noexpand&{% + \noexpand\newverse[][]}% + \def\noexpand\&{\noexpand\@stopstanza}% + \noexpand\stanza@line[#1]} + +\newcommandx{\stanza}[1][1,usedefault]{\@startstanza[#1]} + +\newcommandx{\@stopstanza}[1][1,usedefault]{% + \endlock% + \pend[#1]% + \endgroup% + \instanzafalse% + \endstanzaextra% +} + +\newcommandx*{\newverse}[2][1,2,usedefault]{% + \endlock\pend[#1]\sza@penalty\global% + \advance\stanza@count\@ne\stanza@line[#2]% + } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % \begin{macro}{\flagstanza} % Use \verb?\flagstanza[len]{text}? at the start of a line to put \texttt{text} % a distance \texttt{len} before the start of the line. The default for @@ -12754,9 +12994,663 @@ % % % +% \section{Section's title commands} +% \subsection{Deprecated commands} +% \begin{macro}{\initnumbering@sectcmd} +% \begin{macro}{\ledsection} +% \begin{macro}{\ledsection*} +% \begin{macro}{\ledsubsection} +% \begin{macro}{\ledsubsection*} +% \begin{macro}{\ledsubsubsection} +% \begin{macro}{\ledsubsubsection*} +% \begin{macro}{\ledchapter} +% \begin{macro}{\ledchapter*} +% \begin{macro}{\@patchforledchapter} +% \begin{macro}{\quotation} +% \begin{macro}{\endquotation} +% \begin{macro}{\quote} +% \begin{macro}{\endquote} +% \changes{v1.12.0}{2014/08/05}{\cs{ledxxx} sectioning commands are deprecated and replaced by \cs{eledxxx} commands.} +% \changes{v1.2}{2012/10/08}{Compatibility of \cs{ledchapter} with the \emph{memoir} class.} +% \changes{v1.3}{2012/11/01}{\emph{Quotation} and {quote} environment inside the numbering sections.} +% \changes{v1.4.1}{2012/11/16}{New option \emph{noquotation}.} +% \changes{v1.4.7}{2012/06/07}{Compatibility of sectioning commands with \cs{autopar}.} +% \changes{v1.8.0}{2013/12/13}{Correction of sectioning commands in parallel texts.} +% \changes{v1.10.0}{2014/02/27}{Correction of sectioning commands in parallel texts.} +% \cs{initnumbering@sectcmd} defines \cs{ledxxx} commands. These commands are deprecated. +% It also defines quotation environment. +% Note: this assumes that the user didn't change \cs{chapter}. +% If he did, he should redefine \cs{initnumbering@sectcmd}. +% \begin{macrocode} +\newcommand{\initnumbering@sectcmd}{ + \newcommand{\ledsection}[2][]{\eledmac@warning{\string\ledsection\space deprecated}% + \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi%% + \pstart% + \leavevmode\ifledsecnolinenumber\skipnumbering\fi\section[##1]{##2}\leavevmode\vspace{2.3ex \@plus.2ex}\skipnumbering\pend% + \vspace{-2\parskip}\vspace{-2\baselineskip}% + \ifautopar\else\pstart\fi + } + \WithSuffix\newcommand\ledsection*[1]{\eledmac@warning{\string\ledsection*\space deprecated}% + \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi% + \pstart% + \leavevmode\ifledsecnolinenumber\skipnumbering\fi\section*{##1}\leavevmode\vspace{2.3ex \@plus.2ex}\skipnumbering\pend% + \vspace{-2\parskip}\vspace{-2\baselineskip}% + \ifautopar\else\pstart\fi + } + \newcommand{\ledsubsection}[2][]{\eledmac@warning{\string\ledsubsection*\space deprecated}% + \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi% + \pstart% + \leavevmode\ifledsecnolinenumber\skipnumbering\fi\subsection[##1]{##2}\leavevmode\vspace{1.5ex \@plus .2ex}\skipnumbering\pend% + \vspace{-2\parskip}\vspace{-2\baselineskip}% + \ifautopar\else\pstart\fi + } + \WithSuffix\newcommand\ledsubsection*[1]{\eledmac@warning{\string\ledsubsection*\space deprecated}% + \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi% + \pstart% + \leavevmode\ifledsecnolinenumber\skipnumbering\fi\subsection*{##1}\leavevmode\vspace{1.5ex \@plus .2ex}\skipnumbering\pend% + \vspace{-2\parskip}\vspace{-2\baselineskip}% + \ifautopar\else\pstart\fi + } + \newcommand{\ledsubsubsection}[2][]{\eledmac@warning{\string\ledsubsubsection*\space deprecated}% + \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi% + \pstart% + \leavevmode\ifledsecnolinenumber\skipnumbering\fi\subsubsection[##1]{##2}\leavevmode\vspace{1.5ex \@plus .2ex}\skipnumbering\pend% + \vspace{-2\parskip}\vspace{-2\baselineskip}% + \ifautopar\else\pstart\fi + } + \WithSuffix\newcommand\ledsubsubsection*[1]{\eledmac@warning{\string\ledsubsubsection*\space deprecated}% + \leavevmode\pend\vspace{3.5ex \@plus 1ex \@minus .2ex}\ifl@dpairing\else\skipnumbering\fi% + \pstart% + \leavevmode\ifledsecnolinenumber\skipnumbering\fi\subsubsection*{##1}\leavevmode\vspace{1.5ex \@plus .2ex}\skipnumbering\pend% + \vspace{-2\parskip}\vspace{-2\baselineskip}% + \ifautopar\else\pstart\fi + } + \newcommand\ledchapter[2][]{% + \eledmac@warning{\string\ledchapter\space deprecated}% + \ifl@dmemoir% + \gdef\ch@pt@c{##1}% + \fi% + ~\pend\skipnumbering% + \pstart% + \@patchforledchapter\chapter[##1]{##2}% + \pend\pstart} + \WithSuffix\newcommand\ledchapter*[1]{% + \eledmac@warning{\string\ledchapter*\space deprecated}% + ~\pend\skipnumbering% + \pstart% + \@patchforledchapter\chapter*{##1}\pend% + \pstart} + \def\@patchforledchapter{ + \patchcmd{\@makeschapterhead}{1\par}{1}{}{} + \pretocmd{\@makeschapterhead}{\par}{}{} + \apptocmd{\@makeschapterhead}{\par}{}{} + \patchcmd{\@makeschapterhead}{\vskip 40\p@}{}{}{} + \patchcmd{\@makechapterhead}{1\par}{1}{}{} + \pretocmd{\@makechapterhead}{\par}{}{} + \apptocmd{\@makechapterhead}{\par}{}{} + \patchcmd{\@makechapterhead}{\vskip 40\p@}{}{}{} + \apptocmd{\@chapter}{\par\leavevmode\vspace{40 \p@}\skipnumbering}{}{} + \apptocmd{\@schapter}{\par\leavevmode\vspace{40 \p@}\skipnumbering}{}{} + \newcommand\beforeledchapter{\pend\cleardoublepage\pstart} + \patchcmd{\chapter}{\cleardoublepage}{\relax}{}{} + \patchcmd{\chapter}{\clearpage}{\relax}{}{} + } + \ifnoquotation@\else + \renewcommand{\quotation}{\par\leavevmode% + \parindent=1.5em% + \skipnumbering% + \ifautopar% + \vskip-\parskip% + \else% + \vskip\topsep% + \fi% + \global\leftskip=\leftmargin% + \global\rightskip=\leftmargin% + } + \renewcommand{\endquotation}{\par% + \global\leftskip=0pt% + \global\rightskip=0pt% + \leavevmode% + \skipnumbering% + \ifautopar% + \vskip-\parskip% + \else% + \vskip\topsep% + \fi% + } + \renewcommand{\quote}{\par\leavevmode% + \parindent=0pt% + \skipnumbering% + \ifautopar% + \vskip-\parskip% + \else% + \vskip\topsep% + \fi% + \global\leftskip=\leftmargin% + \global\rightskip=\leftmargin% + } + \renewcommand{\endquote}{\par% + \global\leftskip=0pt% + \global\rightskip=0pt% + \leavevmode% + \skipnumbering% + \ifautopar% + \vskip-\parskip% + \else% + \vskip\topsep% + \fi% + } + \fi +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\ledsectnotoc} +% The \cs{ledsectnotoc} only disables the \cs{addcontentsline} macro. +% \begin{macrocode} +\newcommand{\ledsectnotoc}{\let\addcontentsline\@gobblethree} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ledsectnomark} +% The \cs{ledsectnomark} only disables the \cs{chaptermark}, \cs{sectionmark} and \cs{subsectionmark} macros. +% \begin{macrocode} +\newcommand{\ledsectnomark}{% + \let\chaptermark\@gobble% + \let\sectionmark\@gobble% + \let\subsectionmark\@gobble% +} +% \end{macrocode} +% \end{macro} +% +% \subsection{New commands : \cs{eledxxx}} +% The new system of \cs{eledxxxx} commands to section text work like this: +% \begin{enumerate} +% \item When one of these commands is called, \Lpack{eledmac} writes to an auxiliary files: +% \begin{itemize} +% \item The section level. +% \item The section title. +% \item The side (when \Lpack{eledpar} is used). +% \item The pstart where the command is called. +% \item If we have starred version or not. +% \end{itemize} +% \item \Lpack{eledmac} adds the title of the section to pstart, as normal content. This is to enable critical notes. +% \item When \LaTeX\ is run a other time, this file is read. That: +% \begin{itemize} +% \item Adds the pstart number to a list of pstarts where a sectioning command is used. +% \item Defines a command, the name of which contains the pstart number, and which calls the normal \LaTeX\ sectioning command. +% \end{itemize} +% \item This last command is called when the pstart is effectively printed. +% \end{enumerate} +% +% \begin{macro}{\beforeeledchapter} +% For technical reasons, not yet solved, page-breaking before chapters can't be made automatically by eledmac. Users have to us \cs{beforeeledchapter}. +% \begin{macrocode} +\ifl@dmemoir + \newcommand\beforeeledchapter{\clearforchapter} +\else + \newcommand\beforeeledchapter{\if@openright\cleardoublepage\else\clearpage\fi} +\fi +% \end{macrocode} +% \end{macro} +% \begin{macro}{\if@eled@sectioning} +% The boolean \cs{if@eled@sectioning} is set to true when a sectioning command is called by a \cs{eledxxx} command, and set to false after. It is used to enable/disable line number printing. +% \begin{macrocode} +\newif\if@eled@sectioning +% \end{macrocode} +% \end{macro} +% \begin{macro}{\print@leftmargin@eledsection} +% \begin{macro}{\print@rightmargin@eledsection} +% \cs{print@leftmargin@eledsection} and \cs{print@rightmargin@eledsection} are added by eledmac inside the code of sectioning command, in order to affix lines numbers. +% They include tests for RTL languages. +% \begin{macrocode} +\def\print@rightmargin@eledsection{% + \if@eled@sectioning% + \begingroup% + \if@RTL% + \let\llap\rlap% + \let\leftlinenum\rightlinenum% + \let\leftlinenumR\rightlinenumR% + \let\l@drd@ta\l@dld@ta% + \let\l@drsn@te\l@dlsn@te% + \fi% + \hfill\l@drd@ta \csuse{LR}{\l@drsn@te}% + \endgroup% + \fi% +}% + +\def\print@leftmargin@eledsection{% + \if@eled@sectioning% + \leavevmode% + \begingroup% + \if@RTL% + \let\rlap\llap% + \let\rightlinenum\leftlinenum% + \let\rightlinenumR\leftlinenumR% + \let\l@dld@ta\l@drd@ta% + \let\l@dlsn@te\l@drsn@te% + \fi% + \l@dld@ta\csuse{LR}{\l@dlsn@te}% + \endgroup% + \fi% +}% + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \begin{macro}{\chapter} +% \begin{macro}{\M@sect} +% \begin{macro}{\@mem@old@ssect} +% \begin{macro}{\@makechapterhead} +% \begin{macro}{\@makechapterhead} +% \begin{macro}{\@makeschapterhead} +% \begin{macro}{\@sect} +% \begin{macro}{\@ssect} +% We have to patch \LaTeX, \Lclass{book} and \Lclass{memoir} sectioning commands in order to: +% \begin{itemize} +% \item Disable \cs{edtext} inside. +% \item Disable page breaking (for \cs{chapter}). +% \item Add line numbers and sidenotes. +% \end{itemize} +% Unfortunately, Maïeul Rouquette was not able to try if \Lclass{memoir} is loaded. That is why \Lpack{eledmac} tries to define for both standard class and \Lclass{memoir} class. % +% +% \begin{macrocode} +\catcode`\#=12 % Space NEEDS by \catcode +\AtBeginDocument{% +\patchcmd{\chapter}{\clearforchapter}{% + \ifnumbering\else% + \clearforchapter + \fi% + } + {} + {} + +\pretocmd{\M@sect} + {\let\old@edtext=\edtext% + \let\edtext=\dummy@edtext% + } + {} + {} + +\apptocmd{\M@sect} + {\let\edtext=\old@edtext} + {} + {} + +\patchcmd{\M@sect} + { #9} + { #9% + \print@rightmargin@eledsection% + } + {} + {} + +\patchcmd{\M@sect} + {\hskip #3\relax} + {\hskip #3\relax% + \print@leftmargin@eledsection% + } + {} + {} + +\pretocmd{\@mem@old@ssect} + {\let\old@edtext=\edtext% + \let\edtext=\dummy@edtext% + } + {} + {} + +\apptocmd{\@mem@old@ssect} + {\let\edtext=\old@edtext} + {} + {} + +\patchcmd{\@mem@old@ssect} + {#5} + {#5% + \print@leftmargin@eledsection% + } + {} + {} + +\patchcmd{\@mem@old@ssect} + {\hskip #1} + {\hskip #1% + \print@rightmargin@eledsection% + } + {} + {} + +\patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}{% + \if@eled@sectioning\else% + \leavevmode\if@openright\cleardoublepage\else\clearpage\fi%No clearpage inside a \eledsection : will make the critical notes not in the same page than title. + \fi% + }% + {}% + {}% + +\patchcmd{\@makechapterhead} + {#1} + {\print@leftmargin@eledsection% + #1% + \print@rightmargin@eledsection% + } + {} + {} + +\patchcmd{\@makechapterhead}% For BIDI + {\if@RTL\raggedleft\else\raggedright\fi}% + {\if@eled@sectioning\else% + \if@RTL\raggedleft\else\raggedright\fi% + \fi% + }% + {}% + {}% + +\patchcmd{\@makeschapterhead} + {#1} + {\print@leftmargin@eledsection% + #1% + \print@rightmargin@eledsection% + } + {} + {} + +\pretocmd{\@sect} + {\let\old@edtext=\edtext + \let\edtext=\dummy@edtext% + } + {} + {} + +\apptocmd{\@sect} + {\let\edtext=\old@edtext} + {} + {} + +\patchcmd{\@sect} + {#8} + {#8% + \print@rightmargin@eledsection% + } + {} + {} + +\patchcmd{\@sect} + {\hskip #3\relax} + {\hskip #3\relax% + \print@leftmargin@eledsection% + } + {} + {} + +\pretocmd{\@ssect} + {\let\old@edtext=\edtext% + \let\edtext=\dummy@edtext% + } + {} + {} + +\apptocmd{\@ssect} + {\let\edtext=\old@edtext} + {} + {} + +\patchcmd{\@ssect} + {#5} + {#5% + \print@rightmargin@eledsection% + } + {} + {} + +\patchcmd{\@ssect} + {\hskip #1} + {\hskip #1% + \print@leftmargin@eledsection% + } + {} + {} +}% +\catcode`\#=6 %Space NEEDS by \catcode +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\eled@sectioning@out} +% \cs{eled@sectioning@out} is the output file, to dump the pstarts where a sectioning command is used. +% \begin{macrocode} +\newwrite\eled@sectioning@out +% \end{macrocode} +% \end{macro} +% \begin{macro}{\eledchapter} +% \begin{macro}{\eledsection} +% \begin{macro}{\eledsubsection} +% \begin{macro}{\eledsubsubsection} +% \begin{macro}{\eledchapter*} +% \begin{macro}{\eledsection*} +% \begin{macro}{\eledsubsection*} +% \begin{macro}{\eledsubsubsection*} +% And now, the user sectioning commands, which write to the file, and also add content as a "normal" line. +% \begin{macrocode} +\newcommand{\eledchapter}[2][]{% + #2% + \ifledRcol% + \immediate\write\eled@sectioningR@out{% + \string\eled@chapter{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{}{R} + }% + \else% + \immediate\write\eled@sectioning@out{% + \string\eled@chapter{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{}{} + }% + \fi% +} + +\newcommand{\eledsection}[2][]{% + #2% + \ifledRcol% + \immediate\write\eled@sectioningR@out{% + \string\eled@section{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{}{R} + }% + \else% + \immediate\write\eled@sectioning@out{% + \string\eled@section{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{}{} + }% + \fi% +} + +\newcommand{\eledsubsection}[2][]{% + #2% + \ifledRcol% + \immediate\write\eled@sectioningR@out{% + \string\eled@subsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{}{R} + }% + \else% + \immediate\write\eled@sectioning@out{% + \string\eled@subsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{}{} + }% + \fi% +} +\newcommand{\eledsubsubsection}[2][]{% + #2% + \ifledRcol% + \immediate\write\eled@sectioningR@out{% + \string\eled@subsubsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{}{R} + }% + \else% + \immediate\write\eled@sectioning@out{% + \string\eled@subsubsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{}{} + }% + \fi% +} + + +\WithSuffix\newcommand\eledchapter*[2][]{% + #2% + \ifledRcol% + \immediate\write\eled@sectioningR@out{% + \string\eled@chapter{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{*}{R} + }% + \else% + \immediate\write\eled@sectioning@out{% + \string\eled@chapter{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{*}{} + }% + \fi% +} + +\WithSuffix\newcommand\eledsection*[2][]{% + #2% + \ifledRcol% + \immediate\write\eled@sectioningR@out{% + \string\eled@section{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{*}{R} + }% + \else% + \immediate\write\eled@sectioning@out{% + \string\eled@section{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{*}{} + }% + \fi% +} + +\WithSuffix\newcommand\eledsubsection*[2][]{% + #2% + \ifledRcol% + \immediate\write\eled@sectioningR@out{% + \string\eled@subsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{*}{R} + }% + \else% + \immediate\write\eled@sectioning@out{% + \string\eled@subsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{*}{} + }% + \fi% +} + +\WithSuffix\newcommand\eledsubsubsection*[2][]{% + #2% + \ifledRcol% + \immediate\write\eled@sectioningR@out{% + \string\eled@subsubsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsR}{*}{R} + }% + \else% + \immediate\write\eled@sectioning@out{% + \string\eled@subsubsection{#1}{\unexpanded{#2}}{\the\l@dnumpstartsL}{*}{} + }% + \fi% +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\eled@chapter} +% \begin{macro}{\eled@section} +% \begin{macro}{\eled@subsection} +% \begin{macro}{\eled@subsubsection} +% The sectioning macros, called in the auxiliary file. They have five arguments: +% \begin{enumerate} +% \item Optional arguments of \LaTeX\ sectioning command. +% \item Mandatory arguments of \LaTeX\ sectioning command. +% \item Pstart number. +% \item Side: \verb+R+ if right, nothing if left. +% \item Starred or not. +% \end{enumerate} +% \begin{macrocode} +\def\eled@chapter#1#2#3#4#5{% + \ifstrempty{#4}% + {% + \ifstrempty{#1}% + {% + \global\csdef{eled@sectioning@#3#5}{\let\edtext=\dummy@edtext\chapter{#2}}% + \global\csdef{eled@sectmark@#3#5}{\let\edtext=\dummy@edtext{}\chaptermark{#2}}% + }%Need for \pairs, because of using parbox. + {% + \global\csdef{eled@sectioning@#3#5}{\let\edtext=\dummy@edtext\chapter[#1]{#2}}% + \global\csdef{eled@sectmark@#3#5}{\let\edtext=\dummy@edtext{}\chaptermark{#2}}%Need for \pairs, because of using parbox. + }% + }% + {% + \ifstrempty{#1}% + {\global\csdef{eled@sectioning@#3#5}{\let\edtext=\dummy@edtext\chapter*{#2}}} + {\global\csdef{eled@sectioning@#3#5}{\let\edtext=\dummy@edtext\chapter*[#1]{#2}}}%Bug in LaTeX! + }% + \listcsgadd{eled@sections#5@@}{#3}% + } +\def\eled@section#1#2#3#4#5{% + \ifstrempty{#4}% + {\ifstrempty{#1}% + {% + \global\csdef{eled@sectioning@#3#5}{\section{#2}}% + \global\csdef{eled@sectmark@#3#5}{\let\edtext=\dummy@edtext{}\sectionmark{#2}}%Need for \pairs, because of using parbox. + }% + {% + \global\csdef{eled@sectioning@#3#5}{\section[#1]{#2}}% + \global\csdef{eled@sectmark@#3#5}{\let\edtext=\dummy@edtext{}\sectionmark{#1}}%Need for \pairs, because of using parbox. + }% + }% + {\ifstrempty{#1}% + {\global\csdef{eled@sectioning@#3#5}{\section*{#2}}}% + {\global\csdef{eled@sectioning@#3#5}{\section*[#1]{#2}}}%Bug in LaTeX! + } + \listcsgadd{eled@sections#5@@}{#3}% + } +\def\eled@subsection#1#2#3#4#5{% + \ifstrempty{#4}% + {\ifstrempty{#1}% + {% + \global\csdef{eled@sectioning@#3#5}{\subsection{#2}}% + \global\csdef{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) + }% + {% + \global\csdef{eled@sectioning@#3#5}{\subsection[#1]{#2}}% + \global\csdef{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) + }% + }% + {\ifstrempty{#1}% + {\global\csdef{eled@sectioning@#3#5}{\subsection*{#2}}}% + {\global\csdef{eled@sectioning@#3#5}{\subsection*[#1]{#2}}}%Bug in LaTeX! + } + \listcsgadd{eled@sections#5@@}{#3}% + } +\def\eled@subsubsection#1#2#3#4#5{% + \ifstrempty{#4}% + {\ifstrempty{#1}% + {\global\csdef{eled@sectioning@#3#5}{\subsubsection{#2}}}% + {\global\csdef{eled@sectioning@#3#5}{\subsubsection[#1]{#2}}}% + }% + {\ifstrempty{#1}% + {\global\csdef{eled@sectioning@#3#5}{\subsubsection*{#2}}}% + {\global\csdef{eled@sectioning@#3#5}{\subsubsection*[#1]{#2}}}%Bug in LaTeX! + } + \listcsgadd{eled@sections#5@@}{#3}% + } + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % \section{Page breaking or no page breaking depending of specific lines} -% By default, page breaks are automatic. However, the use can define lines which will force page breaks, or prevent page breaks around one specific line. +% 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. % On the first run, the line-list file records the line number of where the page break is being changed (either forced, or prevented). % 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. % \begin{macro}{\normal@page@break} @@ -12934,6 +13828,14 @@ % \setcounter{stanzaindentsrepetition}{2} % \setstanzaindents{5,0,1} % \end{verbatim} +% \subsection{Migration to eledmac 1.12.0} +% The migration to eledmac 1.12.0 is easy: +% \begin{itemize} +% \item You must delete all the auxiliary files, and so one, make the normal three runs. +% \item If you have modified \cs{l@reg}, which is not advisable, you must rename it to \cs{@nl@reg}. +% \end{itemize} +% +% The version 1.12.0 adds new best way to manage section title inside numbered text. Please read §~\ref{eledsection} (p.~\pageref{eledsection}). % \clearpage % \bibliographystyle{alpha} % \phantomsection diff --git a/Master/texmf-dist/source/latex/eledmac/eledpar.dtx b/Master/texmf-dist/source/latex/eledmac/eledpar.dtx index cfb74f23010..cae0c298ca7 100644 --- a/Master/texmf-dist/source/latex/eledmac/eledpar.dtx +++ b/Master/texmf-dist/source/latex/eledmac/eledpar.dtx @@ -51,7 +51,7 @@ % % \fi % -% \CheckSum{4483} +% \CheckSum{4628} % % \makeatletter % \newcommand*{\DescribeIt}{\leavevmode\@bsphack\begingroup\MakePrivateLetters @@ -134,6 +134,19 @@ % \my@changes#1\@nil % }% %\makeatother +% \newcommand{\Lpack}[1]{\textsf{#1}} +% \newcommand{\Lclass}[1]{\textsf{#1}} +% \newcommand{\file}[1]{\texttt{#1}} +% \newcommand{\eledpar}{eledpar} +% \newcommand{\eledmac}{eledmac} +% \newcommand{\Eledmac}{\Lpack{\eledmac}} +% \newcommand{\Eledpar}{\Lpack{\eledpar}} +% \newcommand{\edmac}{\texttt{EDMAC}} +% \newcommand{\tabmac}{\texttt{TABMAC}} +% \newcommand{\edstanza}{\texttt{EDSTANZA}} +% \newcommand{\texbook}{\textit{TeXbook}} +% \newcommand{\thetexbook}{\textit{The TeXbook}} +% % \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} @@ -159,20 +172,13 @@ % \changes{v1.4.3}{2013/10/27}{Corrects a false hanging verse when a verse is exactly the length of a line.} % \changes{v1.5.0}{2013/11/08}{Add, as in eledmac, features to manage page breaks.} % \changes{v1.7.0}{2014/04/14}{Add, as in eledmac, features to make crossrefs with pstart numbers.} +% \changes{v1.8.0}{2014/08/05}{Debug eledmac sectioning command after using \cs{resumenumbering}.} +% \changes{v1.8.0}{2014/08/05}{Compatibility with \Lpack{musixtex}.} +% \changes{v1.8.0}{2014/08/05}{Add, as in eledmac, possibility to insert something after \cs{pend}s / verses.} +% \changes{v1.8.0}{2014/08/05}{Add, as in eledmac, possibility to insert something between \cs{pstart}s / verse.} +% \changes{v1.8.0}{2014/08/05}{Add, as in eledmac, new system of sectioning commands.} % \hyphenation{man-u-script man-u-scripts} % -% \newcommand{\Lpack}[1]{\textsf{#1}} -% \newcommand{\Lclass}[1]{\textsf{#1}} -% \newcommand{\file}[1]{\texttt{#1}} -% \newcommand{\eledpar}{eledpar} -% \newcommand{\eledmac}{eledmac} -% \newcommand{\Eledmac}{\Lpack{\eledmac}} -% \newcommand{\Eledpar}{\Lpack{\eledpar}} -% \newcommand{\edmac}{\texttt{EDMAC}} -% \newcommand{\tabmac}{\texttt{TABMAC}} -% \newcommand{\edstanza}{\texttt{EDSTANZA}} -% \newcommand{\texbook}{\textit{TeXbook}} -% \newcommand{\thetexbook}{\textit{The TeXbook}} % % ^^A PW added following as the definitions are at some unknown elsewhere % \newcommand{\egstart}{} @@ -369,9 +375,30 @@ % 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. +% +% \DescribeMacro{\columnsposition} +% \changes{v1.8.0}{2014/08/05}{Add \cs{columnsposition}.} +% By default, columns are positioned to the right of the page. +% However, you use \cs{columnsposition}\verb+{L}+ to align them to the left, +% or \cs{columnsposition}\verb+{C}+ to center them. +% % 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. % % +% \DescribeMacro{\beforecolumnseparator}\DescribeMacro{\aftercolumnseparator} +% \changes{v1.8.0}{2014/08/05}{Add \cs{beforecolumnseparator} and \cs{aftercolumnseparator}.} +% By default, the spaces around column separator are the same as the space: +% \begin{itemize} +% \item On the left of columns, if columns are aligned right. +% \item On the right of columns, if columns are aligned left. +% \item On both the Left and Right columns, if columns are centered. +% \end{itemize} +% You can redefine \cs{beforecolumnseparator} and \cs{aftercolumnseparator} length to define spaces before or after the column separator, instead of letting eledpar calculate them automatically. +% \begin{verbatim} +% \setlength{\beforecolumseparator}{length} +% \setlength{\aftercolumseparator}{length} +% \end{verbatim} +% If you want to come back to the previous behavior, just set them with a negative value. % \section{Facing pages}\label{pages} % % \DescribeEnv{pages} @@ -695,12 +722,17 @@ % % When you use \cs{lednopb} make sure to use it on both sides in the corresponding % verses to keep the pages in sync. +% \section{Side notes} +% As in \Lpack{eledmac}, you must use one of the following commands to add side notes: \cs{ledsidenote}, \cs{ledleftnote}, \cs{ledrightnote}, \cs{ledouterote}, \cs{ledinnerrote}. +% +% The \cs{sidenotemargin} defines the margin of the sidenote for either left or right side, depending on the current environment. +% You can use \cs{sidenotemargin*} to define it for both sides. % \section{Parallel ledgroups} % \changes{v1.6.0}{2013/12/13}{Add tool and documentation for parallel ledgroups} % You can also make parallel ledgroups (see the documentation of eledmac about ledgroups). % To do it you have: % \begin{itemize} -% \item To load \Lpack{eledpar} package with the \verb+parledgroup+ option, or to add \cs{\parledgrouptrue}. +% \item To load \Lpack{eledpar} package with the \verb+parledgroup+ option, or to add \cs{parledgrouptrue}. % \item To push each ledgroup between \cs{pstart}…\cs{pend} command. % \end{itemize} % See the following example: @@ -769,6 +801,15 @@ % \StopEventually{} % % \clearpage +% \section{Sectioning commands} +% \changes{v1.8.0}{2014/08/05}{New sectioning commands, as in eledmac.} +% The standard sectioning commands of eledmac are available, and provide parallel sectionings, for both two-column and two-page layout. +% \DescribeMacro{\eledsectnotoc} +% By default, the section commands of the right side are not added to the table of contents. +% But you can change it, using \cs{eledsectnotoc}\marg{arg}, where \meta{arg} could be \verb+L+ (for left side) or \verb+R+ (for right side). +% +% \DescribeMacro{\eledsectmark} +% By default, the \LaTeX\ marks for header are token from left side. You can change it, using \cs{eledsectmark}\marg{arg}, where \meta{arg} could be \verb+L+ (for left side) or \verb+R+ (for right side). % \section{Implementation overview}\label{overview} % % TeX is designed to process a single stream of text, which may include @@ -806,7 +847,7 @@ % \begin{macrocode} %<*code> \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{eledpar}[2014/04/14 v1.7.0 eledmac extension for parallel texts] +\ProvidesPackage{eledpar}[2014/08/05 v1.8.0 eledmac extension for parallel texts]% % \end{macrocode} % With the option `shiftedpstarts' a long pstart one the left side (or in the right side) don't make a blank on the corresponding pstart, but the blank is put on the bottom of the page. Consequently, the pstarts on the parallel pages are shifted, but the shifted stop at every end of pages. @@ -927,26 +968,7 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\beginnumbering} -% For parallel processing the original \cs{beginnumbering} is extended -% to zero \cs{l@dnumpstartsL} --- the number of chunks to be processed. -% It also sets \cs{ifpst@rtedL} to FALSE. -% \begin{macrocode} -\providecommand*{\beginnumbering}{% - \ifnumbering - \led@err@NumberingStarted - \endnumbering - \fi - \global\l@dnumpstartsL \z@ - \global\pst@rtedLfalse - \global\numberingtrue - \global\advance\section@num \@ne - \initnumbering@reg - \message{Section \the\section@num}% - \line@list@stuff{\jobname.\extensionchars\the\section@num}% - \l@dend@stuff} -% \end{macrocode} -% \end{macro} +% \changes{v1.12.0}{2014/07/24}{\cs{beginnumbering} is defined only on \Lpack{eledmac}, not on \Lpack{eledpar}.} % % \begin{macro}{\beginnumberingR} % This is the right text equivalent of \cs{beginnumbering}, and begins @@ -976,10 +998,11 @@ \l@dend@stuff \setcounter{pstartR}{1} \begingroup - \initnumbering@sectcmd \initnumbering@sectcountR + \gdef\eled@sectionsR@@{} + \makeatletter\InputIfFileExists{\jobname.eledsec\the\section@numR R}{}{}\makeatother + \immediate\openout\eled@sectioningR@out=\jobname.eledsec\the\section@numR R\relax } - % \end{macrocode} % \end{macro} % @@ -1012,7 +1035,10 @@ \fi \else \led@err@NumberingNotStarted - \fi\endgroup} + \fi + \endgroup + \immediate\closeout\eled@sectioningR@out + } % \end{macrocode} % \end{macro} @@ -1048,6 +1074,7 @@ \led@mess@SectionContinued{\the\section@numR R}% \line@list@stuffR{\jobname.\extensionchars\the\section@numR R}% \l@dend@stuff + \initnumbering@sectcmd \else \led@err@numberingShouldHaveStarted \endnumberingR @@ -1326,7 +1353,7 @@ % \subsection{Line-number counters and lists} % % We need another set of counters and lists for the right text, -% corresponding to those in \Lpack{eledmac} for regualr or left text. +% corresponding to those in \Lpack{eledmac} for regular or left text. % % \begin{macro}{\line@numR} % \begin{macro}{\subline@numR} @@ -1481,14 +1508,14 @@ % % The macros with \verb"action" in their names contain all the code % that modifies the action-code list. -% \begin{macro}{\@l@regR} -% \begin{macro}{\@l} -% \cs{@l} does everything related to the start of a +% \begin{macro}{\@nl@regR} +% \begin{macro}{\@nl} +% \cs{@nl} does everything related to the start of a % new line of numbered text. Exactly what it does depends % on whether right text is being processed. % % \begin{macrocode} -\newcommand{\@l@regR}{% +\newcommand{\@nl@regR}{% \ifx\l@dchset@num\relax \else \advance\absline@numR \@ne \set@line@action @@ -1532,12 +1559,12 @@ \fi \fi} -\renewcommand*{\@l}[2]{% +\renewcommand*{\@nl}[2]{% \fix@page{#1}% \ifledRcol - \@l@regR + \@nl@regR \else - \@l@reg + \@nl@reg \fi} % \end{macrocode} @@ -2014,19 +2041,19 @@ % \end{macro} % % \begin{macro}{\new@lineL} -% The \cs{new@lineL} macro sends the \cs{@l} command to the left text +% The \cs{new@lineL} macro sends the \cs{@nl} command to the left text % line-list file, to mark the start of a new text line. % \begin{macrocode} \newcommand*{\new@lineL}{% - \write\linenum@out{\string\@l[\the\c@page][\thepage]}} + \write\linenum@out{\string\@nl[\the\c@page][\thepage]}} % \end{macrocode} % \end{macro} % \begin{macro}{\new@lineR} -% The \cs{new@lineR} macro sends the \cs{@l} command to the right text +% The \cs{new@lineR} macro sends the \cs{@nl} command to the right text % line-list file, to mark the start of a new text line. % \begin{macrocode} \newcommand*{\new@lineR}{% - \write\linenum@outR{\string\@l[\the\c@page][\thepage]}} + \write\linenum@outR{\string\@nl[\the\c@page][\thepage]}} % \end{macrocode} % \end{macro} % @@ -2290,6 +2317,7 @@ \newenvironment{pairs}{%} \l@dpairingtrue \l@dpagingfalse + \initnumbering@sectcmd }{% \l@dpairingfalse } @@ -2302,6 +2330,7 @@ \let\chapter\chapterinpages \l@dpairingtrue \l@dpagingtrue + \initnumbering@sectcmd \setlength{\Lcolwidth}{\textwidth}% \setlength{\Rcolwidth}{\textwidth}% }{% @@ -2339,16 +2368,15 @@ % \begin{macrocode} \newenvironment{Leftside}{% \ledRcolfalse - \let\beginnumbering\beginnumbering\setcounter{pstartL}{1} + \setcounter{pstartL}{1} \let\pstart\pstartL \let\thepstart\thepstartL \let\pend\pendL \let\memorydump\memorydumpL \Leftsidehook - \let\oldstanza\stanza - \renewcommand{\stanza}{\oldstanza\global\instanzaLtrue} + \let\old@startstanza\@startstanza + \def\@startstanza[##1]{\global\instanzaLtrue\old@startstanza[##1]} }{ - \let\stanza\oldstanza \Leftsidehookend} % \end{macrocode} % \end{environment} @@ -2393,11 +2421,10 @@ \let\lednopb\lednopbR \let\lineation\lineationR \Rightsidehook - \let\oldstanza\stanza - \renewcommand{\stanza}{\oldstanza\global\instanzaRtrue} + \let\old@startstanza\@startstanza + \def\@startstanza[##1]{\global\instanzaRtrue\old@startstanza[##1]} }{% \ledRcolfalse - \let\stanza\oldstanza \Rightsidehookend } @@ -2453,6 +2480,7 @@ % \changes{v1.1}{2012/09/25}{Add \cs{labelpstarttrue} (from eledmac).} % \changes{v1.1.1}{2012/10/01}{Correct \cs{pstartR} bug introduced by 1.1.} % \changes{v1.4.3}{2013/10/27}{Spurious spaces in \cs{pstartL} and \cs{pstartR}.} +% \changes{v1.8.0}{2014/08/05}{As in \Lpack{eledmac}, \cs{pendL} and \cs{pendR} can have an optional argument.} % \cs{pstart} starts the paragraph by % clearing the \cs{inserts@list} list and other % relevant variables, and then arranges for the @@ -2476,12 +2504,12 @@ \newcounter{pstartRold} \renewcommand{\thepstartR}{{\bfseries\@arabic\c@pstartR}. } -\newcommand*{\pstartL}{% -\if@nobreak% +\newcommandx*{\pstartL}[1][1]{% + \if@nobreak% \let\@oldnobreak\@nobreaktrue% -\else% + \else% \let\@oldnobreak\@nobreakfalse% -\fi% + \fi% \@nobreaktrue% \ifnumbering \else% \led@err@PstartNotNumbered% @@ -2525,16 +2553,22 @@ \numberedpar@true% \iflabelpstart\protected@edef\@currentlabel% {\p@pstartL\thepstartL}\fi% +% \end{macrocode} +% Dump the optional arguments +% \begin{macrocode} + \ifstrempty{#1}% + {}% + {\csgdef{before@pstartL@\the\l@dnumpstartsL}{\noindent#1}}% } % \end{macrocode} % % \begin{macrocode} -\newcommand*{\pstartR}{% -\if@nobreak% +\newcommandx*{\pstartR}[1][1]{% + \if@nobreak% \let\@oldnobreak\@nobreaktrue% -\else% + \else% \let\@oldnobreak\@nobreakfalse% -\fi% + \fi% \@nobreaktrue% \ifnumberingR \else% \led@err@PstartNotNumbered% @@ -2568,6 +2602,9 @@ \numberedpar@true% \iflabelpstart\protected@edef\@currentlabel% {\p@pstartR\thepstartR}\fi% + \ifstrempty{#1}% + {} + {\csgdef{before@pstartR@\the\l@dnumpstartsR}{\noindent#1}}% } % \end{macrocode} % \end{macro} @@ -2576,12 +2613,14 @@ % % \begin{macro}{\pendL} % \changes{v1.4.3}{2013/10/27}{Spurious spaces in \cs{pendL}.} +% \changes{v1.8.0}{2014/08/05}{As in \Lpack{eledmac}, \cs{pendL} can have an optional argument.} % \cs{pend} must be used to end a numbered paragraph. Again we need % a version % that knows about left parallel texts. % % \begin{macrocode} -\newcommand*{\pendL}{\ifnumbering \else% +\newcommandx*{\pendL}[1][1]{% + \ifnumbering \else% \led@err@PendNotNumbered% \fi% \ifnumberedpar@ \else% @@ -2607,17 +2646,24 @@ \addtocounter{pstartL}{1}% \fi \parledgroup@beforenotes@save{L}% +% \end{macrocode} +% Dump content of the optional argument. +% \begin{macrocode} + \ifstrempty{#1}% + {}% + {\csgdef{after@pendL@\the\l@dnumpstartsL}{\noindent#1}}% } - % \end{macrocode} % \end{macro} % % \begin{macro}{\pendR} % \changes{v1.4.3}{2013/10/27}{Spurious spaces in \cs{pstartR}.} +% \changes{v1.8.0}{2014/08/05}{As in \Lpack{eledmac}, \cs{pendR} can have an optional argument.} % The version of \cs{pend} needed for right texts. % % \begin{macrocode} -\newcommand*{\pendR}{\ifnumberingR \else% +\newcommandx*{\pendR}[1][1]{% + \ifnumberingR \else% \led@err@PendNotNumbered% \fi% \ifnumberedpar@ \else% @@ -2632,7 +2678,10 @@ \ifnumberpstart% \addtocounter{pstartR}{1}% \fi% - \parledgroup@beforenotes@save{R} + \parledgroup@beforenotes@save{R}% + \ifstrempty{#1}% + {}% + {\csgdef{after@pendR@\the\l@dnumpstartsR}{\noindent#1}}% } % \end{macrocode} @@ -2690,7 +2739,8 @@ % \end{macro} % % -% \changes{v0.11}{2012/06/11}{Change \cs{do@lineL} and \cs{do@lineR} to allow line numbering by pstart(like in eledmac 0.15).} +% \changes{v0.11}{2012/06/11}{Change \cs{do@lineL} and \cs{do@lineR} to allow line numbering by pstart (like in eledmac 0.15).} +% \changes{v1.8.0}{2014/08/05}{Change \cs{do@lineR} and \cs{do@lineR} to allow new sectioning commands.} % \begin{macro}{\do@lineL} % The \cs{do@lineL} macro is called to % do all the processing for a single line of left text. @@ -2710,18 +2760,19 @@ \IfStrEq{\splitfirstmarks\parledgroup@}{begin}{\parledgroup@notes@startL}{} \unvbox\one@line \global\setbox\one@line=\lastbox \getline@numL -\ifnum\@lock>\@ne\inserthangingsymboltrue\else\inserthangingsymbolfalse\fi + \ifnum\@lock>\@ne% + \inserthangingsymboltrue% + \else% + \inserthangingsymbolfalse% + \fi \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{\do@insidelineLhook\inserthangingsymbolL\new@lineL\l@dunhbox@line{\one@line}}\correcthangingL\ledrlfill\l@drd@ta% - \l@drsn@te - }}% + \xifinlist{\the\l@dpscL}{\eled@sections@@}% + {}% + {\print@lineL}}% \add@penaltiesL \global\advance\@donereallinesL\@ne \global\advance\@donetotallinesL\@ne @@ -2734,6 +2785,41 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\print@eledsectionL} +% \cs{print@lineL} is for lines without a sectioning command. +% \begin{macrocode} +\def\print@lineL{% + \affixpstart@numL% + \l@dld@ta %space kept for backwar compatibility + \l@dlsn@te %space kept for backwar compatibility + {\ledllfill\hb@xt@ \wd\one@line{\do@insidelineLhook\inserthangingsymbolL\new@lineL\l@dunhbox@line{\one@line}}\correcthangingL\ledrlfill\l@drd@ta% + \l@drsn@te}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\print@eledsectionL} +% \cs{print@eledsectionL} is for line with macro code. +% \begin{macrocode} +\def\print@eledsectionL{% + \addtocounter{pstartL}{-1}% + \ifdefstring{\@eledsectnotoc}{L}{\ledsectnotoc}{} + \ifdefstring{\@eledsectmark}{L}{}{\ledsectnomark} + \numdef{\temp@}{\l@dpscL-1}% + \xifinlist{\temp@}{\eled@sections@@}{\@nobreaktrue}{\@nobreakfalse}% + \@eled@sectioningtrue% + \csuse{eled@sectioning@\the\l@dpscL}% + \@eled@sectioningfalse% + \global\csundef{eled@sectioning@\the\l@dpscL}% + \if@RTL% + \hspace{-\paperwidth}% + {\hbox{\l@dunhbox@line{\one@line}} \new@line}% + \else% + \hspace{\paperwidth}% + {\new@line \hbox{\l@dunhbox@line{\one@line}}}% + \fi% + \vskip\eledsection@correcting@skip% +} +% \end{macrocode} +% \end{macro} % \changes{v0.3}{2005/02/10}{Added \cs{do@lineLhook} and \cs{do@lineRhook}} % \changes{v1.4}{2013/07/11}{Added \cs{do@insidelineLhook} and \cs{do@insidelineRhook}} % \begin{macro}{\do@lineLhook} @@ -2758,6 +2844,7 @@ % \changes{v0.3}{2005/02/10}{Changed \cs{do@lineR} similarly to \cs{do@lineL}} % \begin{macrocode} \newcommand*{\do@lineR}{% + \ledRcol@true% \advance\countRline \@ne \ifvbox\namebox{l@dRcolrawbox\the\l@dpscR}% {\vbadness=10000 @@ -2766,33 +2853,69 @@ \l@demptyd@ta \global\setbox\one@lineR=\vsplit\namebox{l@dRcolrawbox\the\l@dpscR} to\baselineskip}% - \IfStrEq{\splitfirstmarks\parledgroup@}{begin}{\parledgroup@notes@startR}{} + \IfStrEq{\splitfirstmarks\parledgroup@}{begin}{\parledgroup@notes@startR}{} \unvbox\one@lineR \global\setbox\one@lineR=\lastbox \getline@numR -\ifnum\@lockR>\@ne\inserthangingsymbolRtrue\else\inserthangingsymbolRfalse\fi + \ifnum\@lockR>\@ne% + \inserthangingsymbolRtrue + \else% + \inserthangingsymbolRfalse% + \fi% \setbox\l@drightbox \hb@xt@ \Rcolwidth{% - \affixpstart@numR - \affixline@numR - \l@dld@ta + \affixline@numR% \add@insertsR \affixside@noteR - \l@dlsn@te - {\correcthangingR\ledllfill\hb@xt@ \wd\one@lineR{\do@insidelineRhook\inserthangingsymbolR\new@lineR\l@dunhbox@line{\one@lineR}}\ledrlfill\l@drd@ta% - \l@drsn@te - }}% + \xifinlist{\the\l@dpscR}{\eled@sectionsR@@}% + {}% + {\print@lineR}% + }% \add@penaltiesR \global\advance\@donereallinesR\@ne \global\advance\@donetotallinesR\@ne \else \setbox\l@drightbox \hb@xt@ \Rcolwidth{\hspace*{\Rcolwidth}} \global\advance\@donetotallinesR\@ne -\fi} +\fi +\ledRcol@false% +} % \end{macrocode} % \end{macro} % +% \begin{macro}{\print@lineR}{} +% \begin{macro}{\print@eledsectionR}{} +\def\print@lineR{% + \affixpstart@numR% + \l@dld@ta + \l@dlsn@te +\correcthangingR\ledllfill\hb@xt@ \wd\one@lineR{\do@insidelineRhook\inserthangingsymbolR\new@lineR\l@dunhbox@line{\one@lineR}}\ledrlfill\l@drd@ta% + \l@drsn@te + } + +\def\print@eledsectionR{% + \addtocounter{pstartR}{-1}% + \initnumbering@sectcountR% + \ifdefstring{\@eledsectnotoc}{R}{\ledsectnotoc}{}% + \ifdefstring{\@eledsectmark}{R}{}{\ledsectnomark}% + \numdef{\temp@}{\l@dpscR-1}% + \xifinlist{\temp@}{\eled@sectionsR@@}{\@nobreaktrue}{\@nobreakfalse}% + \@eled@sectioningtrue% + \csuse{eled@sectioning@\the\l@dpscR R}% + \@eled@sectioningfalse% + \global\csundef{eled@sectioning@\the\l@dpscR R}% + \if@RTL% + \hspace{-\paperwidth}% + {\hbox{\l@dunhbox@line{\one@lineR}} \new@lineR}% + \else% + \hspace{\paperwidth}% + {\new@lineR \hbox{\l@dunhbox@line{\one@lineR}}}% + \fi% + \vskip\eledsection@correcting@skip +} +% \end{macro} +% \end{macro} % % \subsection{Line and page number computation} % @@ -3400,7 +3523,7 @@ % The \cs{@lab} command, which appears in the \cs{linenum@out} file, % appends the current values of page, line and sub-line to the % \cs{labelref@list}. These values are defined by the earlier -% \cs{@page}, \cs{@l}, and the \cs{sub@on} and \cs{sub@off} commands +% \cs{@page}, \cs{@nl}, and the \cs{sub@on} and \cs{sub@off} commands % appearing in the \cs{linenum@out} file. % % \begin{macrocode} @@ -3425,82 +3548,27 @@ % don't produce any note but do put an extra unnumbered blank line into % the text. % \begin{macro}{\sidenote@marginR} -% \begin{macro}{\sidenotemargin} +% \begin{macro}{\sidenotemargin*} +% \changes{v1.8.0}{2014/08/05}{\cs{sidenotemargin} is now directly defined in \Lpack{eledmac} to be able to manage \Lpack{eledpar}.} +% \changes{v1.8.0}{2014/08/05}{Add \cs{sidenotemargin*}} % Specifies which margin sidenotes can be in. % \begin{macrocode} +\WithSuffix\newcommand\sidenotemargin*[1]{% + \l@dgetsidenote@margin{#1} + \global\sidenote@marginR=\@l@dtempcntb + \global\sidenote@margin=\@l@dtempcntb +} \newcount\sidenote@marginR -\renewcommand*{\sidenotemargin}[1]{{% - \l@dgetsidenote@margin{#1}% - \ifnum\@l@dtempcntb>\m@ne - \ifledRcol - \global\sidenote@marginR=\@l@dtempcntb - \else - \global\sidenote@margin=\@l@dtempcntb - \fi - \fi}} -\sidenotemargin{right} \global\sidenote@margin=\@ne % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\l@dlsnote} -% \begin{macro}{\l@drsnote} -% \begin{macro}{\l@dcsnote} -% The `footnotes' for left, right, and moveable sidenotes. The whole -% scheme is reminiscent of the critical footnotes code. + % \changes{v1.3.3}{2012/12/19}{Debug on the left notes of the right column.} % \changes{v1.3.4}{2013/07/03}{Allow to use commands in sidenotes, like it was introduced by eledmac 1.0.} -% \begin{macrocode} -\renewcommand*{\l@dlsnote}[1]{% - \begingroup% - \newcommand{\content}{#1}% - \ifnumberedpar@ - \ifledRcol% - \xright@appenditem{\noexpand\vl@dlsnote{\csexpandonce{content}}}% - \to\inserts@listR - \global\advance\insert@countR \@ne% - \else% - \xright@appenditem{\noexpand\vl@dlsnote{\csexpandonce{content}}}% - \to\inserts@list - \global\advance\insert@count \@ne% - \fi - \fi\ignorespaces\endgroup} -\renewcommand*{\l@drsnote}[1]{% - \begingroup% - \newcommand{\content}{#1}% - \ifnumberedpar@ - \ifledRcol% - \xright@appenditem{\noexpand\vl@drsnote{\csexpandonce{content}}}% - \to\inserts@listR - \global\advance\insert@countR \@ne% - \else% - \xright@appenditem{\noexpand\vl@drsnote{\csexpandonce{content}}}% - \to\inserts@list - \global\advance\insert@count \@ne% - \fi - \fi\ignorespaces\endgroup} -\renewcommand*{\l@dcsnote}[1]{% - \begingroup% - \newcommand{\content}{#1}% - \ifnumberedpar@ - \ifledRcol% - \xright@appenditem{\noexpand\vl@dcsnote{\csexpandonce{content}}}% - \to\inserts@listR - \global\advance\insert@countR \@ne% - \else% - \xright@appenditem{\noexpand\vl@dcsnote{\csexpandonce{content}}}% - \to\inserts@list - \global\advance\insert@count \@ne% - \fi - \fi\ignorespaces\endgroup} - -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% +% \changes{v1.8.0}{2014/08/05}{\cs{l@dlsnote},\cs{l@drsnote} and \cs{l@dcsnote} defined only one time, in \Lpack{eledmac}. } % \begin{macro}{\affixside@noteR} % The right text version of \cs{affixside@note}. % \changes{v1.1.2}{2012/10/06}{Remove spurious space between line number and line content} @@ -3517,27 +3585,38 @@ \numdef{\itemcount@}{\itemcount@+1}% }% \dolistloop{\l@dcsnotetext}% - \ifnumgreater{\itemcount@}{1}{\eledmac@warning{\itemcount@\space sidenotes on line \the\line@numR R p. \the\page@numR,}}{}% + \ifnumgreater{\itemcount@}{1}{\eledmac@warning{\itemcount@\space sidenotes on line \the\line@numR\space p. \the\page@numR,}}{}% \gdef\@templ@d{}% \ifx\@templ@d\l@dcsnotetext \else% \if@twocolumn% \if@firstcolumn% - \setl@dlp@rbox{\sidenotecontent@}% + \setl@dlp@rbox{##1}{\sidenotecontent@}% \else% \setl@drp@rbox{\sidenotecontent@}% \fi% \else% \@l@dtempcntb=\sidenote@marginR% \ifnum\@l@dtempcntb>\@ne% - \advance\@l@dtempcntb by\page@num% + \advance\@l@dtempcntb by\page@numR% \fi% \ifodd\@l@dtempcntb% - \setl@drp@rbox{\sidenotecontent@t}% + \setl@drp@rbox{\sidenotecontent@}% + \gdef\sidenotecontent@{}% + \numdef{\itemcount@}{0}% + \dolistloop{\l@dcsnotetext@l}% + \ifnumgreater{\itemcount@}{1}{\eledmac@warning{\itemcount@\space leftnotes on line \the\line@numR\space p. \the\page@numR,}}{}% + \setl@dlp@rbox{\sidenotecontent@}% \else% \setl@dlp@rbox{\sidenotecontent@}% + \gdef\sidenotecontent@{}% + \numdef{\itemcount@}{0}% + \dolistloop{\l@dcsnotetext@r}% + \ifnumgreater{\itemcount@}{1}{\eledmac@warning{\itemcount@\space rightnotes on line \the\line@numR\space p. \the\page@numR,}}{}% + \setl@drp@rbox{\sidenotecontent@}% \fi% \fi% - \fi} + \fi% +} % \end{macrocode} % \end{macro} @@ -3908,34 +3987,12 @@ % \end{macro} % % \begin{macro}{\ifl@dsamelang} -% \begin{macro}{\l@dsamelangfalse} -% \begin{macro}{\l@dsamelangtrue} -% A flag for checking if the same \verb?babel? language has been used -% for both the left and right texts. -% \begin{macrocode} -\newif\ifl@dsamelang - \l@dsamelangtrue -% \end{macrocode} -% \end{macro} -% \end{macro} +% Suppress \cs{ifl@dsamelang} which didn't work and was not logical, because both columns could have the same language but not the main language of the document. % \end{macro} % % \begin{macro}{\l@dchecklang} -% I'm going to use \cs{theledlanguageL} and \cs{theledlanguageR} to hold -% the names of the languages used for the left and right texts. This macro -% sets \cs{ifl@dsamelang} TRUE if they are the same, otherwise it -% sets it FALSE. -% \begin{macrocode} -\newcommand*{\l@dchecklang}{% - \l@dsamelangfalse - \edef\@tempa{\theledlanguageL}\edef\@temp{\theledlanguageR}% - \ifx\@tempa\@tempb - \l@dsamelangtrue - \fi} - -% \end{macrocode} +% \changes{v1.12.0}{2014/08/05}{Suppress \cs{l@dchecklang} which didn't work and was not logical, because both columns could have the same language but not the main language of the document.} % \end{macro} -% % \begin{macro}{\l@dbbl@set@language} % In \verb?babel? the macro \cs{bbl@set@language}\marg{lang} does the work when % the language \meta{lang} is changed via \cs{selectlanguage}. @@ -4017,12 +4074,15 @@ } % \end{macrocode} % If on Polyglossia +% \changes{v1.8.0}{2014/08/05}{Correct left/right language setting with polyglossia.} % \begin{macrocode} - { \apptocmd{\xpg@set@language}{% - \ifledRcol \gdef\theledlanguageR{#1}% - \else \gdef\theledlanguageL{#1}% + { \let\old@otherlanguage\otherlanguage% + \renewcommand{\otherlanguage}[2][]{% + \selectlanguage[#1]{#2}% + \ifledRcol \gdef\theledlanguageR{#2}% + \else \gdef\theledlanguageL{#2}% \fi}% - \let\l@duselanguage\xpg@set@language + \let\l@duselanguage\xpg@set@language% \gdef\theledlanguageL{\xpg@main@language}% \gdef\theledlanguageR{\xpg@main@language}% % \end{macrocode} @@ -4038,13 +4098,24 @@ % % \section{Parallel columns} % +% \begin{macro}{\@eledsectionL} +% \begin{macro}{\@eledsectionR} +% The parbox \cs{@eledsectionL} and \cs{@eledsectionR} will keep the sections' title. +% \begin{macrocode} +\newsavebox{\@eledsectionL}% +\newsavebox{\@eledsectionR}% +% \end{macrocode} +% \end{macro} +% \end{macro} % \begin{macro}{\Columns} +% \changes{v1.12.0}{2014/07/28}{Modify \cs{Columns} to enable to add section's title.} % The \cs{Columns} command results in the previous Left and % Right texts being typeset in matching columns. There should % be equal numbers of chunks in the left and right texts. % % \begin{macrocode} \newcommand*{\Columns}{% + \eledsection@correcting@skip=-\baselineskip% Correction for sections' titles \setcounter{pstartL}{\value{pstartLold}} \setcounter{pstartR}{\value{pstartRold}} \ifnum\l@dnumpstartsL=\l@dnumpstartsR\else @@ -4081,27 +4152,47 @@ % are the same % \changes{v0.2}{2004/12/20}{Added \cs{l@dchecklang} and \cs{l@duselanguage} % to \cs{Columns}} +% \changes{v1.12.0}{2014/08/05}{Suppress \cs{l@dchecklang} from \cs{Columns}.} % \begin{macrocode} \checkraw@text - \l@dchecklang { \loop\ifaraw@text % \end{macrocode} % Grab the next pair of left and right text lines and output them, swapping -% languages if they differ +% languages if they differ, adding section title if needed. % \begin{macrocode} - \ifl@dsamelang - \do@lineL - \do@lineR - \else \l@duselanguage{\theledlanguageL}% \do@lineL + \xifinlist{\the\l@dpscL}{\eled@sections@@} + {% + \ifdefstring{\@eledsectmark}{L}% + {\csuse{eled@sectmark@\the\l@dpscL}% + }{}% + \global\csundef{eled@sectmark@\the\l@dpscL}% + \savebox{\@eledsectionL}{\parbox[t][][t]{\Lcolwidth}{\vbox{}\print@eledsectionL}}%\vbox{}-> prevent alignment troubles with RTL language + }% + {}% \l@duselanguage{\theledlanguageR}% \do@lineR - \fi + \xifinlist{\the\l@dpscR}{\eled@sectionsR@@} + {% + \ifdefstring{\@eledsectmark}{R}% + {\csuse{eled@sectmark@\the\l@dpscR R}% + }{}% + \global\csundef{eled@sectmark@\the\l@dpscR R}% + \savebox{\@eledsectionR}{\parbox[t][][t]{\Rcolwidth}{\vbox{}\print@eledsectionR}}}%\vbox{}-> prevent alignment troubles with RTL language + {}% \hb@xt@ \hsize{% - \hfill \unhbox\l@dleftbox - \hfill \columnseparator \hfill - \unhbox\l@drightbox + \ifdefstring{\columns@position}{L}{}{\hfill }% + \unhbox\l@dleftbox% + \ifhbox\@eledsectionL% + \usebox{\@eledsectionL}% + \fi% + \print@columnseparator% + \unhbox\l@drightbox% + \ifhbox\@eledsectionR% + \usebox{\@eledsectionR}% + \fi% + \ifdefstring{\columns@position}{R}{}{\hfill}% }% \checkraw@text \checkverseL @@ -4146,6 +4237,27 @@ % \end{macrocode} % \end{macro} +% \begin{macro}{\print@columnseparator} +% \changes{v1.8.0}{2014/08/05}{Move some code of \cs{Columns} to \cs{print@columnseparator}.} +% \cs{print@columnseparator} print the colum separator, with spaces around, following user's setting. +% We use the \TeX\ \cs{ifdim} instead of \Lpack{etoolbox} +% to avoid having \cs{hfill} in a \verb+{}+, which delete some (little) space. +% \begin{macrocode} +\def\print@columnseparator{% + \ifdim\beforecolumnseparator<0pt% + \hfill% + \else% + \hspace{\beforecolumnseparator}% + \fi% + \columnseparator% + \ifdim\aftercolumnseparator<0pt% + \hfill% + \else% + \hspace{\beforecolumnseparator}% + \fi% +}% +%\end{macrocode} +% \end{macro} % \begin{macro}{\checkpb@columns} % \cs{checkpb@columns} prevent or make pagebreaking in columns, depending of the use of \cs{ledpb} or \cs{lednopb}. % \begin{macrocode} @@ -4187,7 +4299,30 @@ % \end{macrocode} % \end{macro} % \end{macro} -% +% \begin{macro}{\columnsposition} +% \begin{macro}{\columns@position} +% The position of the \cs{Columns} in a page. Default value is R. +% Stored in \cs{columns@position}. +% \begin{macrocode} +\newcommand*{\columnsposition}[1]{% + \xdef\columns@position{#1}% + }% +\xdef\columns@position{R}% +% \end{macrocode} +% \end{macro} +% \end{macro} +% \begin{macro}{\beforecolumnseparator} +% \begin{macro}{\aftercolumnseparator} +% \cs{beforecolumnseparator} and \cs{aftercolumnseparator} lengths are defined to \verb+-1pt+. If user change them to a positive length, the lengths are used to define blank spaces before / after the column separator, instead of \cs{hfill}. +% \begin{macrocode} +\newlength{\beforecolumnseparator}% +\setlength{\beforecolumnseparator}{-2pt}% + +\newlength{\aftercolumnseparator}% +\setlength{\aftercolumnseparator}{-2pt}% +% \end{macrocode} +% \end{macro} +% \end{macro} % \begin{macro}{\if@pstarts} % \begin{macro}{\@pstartstrue} % \begin{macro}{\@pstartsfalse} @@ -4282,12 +4417,14 @@ % % % \begin{macro}{\Pages} +% \changes{v1.12.0}{2014/07/28}{Modify \cs{Pages} to enable to add section's title.} % The \cs{Pages} command results in the previous Left and % Right texts being typeset on matching facing pages. There should % be equal numbers of chunks in the left and right texts. % % \begin{macrocode} \newcommand*{\Pages}{% + \eledsection@correcting@skip=-2\baselineskip% line correcting for section titles. \setcounter{pstartL}{\value{pstartLold}} \setcounter{pstartR}{\value{pstartRold}} \parledgroup@notespacing@set@correction @@ -4380,12 +4517,19 @@ \checkpageL \l@duselanguage{\theledlanguageL}% %%% \begingroup -{ \loop\ifl@dsamepage +{ \loop\ifl@dsamepage% % \end{macrocode} -% Process the next (left) text line, adding it to the page. +% Process the next (left) text line, adding it to the page. +% Eventually, adds the optional argument of pstart. % \changes{v0.3}{2005/02/10}{Added \cs{ledstrutL} to \cs{Pages}} % \begin{macrocode} + \ifdefstring{\@eledsectnotoc}{L}{\ledsectnotoc}{} + \csuse{before@pstartL@\the\l@dpscL} + \global\csundef{before@pstartL@\the\l@dpscL} \do@lineL + \xifinlist{\the\l@dpscL}{\eled@sections@@} + {\print@eledsectionL}% + {}% \advance\numpagelinesL \@ne \ifshiftedpstarts \ifdim\ht\l@dleftbox>0pt\hb@xt@ \hsize{\ledstrutL\unhbox\l@dleftbox}\fi% @@ -4427,8 +4571,15 @@ % \begin{macrocode} \checkpageR \l@duselanguage{\theledlanguageR}% -{ \loop\ifl@dsamepage +{ \loop\ifl@dsamepage% + \initnumbering@sectcountR + \ifdefstring{\@eledsectnotoc}{R}{\ledsectnotoc}{} + \csuse{before@pstartR@\the\l@dpscR} + \global\csundef{before@pstartR@\the\l@dpscR} \do@lineR + \xifinlist{\the\l@dpscR}{\eled@sectionsR@@} + {\print@eledsectionR}% + {}% \advance\numpagelinesR \@ne \ifshiftedpstarts \ifdim\ht\l@drightbox>0pt\hb@xt@ \hsize{\ledstrutR\unhbox\l@drightbox}\fi% @@ -4816,11 +4967,12 @@ % \begin{macrocode} \else% box is empty % \end{macrocode} -% The box is empty; check if enough lines (real and blank) have been +% The box is empty. +% Check if enough lines (real and blank) have been % output. % \begin{macrocode} \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscL}>\@donetotallinesL - \parledgroup@notes@endL + \parledgroup@notes@endL \else % \end{macrocode} % Sufficient lines have been output. @@ -4828,8 +4980,7 @@ \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscL}=\@donetotallinesL \parledgroup@notes@endL \fi - \ifwrittenlinesL - \else + \ifwrittenlinesL\else % \end{macrocode} % Write out the number of lines done, and set the boolean so this is only % done once. @@ -4851,6 +5002,12 @@ \resetprevline@ \fi \fi +% Add the content of the optional argument of the previous \cs{pend}. +% \begin{macrocode} + \csuse{after@pendL@\the\l@dpscL}% + \global\csundef{after@pendL@\the\l@dpscL}% +% \end{macrocode} +% \begin{macrocode} \addtocounter{pstartL}{1} \global\pstartnumtrue \l@dcalc@maxoftwo{\the\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}% @@ -4858,8 +5015,19 @@ {\usenamecount{l@dmaxlinesinpar\the\l@dpscL}}% \global\@donetotallinesL \z@ \global\advance\l@dpscL \@ne +% \end{macrocode} +% Add notes of parallel ledgroup. +% \begin{macrocode} \parledgroup@notes@endL \parledgroup@correction@notespacing@final{L} + \else +% Add the content of the optional argument of the last \cs{pend}. +% \begin{macrocode} + \l@dpagefulltrue + \csuse{after@pendL@\the\l@dpscL}% + \global\csundef{after@pendL@\the\l@dpscL}% +% \end{macrocode} +% \begin{macrocode} \fi \fi \fi} @@ -4870,13 +5038,12 @@ \ifvbox\namebox{l@dRcolrawbox\the\l@dpscR}% box is not empty \else% box is empty \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscR}>\@donetotallinesR - \parledgroup@notes@endR + \parledgroup@notes@endR \else \ifnum\usenamecount{l@dmaxlinesinpar\the\l@dpscR}=\@donetotallinesR \parledgroup@notes@endR \fi - \ifwrittenlinesR - \else + \ifwrittenlinesR\else \@writelinesinparR \writtenlinesRtrue \fi @@ -4889,6 +5056,8 @@ \resetprevline@ \fi \fi + \csuse{after@pendR@\the\l@dpscR}% + \global\csundef{after@pendR@\the\l@dpscR}% \addtocounter{pstartR}{1} \global\pstartnumRtrue \l@dcalc@maxoftwo{\the\usenamecount{l@dmaxlinesinpar\the\l@dpscR}}% @@ -4898,6 +5067,10 @@ \global\advance\l@dpscR \@ne \parledgroup@notes@endR \parledgroup@correction@notespacing@final{R} + \else + \csuse{after@pendR@\the\l@dpscR}% + \global\csundef{after@pendR@\the\l@dpscR}% + \l@dpagefulltrue \fi \fi \fi} @@ -4906,6 +5079,33 @@ % \end{macro} % \end{macro} % +% \section{Sections' titles' commands} +% \begin{macro}{\eledsectnotoc} +% \cs{eledsectnotoc} just saves its content \cs{@eledsectnotoc}, which will be tested where sectioning commands will be printed. +% \begin{macrocode} +\newcommand{\eledsectnotoc}[1]{\xdef\@eledsectnotoc{#1}} +\eledsectnotoc{R} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\eledsectmark} +% \cs{eledsectmark} just saves its content \cs{@eledsectmark}, which will be tested where sectioning commands will be printed. +% \begin{macrocode} +\newcommand{\eledsectmark}[1]{\xdef\@eledsectmark{#1}} +\eledsectmark{L} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\eledsection@correcting@skip} +% Because the vertical correction needed after inserting a title in parallel depends whether we are in parallel columns or parallel pages, we stock its length in \cs{eledsection@correcting@skip}. +% \begin{macrocode} +\newskip\eledsection@correcting@skip +% \end{macrocode} +% \end{macro} +% \begin{macro} +% We save the sectioning commands of the right side in the \cs{eled@sectioningR@out} file. +% \begin{macrocode} +\newwrite\eled@sectioningR@out +% \end{macrocode} +% \end{macro} % \section{Page break/no page break, depending on the specific line} % We need to adapt the macro of the homonym section of eledmac to eledpar. % \begin{macro}{\prev@pbR} @@ -5068,7 +5268,7 @@ \vspace{\parledgroup@notespacing@correction@accumulated} \parledgroup@correction@notespacing@init% \ifstrequal{#1}{L}{ - \numdef{\@checking}{\the\l@dpscL-1} + \numdef{\@checking}{\the\l@dpscL-1} }{ \numdef{\@checking}{\the\l@dpscR-1} } |