summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/xcolor/xcolor.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/xcolor/xcolor.dtx')
-rw-r--r--macros/latex/contrib/xcolor/xcolor.dtx51
1 files changed, 32 insertions, 19 deletions
diff --git a/macros/latex/contrib/xcolor/xcolor.dtx b/macros/latex/contrib/xcolor/xcolor.dtx
index 8162c8f863..e6b5129012 100644
--- a/macros/latex/contrib/xcolor/xcolor.dtx
+++ b/macros/latex/contrib/xcolor/xcolor.dtx
@@ -2,7 +2,7 @@
%%
%% ----------------------------------------------------------------
%% Copyright (C) 2003-2021 by Dr. Uwe Kern <xcolor at ukern dot de>
-%% 2021 LaTeX Project https://github.com/latex3/xcolor/issues
+%% 2021-2022 LaTeX Project https://github.com/latex3/xcolor/issues
%% ----------------------------------------------------------------
%%
%<*package>
@@ -18,8 +18,8 @@
%%
%</package>
%<*extract|driver|test1|test2|test3|test4>
-\def\XCfileversion{v2.13}%
-\def\XCfiledate{2021/10/31}%
+\def\XCfileversion{v2.14}%
+\def\XCfiledate{2022/06/12}%
%</extract|driver|test1|test2|test3|test4>
%
% This file may be distributed and/or modified under the
@@ -34,7 +34,6 @@
%
% \fi
%
-% \CheckSum{4864}
%
% \DoNotIndex{\def,\gdef,\edef,\xdef,\long,\let}
% \DoNotIndex{\ifnum,\ifdim,\iftrue,\iffalse,\ifx,\ifcase,\else,\or,\fi}
@@ -100,15 +99,18 @@
\listfiles
\ProvidesFile{xcolor.dtx}[\XCfiledate\space\XCfileversion\space
`xcolor' source and documentation (UK)]
+\PassOptionsToPackage
+ {
+ hyperindex=false,bookmarks,bookmarksopen,bookmarksopenlevel=1,%
+ pdftitle={xcolor \XCfileversion{} (\XCfiledate)},
+ pdfauthor={Dr. Uwe Kern},%
+ pdfsubject={Color extensions for LaTeX and pdfLaTeX},%
+ pdfkeywords={xcolor,color,colour,model,tint,tone,shade,harmony,spot,latex,pdftex,dvips,%
+ conversion,blend,mix,mask,separation,rgb,cmy,cmyk,hsb,gray,html,wave,thsb,wheel}
+ }{hyperref}
\documentclass{ltxdoc}
\usepackage[table,showerrors,dvipsnames,hyperref]{xcolor}[2005/06/06]
\usepackage{chngpage,varioref,tabularx,amsmath,amsthm}
-\usepackage
- [\GinDriver,hyperindex=false,bookmarks,bookmarksopen,bookmarksopenlevel=1,%
- pdftitle={xcolor \XCfileversion{} (\XCfiledate)},pdfauthor={Dr. Uwe Kern},%
- pdfsubject={Color extensions for LaTeX and pdfLaTeX},%
- pdfkeywords={xcolor,color,colour,model,tint,tone,shade,harmony,spot,latex,pdftex,dvips,%
- conversion,blend,mix,mask,separation,rgb,cmy,cmyk,hsb,gray,html,wave,thsb,wheel}]{hyperref}
\OnlyDescription
\EnableCrossrefs
\CodelineIndex
@@ -1137,6 +1139,12 @@
% This is still experimental code that may confuse \File{.dvi} viewers.
% The opposite option \Option{noxcdraw} forces usage of the generic (driver-independent) code.
%
+% \subsubsection{Colors in math}
+%
+% While it is possible to color parts of a formula using |\color| commands the approach is fairly cumbersome.
+% Therefore the command \cs{mathcolor} has been added to the \Package{color} and \Package{xcolor} package,
+% which has the same syntax as \cs{textcolor}. The full documentation and examples of its use is in \texttt{mathcolor.pdf}
+% in the \LaTeX{} documentation.
%
% \subsubsection{Using the current color}
%
@@ -4850,7 +4858,7 @@
% \end{itemize}
% See table \vref{tab.internal} for some examples.
% \begin{macrocode}
-\def\definecolor{\@testopt{\XC@definecolor}{}}
+\protected\def\definecolor{\@testopt{\XC@definecolor}{}}
\def\XC@definecolor[#1]#2%
{\@testopt{\XC@definec@lor[#1]{#2}}\colornameprefix}
% \end{macrocode}
@@ -5067,7 +5075,7 @@
% \begin{macro}{\DefineNamedColor}
% \marg{type}\marg{name}\marg{model-list}\marg{spec-list}
% \begin{macrocode}
-\def\DefineNamedColor#1%
+\protected\def\DefineNamedColor#1%
{\@nameuse{XC@\ifdefinecolors defin\else prepar\fi ecolor}[#1]}
% \end{macrocode}
% \end{macro}
@@ -5432,7 +5440,7 @@
% The naming is by analogy with |\textrm| (as opposed to |\rm| and |\rmfamily|) although it is slightly a misnomer as the command also works in math-mode.
% Additionally, it calls |\leavevmode| to ensure the start of horizontal mode.
% \begin{macrocode}
-\def\textcolor#1#{\@textcolor{#1}}
+\protected\def\textcolor#1#{\@textcolor{#1}}
\def\@textcolor#1#2#3{\protect\leavevmode{\color#1{#2}#3}}
% \end{macrocode}
% \end{macro}
@@ -5443,7 +5451,7 @@
% Specifies the background color for the current, and all following, pages.
% It is a global declaration which does not respect \TeX\ groups.
% \begin{macrocode}
-\def\pagecolor
+\protected\def\pagecolor
{\begingroup
\let\ignorespaces\endgroup \let\set@color\set@page@color
\color}
@@ -5454,13 +5462,18 @@
% Removes any currently specified page color returning to the default transparent background.
% It is not yet supported by all driver options and so generates a warning if there is no definition in the driver file.
% \begin{macrocode}
-\def\nopagecolor
+\protected\def\nopagecolor
{\@ifundefined{no@page@color}%
{\PackageInfo{xcolor}{\@backslashchar nopagecolor\space is not supported}}%
{\no@page@color}}
% \end{macrocode}
% \end{macro}
%
+% \subsubsection{mathcolor}
+% We load the new mathcolor support from the kernel if it exists. The documentation
+% is in \texttt{mathcolor.pdf}
+%
+\InputIfFileExists{mathcolor.ltx}{}{}
%
% \subsubsection{Colored boxes}
%
@@ -5469,7 +5482,7 @@
% \oarg{model}\marg{spec}\marg{text}\\
% Takes the same argument forms as |\textcolor|, but the color specifies the \emph{background} color of the box.
% \begin{macrocode}
-\def\colorbox#1#{\protect\color@box{#1}}
+\protected\def\colorbox#1#{\color@box{#1}}
\def\color@box#1#2{\color@b@x\relax{\color#1{#2}}}
% \end{macrocode}
% \end{macro}
@@ -5482,7 +5495,7 @@
% Puts a frame of the first color around a box with a background specified by the second color.
% If only the first optional argument is given, it specifies the color model for both colors.
% \begin{macrocode}
-\def\fcolorbox#1#{\color@fbox{#1}}
+\protected\def\fcolorbox#1#{\color@fbox{#1}}
\def\color@fbox#1#2#3#{\protect\color@fb@x{#1}{#2}{#3}}
\def\color@fb@x#1#2#3#4%
{\color@b@x{\fboxsep\z@\color#1{#2}\XC@fbox}%
@@ -6133,7 +6146,7 @@
\ifin@\def#2{4}\else\expandafter\in@\expandafter:\expandafter{#2}%
\ifin@\def#2{3}\else\expandafter\in@\expandafter!\expandafter{#2}%
\ifin@\def#2{2}\else % now there's no >,:,!
- \if-\expandafter\@car#2\@nil\def#2{2}\else % catches -red
+ \if-\expandafter\@car#2\relax\@nil\def#2{2}\else % catches -red
\edef#2{\noexpand\in@{/./}{/#2/}}#2%
\edef#2{\ifin@0\else1\fi}\fi\fi\fi\fi}
% \end{macrocode}
@@ -6975,7 +6988,7 @@
% |\normalcolor| is defined (to |\relax|) in the \LaTeX\ kernel, so it is safe to use this in macros that may possibly be used in conjunction with color.
% It will have no effect until the \XCP{} is also loaded.
% \begin{macrocode}
-\def\normalcolor{\let\current@color\default@color\set@color}
+\protected\def\normalcolor{\let\current@color\default@color\set@color}
% \end{macrocode}
% \end{macro}
%