summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/eledmac/eledmac.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-11-16 23:23:49 +0000
committerKarl Berry <karl@freefriends.org>2012-11-16 23:23:49 +0000
commitb6a5cf35c860440520074aaab583ac9e43ca7488 (patch)
tree83f57832e729d4f581a5f1b3fb590fbe4e989c52 /Master/texmf-dist/source/latex/eledmac/eledmac.dtx
parent46c968cdb2125472e0393519e086437993caa589 (diff)
eledmac (16nov12)
git-svn-id: svn://tug.org/texlive/trunk@28280 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/eledmac/eledmac.dtx')
-rw-r--r--Master/texmf-dist/source/latex/eledmac/eledmac.dtx158
1 files changed, 132 insertions, 26 deletions
diff --git a/Master/texmf-dist/source/latex/eledmac/eledmac.dtx b/Master/texmf-dist/source/latex/eledmac/eledmac.dtx
index b3498697675..fe879f3293a 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{7988}
+% \CheckSum{8188}
%
% \makeatletter
% \newcommand*{\DescribeIt}{\leavevmode\@bsphack\begingroup\MakePrivateLetters
@@ -118,7 +118,7 @@
%
% \newcommand{\dtxfilename}{\texttt{eledmac.dtx}}
% \GetFileInfo{eledmac.sty}
-% ^^A Have the changes in the right order : see http://tex.stackexchange.com/a/74113/7712
+% ^^A To put the changes in the right order : see http://tex.stackexchange.com/a/74113/7712
%\makeatletter
% \let\org@changes@\changes@
% \def\my@changes v#1.#2#3\@nil{%
@@ -165,7 +165,7 @@
% \changes{v0.12}{2011/10/01}{For compatibility with eledpar, possibility to use \cs{autopar} on the right side.}
% \changes{v0.12.1}{2011/10/02}{The numbering of \cs{pstarts} restarts on each \cs{beginnumbering}.}
% \changes{v0.12.1}{2011/10/02}{Don't number \cs{pstarts} of stanza.}
-% \changes{v0.13}{2011/11/08}{New stanzaindentsrepetition counter to repeat stanza indents every \emph{n} verses.}
+% \changes{v0.13}{2011/11/08}{New stanzaindentsrepetition counter: to repeat stanza indents every \emph{n} verses.}
% \changes{v0.13.1}{2011/11/18}{\cs{thepstartL} and \cs{thepstartR} use now \cs{bfseries} and not \cs{bf}, which is deprecated and makes conflicts with memoir class.}
% \changes{v0.14}{2012/04/04}{Tweaked \cs{edlabel} to get correct line number if the command is first element of a paragraph.}
% \changes{v1.0}{2012/09/15}{Some compatibility break with eledmac. Change of name: eledmac.}
@@ -274,8 +274,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 macro to describe the textual variants in a formal way.
+% 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.
%
@@ -1146,7 +1146,7 @@
% 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 some tools to describes the textual variants in a
+% This package provides tools to describes the textual variants in a
% formal way.
%
% It is based on eledmac for the typographical aspect.
@@ -1456,7 +1456,8 @@
% footnotes, instead of explicit punctuation.
% We also define an \cs{rbracket} macro for the
% right square bracket printed at the end of the lemma in many
-% styles of textual notes (including \Eledmac's standard style).
+% styles of textual notes (including \Eledmac's standard style).
+% For polyglossia, when the lemma is RTL, the bracket automatically switches to a left bracket.
%
%
%
@@ -2261,9 +2262,9 @@
% \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.2}{2012/10/13}{Add \cs{ledsectnotoc} command.}
-% \DescribeMacro{\ledsectnotoc}If you use the sectionning commands in parallel texts (with eledpar),
-% you could want the table of contents works only
-% for one side, in many case, the side of the original text.
+% \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 begining of the side environnment :
% \begin{verbatim}
% \begin{Rightside}
@@ -2272,10 +2273,10 @@
% \end{Rightside}
% \end{verbatim}
% \subsection{Quotation environments}
-% Inside a numbered section, the \verb+quotation+ and \verb+quote+ environment can be used with the same meaning as outside.
-% The typographical consequences are similar as outside, based on the styles of the \emph{book} class.
-% However, if you used some package which redefine these environnments, theses redefinition won't be available inside the numbering section.
-% You must open the quotation environments inside a \cs{pstart}-\cs{pend} block, and not outside.
+% 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.
+% However, if you use a package that redefines these environments, these redefinitions won't be available inside the numbering section.
+% You must open the quotation environments inside a \cs{start}-\cs{pend} block, not outside.
% \section{Miscellaneous}
%
%
@@ -2646,7 +2647,7 @@
% \begin{macrocode}
%<*code>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{eledmac}[2012/11/01 v1.3 LaTeX port of EDMAC]
+\ProvidesPackage{eledmac}[2012/11/16 v1.4 LaTeX port of EDMAC]
% \end{macrocode}
%
% In general there is the following modifications to the original
@@ -2689,12 +2690,23 @@
% \end{macrocode}
% \end{macro}
% \end{macro}
-% Loading package \emph{xargs} to declare commands with optional arguments. \emph{Etoolbox} is also used for more clear code, for example in dynamic command names (it could replace \cs{csname} etc.). \emph{suffix} to declare commands with starred version.
+% 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 starred versions/a starred version, and \emph{iflutex} to test if LuaLaTeX is running.
+% \changes{v1.4}{2012/11/16}{Compatibility with LuaTeX of RTL notes.}
% \begin{macrocode}
\RequirePackage{xargs}
\RequirePackage{etoolbox}
\RequirePackage{suffix}
+\RequirePackage{ifluatex}
% \end{macrocode}
+% \begin{macro}{\if@RTL}
+% The \cs{if@RTL} is defined by the bidi package, which is sometimes loaded by \emph{polyglossia}.
+% But we define it if the bidi package is not loaded.
+% \begin{macrocode}
+\ifcsdef{if@RTL}{}{\newif\if@RTL}
+% \end{macrocode}
+% \end{macro}
% \begin{macro}{\showlemma}
% \verb?\showlemma?\marg{lemma} typesets the lemma text in the body.
% It depends on the option.
@@ -5167,7 +5179,10 @@
% within the expansion of \verb"#2" above, or in \cs{aftergroup}
% commands within that expansion.
% \begin{macrocode}
- \flag@start
+ \@ifundefined{xpg@main@language}{%if not polyglossia
+ \flag@start}%
+ {\if@RTL\flag@end\else\flag@start\fi% With polyglossia, you must track whether the language reads left to right (English) or right to left (Arabic).
+ }
\endgroup
\showlemma{#1}%
% \end{macrocode}
@@ -5184,11 +5199,16 @@
\x@lemma
\global\let\x@lemma=\relax
\fi
- \flag@end}
+ \@ifundefined{xpg@main@language}{%if not polyglossia
+ \flag@end}%
+ {\if@RTL\flag@start\else\flag@end\fi% With polyglossia, you must track whether the language reads left to right (English) or right to left (Arabic).
+ }
+ }
% \end{macrocode}
% \end{macro}
%
% \changes{v0.4}{2004/02/29}{Added \cs{showlemma} to \cs{edtext} (and \cs{critext})}
+% \changes{v1.4}{2012/11/16}{Compatibility of \cs{edtext} (and \cs{critext}) with the right-to-left direction (with Polyglossia).}
% \begin{macro}{\edtext}
% \begin{macrocode}
\newcommand{\edtext}[2]{\leavevmode
@@ -5197,7 +5217,10 @@
\set@line
\global\insert@count=0
\ignorespaces #2\relax
- \flag@start
+ \@ifundefined{xpg@main@language}{%if not polyglossia
+ \flag@start}%
+ {\if@RTL\flag@end\else\flag@start\fi% With polyglossia, you must track whether the language reads left to right (English) or right to left (Arabic).
+ }%
\endgroup
\showlemma{#1}%
\ifx\end@lemmas\empty \else
@@ -5205,7 +5228,11 @@
\x@lemma
\global\let\x@lemma=\relax
\fi
- \flag@end}
+ \@ifundefined{xpg@main@language}{%if not polyglossia
+ \flag@end}%
+ {\if@RTL\flag@start\else\flag@end\fi% With polyglossia, you must track whether the language reads left to right (English) or right to left (Arabic).
+ }%
+ }
% \end{macrocode}
% \end{macro}
@@ -6402,6 +6429,54 @@
% \end{macro}
%
%
+% \begin{macro}{\footnotelang@lua}
+% \cs{footnotelang@lua} is called to remember the information about the language of a lemma when LuaLaTeX is used.
+% \begin{macrocode}
+\newcommandx*{\footnotelang@lua}[1][1=L,usedefault]{%
+ \ifstrequal{#1}{L}{%
+ \xright@appenditem{{\csxdef{footnote@luatextextdir}{\the\luatextextdir}}}\to\inserts@list%Know the dir of lemma
+ \global\advance\insert@count \@ne%
+ \xright@appenditem{{\csxdef{footnote@luatexpardir}{\the\luatexpardir}}}\to\inserts@list%Know the dir of lemma
+ \global\advance\insert@count \@ne%
+ }%
+ {%
+ \xright@appenditem{{\csxdef{footnote@luatextextdir}{\the\luatextextdir}}}\to\inserts@listR%Know the dir of lemma
+ \global\advance\insert@countR \@ne%
+ \xright@appenditem{{\csxdef{footnote@luatexpardir}{\the\luatexpardir}}}\to\inserts@listR%Know the dir of lemma
+ \global\advance\insert@countR \@ne%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\footnotelang@poly}
+% \begin{macrocode}
+% \cs{footnotelang@poly} is called to remember the information about the language of a lemma when Polyglossia is used.
+\newcommandx*{\footnotelang@poly}[1][1=L,usedefault]{%
+ \ifstrequal{#1}{L}{%
+ \if@RTL%
+ \xright@appenditem{{\csxdef{footnote@dir}{@RTLtrue}}}\to\inserts@list%Know the language of lemma
+ \global\advance\insert@count \@ne%
+ \else
+ \xright@appenditem{{\csxdef{footnote@dir}{@RTLfalse}}}\to\inserts@list%Know the language of lemma
+ \global\advance\insert@count \@ne%
+ \fi%
+ \xright@appenditem{{\csxdef{footnote@lang}{\csexpandonce{languagename}}}}\to\inserts@list%Know the language of lemma
+ \global\advance\insert@count \@ne%
+ }%
+ {%
+ \if@RTL
+ \xright@appenditem{{\csxdef{footnote@dir}{@RTLtrue}}}\to\inserts@listR%Know the language of lemma
+ \global\advance\insert@countR \@ne%
+ \else
+ \xright@appenditem{{\csxdef{footnote@dir}{@RTLfalse}}}\to\inserts@listR%Know the language of lemma
+ \global\advance\insert@countR \@ne%
+ \fi
+ \xright@appenditem{{\csxdef{footnote@lang}{\csexpandonce{languagename}}}}\to\inserts@listR%Know the language of lemma
+ \global\advance\insert@countR \@ne%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
% \subsection{Normal footnote formatting} \label{sec:nfootformat}
%
% The processing of each note is done
@@ -6495,13 +6570,21 @@
%
% \verb"\par" should always be redefined to \verb"\endgraf" within
% the format macro (this is what \cs{normal@pars} does),
-% to override any tricky stuff which might be done in the main text
+% to override tricky material in the main text
% to get the lines numbered automatically (as set up by
% \cs{autopar}, for example).
+%
+% \changes{v1.4}{2012/11/16}{Direction of footnotes with polyglossia.}
% \begin{macrocode}
\newcommand*{\ledsetnormalparstuff}{%
- \normal@pars
+ \ifluatex%
+ \luatextextdir\footnote@luatextextdir%
+ \luatexpardir\footnote@luatexpardir%
+ \fi%
+ \csuse{\csuse{footnote@dir}}%
+ \normal@pars%
\noindent \parfillskip \z@ \@plus 1fil}
+
\notbool{parapparatus@}{\newcommandx*}{\newcommandx}{\normalfootfmt}[4][4=Z]{% 4th arg is optional, for backward compatibility
\ledsetnormalparstuff%
\hangindent=\csuse{Xhangindent@#4}
@@ -6532,10 +6615,22 @@
% \cs{printlines}. The right bracket macro is the same again;
% it crops up in \cs{normalfootfmt} and the other footnote
% macros for controlling the format of the footnotes.
+%
+% With polyglossia, each critical note has a \cs{footnote@lang} which shows the language of the lemma,
+% and which can be used to switch the bracket from right to left.
+% \changes{v1.4}{2012/11/16}{Switch the right bracket to a left bracket when the lemma is RTL (needs polyglossia or LuaTeX).}
% \begin{macrocode}
\def\endashchar{\textnormal{--}}
\newcommand*{\fullstop}{\textnormal{.}}
-\newcommand*{\rbracket}{\textnormal{\thinspace]}}
+\newcommand*{\rbracket}{\textnormal{%
+ \csuse{text\csuse{footnote@lang}}{%
+ \ifluatex%
+ \ifdefstring{\footnote@luatextextdir}{TRT}{\thinspace[}{\thinspace]}%
+ \else%
+ \thinspace]%
+ \fi}%
+ }%
+}
% \end{macrocode}
% \end{macro}
@@ -6777,7 +6872,7 @@
}%
\vskip\skip\csname #1footins\endcsname%
\leftskip0pt \rightskip0pt
- \csname #1footnoterule\endcsname}
+ \csname #1footnoterule\endcsname\noindent\leavevmode}
% \end{macrocode}
% \end{macro}
%
@@ -7028,7 +7123,7 @@
{}%
}%
\vskip\skip\csname #1footins\endcsname%
- \csname #1footnoterule\endcsname}
+ \csname #1footnoterule\endcsname\noindent\leavevmode}
% \end{macrocode}
% \end{macro}
%
@@ -7129,7 +7224,7 @@
% Here we produce the contents of the footnote from box $0$, and
% add a penalty of $0$ between boxes in this insert.
% \begin{macrocode}
- \box0
+ \if@RTL\noindent \leavevmode\fi\box0%
\penalty0
\egroup}
@@ -8386,6 +8481,7 @@
% \end{macrocode}
% \subsubsection{Create command for critical apparatus, \cs{Xfootnote}}
% Note the double \# in command: it's because command is made inside another command.
+% \changes{v1.4}{2012/11/16}{Remembers the language of the lemma, in order to create a correct direction for the footnote separator.}
% \begin{macrocode}
\global\notbool{parapparatus@}{\expandafter\newcommand\expandafter *}{\expandafter\newcommand}\csname #1footnote\endcsname[2][]{%
@@ -8393,12 +8489,22 @@
\newcommand{\content}{##2}%
\ifnumberedpar@
\ifledRcol%
+ \ifluatex%
+ \footnotelang@lua[R]%
+ \fi%
+ \@ifundefined{xpg@main@language}{}%if polyglossia
+ {\footnotelang@poly[R]}%
\footnoteoptions@[R]{##1}{true}%
\xright@appenditem{\noexpand\csuse{v#1footnote}{#1}%
{{\l@d@nums}{\csexpandonce{@tag}}{\csexpandonce{content}}}}\to\inserts@listR
\footnoteoptions@[R]{##1}{false}%
\global\advance\insert@countR \@ne%
\else%
+ \ifluatex%
+ \footnotelang@lua%
+ \fi%
+ \@ifundefined{xpg@main@language}{}%if polyglossia
+ {\footnotelang@poly}%
\footnoteoptions@{##1}{true}%
\xright@appenditem{\noexpand\csuse{v#1footnote}{#1}%
{{\l@d@nums}{\csexpandonce{@tag}}{\csexpandonce{content}}}}\to\inserts@list