| 1 |
%\iffalse meta-comment |
| 2 |
% |
| 3 |
% Copyright (C) 2012 by Maïeul Rouquette |
| 4 |
% |
| 5 |
% This file may be distributed and/or modified under the |
| 6 |
% conditions of the LaTeX Project Public License, either |
| 7 |
% version 1.3 of this license or (at your option) any later |
| 8 |
% version. The latest version of this license is in: |
| 9 |
% |
| 10 |
% http://www.latex-project.org/lppl.txt |
| 11 |
% |
| 12 |
% and version 1.3 or later is part of all distributions of |
| 13 |
% LaTeX version 2003/06/01 or later. |
| 14 |
% This work has the LPPL maintenance status "unmaintained". |
| 15 |
% |
| 16 |
% \fi |
| 17 |
|
| 18 |
% \iffalse |
| 19 |
%<*driver> |
| 20 |
\documentclass{ltxdoc} |
| 21 |
\usepackage{polyglossia,csquotes} |
| 22 |
\setmainlanguage{english} |
| 23 |
\usepackage[noreledmac]{eledmac} |
| 24 |
\usepackage{eledform,tikz,tikz-qtree} |
| 25 |
\usepackage{hyperref} |
| 26 |
\EnableCrossrefs |
| 27 |
\CodelineIndex |
| 28 |
\RecordChanges |
| 29 |
\begin{document} |
| 30 |
\DocInput{eledform.dtx} |
| 31 |
\end{document} |
| 32 |
%</driver> |
| 33 |
% \fi |
| 34 |
% \CheckSum{106} |
| 35 |
% \CharacterTable |
| 36 |
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
| 37 |
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z |
| 38 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 39 |
% Exclamation \! Double quote \" Hash (number) \# |
| 40 |
% Dollar \$ Percent \% Ampersand \& |
| 41 |
% Acute accent \' Left paren \( Right paren \) |
| 42 |
% Asterisk \* Plus \+ Comma \, |
| 43 |
% Minus \- Point \. Solidus \/ |
| 44 |
% Colon \: Semicolon \; Less than \< |
| 45 |
% Equals \= Greater than \> Question mark \? |
| 46 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 47 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 48 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 49 |
% Right brace \} Tilde \~} |
| 50 |
% |
| 51 |
% \changes{v1.0}{2012/10/01}{First public release.} |
| 52 |
% \changes{v1.1}{2012/10/08}{News options to change the order of the elements.} |
| 53 |
% \changes{v1.1a}{2015/13/08}{Package unmaintened.} |
| 54 |
% \GetFileInfo{eledform.sty} |
| 55 |
%\DoNotIndex{\csgdef,\if,\fi,\else,\listgadd} |
| 56 |
% |
| 57 |
%\title{The eledform extension for eledmac} |
| 58 |
% \author{Maïeul Rouquette \\ maieul at maieul dot net} |
| 59 |
% \date{\fileversion\space\filedate} |
| 60 |
% \maketitle |
| 61 |
% \textbf{This package is unmaintened. |
| 62 |
% Maïeul Rouquette has no more time to maintain it. |
| 63 |
% } |
| 64 |
% \begin{abstract} |
| 65 |
% The \emph{eledmac} package provides tools to make critical editions of texts. |
| 66 |
% But it doesn't provide any formalism to note the textual variants: each user has to make his own formalism. |
| 67 |
% This package tries to provide a formalism |
| 68 |
% which distinguishes between the \emph{formal} notation of textual variants and their typographical notation\footnote{The original idea of this package is described at \url{http://geekographie.maieul.net/Formaliser-les-variantes}. You can suggest new features or report bugs at \url{https://github.com/maieul/eledform/issues}.}. |
| 69 |
% \end{abstract} |
| 70 |
% \tableofcontents |
| 71 |
% \section{Use} |
| 72 |
% \subsection{One Example} |
| 73 |
% \subsubsection{Without formalism} |
| 74 |
% Suppose this case : |
| 75 |
% \begin{enumerate} |
| 76 |
% \item One text, with fives manuscripts: P, A, B, C, D. |
| 77 |
% P is the manuscript which is used as reference. |
| 78 |
% Variants in A, B, C, D are shown in the apparatus. |
| 79 |
% \item The pseudo-word \enquote{lorem} has these variants: |
| 80 |
% \begin{description} |
| 81 |
% \item[A and B]the word is omitted. |
| 82 |
% \item[C]the word is replaced by \enquote{loram}. |
| 83 |
% \item[D]the word is replaced by \enquote{lorim}. |
| 84 |
% \end{description} |
| 85 |
% \end{enumerate} |
| 86 |
% Without formalism, you could write: |
| 87 |
% \begin{verbatim} |
| 88 |
% \edtext{lorem}{\Afootnote{AB \emph{omit}; C loram; D lorim}} |
| 89 |
% \end{verbatim} |
| 90 |
% Which produces this critical note: |
| 91 |
% \begin{quote} |
| 92 |
% lorem] AB omit; C loram; D lorim |
| 93 |
% \end{quote} |
| 94 |
% There are some limits for this method: |
| 95 |
% \begin{itemize} |
| 96 |
% \item If we want to change display, we must changes all notes. |
| 97 |
% \item We can't produce statistics. |
| 98 |
% \item Difficulty to export in other format than \LaTeX. |
| 99 |
% \item No method to check if we're making mistakes regarding to the manuscripts. |
| 100 |
% \end{itemize} |
| 101 |
% \subsubsection{With formalism} |
| 102 |
% To describe the same situation, we propose this formalism : |
| 103 |
% \begin{verbatim} |
| 104 |
%\var{lorem}{A,B}{ |
| 105 |
%{{C}{loram}}, |
| 106 |
%{{D}{lorim}} |
| 107 |
%} |
| 108 |
% \end{verbatim} |
| 109 |
% With \emph{eledform}, this will produce the same result as the non-formalised form, |
| 110 |
% but without the described inconveniences. |
| 111 |
% You can see an example in the file \href{example.tex}{example.tex}, which produces \href{example.pdf}{example.pdf}. |
| 112 |
% \subsection{References} |
| 113 |
% \subsubsection{Declare the manuscripts} |
| 114 |
% \DescribeMacro{\manuscripts} |
| 115 |
% You have to use \cs{Manuscripts}\marg{list} |
| 116 |
% to provide the list of manuscripts used in the apparatus. |
| 117 |
% \LaTeX\ prints a warning message in the log file if you're referring to a |
| 118 |
% manuscript that is not declared before. |
| 119 |
% It also prints an error in the resulting file. |
| 120 |
% The list of manuscripts is a comma separated list: |
| 121 |
% \begin{verbatim} |
| 122 |
% \manuscripts{A,B,C,D} |
| 123 |
% \end{verbatim} |
| 124 |
% \subsubsection{Declare variants} |
| 125 |
% \DescribeMacro{\var} |
| 126 |
% The main macro is \cs{var}\oarg{short}\marg{lemma}\marg{del}\marg{variants}\oarg{other}. |
| 127 |
% This macro takes five arguments, two are optional. |
| 128 |
% \begin{description} |
| 129 |
% \item[\meta{short} (optional)]an abbreviated version of the lemma for the notes. |
| 130 |
% \item[\meta{lemma}]the lemma which has variants. |
| 131 |
% \item[\meta{del}]a comma separated list of manuscripts where the lemma is ommited. |
| 132 |
% \item[\meta{variants}]a comma separated list of variants. Each variant has the form \verb+{+\marg{manuscripts}\marg{variant}\verb+}+, where: |
| 133 |
% \begin{description} |
| 134 |
% \item[\meta{manuscripts}]a comma separated list of manuscripts where the variant is. |
| 135 |
% \item[\meta{variant}]the variant itself. |
| 136 |
% \end{description} |
| 137 |
% \item[\meta{other}(optional)]other code linked to the lemma, for example a call to an critical footnote. |
| 138 |
% \end{description} |
| 139 |
% \subsubsection{Customize} |
| 140 |
% \DescribeMacro{\manposition} |
| 141 |
% By default (since v1.1), the manuscripts are printed after the variant. |
| 142 |
% With \cs{manposition}\marg{position}, where position is any text except \verb+last+, you can change it. |
| 143 |
% |
| 144 |
% \DescribeMacro{\omitposition} |
| 145 |
% By default, the omission are printed at the begining of the variants. |
| 146 |
% With \cs{omitposition}\marg{position}, where position is any text except \verb+first+, you can change it. |
| 147 |
% |
| 148 |
% \DescribeMacro{\varseries} |
| 149 |
% By default, the notes for textual variants are printed in the A series of footnotes. |
| 150 |
% With \cs{varseries}\marg{letter}, you can change it. |
| 151 |
% |
| 152 |
% \DescribeMacro{\omittext} |
| 153 |
% When a manuscript omits a lemma, \emph{eledform} prints \verb|\emph{omit}|. |
| 154 |
% You can change it with \cs{omittext}\marg{text}. |
| 155 |
% |
| 156 |
% \DescribeMacro{\manvarseparator} |
| 157 |
% By default, a non breakable space is printed between the manuscript letter and the variant. |
| 158 |
% You can change it with \cs{manvarseparator}\marg{separator}. |
| 159 |
% |
| 160 |
% \DescribeMacro{\varseparator} |
| 161 |
% By default, a breakable space is printed between each variant of a lemma. |
| 162 |
% You can change it with \cs{varseparator}\marg{separator}. |
| 163 |
%\StopEventually{\PrintChanges} |
| 164 |
% \section{Implementation} |
| 165 |
% \begin{macrocode} |
| 166 |
\NeedsTeXFormat{LaTeX2e} |
| 167 |
\ProvidesPackage{eledform}[2015/08/13 v1.1a formalism for eledmac] |
| 168 |
\RequirePackage{eledmac} |
| 169 |
% \end{macrocode} |
| 170 |
% \subsection{Define manuscripts} |
| 171 |
% \begin{macro}{\manuscripts@} |
| 172 |
% The \cs{manuscripts@} macro is an etoolbox list. |
| 173 |
% \begin{macrocode} |
| 174 |
\def\manuscripts@{} |
| 175 |
% \end{macrocode} |
| 176 |
% \end{macro} |
| 177 |
% \begin{macro}{\manuscripts} |
| 178 |
% The \cs{manuscripts} macro only fills the \cs{manuscripts} macro. |
| 179 |
% \begin{macrocode} |
| 180 |
\newcommand{\manuscript}[1]{% |
| 181 |
\renewcommand{\do}[1]{\listgadd{\manuscripts@}{##1}}% |
| 182 |
\docsvlist{#1}% |
| 183 |
} |
| 184 |
% \end{macrocode} |
| 185 |
% \end{macro} |
| 186 |
% \subsection{Print the critical notes} |
| 187 |
% \begin{macro}{\var} |
| 188 |
% The \cs{var} macro is the only public macro, which calls all private macros. |
| 189 |
% \begin{macrocode} |
| 190 |
\newcommandx*{\var}[5][1,5,usedefault]{% |
| 191 |
% \end{macrocode} |
| 192 |
% First, call the \cs{edtext} macro. |
| 193 |
% \begin{macrocode} |
| 194 |
\edtext{#2}{% |
| 195 |
% \end{macrocode} |
| 196 |
% If the \cs{var} macro is called with the optional first argument, |
| 197 |
% we put it into the \cs{lemma} macro. |
| 198 |
% \begin{macrocode} |
| 199 |
\ifstrempty{#1}{}{\lemma{#1}}% |
| 200 |
% \end{macrocode} |
| 201 |
% The \cs{varnote@} macro is an Xfootnote macro defined by user, with the \cs{varnote} macro (cf.~\pageref{varnote}). |
| 202 |
% \begin{macrocode} |
| 203 |
\varnote@{% |
| 204 |
% \end{macrocode} |
| 205 |
% In the case where the manuscripts with omission must be printed in first position. |
| 206 |
% \begin{macrocode} |
| 207 |
\ifdefstring{\omitposition@}{first}{ |
| 208 |
% \end{macrocode} |
| 209 |
% If the third argument is not empty, we call the \cs{del@} macro, which print the manuscript where the lemma is omitted |
| 210 |
% \begin{macrocode} |
| 211 |
\ifstrempty{#3}{}% |
| 212 |
{\del@{#3}% |
| 213 |
% \end{macrocode} |
| 214 |
% If the third and fourth argument are both not empty, we print the separator between variants. |
| 215 |
% \begin{macrocode} |
| 216 |
\ifstrempty{#4}% |
| 217 |
{}% |
| 218 |
{\varseparator@}% |
| 219 |
}% |
| 220 |
% \end{macrocode} |
| 221 |
% And so, we print all the variants which are not an omission. |
| 222 |
% \begin{macrocode} |
| 223 |
\var@{#4}% |
| 224 |
% \end{macrocode} |
| 225 |
% The same thing, but if the manuscripts with omission must be printed in last position. |
| 226 |
% \begin{macrocode} |
| 227 |
}% |
| 228 |
{% |
| 229 |
\ifstrempty{#4}% |
| 230 |
{}% |
| 231 |
{\var@{#4}% |
| 232 |
\ifstrempty{#3}% |
| 233 |
{}% |
| 234 |
{\varseparator@}% |
| 235 |
}% |
| 236 |
\ifstrempty{#3}{}{\del@{#3}}% |
| 237 |
}% |
| 238 |
}% |
| 239 |
% \end{macrocode} |
| 240 |
% Eventually, we add the critical notes which are not for textual criticism. |
| 241 |
% \begin{macrocode} |
| 242 |
#5% |
| 243 |
}% |
| 244 |
} |
| 245 |
% \end{macrocode} |
| 246 |
% \end{macro} |
| 247 |
% \begin{macro}{\print@manuscript} |
| 248 |
% The \cs{print@manuscripts} command only prints the manuscripts where a variant exists. |
| 249 |
% \begin{macrocode} |
| 250 |
\newcommand{\print@manuscript}[1]{% |
| 251 |
\ifinlist{#1}{\manuscripts@}% |
| 252 |
{#1}% |
| 253 |
{\eledmac@warning{Manuscript #1 not declared, p.\the\page@num ; l.\the\line@num}\underline{Manuscript #1 not declared!}}% |
| 254 |
} |
| 255 |
% \end{macrocode} |
| 256 |
% \end{macro} |
| 257 |
% \begin{macro}{\del@} |
| 258 |
% The \cs{del@} macro prints the manuscripts where the lemma is omitted, |
| 259 |
% and after that, the text to indicate this omission. |
| 260 |
% \begin{macrocode} |
| 261 |
\newcommand{\del@}[1]{% |
| 262 |
\renewcommand{\do}[1]{% |
| 263 |
\print@manuscript{##1}% |
| 264 |
}% |
| 265 |
\ifdefstring{\manposition@}{last}% |
| 266 |
{\omittext@\manvarseparator@\docsvlist{#1}}% |
| 267 |
{\docsvlist{#1}\manvarseparator@\omittext@}% |
| 268 |
} |
| 269 |
% \end{macrocode} |
| 270 |
% \end{macro} |
| 271 |
% \begin{macro}{\var@} |
| 272 |
% The \cs{var@} macro loops on the non omission variants. |
| 273 |
% Except for the first variant, it prints the variant separator. |
| 274 |
% \begin{macrocode} |
| 275 |
\newcommand{\var@}[1]{% |
| 276 |
\newif\iffirst% |
| 277 |
\firsttrue% |
| 278 |
\renewcommand{\do}[1]{\iffirst\firstfalse\else\varseparator@\fi{\var@@##1}}% |
| 279 |
\docsvlist{#1}% |
| 280 |
} |
| 281 |
% \end{macrocode} |
| 282 |
% \end{macro} |
| 283 |
% \begin{macro}{\var@@} |
| 284 |
% The \cs{var@@} macro prints manuscripts for a singular variant |
| 285 |
% and this variant after that. |
| 286 |
% \begin{macrocode} |
| 287 |
\newcommand{\var@@}[2]{% |
| 288 |
\renewcommand{\do}[1]{% |
| 289 |
\print@manuscript{##1}% |
| 290 |
}% |
| 291 |
\ifdefstring{\manposition@}{last}% |
| 292 |
{#2\manvarseparator@\docsvlist{#1}}% |
| 293 |
{\docsvlist{#1}\manvarseparator@#2}% |
| 294 |
} |
| 295 |
% \end{macrocode} |
| 296 |
% \end{macro} |
| 297 |
% \subsection{Customization} |
| 298 |
% \subsubsection{The footnote series} |
| 299 |
% \begin{macro}{\varnote@}\label{varnote} |
| 300 |
% The \cs{varnote@} macro is only a reference to a critical footnote macro of eledmac. |
| 301 |
% The default is \cs{Afootnote}. |
| 302 |
% \begin{macrocode} |
| 303 |
\let\varnote@\Afootnote |
| 304 |
% \end{macrocode} |
| 305 |
% \end{macro} |
| 306 |
% \begin{macro}{\varseries} |
| 307 |
% The \cs{varseries} macro redefines this reference. |
| 308 |
% \begin{macrocode} |
| 309 |
\newcommand{\varseries}[1]{\letcs{\varnote@}{#1footnote}} |
| 310 |
% \end{macrocode} |
| 311 |
% \end{macro} |
| 312 |
% \subsubsection{Display options} |
| 313 |
% \begin{macro}{\new@eledform@custom} |
| 314 |
% The \cs{new@eledform@custom} macro has two actions : |
| 315 |
% \begin{enumerate} |
| 316 |
% \item Define the default value of an option (\cs{option@}). |
| 317 |
% \item Create the command which modifies this option (\cs{option}). |
| 318 |
% \end{enumerate} |
| 319 |
% \begin{macrocode} |
| 320 |
\newcommand{\new@eledform@custom}[2]{% |
| 321 |
\csgdef{#1@}{#2}% |
| 322 |
\expandafter\newcommand\csname#1\endcsname[1]{\csgdef{#1@}{##1}}% |
| 323 |
} |
| 324 |
% \end{macrocode} |
| 325 |
% \end{macro} |
| 326 |
% And so, we can call \cs{new@eledform@custom} to define options for user. |
| 327 |
% \begin{macro}{\omittext} |
| 328 |
% \begin{macro}{\manvarseparator} |
| 329 |
% \begin{macro}{\varseparator} |
| 330 |
% \begin{macro}{\manposition} |
| 331 |
% \begin{macro}{\omitposition} |
| 332 |
% \begin{macrocode} |
| 333 |
\new@eledform@custom{omitposition}{first} |
| 334 |
\new@eledform@custom{manposition}{last} |
| 335 |
\new@eledform@custom{omittext}{\emph{omit}} |
| 336 |
\new@eledform@custom{manvarseparator}{~} |
| 337 |
\new@eledform@custom{varseparator}{\space} |
| 338 |
% \end{macrocode} |
| 339 |
% \end{macro} |
| 340 |
% \end{macro} |
| 341 |
% \end{macro} |
| 342 |
% \end{macro} |
| 343 |
% \end{macro} |
| 344 |
% \subsection{Stemma of the code} |
| 345 |
% The next figure is a stemma of the code. |
| 346 |
% |
| 347 |
% \hspace{-3cm}\noindent\input{include/stemma} |
| 348 |
% \newpage |
| 349 |
% \addcontentsline{toc}{section}{Changes} |
| 350 |
% \PrintChanges |
| 351 |
% \addcontentsline{toc}{section}{Index} |
| 352 |
% \PrintIndex |
| 353 |
% \Finale |
| 354 |
\endinput |