summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/oberdiek/hycolor.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-04-11 23:02:14 +0000
committerKarl Berry <karl@freefriends.org>2007-04-11 23:02:14 +0000
commit6858df01ea6ebb32f4be0f68e4b2e03d8713f38f (patch)
treed0466192a4c6ae7f99e95d2e6e9b613ebcb73d3d /Master/texmf-dist/source/latex/oberdiek/hycolor.dtx
parent59314283a9039be6cceb0bbee8600837477c9058 (diff)
oberdiek: accsupp, atenddvi, hycolor, iflang (11apr07)
git-svn-id: svn://tug.org/texlive/trunk@4149 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/hycolor.dtx')
-rw-r--r--Master/texmf-dist/source/latex/oberdiek/hycolor.dtx1481
1 files changed, 1481 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/hycolor.dtx b/Master/texmf-dist/source/latex/oberdiek/hycolor.dtx
new file mode 100644
index 00000000000..4d32f2b1efa
--- /dev/null
+++ b/Master/texmf-dist/source/latex/oberdiek/hycolor.dtx
@@ -0,0 +1,1481 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either
+% version 1.3 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.3 or later is part of all distributions of
+% LaTeX version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status "maintained".
+%
+% This Current Maintainer of this work is Heiko Oberdiek.
+%
+% This work consists of the main source file hycolor.dtx
+% and the derived files
+% hycolor.sty, hycolor.pdf, hycolor.ins, hycolor.drv,
+% hycolor-test1.tex, hycolor-test2.tex.
+%
+% Distribution:
+% CTAN:macros/latex/contrib/oberdiek/hycolor.dtx
+% CTAN:macros/latex/contrib/oberdiek/hycolor.pdf
+%
+% Unpacking:
+% (a) If hycolor.ins is present:
+% tex hycolor.ins
+% (b) Without hycolor.ins:
+% tex hycolor.dtx
+% (c) If you insist on using LaTeX
+% latex \let\install=y\input{hycolor.dtx}
+% (quote the arguments according to the demands of your shell)
+%
+% Documentation:
+% (a) If hycolor.drv is present:
+% latex hycolor.drv
+% (b) Without hycolor.drv:
+% latex hycolor.dtx; ...
+% The class ltxdoc loads the configuration file ltxdoc.cfg
+% if available. Here you can specify further options, e.g.
+% use A4 as paper format:
+% \PassOptionsToClass{a4paper}{article}
+%
+% Programm calls to get the documentation (example):
+% pdflatex hycolor.dtx
+% makeindex -s gind.ist hycolor.idx
+% pdflatex hycolor.dtx
+% makeindex -s gind.ist hycolor.idx
+% pdflatex hycolor.dtx
+%
+% Installation:
+% TDS:tex/latex/oberdiek/hycolor.sty
+% TDS:doc/latex/oberdiek/hycolor.pdf
+% TDS:doc/latex/oberdiek/hycolor-test1.tex
+% TDS:doc/latex/oberdiek/hycolor-test2.tex
+% TDS:source/latex/oberdiek/hycolor.dtx
+%
+%<*ignore>
+\begingroup
+ \def\x{LaTeX2e}%
+\expandafter\endgroup
+\ifcase 0\ifx\install y1\fi\expandafter
+ \ifx\csname processbatchFile\endcsname\relax\else1\fi
+ \ifx\fmtname\x\else 1\fi\relax
+\else\csname fi\endcsname
+%</ignore>
+%<*install>
+\input docstrip.tex
+\Msg{************************************************************************}
+\Msg{* Installation}
+\Msg{* Package: hycolor 2007/04/11 v1.1 Code for color options of hyperref/bookmark (HO)}
+\Msg{************************************************************************}
+
+\keepsilent
+\askforoverwritefalse
+
+\preamble
+
+This is a generated file.
+
+Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
+
+This work may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either
+version 1.3 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.3 or later is part of all distributions of
+LaTeX version 2005/12/01 or later.
+
+This work has the LPPL maintenance status "maintained".
+
+This Current Maintainer of this work is Heiko Oberdiek.
+
+This work consists of the main source file hycolor.dtx
+and the derived files
+ hycolor.sty, hycolor.pdf, hycolor.ins, hycolor.drv,
+ hycolor-test1.tex, hycolor-test2.tex.
+
+\endpreamble
+
+\generate{%
+ \file{hycolor.ins}{\from{hycolor.dtx}{install}}%
+ \file{hycolor.drv}{\from{hycolor.dtx}{driver}}%
+ \usedir{tex/latex/oberdiek}%
+ \file{hycolor.sty}{\from{hycolor.dtx}{package}}%
+ \usedir{doc/latex/oberdiek}%
+ \file{hycolor-test1.tex}{\from{hycolor.dtx}{test,test1}}%
+ \file{hycolor-test2.tex}{\from{hycolor.dtx}{test,test2}}%
+}
+
+\obeyspaces
+\Msg{************************************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move the following}
+\Msg{* file into a directory searched by TeX:}
+\Msg{*}
+\Msg{* hycolor.sty}
+\Msg{*}
+\Msg{* To produce the documentation run the file `hycolor.drv'}
+\Msg{* through LaTeX.}
+\Msg{*}
+\Msg{* Happy TeXing!}
+\Msg{*}
+\Msg{************************************************************************}
+
+\endbatchfile
+%</install>
+%<*ignore>
+\fi
+%</ignore>
+%<*driver>
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesFile{hycolor.drv}%
+ [2007/04/11 v1.1 Code for color options of hyperref/bookmark (HO)]%
+\documentclass{ltxdoc}
+\usepackage{holtxdoc}
+\usepackage[ruled]{algorithm2e}
+
+\makeatletter
+\newcommand*{\makedefaultH}[1]{%
+ \expandafter\edef\csname #1\endcsname{%
+ \noexpand\@protected@testopt
+ \expandafter\noexpand\csname#1\endcsname
+ \expandafter\noexpand\csname
+ \expandafter\string\csname#1\endcsname\endcsname
+ {H}%
+ }%
+}
+\makeatother
+\makedefaultH{algorithm}
+\makedefaultH{procedure}
+\makedefaultH{function}
+
+\SetKwInput{KwParam}{Param}
+\newcommand*{\Param}[2]{%
+ \KwParam{\ArgSty{#1} (#2)}%
+}
+\newcommand*{\Dat}[1]{%
+ \texttt{\upshape#1}%
+}
+\newcommand*{\Var}[1]{%
+ \ArgSty{#1}%
+}
+\newcommand*{\Gets}{%
+ \ensuremath{\leftarrow}%
+ \ %
+}
+
+\makeatletter
+\newcommand*{\bs}{\texttt{\@backslashchar}}
+\makeatother
+\begin{document}
+ \DocInput{hycolor.dtx}%
+\end{document}
+%</driver>
+% \fi
+%
+% \CheckSum{1043}
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+% \GetFileInfo{hycolor.drv}
+%
+% \title{The \xpackage{hycolor} package}
+% \date{2007/04/11 v1.1}
+% \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}}
+%
+% \maketitle
+%
+% \begin{abstract}
+% Package \xpackage{hycolor} implements the color option stuff that
+% is used by packages \xpackage{hyperref} and \xpackage{bookmark}.
+% It is not intended as package for the user.
+% \end{abstract}
+%
+% \tableofcontents
+%
+% \section{Documentation}
+%
+% The package \xpackage{hycolor} implements color options
+% for packages \xpackage{hyperref} and \xpackage{bookmark}.
+%
+% Package \xpackage{xcolor} provides macros for extracting
+% color values and converting color data to other color models.
+% If this package is loaded, the full range of color specifications
+% of packages \xpackage{color} and \xpackage{xcolor} are supported
+% including the optional argument for the color model.
+% \begin{quote}
+% |\hyperref{linkbordercolor=red}%| needs \xpackage{xcolor}\\
+% |\hyperref{linkbordercolor=[named]{red}%| needs \xpackage{xcolor}\\
+% |\hyperref{linkbordercolor=[rgb]{1,0,0}|\\
+% \end{quote}
+%
+% Without package \xpackage{xcolor} some of the options only
+% support some models, if they are given directly, e.g.:
+% \begin{quote}
+% |\bookmarksetup{color=[rgb]{1,0,0}}|
+% \end{quote}
+%
+% Because of compatibility some options of \xpackage{hyperref}
+% also support space separated RGB values:
+% \begin{quote}
+% |\hypersetup{linkbordercolor=1 0 0}%| is the same as\\
+% |\hypersetup{linkbordercolor=[rgb]{1,0,0}}|
+% \end{quote}
+%
+% Coloring is optional, it can be turned off by using an empty
+% value:
+% \begin{quote}
+% |\hypersetup{linkbordercolor={}}|
+% \end{quote}
+%
+% The PDF specification knows some kind of an emtpy color setting
+% without values. This applies to form field colors. The new
+% A virtual color model \texttt{empty} is introduced for this
+% purpose, e.g.
+% \begin{quote}
+% |\TextField[backgroundcolor={[empty]{}}, ...]{...}%| or\\
+% |\TextField[{backgroundcolor=[empty]{}, ...}]{...}|
+% \end{quote}
+% PDF specification 1.7 also allows this for border link colors.
+% But this isn't currently supported by this package, because
+% the tested viewers (AR7/Linux, xpdf 3.00, ghostscript 8.54)
+% don't support this yet. In contrary ghostscript generates an
+% error message.
+%
+% \subsection{Summary}
+%
+% \begin{quote}
+% \begin{tabular}{@{}llll@{}}
+% Color option & Models without \xpackage{xcolor}
+% & RGB color & Model empty\\
+% \hline
+% |BKM.color| & |gray|, |rgb| & no & no\\
+% |Hyp.*color| & all & no & no\\
+% |Hyp.*bordercolor| & |gray|, |rgb| & yes & no\\
+% |Field.*color| & |gray|, |rgb|, |cmyk| & yes & yes\\
+% \end{tabular}
+% \end{quote}
+% Explanation of the color option prefixes:
+% \begin{quote}
+% \begin{tabular}{@{}ll@{}}
+% Prefix & Explanation\\
+% \hline
+% |BKM| & Package \xpackage{bookmark}\\
+% |Hyp| & Package \xpackage{hyperref}:
+% package options or |\hypersetup|\\
+% |Field| & Package \xpackage{hyperref}:
+% Form field options\\
+% \end{tabular}
+% \end{quote}
+%
+%
+% \StopEventually{
+% }
+%
+% \section{Implementation}
+%
+% \begin{macrocode}
+%<*package>
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{hycolor}%
+ [2007/04/11 v1.1 Code for color options of hyperref/bookmark (HO)]%
+% \end{macrocode}
+%
+% \subsection{Normalization}
+%
+% \subsubsection{Sanitize value of color option}
+%
+% \begin{procedure}
+% \Param{cmd}{macro}
+% \Param{value}{value of color option}
+% \BlankLine
+% \KwResult{\ArgSty{value} is expanded, sanitized, and
+% stored in macro \ArgSty{cmd}.}
+% \caption{DefSanitized(cmd, value)}
+% \BlankLine
+% Initialize active characters\;
+% \ArgSty{cmd} := Expand \ArgSty{value}\;
+% Sanitize \ArgSty{cmd}\;
+% \end{procedure}
+% \emph{Sanitization} means that the string does not contain any
+% macros or special tokens. It consists of characters with
+% catcode 12 (other). The only exception is the space with
+% catcode 10 (space).
+% \begin{macro}{\HyColor@DefSanitized}
+% \begin{macrocode}
+\begingroup
+ \catcode`\!=13 %
+ \catcode`\:=13 %
+ \catcode`\-=13 %
+ \catcode`\+=13 %
+ \catcode`\;=13 %
+ \catcode`\"=13 %
+ \catcode`\>=13 %
+ \edef\x{%
+ \def\noexpand!{\string!}%
+ \def\noexpand:{\string:}%
+ \def\noexpand-{\string-}%
+ \def\noexpand+{\string+}%
+ \def\noexpand;{\string;}%
+ \def\noexpand"{\string"}%
+ \def\noexpand>{\string>}%
+ }%
+ \def\y#1{\endgroup
+ \def\HyColor@DefSanitized##1##2{%
+ \begingroup
+ \csname @safe@activestrue\endcsname
+ #1%
+ \edef\x{\endgroup
+ \def\noexpand##1{##2}%
+ }%
+ \x
+ \@onelevel@sanitize##1%
+ }%
+ }%
+\expandafter\y\expandafter{\x}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Normalize result}
+%
+% \begin{procedure}
+% \Param{value}{Sanitized explicit number}
+% \Param{cmd}{Macro that stores result}
+% \BlankLine
+% \KwResult{\ArgSty{cmd} contains normalized number}
+% \caption{NormalizeNum(value, cmd)}
+% \BlankLine
+% \uIf{\Var{value}\,\Dat{pt} $<$ \Dat{0pt}}{
+% \ArgSty{cmd} \Gets \Dat{0}\;
+% }
+% \uElseIf{number before dot of \Var{value} $<$ \Dat{1}}{
+% \Var{cmd} \Gets number after dot of \Var{value}\;
+% \Var{cmd} \Gets strip trailing zeros from \Var{cmd}\;
+% \If{dot remains only}{
+% \Var{cmd} \Gets \Dat{0}\;
+% }
+% }
+% \Else{
+% \Var{cmd} \Gets \Dat{1}\;
+% }
+% \end{procedure}
+% The number is limited to the range between 0.0 and 1.0 and
+% formatted as short PDF number without leading or trailing zeros.
+% The precision of the number isn't changed.
+% \begin{macro}{\HyColor@NormalizeNum}
+% \begin{macrocode}
+\def\HyColor@NormalizeNum#1#2{%
+ \ifdim#1pt<\z@
+ \def#2{0}%
+ \else
+ \edef#2{\zap@space#1 \@empty}%
+ \expandafter\HyColor@CheckDot#2..\@nil#2%
+ \fi
+}
+\def\HyColor@CheckDot#1.#2.#3\@nil#4{%
+ \ifnum0#1<\@ne
+ \ifx\\#2\\%
+ \def#4{0}%
+ \else
+ \edef#4{\HyColor@ReverseString#2\@nil{}}%
+ \edef#4{\expandafter\HyColor@StripLeadingZeros#4\@empty}%
+ \ifx#4\@empty
+ \def#4{0}%
+ \else
+ \edef#4{.\expandafter\HyColor@ReverseString#4\@nil{}}%
+ \fi
+ \fi
+ \else
+ \def#4{1}%
+ \fi
+}
+\def\HyColor@ReverseString#1#2\@nil#3{%
+ \ifx\\#2\\%
+ #1#3%
+ \else
+ \@ReturnAfterFi{%
+ \HyColor@ReverseString#2\@nil{#1#3}%
+ }%
+ \fi
+}
+\long\def\@ReturnAfterFi#1\fi{\fi#1}
+\def\HyColor@StripLeadingZeros#1{%
+ \ifx#10%
+ \expandafter\HyColor@StripLeadingZeros
+ \else
+ #1%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\HyColor@NormalizeCommaRGB}
+% \begin{macrocode}
+\def\HyColor@NormalizeCommaRGB#1,#2,#3\@nil#4{%
+ \HyColor@NormalizeNum{#1}\HyColor@temp
+ \let#4\HyColor@temp
+ \HyColor@NormalizeNum{#2}\HyColor@temp
+ \edef#4{#4 \HyColor@temp}%
+ \HyColor@NormalizeNum{#3}\HyColor@temp
+ \edef#4{#4 \HyColor@temp}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\HyColor@NormalizeCommaCMYK}
+% \begin{macrocode}
+\def\HyColor@NormalizeCommaCMYK#1,#2,#3,#4\@nil#5{%
+ \HyColor@NormalizeNum{#1}\HyColor@temp
+ \let#5\HyColor@temp
+ \HyColor@NormalizeNum{#2}\HyColor@temp
+ \edef#5{#5 \HyColor@temp}%
+ \HyColor@NormalizeNum{#3}\HyColor@temp
+ \edef#5{#5 \HyColor@temp}%
+ \HyColor@NormalizeNum{#4}\HyColor@temp
+ \edef#5{#5 \HyColor@temp}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Main algorithm for color options}
+%
+% \begin{procedure}
+% \Param{key}{name of color option}
+% \Param{value}{value of color option}
+% \Param{cmd}{macro that stores result}
+% \BlankLine
+% \KwResult{Macro \ArgSty{cmd} contains the calculated
+% color specification string or has the meaning of \cs{relax}
+% if the color must not set}
+% \caption{Main color option algorithm()}
+% \BlankLine
+% DefSanitized(\ArgSty{temp}, \ArgSty{value})\;
+% Call option specific algorithm(\ArgSty{key}, \ArgSty{temp}, \ArgSty{cmd})\;
+% \end{procedure}
+%
+% \subsection{Package \xpackage{bookmark}}
+%
+% Since v0.8 2007/03/27 package \xpackage{bookmark} only provides
+% one color option \xoption{color}. Because option \xoption{rgbcolor}
+% can easily given as color specification in model rgb:
+% \begin{quote}
+% |rgbcolor=r g b| $\equiv$ |color=[rgb]{r,g,b}|
+% \end{quote}
+% Package \xpackage{bookmark} stores the result in macro \cs{BKM@color}.
+% The empty string is interpreted as \emph{no color}.
+%
+% \begin{procedure}
+% \Param{value}{value of option \xoption{color}}
+% \Param{cmd}{macro for result}
+% \Param{package}{package name for error message}
+% \Param{option}{option name for error message}
+% \BlankLine
+% \Switch{\Var{value}}{
+% \Case{empty}{
+% \Var{cmd} \Gets no color\;
+% }
+% \Case{with model}{
+% \eIf{with xcolor}{
+% \Var{cmd} \Gets ConvertToRGB(\Var{model}, \Var{values})\;
+% }{
+% \uIf{model $=$ rgb}{
+% \Var{cmd} \Gets \Var{values} as normalized values\;
+% }
+% \uElseIf{model $=$ gray}{
+% \Var{cmd} \Gets \Var{values} as normalized tripled values\;
+% }
+% \Else{
+% error\;
+% }
+% }
+% }
+% \Other{
+% \eIf{with xcolor}{
+% (\Var{model}, \Var{values} \Gets get model and values\;
+% \Var{cmd} \Gets ConvertToRGB(\Var{model}, \Var{values})\;
+% }{
+% error\;
+% }
+% }
+% }
+% \end{procedure}
+%
+% \begin{macrocode}
+\def\HyColor@BookmarkColor#1#2#3#4{%
+ \HyColor@IfModel{#1}{%
+ \HyColor@IfXcolor{%
+ \convertcolorspec\HyColor@model\HyColor@values
+ \HyColor@model@rgb#2%
+ \expandafter\HyColor@NormalizeCommaRGB#2\@nil#2%
+ }{%
+ \ifx\HyColor@model\HyColor@model@rgb
+ \expandafter\HyColor@NormalizeCommaRGB\HyColor@values\@nil#2%
+ \else
+ \ifx\HyColor@model\HyColor@model@gray
+ \expandafter\HyColor@NormalizeNum
+ \expandafter{\HyColor@values}#2%
+ \edef#2{#2 #2 #2}%
+ \else
+ \let#2\@empty
+ \HyColor@ErrorModelNoXcolor{#3}{#4}%
+ \fi
+ \fi
+ }%
+ }{%
+ \let#2\HyColor@values
+ \ifx#2\@empty
+ \else
+ \HyColor@IfXcolor{%
+ \extractcolorspec{#1}#2%
+ \expandafter\convertcolorspec#2\HyColor@model@rgb#2%
+ \expandafter\HyColor@NormalizeCommaRGB#2\@nil#2%
+ }{%
+ \let#2\@empty
+ \HyColor@ErrorSpecNoXcolor{#3}{#4}%
+ }%
+ \fi
+ }%
+}
+% \end{macrocode}
+% \begin{macrocode}
+\def\HyColor@ErrorModelNoXcolor#1#2{%
+ \PackageError{#1}{%
+ Color model `\HyColor@model' is not supported\MessageBreak
+ without package `xcolor' in\MessageBreak
+ `#2=[\HyColor@model]{\HyColor@values}'%
+ }\@ehc
+}
+% \end{macrocode}
+% \begin{macrocode}
+\def\HyColor@ErrorSpecNoXcolor#1#2{%
+ \PackageError{#1}{%
+ This color specification is not supported\MessageBreak
+ without package `xcolor' in\MessageBreak
+ `#2=\HyColor@values'%
+ }\@ehc
+}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\def\HyColor@IfModel#1{%
+ \@ifnextchar[{%
+ \HyColor@WithModel
+ }{%
+ \HyColor@WithoutModel
+ }%
+ #1\@nil
+}
+\def\HyColor@WithModel[#1]#2\@nil{%
+ \HyColor@DefSanitized\HyColor@model{#1}%
+ \HyColor@DefSanitized\HyColor@values{#2}%
+ \@firstoftwo
+}
+\def\HyColor@WithoutModel#1\@nil{%
+ \let\HyColor@model\relax
+ \HyColor@DefSanitized\HyColor@values{#1}%
+ \@secondoftwo
+}
+% \end{macrocode}
+%
+% \subsection{Utils}
+%
+% \begin{macro}{\@ReturnAfterFi}
+% \begin{macrocode}
+\long\def\@ReturnAfterFi#1\fi{\fi#1}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\HyColor@IfXcolor}
+% \begin{macrocode}
+\def\HyColor@IfXcolor{%
+ \begingroup\expandafter\expandafter\expandafter\endgroup
+ \expandafter\ifx\csname convertcolorspec\endcsname\relax
+ \expandafter\@secondoftwo
+ \else
+ \expandafter\@firstoftwo
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\def\HyColor@model@empty{empty}
+\@onelevel@sanitize\HyColor@model@empty
+\def\HyColor@model@gray{gray}
+\@onelevel@sanitize\HyColor@model@gray
+\def\HyColor@model@rgb{rgb}
+\@onelevel@sanitize\HyColor@model@rgb
+\def\HyColor@model@cmyk{cmyk}
+\@onelevel@sanitize\HyColor@model@cmyk
+\def\HyColor@model@Gray{Gray}
+\@onelevel@sanitize\HyColor@model@Gray
+% \end{macrocode}
+%
+% \subsection{Package \xpackage{hyperref}}
+%
+% \subsubsection{Options \xoption{Hyp.*color}}
+%
+% \begin{macrocode}
+\def\HyColor@UseColor#1{%
+ \ifx#1\relax
+ \else
+ \ifx#1\@empty
+ \else
+ \expandafter\HyColor@@UseColor#1\@nil
+ \fi
+ \fi
+}
+\def\HyColor@@UseColor{%
+ \@ifnextchar[\HyColor@@@UseColor\HyColor@@@@UseColor
+}
+\def\HyColor@@@UseColor[#1]#2\@nil{%
+ \color[{#1}]{#2}%
+}
+\def\HyColor@@@@UseColor#1\@nil{%
+ \color{#1}%
+}
+% \end{macrocode}
+%
+% \begin{procedure}
+% \Param{value}{value of the option}
+% \Param{cmd}{macro for result}
+% \caption{HyperrefColor(value, cmd)}
+% \BlankLine
+% \Switch{\Var{value}}{
+% \Case{empty}{
+% \Var{cmd} \Gets no color\;
+% }
+% \Case{with model}{
+% Call \cs{color} with model\;
+% }
+% \Case{without model}{
+% Call \cs{color} without model\;
+% }
+% }
+% \end{procedure}
+%
+% \begin{macrocode}
+\def\HyColor@HyperrefColor#1#2{%
+ \HyColor@IfModel{#1}{%
+ \edef#2{[{\HyColor@model}]{\HyColor@values}}%
+ }{%
+ \let#2\HyColor@values
+ \ifx#2\@empty
+ \let#2\relax
+ \fi
+ }%
+}
+% \end{macrocode}
+%
+% \subsubsection{Generic algorithm}
+%
+% \begin{procedure}
+% \small
+% \Param{value}{value of the option}
+% \Param{cmd}{macro for result}
+% \Param{package}{package name for error message}
+% \Param{option}{option name for error message}
+% \caption{Algorithm X0134(value, cmd, package, option)}
+% \BlankLine
+% \Switch{\Var{value}}{
+% \Case{empty}{
+% \Var{cmd} \Gets no color\;
+% }
+% \Case{with model}{
+% \Switch{\Var{model}}{
+% \Case{empty}{
+% \Var{cmd} \Gets ""\;
+% }
+% \Case{gray, rgb, cmyk}{
+% \Var{cmd} \Gets \Var{output}()\;
+% }
+% \Case{Gray}{
+% \eIf{with xcolor}{
+% (\Var{model}, \Var{values}) \Gets convert to gray\;
+% }{
+% error(\Var{package}, \Var{option}, "Missing xcolor"),
+% \Var{cmd} \Gets no color\;
+% }
+% }
+% \Else{
+% \eIf{with xcolor}{
+% (\Var{model}, \Var{values}) \Gets convert to rgb\;
+% \Var{cmd} \Gets \Var{output}()\;
+% }{
+% error(\Var{package}, \Var{option}, "Missing xcolor"),
+% \Var{cmd} \Gets no color\;
+% }
+% }
+% }
+% }
+% \Case{rgb values}{
+% (\Var{model}, \Var{values}) \Gets ("rgb", (r,g,b))\;
+% \Var{cmd} \Gets \Var{output}()\;
+% }
+% \Case{without model}{
+% \eIf{with xcolor}{
+% (\Var{model}, \Var{values}) \Gets
+% get model and values(\Var{value})\;
+% \Switch{\Var{model}}{
+% \Case{gray, rgb, cmyk}{
+% \Var{cmd} \Gets \Var{output}()\;
+% }
+% \Case{Gray}{
+% (\Var{model}, \Var{values}) \Gets convert to gray\;
+% \Var{cmd} \Gets \Var{output}()\;
+% }
+% \Else{
+% (\Var{model}, \Var{values}) \Gets convert to rgb\;
+% \Var{cmd} \Gets \Var{output}()\;
+% }
+% }
+% }{
+% error(\Var{package}, \Var{option}, "Missing xcolor"),
+% \Var{cmd} \Gets no color\;
+% }
+% }
+% }
+% \end{procedure}
+%
+% \begin{macro}{\HyColor@XZeroOneThreeFour}
+% \begin{macrocode}
+\def\HyColor@XZeroOneThreeFour#1#2#3#4{%
+ \HyColor@IfModel{#1}{%
+ \ifx\HyColor@model\HyColor@model@empty
+ \let#2\@empty
+ \else\ifx\HyColor@model\HyColor@model@gray
+ \expandafter\HyColor@NormalizeNum
+ \expandafter{\HyColor@values}#2%
+ \else\ifx\HyColor@model\HyColor@model@rgb
+ \expandafter\HyColor@NormalizeCommaRGB\HyColor@values\@nil#2%
+ \else\ifx\HyColor@model\HyColor@model@cmyk
+ \expandafter\HyColor@NormalizeCommaCMYK\HyColor@values\@nil#2%
+ \else\ifx\HyColor@model\HyColor@model@Gray
+ \HyColor@IfXcolor{%
+ \convertcolorspec\HyColor@model\HyColor@values
+ \HyColor@model@gray#2%
+ \expandafter\HyColor@NormalizeNum\expandafter{#2}#2%
+ \let\HyColor@model\HyColor@model@gray
+ }{%
+ \let#2\relax
+ \HyColor@ErrorModelNoXcolor{#3}{#4}%
+ }%
+ \else
+ \HyColor@IfXcolor{%
+ \convertcolorspec\HyColor@model\HyColor@values
+ \HyColor@model@rgb#2%
+ \expandafter\HyColor@NormalizeCommaRGB#2\@nil#2%
+ \let\HyColor@model\HyColor@model@rgb
+ }{%
+ \let#2\relax
+ \HyColor@ErrorModelNoXcolor{#3}{#4}%
+ }%
+ \fi\fi\fi\fi\fi
+ }{%
+ \let#2\HyColor@values
+ \ifx#2\@empty
+ \let#2\relax
+ \else
+ \expandafter\HyColor@IfRGB\expandafter{\HyColor@values}{%
+ \expandafter\HyColor@NormalizeCommaRGB\HyColor@values\@nil#2%
+ }{%
+ \HyColor@IfXcolor{%
+ \expandafter\extractcolorspec\expandafter{\HyColor@values}#2%
+ \edef\HyColor@model{\expandafter\@firstoftwo#2}%
+ \edef\HyColor@values{\expandafter\@secondoftwo#2}%
+ \ifx\HyColor@model\HyColor@model@gray
+ \expandafter\HyColor@NormalizeNum\expandafter
+ {\HyColor@values}#2%
+ \else\ifx\HyColor@model\HyColor@model@rgb
+ \expandafter\HyColor@NormalizeCommaRGB
+ \HyColor@values\@nil#2%
+ \else\ifx\HyColor@model\HyColor@model@cmyk
+ \expandafter\HyColor@NormalizeCommaCMYK
+ \HyColor@values\@nil#2%
+ \else\ifx\HyColor@model\HyColor@model@Gray
+ \convertcolorspec\HyColor@model\HyColor@values
+ \HyColor@model@gray#2%
+ \expandafter\HyColor@NormalizeNum\expandafter
+ {\HyColor@values}#2%
+ \let\HyColor@model\HyColor@model@gray
+ \else
+ \convertcolorspec\HyColor@model\HyColor@values
+ \HyColor@model@rgb#2%
+ \expandafter\HyColor@NormalizeCommaRGB#2\@nil#2%
+ \let\HyColor@model\HyColor@model@rgb
+ \fi\fi\fi\fi
+ }{%
+ \let#2\relax
+ \HyColor@ErrorSpecNoXcolor{#3}{#4}%
+ }%
+ }%
+ \fi
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Field options}
+%
+% \begin{macro}{\HyColor@FieldBColor}
+% \begin{macrocode}
+\let\HyColor@FieldBColor\HyColor@XZeroOneThreeFour
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\HyColor@FieldColor}
+% \begin{macrocode}
+\def\HyColor@FieldColor#1#2#3#4{%
+ \let\HyColor@model\@empty
+ \HyColor@XZeroOneThreeFour{#1}{#2}{#3}{#4}%
+ \ifx#2\relax
+ \let#2\@empty
+ \else
+ \ifx#2\@empty
+ \else
+ \ifx\HyColor@model\HyColor@model@gray
+ \edef#2{#2 g}%
+ \else\ifx\HyColor@model\HyColor@model@rgb
+ \edef#2{#2 rg}%
+ \else\ifx\HyColor@model\HyColor@model@cmyk
+ \edef#2{#2 k}%
+ \else
+ \PackageError{#3}{Internal error: unsupported color model}\@ehc
+ \fi\fi\fi
+ \fi
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Detection for naked RGB values}
+%
+% \begin{macro}{\HyColor@IfRGB}
+% \begin{macrocode}
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname pdfmatch\endcsname\relax
+ \expandafter\@firstoftwo
+\else
+ \expandafter\@secondoftwo
+\fi
+{%
+ \newif\ifHyColor@result
+ \begingroup
+ \def\x#1{\endgroup
+ \def\HyColor@IfRGB##1{%
+ \HyColor@@IfRGB##1#1#1#1\@nil
+ }%
+ }%
+ \x{ }%
+ \edef\HyColor@TwoSpaces{\space\space}%
+ \def\HyColor@@IfRGB#1 #2 #3 #4\@nil{%
+ \HyColor@resulttrue
+ \def\HyColor@temp{#4}%
+ \ifx\HyColor@temp\HyColor@TwoSpaces
+ \HyColor@CheckNum{#1}%
+ \ifHyColor@result
+ \HyColor@CheckNum{#2}%
+ \ifHyColor@result
+ \HyColor@CheckNum{#3}%
+ \fi
+ \fi
+ \else
+ \HyColor@resultfalse
+ \fi
+ \ifHyColor@result
+ \let\HyColor@model\HyColor@model@rgb
+ \edef\HyColor@values{#1,#2,#3}%
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi
+ }%
+ \def\HyColor@zero{0}%
+ \def\HyColor@one{1}%
+ \def\HyColor@dot{.}%
+ \def\HyColor@CheckNum#1{%
+ \def\HyColor@temp{#1}%
+ \ifx\HyColor@temp\@empty
+ \HyColor@resultfalse
+ \else
+ \edef\HyColor@temp{\@car#1\@nil}%
+ \ifx\HyColor@temp\HyColor@zero
+ \else
+ \ifx\HyColor@temp\HyColor@one
+ \else
+ \ifx\HyColor@temp\HyColor@dot
+ \else
+ \HyColor@resultfalse
+ \fi
+ \fi
+ \fi
+ \fi
+ }%
+}{%
+ \def\HyColor@MatchNum{%
+ (0*1\string\.0*|0*1|0+\string\.?[0-9]*|\string\.[0-9]+)%
+ }%
+ \def\HyColor@IfRGB#1{%
+ \ifnum\pdfmatch{^\HyColor@MatchNum\space\HyColor@MatchNum
+ \space\HyColor@MatchNum$}{#1}>\z@
+ \let\HyColor@model\HyColor@model@rgb
+ \edef\HyColor@values{%
+ \expandafter\strip@prefix\pdflastmatch1,%
+ \expandafter\strip@prefix\pdflastmatch2,%
+ \expandafter\strip@prefix\pdflastmatch3%
+ }%
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Options \xoption{*bordercolor}}
+%
+% \begin{procedure}
+% \Param{value}{value of the option}
+% \Param{cmd}{macro for result}
+% \Param{package, option}{package and option for error message}
+% \caption{HyperrefBorderColor(value, cmd, output, package, option)}
+% \BlankLine
+% \Switch{\Var{value}}{
+% \Case{empty}{
+% \Var{cmd} \Gets no color\;
+% }
+% \Case{with model}{
+% \eIf{with xcolor}{
+% (\Var{model}, \Var{values}) \Gets convert to rgb\;
+% \Var{cmd} \Gets output values\;
+% }{
+% \Switch{\Var{model}}{
+% \Case{rgb, gray}{
+% \Var{cmd} \Gets output values\;
+% }
+% \Else{
+% error(\Var{package}, \Var{option}, "Missing xcolor")\;
+% \Var{cmd} \Gets no color\;
+% }
+% }
+% }
+% }
+% \Case{rgb values}{
+% \Var{cmd} \Gets output values\;
+% }
+% \Case{without model}{
+% \eIf{with xcolor}{
+% (\Var{model}, \Var{values}) \Gets convert to rgb\;
+% \Var{cmd} \Gets output values\;
+% }{
+% error(\Var{package}, \Var{option}, "Missing xcolor");
+% \Var{cmd} \Gets no color\;
+% }
+% }
+% }
+% \end{procedure}
+%
+% \begin{macro}{\HyColor@HyperrefBorderColor}
+% \begin{macrocode}
+\def\HyColor@HyperrefBorderColor#1#2#3#4{%
+ \HyColor@IfModel{#1}{%
+ \HyColor@IfXcolor{%
+ \convertcolorspec\HyColor@model\HyColor@values
+ \HyColor@model@rgb#2%
+ \expandafter\HyColor@NormalizeCommaRGB#2\@nil#2%
+ }{%
+ \ifx\HyColor@model\HyColor@model@rgb
+ \expandafter\HyColor@NormalizeCommaRGB\HyColor@values\@nil#2%
+ \else
+ \ifx\HyColor@model\HyColor@model@gray
+ \expandafter\HyColor@NormalizeNum
+ \expandafter{\HyColor@values}#2%
+ \edef#2{#2 #2 #2}%
+ \else
+ \let#2\relax
+ \HyColor@ErrorModelNoXcolor{#3}{#4}%
+ \fi
+ \fi
+ }%
+ }{%
+ \let#2\HyColor@values
+ \ifx#2\@empty
+ \let#2\relax
+ \else
+ \expandafter\HyColor@IfRGB\expandafter{\HyColor@values}{%
+ \expandafter\HyColor@NormalizeCommaRGB\HyColor@values\@nil#2%
+ }{%
+ \HyColor@IfXcolor{%
+ \extractcolorspec{#1}#2%
+ \expandafter\convertcolorspec#2\HyColor@model@rgb#2%
+ \expandafter\HyColor@NormalizeCommaRGB#2\@nil#2%
+ }{%
+ \let#2\relax
+ \HyColor@ErrorSpecNoXcolor{#3}{#4}%
+ }%
+ }%
+ \fi
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+%
+% \section{Test}]
+%
+% \begin{macrocode}
+%<*test1>
+\ProvidesFile{hycolor-test1.tex}[2007/04/11 test file 1]
+%</test1>
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<*test2>
+\ProvidesFile{hycolor-test2.tex}[2007/04/11 test file 2]
+\let\pdfmatch\relax
+%</test2>
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<*test>
+% \end{macrocode}
+% \begin{macrocode}
+\documentclass{article}
+
+\usepackage{qstest}
+\IncludeTests{*}
+\LogTests{lgout}{*}{*}
+
+\makeatletter
+
+\newcommand*{\TestPackageName}{test-package}
+\newcommand*{\TestOptionName}{test-option}
+
+\newcommand\Message{}
+\def\Message#1#{\immediate\write16}
+
+\newcommand*{\ExpectError}[2]{%
+ \begingroup
+ \global\let\saved@errhelp\errhelp
+ \global\let\saved@errmessage\errmessage
+ \let\errhelp\@gobble
+ \def\errmessage##1{%
+ \xdef\@ExpectErrorMessage{##1}%
+ }%
+ \PackageError\TestPackageName{#1}\@ehc
+ \def\errhelp##1{%
+ \global\let\errhelp\saved@errhelp
+ }%
+ \global\let\@ResultErrorMessage\@empty
+ \def\errmessage##1{%
+ \xdef\@ResultErrorMessage{##1}%
+ \global\let\errmessage\saved@errmessage
+ % \Message{[ ##1}%
+ % \Message{] (ignored error)}%
+ % \Message{}%
+ }%
+ #2%
+ \endgroup
+ \Expect*{\@ResultErrorMessage}*{\@ExpectErrorMessage}%
+}
+
+\usepackage{hycolor}
+%</test>
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<*test1>
+\begin{qstest}{NumNormalize}{num, normalize}
+ \def\test#1#2{%
+ \HyColor@NormalizeNum{#1}\cmd
+ \Expect*{\cmd}{#2}%
+ }%
+ \test{0}{0}%
+ \test{000}{0}%
+ \test{-1}{0}%
+ \test{ 0 }{0}%
+ \test{1.1}{1}%
+ \test{100}{1}%
+ \test{00100}{1}%
+ \test{99.99}{1}%
+ \test{0.0}{0}%
+ \test{00.00}{0}%
+ \test{0.}{0}%
+ \test{.0}{0}%
+ \test{0.1}{.1}%
+ \test{0.10}{.1}%
+ \test{0.1000}{.1}%
+ \test{.1000}{.1}%
+ \test{0.01}{.01}%
+ \test{0.01010}{.0101}%
+ \test{.0000000001}{.0000000001}%
+ \test{.9999999999}{.9999999999}%
+\end{qstest}
+
+\begin{qstest}{BookmarkColor without xcolor}{bookmark, noxcolor}
+ \def\test#1#2{%
+ \HyColor@BookmarkColor{#1}\cmd\TestPackageName\TestOptionName
+ \Expect*{\cmd}{#2}%
+ }%
+ \test{[rgb]{1,0,0}}{1 0 0}%
+ \test{[gray]{0.10}}{.1 .1 .1}%
+ \test{}{}%
+ \test{[rgb]{ 1 , 1 , 0 }}{1 1 0}%
+ \def\errortest[#1]#2{%
+ \ExpectError{%
+ Color model `#1' is not supported\MessageBreak
+ without package `xcolor' in\MessageBreak
+ `\TestOptionName=[#1]{#2}'%
+ }{%
+ \test{[#1]{#2}}{}%
+ }%
+ }%
+ \errortest[cmyk]{1,0,0,0}%
+ \errortest[empty]{}%
+ \def\errortest#1{%
+ \ExpectError{%
+ This color specification is not supported\MessageBreak
+ without package `xcolor' in\MessageBreak
+ `\TestOptionName=#1'%
+ }{%
+ \test{#1}{}%
+ }%
+ }%
+\end{qstest}
+%</test1>
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<*test1|test2>
+\begin{qstest}{X0134 without xcolor}{X0134, noxcolor}
+ \def\test#1#2{%
+ \HyColor@XZeroOneThreeFour{#1}\cmd\TestPackageName\TestOptionName
+ \Expect*{\cmd}{#2}%
+ }%
+ \test{[empty]{}}{}%
+ \test{[rgb]{1,0,0}}{1 0 0}%
+ \test{[gray]{0.10}}{.1}%
+ \test{[cmyk]{0,1,0,0}}{0 1 0 0}%
+ \test{[rgb]{ 1 , 1 , 0 }}{1 1 0}%
+ \def\errortest[#1]#2{%
+ \ExpectError{%
+ Color model `#1' is not supported\MessageBreak
+ without package `xcolor' in\MessageBreak
+ `test-option=[#1]{#2}'%
+ }{%
+ \HyColor@XZeroOneThreeFour{[#1]{#2}}\cmd
+ \TestPackageName\TestOptionName
+ \Expect{true}*{\ifx\cmd\relax true\else false\fi}%
+ }%
+ }%
+ \errortest[Gray]{10}%
+ \errortest[cmy]{1,0,0}%
+ \def\errortest#1{%
+ \ExpectError{%
+ This color specification is not supported\MessageBreak
+ without package `xcolor' in\MessageBreak
+ `test-option=#1'%
+ }{%
+ \HyColor@XZeroOneThreeFour{#1}\cmd\TestPackageName\TestOptionName
+ \Expect{true}*{\ifx\cmd\relax true\else false\fi}%
+ }%
+ }%
+ \errortest{yellow}%
+\end{qstest}
+
+\begin{qstest}{HyperrefBorderColor without xcolor}%
+ {hyperef bordercolor, noxcolor}%
+ \def\test#1#2{%
+ \HyColor@HyperrefBorderColor{#1}\cmd\TestPackageName\TestOptionName
+ \Expect*{\cmd}{#2}%
+ }%
+ \test{[rgb]{1,0,0}}{1 0 0}%
+ \test{[gray]{0.10}}{.1 .1 .1}%
+ \test{[rgb]{ 1 , 1 , 0 }}{1 1 0}%
+ \def\errortest[#1]#2{%
+ \ExpectError{%
+ Color model `#1' is not supported\MessageBreak
+ without package `xcolor' in\MessageBreak
+ `test-option=[#1]{#2}'%
+ }{%
+ \HyColor@HyperrefBorderColor{[#1]{#2}}\cmd
+ \TestPackageName\TestOptionName
+ \Expect{true}*{\ifx\cmd\relax true\else false\fi}%
+ }%
+ }%
+ \errortest[Gray]{10}%
+ \errortest[cmy]{1,0,0}%
+ \errortest[cmyk]{0,1,0,0}%
+ \def\errortest#1{%
+ \ExpectError{%
+ This color specification is not supported\MessageBreak
+ without package `xcolor' in\MessageBreak
+ `test-option=#1'%
+ }{%
+ \HyColor@HyperrefBorderColor{#1}\cmd
+ \TestPackageName\TestOptionName
+ \Expect{true}*{\ifx\cmd\relax true\else false\fi}%
+ }%
+ }%
+ \errortest{yellow}%
+\end{qstest}
+%</test1|test2>
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<*test1|test2>
+\usepackage{xcolor}
+\definecolor[named]{MyGreen}{rgb}{0,0.7,0}
+\definecolor{mygreen}{named}{MyGreen}
+%</test1|test2>
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<*test1>
+\begin{qstest}{BookmarkColor with xcolor}{bookmark, xcolor}
+ \def\test#1#2{%
+ \HyColor@BookmarkColor{#1}\cmd\PackageName\OptionName
+ \Expect*{\cmd}{#2}%
+ }%
+ \test{[rgb]{1,0,0}}{1 0 0}%
+ \test{[gray]{0.10}}{.1 .1 .1}%
+ \test{}{}%
+ \test{[rgb]{ 1 , 1 , 0 }}{1 1 0}%
+ \test{[cmyk]{1,0,0,0}}{0 1 1}%
+ \test{red}{1 0 0}%
+ \test{cyan}{0 1 1}%
+ \test{red!40!blue}{.4 0 .6}%
+ \test{[Gray]{10}}{.66667 .66667 .66667}%
+ \test{[RGB]{100,200,50}}{.39217 .78432 .19609}%
+ \test{[wave]{363}}{.00316 0 .00316}%
+ \test{[wave]814}{.00797 0 0}%
+ \test{[HSB]{100,200,50}}{.03473 .20833 .12152}%
+ \test{[HTML]{A800FF}}{.65881 0 1}%
+ \test{[cmy]{.3,.5,.2}}{.7 .5 .8}%
+ \test{[cmyk]{.3,.5,.2,.1}}{.6 .4 .7}%
+ \test{[hsb]{.3,.5,.2}}{.12 .2 .1}%
+ \test{[Hsb]{120,.5,.2}}{.1 .2 .1}%
+ \test{[tHsb]{120,.5,.2}}{.2 .2 .1}%
+ \test{[named]{MyGreen}}{0 .7 0}%
+ \test{mygreen}{0 .7 0}%
+\end{qstest}
+
+\begin{qstest}{HyperrefColor}{hyperref, color}
+ \def\test#1#2{%
+ \HyColor@HyperrefColor{#1}\cmd
+ \Expect*{\cmd}{#2}%
+ }%
+ \test{red}{red}%
+ \test{[rgb]{1,0,0}}{[{rgb}]{1,0,0}}%
+ \HyColor@HyperrefColor{}\cmd
+ \Expect{true}*{\ifx\cmd\relax true\else false\fi}%
+\end{qstest}
+%</test1>
+% \end{macrocode}
+% \begin{macrocode}
+%<*test1|test2>
+\begin{qstest}{X0134 with xcolor}{hyperref, X0134, xcolor}
+ \def\test#1#2{%
+ \HyColor@XZeroOneThreeFour{#1}\cmd\PackageName\OptionName
+ \Expect*{\cmd}{#2}%
+ }%
+ \test{[empty]{}}{}%
+ \test{[gray]{0.1}}{.1}%
+ \test{[rgb]{1,0.5,0.0}}{1 .5 0}%
+ \test{[cmyk]{0,1,0,0.5}}{0 1 0 .5}%
+ \test{[Gray]{10}}{.66667}%
+ \test{red}{1 0 0}%
+ \test{1 0 0}{1 0 0}%
+ \test{001.0 .23 0}{1 .23 0}%
+ \test{[named]{MyGreen}}{0 .7 0}%
+ \test{mygreen}{0 .7 0}%
+ \HyColor@XZeroOneThreeFour{}\cmd\PackageName\OptionName
+ \Expect{true}*{\ifx\cmd\relax true\else false\fi}%
+\end{qstest}
+
+\begin{qstest}{FieldColor}{hyperref, field, FieldColor}
+ \def\test#1#2{%
+ \HyColor@FieldColor{#1}\cmd\PackageName\OptionName
+ \Expect*{\cmd}{#2}%
+ }%
+ \test{}{}%
+ \test{[gray]{0.7}}{.7 g}%
+ \test{[rgb]{1,0,0}}{1 0 0 rg}%
+ \test{[cmyk]{0,1,0,0}}{0 1 0 0 k}%
+ \test{[cmy]{.5,.4,.3}}{.5 .6 .7 rg}%
+\end{qstest}
+%</test1|test2>
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<*test>
+\begin{document}
+\end{document}
+%</test>
+% \end{macrocode}
+% \section{Installation}
+%
+% \subsection{Download}
+%
+% \paragraph{Package.} This package is available on
+% CTAN\footnote{\url{ftp://ftp.ctan.org/tex-archive/}}:
+% \begin{description}
+% \item[\CTAN{macros/latex/contrib/oberdiek/hycolor.dtx}] The source file.
+% \item[\CTAN{macros/latex/contrib/oberdiek/hycolor.pdf}] Documentation.
+% \end{description}
+%
+%
+% \paragraph{Bundle.} All the packages of the bundle `oberdiek'
+% are also available in a TDS compliant ZIP archive. There
+% the packages are already unpacked and the documentation files
+% are generated. The files and directories obey the TDS standard.
+% \begin{description}
+% \item[\CTAN{macros/latex/contrib/oberdiek/oberdiek-tds.zip}]
+% \end{description}
+%
+% \subsection{Bundle installation}
+%
+% \paragraph{Unpacking.} Unpack the \xfile{oberdiek-tds.zip} in the
+% TDS tree (also known as \xfile{texmf} tree) of your choice.
+% Example (linux):
+% \begin{quote}
+% |unzip oberdiek-tds.zip -d ~/texmf|
+% \end{quote}
+%
+% \paragraph{Script installation.}
+% Check the directory \xfile{TDS:scripts/oberdiek/} for
+% scripts that need further installation steps.
+% Package \xpackage{attachfile2} comes with the Perl script
+% \xfile{pdfatfi.pl} that should be installed in such a way
+% that it can be called as \texttt{pdfatfi}.
+% Example (linux):
+% \begin{quote}
+% |chmod +x scripts/oberdiek/pdfatfi.pl|\\
+% |cp scripts/oberdiek/pdfatfi.pl /usr/local/bin/|
+% \end{quote}
+%
+% \subsection{Package installation}
+%
+% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
+% \docstrip\ archive. The files are extracted by running the
+% \xfile{.dtx} through \plainTeX:
+% \begin{quote}
+% \verb|tex hycolor.dtx|
+% \end{quote}
+%
+% \paragraph{TDS.} Now the different files must be moved into
+% the different directories in your installation TDS tree
+% (also known as \xfile{texmf} tree):
+% \begin{quote}
+% \sbox0{^^A
+% \begin{tabular}{@{}>{\ttfamily}l@{$\quad\rightarrow\quad$}>{\ttfamily}l@{}}
+% hycolor.sty & tex/latex/oberdiek/hycolor.sty\\
+% hycolor.pdf & doc/latex/oberdiek/hycolor.pdf\\
+% hycolor-test1.tex & doc/latex/oberdiek/hycolor-test1.tex\\
+% hycolor-test2.tex & doc/latex/oberdiek/hycolor-test2.tex\\
+% hycolor.dtx & source/latex/oberdiek/hycolor.dtx\\
+% \end{tabular}^^A
+% }%
+% \ifdim\wd0>\linewidth
+% \mbox{}\nobreak\hskip0pt minus\leftmargin
+% \usebox0
+% \nobreak\hskip0pt minus\rightmargin
+% \else
+% \usebox0
+% \fi
+% \end{quote}
+% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's
+% TDS installing feature, then some files can already be in the right
+% place, see the documentation of \docstrip.
+%
+% \subsection{Refresh file name databases}
+%
+% If your \TeX~distribution
+% (\teTeX, \mikTeX, \dots) relies on file name databases, you must refresh
+% these. For example, \teTeX\ users run \verb|texhash| or
+% \verb|mktexlsr|.
+%
+% \subsection{Some details for the interested}
+%
+% \paragraph{Attached source.}
+%
+% The PDF documentation on CTAN also includes the
+% \xfile{.dtx} source file. It can be extracted by
+% AcrobatReader 6 or higher. Another option is \textsf{pdftk},
+% e.g. unpack the file into the current directory:
+% \begin{quote}
+% \verb|pdftk hycolor.pdf unpack_files output .|
+% \end{quote}
+%
+% \paragraph{Unpacking with \LaTeX.}
+% The \xfile{.dtx} chooses its action depending on the format:
+% \begin{description}
+% \item[\plainTeX:] Run \docstrip\ and extract the files.
+% \item[\LaTeX:] Generate the documentation.
+% \end{description}
+% If you insist on using \LaTeX\ for \docstrip\ (really,
+% \docstrip\ does not need \LaTeX), then inform the autodetect routine
+% about your intention:
+% \begin{quote}
+% \verb|latex \let\install=y\input{hycolor.dtx}|
+% \end{quote}
+% Do not forget to quote the argument according to the demands
+% of your shell.
+%
+% \paragraph{Generating the documentation.}
+% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate
+% the documentation. The process can be configured by the
+% configuration file \xfile{ltxdoc.cfg}. For instance, put this
+% line into this file, if you want to have A4 as paper format:
+% \begin{quote}
+% \verb|\PassOptionsToClass{a4paper}{article}|
+% \end{quote}
+% An example follows how to generate the
+% documentation with pdf\LaTeX:
+% \begin{quote}
+%\begin{verbatim}
+%pdflatex hycolor.dtx
+%makeindex -s gind.ist hycolor.idx
+%pdflatex hycolor.dtx
+%makeindex -s gind.ist hycolor.idx
+%pdflatex hycolor.dtx
+%\end{verbatim}
+% \end{quote}
+%
+% \begin{History}
+% \begin{Version}{2007/04/09 v1.0}
+% \item
+% First version.
+% \end{Version}
+% \begin{Version}{2007/04/11 v1.1}
+% \item
+% Line ends sanitized.
+% \end{Version}
+% \end{History}
+%
+% \PrintIndex
+%
+% \Finale
+\endinput