| 1 |
%% |
| 2 |
%% This is file `mathcolor.ltx', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% mathcolor.dtx (with options: `code') |
| 8 |
%% |
| 9 |
%% The source is maintained by the LaTeX Project team and bug |
| 10 |
%% reports for it can be opened at https://latex-project.org/bugs/ |
| 11 |
%% (but please observe conditions on bug reports sent to that address!) |
| 12 |
%% |
| 13 |
%% |
| 14 |
%% File: mathcolor.dtx (C) Copyright 2021-2022 |
| 15 |
%%% From File: mathcolor.dtx |
| 16 |
\def\mathcolorversion{v1.0c} |
| 17 |
\def\mathcolordate{2022/07/25} |
| 18 |
\ifcsname mathcolor\endcsname \endinput \fi |
| 19 |
\ExplSyntaxOn |
| 20 |
\seq_new:N \g__mathcolor_seq |
| 21 |
\DeclareDocumentCommand \mathcolor { o m m } |
| 22 |
{ |
| 23 |
\mode_if_math:F { \non@alpherr {\mathcolor\space} } |
| 24 |
\seq_gpush:No \g__mathcolor_seq \current@color |
| 25 |
\group_insert_after:N \use_none:n |
| 26 |
\IfValueTF {#1} { \color[#1]{#2} } { \color{#2} } |
| 27 |
#3 |
| 28 |
\__mathcolor_scan_for_scripts:w |
| 29 |
} |
| 30 |
\cs_new_protected:Npn \__mathcolor_scan_for_scripts:w |
| 31 |
{ |
| 32 |
\peek_remove_filler:n |
| 33 |
{ |
| 34 |
\group_align_safe_begin: |
| 35 |
\token_case_catcode:NnTF \l_peek_token |
| 36 |
{ |
| 37 |
\c_math_subscript_token { } |
| 38 |
\c_math_superscript_token { } |
| 39 |
} |
| 40 |
{ \__mathcolor_handle_scripts:Nw } |
| 41 |
{ |
| 42 |
\token_case_meaning:NnTF \l_peek_token |
| 43 |
{ |
| 44 |
\limits { \limits } |
| 45 |
\nolimits { \nolimits } |
| 46 |
\displaylimits { \displaylimits } |
| 47 |
} |
| 48 |
{ |
| 49 |
\group_align_safe_end: % case 4 |
| 50 |
\__mathcolor_scan_for_scripts:w \use_none:n |
| 51 |
} |
| 52 |
{ |
| 53 |
\token_if_eq_meaning:NNTF \l_peek_token ' |
| 54 |
{ |
| 55 |
\__mathcolor_handle_scripts:Nw ^ |
| 56 |
\c_group_begin_token |
| 57 |
\exp_after:wN \prim@s \use_none:n |
| 58 |
} |
| 59 |
{ |
| 60 |
\group_align_safe_end: % case 1 |
| 61 |
\reset@color |
| 62 |
\seq_gpop:NN \g__mathcolor_seq \current@color |
| 63 |
} |
| 64 |
} |
| 65 |
} |
| 66 |
} |
| 67 |
} |
| 68 |
\cs_new_protected:Npn \__mathcolor_handle_scripts:Nw #1 |
| 69 |
{ |
| 70 |
#1 \c_group_begin_token \c_group_begin_token |
| 71 |
\seq_get:NN \g__mathcolor_seq \current@color |
| 72 |
\set@color |
| 73 |
\group_insert_after:N \c_group_end_token |
| 74 |
\group_insert_after:N \__mathcolor_scan_for_scripts:w |
| 75 |
\peek_remove_filler:n |
| 76 |
{ |
| 77 |
\token_if_eq_meaning:NNTF \l_peek_token \c_group_begin_token |
| 78 |
{ |
| 79 |
\group_align_safe_end: % case 2 |
| 80 |
\peek_catcode_remove:NT \c_group_begin_token { } |
| 81 |
} |
| 82 |
{ |
| 83 |
\exp_after:wN \group_align_safe_end: % case 3 |
| 84 |
\use_ii_i:nn \c_group_end_token |
| 85 |
} |
| 86 |
} |
| 87 |
} |
| 88 |
\ExplSyntaxOff |
| 89 |
%%%%%%%%%%%%%%%% |
| 90 |
\endinput |
| 91 |
%% |
| 92 |
%% End of file `mathcolor.ltx'. |