From c3c9975778ff2848e51f6debf733abe8ca930bd3 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 3 Nov 2022 03:05:14 +0000 Subject: CTAN sync 202211030305 --- macros/latex-dev/required/graphics/README.md | 2 +- macros/latex-dev/required/graphics/changes.txt | 10 + macros/latex-dev/required/graphics/color.pdf | Bin 212223 -> 212223 bytes macros/latex-dev/required/graphics/drivers.pdf | Bin 286459 -> 286459 bytes macros/latex-dev/required/graphics/epsfig.pdf | Bin 159997 -> 159997 bytes macros/latex-dev/required/graphics/graphics.pdf | Bin 303464 -> 303464 bytes macros/latex-dev/required/graphics/graphicx.pdf | Bin 240623 -> 240623 bytes macros/latex-dev/required/graphics/grfguide.pdf | Bin 330978 -> 330978 bytes macros/latex-dev/required/graphics/keyval.pdf | Bin 239589 -> 239589 bytes macros/latex-dev/required/graphics/lscape.pdf | Bin 155986 -> 155986 bytes macros/latex-dev/required/graphics/mathcolor.dtx | 231 +++++++++++------------ macros/latex-dev/required/graphics/mathcolor.pdf | Bin 476153 -> 474666 bytes macros/latex-dev/required/graphics/rotating.pdf | Bin 278408 -> 278331 bytes macros/latex-dev/required/graphics/rotex.pdf | Bin 172228 -> 172277 bytes macros/latex-dev/required/graphics/trig.pdf | Bin 199266 -> 199266 bytes 15 files changed, 122 insertions(+), 121 deletions(-) (limited to 'macros/latex-dev/required/graphics') diff --git a/macros/latex-dev/required/graphics/README.md b/macros/latex-dev/required/graphics/README.md index c30c8d390b..0705aac316 100644 --- a/macros/latex-dev/required/graphics/README.md +++ b/macros/latex-dev/required/graphics/README.md @@ -1,7 +1,7 @@ The LaTeX `graphics` bundle =========================== -Release 2022-11-01 pre-release 0 +Release 2023-05-01 pre-release 0 Overview -------- diff --git a/macros/latex-dev/required/graphics/changes.txt b/macros/latex-dev/required/graphics/changes.txt index 616f56230f..55dde0358f 100644 --- a/macros/latex-dev/required/graphics/changes.txt +++ b/macros/latex-dev/required/graphics/changes.txt @@ -8,6 +8,16 @@ are not part of the distribution. All changes above are only part of the development branch for the next release. ================================================================================ +######################### +# 2022-11-01 Release +######################### + +2022-07-25 Frank Mittelbach + + * mathcolor.dtx (section{The Implementation}): + Avoid ending an alignment cell prematurely when hitting an + & during scanning (gh/901) + ######################### # 2022-06-01 Release ######################### diff --git a/macros/latex-dev/required/graphics/color.pdf b/macros/latex-dev/required/graphics/color.pdf index de87111c77..60ff965219 100644 Binary files a/macros/latex-dev/required/graphics/color.pdf and b/macros/latex-dev/required/graphics/color.pdf differ diff --git a/macros/latex-dev/required/graphics/drivers.pdf b/macros/latex-dev/required/graphics/drivers.pdf index 1c82349c40..2ff5ce85cb 100644 Binary files a/macros/latex-dev/required/graphics/drivers.pdf and b/macros/latex-dev/required/graphics/drivers.pdf differ diff --git a/macros/latex-dev/required/graphics/epsfig.pdf b/macros/latex-dev/required/graphics/epsfig.pdf index d650f59d51..c7c77e4fc7 100644 Binary files a/macros/latex-dev/required/graphics/epsfig.pdf and b/macros/latex-dev/required/graphics/epsfig.pdf differ diff --git a/macros/latex-dev/required/graphics/graphics.pdf b/macros/latex-dev/required/graphics/graphics.pdf index 612c27318a..ff41a912d3 100644 Binary files a/macros/latex-dev/required/graphics/graphics.pdf and b/macros/latex-dev/required/graphics/graphics.pdf differ diff --git a/macros/latex-dev/required/graphics/graphicx.pdf b/macros/latex-dev/required/graphics/graphicx.pdf index 87e42ec86c..733330d537 100644 Binary files a/macros/latex-dev/required/graphics/graphicx.pdf and b/macros/latex-dev/required/graphics/graphicx.pdf differ diff --git a/macros/latex-dev/required/graphics/grfguide.pdf b/macros/latex-dev/required/graphics/grfguide.pdf index f487177b50..80e906d306 100644 Binary files a/macros/latex-dev/required/graphics/grfguide.pdf and b/macros/latex-dev/required/graphics/grfguide.pdf differ diff --git a/macros/latex-dev/required/graphics/keyval.pdf b/macros/latex-dev/required/graphics/keyval.pdf index 5628e90294..7bfca3934f 100644 Binary files a/macros/latex-dev/required/graphics/keyval.pdf and b/macros/latex-dev/required/graphics/keyval.pdf differ diff --git a/macros/latex-dev/required/graphics/lscape.pdf b/macros/latex-dev/required/graphics/lscape.pdf index f65e366770..3d8b3d5394 100644 Binary files a/macros/latex-dev/required/graphics/lscape.pdf and b/macros/latex-dev/required/graphics/lscape.pdf differ diff --git a/macros/latex-dev/required/graphics/mathcolor.dtx b/macros/latex-dev/required/graphics/mathcolor.dtx index 2341e71e28..5dc482e38e 100644 --- a/macros/latex-dev/required/graphics/mathcolor.dtx +++ b/macros/latex-dev/required/graphics/mathcolor.dtx @@ -14,8 +14,8 @@ %%% From File: mathcolor.dtx % % \begin{macrocode} -\def\mathcolorversion{v1.0b} -\def\mathcolordate{2022/01/28} +\def\mathcolorversion{v1.0c} +\def\mathcolordate{2022/07/25} % \end{macrocode} %<*driver> \documentclass{l3doc} @@ -39,9 +39,6 @@ % % % \fi - - - % % \title{Providing color in math\thanks{This file has version % \mathcolorversion\ dated \mathcolordate, \copyright\ \LaTeX\ @@ -124,7 +121,6 @@ % and achieve the same effect: % \[ \mathcolor{red}{\int}\limits_0^1 \textrm{ or } % \mathcolor{red}{\int\limits}_0^1 \] - % % % \MaybeStop{\setlength\IndexMin{200pt} \PrintIndex } @@ -163,7 +159,8 @@ % second argument (like \cs{textcolor}, but without spacing % problems in math). % \begin{macrocode} -\DeclareDocumentCommand \mathcolor { o m m } { +\DeclareDocumentCommand \mathcolor { o m m } + { % \end{macrocode} % The \cs{mathcolor} is only supported in math mode because in text % mode it has problems scanning away a space after it, for example. @@ -173,13 +170,13 @@ % math alphabets, but the message it gives is fine. % \changes{v1.0b}{2022/01/28}{Restrict command to math mode} % \begin{macrocode} - \mode_if_math:F { \non@alpherr {\mathcolor\space} } + \mode_if_math:F { \non@alpherr {\mathcolor\space} } % \end{macrocode} % First real action is to save the current color value on a stack % (needed if the command is nested or contains some further color % changes with \cs{color} inside). % \begin{macrocode} - \seq_gpush:No \g_@@_seq \current@color + \seq_gpush:No \g_@@_seq \current@color % \end{macrocode} % 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 @@ -189,7 +186,7 @@ % \cs{use_none:n} which gobbles the \cs{reset@color} added by % \cs{color} with \cs{aftergroup}. % \begin{macrocode} - \group_insert_after:N \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 @@ -197,11 +194,11 @@ % going low-level here is not an option as we need to support % different color packages and their internals are not identical. % \begin{macrocode} - \IfValueTF{#1} { \color[#1]{#2} }{ \color{#2} } + \IfValueTF {#1} { \color[#1]{#2} } { \color{#2} } % \end{macrocode} % Then comes the math material we want to see colored: % \begin{macrocode} - #3 + #3 % \end{macrocode} % After that we need to reset the color ourselves (without a group % that does it for us), i.e., popping the saved color from our @@ -209,8 +206,8 @@ % separate command (which in fact needs to be called several times, % so inlining the code wouldn't be possible. % \begin{macrocode} - \@@_scan_for_scripts:w -} + \@@_scan_for_scripts:w + } % \end{macrocode} % \end{macro} % @@ -223,29 +220,57 @@ % \cs{mathop} in which case the sub and superscripts may be % attached as \cs{limits} instead of after the material. All cases % need separate treatment. +% And we need to watch out for an upcoming \verb=&= and avoid +% prematurely triggering the end of an alignment cell. +% \changes{v1.0c}{2022/07/25}{Avoid ending an alignment cell +% prematurely when hitting an \texttt{\&} during +% scanning (gh/901)} % \begin{macrocode} -\cs_new_protected:Npn \@@_scan_for_scripts:w { +\cs_new_protected:Npn \@@_scan_for_scripts:w + { % \end{macrocode} -% We therefore first parse for a \cs{c_math_subscript_token} -% ignoring (dropping) any spaces and \cs{relax} as \TeX{} would -% do. We do this with expansion so that hidden sub or superscripts +% We need to look at what follows \cs{mathcolor}, and we need to do +% that ignoring (and dropping) any spaces and \cs{relax} as \TeX{} +% would do in normal math processing (for example before a subscript +% token). We do this with expansion so that hidden sub or superscripts % in macros are still found as long as the macros are expandable. % \begin{macrocode} - \@@_peek_catcode_ignore_filler_expand:NTF \c_math_subscript_token -% \end{macrocode} -% If we found that character we call a function that handles sub or -% superscripts. -% \begin{macrocode} - { \@@_handle_scripts:Nw } -% \end{macrocode} -% Otherwise check if this token we peeked at (which is now stored -% in \cs{l_peek_token} is a superscript token. -% \begin{macrocode} - { \token_if_math_superscript:NTF \l_peek_token -% \end{macrocode} -% If found we call the sub/superscript handler. -% \begin{macrocode} - { \@@_handle_scripts:Nw } + \peek_remove_filler:n + { +% \end{macrocode} +% To avoid problems hitting on \verb=&= we start with a +% \cs{group_align_safe_begin:}. That has to be ended with +% \cs{group_align_safe_end:} when the +% danger (aka scanning) is over, which, due to the branching below, happens at +% four different points, i.e., when the \cs{mathcolor} is +% \begin{enumerate} +% \item +% followed by a \enquote{normal} token; +% \item +% followed by a braced sub/superscript; +% \item +% followed by an unbraced sub/superscript; +% \item +% followed by one of the \cs{limits} primitives. +% \end{enumerate} +% In each case we have to end the align safe group and we mark the +% points below in the code for easy reference. +% \begin{macrocode} + \group_align_safe_begin: +% \end{macrocode} +% We first parse for \cs{c_math_subscript_token} or +% \cs{c_math_superscript_token}. +% After \cs{peek_remove_filler:n} is done, it sets \cs{l_peek_token} +% equal to the next non-filler token, so we can avoid unnecessary +% work and just compare that. If either of the tokens is found, call +% \cs{@@_handle_scripts:Nw}: +% \begin{macrocode} + \token_case_catcode:NnTF \l_peek_token + { + \c_math_subscript_token { } + \c_math_superscript_token { } + } + { \@@_handle_scripts:Nw } % \end{macrocode} % Otherwise we check if it was any of the limit operation % primitives. If that is the case, e.g., if we have a situation @@ -256,45 +281,59 @@ % we have to move it directly after the \cs{int} to ensure there % is no color reset between the operator and the \cs{limits} command. % \begin{macrocode} - { \token_case_meaning:NnTF \l_peek_token { - \limits { \limits } - \nolimits { \nolimits } - \displaylimits { \displaylimits } - } + \token_case_meaning:NnTF \l_peek_token + { + \limits { \limits } + \nolimits { \nolimits } + \displaylimits { \displaylimits } + } % \end{macrocode} % Once that is done, we have to get rid of the token we peeked at % 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. +% solution is to add \cs{use_none:n} in front of the peeked at +% token. +% +% Here we end the align safe group and +% \cs{@@_scan_for_scripts:w} will start a new one. % \begin{macrocode} - { \@@_scan_for_scripts:w \use_none:n } + { + \group_align_safe_end: % case 4 + \@@_scan_for_scripts:w \use_none:n + } % \end{macrocode} -% If it was one of these we look for a \texttt{'} and if found remove it and +% If it was not one of these we look for a \texttt{'} and if found remove it and % 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{expanded} or \cs{expandafter}. % \begin{macrocode} - { \peek_meaning_remove:NTF ' - { \@@_handle_scripts:Nw ^\c_group_begin_token \prim@s } + { + \token_if_eq_meaning:NNTF \l_peek_token ' + { + \@@_handle_scripts:Nw ^ + \c_group_begin_token + \exp_after:wN \prim@s \use_none:n + } % \end{macrocode} % If it is anything else we finish off which means we reset the % color (because we prevented that before to happen automatically % after the next group) and pop the color stack setting \cs{current@color}. % \begin{macrocode} - { \reset@color - \seq_gpop:NN \g_@@_seq \current@color - } + { + \group_align_safe_end: % case 1 + \reset@color + \seq_gpop:NN \g_@@_seq \current@color + } + } } } - } -} + } % \end{macrocode} % \end{macro} - - - +% +% % \begin{macro}{\@@_handle_scripts:Nw} % The tricky part of handling sub and superscripts is that we have % to reset color to the one that is on the stack but reset it back @@ -306,7 +345,8 @@ % sign, and superscript. So technically the superscript comes first % and the \cs{sum} that should get colored red is the middle. % \begin{macrocode} -\cs_new_protected:Npn \@@_handle_scripts:Nw #1 { +\cs_new_protected:Npn \@@_handle_scripts:Nw #1 + { % \end{macrocode} % The argument is either \verb=^= or \verb=_=, so we execute it and % explicitly open two \verb={= groups. We need two because color @@ -329,7 +369,7 @@ %\begin{verbatim} % \reset@color } \@@_scan_for_scripts:w %\end{verbatim} -% The \cs{_@@_scan_for_scripts:w} then retakes control and initiates +% The \cs{@@_scan_for_scripts:w} then retakes control and initiates % parsing for another sub or superscript. % \begin{macrocode} \group_insert_after:N \c_group_end_token @@ -341,76 +381,28 @@ % 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 } - }% \end{macrocode} -% \end{macro} - - -% \begin{macro}{\@@_handle_unbraced_script:N} -% All we have to do here is to add the final closing brace. -% \begin{macrocode} -\cs_new_protected:Npn \@@_handle_unbraced_script:N #1 { - #1 \c_group_end_token } -% \end{macrocode} -% \end{macro} -% -% -% -% \subsection{Utility function for the peek module} -% -% This peek is expanding and ignores spaces and \cs{relax} (even -% though the name doesn't say so) -% but \cs{relax} is usually allowed in such places where we so it -% may not be bad to have it in this way in general --- maybe this -% should move to expl3 peek functions (or otherwise the naming -% should perhaps be adjusted). -% -% -% \begin{macrocode} -\tl_new:N \l_@@_peek_tmp_tl -% \end{macrocode} -% -% \begin{macrocode} -\cs_new_protected:Npn \@@_peek_catcode_ignore_filler_expand:NTF #1#2#3 - { - \tl_set:Nn \l_@@_peek_tmp_tl - { \token_if_eq_catcode:NNTF \l_peek_token #1 {#2} {#3} } - \@@_peek_expand:w - } -% \end{macrocode} -% -% \begin{macrocode} -\cs_new_protected:Npn \@@_peek_expand:w - { - \exp_after:wN \peek_catcode_remove:NTF - \exp_after:wN \c_space_token - \exp_after:wN \@@_peek_test_expand:w - \exp_after:wN \@@_peek_test_relax:w - \exp:w \exp_end_continue_f:w - } -% \end{macrocode} +% to account for that: this is done in false branch by +% \cs{use_ii_i:nn}. % +% After scanning for a brace all scanning is done, so here are the +% other two points where we have to end the align safe group (in +% the true and false case). % \begin{macrocode} -\cs_new_protected:Npn \@@_peek_test_expand:w - { - \token_if_expandable:NTF \l_peek_token - { \@@_peek_expand:w } - { \l_@@_peek_tmp_tl } + \peek_remove_filler:n + { + \token_if_eq_meaning:NNTF \l_peek_token \c_group_begin_token + { + \group_align_safe_end: % case 2 + \peek_catcode_remove:NT \c_group_begin_token { } + } + { + \exp_after:wN \group_align_safe_end: % case 3 + \use_ii_i:nn \c_group_end_token + } + } } % \end{macrocode} -% -% \begin{macrocode} -\cs_new_protected:Npn \@@_peek_test_relax:w - { - \peek_meaning_remove:NTF \scan_stop: - { \@@_peek_expand:w } - { \@@_peek_test_expand:w } - } -% \end{macrocode} +% \end{macro} % % \begin{macrocode} %<@@=> @@ -424,7 +416,6 @@ % \Finale % % - %%%%%%%%%%%%%%%% \endinput %%%%%%%%%%%%%%%% diff --git a/macros/latex-dev/required/graphics/mathcolor.pdf b/macros/latex-dev/required/graphics/mathcolor.pdf index 64d2f93334..43e44ed186 100644 Binary files a/macros/latex-dev/required/graphics/mathcolor.pdf and b/macros/latex-dev/required/graphics/mathcolor.pdf differ diff --git a/macros/latex-dev/required/graphics/rotating.pdf b/macros/latex-dev/required/graphics/rotating.pdf index aad5f49c95..ab77c4b467 100644 Binary files a/macros/latex-dev/required/graphics/rotating.pdf and b/macros/latex-dev/required/graphics/rotating.pdf differ diff --git a/macros/latex-dev/required/graphics/rotex.pdf b/macros/latex-dev/required/graphics/rotex.pdf index 4dce5855b6..b6fe701a67 100644 Binary files a/macros/latex-dev/required/graphics/rotex.pdf and b/macros/latex-dev/required/graphics/rotex.pdf differ diff --git a/macros/latex-dev/required/graphics/trig.pdf b/macros/latex-dev/required/graphics/trig.pdf index 8a079345fc..e1df668772 100644 Binary files a/macros/latex-dev/required/graphics/trig.pdf and b/macros/latex-dev/required/graphics/trig.pdf differ -- cgit v1.2.3