diff options
author | Karl Berry <karl@freefriends.org> | 2022-11-01 19:57:17 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-11-01 19:57:17 +0000 |
commit | cfd5d22753b4fdca36d85f59b8ba0e5d1e8a9ad0 (patch) | |
tree | 06d78cd6aa3bc8723a05ec9c682510ff774b3cef /Master/texmf-dist/tex/latex/graphics | |
parent | 820f14d57cd6b67d5793e43d5d1e4866a51ffaa7 (diff) |
latex2e 2022-11 (1nov22)
git-svn-id: svn://tug.org/texlive/trunk@64892 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/graphics')
-rw-r--r-- | Master/texmf-dist/tex/latex/graphics/mathcolor.ltx | 124 |
1 files changed, 59 insertions, 65 deletions
diff --git a/Master/texmf-dist/tex/latex/graphics/mathcolor.ltx b/Master/texmf-dist/tex/latex/graphics/mathcolor.ltx index c7588a3e195..6e9c12551ce 100644 --- a/Master/texmf-dist/tex/latex/graphics/mathcolor.ltx +++ b/Master/texmf-dist/tex/latex/graphics/mathcolor.ltx @@ -13,85 +13,79 @@ %% %% File: mathcolor.dtx (C) Copyright 2021-2022 %%% From File: mathcolor.dtx -\def\mathcolorversion{v1.0b} -\def\mathcolordate{2022/01/28} - - +\def\mathcolorversion{v1.0c} +\def\mathcolordate{2022/07/25} \ifcsname mathcolor\endcsname \endinput \fi \ExplSyntaxOn \seq_new:N \g__mathcolor_seq -\DeclareDocumentCommand \mathcolor { o m m } { - \mode_if_math:F { \non@alpherr {\mathcolor\space} } - \seq_gpush:No \g__mathcolor_seq \current@color - \group_insert_after:N \use_none:n - \IfValueTF{#1} { \color[#1]{#2} }{ \color{#2} } - #3 - \__mathcolor_scan_for_scripts:w -} -\cs_new_protected:Npn \__mathcolor_scan_for_scripts:w { - \__mathcolor_peek_catcode_ignore_filler_expand:NTF \c_math_subscript_token - { \__mathcolor_handle_scripts:Nw } - { \token_if_math_superscript:NTF \l_peek_token - { \__mathcolor_handle_scripts:Nw } - { \token_case_meaning:NnTF \l_peek_token +\DeclareDocumentCommand \mathcolor { o m m } + { + \mode_if_math:F { \non@alpherr {\mathcolor\space} } + \seq_gpush:No \g__mathcolor_seq \current@color + \group_insert_after:N \use_none:n + \IfValueTF {#1} { \color[#1]{#2} } { \color{#2} } + #3 + \__mathcolor_scan_for_scripts:w + } +\cs_new_protected:Npn \__mathcolor_scan_for_scripts:w + { + \peek_remove_filler:n + { + \group_align_safe_begin: + \token_case_catcode:NnTF \l_peek_token { - \limits { \limits } - \nolimits { \nolimits } - \displaylimits { \displaylimits } + \c_math_subscript_token { } + \c_math_superscript_token { } } - { \__mathcolor_scan_for_scripts:w \use_none:n } - { \peek_meaning_remove:NTF ' - { \__mathcolor_handle_scripts:Nw ^\c_group_begin_token \prim@s } - { \reset@color - \seq_gpop:NN \g__mathcolor_seq \current@color - } + { \__mathcolor_handle_scripts:Nw } + { + \token_case_meaning:NnTF \l_peek_token + { + \limits { \limits } + \nolimits { \nolimits } + \displaylimits { \displaylimits } + } + { + \group_align_safe_end: % case 4 + \__mathcolor_scan_for_scripts:w \use_none:n + } + { + \token_if_eq_meaning:NNTF \l_peek_token ' + { + \__mathcolor_handle_scripts:Nw ^ + \c_group_begin_token + \exp_after:wN \prim@s \use_none:n + } + { + \group_align_safe_end: % case 1 + \reset@color + \seq_gpop:NN \g__mathcolor_seq \current@color + } + } } } - } -} - -\cs_new_protected:Npn \__mathcolor_handle_scripts:Nw #1 { + } +\cs_new_protected:Npn \__mathcolor_handle_scripts:Nw #1 + { #1 \c_group_begin_token \c_group_begin_token \seq_get:NN \g__mathcolor_seq \current@color \set@color \group_insert_after:N \c_group_end_token \group_insert_after:N \__mathcolor_scan_for_scripts:w - \__mathcolor_peek_catcode_ignore_filler_expand:NTF \c_group_begin_token - { \peek_catcode_remove:NT \c_group_begin_token { } } - { \__mathcolor_handle_unbraced_script:N } - }% \end{macrocode} - -\cs_new_protected:Npn \__mathcolor_handle_unbraced_script:N #1 { - #1 \c_group_end_token } -\tl_new:N \l__mathcolor_peek_tmp_tl -\cs_new_protected:Npn \__mathcolor_peek_catcode_ignore_filler_expand:NTF #1#2#3 - { - \tl_set:Nn \l__mathcolor_peek_tmp_tl - { \token_if_eq_catcode:NNTF \l_peek_token #1 {#2} {#3} } - \__mathcolor_peek_expand:w - } -\cs_new_protected:Npn \__mathcolor_peek_expand:w - { - \exp_after:wN \peek_catcode_remove:NTF - \exp_after:wN \c_space_token - \exp_after:wN \__mathcolor_peek_test_expand:w - \exp_after:wN \__mathcolor_peek_test_relax:w - \exp:w \exp_end_continue_f:w - } -\cs_new_protected:Npn \__mathcolor_peek_test_expand:w - { - \token_if_expandable:NTF \l_peek_token - { \__mathcolor_peek_expand:w } - { \l__mathcolor_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 + } + } } -\cs_new_protected:Npn \__mathcolor_peek_test_relax:w - { - \peek_meaning_remove:NTF \scan_stop: - { \__mathcolor_peek_expand:w } - { \__mathcolor_peek_test_expand:w } - } \ExplSyntaxOff - %%%%%%%%%%%%%%%% \endinput %% |