From f43c87eb1bdb4aaf45154bde25cbb2a7e951ac19 Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Sun, 21 Feb 2021 07:54:54 +0100 Subject: added \ekdpb for conditional page breaks --- ekdosis.dtx | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/ekdosis.dtx b/ekdosis.dtx index c7176e7..6e975d8 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx @@ -4220,6 +4220,20 @@ subtype="arabtex">'inna 'abI kAna mina % edition text is ready for any substantial change in the preceding % pages may result in pages that break just after they begin. % +% \paragraph{Conditional page breaks} +% \DescribeMacro{\ekdpb} \cs{ekdpb}\oarg{page no}\marg{line no} +% \newfeature[v1.2]\\ +% One way to avoid this inconvenience is to use \cs{ekdpb} instead of +% the standard \cs{pabebreak} command provided by \LaTeX\ to insert +% conditional page breaks. \cs{ekdpb} takes as mandatory argument an +% integer that represents the line number where the page break should +% take place. An optional argument allows to further specify the page +% number where the page break should occur. The value that is expected +% is the page number as it is printed\===e.g.\ an Arabic, Roman or +% alphanumeric number. If the specified conditions are not met, then +% the page break is not triggered. +% +% \paragraph{Using \texttt{maxentries}} % Another way\---should the edition text fall into the vicious circle % too often\---is to limit the number of entries per page that a given % layer of apparatus criticus may accept as described above @@ -6431,6 +6445,7 @@ Sample text with a \textcolor{red}{word} in red. } \@onlypreamble\DeclareApparatus % \end{macrocode} +% \end{macro} % \begin{macro}{\addentries} % \changes{v1.1}{2020/11/04}{modifies the number of accepted entries % on the current page.} @@ -6448,6 +6463,35 @@ Sample text with a \textcolor{red}{word} in red. } % \end{macrocode} % \end{macro} +% \begin{macro}{\ekdpb} +% \changes{v1.2}{2021/02/21}{insert conditional page breaks} +% \cs{ekdpk}\oarg{page no}\marg{line no} is used to insert conditional +% page breaks by specifying that the page break should occur only on a +% given line and optionally a given page. If the specified conditions +% are met then this command triggers \cs{pagebreak}. +% \begin{macrocode} +\NewDocumentCommand{\ekdpb}{o m}{% + \def\@tmpoarg{#1}% + \def\@tmpmarg{#2}% + \luadirect{ekdosis.dolnlab(\luastringN{#2})}% + \linelabel{\luadirect{tex.sprint(ekdosis.getlnlab())}}% + \def\tmpln{% + \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}}}% + \def\tmppg{% + \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}}}% + \IfNoValueTF{#1} + {\ifnum\@tmpmarg=\tmpln + \pagebreak + \fi} + {\ifnum + \pdf@strcmp{\@tmpoarg}{\tmppg} = 0 + \ifnum\@tmpmarg=\tmpln + \pagebreak + \fi + \fi + }\ignorespaces +} +% \end{macrocode} % \end{macro} % Apparatus-related settings and functions. Some booleans to check if % an apparatus should be inserted and what is the current environment. -- cgit v1.2.3