[latex3-commits] [git/LaTeX3-latex3-latex3] l3text: Strip spaces for Unimath purification (54dabec19)

Joseph Wright joseph.wright at morningstar2.co.uk
Sun Dec 15 20:47:57 CET 2019


Repository : https://github.com/latex3/latex3
On branch  : l3text
Link       : https://github.com/latex3/latex3/commit/54dabec19d89e760aefada09f4e578352b734910

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

commit 54dabec19d89e760aefada09f4e578352b734910
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Sun Dec 15 19:47:57 2019 +0000

    Strip spaces for Unimath purification
    
    We will need to insert spaces with some control:
    stripping out any stray one makes sense.


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

54dabec19d89e760aefada09f4e578352b734910
 l3kernel/l3text.dtx | 33 +++++----------------------------
 1 file changed, 5 insertions(+), 28 deletions(-)

diff --git a/l3kernel/l3text.dtx b/l3kernel/l3text.dtx
index 710f7c83f..ba4e68542 100644
--- a/l3kernel/l3text.dtx
+++ b/l3kernel/l3text.dtx
@@ -3180,10 +3180,7 @@
 % \end{macro}
 %
 % \begin{macro}[rEXP]{\text_purify_math_unicode:n}
-% \begin{macro}[rEXP]{\@@_purify_unimath_loop:w}
-% \begin{macro}[rEXP]{\@@_purify_unimath_space:w}
-% \begin{macro}[rEXP]{\@@_purify_unimath_group:n}
-% \begin{macro}[rEXP]{\@@_purify_unimath_N_type:N}
+% \begin{macro}[rEXP]{\@@_purify_unimath_loop:nw}
 % \begin{macro}[rEXP]{\@@_purify_unimath_chars:nn}
 % \begin{macro}[rEXP]
 %   {
@@ -3239,32 +3236,15 @@
 %
 %   As with the other math mode loops, we start off in the standard way.
 %   Here, we have to track which math font is active, so there is an
-%   \texttt{n}-type argument to pass.
+%   \texttt{n}-type argument to pass. As spaces need to be tided up, it
+%   is easiest to use a faster loop than usual. However, there is a need
+%   to know the nature of the end-of-loop, so it is done manually.
 %    \begin{macrocode}
 \cs_new:Npn \text_purify_math_unicode:n #1
   {
     \@@_purify_unimath_loop:nw { normal } #1
       \q_recursion_tail \q_recursion_stop
   }
-\cs_new:Npn \@@_purify_unimath_loop:nw #1#2 \q_recursion_stop
-  {
-    \tl_if_head_is_N_type:nTF {#2}
-      { \@@_purify_unimath_N_type:nN }
-      {
-        \tl_if_head_is_group:nTF {#2}
-          { \@@_purify_unimath_group:nn }
-          { \@@_purify_unimath_space:nw }
-      }
-    {#1} #2 \q_recursion_stop
-  }
-\exp_after:wN \cs_new:Npn \exp_after:wN \@@_purify_unimath_space:nw
-  \exp_after:wN # \exp_after:wN 1 \c_space_tl
-  {
-    \c_space_tl
-    \@@_purify_unimath_loop:nw {#1}
-  }
-\cs_new:Npn \@@_purify_unimath_group:nn #1#2
-  { \@@_purify_unimath_loop:nw {#1} #2 }
 %    \end{macrocode}
 %   For \texttt{N}-type arguments, we first look for the cases that
 %   follow font choice. Those can be both chars and control sequences,
@@ -3273,7 +3253,7 @@
 %   mappings: again, these could be chars such as |-| or commands.
 %   Only if none of these apply do we split into two paths.
 %    \begin{macrocode}
-\cs_new:Npn \@@_purify_unimath_N_type:nN #1#2
+\cs_new:Npn \@@_purify_unimath_loop:nw #1#2
   {
     \quark_if_recursion_tail_stop:N #2
     \cs_if_exist:cTF
@@ -3507,9 +3487,6 @@
 % \end{macro}
 % \end{macro}
 % \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
 % \begin{macro}[rEXP]{\@@_purify_unimath_accent:nNn}
 % \begin{macro}[rEXP]
 %   {





More information about the latex3-commits mailing list