summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3kernel/l3flag.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/l3kernel/l3flag.dtx')
-rw-r--r--macros/latex/contrib/l3kernel/l3flag.dtx26
1 files changed, 25 insertions, 1 deletions
diff --git a/macros/latex/contrib/l3kernel/l3flag.dtx b/macros/latex/contrib/l3kernel/l3flag.dtx
index bbc4453f05..98f74360d0 100644
--- a/macros/latex/contrib/l3kernel/l3flag.dtx
+++ b/macros/latex/contrib/l3kernel/l3flag.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2023-04-20}
+% \date{Released 2023-05-05}
%
% \maketitle
%
@@ -152,6 +152,14 @@
% The \meta{flag}'s height is increased by $1$ locally.
% \end{function}
%
+% \begin{function}[EXP, added = 2023-04-25]{\flag_ensure_raised:n}
+% \begin{syntax}
+% \cs{flag_ensure_raised:n} \Arg{flag name}
+% \end{syntax}
+% Ensures the \meta{flag} is raised by making its height at least~$1$,
+% locally.
+% \end{function}
+%
% \end{documentation}
%
% \begin{implementation}
@@ -299,6 +307,22 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}[EXP]{\flag_ensure_raised:n}
+% It might be faster to just call the \enquote{trap} function in all
+% cases but conceptually the function name suggests we should only run
+% it if the flag is zero in case the \enquote{trap} made customizable
+% in the future.
+% \begin{macrocode}
+\cs_new:Npn \flag_ensure_raised:n #1
+ {
+ \if_cs_exist:w flag~#1~0 \cs_end:
+ \else:
+ \cs:w flag~#1 \cs_end: 0 ;
+ \fi:
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macrocode}
%</package>
% \end{macrocode}