aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2022-04-20 09:26:44 +0200
committerRobert Alessi <alessi@robertalessi.net>2022-04-20 09:26:44 +0200
commit792c43808b2ced93e83dbc1f8779593cf60e2f7c (patch)
tree22dfffcdd3be21fabacd54312af55896ca50162b
parent5db66a13df4995b41789d570773db13caa62ab27 (diff)
downloadekdosis-792c43808b2ced93e83dbc1f8779593cf60e2f7c.tar.gz
\ekdmark needed more work for "paired" facing pages. new command \ekdEOprint
-rw-r--r--ekdosis.dtx142
-rw-r--r--ekdosis.el4
2 files changed, 129 insertions, 17 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx
index 91e2452..5faf7fa 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -61,7 +61,7 @@ along with this program. If not, see
61%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] 61%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
62%<package>\ProvidesPackage{ekdosis} 62%<package>\ProvidesPackage{ekdosis}
63%<*package> 63%<*package>
64 [2022/01/17 v1.5-dev Typesetting TEI xml-compliant critical editions] 64 [2022/04/20 v1.5-dev Typesetting TEI xml-compliant critical editions]
65%</package> 65%</package>
66%<*driver> 66%<*driver>
67\begin{filecontents}[noheader,overwrite]{bibdata.xml} 67\begin{filecontents}[noheader,overwrite]{bibdata.xml}
@@ -3321,13 +3321,16 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+
3321% \underLine{semicolon}-separated list of previously defined 3321% \underLine{semicolon}-separated list of previously defined
3322% environments that shall receive at least one layer of apparatus 3322% environments that shall receive at least one layer of apparatus
3323% criticus.\\ 3323% criticus.\\
3324% \DescribeOption{paired} |paired|$=$\verb+true|false+% 3324% \DescribeOption{paired} |paired|$=$\verb+true|false+%^^A
3325% \phts\label{ref:paired-opt}%^^A
3325% \hfill\tcboxverb{Default: true (initially not set)}\\ 3326% \hfill\tcboxverb{Default: true (initially not set)}\\
3326% This named argument does not need a value as it defaults to |true| 3327% This named argument does not need a value as it defaults to |true|
3327% if used. By default, \pkg{ekdosis} follows the \LaTeX{} page 3328% if used. By default, \pkg{ekdosis} follows the \LaTeX{} page
3328% numbering scheme when multiple texts are arranged on facing 3329% numbering scheme when multiple texts are arranged on facing
3329% pages. The |paired| option leaves every right-hand page number 3330% pages. The |paired| option leaves every right-hand page number
3330% unchanged, so that both facing pages hold the same page number.\\ 3331% unchanged, so that both facing pages hold the same page
3332% number.\footnote{For setting headers and footers in this arrangement
3333% of text, see \vpageref{sec:header-paired-pages}.}\\
3331% \DescribeOption{lineation} |lineation|$=$\verb+page|document+ 3334% \DescribeOption{lineation} |lineation|$=$\verb+page|document+
3332% \hfill\tcboxverb{Default: document}\\ 3335% \hfill\tcboxverb{Default: document}\\
3333% This option applies to edition texts initially set to receive an 3336% This option applies to edition texts initially set to receive an
@@ -5904,6 +5907,50 @@ subtype="arabtex">'inna 'abI kAna mina
5904%</example> 5907%</example>
5905% \fi 5908% \fi
5906% 5909%
5910% \paragraph{\enquote{Paired} facing pages}
5911% \phts\label{sec:header-paired-pages}
5912% As already described \vpageref{ref:paired-opt}\===the
5913% \textooquote|paired|\textcoquote\ option\===\pkg{ekdosis} can
5914% arrange texts on facing pages with every right-hand page number
5915% unchanged, so that both facing pages hold the same number, as in the
5916% \enquote{Budé} series. As a result of this layout, the distinction
5917% between left- and right-hand pages does not apply and headers and
5918% footers have to be set as if the whole edition text and the
5919% translation were intended for single-sided printing. To return to
5920% the example just given, the three optional arguments of \cs{sethead}
5921% are inoperative, as are the symbolic letters |E| and |O| of
5922% \cs{ekdprintmark}. Both letters must be omitted, which boils down to
5923% using the following six selectors, instead of twelve: |HL|, |HC|,
5924% |HR|, |FL|, |FC| and |FR|.
5925%
5926% \DescribeMacro{\ekdEOprint}\newfeature[v1.5] Finally, to make up for
5927% commands and arguments designed to set headers and footers on
5928% left-hand pages, \pkg{ekdosis} provides \cs{ekdEOprint}. This
5929% command accepts two mandatory, self-evident arguments, like so:
5930% \cs{ekdEOprint}\marg{left-hand mark}\marg{right-hand mark}.
5931%
5932% As an illustration, the example provided above would read as follows
5933% for editions laid out on \enquote{paired} facing pages:---
5934%
5935% \iffalse
5936%<*example>
5937% \fi
5938\begin{minted}[linenos=false]{latex}
5939% Preamble:
5940\usepackage{titleps}
5941\newpagestyle{edition}{
5942 \sethead{\ekdprintmark{HL}{\ekdEOprint{\thepage}{}}}
5943 {\ekdprintmark{HC}{\ekdEOprint{Hippocratis}{%
5944 Epidemiarum liber II, \ekdmark}}}
5945 {\ekdprintmark{HR}{\ekdEOprint{}{\thepage}}}
5946}
5947% Apply the page style:
5948\pagestyle{edition}
5949\end{minted}
5950% \iffalse
5951%</example>
5952% \fi
5953%
5907% \DescribeMacro{\ekdnohfmarks} Once all signposts are marked with 5954% \DescribeMacro{\ekdnohfmarks} Once all signposts are marked with
5908% \cs{ekdprintmark}, \cs{ekdnohfmarks} can be used at any point of the 5955% \cs{ekdprintmark}, \cs{ekdnohfmarks} can be used at any point of the
5909% document with the same effect as the \LaTeX\ standard command 5956% document with the same effect as the \LaTeX\ standard command
@@ -8063,7 +8110,7 @@ Sample text with a \textcolor{red}{word} in red.
8063% \end{macrocode} 8110% \end{macrocode}
8064% \paragraph{\textsf{ekdosis} Symbol} 8111% \paragraph{\textsf{ekdosis} Symbol}
8065% \begin{macro}{\eKd} 8112% \begin{macro}{\eKd}
8066% \changes{v1.5}{2022/01/17}{Prints \textsf{ekdosis} indentifying 8113% \changes{v1.5}{2022/04/20}{Prints \textsf{ekdosis} indentifying
8067% symbol} As of v1.5, \pkg{ekdosis} has its own identifying 8114% symbol} As of v1.5, \pkg{ekdosis} has its own identifying
8068% symbol. It is produced by \cs{eKd} and best printed with the Old 8115% symbol. It is produced by \cs{eKd} and best printed with the Old
8069% Standard Greek font. 8116% Standard Greek font.
@@ -8324,7 +8371,7 @@ Sample text with a \textcolor{red}{word} in red.
8324% \begin{macro}{\teidirectE} 8371% \begin{macro}{\teidirectE}
8325% \changes{v1.3}{2021/08/18}{direct insertion of elements in the 8372% \changes{v1.3}{2021/08/18}{direct insertion of elements in the
8326% \texttt{TEI xml} file} 8373% \texttt{TEI xml} file}
8327% \changes{v1.5}{2022/01/17}{direct insertion of empty elements in the 8374% \changes{v1.5}{2022/04/20}{direct insertion of empty elements in the
8328% \texttt{TEI xml} file} 8375% \texttt{TEI xml} file}
8329% \cs{teidirect}\oarg{xml attributes}\marg{xml element}\marg{code} 8376% \cs{teidirect}\oarg{xml attributes}\marg{xml element}\marg{code}
8330% does nothing in \LaTeX. It is only used to insert elements in the 8377% does nothing in \LaTeX. It is only used to insert elements in the
@@ -8339,7 +8386,7 @@ Sample text with a \textcolor{red}{word} in red.
8339% \end{macro} 8386% \end{macro}
8340% \end{macro} 8387% \end{macro}
8341% \begin{macro}{\getTEIxmlid} 8388% \begin{macro}{\getTEIxmlid}
8342% \changes{v1.5}{2022/01/17}{returns \texttt{TEI xml:ids} from a 8389% \changes{v1.5}{2022/04/20}{returns \texttt{TEI xml:ids} from a
8343% csv-list of ids} This command returns from a csv-list of unique 8390% csv-list of ids} This command returns from a csv-list of unique
8344% identifiers declared in commands such as \cs{DeclareWitness} and the 8391% identifiers declared in commands such as \cs{DeclareWitness} and the
8345% like a space-separated list of their corresponding |xml:id|s, each 8392% like a space-separated list of their corresponding |xml:id|s, each
@@ -9915,7 +9962,7 @@ Sample text with a \textcolor{red}{word} in red.
9915% \end{macro} 9962% \end{macro}
9916% \paragraph{Lacunae} 9963% \paragraph{Lacunae}
9917% \begin{macro}{\ilabel} 9964% \begin{macro}{\ilabel}
9918% \changes{v1.5}{2022/01/17}{recalls and sets the ending label of 9965% \changes{v1.5}{2022/04/20}{recalls and sets the ending label of
9919% lemmas used to mark lacunae in witnesses} When \cs{lem} has been 9966% lemmas used to mark lacunae in witnesses} When \cs{lem} has been
9920% used with the optional argument |ilabel=<label>|, 9967% used with the optional argument |ilabel=<label>|,
9921% \cs{ilabel}\marg{label} must be used to mark the point where the 9968% \cs{ilabel}\marg{label} must be used to mark the point where the
@@ -10159,14 +10206,18 @@ Sample text with a \textcolor{red}{word} in red.
10159% \begin{macro}{\ekdprintmark} 10206% \begin{macro}{\ekdprintmark}
10160% \changes{v1.3}{2021/08/18}{prints or removes the marks in headers 10207% \changes{v1.3}{2021/08/18}{prints or removes the marks in headers
10161% and footers} \cs{ekdprintmark}\marg{selector}\marg{signpost} The 10208% and footers} \cs{ekdprintmark}\marg{selector}\marg{signpost} The
10162% signposts printed in headers and footers must be 10209% signposts printed in headers and footers must be passed as second
10163% passed as second argument of \cs{ekdprintmark} so that \pkg{ekdosis} 10210% argument of \cs{ekdprintmark} so that \pkg{ekdosis} can remove
10164% can remove them on pages where printing them is not 10211% them on pages where printing them is not desirable. \meta{selector}
10165% desirable. \meta{selector} refers to three symbolic letters where 10212% refers to three possible symbolic letters where the first can be
10166% the first can be either |H| or |F|\===for \underLine{h}eader or 10213% either |H| or |F|\===for \underLine{h}eader or
10167% \underLine{f}ooter\===, the second |E| or |O|\===for \underLine{o}dd 10214% \underLine{f}ooter\===, the second |E| or |O|\===for \underLine{o}dd
10168% or \underLine{e}ven\===and the third |L|, |C| or |R|\===for 10215% or \underLine{e}ven\===and the third |L|, |C| or |R|\===for
10169% \underLine{l}eft, \underLine{c}enter or \underLine{r}ight:--- 10216% \underLine{l}eft, \underLine{c}enter or \underLine{r}ight. When
10217% critical editions are layed out on \enquote{paired} facing pages as
10218% described above \vpageref{ref:paired-opt}, the second letter, |E| or
10219% |O|, must obviously be omitted for headers and footers are the same
10220% on every facing page:---
10170% \begin{macrocode} 10221% \begin{macrocode}
10171\ekvdefinekeys{ekd@marks}{ 10222\ekvdefinekeys{ekd@marks}{
10172 choice mark = {HEL = \def\ekd@mk{HEL}, 10223 choice mark = {HEL = \def\ekd@mk{HEL},
@@ -10185,13 +10236,59 @@ Sample text with a \textcolor{red}{word} in red.
10185 must be either `HEL', `HEC', `HER', `HOL', `HOC', `HOR', `FEL', 10236 must be either `HEL', `HEC', `HER', `HOL', `HOC', `HOR', `FEL',
10186 \MessageBreak `FEC', `FER', `FOL', `FOC' or `FOR'.} 10237 \MessageBreak `FEC', `FER', `FOL', `FOC' or `FOR'.}
10187} 10238}
10188\NewDocumentCommand{\ekdprintmark}{m m}{% 10239\NewDocumentCommand{\ekd@printmark}{m m}{%
10189 \bgroup 10240 \bgroup
10190 \ekvset{ekd@marks}{mark = #1}% 10241 \ekvset{ekd@marks}{mark = #1}%
10191 \luadirect{tex.sprint(ekdosis.printmark(\luastringN{#2}, 10242 \luadirect{tex.sprint(ekdosis.printmark(\luastringN{#2},
10192 \luastringO{\ekd@mk}))}% 10243 \luastringO{\ekd@mk}))}%
10193 \egroup 10244 \egroup
10194} 10245}
10246\NewDocumentCommand{\ekdprintmark}{m m}{%
10247 \def\@tempa{#1}%
10248 \def\mk@HL{HL}\def\mk@HC{HC}\def\mk@HR{HR}%
10249 \def\mk@FL{FL}\def\mk@FC{FC}\def\mk@FR{FR}%
10250 \ifx\@tempa\mk@HL
10251 \csname ekd@printmark\endcsname{HEL}{\csname
10252 ekd@printmark\endcsname{HOL}{#2}}%
10253 \else
10254 \ifx\@tempa\mk@HC
10255 \csname ekd@printmark\endcsname{HEC}{\csname
10256 ekd@printmark\endcsname{HOC}{#2}}%
10257 \else
10258 \ifx\@tempa\mk@HR
10259 \csname ekd@printmark\endcsname{HER}{\csname
10260 ekd@printmark\endcsname{HOR}{#2}}%
10261 \else
10262 \ifx\@tempa\mk@FL
10263 \csname ekd@printmark\endcsname{FEL}{\csname
10264 ekd@printmark\endcsname{FOL}{#2}}%
10265 \else
10266 \ifx\@tempa\mk@FC
10267 \csname ekd@printmark\endcsname{FEC}{\csname
10268 ekd@printmark\endcsname{FOC}{#2}}%
10269 \else
10270 \ifx\@tempa\mk@FR
10271 \csname ekd@printmark\endcsname{FER}{\csname
10272 ekd@printmark\endcsname{FOR}{#2}}%
10273 \else
10274 \csname ekd@printmark\endcsname{#1}{#2}%
10275 \fi\fi\fi\fi\fi\fi
10276}
10277% \end{macrocode}
10278% \end{macro}
10279% \begin{macro}{\ekdEOprint}
10280% \changes{v1.5}{2022/04/20}{Sets headers and footers on
10281% \enquote{paired} facing pages}
10282% To set headers and footers on \enquote{paired} facing pages,
10283% \cs{ekdEOprint} accepts two mandatory, self-evident arguments, like
10284% so: \cs{ekdEOprint}\marg{left-hand mark}\marg{right-hand mark}. This
10285% command uses the zero-based |abspage| counter provided by
10286% \pkg{zref-abspage}. So if the number returned by this counter is
10287% odd, it falls on a left-hand page:---
10288% \begin{macrocode}
10289\NewDocumentCommand{\ekdEOprint}{m m}{%
10290 \ifnumodd{\theabspage}{#1}{#2}%
10291}
10195% \end{macrocode} 10292% \end{macrocode}
10196% \end{macro} 10293% \end{macro}
10197% \begin{macro}{\ekdnofhmarks} 10294% \begin{macro}{\ekdnofhmarks}
@@ -10200,7 +10297,7 @@ Sample text with a \textcolor{red}{word} in red.
10200% \cs{ekdnohfmarks} has the same effect as the \LaTeX\ standard 10297% \cs{ekdnohfmarks} has the same effect as the \LaTeX\ standard
10201% command \cs{thispagestyle}|{empty}|. 10298% command \cs{thispagestyle}|{empty}|.
10202% \begin{macrocode} 10299% \begin{macrocode}
10203\NewDocumentCommand{\ekdnohfmark}{}{% 10300\NewDocumentCommand{\ekdnohfmarks}{}{%
10204 \luadirect{ekdosis.nohfmark()}% 10301 \luadirect{ekdosis.nohfmark()}%
10205} 10302}
10206% \end{macrocode} 10303% \end{macrocode}
@@ -11670,7 +11767,20 @@ function ekdosis.gethfmark(page)
11670 then 11767 then
11671 return hfmarks[indexpage].mark 11768 return hfmarks[indexpage].mark
11672 else 11769 else
11673 return hfmarks[#hfmarks-1].mark or "" 11770 if page > hfmarks[#hfmarks].a
11771 then
11772 return hfmarks[#hfmarks].mark
11773 else
11774 for i=1,#hfmarks
11775 do
11776 if hfmarks[i].a > page
11777 then
11778 idfound = i
11779 break
11780 end
11781 end
11782 return hfmarks[idfound-1].mark or ""
11783 end
11674 end 11784 end
11675end 11785end
11676 11786
diff --git a/ekdosis.el b/ekdosis.el
index e9fb8a7..f2fa1e7 100644
--- a/ekdosis.el
+++ b/ekdosis.el
@@ -386,8 +386,10 @@
386 (TeX-arg-eval completing-read 386 (TeX-arg-eval completing-read
387 (TeX-argument-prompt nil nil "selector") 387 (TeX-argument-prompt nil nil "selector")
388 '("HEL" "HEC" "HER" "HOL" "HOC" "HOR" 388 '("HEL" "HEC" "HER" "HOL" "HOC" "HOR"
389 "FEL" "FEC" "FER" "FOL" "FOC" "FOR")) 389 "FEL" "FEC" "FER" "FOL" "FOC" "FOR"
390 "HL" "HC" "HR" "FL" "FC" "FR"))
390 "signpost" 0 ) 391 "signpost" 0 )
392 '("ekdEOprint" "even page" "odd page" 0)
391 '("ekdnohfmark" 0) 393 '("ekdnohfmark" 0)
392 '("ekdresethfmarks" 0) 394 '("ekdresethfmarks" 0)
393 '("ekdpb" [ "page number" ] "line number" 0) 395 '("ekdpb" [ "page number" ] "line number" 0)