From 447055607c51bd143cb3dad73e9e93038408a630 Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Wed, 2 Jun 2021 17:29:27 +0200 Subject: headers/footers: added endmarks --- ekdosis.dtx | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/ekdosis.dtx b/ekdosis.dtx index 91b6b94..ca27494 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx @@ -61,7 +61,7 @@ along with this program. If not, see %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{ekdosis} %<*package> - [2021/05/31 v1.3-dev Typesetting TEI xml-compliant critical editions] + [2021/06/02 v1.3-dev Typesetting TEI xml-compliant critical editions] % %<*driver> \begin{filecontents}[noheader,overwrite]{bibdata.xml} @@ -7511,7 +7511,7 @@ Sample text with a \textcolor{red}{word} in red. % \end{macrocode} % \end{macro} % \begin{macro}{\teidirect} -% \changes{v1.3}{2021/05/31}{direct insertion of elements in the +% \changes{v1.3}{2021/06/02}{direct insertion of elements in the % \texttt{TEI xml} file} % \cs{teidirect}\oarg{xml attributes}\marg{xml element}\marg{code} % does nothing in \LaTeX. Its only use is to insert elements in the @@ -7870,7 +7870,7 @@ Sample text with a \textcolor{red}{word} in red. % \end{macrocode} % \end{macro} % \begin{macro}{\SetApparatusNoteLanguage} -% \changes{v1.3}{2021/05/31}{defines an alternate language to be +% \changes{v1.3}{2021/06/02}{defines an alternate language to be % applied in note apparatus entries} % \cs{SetApparatusNoteLang}\marg{languagename} can be used when % it is needed to apply in entries introduced by the \cs{note} command @@ -9110,6 +9110,14 @@ Sample text with a \textcolor{red}{word} in red. \NewDocumentCommand{\ekdmark}{}{% \luadirect{tex.sprint(ekdosis.gethfmark(\luastring{\thepage}))}% } +\NewDocumentCommand{\endmark}{}{% + \stepcounter{ekd@lab}% + \label{ekd:\theekd@lab}% + \luadirect{ekdosis.storehfmark( + \luastring{\getpagerefnumber{ekd:\theekd@lab}}, + "", "endmk")}% + \ifdefined\xspace\xspace\fi +} % \end{macrocode} % \paragraph{Divisions of the Body} % \pkg{ekdosis} can convert \cs{book}, \cs{part}, \cs{chapter}, @@ -9775,6 +9783,7 @@ local texpatttotags = { {a="\\teidirect%s+(%b[]){(.-)}(%b{})", b="<%2 ekd@os%1ekd@cs>ekd@ob%3ekd@cb"}, {a="\\teidirect%s+{(.-)}(%b{})", b="<%1>ekd@ob%2ekd@cb"}, {a="\\altrfont%s+", b=""}, + {a="\\endmark%s+", b=""}, {a="\\mbox%s+(%b{})", b="ekd@ob%1ekd@cb"}, {a="\\LR%s+(%b{})", b="ekd@ob%1ekd@cb"}, {a="\\RL%s+(%b{})", b="ekd@ob%1ekd@cb"}, @@ -10366,8 +10375,14 @@ end --headers and footers local hfmarks = {} -function ekdosis.storehfmark(page, mk) - table.insert(hfmarks, {a = page, mark = mk}) +function ekdosis.storehfmark(page, mk, opt) + if opt == "endmk" + then + local emark = hfmarks[#hfmarks].mark + table.insert(hfmarks, {a = page, mark = emark}) + else + table.insert(hfmarks, {a = page, mark = mk}) + end return true end @@ -10377,10 +10392,11 @@ function ekdosis.gethfmark(page) then return hfmarks[indexpage].mark else - return "nil" + return hfmarks[#hfmarks-1].mark or "" end end +-- divisions of the body text local divdepth = { book = 1, part = 2, -- cgit v1.2.3