diff options
Diffstat (limited to 'macros/latex/contrib/xcolor/xcolor.dtx')
-rw-r--r-- | macros/latex/contrib/xcolor/xcolor.dtx | 104 |
1 files changed, 59 insertions, 45 deletions
diff --git a/macros/latex/contrib/xcolor/xcolor.dtx b/macros/latex/contrib/xcolor/xcolor.dtx index 48ab957f48..8162c8f863 100644 --- a/macros/latex/contrib/xcolor/xcolor.dtx +++ b/macros/latex/contrib/xcolor/xcolor.dtx @@ -1,12 +1,13 @@ % \iffalse meta-comment %% %% ---------------------------------------------------------------- -%% Copyright (C) 2003-2016 by Dr. Uwe Kern <xcolor at ukern dot de> +%% Copyright (C) 2003-2021 by Dr. Uwe Kern <xcolor at ukern dot de> +%% 2021 LaTeX Project https://github.com/latex3/xcolor/issues %% ---------------------------------------------------------------- %% %<*package> %% Please send error reports and suggestions for -%% improvements to the above email address. +%% improvements to https://github.com/latex3/xcolor/issues. %% %% This package contains code copied from %% @@ -17,19 +18,19 @@ %% %</package> %<*extract|driver|test1|test2|test3|test4> -\def\XCfileversion{v2.12}% -\def\XCfiledate{2016/05/11}% +\def\XCfileversion{v2.13}% +\def\XCfiledate{2021/10/31}% %</extract|driver|test1|test2|test3|test4> % % This file may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.2 +% conditions of the LaTeX Project Public License, either version 1.3c % of this license or (at your option) any later version. % The latest version of this license is in: % % http://www.latex-project.org/lppl.txt % -% and version 1.2 or later is part of all distributions of LaTeX -% version 1999/12/01 or later. +% and version 1.3c or later is part of all distributions of LaTeX +% version 2008-05-04 or later. % % \fi % @@ -231,8 +232,8 @@ % \date{\XCfileversion{} (\XCfiledate) % \thanks{This package can be downloaded from \CTAN{macros/latex/contrib/xcolor/}{}. % There is also an \textsf{xcolor} homepage: \XCW. -% Please send error reports and suggestions for improvements to the author: -% \texttt{\href{mailto:xcolor@ukern.de}{xcolor@ukern.de}}.}} +% Please send error reports and suggestions for improvements to: +% \url{https://github.com/latex3/xcolor/issues}.}} % \maketitle % % \begin{abstract} @@ -376,7 +377,7 @@ % % In general, there are several types of options: % \begin{itemize} -% \item options that determine the color driver as explained in \cite{dpc} and \cite{color}, currently: \Option{dvips}, \Option{xdvi}, \Option{dvipdf}, \Option{dvipdfm}, \Option{dvipdfmx}, \Option{luatex}, \Option{pdftex}, \Option{dvipsone}, \Option{dviwindo}, \Option{emtex}, \Option{dviwin}, \Option{oztex}, \Option{textures}, \Option{pctexps}, \Option{pctexwin}, \Option{pctexhp}, \Option{pctex32}, \Option{truetex}, \Option{tcidvi}, \Option{vtex}, \Option{xetex}, +% \item options that determine the color driver as explained in \cite{dpc} and \cite{color}, currently: \Option{dvips}, \Option{xdvi}, \Option{dvipdf}, \Option{dvipdfm}, \Option{dvipdfmx}, \Option{luatex}, \Option{pdftex}, \Option{dvipsone}, \Option{dviwindo}, \Option{emtex}, \Option{dviwin}, \Option{oztex}, \Option{textures}, \Option{pctexps}, \Option{pctexwin}, \Option{pctexhp}, \Option{pctex32}, \Option{truetex}, \Option{tcidvi}, \Option{vtex}, \Option{xetex}, \Option{dvisvgm}, % \item options that determine the target color model\footnote{Section \vref{sec.tgt} explains how this setting can be overridden at any point in a document.} (\Option{natural}, \Option{rgb}, \Option{cmy}, \Option{cmyk}, \Option{hsb}, \Option{gray}, \Option{RGB}, \Option{HTML}, \Option{HSB}, \Option{Gray}) or disable colored output (\Option{monochrome}), % \item options that control whether and how certain sets of predefined colors are being loaded: \Option{dvipsnames}, \Option{dvipsnames*}, \Option{svgnames}, \Option{svgnames*}, \Option{x11names}, \Option{x11names*}, % \item options that determine which other packages are to be loaded or supported: \Option{table}, \Option{fixpdftex}, @@ -3144,6 +3145,16 @@ % \subsection*{History} % \addcontentsline{toc}{subsection}{History} % +% \subsubsection*{2021/10/31 v2.13} +% \begin{itemize} +% \item Bug Fixes: +% \begin{itemize} +% \item Avoid use of |\string| to generate csnames +% \item Declare |dvisvgm| option and make |dvipdfm| an alias to |dvipdfmx| to match graphics and color packages. +% \item Modify |\XC@info| to avoid spurious text from |\colorlet{foo}{.!50}| +% \end{itemize} +% \end{itemize} +% % \subsubsection*{2016/05/11 v2.12} % \begin{itemize} % \item New features: @@ -3596,7 +3607,7 @@ % \begin{macro}{\XC@@} % Macro consisting of the macro |\\XC@@|, serves as a delimiter. % \begin{macrocode} -\edef\XC@@{\expandafter\noexpand\csname\string\XC@@\endcsname} +\edef\XC@@{\expandafter\noexpand\csname\@backslashchar XC@@\endcsname} % \end{macrocode} % \end{macro} % @@ -4044,9 +4055,9 @@ % % Drivers that come with their individual definition files: % \begin{macrocode} -\@tfor\@@tmp:={dvipdf}{dvipdfm}{dvipdfmx}{dvips}{dvipsone}{dviwin}% +\@tfor\@@tmp:={dvipdf}{dvipdfmx}{dvips}{dvipsone}{dviwin}% {emtex}{luatex}{pctex32}{pctexhp}{pctexps}{pctexwin}{pdftex}% - {tcidvi}{textures}{truetex}{vtex}{xetex}\do + {tcidvi}{textures}{truetex}{vtex}{xetex}{dvisvgm}\do {\edef\@@tmp{\noexpand\DeclareOption{\@@tmp}% {\def\noexpand\Gin@driver{\@@tmp.def}}}% \@@tmp} @@ -4057,6 +4068,7 @@ \DeclareOption{dviwindo}{\ExecuteOptions{dvipsone}} \DeclareOption{oztex}{\ExecuteOptions{dvips}} \DeclareOption{xdvi}{\ExecuteOptions{dvips,monochrome}} +\DeclareOption{dvipdfm}{\ExecuteOptions{dvipdfmx}} % \end{macrocode} % % Options used by (some) drivers. @@ -4890,7 +4902,7 @@ \toks@\expandafter{\@@drv}% \edef\@@tmp {\ifglobalcolors\global\else\xglobal@\fi - \noexpand\@namedef{\string\color@\@@nam}% + \noexpand\@namedef{\@backslashchar color@\@@nam}% {\noexpand\xcolor@{\@@cls}{\the\toks@}{\@@mod}{\@@clr}}}% \fi}% \expandafter\endgroup\@@tmp\xglobal@stop} @@ -5026,7 +5038,7 @@ \else \edef\@@tmp {\expandafter\expandafter\expandafter\@secondoffive - \csname\string\color@\@@clr\endcsname}% + \csname\@backslashchar color@\@@clr\endcsname}% \ifx\@@cls\@@tmp\XC@@tsttrue\fi \fi \fi\fi @@ -5048,7 +5060,7 @@ {\c@lor@error{`#2'}\let\@@tmp\@empty}% {\edef\@@tmp {\ifglobalcolors\global\else\xglobal@\fi - \noexpand\XC@let@cc{\string\color@#1}{\string\color@#2}}}} + \noexpand\XC@let@cc{\@backslashchar color@#1}{\@backslashchar color@#2}}}} % \end{macrocode} % \end{macro} % @@ -5194,7 +5206,7 @@ \XC@sdef\@@mod{#2}% \@ifxempty{#4}{\extractcolorspec{#5}\@@clr}{\edef\@@clr{{#4}{#5}}}% \expandafter\convertcolorspec\@@clr\@@mod\@@clr - \@namexdef{\string\colorB@#1}{{\@@mod}{\@@clr}}% + \@namexdef{\@backslashchar colorB@#1}{{\@@mod}{\@@clr}}% \edef\@@met{#3}% \ifx\@@met\XC@met@last \@ifxempty{#6}{\extractcolorspec{#7}\@@tmp}{\edef\@@tmp{{#6}{#7}}}% @@ -5204,7 +5216,7 @@ \else \edef\@@tmp{#7}% \fi - \@namexdef{\string\colorD@#1}{{\@@met}{\@@tmp}}% + \@namexdef{\@backslashchar colorD@#1}{{\@@met}{\@@tmp}}% \endgroup} % \end{macrocode} % \end{macro} @@ -5216,15 +5228,15 @@ \def\XC@resetcolorseries[#1]#2% {\begingroup \@namexdef - {\string\color@#2}{\noexpand\xcolor@{}{}\@nameuse{\string\colorB@#2}}% - \XC@let@Nc\@@tmp{\string\colorD@#2}% + {\@backslashchar color@#2}{\noexpand\xcolor@{}{}\@nameuse{\@backslashchar colorB@#2}}% + \XC@let@Nc\@@tmp{\@backslashchar colorD@#2}% \edef\@@met{\expandafter\@firstoftwo\@@tmp}% \edef\@@tmp{\expandafter\@secondoftwo\@@tmp}% \ifx\@@met\XC@met@step\else \edef\@@scl{\@ifxempty{#1}\colorseriescycle{#1}}% \expandafter\XC@calc@\@@tmp,,,,:D% \fi - \@namexdef{\string\colorS@#2}{\@@tmp}% + \@namexdef{\@backslashchar colorS@#2}{\@@tmp}% \endgroup} % \end{macrocode} % \end{macro} @@ -5236,14 +5248,14 @@ % In the relative case, the (non-negative) number of single steps is supposed to be stored in |\@tempcnta|. % \begin{macrocode} \def\XC@step#1% - {\let\xcolor@\@gobbletwo\edef\@@tmp{\@nameuse{\string\color@#1}}% + {\let\xcolor@\@gobbletwo\edef\@@tmp{\@nameuse{\@backslashchar color@#1}}% \expandafter\XC@st@p\@@tmp{#1}% - \@namexdef{\string\color@#1}{\noexpand\xcolor@{}{}{\@@mod}{\@@tmp}}} + \@namexdef{\@backslashchar color@#1}{\noexpand\xcolor@{}{}{\@@mod}{\@@tmp}}} % \end{macrocode} % % \begin{macrocode} \def\XC@st@p#1#2#3% - {\def\@@mod{#1}\def\@@tmp{#2}\edef\@@vec{\@nameuse{\string\colorS@#3}}% + {\def\@@mod{#1}\def\@@tmp{#2}\edef\@@vec{\@nameuse{\@backslashchar colorS@#3}}% \@whilenum\@tempcnta>\z@\do {\XC@inflate\@@mod\@@tmp\@@vec\@@tmp \expandafter\XC@add\@@tmp,\@@tmp \expandafter\XC@calc@\@@tmp,,,,:U% @@ -5252,7 +5264,7 @@ % % \begin{macrocode} \def\XC@stepabs#1% - {\edef\@@tmp{\@nameuse{\string\colorB@#1}}% + {\edef\@@tmp{\@nameuse{\@backslashchar colorB@#1}}% \expandafter\XC@st@p\@@tmp{#1}% \edef\@@tmp {\def\noexpand\@@mod{\@@mod}\def\noexpand\@@clr{\@@tmp}}} @@ -5406,7 +5418,7 @@ % % \begin{macrocode} \def\XC@declaredc@lor - {\XC@let@Nc\XC@current@color{\string\color@\XC@@tmp}% + {\XC@let@Nc\XC@current@color{\@backslashchar color@\XC@@tmp}% \edef\current@color{\XC@current@color}% \XC@display} % \end{macrocode} @@ -5444,7 +5456,7 @@ % \begin{macrocode} \def\nopagecolor {\@ifundefined{no@page@color}% - {\PackageInfo{xcolor}{\string\nopagecolor\space is not supported}}% + {\PackageInfo{xcolor}{\@backslashchar nopagecolor\space is not supported}}% {\no@page@color}} % \end{macrocode} % \end{macro} @@ -5778,7 +5790,7 @@ \ifodd\count@\@tempswatrue\else\@tempswafalse\fi \@ifundefinedcolor\@@nam {\c@lor@error{`\@@nam'}\def\@@nam{black}}{}% - \let\xcolor@\@xcolor@\@nameuse{\string\color@\@@nam}} + \let\xcolor@\@xcolor@\@nameuse{\@backslashchar color@\@@nam}} % \end{macrocode} % \end{macro} % \end{macro} @@ -5852,11 +5864,11 @@ % Write information to log file and display the current color. % \begin{macrocode} \def\XC@display - {\XC@bcolor\XC@let@cN{\string\color@.}\XC@current@color + {\XC@bcolor\XC@let@cN{\@backslashchar color@.}\XC@current@color \ifnum\XC@type{.}=1 \PackageWarning{xcolor}{Incompatible color definition}\else \ifnum\XC@tracing>2 - \begingroup \let\xcolor@\@empty \def\@nil{\string\@nil}% + \begingroup \let\xcolor@\@empty \def\@nil{\@backslashchar @nil}% \PackageInfo{xcolor}{Setting color `\XC@current@color'}% \endgroup \fi\fi @@ -6058,7 +6070,7 @@ % \marg{name}\marg{undefined}\marg{defined}\\ % Checks whether \Meta{name} is a defined color name and executes the respective code. % \begin{macrocode} -\def\@ifundefinedcolor#1{\@ifundefined{\string\color@#1}} +\def\@ifundefinedcolor#1{\@ifundefined{\@backslashchar color@#1}} % \end{macrocode} % \end{macro} % @@ -6086,7 +6098,7 @@ % \begin{macrocode} \def\XC@type#1% {\expandafter\expandafter\expandafter\XC@typ@ - \csname\string\color@#1\endcsname\@empty\@empty\@empty\XC@@} + \csname\@backslashchar color@#1\endcsname\@empty\@empty\@empty\XC@@} % \end{macrocode} % % \begin{macrocode} @@ -6117,11 +6129,13 @@ % \begin{macrocode} \def\XC@info#1#2% {\XC@edef#2{#1}% - \if.#2\def#2{0}\else\expandafter\in@\expandafter>\expandafter{#2}% + \expandafter\in@\expandafter>\expandafter{#2}% \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\edef#2{\noexpand\in@{/-}{/#2}}#2% - \edef#2{\ifin@2\else1\fi}\fi\fi\fi\fi} + \ifin@\def#2{2}\else % now there's no >,:,! + \if-\expandafter\@car#2\@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} % \end{macro} % @@ -6925,7 +6939,7 @@ \expandafter\expandafter\expandafter\c@lor@to@ps#1#2\@@ \else \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter - \expandafter\c@lor@to@ps\csname\string\color@#1#2\endcsname\@@ + \expandafter\c@lor@to@ps\csname\@backslashchar color@#1#2\endcsname\@@ \fi \space} % \end{macrocode} @@ -6986,18 +7000,18 @@ {{dvipdf,dvipdfm,dvipdfmx,dvips,pctex32}% {\def\c@lor@@named#1,#2,#3\@@#4% {\edef#4{\expandafter\expandafter\expandafter\@thirdoffive - \csname\string\color@#1\endcsname}} + \csname\@backslashchar color@#1\endcsname}} \def\define@color@named#1#2% - {\@namedef{\string\color@#1}{{}{}{ \colornameprefix#1}{}{}}}}% + {\@namedef{\@backslashchar color@#1}{{}{}{ \colornameprefix#1}{}{}}}}% % \end{macrocode} % % \begin{macrocode} {dvipsone,luatex,pctexps,pdftex,tcidvi,truetex,vtex,xetex}% {\def\c@lor@@named#1,#2,#3\@@#4% {\edef#4{\expandafter\expandafter\expandafter\@thirdoffive - \csname\string\color@#1\endcsname}} + \csname\@backslashchar color@#1\endcsname}} \def\define@color@named#1#2% - {\let\@@cls\@empty\@namedef{\string\color@#1}{{}{}{#2}{}{}}}}% + {\let\@@cls\@empty\@namedef{\@backslashchar color@#1}{{}{}{#2}{}{}}}}% % \end{macrocode} % % \begin{macrocode} @@ -7010,7 +7024,7 @@ \def\c@lor@ps@#1 #2\@@ {\expandafter\expandafter\expandafter\expandafter\expandafter \expandafter\expandafter\c@lor@to@ps@ - \csname\string\color@#1\expandafter\endcsname\space + \csname\@backslashchar color@#1\expandafter\endcsname\space #2. \@@{#1}}}% % \end{macrocode} % @@ -7768,7 +7782,7 @@ Purple0,.628,.125,.94} \begin{document} \title{Color conversion with the \textsf{xcolor} package --- Examples} -\author{Dr. Uwe Kern\thanks{This file is part of the \textsf{xcolor} distribution which can be downloaded from the CTAN mirrors (\texttt{macros/latex/contrib/xcolor/}) or the homepage \texttt{www.ukern.de/tex/xcolor.html}. Please send error reports and suggestions for improvements to \texttt{xcolor@ukern.de}.}} +\author{Dr. Uwe Kern\thanks{This file is part of the \textsf{xcolor} distribution which can be downloaded from the CTAN mirrors (\texttt{macros/latex/contrib/xcolor/}) or the homepage \texttt{www.ukern.de/tex/xcolor.html}. Please send error reports and suggestions for improvements to \texttt{https://github.com/latex3/xcolor/issues}.}} \date{\XCfileversion{} (\XCfiledate)} \maketitle @@ -7820,7 +7834,7 @@ Purple0,.628,.125,.94} \usepackage{pstricks,pst-tree,pst-slpe,multido} \makeatletter \makeatother -\usepackage{fvrb-ex} +\usepackage{fancyvrb-ex} \def\textfraction{0.01} \def\topfraction{0.99} @@ -7832,7 +7846,7 @@ Purple0,.628,.125,.94} \begin{document} \title{Color extensions with the \textsf{xcolor} package --- \textsf{pstricks} examples} -\author{Dr. Uwe Kern\thanks{This file is part of the \textsf{xcolor} distribution which can be downloaded from the CTAN mirrors (\texttt{macros/latex/contrib/xcolor/}) or the homepage \texttt{www.ukern.de/tex/xcolor.html}. Please send error reports and suggestions for improvements to \texttt{xcolor@ukern.de}.}} +\author{Dr. Uwe Kern\thanks{This file is part of the \textsf{xcolor} distribution which can be downloaded from the CTAN mirrors (\texttt{macros/latex/contrib/xcolor/}) or the homepage \texttt{www.ukern.de/tex/xcolor.html}. Please send error reports and suggestions for improvements to \texttt{https://github.com/latex3/xcolor/issues}.}} \date{\XCfileversion{} (\XCfiledate)} \maketitle @@ -7964,7 +7978,7 @@ Purple0,.628,.125,.94} \title{Color extensions with the \textsf{xcolor} package --- various examples} \author{\href{mailto:xcolor@ukern.de}{\fboxrule0pt\fboxsep2pt\fbox{Dr. Uwe Kern}}} \date{\XCfileversion{} (\XCfiledate) -\thanks{This file (\texttt{\jobname.tex}) is part of the \textsf{xcolor} distribution which can be downloaded from the CTAN mirrors \texttt{\href{http://www.ctan.org/tex-archive/macros/latex/contrib/xcolor/}{CTAN/macros/latex/contrib/xcolor/}} or the homepage \texttt{\href{http://www.ukern.de/tex/xcolor.html}{www.ukern.de/tex/xcolor.html}}. Please send error reports and suggestions for improvements to \texttt{\href{mailto:xcolor@ukern.de}{xcolor@ukern.de}}.}} +\thanks{This file (\texttt{\jobname.tex}) is part of the \textsf{xcolor} distribution which can be downloaded from the CTAN mirrors \texttt{\href{http://www.ctan.org/tex-archive/macros/latex/contrib/xcolor/}{CTAN/macros/latex/contrib/xcolor/}} or the homepage \texttt{\href{http://www.ukern.de/tex/xcolor.html}{www.ukern.de/tex/xcolor.html}}. Please send error reports and suggestions for improvements to \url{https://github.com/latex3/xcolor/issues}.}} \maketitle The purpose of this file is to demonstrate a variety of capabilities including the logging facilities of the \textsf{xcolor} package. |