summaryrefslogtreecommitdiff
path: root/macros/latex-dev/required/graphics/mathcolor.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex-dev/required/graphics/mathcolor.dtx')
-rw-r--r--macros/latex-dev/required/graphics/mathcolor.dtx16
1 files changed, 13 insertions, 3 deletions
diff --git a/macros/latex-dev/required/graphics/mathcolor.dtx b/macros/latex-dev/required/graphics/mathcolor.dtx
index 6ed53f8f61..2341e71e28 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.0a}
-\def\mathcolordate{2022/01/07}
+\def\mathcolorversion{v1.0b}
+\def\mathcolordate{2022/01/28}
% \end{macrocode}
%<*driver>
\documentclass{l3doc}
@@ -165,7 +165,17 @@
% \begin{macrocode}
\DeclareDocumentCommand \mathcolor { o m m } {
% \end{macrocode}
-% First action is to save the current color value on a stack
+% The \cs{mathcolor} is only supported in math mode because in text
+% mode it has problems scanning away a space after it, for example.
+% We therefore raise an error if it executes
+% anywhere else. The \LaTeXe{} error command is a
+% bit strangely named, because in the kernel it is only used for
+% 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} }
+% \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}