[latex3-commits] [git/LaTeX3-latex3-latex2e] everymath: Simplify and combine booleans (31dd285b)
Joseph Wright
joseph.wright at morningstar2.co.uk
Sun Dec 11 21:23:58 CET 2022
Repository : https://github.com/latex3/latex2e
On branch : everymath
Link : https://github.com/latex3/latex2e/commit/31dd285b8071a2c3e6281481bcf0e41437a7abee
>---------------------------------------------------------------
commit 31dd285b8071a2c3e6281481bcf0e41437a7abee
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Sun Dec 11 20:17:58 2022 +0000
Simplify and combine booleans
>---------------------------------------------------------------
31dd285b8071a2c3e6281481bcf0e41437a7abee
required/latex-lab/latex-lab-everymath.dtx | 51 +++++++++++-------------------
1 file changed, 19 insertions(+), 32 deletions(-)
diff --git a/required/latex-lab/latex-lab-everymath.dtx b/required/latex-lab/latex-lab-everymath.dtx
index 81765450..5a7a3d2e 100644
--- a/required/latex-lab/latex-lab-everymath.dtx
+++ b/required/latex-lab/latex-lab-everymath.dtx
@@ -71,7 +71,7 @@
% \subsection{File declaration}
% \begin{macrocode}
\ProvidesFile{latex-lab-everymath.ltx}
- [2022-12-09 v0.1a Grab all the math(s)]
+ [2022-12-11 v0.1a Grab all the math(s)]
% \end{macrocode}
%
% \begin{macrocode}
@@ -98,24 +98,11 @@
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_@@_inner_bool}
-% Tracks if we are inside a top-level inline math context.
+% \begin{variable}{\l_@@_collected_bool}
+% Tracks if math mode material has been collected, which happens inside
+% \pkg{amsmath} environments as well as those handled directly here.
% \begin{macrocode}
-\bool_new:N \l_@@_inner_bool
-% \end{macrocode}
-% \end{variable}
-%
-% \begin{variable}{\l_@@_display_bool}
-% Tracks display style (cases where \cs{everydisplay} is triggered).
-% \begin{macrocode}
-\bool_new:N \l_@@_display_bool
-% \end{macrocode}
-% \end{variable}
-%
-% \begin{variable}{\l_@@_env_bool}
-% Tracks math environments which deal with grabbing themselves.
-% \begin{macrocode}
-\bool_new:N \l_@@_env_bool
+\bool_new:N \l_@@_collected_bool
% \end{macrocode}
% \end{variable}
%
@@ -229,7 +216,7 @@
\cs_new_eq:NN \@@_equation_end: \endequation
\RenewDocumentEnvironment { equation } { b }
{
- \bool_set_true:N \l_@@_env_bool
+ \bool_set_true:N \l_@@_collected_bool
\@@_process:n {#1}
\@@_equation_begin: #1 \@@_equation_end:
}
@@ -238,7 +225,7 @@
\cs_new_eq:Nc \@@_equation_star_end: { endequation* }
\RenewDocumentEnvironment { equation* } { b }
{
- \bool_set_true:N \l_@@_env_bool
+ \bool_set_true:N \l_@@_collected_bool
\@@_process:n {#1}
\@@_equation_star_begin: #1 \@@_equation_star_end:
}
@@ -257,13 +244,13 @@
{
\cs_gset_protected:Npn \[ % \]
{
- \bool_if:NTF \l_@@_env_bool
+ \bool_if:NTF \l_@@_collected_bool
{ \begin { equation* } }
{ \@@_grab_eqn:w }
} % \[
\cs_gset_protected:Npn \]
{
- \bool_if:NTF \l_@@_env_bool
+ \bool_if:NTF \l_@@_collected_bool
{ \end{ equation* } }
{ \@badmath }
}
@@ -282,11 +269,9 @@
\exp_args:No \tex_everymath:D
{
\tex_the:D \tex_everymath:D
- \bool_lazy_or:nnF
- { \l_@@_inner_bool }
- { \l_@@_display_bool }
+ \bool_if:NF \l_@@_collected_bool
{
- \bool_set_true:N \l_@@_inner_bool
+ \bool_set_true:N \l_@@_collected_bool
\bool_if:NTF \l_@@_cmd_bool
{ \@@_grab_inline_cmd:w }
{ \@@_grab_inline_dollar:w }
@@ -295,9 +280,11 @@
\exp_args:No \tex_everydisplay:D
{
\tex_the:D \tex_everydisplay:D
- \bool_set_true:N \l_@@_display_bool
- \bool_if:NF \l_@@_env_bool
- { \@@_grab_dollardollar:w }
+ \bool_if:NF \l_@@_collected_bool
+ {
+ \bool_set_true:N \l_@@_collected_bool
+ \@@_grab_dollardollar:w
+ }
}
% \end{macrocode}
%
@@ -309,9 +296,9 @@
{ align , aligned , gather , gathered }
{
\AddToHook{ env / #1 / begin }
- { \bool_set_true:N \l_@@_env_bool }
+ { \bool_set_true:N \l_@@_collected_bool }
\AddToHook{ env / #1* / begin }
- { \bool_set_true:N \l_@@_env_bool }
+ { \bool_set_true:N \l_@@_collected_bool }
}
% \end{macrocode}
%
@@ -336,7 +323,7 @@
{ tabular }
{
\AddToHook{ env / #1 / begin }
- { \bool_set_true:N \l_@@_inner_bool }
+ { \bool_set_true:N \l_@@_collected_bool }
}
% \end{macrocode}
%
More information about the latex3-commits
mailing list.