diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/eledmac/eledmac.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/eledmac/eledmac.dtx | 201 |
1 files changed, 164 insertions, 37 deletions
diff --git a/Master/texmf-dist/source/latex/eledmac/eledmac.dtx b/Master/texmf-dist/source/latex/eledmac/eledmac.dtx index 7729c61ce78..2132ec053d2 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{8217} +% \CheckSum{8406} % % \makeatletter % \newcommand*{\DescribeIt}{\leavevmode\@bsphack\begingroup\MakePrivateLetters @@ -121,8 +121,8 @@ % ^^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{% -% \org@changes@{v#1.\six@digits{#2}#3=v#1.#2#3}% +% \def\my@changes v#1.#2.#3\@nil{% +% \org@changes@{v#1.\six@digits{#2}.#3=v#1.#2.#3}% % }% % \newcommand*{\six@digits}[1]{% % \ifnum#1<100000 0\fi @@ -132,7 +132,7 @@ % \two@digits{#1}% % }% % \renewcommand*{\changes@}[1]{% -% \my@changes#1\@nil +% \my@changes#1.\@nil % }% %\makeatother % \changes{v0.1}{2003/03/25}{First public release} @@ -175,7 +175,7 @@ % \changes{v1.4.4}{2013/02/18}{Label inside familiar footnotes.} % \changes{v1.4.5}{2013/03/02}{Bug with komasscript + eledpar + chapter.} % \changes{v1.4.6}{2013/04/15}{Bug with memoir class introduced by 1.4.5.} -% \changes{v1.4.8}{2013/07/02}{Correct a bug whith parallel texts introduced by 1.1} +% \changes{v1.4.8}{2013/07/02}{Correct a bug with parallel texts introduced by 1.1.} % \hyphenation{man-u-script man-u-scripts} % % \newcommand{\Lpack}[1]{\textsf{#1}} @@ -1243,7 +1243,7 @@ % With \cs{afternumberinfootnote}\oarg{s}\marg{l} you can add some space after the line number in a footnote. If the line number is not printed, the space is not either. The default value is 0.5~em. % %\DescribeMacro{\nonbreakableafternumber}\changes{v1.4.3}{2012/12/18}{Add \cs{nonbreakableafternumber}.} -%By default, the space defined by \cs{afternumberinfootnote} is breakeable. With \cs{afternumberinfootnote}\oarg{s} it becomes non breakable. Use \cs{afternumberinfootnote}\oarg{s}\oarg{false} to cancel it (\verb|<s>| can be empty if you want to disable it for every series). +%By default, the space defined by \cs{afternumberinfootnote} is breakable. With \cs{afternumberinfootnote}\oarg{s} it becomes non breakable. Use \cs{afternumberinfootnote}\oarg{s}\oarg{false} to cancel it (\verb|<s>| can be empty if you want to disable it for every series). % % \DescribeMacro{\beforesymlinenum} % With \cs{beforesymlinenum}\oarg{s}\marg{l} you can add some space before the line symbol in a footnote. The default value is value set by \cs{beforenumberinfootnote}. @@ -1570,7 +1570,7 @@ %\setstanzaindents{0,1,0,1,0,1,0,1,0,1,0} % \end{verbatim} % -%If you don't use the \verb+stanzaindentsrepetition+ counter,make sure you have at least one more numerical +%If you don't use the \verb+stanzaindentsrepetition+ counter, make sure you have at least one more numerical % entry in \verb+\setstanzavalues+ than the number of lines in the stanza. % The macros make no restriction on the number of lines in a stanza. % Stanza indentation values (and penalty values) obey \TeX's grouping @@ -1870,8 +1870,8 @@ % % \DescribeMacro{\rightnoteupfalse} % \DescribeMacro{\leftnoteupfalse} -% By defaut, left and right sidenotes have their \emph{end} at the line they are called. -% If you want they to have their \emph{start} at the line they are called, use \cs{leftnoteupfalse} (for left note) and/or \cs{rightnoteupfalse} (for right note). +% By default, Sidenotes are placed to align with the last line of the note to which it refers. +% If you want they to be placed to align with the first line of the note to which it refers, use \cs{leftnoteupfalse} (for left note) and/or \cs{rightnoteupfalse} (for right note). % % \DescribeMacro{\ledlsnotesep} % \DescribeMacro{\ledrsnotesep} @@ -1962,11 +1962,19 @@ % that \meta{item} and the current page \& linenumber should be added to % the raw index file. % -% If the \Lclass{memoir} class is used then the macro takes an optional +% If the \Lclass{memoir} class or the \Lpack{imakeidx} package is used then the macro takes an optional % argument, which is the name of a raw index file. For example % |\edindex[line]{item}| will use |line.idx| as the raw file instead of % |\jobname.idx|. % +% The minimal version of \Lpack{imakeidx} package to be used is the version 1.3a uploaded on CTAN on 2013/07/11. +% +% Be careful with the order of package loading and index declaration. You must use this order: +% \begin{enumerate} +% \item Load \Lpack{imakeidx}. +% \item Load \Lpack{eledmac}. +% \item Declare the index with the macro \cs{makeindex} of \Lpack{imakeidx}. +% \end{enumerate} % \DescribeMacro{\pagelinesep} % The page \& linenumber combination is written as |page\pagelinesep line|, % where the default definition is |\newcommand{\pagelinesep}{-}| so that @@ -2423,6 +2431,9 @@ % changes many LaTeX internals and \Lpack{eledmac} does things that are % not normally seen in LaTeX. % +% If you want to use the option \emph{bottom} of the \Lpack{footmisc} package, +% you must load this package \emph{before} the \Eledmac\ package. +% % \DescribeMacro{\morenoexpands} % You can define the macro \cs{morenoexpands} to modify macros that you % call within \cs{edtext}. Because of the way \Eledmac{} numbers the lines @@ -2666,10 +2677,10 @@ % \begin{macrocode} %<*code> \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{eledmac}[2013/07/10 v1.4.9 LaTeX port of EDMAC] +\ProvidesPackage{eledmac}[2013/07/11 v1.5 LaTeX port of EDMAC] % \end{macrocode} % -% In general there is the following modifications to the original +% Generally, these are the modifications to the original. % \edmac{} code: % \begin{itemize} % \item Replace as many \cs{def}'s by \cs{newcommand}'s as possible @@ -2713,13 +2724,14 @@ % \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 starred versions/a starred version, 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. % \changes{v1.4}{2012/11/16}{Compatibility with LuaTeX of RTL notes.} % \begin{macrocode} \RequirePackage{xargs} \RequirePackage{etoolbox} \reserveinserts{32} \RequirePackage{suffix} +\RequirePackage{xstring} \RequirePackage{ifluatex} % \end{macrocode} % \begin{macro}{\if@RTL} @@ -2781,6 +2793,13 @@ % \end{macro} % % +% \begin{macro}{\ifl@imakeidx} +% Define a flag for if the \Lpack{imakeidx} package has been used. +% \begin{macrocode} +\newif\ifl@imakeidx +\@ifpackageloaded{imakeidx}{\l@imakeidxtrue}{\l@imakeidxfalse} +% \end{macrocode} +% \end{macro} % \subsection{Messages} % % All the messages are grouped here as macros. This saves TeX's memory @@ -3150,7 +3169,7 @@ % \changes{v1.4.7}{2012/06/07}{Compatibility of sectionning commands with \cs{autopar}.} % \cs{initnumbering@sectcmd} defines sectioning commands inside numbered section. % It also defines quotation environment. -% Note that it's suppose user didn't change \cs{chapter}. +% Note: this supposes that the user didn't change \cs{chapter}. % If he did, he should redefine \cs{initnumbering@sectcmd}. % \begin{macrocode} \newcommand{\initnumbering@sectcmd}{ @@ -5643,7 +5662,7 @@ \fi \affixline@num \affixpstart@num - \hb@xt@ \linewidth{\inserthangingsymbol\l@dld@ta\add@inserts\affixside@note + \hb@xt@ \linewidth{\do@insidelinehook\inserthangingsymbol\l@dld@ta\add@inserts\affixside@note \l@dlsn@te {\ledllfill\hb@xt@ \wd\one@line{\new@line\l@dunhbox@line{\one@line}}\ledrlfill\l@drd@ta% \l@drsn@te @@ -5653,12 +5672,17 @@ % \end{macro} % % \begin{macro}{\do@linehook} -% A hook into \cs{do@line}. +% \begin{macro}{\do@insidelinehook} +% Two hooks into \cs{do@line}. The first is called at the begining of \cs{do@line}, the secund is called in the line box. +% The secund can, for example, have a \cs{markboth} command inside, the first can't. % \changes{v0.7}{2005/02/18}{Added \cs{do@linehook} for use in \cs{do@line}} +% \changes{v1.5}{2013/07/11}{Added \cs{do@insidelinehook} for use in \cs{do@line}} % \begin{macrocode} \newcommand*{\do@linehook}{} +\newcommand*{\do@insidelinehook}{} % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}{\l@demptyd@ta} % \begin{macro}{\l@dld@ta} @@ -7715,9 +7739,9 @@ % % \section{Familiar footnotes} % % \subsection{Generality} -% The original \edmac{} provided the five series of critical footnotes, +% The original \edmac{} provided users with five series of critical footnotes (\cs{Afootnote} \cs{Bfootnote} \cs{Cfootnote} \cs{Dfootnote} \cs{Efootnote}), % and LaTeX provides a single numbered footnote. The \Eledmac{} package -% uses the \edmac{} mechanism to provide a few series of numbered footnotes. +% uses the \edmac{} mechanism to provide five series of numbered footnotes. % % First, though, the \Lpack{footmisc} package has an option whereby % two or more consecutive \cs{footnote}s have their marks separated @@ -7825,7 +7849,7 @@ % \verb?\vl@dbfnote? calls the original \verb?\@footnotetext?. % \changes{v0.6}{2004/11/23}{Changed \cs{l@dbfnote} and \cs{vl@dbfnote} as % originals could give incorrect markers in the footnotes} -% \changes{v1.4.1}{2012/11/16}{Compatibility of standard footnotes with eledmac when theses footnotes contain any commands.} +% \changes{v1.4.1}{2012/11/16}{Compatibility of standard footnotes with eledmac when these footnotes contain any commands.} % \begin{macrocode} \newcommand{\l@dbfnote}[1]{% \ifnumberedpar@ @@ -8537,7 +8561,8 @@ {}% {\footnotelang@poly[R]}% \footnoteoptions@[R]{##1}{true}% - \xright@appenditem{\noexpand\csuse{v#1footnote}{#1}% + \xright@appenditem{\noexpand\prepare@edindex@fornote{\l@d@nums}% +\noexpand\csuse{v#1footnote}{#1}% {{\l@d@nums}{\csexpandonce{@tag}}{\csexpandonce{content}}}}\to\inserts@listR \footnoteoptions@[R]{##1}{false}% \global\advance\insert@countR \@ne% @@ -8549,7 +8574,8 @@ {}% {\footnotelang@poly}% \footnoteoptions@{##1}{true}% - \xright@appenditem{\noexpand\csuse{v#1footnote}{#1}% + \xright@appenditem{\noexpand\prepare@edindex@fornote{\l@d@nums}% +\noexpand\csuse{v#1footnote}{#1}% {{\l@d@nums}{\csexpandonce{@tag}}{\csexpandonce{content}}}}\to\inserts@list \global\advance\insert@count \@ne% \footnoteoptions@{##1}{false}% @@ -9088,7 +9114,13 @@ % \end{macrocode} % \end{macro} -% +% \begin{macro}{\ifFN@bottom} +% \changes{v1.5}{2013/07/11}{Use the bottom option of \Lpack{footmisc} package.} +% The \cs{ifFN@bottom} macro is defined by the \Lpack{footmisc} package. If this package is not loaded, we define it. +% \begin{macrocode} +\AtBeginDocument{\@ifpackageloaded{footmisc}{}{\newif\ifFN@bottom}} +% \end{macrocode} +% \end{macro} % \begin{macro}{\l@ddofootinsert} % This macro essentially holds the initial portion of the kernel % \cs{@makecol} code. @@ -9104,7 +9136,7 @@ \boxmaxdepth \@maxdepth \@tempdima\dp\@cclv \unvbox \@cclv - \vskip \skip\footins + \ifFN@bottom\vfill\fi\vskip \skip\footins%%% If the option bottom of loadmisc package is loaded \color@begingroup \normalcolor \footnoterule @@ -10333,6 +10365,7 @@ % % \section{Indexing} % +% \changes{v1.5}{2013/07/11}{Correct indexing when the call is made in critical notes.} % Here's some code for indexing using page \& line numbers. % % \begin{macro}{\pagelinesep} @@ -10365,10 +10398,52 @@ % \begin{macrocode} \newcommand{\thepageline}{% \thepage\pagelinesep\lineref{\edindexlab\thelabidx}} - % \end{macrocode} % \end{macro} +% +% \begin{macro}{\thestartpageline} +% \begin{macro}{\theendpageline} +% These macros make up the page/line start/end number when the \cs{edindex} command is call in critical notes. +% \begin{macrocode} +\newcommand{\thestartpageline}{\l@dparsedstartpage\pagelinesep\l@dparsedstartline} +\newcommand{\theendpageline}{\l@dparsedendpage\pagelinesep\l@dparsedendline} +% \end{macrocode} +% \end{macro} +% \end{macro} % +% \begin{macro}{\if@edindex@fornote@true} +% This boolean test is switching at the begining of each critical note, +% to allow indexing in this note. +% \begin{macrocode} +\newif\if@edindex@fornote@ +% \end{macrocode} +% \end{macro} +% \begin{macro}{\prepare@edindex@fornote} +% This macro is called at the begining of each critical note. +% It switches some parameters, +% to allow indexing in this note, with reference to page and line number. +% \begin{macrocode} +\newcommand{\prepare@edindex@fornote}[1]{% + \l@dp@rsefootspec#1|% + \@edindex@fornote@true +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\get@index@command} +% This macro is used to analyse if a text to be indexed have a command after an \verb+|+. +% \begin{macrocode} +\def\get@index@command#1|#2{\gdef\@index@command{#2}\gdef\@index@txt{#1}} +% \end{macro} +% \end{macrocode} +% \begin{macro}{\ledinnote} +% \begin{macro}{\ledinnotehyperpage} +% These macros are used to precise that an index reference point to a note. +% \begin{macrocode} +\newcommand{\ledinnote}[2]{\csuse{#1}{#2\emph{n}}} +\newcommand{\ledinnotehyperpage}[2]{\csuse{#1}{\hyperpage{#2}\emph{n}}} +% \end{macrocode} +% \end{macro} +% \end{macro} % The \Lpack{memoir} class provides more flexible indexing than the % standard classes. We need different code if the \Lpack{memoir} % class is being used. @@ -10381,6 +10456,7 @@ % % \begin{macro}{\makeindex} % \begin{macro}{\edindex} +% \changes{v1.5}{2013/07/11}{Compatibility with \Lpack{imakeidx} package, and possibility to use multiple index with \cs{edindex}.} % Need to add the definition of |\edindex| to |\makeindex|, and initialise % |\edindex| to do nothing. In this case |\edindex| has an optional % argument. We use the hook provided in \Lpack{memoir} v1.61. @@ -10424,16 +10500,37 @@ \def\l@d@@wrindexhyp#1|#2|#3\\{% \ifshowindexmark\@showidx{#1}\fi \ifx\\#2\\% - \protected@write\@auxout{}% - {\string\@@wrindexm@m{\@idxfile}{#1|hyperpage}{\thepageline}}% + \if@edindex@fornote@% + \protected@write\@auxout{}% + {\string\@@wrindexm@m{\@idxfile}{#1|(ledinnotehyperpage}{\thestartpageline}}% + \protected@write\@auxout{}% + {\string\@@wrindexm@m{\@idxfile}{#1|)ledinnotehyperpage}{\theendpageline}}% + \else% + \protected@write\@auxout{}% + {\string\@@wrindexm@m{\@idxfile}{#1|hyperpage}{\thepageline}}% + \fi% \else \def\Hy@temp@A{#2}% \ifx\Hy@temp@A\HyInd@ParenLeft - \protected@write\@auxout{}% - {\string\@@wrindexm@m{\@idxfile}{#1|#2hyperpage}{\thepageline}}% + \if@edindex@fornote@% + \protected@write\@auxout{}% + {\string\@@wrindexm@m{\@idxfile}{#1|(ledinnotehyperpage{#2}}{\thestartpageline}}% + \protected@write\@auxout{}% + {\string\@@wrindexm@m{\@idxfile}{#1|)ledinnotehyperpage{#2}}{\theendpageline}}% + \else% + \protected@write\@auxout{}% + {\string\@@wrindexm@m{\@idxfile}{#1|#2hyperpage}{\thepageline}}% + \fi% \else - \protected@write\@auxout{}% - {\string\@@wrindexm@m{\@idxfile}{#1|#2}{\thepageline}}% + \if@edindex@fornote@% + \protected@write\@auxout{}% + {\string\@@wrindexm@m{\@idxfile}{#1|(ledinnote{#2}}{\thestartpageline}}% + \protected@write\@auxout{}% + {\string\@@wrindexm@m{\@idxfile}{#1|)ledinnote{#2}}{\theendpageline}}% + \else% + \protected@write\@auxout{}% + {\string\@@wrindexm@m{\@idxfile}{#1|#2}{\thepageline}}% + \fi% \fi \fi \endgroup @@ -10453,12 +10550,12 @@ % Need to add the definition of |\edindex| to |\makeindex|, and initialise % |\edindex| to do nothing. % \begin{macrocode} - \g@addto@macro{\makeindex}{% + \pretocmd{\makeindex}{% \def\edindex{\@bsphack \doedindexlabel \begingroup \@sanitize - \@wredindex}} + \@wredindex}}{}{} \newcommand{\edindex}[1]{\@bsphack\@esphack} % \end{macrocode} % \end{macro} @@ -10467,9 +10564,30 @@ % \begin{macro}{\@wredindex} % Write the index information to the \file{idx} file. % \begin{macrocode} - \newcommand{\@wredindex}[1]{% - \protected@write\@indexfile{}% - {\string\indexentry{#1}{\thepageline}}% + \newcommandx{\@wredindex}[2][1=\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|}% + \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}% + \fi% + \else% + \if@edindex@fornote@% + \IfSubStr[1]{#2}{|}{\get@index@command#2}{\get@index@command#2|}% + \expandafter\protected@write\@indexfile{}% + {\string\indexentry{\@index@txt|(ledinnote{\@index@command}}{\thestartpageline} + }% + \expandafter\protected@write\@indexfile{}% + {\string\indexentry{\@index@txt|)ledinnote{\@index@command}}{\theendpageline} + }% + \else% + \protected@write\@indexfile{}% + {\string\indexentry{#2}{\thepageline} + }% + \fi% + \fi% \endgroup \@esphack} % \end{macrocode} @@ -10488,11 +10606,20 @@ \AtBeginDocument{\@ifpackageloaded{hyperref}{}{% \def\l@d@@wrindexhyp#1||\\{% \ifshowindexmark\@showidx{#1}\fi - \protected@write\@auxout{}% - {\string\@@wrindexm@m{\@idxfile}{#1}{\thepageline}}% + \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}}% + \protected@write\@auxout{}% + {\string\@@wrindexm@m{\@idxfile}{\@index@txt|)ledinnote{\@index@command}}{\theendpageline}}% + \else% + \protected@write\@auxout{}% + {\string\@@wrindexm@m{\@idxfile}{#1}{\thepageline}}% + \fi% \endgroup \@esphack}}} + % \end{macrocode} % \end{macro} % |