diff options
author | Robert Alessi <alessi@robertalessi.net> | 2021-02-21 07:54:54 +0100 |
---|---|---|
committer | Robert Alessi <alessi@robertalessi.net> | 2021-02-21 07:54:54 +0100 |
commit | f43c87eb1bdb4aaf45154bde25cbb2a7e951ac19 (patch) | |
tree | 2aa98f73b1f773c624666b1445ba324637fd76bc | |
parent | 7af1eb722049eab5b0642facd624f9fc4a783a60 (diff) | |
download | ekdosis-f43c87eb1bdb4aaf45154bde25cbb2a7e951ac19.tar.gz |
added \ekdpb for conditional page breaks
-rw-r--r-- | ekdosis.dtx | 44 |
1 files changed, 44 insertions, 0 deletions
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 | |||
4220 | % edition text is ready for any substantial change in the preceding | 4220 | % edition text is ready for any substantial change in the preceding |
4221 | % pages may result in pages that break just after they begin. | 4221 | % pages may result in pages that break just after they begin. |
4222 | % | 4222 | % |
4223 | % \paragraph{Conditional page breaks} | ||
4224 | % \DescribeMacro{\ekdpb} \cs{ekdpb}\oarg{page no}\marg{line no} | ||
4225 | % \newfeature[v1.2]\\ | ||
4226 | % One way to avoid this inconvenience is to use \cs{ekdpb} instead of | ||
4227 | % the standard \cs{pabebreak} command provided by \LaTeX\ to insert | ||
4228 | % conditional page breaks. \cs{ekdpb} takes as mandatory argument an | ||
4229 | % integer that represents the line number where the page break should | ||
4230 | % take place. An optional argument allows to further specify the page | ||
4231 | % number where the page break should occur. The value that is expected | ||
4232 | % is the page number as it is printed\===e.g.\ an Arabic, Roman or | ||
4233 | % alphanumeric number. If the specified conditions are not met, then | ||
4234 | % the page break is not triggered. | ||
4235 | % | ||
4236 | % \paragraph{Using \texttt{maxentries}} | ||
4223 | % Another way\---should the edition text fall into the vicious circle | 4237 | % Another way\---should the edition text fall into the vicious circle |
4224 | % too often\---is to limit the number of entries per page that a given | 4238 | % too often\---is to limit the number of entries per page that a given |
4225 | % layer of apparatus criticus may accept as described above | 4239 | % layer of apparatus criticus may accept as described above |
@@ -6431,6 +6445,7 @@ Sample text with a \textcolor{red}{word} in red. | |||
6431 | } | 6445 | } |
6432 | \@onlypreamble\DeclareApparatus | 6446 | \@onlypreamble\DeclareApparatus |
6433 | % \end{macrocode} | 6447 | % \end{macrocode} |
6448 | % \end{macro} | ||
6434 | % \begin{macro}{\addentries} | 6449 | % \begin{macro}{\addentries} |
6435 | % \changes{v1.1}{2020/11/04}{modifies the number of accepted entries | 6450 | % \changes{v1.1}{2020/11/04}{modifies the number of accepted entries |
6436 | % on the current page.} | 6451 | % on the current page.} |
@@ -6448,6 +6463,35 @@ Sample text with a \textcolor{red}{word} in red. | |||
6448 | } | 6463 | } |
6449 | % \end{macrocode} | 6464 | % \end{macrocode} |
6450 | % \end{macro} | 6465 | % \end{macro} |
6466 | % \begin{macro}{\ekdpb} | ||
6467 | % \changes{v1.2}{2021/02/21}{insert conditional page breaks} | ||
6468 | % \cs{ekdpk}\oarg{page no}\marg{line no} is used to insert conditional | ||
6469 | % page breaks by specifying that the page break should occur only on a | ||
6470 | % given line and optionally a given page. If the specified conditions | ||
6471 | % are met then this command triggers \cs{pagebreak}. | ||
6472 | % \begin{macrocode} | ||
6473 | \NewDocumentCommand{\ekdpb}{o m}{% | ||
6474 | \def\@tmpoarg{#1}% | ||
6475 | \def\@tmpmarg{#2}% | ||
6476 | \luadirect{ekdosis.dolnlab(\luastringN{#2})}% | ||
6477 | \linelabel{\luadirect{tex.sprint(ekdosis.getlnlab())}}% | ||
6478 | \def\tmpln{% | ||
6479 | \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}}}% | ||
6480 | \def\tmppg{% | ||
6481 | \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}}}% | ||
6482 | \IfNoValueTF{#1} | ||
6483 | {\ifnum\@tmpmarg=\tmpln | ||
6484 | \pagebreak | ||
6485 | \fi} | ||
6486 | {\ifnum | ||
6487 | \pdf@strcmp{\@tmpoarg}{\tmppg} = 0 | ||
6488 | \ifnum\@tmpmarg=\tmpln | ||
6489 | \pagebreak | ||
6490 | \fi | ||
6491 | \fi | ||
6492 | }\ignorespaces | ||
6493 | } | ||
6494 | % \end{macrocode} | ||
6451 | % \end{macro} | 6495 | % \end{macro} |
6452 | % Apparatus-related settings and functions. Some booleans to check if | 6496 | % Apparatus-related settings and functions. Some booleans to check if |
6453 | % an apparatus should be inserted and what is the current environment. | 6497 | % an apparatus should be inserted and what is the current environment. |