aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2022-04-28 15:35:23 +0200
committerRobert Alessi <alessi@robertalessi.net>2022-04-28 15:35:23 +0200
commitf5620b99c9e1bbd4f24146b73d5f4d71dd0a3152 (patch)
tree174c76724e0039095c17caef1b0041a029a6e31f
parent792c43808b2ced93e83dbc1f8779593cf60e2f7c (diff)
downloadekdosis-f5620b99c9e1bbd4f24146b73d5f4d71dd0a3152.tar.gz
new commands for “mirrored” paired facing pages
-rw-r--r--ekdosis.dtx157
-rw-r--r--ekdosis.el5
2 files changed, 153 insertions, 9 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx
index 5faf7fa..e7594ac 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/04/20 v1.5-dev Typesetting TEI xml-compliant critical editions] 64 [2022/04/28 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}
@@ -605,9 +605,11 @@ along with this program. If not, see
605%^^A dox does not work with the latest latex-dev: 605%^^A dox does not work with the latest latex-dev:
606\ifdefined\SpecialMacroIndex 606\ifdefined\SpecialMacroIndex
607 \NewDocElement{Option}{option} 607 \NewDocElement{Option}{option}
608 \NewDocElement[printtype=\textit{cnt.}]{Counter}{counter}
608\else 609\else
609 \usepackage{dox} 610 \usepackage{dox}
610 \doxitem{Option}{option}{options} 611 \doxitem{Option}{option}{options}
612 \doxitem{Counter}{counter}{counter}
611\fi 613\fi
612\usepackage{fontspec} 614\usepackage{fontspec}
613\defaultfontfeatures{Renderer=Harfbuzz} 615\defaultfontfeatures{Renderer=Harfbuzz}
@@ -3330,7 +3332,8 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+
3330% pages. The |paired| option leaves every right-hand page number 3332% pages. The |paired| option leaves every right-hand page number
3331% unchanged, so that both facing pages hold the same page 3333% unchanged, so that both facing pages hold the same page
3332% number.\footnote{For setting headers and footers in this arrangement 3334% number.\footnote{For setting headers and footers in this arrangement
3333% of text, see \vpageref{sec:header-paired-pages}.}\\ 3335% of text, but also for the current limitations attached to this
3336% option, see \vpageref{sec:header-paired-pages}.}\\
3334% \DescribeOption{lineation} |lineation|$=$\verb+page|document+ 3337% \DescribeOption{lineation} |lineation|$=$\verb+page|document+
3335% \hfill\tcboxverb{Default: document}\\ 3338% \hfill\tcboxverb{Default: document}\\
3336% This option applies to edition texts initially set to receive an 3339% This option applies to edition texts initially set to receive an
@@ -5951,6 +5954,99 @@ subtype="arabtex">'inna 'abI kAna mina
5951%</example> 5954%</example>
5952% \fi 5955% \fi
5953% 5956%
5957% \paragraph{\enquote{Mirrored} paired facing pages}
5958% \newfeature[v1.5] The \textooquote|paired|\textcoquote\ option just
5959% described can give surprising results at first sight, in which
5960% facing pages are arranged by succeeding pairs of left- or right-hand
5961% pages. This is certainly not the desired layout for duplex
5962% printing. However, this is not a redhibitory inconvenience for
5963% professional printers can easily carry out the necessary corrections
5964% by applying offsets to the horizontal margins. That being said, one
5965% may also wish to have these horizontal offsets applied from the
5966% outset in the PDF output that is produced by \LaTeX.
5967%
5968% \danger What follows assumes that the critical edition is printed on
5969% facing pages and starts on a left-hand page. Furthermore, it must be
5970% noted that the |paired| option must be either unset or set to
5971% |false|.
5972%
5973% \DescribeMacro{\setpairedpage} \cs{setpairedpage} is provided to set
5974% mirrored paired facing pages. This command takes no argument and is
5975% meant to be issued in commands used to set headers and footers on
5976% both sides, \emph{before} \cs{thepage} is called, like so:---
5977%
5978% \iffalse
5979%<*example>
5980% \fi
5981\begin{minted}[linenos=false,highlightlines={4,9}]{latex}
5982% Preamble:
5983\usepackage{titleps}
5984\newpagestyle{edition}{
5985 \sethead[\setpairedpage\ekdprintmark{HEL}{\thepage}]
5986 [\ekdprintmark{HEC}{Hippocratis}]
5987 []
5988 {}
5989 {\ekdprintmark{HOC}{Epidemiarum liber II, \ekdmark}}
5990 {\setpairedpage\ekdprintmark{HOR}{\thepage}}
5991}
5992% Apply the page style:
5993\pagestyle{edition}
5994\end{minted}
5995% \iffalse
5996%</example>
5997% \fi
5998%
5999% \begin{remarks}
6000% \item As can be seen, \cs{setpairedpage} must be issued
6001% \emph{before} \cs{ekdprintmark} so that it can be processed on
6002% pages where headers and footers are removed by \cs{ekdnohfmarks}
6003% described below.
6004% \item If there be no \cs{thepage} in headers or footers,
6005% \cs{setpairedpage} must still be issued once on each side.
6006% \end{remarks}
6007%
6008% \DescribeMacro{\setpairedpagenum} \cs{setpairedpagenum}\marg{number}
6009% can be used just ahead of the alignment environment to set the
6010% number of the first left-hand paired page to follow. The first
6011% paired page number is initially set to |1|.
6012%
6013% \DescribeMacro{\resetpagenumber} Finally, \cs{resetpagenumber}
6014% \emph{must} be used right out of the alignment environment so that
6015% any numbering error on the page that follows the edition text can be
6016% corrected. See below \vref{lst:mirrored-fp},
6017% l.~\lnref{ln:mirrored:fp:resetpn}.
6018%
6019% A schematic illustration of this technique follows:---
6020%
6021% \captof{\enquote{Mirrored} paired facing
6022% pages}[\label{lst:mirrored-fp}]
6023% \iffalse
6024%<*example>
6025% \fi
6026\begin{minted}[escapeinside=++,highlightlines={16}]{latex}
6027\mainmatter
6028\part{Edition text}
6029\cleartoevenpage % this needs the 'nextpage' package.
6030\pagestyle{edition} % apply the style where 'mirrored' paired facing
6031 % pages are defined as illustrated above.
6032\begin{alignment}
6033 \begin{edition}
6034 ...
6035 \end{edition}
6036 \begin{translation}
6037 ...
6038 \end{translation}
6039\end{alignment}
6040\backmatter % or \cleartooddpage provided by the 'nextpage'
6041 % package.
6042\resetpagenumber % this command is always required.+\label{ln:mirrored:fp:resetpn}+
6043\pagestyle{back} % apply a new page style.
6044\end{minted}
6045% \iffalse
6046%</example>
6047% \fi
6048%
6049% \paragraph{Removing or Resetting Headers and Footers}
5954% \DescribeMacro{\ekdnohfmarks} Once all signposts are marked with 6050% \DescribeMacro{\ekdnohfmarks} Once all signposts are marked with
5955% \cs{ekdprintmark}, \cs{ekdnohfmarks} can be used at any point of the 6051% \cs{ekdprintmark}, \cs{ekdnohfmarks} can be used at any point of the
5956% document with the same effect as the \LaTeX\ standard command 6052% document with the same effect as the \LaTeX\ standard command
@@ -8110,7 +8206,7 @@ Sample text with a \textcolor{red}{word} in red.
8110% \end{macrocode} 8206% \end{macrocode}
8111% \paragraph{\textsf{ekdosis} Symbol} 8207% \paragraph{\textsf{ekdosis} Symbol}
8112% \begin{macro}{\eKd} 8208% \begin{macro}{\eKd}
8113% \changes{v1.5}{2022/04/20}{Prints \textsf{ekdosis} indentifying 8209% \changes{v1.5}{2022/04/28}{Prints \textsf{ekdosis} indentifying
8114% symbol} As of v1.5, \pkg{ekdosis} has its own identifying 8210% symbol} As of v1.5, \pkg{ekdosis} has its own identifying
8115% symbol. It is produced by \cs{eKd} and best printed with the Old 8211% symbol. It is produced by \cs{eKd} and best printed with the Old
8116% Standard Greek font. 8212% Standard Greek font.
@@ -8371,7 +8467,7 @@ Sample text with a \textcolor{red}{word} in red.
8371% \begin{macro}{\teidirectE} 8467% \begin{macro}{\teidirectE}
8372% \changes{v1.3}{2021/08/18}{direct insertion of elements in the 8468% \changes{v1.3}{2021/08/18}{direct insertion of elements in the
8373% \texttt{TEI xml} file} 8469% \texttt{TEI xml} file}
8374% \changes{v1.5}{2022/04/20}{direct insertion of empty elements in the 8470% \changes{v1.5}{2022/04/28}{direct insertion of empty elements in the
8375% \texttt{TEI xml} file} 8471% \texttt{TEI xml} file}
8376% \cs{teidirect}\oarg{xml attributes}\marg{xml element}\marg{code} 8472% \cs{teidirect}\oarg{xml attributes}\marg{xml element}\marg{code}
8377% does nothing in \LaTeX. It is only used to insert elements in the 8473% does nothing in \LaTeX. It is only used to insert elements in the
@@ -8386,7 +8482,7 @@ Sample text with a \textcolor{red}{word} in red.
8386% \end{macro} 8482% \end{macro}
8387% \end{macro} 8483% \end{macro}
8388% \begin{macro}{\getTEIxmlid} 8484% \begin{macro}{\getTEIxmlid}
8389% \changes{v1.5}{2022/04/20}{returns \texttt{TEI xml:ids} from a 8485% \changes{v1.5}{2022/04/28}{returns \texttt{TEI xml:ids} from a
8390% csv-list of ids} This command returns from a csv-list of unique 8486% csv-list of ids} This command returns from a csv-list of unique
8391% identifiers declared in commands such as \cs{DeclareWitness} and the 8487% identifiers declared in commands such as \cs{DeclareWitness} and the
8392% like a space-separated list of their corresponding |xml:id|s, each 8488% like a space-separated list of their corresponding |xml:id|s, each
@@ -8621,7 +8717,7 @@ Sample text with a \textcolor{red}{word} in red.
8621} 8717}
8622\protected\def\LRnum#1{\bgroup\textdir TLT#1\egroup} 8718\protected\def\LRnum#1{\bgroup\textdir TLT#1\egroup}
8623% \end{macrocode} 8719% \end{macrocode}
8624% Set counter referring to line numbers and make it global. 8720% Set a counter referring to line numbers and make it global.
8625% \begin{macrocode} 8721% \begin{macrocode}
8626\newcounter{ekd@lab} 8722\newcounter{ekd@lab}
8627\globalcounter{ekd@lab} 8723\globalcounter{ekd@lab}
@@ -9962,7 +10058,7 @@ Sample text with a \textcolor{red}{word} in red.
9962% \end{macro} 10058% \end{macro}
9963% \paragraph{Lacunae} 10059% \paragraph{Lacunae}
9964% \begin{macro}{\ilabel} 10060% \begin{macro}{\ilabel}
9965% \changes{v1.5}{2022/04/20}{recalls and sets the ending label of 10061% \changes{v1.5}{2022/04/28}{recalls and sets the ending label of
9966% lemmas used to mark lacunae in witnesses} When \cs{lem} has been 10062% lemmas used to mark lacunae in witnesses} When \cs{lem} has been
9967% used with the optional argument |ilabel=<label>|, 10063% used with the optional argument |ilabel=<label>|,
9968% \cs{ilabel}\marg{label} must be used to mark the point where the 10064% \cs{ilabel}\marg{label} must be used to mark the point where the
@@ -10277,7 +10373,7 @@ Sample text with a \textcolor{red}{word} in red.
10277% \end{macrocode} 10373% \end{macrocode}
10278% \end{macro} 10374% \end{macro}
10279% \begin{macro}{\ekdEOprint} 10375% \begin{macro}{\ekdEOprint}
10280% \changes{v1.5}{2022/04/20}{Sets headers and footers on 10376% \changes{v1.5}{2022/04/28}{Sets headers and footers on
10281% \enquote{paired} facing pages} 10377% \enquote{paired} facing pages}
10282% To set headers and footers on \enquote{paired} facing pages, 10378% To set headers and footers on \enquote{paired} facing pages,
10283% \cs{ekdEOprint} accepts two mandatory, self-evident arguments, like 10379% \cs{ekdEOprint} accepts two mandatory, self-evident arguments, like
@@ -10312,6 +10408,51 @@ Sample text with a \textcolor{red}{word} in red.
10312} 10408}
10313% \end{macrocode} 10409% \end{macrocode}
10314% \end{macro} 10410% \end{macro}
10411% \paragraph{\enquote{Mirrored} paired pages}
10412% An easy way to have mirrored paired pages is to use a dedicaded
10413% counter to set the value of the page numbers. This counter should be
10414% incremented every two pages.
10415% \begin{counter}{pairedpage}
10416% \changes{v1.5}{2022/04/28}{A counter incremented every two pages}
10417% |pairedpage| is first set as a global counter:---
10418% \begin{macrocode}
10419\newcounter{pairedpage}
10420\globalcounter{pairedpage}
10421% \end{macrocode}
10422% \end{counter}
10423% \begin{macro}{\setpairedpagenum}
10424% \changes{v1.5}{2022/04/28}{sets the same page number on paired
10425% pages} \cs{setpairedpagenum}\marg{number} is used just ahead of
10426% the alignment environment to set the number of the first left-hand
10427% paired page.
10428% \begin{macro}{\setpairedpage}
10429% \changes{v1.5}{2022/04/28}{sets the page number of the first paired
10430% page} \cs{setpairedpage} is an argument-less command meant to be
10431% issued in commands used to set headers or footers before
10432% \cs{thepage}. This command has the counter |pairedpage|
10433% incremented on right-hand pages only, and sets |page| $\leftarrow$
10434% |pairedpage| on every page.
10435% \begin{macro}{\resetpagenumber}
10436% \changes{v1.5}{2022/04/28}{resets normal running page numbers}
10437% \cs{resetpagenumber} must be used right out of \enquote{mirrored}
10438% paired pages alignment environments. This argument-less command
10439% corrects any numbering error on the page following the edition
10440% text and resumes normal page numbering.
10441% \begin{macrocode}
10442\NewDocumentCommand{\setpairedpagenum}{m}{%
10443 \setcounter{pairedpage}{\number\numexpr#1-1}%
10444}
10445\NewDocumentCommand{\setpairedpage}{}{%
10446 \ifnumodd{\thepage}{\setcounter{page}{\thepairedpage}}
10447 {\refstepcounter{pairedpage}\setcounter{page}{\thepairedpage}}%
10448}
10449\def\resetpagenumber{%
10450 \ifnumodd{\thepairedpage}{}{\addtocounter{page}{-1}}
10451}
10452% \end{macrocode}
10453% \end{macro}
10454% \end{macro}
10455% \end{macro}
10315% \paragraph{Divisions of the Body} 10456% \paragraph{Divisions of the Body}
10316% \pkg{ekdosis} can convert \cs{book}, \cs{part}, \cs{chapter}, 10457% \pkg{ekdosis} can convert \cs{book}, \cs{part}, \cs{chapter},
10317% \cs{section}, \cs{subsec{\allowbreak}tion} and \cs{subsubsection} 10458% \cs{section}, \cs{subsec{\allowbreak}tion} and \cs{subsubsection}
diff --git a/ekdosis.el b/ekdosis.el
index f2fa1e7..3bd1ade 100644
--- a/ekdosis.el
+++ b/ekdosis.el
@@ -390,7 +390,10 @@
390 "HL" "HC" "HR" "FL" "FC" "FR")) 390 "HL" "HC" "HR" "FL" "FC" "FR"))
391 "signpost" 0 ) 391 "signpost" 0 )
392 '("ekdEOprint" "even page" "odd page" 0) 392 '("ekdEOprint" "even page" "odd page" 0)
393 '("ekdnohfmark" 0) 393 '("setpairedpagenum" "page number" 0)
394 '("setpairedpage" 0)
395 '("resetpagenumber" 0)
396 '("ekdnohfmarks" 0)
394 '("ekdresethfmarks" 0) 397 '("ekdresethfmarks" 0)
395 '("ekdpb" [ "page number" ] "line number" 0) 398 '("ekdpb" [ "page number" ] "line number" 0)
396 '("ekdpb*") 399 '("ekdpb*")