[latex3-commits] [git/LaTeX3-latex3-latex2e] mathcolor: Minor adjustments (f517b614)

PhelypeOleinik phelype.oleinik at latex-project.org
Tue Jan 11 14:52:57 CET 2022


Repository : https://github.com/latex3/latex2e
On branch  : mathcolor
Link       : https://github.com/latex3/latex2e/commit/f517b614994b0cc546a7ea60634f175d7eb0f015

>---------------------------------------------------------------

commit f517b614994b0cc546a7ea60634f175d7eb0f015
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date:   Tue Jan 11 10:52:57 2022 -0300

    Minor adjustments


>---------------------------------------------------------------

f517b614994b0cc546a7ea60634f175d7eb0f015
 base/doc/ltnews35.tex           |  2 +-
 required/graphics/mathcolor.dtx | 36 +++++++++++++++++-------------------
 2 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/base/doc/ltnews35.tex b/base/doc/ltnews35.tex
index d97201b4..91a77802 100644
--- a/base/doc/ltnews35.tex
+++ b/base/doc/ltnews35.tex
@@ -468,7 +468,7 @@ color a certain part of a formula, for example, an opening symbol such
 as \verb=\left(= but not the corresponding \verb=\right)=.
 
 We have therefore added the command \cs{mathcolor} to the \pkg{color}
-and \pkg{xcolor} pachage, which has the same syntax as \cs{textcolor},
+and \pkg{xcolor} package, which has the same syntax as \cs{textcolor},
 but is specially designed for use in math and handles sub and
 superscripts and other aspects correctly and preserves correct
 spacing. Thus, the above example can now be written as
diff --git a/required/graphics/mathcolor.dtx b/required/graphics/mathcolor.dtx
index a0ea614c..6ed53f8f 100644
--- a/required/graphics/mathcolor.dtx
+++ b/required/graphics/mathcolor.dtx
@@ -100,13 +100,13 @@
 % \begin{syntax}
 %   \cs{mathcolor} \oarg{model} \Arg{color-spec} \Arg{math material}
 % \end{syntax}
-%    If has the same arguments as \cs{textcolor} but is intended for
-%    use in formula.The command does not generate a group and the
+%    It has the same arguments as \cs{textcolor} but is intended for
+%    use in formulas. The command does not generate a group and the
 %    \meta{math material} retains its math atom states and it correctly
 %    handles sub and superscripts that follow.
 % \end{function}
 %
-%    The command can also be use to color a single opening or closing
+%    The command can also be used to color a single opening or closing
 %    symbol, e.g., the correct input to our earlier example is
 %\begin{verbatim}
 %    \[  \left\{ \frac{1}{2} \mathcolor{red}{\right\}} \]
@@ -133,7 +133,7 @@
 % \section{The Implementation}
 %
 %    The code is called inside of the \pkg{color} or \pkg{xcolor}
-%    package, so \texttt{@} is already a letter, but the 
+%    packages, so \texttt{@} is already a letter, but the
 %    coding here is done in the L3 programming layer, so we need to
 %    activate that. But first we check if this file was loaded before,
 %    e.g., when both \pkg{color} and \pkg{xcolor} are in the preamble
@@ -171,19 +171,19 @@
 %    \begin{macrocode}
   \seq_gpush:No \g_@@_seq \current at color
 %    \end{macrocode}
-%    The we switch to the new color, but we do not want to reset the
+%    Then we switch to the new color, but we do not want to reset the
 %    color after the group (which is done by \cs{color} using
 %    \cs{aftergroup}\cs{reset at color}). The best solution here would be
 %    if the color packages  would provide a command doing just the
 %    color switching, but for now we simply undo that part by pushing
-%    \cs{use_none:n} which gobbles\cs{reset at color} added by \cs{color}
-%    with \cs{aftergroup}.
+%    \cs{use_none:n} which gobbles the \cs{reset at color} added by
+%    \cs{color} with \cs{aftergroup}.
 %    \begin{macrocode}
-  \aftergroup \use_none:n
+  \group_insert_after:N \use_none:n
 %    \end{macrocode}
 %    Switching the color is also slightly suboptimal, because
 %    depending on whether or not we have a \meta{model} argument, we
-%    have to call \cs{color} with or without optional argument. But
+%    have to call \cs{color} with or without the optional argument. But
 %    going low-level here is not an option as we need to support
 %    different color packages and their internals are not identical.
 %    \begin{macrocode}
@@ -254,8 +254,8 @@
           }
 %    \end{macrocode}
 %    Once that is done, we have to get rid of the token we peeked at
-%    and them restart scanning for sub or superscripts. Given that
-%    \cs{_@@_scan_for_scripts:w} expands while scanning the simplest
+%    and then restart scanning for sub or superscripts. Given that
+%    \cs{@@_scan_for_scripts:w} expands while scanning the simplest
 %    solution is to add \cs{use_none:n} in front of the peeked at token.
 %    \begin{macrocode}
           { \@@_scan_for_scripts:w \use_none:n }
@@ -264,7 +264,7 @@
 %    replace it by its expansion. The reason we have to do this (and
 %    not rely on the earlier peeking to expand for us is the fact
 %    that \texttt{'} is only ``math active'' and that doesn't expand
-%    under \cs{expand} or \cs{expandafter}.
+%    under \cs{expanded} or \cs{expandafter}.
 %    \begin{macrocode}
           { \peek_meaning_remove:NTF '
             { \@@_handle_scripts:Nw ^\c_group_begin_token \prim at s }
@@ -322,22 +322,20 @@
 %    The \cs{_@@_scan_for_scripts:w} then retakes control and initiates
 %    parsing for another sub or superscript.
 %    \begin{macrocode}
-    \aftergroup \c_group_end_token
-    \aftergroup \@@_scan_for_scripts:w
+    \group_insert_after:N \c_group_end_token
+    \group_insert_after:N \@@_scan_for_scripts:w
 %    \end{macrocode}
 %    Before we give control to \TeX{} to process the sub or
 %    superscript some final adjustment is necessary: if the input was
-%    \verb=^{...}= then we have on \verb={= too many, because we
+%    \verb=^{...}= then we have one \verb={= too many, because we
 %    already supplied the outer one already. In that case we drop
 %    it. Otherwise we have an unbraced single token sub or superscript
 %    which means we are missing a closing \verb=}= at the end and need
 %    to account for that: this is done in \cs{_@@_handle_unbraced_script:N}.
 %    \begin{macrocode}
     \@@_peek_catcode_ignore_filler_expand:NTF \c_group_begin_token
-         {
-           \peek_catcode_remove:NT \c_group_begin_token { }
-         }
-         { \@@_handle_unbraced_script:N }
+      { \peek_catcode_remove:NT \c_group_begin_token { } }
+      { \@@_handle_unbraced_script:N }
   }%    \end{macrocode}
 %  \end{macro}
 





More information about the latex3-commits mailing list.