From df61c4b717995c3828019580e1da325d0870e8ca Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Mon, 24 May 2021 10:20:29 +0200
Subject: added \ekdpb* which forces the page break irrespective of the values
 given in the arguments

---
 ekdosis.dtx | 56 ++++++++++++++++++++++++++++++++------------------------
 1 file changed, 32 insertions(+), 24 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index 6151f86..7aa05cf 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -5277,7 +5277,8 @@ subtype="arabtex">'inna 'abI kAna mina
 % 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}
+% \DescribeMacro{\ekdpb}\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{pagebreak} command provided by \LaTeX\ to insert
@@ -5287,7 +5288,9 @@ subtype="arabtex">'inna 'abI kAna mina
 % 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 be not
-% met, then the page break is not triggered.
+% met, then the page break is not triggered.  Finally, the
+% \enquote{starred} version of this command forces the page break,
+% irrespective of the values specified as page or line numbers.
 %
 % \paragraph{Using \texttt{maxentries}}
 % Another way\---should the edition text fall into the vicious circle
@@ -7675,28 +7678,33 @@ Sample text with a \textcolor{red}{word} in red.
 % 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\tmp@ln{%
-    \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}}}%
-  \def\tmp@pg{%
-    \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}}}%
-  \IfNoValueTF{#1}
-  {\ifnum
-    \pdf@strcmp{\@tmpmarg}{\tmp@ln} = 0
-    \pagebreak
-    \fi}
-  {\ifnum
-    \pdf@strcmp{\@tmpoarg}{\tmp@pg} = 0
-    \ifnum
-    \pdf@strcmp{\@tmpmarg}{\tmp@ln} = 0
-    \pagebreak
-    \fi
-    \fi
-  }\ignorespaces
+\NewDocumentCommand{\ekdpb}{s o m}{%
+  \IfBooleanTF{#1}
+  {\pagebreak}
+  {%
+    \def\@tmpoarg{#2}%
+    \def\@tmpmarg{#3}%
+    \luadirect{ekdosis.dolnlab(\luastringN{#3})}%
+    \linelabel{\luadirect{tex.sprint(ekdosis.getlnlab())}}%
+    \def\tmp@ln{%
+      \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}}}%
+    \def\tmp@pg{%
+      \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}}}%
+    \IfNoValueTF{#2}
+    {\ifnum
+      \pdf@strcmp{\@tmpmarg}{\tmp@ln} = 0
+      \pagebreak
+      \fi}
+    {\ifnum
+      \pdf@strcmp{\@tmpoarg}{\tmp@pg} = 0
+      \ifnum
+      \pdf@strcmp{\@tmpmarg}{\tmp@ln} = 0
+      \pagebreak
+      \fi
+      \fi
+    }%
+  }
+  \ignorespaces
 }
 %    \end{macrocode}
 % \end{macro}
-- 
cgit v1.2.3

