[latex3-commits] [git/LaTeX3-latex3-latex2e] math-tagging-experiments: addversion with comments by Chris (a256cbb5)
Frank Mittelbach
frank.mittelbach at latex-project.org
Tue Feb 28 11:25:49 CET 2023
Repository : https://github.com/latex3/latex2e
On branch : math-tagging-experiments
Link : https://github.com/latex3/latex2e/commit/a256cbb5507584638314ee573263d42992ba4b58
>---------------------------------------------------------------
commit a256cbb5507584638314ee573263d42992ba4b58
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date: Tue Feb 28 11:25:49 2023 +0100
addversion with comments by Chris
>---------------------------------------------------------------
a256cbb5507584638314ee573263d42992ba4b58
required/latex-lab/latex-lab-mathcapture.dtx | 102 ++++++++++++++++++++++++++-
1 file changed, 101 insertions(+), 1 deletion(-)
diff --git a/required/latex-lab/latex-lab-mathcapture.dtx b/required/latex-lab/latex-lab-mathcapture.dtx
index 4c9b6f22..13bf12cc 100644
--- a/required/latex-lab/latex-lab-mathcapture.dtx
+++ b/required/latex-lab/latex-lab-mathcapture.dtx
@@ -62,6 +62,8 @@
% \tableofcontents
%
% \section{Introduction}
+% \car*{Todo: update all the documentation! Both here and
+% (what little there is!) in the implementation section.}
%
% This file implements capture of all math mode material at the outer
% level, i.e., a formula is captured in its entirety with inner text
@@ -117,7 +119,61 @@
% \end{itemize}
% \end{function}
%
-% \MaybeStop{\setlength\IndexMin{200pt} \PrintIndex }
+% \section{Known current bugs, etc.}
+% \car*{New Section, now with subsections.\\
+% As indicated, these lists are probably incomplete.\\
+% Some of these have been addressed in a more recent branch.}
+%
+% \subsection{Capture/grabbing problems}
+%
+% \begin{enumerate}
+% \item Incorrect grabbing of |$|-math when there is also
+% explicit |$|-math within a \textit{text environment}
+% that is itself within the math that should all be grabbed.
+% \item Similar incorrect grabbing with |$$| also.
+% \item The grabbing, for all the display environments (and |\) \]|), needs
+% to deal with nesting: \pkg{amsmath} contains code for this.
+% \item
+% \end{enumerate}
+%
+% \subsection{Other problems}
+%
+% \begin{enumerate}
+% \item
+% The presence of \cs{m at th} in association with \cs{ensuremath}
+% does not necessarily indicate fakemath. This is because
+% wanting mathsurround to be zero is very reasonable and common,
+% \emph{even when the math is genuine} (and hence needs to be collected).
+% \item User-defined environments can create problems; but this area, of
+% new, copied and changed environments, has not yet been developed.
+%
+% \car*{Joseph wrote, inter alia:\\
+% My thinking [regarding] \cs{RegisterMathEnvironment}\\
+% - (New) Math environments should not be created-then-patched, but only
+% generated by a [(future)] dedicated command (\cs{DeclareMathEnviornment},
+% presumably)\\
+% - Math environments created with \pkg{ltcmd} [commands] should not be copied, . . .\\
+% - Package authors should be able to manually set up math environments with a public boolean.}
+%
+% \item
+% \end{enumerate}
+%
+%
+% \subsection{Other ToDos}
+%
+% \begin{enumerate}
+% \item Add (some of) the math display commands that were \enquote{lifted from
+% plain}, e.g., \cs{displaylines} \cs{eqalign}(??).
+ \item
+% \end{enumerate}
+%
+%
+% \car*{\cs{MaybeStop} (temporarily) not executed, as it is unknown on Chris' system.}
+% \iffalse
+% \MaybeStop{\setlength\IndexMin{200pt} \PrintIndex }
+% \else
+% \StopEventually{\setlength\IndexMin{200pt} \PrintIndex }
+% \fi
%
% \section{The Implementation}
%
@@ -130,6 +186,8 @@
% \end{macrocode}
%
% \subsection{File declaration}
+%
+% \car{Change description here?}
% \begin{macrocode}
\ProvidesFile{latex-lab-mathcapture.ltx}
[2023-01-31 v0.2a Grab all the math(s)]
@@ -149,16 +207,25 @@
{ \RequirePackage { amsmath } }
% \end{macrocode}
%
+%
% \subsection{Data structures}
%
+%
+% \car{if $=>$ whether, below}
+%
% \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_@@_collected_bool
% \end{macrocode}
% \end{variable}
%
+% \car{Change first tl name below: `env' $=>$ `info'?\\
+% Or do we need an extra storage tl?}
+%
% \begin{variable}{\g_@@_grabbed_env_tl, \g_@@_grabbed_math_tl}
% \begin{macrocode}
\tl_new:N \g_@@_grabbed_env_tl
@@ -205,6 +272,17 @@
% \begin{macro}{\@@_grab_dollar:w}
% Grab up to a single |$|, for inline math mode, suppressing
% any processing if the first token is \tn{m at th}.
+%
+% \fmi{what's that test doing?}
+%
+% \car{It is some kind of fix, to avoid the remote
+% possibility that the math is empty, making the code
+% produce an unwanted \texttt{\$\$}.}
+%
+%\car{cf.~the code for this in \cs{@ensuredmath}}
+
+%\car{It is harmless but unnecessary in the dollardollar grabbing below.}
+%
% \begin{macrocode}
\cs_new_protected:Npn \@@_grab_dollar:w % $
#1 $
@@ -232,6 +310,7 @@
% \end{macrocode}
% \end{macro}
%
+%
% \begin{macro}{\@@_grab_inline:w}
% Collect inline math content and deal with the need to move to math mode.
% \begin{macrocode}
@@ -290,7 +369,9 @@
% \begin{macro}{\math_register_env:n}
% \begin{macro}{\RegisterMathEnvironment}
% Set up to capture environment content and make available.
+%
% \begin{macrocode}
+%
\cs_new_protected:Npn \math_register_env:nn #1#2
{
\tl_set:Nn \l_@@_env_name_tl {#1}
@@ -330,6 +411,11 @@
%
% \subsection{Document commands}
%
+% \car*{Add one more here: \texttt{displaymath}, which
+% is equivalent to \cs{[} , \cs{]}\\
+% and hence to the basic \texttt{equation*}.\\
+% Added in more recent branch.}
+%
% \begin{macro}
% {\equation, \@@_equation_begin:, \equation*, \@@_equation_star_begin:}
% \begin{macro}
@@ -337,6 +423,11 @@
% These environments are not set up by \pkg{amsmath} to collect their body,
% so we do that here. This has to be done \emph{after} we can be sure
% \pkg{amsmath} is loaded.
+%
+% \car*{Note that with \pkg{amsmath} loaded, \texttt{equation*} and \texttt{equation}\\
+% are the two basics: they are used to define the other single-row\\
+% display environments, etc.}
+%
% \begin{macrocode}
\tl_gput_right:Nn \@kernel at before@begindocument
{
@@ -399,8 +490,15 @@
% \end{macrocode}
% \end{macro}
%
+%
% \begin{macro}{\ensuremath}
% A bit of nesting fun to make sure we collect only if required.
+% \fmi{why does ensuremath need handling at all?}
+%
+% \car{Indeed! Currently, this is setup to process the math that
+% it has anyways already captured as its argument; thus it is more
+% efficient than leaving the capture to be repeated by the \cs{everymath}}
+%
% \begin{macrocode}
\cs_gset_protected:Npn \ensuremath #1
{
@@ -541,3 +639,5 @@
%
% \Finale
%
+%
+
More information about the latex3-commits
mailing list.