aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2021-06-27 15:10:33 +0200
committerRobert Alessi <alessi@robertalessi.net>2021-06-27 15:10:33 +0200
commit4243296d907f6eb790ce259f2da9dbece6d31771 (patch)
tree76769198f55882fbdf9106480bcbf29e5df242c1
parent4074397c131445596974c5dd4320577241e11fe8 (diff)
downloadekdosis-4243296d907f6eb790ce259f2da9dbece6d31771.tar.gz
started documenting the functions related to headers and footers
-rw-r--r--ekdosis.dtx168
1 files changed, 115 insertions, 53 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx
index bb042f3..820e9a8 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 [2021/06/26 v1.3-dev Typesetting TEI xml-compliant critical editions] 64 [2021/06/27 v1.3-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}
@@ -5092,7 +5092,7 @@ subtype="arabtex">'inna 'abI kAna mina
5092%</example> 5092%</example>
5093% \fi 5093% \fi
5094% 5094%
5095% \subsection{Using \texttt{TEI} Un-numbered Divisions} 5095% \subsection{\texttt{TEI} Un-numbered Divisions}
5096% \label{sec:ekddiv} 5096% \label{sec:ekddiv}
5097% \danger As already described \vpageref{ref:divs-opt}, the 5097% \danger As already described \vpageref{ref:divs-opt}, the
5098% un-numbered style of division is the one that is set by default. It 5098% un-numbered style of division is the one that is set by default. It
@@ -7353,7 +7353,7 @@ Sample text with a \textcolor{red}{word} in red.
7353% \end{macrocode} 7353% \end{macrocode}
7354% \paragraph{Setup} 7354% \paragraph{Setup}
7355% \begin{macro}{\ekdsetup} 7355% \begin{macro}{\ekdsetup}
7356% \changes{v1.3}{2021/06/26}{new command for global options} 7356% \changes{v1.3}{2021/06/27}{new command for global options}
7357% \cs{ekdsetup} is used to specify options that affect the general 7357% \cs{ekdsetup} is used to specify options that affect the general
7358% behavior of \pkg{ekdosis}. It is a preamble-only command. 7358% behavior of \pkg{ekdosis}. It is a preamble-only command.
7359% \begin{macrocode} 7359% \begin{macrocode}
@@ -7584,7 +7584,7 @@ Sample text with a \textcolor{red}{word} in red.
7584% \end{macrocode} 7584% \end{macrocode}
7585% \end{macro} 7585% \end{macro}
7586% \begin{macro}{\teidirect} 7586% \begin{macro}{\teidirect}
7587% \changes{v1.3}{2021/06/26}{direct insertion of elements in the 7587% \changes{v1.3}{2021/06/27}{direct insertion of elements in the
7588% \texttt{TEI xml} file} 7588% \texttt{TEI xml} file}
7589% \cs{teidirect}\oarg{xml attributes}\marg{xml element}\marg{code} 7589% \cs{teidirect}\oarg{xml attributes}\marg{xml element}\marg{code}
7590% does nothing in \LaTeX. Its only use is to insert elements in the 7590% does nothing in \LaTeX. Its only use is to insert elements in the
@@ -7951,7 +7951,7 @@ Sample text with a \textcolor{red}{word} in red.
7951% \end{macrocode} 7951% \end{macrocode}
7952% \end{macro} 7952% \end{macro}
7953% \begin{macro}{\SetApparatusNoteLanguage} 7953% \begin{macro}{\SetApparatusNoteLanguage}
7954% \changes{v1.3}{2021/06/26}{defines an alternate language to be 7954% \changes{v1.3}{2021/06/27}{defines an alternate language to be
7955% applied in note apparatus entries} 7955% applied in note apparatus entries}
7956% \cs{SetApparatusNoteLang}\marg{languagename} can be used when 7956% \cs{SetApparatusNoteLang}\marg{languagename} can be used when
7957% it is needed to apply in entries introduced by the \cs{note} command 7957% it is needed to apply in entries introduced by the \cs{note} command
@@ -9180,6 +9180,13 @@ Sample text with a \textcolor{red}{word} in red.
9180% \end{macrocode} 9180% \end{macrocode}
9181% \end{environment} 9181% \end{environment}
9182% \paragraph{Headers and Footers} 9182% \paragraph{Headers and Footers}
9183% \pkg{ekdosis} provides a mechanism of its own for headers and
9184% footers as follows. Most of it is handled by \textsf{Lua}
9185% functions.
9186% \begin{macro}{\ekd@storemark}
9187% \cs{ekd@storemark} is used internally by the |mark| optional
9188% argument of \cs{ekddiv} described below to store marks to be
9189% printed at specific places in headers or footers.
9183% \begin{macrocode} 9190% \begin{macrocode}
9184\NewDocumentCommand{\ekd@storemark}{m}{% 9191\NewDocumentCommand{\ekd@storemark}{m}{%
9185 \stepcounter{ekd@lab}% 9192 \stepcounter{ekd@lab}%
@@ -9188,6 +9195,20 @@ Sample text with a \textcolor{red}{word} in red.
9188 \luastring{\getpagerefnumber{ekd:\theekd@lab}}, 9195 \luastring{\getpagerefnumber{ekd:\theekd@lab}},
9189 \luastringN{#1})}% 9196 \luastringN{#1})}%
9190} 9197}
9198% \end{macrocode}
9199% \end{macro}
9200% \begin{macro}{\endmark}
9201% \changes{v1.3}{2021/06/27}{prints the last-emitted mark of the
9202% preceding page}
9203% By default, \cs{ekdmark} described below prints the first mark
9204% that is emitted on a given page and ignores the mark corresponding
9205% to the portion of text that may be printed between the top of the
9206% page and the point where the first mark is called. \cs{endmark} is
9207% an argument-less command that can be used just at the end of that
9208% portion of text to instruct \pkg{ekdosis} to print the last-emitted
9209% mark of the preceding page instead of the first-emitted mark of the
9210% current page.
9211% \begin{macrocode}
9191\NewDocumentCommand{\endmark}{}{% 9212\NewDocumentCommand{\endmark}{}{%
9192 \stepcounter{ekd@lab}% 9213 \stepcounter{ekd@lab}%
9193 \label{ekd:\theekd@lab}% 9214 \label{ekd:\theekd@lab}%
@@ -9196,22 +9217,47 @@ Sample text with a \textcolor{red}{word} in red.
9196 "", "endmk")}% 9217 "", "endmk")}%
9197 \ifdefined\xspace\xspace\fi 9218 \ifdefined\xspace\xspace\fi
9198} 9219}
9220% \end{macrocode}
9221% \end{macro}
9222% \begin{macro}{\edkmark}
9223% \changes{v1.3}{2021/06/27}{prints marks in headers or footers}
9224% \cs{ekdmark} is an argument-less command called in commands used to
9225% make headers and footers where the marks stored by means of the
9226% |mark| optional argument of \cs{ekddiv} are to be printed.
9227% \begin{macrocode}
9199\NewDocumentCommand{\ekdmark}{}{% 9228\NewDocumentCommand{\ekdmark}{}{%
9200 \luadirect{tex.sprint(ekdosis.gethfmark(\luastring{\thepage}))}% 9229 \luadirect{tex.sprint(ekdosis.gethfmark(\luastring{\thepage}))}%
9201} 9230}
9231% \end{macrocode}
9232% \end{macro}
9233% \begin{macro}{\ekdprintmark}
9234% \changes{v1.3}{2021/06/27}{prints or removes the marks in headers
9235% and footers} \cs{ekdprintmark}\marg{selector}\marg{signpost} The
9236% signposts printed in headers and footers must be
9237% passed as second argument of \cs{ekdprintmark} so that \pkg{ekdosis}
9238% can remove them on pages where printing them is not
9239% desirable. \meta{selector} refers to three symbolic letters where
9240% the first can be |H| or |F|\===for \underLine{h}eader or
9241% \underLine{f}ooter\===, the second |E| or |O|\===for \underLine{o}dd
9242% or \underLine{e}ven\===and the third |L|, |C| or |R|\===for
9243% \underLine{l}eft, \underLine{c}enter or \underLine{r}ight:---
9244% \begin{macrocode}
9202\ekvdefinekeys{ekd@marks}{ 9245\ekvdefinekeys{ekd@marks}{
9203 choice mark = {hel = \def\ekd@mk{hel}, 9246 choice mark = {HEL = \def\ekd@mk{HEL},
9204 hec = \def\ekd@mk{hec}, 9247 HEC = \def\ekd@mk{HEC},
9205 her = \def\ekd@mk{her}, 9248 HER = \def\ekd@mk{HER},
9206 hol = \def\ekd@mk{hol}, 9249 HOL = \def\ekd@mk{HOL},
9207 hoc = \def\ekd@mk{hoc}, 9250 HOC = \def\ekd@mk{HOC},
9208 hor = \def\ekd@mk{hor}, 9251 HOR = \def\ekd@mk{HOR},
9209 fol = \def\ekd@mk{fol}, 9252 FEL = \def\ekd@mk{FEL},
9210 foc = \def\ekd@mk{foc}, 9253 FEC = \def\ekd@mk{FEC},
9211 fol = \def\ekd@mk{fol}, 9254 FEL = \def\ekd@mk{FER},
9212 fel = \def\ekd@mk{fel}, 9255 FOL = \def\ekd@mk{FOL},
9213 fec = \def\ekd@mk{fec}, 9256 FOC = \def\ekd@mk{FOC},
9214 fel = \def\ekd@mk{fel}} 9257 FOL = \def\ekd@mk{FOR}},
9258 unknown-choice mark = \PackageError{ekdosis}{unknown mark=#1}{`mark'
9259 must be either `HEL', `HEC', `HER', `HOL', `HOC', `HOR', `FEL',
9260 \MessageBreak `FEC', `FER', `FOL', `FOC' or `FOR'.}
9215} 9261}
9216\NewDocumentCommand{\ekdprintmark}{m m}{% 9262\NewDocumentCommand{\ekdprintmark}{m m}{%
9217 \bgroup 9263 \bgroup
@@ -9220,13 +9266,29 @@ Sample text with a \textcolor{red}{word} in red.
9220 \luastringO{\ekd@mk}))}% 9266 \luastringO{\ekd@mk}))}%
9221 \egroup 9267 \egroup
9222} 9268}
9269% \end{macrocode}
9270% \end{macro}
9271% \begin{macro}{\ekdnofhmarks}
9272% \changes{v1.3}{2021/06/27}{removes headers and footers on specific
9273% pages} Once the signposts are marked with \cs{ekdprintmark},
9274% \cs{ekdnohfmarks} has the same effect as the \LaTeX\ standard
9275% command \cs{thispagestyle}|{empty}|.
9276% \begin{macrocode}
9223\NewDocumentCommand{\ekdnohfmark}{}{% 9277\NewDocumentCommand{\ekdnohfmark}{}{%
9224 \luadirect{ekdosis.nohfmark()}% 9278 \luadirect{ekdosis.nohfmark()}%
9225} 9279}
9280% \end{macrocode}
9281% \end{macro}
9282% \begin{macro}{\ekdresethfmarks}
9283% \changes{v1.3}{2021/06/27}{marks headers and footers as printable}
9284% \cs{ekdresethfmarks} can be used in rare cases when it is needed to
9285% reset headers and footers to their original, viz.\ printable state.
9286% \begin{macrocode}
9226\NewDocumentCommand{\ekdresethfmarks}{}{% 9287\NewDocumentCommand{\ekdresethfmarks}{}{%
9227 \luadirect{ekdosis.resethfmark()}% 9288 \luadirect{ekdosis.resethfmark()}%
9228} 9289}
9229% \end{macrocode} 9290% \end{macrocode}
9291% \end{macro}
9230% \paragraph{Divisions of the Body} 9292% \paragraph{Divisions of the Body}
9231% \pkg{ekdosis} can convert \cs{book}, \cs{part}, \cs{chapter}, 9293% \pkg{ekdosis} can convert \cs{book}, \cs{part}, \cs{chapter},
9232% \cs{section}, \cs{subsec{\allowbreak}tion} and \cs{subsubsection} 9294% \cs{section}, \cs{subsec{\allowbreak}tion} and \cs{subsubsection}
@@ -10503,48 +10565,48 @@ function ekdosis.storehfmark(page, mk, opt)
10503end 10565end
10504 10566
10505local printhfmarks = { 10567local printhfmarks = {
10506 hel = true, 10568 HEL = true,
10507 hec = true, 10569 HEC = true,
10508 her = true, 10570 HER = true,
10509 hol = true, 10571 HOL = true,
10510 hoc = true, 10572 HOC = true,
10511 hor = true, 10573 HOR = true,
10512 fol = true, 10574 FOL = true,
10513 foc = true, 10575 FOC = true,
10514 fol = true, 10576 FOR = true,
10515 fel = true, 10577 FEL = true,
10516 fec = true, 10578 FEC = true,
10517 fel = true, 10579 FER = true,
10518} 10580}
10519 10581
10520function ekdosis.nohfmark() 10582function ekdosis.nohfmark()
10521 printhfmarks.hel = false 10583 printhfmarks.HEL = false
10522 printhfmarks.hec = false 10584 printhfmarks.HEC = false
10523 printhfmarks.her = false 10585 printhfmarks.HER = false
10524 printhfmarks.hol = false 10586 printhfmarks.HOL = false
10525 printhfmarks.hoc = false 10587 printhfmarks.HOC = false
10526 printhfmarks.hor = false 10588 printhfmarks.HOR = false
10527 printhfmarks.fol = false 10589 printhfmarks.FOL = false
10528 printhfmarks.foc = false 10590 printhfmarks.FOC = false
10529 printhfmarks.fol = false 10591 printhfmarks.FOR = false
10530 printhfmarks.fel = false 10592 printhfmarks.FEL = false
10531 printhfmarks.fec = false 10593 printhfmarks.FEC = false
10532 printhfmarks.fel = false 10594 printhfmarks.FER = false
10533end 10595end
10534 10596
10535function ekdosis.resethfmark() 10597function ekdosis.resethfmark()
10536 printhfmarks.hel = true 10598 printhfmarks.HEL = true
10537 printhfmarks.hec = true 10599 printhfmarks.HEC = true
10538 printhfmarks.her = true 10600 printhfmarks.HER = true
10539 printhfmarks.hol = true 10601 printhfmarks.HOL = true
10540 printhfmarks.hoc = true 10602 printhfmarks.HOC = true
10541 printhfmarks.hor = true 10603 printhfmarks.HOR = true
10542 printhfmarks.fol = true 10604 printhfmarks.FOL = true
10543 printhfmarks.foc = true 10605 printhfmarks.FOC = true
10544 printhfmarks.fol = true 10606 printhfmarks.FOR = true
10545 printhfmarks.fel = true 10607 printhfmarks.FEL = true
10546 printhfmarks.fec = true 10608 printhfmarks.FEC = true
10547 printhfmarks.fel = true 10609 printhfmarks.FER = true
10548end 10610end
10549 10611
10550function ekdosis.printmark(str, mk) 10612function ekdosis.printmark(str, mk)