| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% File: hycolor.dtx |
| 4 |
% Version: 2020-01-27 v1.10 |
| 5 |
% Info: Color options for hyperref/bookmark |
| 6 |
% |
| 7 |
% Copyright (C) |
| 8 |
% 2007-2011 Heiko Oberdiek |
| 9 |
% 2016-2020 Oberdiek Package Support Group |
| 10 |
% https://github.com/ho-tex/hycolor/issues |
| 11 |
% |
| 12 |
% This work may be distributed and/or modified under the |
| 13 |
% conditions of the LaTeX Project Public License, either |
| 14 |
% version 1.3c of this license or (at your option) any later |
| 15 |
% version. This version of this license is in |
| 16 |
% https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 17 |
% and the latest version of this license is in |
| 18 |
% https://www.latex-project.org/lppl.txt |
| 19 |
% and version 1.3 or later is part of all distributions of |
| 20 |
% LaTeX version 2005/12/01 or later. |
| 21 |
% |
| 22 |
% This work has the LPPL maintenance status "maintained". |
| 23 |
% |
| 24 |
% The Current Maintainers of this work are |
| 25 |
% Heiko Oberdiek and the Oberdiek Package Support Group |
| 26 |
% https://github.com/ho-tex/hycolor/issues |
| 27 |
% |
| 28 |
% This work consists of the main source file hycolor.dtx |
| 29 |
% and the derived files |
| 30 |
% hycolor.sty, hycolor.pdf, hycolor.ins, hycolor.drv, |
| 31 |
% xcolor-patch.sty |
| 32 |
% |
| 33 |
% Distribution: |
| 34 |
% CTAN:macros/latex/contrib/hycolor/hycolor.dtx |
| 35 |
% CTAN:macros/latex/contrib/hycolor/hycolor.pdf |
| 36 |
% |
| 37 |
% Unpacking: |
| 38 |
% (a) If hycolor.ins is present: |
| 39 |
% tex hycolor.ins |
| 40 |
% (b) Without hycolor.ins: |
| 41 |
% tex hycolor.dtx |
| 42 |
% (c) If you insist on using LaTeX |
| 43 |
% latex \let\install=y\input{hycolor.dtx} |
| 44 |
% (quote the arguments according to the demands of your shell) |
| 45 |
% |
| 46 |
% Documentation: |
| 47 |
% (a) If hycolor.drv is present: |
| 48 |
% latex hycolor.drv |
| 49 |
% (b) Without hycolor.drv: |
| 50 |
% latex hycolor.dtx; ... |
| 51 |
% The class ltxdoc loads the configuration file ltxdoc.cfg |
| 52 |
% if available. Here you can specify further options, e.g. |
| 53 |
% use A4 as paper format: |
| 54 |
% \PassOptionsToClass{a4paper}{article} |
| 55 |
% |
| 56 |
% Program calls to get the documentation (example): |
| 57 |
% pdflatex hycolor.dtx |
| 58 |
% makeindex -s gind.ist hycolor.idx |
| 59 |
% pdflatex hycolor.dtx |
| 60 |
% makeindex -s gind.ist hycolor.idx |
| 61 |
% pdflatex hycolor.dtx |
| 62 |
% |
| 63 |
% Installation: |
| 64 |
% TDS:tex/latex/hycolor/hycolor.sty |
| 65 |
% TDS:tex/latex/hycolor/xcolor-patch.sty |
| 66 |
% TDS:doc/latex/hycolor/hycolor.pdf |
| 67 |
% TDS:source/latex/hycolor/hycolor.dtx |
| 68 |
% |
| 69 |
%<*ignore> |
| 70 |
\begingroup |
| 71 |
\catcode123=1 % |
| 72 |
\catcode125=2 % |
| 73 |
\def\x{LaTeX2e}% |
| 74 |
\expandafter\endgroup |
| 75 |
\ifcase 0\ifx\install y1\fi\expandafter |
| 76 |
\ifx\csname processbatchFile\endcsname\relax\else1\fi |
| 77 |
\ifx\fmtname\x\else 1\fi\relax |
| 78 |
\else\csname fi\endcsname |
| 79 |
%</ignore> |
| 80 |
%<*install> |
| 81 |
\input docstrip.tex |
| 82 |
\Msg{************************************************************************} |
| 83 |
\Msg{* Installation} |
| 84 |
\Msg{* Package: hycolor 2020-01-27 v1.10 Color options for hyperref/bookmark (HO)} |
| 85 |
\Msg{************************************************************************} |
| 86 |
|
| 87 |
\keepsilent |
| 88 |
\askforoverwritefalse |
| 89 |
|
| 90 |
\let\MetaPrefix\relax |
| 91 |
\preamble |
| 92 |
|
| 93 |
This is a generated file. |
| 94 |
|
| 95 |
Project: hycolor |
| 96 |
Version: 2020-01-27 v1.10 |
| 97 |
|
| 98 |
Copyright (C) |
| 99 |
2007-2011 Heiko Oberdiek |
| 100 |
2016-2020 Oberdiek Package Support Group |
| 101 |
|
| 102 |
This work may be distributed and/or modified under the |
| 103 |
conditions of the LaTeX Project Public License, either |
| 104 |
version 1.3c of this license or (at your option) any later |
| 105 |
version. This version of this license is in |
| 106 |
https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 107 |
and the latest version of this license is in |
| 108 |
https://www.latex-project.org/lppl.txt |
| 109 |
and version 1.3 or later is part of all distributions of |
| 110 |
LaTeX version 2005/12/01 or later. |
| 111 |
|
| 112 |
This work has the LPPL maintenance status "maintained". |
| 113 |
|
| 114 |
The Current Maintainers of this work are |
| 115 |
Heiko Oberdiek and the Oberdiek Package Support Group |
| 116 |
https://github.com/ho-tex/hycolor/issues |
| 117 |
|
| 118 |
|
| 119 |
This work consists of the main source file hycolor.dtx |
| 120 |
and the derived files |
| 121 |
hycolor.sty, hycolor.pdf, hycolor.ins, hycolor.drv, |
| 122 |
xcolor-patch.sty |
| 123 |
|
| 124 |
\endpreamble |
| 125 |
\let\MetaPrefix\DoubleperCent |
| 126 |
|
| 127 |
\generate{% |
| 128 |
\file{hycolor.ins}{\from{hycolor.dtx}{install}}% |
| 129 |
\file{hycolor.drv}{\from{hycolor.dtx}{driver}}% |
| 130 |
\usedir{tex/latex/hycolor}% |
| 131 |
\file{hycolor.sty}{\from{hycolor.dtx}{package}}% |
| 132 |
\file{xcolor-patch.sty}{\from{hycolor.dtx}{xcolor}}% |
| 133 |
} |
| 134 |
|
| 135 |
\catcode32=13\relax% active space |
| 136 |
\let =\space% |
| 137 |
\Msg{************************************************************************} |
| 138 |
\Msg{*} |
| 139 |
\Msg{* To finish the installation you have to move the following} |
| 140 |
\Msg{* files into a directory searched by TeX:} |
| 141 |
\Msg{*} |
| 142 |
\Msg{* hycolor.sty, xcolor-patch.sty} |
| 143 |
\Msg{*} |
| 144 |
\Msg{* To produce the documentation run the file `hycolor.drv'} |
| 145 |
\Msg{* through LaTeX.} |
| 146 |
\Msg{*} |
| 147 |
\Msg{* Happy TeXing!} |
| 148 |
\Msg{*} |
| 149 |
\Msg{************************************************************************} |
| 150 |
|
| 151 |
\endbatchfile |
| 152 |
%</install> |
| 153 |
%<*ignore> |
| 154 |
\fi |
| 155 |
%</ignore> |
| 156 |
%<*driver> |
| 157 |
\NeedsTeXFormat{LaTeX2e} |
| 158 |
\ProvidesFile{hycolor.drv}% |
| 159 |
[2020-01-27 v1.10 Color options for hyperref/bookmark (HO)]% |
| 160 |
\documentclass{ltxdoc} |
| 161 |
\usepackage{holtxdoc}[2011/11/22] |
| 162 |
\usepackage[ruled]{algorithm2e} |
| 163 |
|
| 164 |
\makeatletter |
| 165 |
\newcommand*{\makedefaultH}[1]{% |
| 166 |
\expandafter\edef\csname #1\endcsname{% |
| 167 |
\noexpand\@protected@testopt |
| 168 |
\expandafter\noexpand\csname#1\endcsname |
| 169 |
\expandafter\noexpand\csname |
| 170 |
\expandafter\string\csname#1\endcsname\endcsname |
| 171 |
{H}% |
| 172 |
}% |
| 173 |
} |
| 174 |
\makeatother |
| 175 |
\makedefaultH{algorithm} |
| 176 |
\makedefaultH{procedure} |
| 177 |
\makedefaultH{function} |
| 178 |
|
| 179 |
\SetKwInput{KwParam}{Param} |
| 180 |
\newcommand*{\Param}[2]{% |
| 181 |
\KwParam{\ArgSty{#1} (#2)}% |
| 182 |
} |
| 183 |
\newcommand*{\Dat}[1]{% |
| 184 |
\texttt{\upshape#1}% |
| 185 |
} |
| 186 |
\newcommand*{\Var}[1]{% |
| 187 |
\ArgSty{#1}% |
| 188 |
} |
| 189 |
\newcommand*{\Gets}{% |
| 190 |
\ensuremath{\leftarrow}% |
| 191 |
\ % |
| 192 |
} |
| 193 |
|
| 194 |
\makeatletter |
| 195 |
\newcommand*{\bs}{\texttt{\@backslashchar}} |
| 196 |
\makeatother |
| 197 |
\begin{document} |
| 198 |
\DocInput{hycolor.dtx}% |
| 199 |
\end{document} |
| 200 |
%</driver> |
| 201 |
% \fi |
| 202 |
% |
| 203 |
% |
| 204 |
% |
| 205 |
% \GetFileInfo{hycolor.drv} |
| 206 |
% |
| 207 |
% \title{The \xpackage{hycolor} package} |
| 208 |
% \date{2020-01-27 v1.10} |
| 209 |
% \author{Heiko Oberdiek\thanks |
| 210 |
% {Please report any issues at \url{https://github.com/ho-tex/hycolor/issues}}} |
| 211 |
% |
| 212 |
% \maketitle |
| 213 |
% |
| 214 |
% \begin{abstract} |
| 215 |
% Package \xpackage{hycolor} implements the color option stuff that |
| 216 |
% is used by packages \xpackage{hyperref} and \xpackage{bookmark}. |
| 217 |
% It is not intended as package for the user. |
| 218 |
% \end{abstract} |
| 219 |
% |
| 220 |
% \tableofcontents |
| 221 |
% |
| 222 |
% \section{Documentation} |
| 223 |
% |
| 224 |
% The package \xpackage{hycolor} implements color options |
| 225 |
% for packages \xpackage{hyperref} and \xpackage{bookmark}. |
| 226 |
% |
| 227 |
% Package \xpackage{xcolor} provides macros for extracting |
| 228 |
% color values and converting color data to other color models. |
| 229 |
% If this package is loaded, the full range of color specifications |
| 230 |
% of packages \xpackage{color} and \xpackage{xcolor} are supported |
| 231 |
% including the optional argument for the color model. |
| 232 |
% \begin{quote} |
| 233 |
% |\hypersetup{linkbordercolor=red}%| needs \xpackage{xcolor}\\ |
| 234 |
% |\hypersetup{linkbordercolor=[named]{red}}%| needs \xpackage{xcolor}\\ |
| 235 |
% |\hypersetup{linkbordercolor=[rgb]{1,0,0}}| |
| 236 |
% \end{quote} |
| 237 |
% |
| 238 |
% Without package \xpackage{xcolor} some of the options only |
| 239 |
% support some models, if they are given directly, e.g.: |
| 240 |
% \begin{quote} |
| 241 |
% |\bookmarksetup{color=[rgb]{1,0,0}}| |
| 242 |
% \end{quote} |
| 243 |
% |
| 244 |
% Because of compatibility some options of \xpackage{hyperref} |
| 245 |
% also support space separated RGB values: |
| 246 |
% \begin{quote} |
| 247 |
% |\hypersetup{linkbordercolor=1 0 0}%| is the same as\\ |
| 248 |
% |\hypersetup{linkbordercolor=[rgb]{1,0,0}}| |
| 249 |
% \end{quote} |
| 250 |
% |
| 251 |
% Coloring is optional, it can be turned off by using an empty |
| 252 |
% value: |
| 253 |
% \begin{quote} |
| 254 |
% |\hypersetup{linkbordercolor={}}| |
| 255 |
% \end{quote} |
| 256 |
% |
| 257 |
% The PDF specification knows some kind of an emtpy color setting |
| 258 |
% without values. This applies to form field colors. The new |
| 259 |
% A virtual color model \texttt{empty} is introduced for this |
| 260 |
% purpose, e.g. |
| 261 |
% \begin{quote} |
| 262 |
% |\TextField[backgroundcolor={[empty]{}}, ...]{...}%| or\\ |
| 263 |
% |\TextField[{backgroundcolor=[empty]{}, ...}]{...}| |
| 264 |
% \end{quote} |
| 265 |
% PDF specification 1.7 also allows this for border link colors. |
| 266 |
% But this isn't currently supported by this package, because |
| 267 |
% the tested viewers (AR7/Linux, xpdf 3.00, ghostscript 8.54) |
| 268 |
% don't support this yet. In contrary ghostscript generates an |
| 269 |
% error message. |
| 270 |
% |
| 271 |
% \subsection{Summary} |
| 272 |
% |
| 273 |
% \begin{tabular}{@{}llll@{}} |
| 274 |
% Color option & Models without \xpackage{xcolor} |
| 275 |
% & RGB color & Model empty\\ |
| 276 |
% \hline |
| 277 |
% |BKM.color| & |gray|, |rgb| & no & no\\ |
| 278 |
% |Hyp.*color| & all & no & no\\ |
| 279 |
% |Hyp.*bordercolor| & |gray|, |rgb| & yes & no\\ |
| 280 |
% |Field.*color| & |gray|, |rgb|, |cmyk| & yes & yes\\ |
| 281 |
% |AtFi.color| & |gray|, |rgb| & yes & no\\ |
| 282 |
% \end{tabular} |
| 283 |
% |
| 284 |
% ``RGB color'' means that the color value can be given as |
| 285 |
% space separated RGB numbers (real numbers in the range |
| 286 |
% from 0 to 1). |
| 287 |
% Explanation of the color option prefixes: |
| 288 |
% |
| 289 |
% \begin{tabular}{@{}ll@{}} |
| 290 |
% Prefix & Explanation\\ |
| 291 |
% \hline |
| 292 |
% |BKM| & Package \xpackage{bookmark}\\ |
| 293 |
% |Hyp| & Package \xpackage{hyperref}: |
| 294 |
% package options or |\hypersetup|\\ |
| 295 |
% |Field| & Package \xpackage{hyperref}: |
| 296 |
% Form field options\\ |
| 297 |
% |AtFi| & Package \xpackage{attachfile2}: option \xoption{color}\\ |
| 298 |
% \end{tabular} |
| 299 |
% |
| 300 |
% |
| 301 |
% \StopEventually{ |
| 302 |
% } |
| 303 |
% |
| 304 |
% \section{Implementation} |
| 305 |
% |
| 306 |
% \begin{macrocode} |
| 307 |
%<*package> |
| 308 |
\NeedsTeXFormat{LaTeX2e} |
| 309 |
\ProvidesPackage{hycolor}% |
| 310 |
[2020-01-27 v1.10 Color options for hyperref/bookmark (HO)]% |
| 311 |
% \end{macrocode} |
| 312 |
% |
| 313 |
% Should not be needed after \textsf{xcolor} updates, |
| 314 |
% Avoid loading \xpackage{xcolor-patch} but fix Gray color model. |
| 315 |
% \begin{macrocode} |
| 316 |
% \RequirePackage{xcolor-patch}[2019/12/15] |
| 317 |
\AtBeginDocument{% |
| 318 |
\def\@tempa#1,{% |
| 319 |
\XC@ifxcase\tm{% |
| 320 |
\XC@mod@rgb{% |
| 321 |
\XC@calcN{#1}\@@tmp |
| 322 |
\edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}% |
| 323 |
}% |
| 324 |
\XC@mod@cmy{% |
| 325 |
\XC@calcC{#1}\@@tmp |
| 326 |
\edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}% |
| 327 |
}% |
| 328 |
\XC@mod@cmyk{% |
| 329 |
\XC@calcC{#1}\@@tmp |
| 330 |
\edef\@@tmp{0,0,0,\@@tmp}% |
| 331 |
}% |
| 332 |
\XC@mod@RGB{% |
| 333 |
\edef\@@scl{\rangeRGB}% |
| 334 |
\XC@calcM{#1}\@@tmp |
| 335 |
\edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}% |
| 336 |
}% |
| 337 |
\XC@mod@HTML{% |
| 338 |
\edef\@@scl{\@cclv}% |
| 339 |
\XC@calcM{#1}\@@tmp |
| 340 |
\XC@calcH\@@tmp\@@tmp |
| 341 |
\edef\@@tmp{\@@tmp\@@tmp\@@tmp}% |
| 342 |
}% |
| 343 |
\XC@mod@HSB{% |
| 344 |
\edef\@@scl{\rangeHSB}% |
| 345 |
\XC@calcM{#1}\@@tmp |
| 346 |
\edef\@@tmp{0,0,\@@tmp}% |
| 347 |
}% |
| 348 |
\XC@mod@Gray{% |
| 349 |
\edef\@@scl{\rangeGray}% |
| 350 |
\XC@calcM{#1}\@@tmp |
| 351 |
}% |
| 352 |
}% |
| 353 |
{% |
| 354 |
\XC@calcN{#1}\@@tmp |
| 355 |
\edef\@@tmp{0,0,\@@tmp}% |
| 356 |
}% |
| 357 |
}% |
| 358 |
\ifx\XC@cnv@gray\@tempa |
| 359 |
\def\XC@cnv@gray#1,{% |
| 360 |
\XC@ifxcase\tm{% |
| 361 |
\XC@mod@rgb{% |
| 362 |
\XC@calcN{#1}\@@tmp |
| 363 |
\edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}% |
| 364 |
}% |
| 365 |
\XC@mod@gray{}% |
| 366 |
\XC@mod@cmy{% |
| 367 |
\XC@calcC{#1}\@@tmp |
| 368 |
\edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}% |
| 369 |
}% |
| 370 |
\XC@mod@cmyk{% |
| 371 |
\XC@calcC{#1}\@@tmp |
| 372 |
\edef\@@tmp{0,0,0,\@@tmp}% |
| 373 |
}% |
| 374 |
\XC@mod@RGB{% |
| 375 |
\edef\@@scl{\rangeRGB}% |
| 376 |
\XC@calcM{#1}\@@tmp |
| 377 |
\edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}% |
| 378 |
}% |
| 379 |
\XC@mod@HTML{% |
| 380 |
\edef\@@scl{\@cclv}% |
| 381 |
\XC@calcM{#1}\@@tmp |
| 382 |
\XC@calcH\@@tmp\@@tmp |
| 383 |
\edef\@@tmp{\@@tmp\@@tmp\@@tmp}% |
| 384 |
}% |
| 385 |
\XC@mod@HSB{% |
| 386 |
\edef\@@scl{\rangeHSB}% |
| 387 |
\XC@calcM{#1}\@@tmp |
| 388 |
\edef\@@tmp{0,0,\@@tmp}% |
| 389 |
}% |
| 390 |
\XC@mod@Gray{% |
| 391 |
\edef\@@scl{\rangeGray}% |
| 392 |
\XC@calcM{#1}\@@tmp |
| 393 |
}% |
| 394 |
}% |
| 395 |
{% |
| 396 |
\XC@calcN{#1}\@@tmp |
| 397 |
\edef\@@tmp{0,0,\@@tmp}% |
| 398 |
}% |
| 399 |
}% |
| 400 |
\fi |
| 401 |
\let\@tempa\relax |
| 402 |
} |
| 403 |
% \end{macrocode} |
| 404 |
% |
| 405 |
% \subsection{Normalization} |
| 406 |
% |
| 407 |
% \subsubsection{Sanitize value of color option} |
| 408 |
% |
| 409 |
% \begin{procedure} |
| 410 |
% \Param{cmd}{macro} |
| 411 |
% \Param{value}{value of color option} |
| 412 |
% \BlankLine |
| 413 |
% \KwResult{\ArgSty{value} is expanded, sanitized, and |
| 414 |
% stored in macro \ArgSty{cmd}.} |
| 415 |
% \caption{DefSanitized(cmd, value)} |
| 416 |
% \BlankLine |
| 417 |
% Initialize active characters\; |
| 418 |
% \ArgSty{cmd} := Expand \ArgSty{value}\; |
| 419 |
% Sanitize \ArgSty{cmd}\; |
| 420 |
% \end{procedure} |
| 421 |
% \emph{Sanitization} means that the string does not contain any |
| 422 |
% macros or special tokens. It consists of characters with |
| 423 |
% catcode 12 (other). The only exception is the space with |
| 424 |
% catcode 10 (space). |
| 425 |
% \begin{macro}{\HyColor@DefSanitized} |
| 426 |
% \begin{macrocode} |
| 427 |
\begingroup |
| 428 |
\catcode`\!=13 % |
| 429 |
\catcode`\:=13 % |
| 430 |
\catcode`\-=13 % |
| 431 |
\catcode`\+=13 % |
| 432 |
\catcode`\;=13 % |
| 433 |
\catcode`\"=13 % |
| 434 |
\catcode`\>=13 % |
| 435 |
\edef\x{% |
| 436 |
\def\noexpand!{\string!}% |
| 437 |
\def\noexpand:{\string:}% |
| 438 |
\def\noexpand-{\string-}% |
| 439 |
\def\noexpand+{\string+}% |
| 440 |
\def\noexpand;{\string;}% |
| 441 |
\def\noexpand"{\string"}% |
| 442 |
\def\noexpand>{\string>}% |
| 443 |
}% |
| 444 |
\def\y#1{\endgroup |
| 445 |
\def\HyColor@DefSanitized##1##2{% |
| 446 |
\begingroup |
| 447 |
\csname @safe@activestrue\endcsname |
| 448 |
#1% |
| 449 |
\edef\x{\endgroup |
| 450 |
\def\noexpand##1{##2}% |
| 451 |
}% |
| 452 |
\x |
| 453 |
\@onelevel@sanitize##1% |
| 454 |
}% |
| 455 |
}% |
| 456 |
\expandafter\y\expandafter{\x} |
| 457 |
% \end{macrocode} |
| 458 |
% \end{macro} |
| 459 |
% |
| 460 |
% \subsubsection{Normalize result} |
| 461 |
% |
| 462 |
% \begin{procedure} |
| 463 |
% \Param{value}{Sanitized explicit number} |
| 464 |
% \Param{cmd}{Macro that stores result} |
| 465 |
% \BlankLine |
| 466 |
% \KwResult{\ArgSty{cmd} contains normalized number} |
| 467 |
% \caption{NormalizeNum(value, cmd)} |
| 468 |
% \BlankLine |
| 469 |
% \uIf{\Var{value}\,\Dat{pt} $<$ \Dat{0pt}}{ |
| 470 |
% \ArgSty{cmd} \Gets \Dat{0}\; |
| 471 |
% } |
| 472 |
% \uElseIf{number before dot of \Var{value} $<$ \Dat{1}}{ |
| 473 |
% \Var{cmd} \Gets number after dot of \Var{value}\; |
| 474 |
% \Var{cmd} \Gets strip trailing zeros from \Var{cmd}\; |
| 475 |
% \If{dot remains only}{ |
| 476 |
% \Var{cmd} \Gets \Dat{0}\; |
| 477 |
% } |
| 478 |
% } |
| 479 |
% \Else{ |
| 480 |
% \Var{cmd} \Gets \Dat{1}\; |
| 481 |
% } |
| 482 |
% \end{procedure} |
| 483 |
% The number is limited to the range between 0.0 and 1.0 and |
| 484 |
% formatted as short PDF number without leading or trailing zeros. |
| 485 |
% The precision of the number isn't changed. |
| 486 |
% \begin{macro}{\HyColor@NormalizeNum} |
| 487 |
% \begin{macrocode} |
| 488 |
\def\HyColor@NormalizeNum#1#2{% |
| 489 |
\ifdim#1pt<\z@ |
| 490 |
\def#2{0}% |
| 491 |
\else |
| 492 |
\edef#2{\zap@space#1 \@empty}% |
| 493 |
\expandafter\HyColor@CheckDot#2..\@nil#2% |
| 494 |
\fi |
| 495 |
} |
| 496 |
\def\HyColor@CheckDot#1.#2.#3\@nil#4{% |
| 497 |
\ifnum0#1<\@ne |
| 498 |
\ifx\\#2\\% |
| 499 |
\def#4{0}% |
| 500 |
\else |
| 501 |
\edef#4{\HyColor@ReverseString#2\@nil{}}% |
| 502 |
\edef#4{\expandafter\HyColor@StripLeadingZeros#4\@empty}% |
| 503 |
\ifx#4\@empty |
| 504 |
\def#4{0}% |
| 505 |
\else |
| 506 |
\edef#4{.\expandafter\HyColor@ReverseString#4\@nil{}}% |
| 507 |
\fi |
| 508 |
\fi |
| 509 |
\else |
| 510 |
\def#4{1}% |
| 511 |
\fi |
| 512 |
} |
| 513 |
\def\HyColor@ReverseString#1#2\@nil#3{% |
| 514 |
\ifx\\#2\\% |
| 515 |
#1#3% |
| 516 |
\else |
| 517 |
\@ReturnAfterFi{% |
| 518 |
\HyColor@ReverseString#2\@nil{#1#3}% |
| 519 |
}% |
| 520 |
\fi |
| 521 |
} |
| 522 |
\long\def\@ReturnAfterFi#1\fi{\fi#1} |
| 523 |
\def\HyColor@StripLeadingZeros#1{% |
| 524 |
\ifx#10% |
| 525 |
\expandafter\HyColor@StripLeadingZeros |
| 526 |
\else |
| 527 |
#1% |
| 528 |
\fi |
| 529 |
} |
| 530 |
% \end{macrocode} |
| 531 |
% \end{macro} |
| 532 |
% |
| 533 |
% \begin{macro}{\HyColor@NormalizeCommaRGB} |
| 534 |
% \begin{macrocode} |
| 535 |
\def\HyColor@NormalizeCommaRGB#1,#2,#3\@nil#4{% |
| 536 |
\HyColor@NormalizeNum{#1}\HyColor@temp |
| 537 |
\let#4\HyColor@temp |
| 538 |
\HyColor@NormalizeNum{#2}\HyColor@temp |
| 539 |
\edef#4{#4 \HyColor@temp}% |
| 540 |
\HyColor@NormalizeNum{#3}\HyColor@temp |
| 541 |
\edef#4{#4 \HyColor@temp}% |
| 542 |
} |
| 543 |
% \end{macrocode} |
| 544 |
% \end{macro} |
| 545 |
% |
| 546 |
% \begin{macro}{\HyColor@NormalizeCommaCMYK} |
| 547 |
% \begin{macrocode} |
| 548 |
\def\HyColor@NormalizeCommaCMYK#1,#2,#3,#4\@nil#5{% |
| 549 |
\HyColor@NormalizeNum{#1}\HyColor@temp |
| 550 |
\let#5\HyColor@temp |
| 551 |
\HyColor@NormalizeNum{#2}\HyColor@temp |
| 552 |
\edef#5{#5 \HyColor@temp}% |
| 553 |
\HyColor@NormalizeNum{#3}\HyColor@temp |
| 554 |
\edef#5{#5 \HyColor@temp}% |
| 555 |
\HyColor@NormalizeNum{#4}\HyColor@temp |
| 556 |
\edef#5{#5 \HyColor@temp}% |
| 557 |
} |
| 558 |
% \end{macrocode} |
| 559 |
% \end{macro} |
| 560 |
% |
| 561 |
% \subsection{Main algorithm for color options} |
| 562 |
% |
| 563 |
% \begin{procedure} |
| 564 |
% \Param{key}{name of color option} |
| 565 |
% \Param{value}{value of color option} |
| 566 |
% \Param{cmd}{macro that stores result} |
| 567 |
% \BlankLine |
| 568 |
% \KwResult{Macro \ArgSty{cmd} contains the calculated |
| 569 |
% color specification string or has the meaning of \cs{relax} |
| 570 |
% if the color must not set} |
| 571 |
% \caption{MainColorOptionAlgorithm(key, value, cmd)} |
| 572 |
% \BlankLine |
| 573 |
% DefSanitized(\ArgSty{temp}, \ArgSty{value})\; |
| 574 |
% Call option specific algorithm(\ArgSty{key}, \ArgSty{temp}, \ArgSty{cmd})\; |
| 575 |
% \end{procedure} |
| 576 |
% |
| 577 |
% \subsection{Package \xpackage{bookmark}} |
| 578 |
% |
| 579 |
% Since v0.8 2007/03/27 package \xpackage{bookmark} only provides |
| 580 |
% one color option \xoption{color}. Because option \xoption{rgbcolor} |
| 581 |
% can easily given as color specification in model rgb: |
| 582 |
% \begin{quote} |
| 583 |
% |rgbcolor=|\meta{r} \meta{g} \meta{b} $\equiv$ |
| 584 |
% |color=[rgb]{|\meta{r}|,|\meta{g}|,|\meta{b}|}| |
| 585 |
% \end{quote} |
| 586 |
% Package \xpackage{bookmark} stores the result in macro \cs{BKM@color}. |
| 587 |
% The empty string is interpreted as \emph{no color}. |
| 588 |
% |
| 589 |
% \begin{procedure} |
| 590 |
% \Param{value}{value of option \xoption{color}} |
| 591 |
% \Param{cmd}{macro for result} |
| 592 |
% \Param{package}{package name for error message} |
| 593 |
% \Param{option}{option name for error message} |
| 594 |
% \caption{BookmarkColor(value, cmd, package, option)} |
| 595 |
% \BlankLine |
| 596 |
% \Switch{\Var{value}}{ |
| 597 |
% \Case{empty}{ |
| 598 |
% \Var{cmd} \Gets no color\; |
| 599 |
% } |
| 600 |
% \Case{with model}{ |
| 601 |
% \eIf{with xcolor}{ |
| 602 |
% \Var{cmd} \Gets ConvertToRGB(\Var{model}, \Var{values})\; |
| 603 |
% }{ |
| 604 |
% \uIf{model $=$ rgb}{ |
| 605 |
% \Var{cmd} \Gets \Var{values} as normalized values\; |
| 606 |
% } |
| 607 |
% \uElseIf{model $=$ gray}{ |
| 608 |
% \Var{cmd} \Gets \Var{values} as normalized tripled values\; |
| 609 |
% } |
| 610 |
% \Else{ |
| 611 |
% error\; |
| 612 |
% } |
| 613 |
% } |
| 614 |
% } |
| 615 |
% \Other{ |
| 616 |
% \eIf{with xcolor}{ |
| 617 |
% (\Var{model}, \Var{values} \Gets get model and values\; |
| 618 |
% \Var{cmd} \Gets ConvertToRGB(\Var{model}, \Var{values})\; |
| 619 |
% }{ |
| 620 |
% error\; |
| 621 |
% } |
| 622 |
% } |
| 623 |
% } |
| 624 |
% \end{procedure} |
| 625 |
% |
| 626 |
% \begin{macrocode} |
| 627 |
\def\HyColor@BookmarkColor#1#2#3#4{% |
| 628 |
\HyColor@IfModel{#1}{% |
| 629 |
\HyColor@IfXcolor{% |
| 630 |
\convertcolorspec\HyColor@model\HyColor@values |
| 631 |
\HyColor@model@rgb#2% |
| 632 |
\expandafter\HyColor@NormalizeCommaRGB#2\@nil#2% |
| 633 |
}{% |
| 634 |
\ifx\HyColor@model\HyColor@model@rgb |
| 635 |
\expandafter\HyColor@NormalizeCommaRGB\HyColor@values\@nil#2% |
| 636 |
\else |
| 637 |
\ifx\HyColor@model\HyColor@model@gray |
| 638 |
\expandafter\HyColor@NormalizeNum |
| 639 |
\expandafter{\HyColor@values}#2% |
| 640 |
\edef#2{#2 #2 #2}% |
| 641 |
\else |
| 642 |
\let#2\@empty |
| 643 |
\HyColor@ErrorModelNoXcolor{#3}{#4}% |
| 644 |
\fi |
| 645 |
\fi |
| 646 |
}% |
| 647 |
}{% |
| 648 |
\let#2\HyColor@values |
| 649 |
\ifx#2\@empty |
| 650 |
\else |
| 651 |
\HyColor@IfXcolor{% |
| 652 |
\extractcolorspec{#1}#2% |
| 653 |
\expandafter\convertcolorspec#2\HyColor@model@rgb#2% |
| 654 |
\expandafter\HyColor@NormalizeCommaRGB#2\@nil#2% |
| 655 |
}{% |
| 656 |
\let#2\@empty |
| 657 |
\HyColor@ErrorSpecNoXcolor{#3}{#4}% |
| 658 |
}% |
| 659 |
\fi |
| 660 |
}% |
| 661 |
} |
| 662 |
% \end{macrocode} |
| 663 |
% \begin{macrocode} |
| 664 |
\def\HyColor@ErrorModelNoXcolor#1#2{% |
| 665 |
\PackageError{#1}{% |
| 666 |
Color model `\HyColor@model' is not supported\MessageBreak |
| 667 |
without package `xcolor' in\MessageBreak |
| 668 |
`#2=[\HyColor@model]{\HyColor@values}'% |
| 669 |
}\@ehc |
| 670 |
} |
| 671 |
% \end{macrocode} |
| 672 |
% \begin{macrocode} |
| 673 |
\def\HyColor@ErrorSpecNoXcolor#1#2{% |
| 674 |
\PackageError{#1}{% |
| 675 |
This color specification is not supported\MessageBreak |
| 676 |
without package `xcolor' in\MessageBreak |
| 677 |
`#2=\HyColor@values'% |
| 678 |
}\@ehc |
| 679 |
} |
| 680 |
% \end{macrocode} |
| 681 |
% |
| 682 |
% \begin{macrocode} |
| 683 |
\def\HyColor@IfModel#1{% |
| 684 |
\@ifnextchar[{% |
| 685 |
\HyColor@WithModel |
| 686 |
}{% |
| 687 |
\HyColor@WithoutModel |
| 688 |
}% |
| 689 |
#1\@nil |
| 690 |
} |
| 691 |
\def\HyColor@WithModel[#1]#2\@nil{% |
| 692 |
\HyColor@DefSanitized\HyColor@model{#1}% |
| 693 |
\HyColor@DefSanitized\HyColor@values{#2}% |
| 694 |
\@firstoftwo |
| 695 |
} |
| 696 |
\def\HyColor@WithoutModel#1\@nil{% |
| 697 |
\let\HyColor@model\relax |
| 698 |
\HyColor@DefSanitized\HyColor@values{#1}% |
| 699 |
\@secondoftwo |
| 700 |
} |
| 701 |
% \end{macrocode} |
| 702 |
% |
| 703 |
% \subsection{Utils} |
| 704 |
% |
| 705 |
% \begin{macro}{\@ReturnAfterFi} |
| 706 |
% \begin{macrocode} |
| 707 |
\long\def\@ReturnAfterFi#1\fi{\fi#1} |
| 708 |
% \end{macrocode} |
| 709 |
% \end{macro} |
| 710 |
% |
| 711 |
% \begin{macro}{\HyColor@IfXcolor} |
| 712 |
% \begin{macrocode} |
| 713 |
\def\HyColor@IfXcolor{% |
| 714 |
\begingroup\expandafter\expandafter\expandafter\endgroup |
| 715 |
\expandafter\ifx\csname convertcolorspec\endcsname\relax |
| 716 |
\expandafter\@secondoftwo |
| 717 |
\else |
| 718 |
\expandafter\@firstoftwo |
| 719 |
\fi |
| 720 |
} |
| 721 |
% \end{macrocode} |
| 722 |
% \end{macro} |
| 723 |
% |
| 724 |
% \begin{macrocode} |
| 725 |
\def\HyColor@model@empty{empty} |
| 726 |
\@onelevel@sanitize\HyColor@model@empty |
| 727 |
\def\HyColor@model@gray{gray} |
| 728 |
\@onelevel@sanitize\HyColor@model@gray |
| 729 |
\def\HyColor@model@rgb{rgb} |
| 730 |
\@onelevel@sanitize\HyColor@model@rgb |
| 731 |
\def\HyColor@model@cmyk{cmyk} |
| 732 |
\@onelevel@sanitize\HyColor@model@cmyk |
| 733 |
\def\HyColor@model@Gray{Gray} |
| 734 |
\@onelevel@sanitize\HyColor@model@Gray |
| 735 |
% \end{macrocode} |
| 736 |
% |
| 737 |
% \subsection{Package \xpackage{hyperref}} |
| 738 |
% |
| 739 |
% \subsubsection{Options \xoption{Hyp.*color}} |
| 740 |
% |
| 741 |
% \begin{macrocode} |
| 742 |
\def\HyColor@UseColor#1{% |
| 743 |
\ifx\relax#1\@empty |
| 744 |
\else |
| 745 |
\ifx\@empty#1\@empty |
| 746 |
\else |
| 747 |
\expandafter\expandafter\expandafter\HyColor@@UseColor#1\@nil |
| 748 |
\fi |
| 749 |
\fi |
| 750 |
} |
| 751 |
\def\HyColor@@UseColor{% |
| 752 |
\@ifnextchar[\HyColor@@@UseColor\HyColor@@@@UseColor |
| 753 |
} |
| 754 |
\def\HyColor@@@UseColor[#1]#2\@nil{% |
| 755 |
\color[{#1}]{#2}% |
| 756 |
} |
| 757 |
\def\HyColor@@@@UseColor#1\@nil{% |
| 758 |
\color{#1}% |
| 759 |
} |
| 760 |
% \end{macrocode} |
| 761 |
% |
| 762 |
% \begin{procedure} |
| 763 |
% \Param{value}{value of the option} |
| 764 |
% \Param{cmd}{macro for result} |
| 765 |
% \caption{HyperrefColor(value, cmd)} |
| 766 |
% \BlankLine |
| 767 |
% \Switch{\Var{value}}{ |
| 768 |
% \Case{empty}{ |
| 769 |
% \Var{cmd} \Gets no color\; |
| 770 |
% } |
| 771 |
% \Case{with model}{ |
| 772 |
% Call \cs{color} with model\; |
| 773 |
% } |
| 774 |
% \Case{without model}{ |
| 775 |
% Call \cs{color} without model\; |
| 776 |
% } |
| 777 |
% } |
| 778 |
% \end{procedure} |
| 779 |
% |
| 780 |
% \begin{macrocode} |
| 781 |
\def\HyColor@HyperrefColor#1#2{% |
| 782 |
\HyColor@IfModel{#1}{% |
| 783 |
\edef#2{[{\HyColor@model}]{\HyColor@values}}% |
| 784 |
}{% |
| 785 |
\let#2\HyColor@values |
| 786 |
\ifx#2\@empty |
| 787 |
\let#2\relax |
| 788 |
\fi |
| 789 |
}% |
| 790 |
} |
| 791 |
% \end{macrocode} |
| 792 |
% |
| 793 |
% \subsubsection{Generic algorithm} |
| 794 |
% |
| 795 |
% \begin{procedure} |
| 796 |
% \footnotesize |
| 797 |
% \Param{value}{value of the option} |
| 798 |
% \Param{cmd}{macro for result} |
| 799 |
% \Param{package}{package name for error message} |
| 800 |
% \Param{option}{option name for error message} |
| 801 |
% \caption{Algorithm X0134(value, cmd, package, option)} |
| 802 |
% \BlankLine |
| 803 |
% \Switch{\Var{value}}{ |
| 804 |
% \Case{empty}{ |
| 805 |
% \Var{cmd} \Gets no color\; |
| 806 |
% } |
| 807 |
% \Case{with model}{ |
| 808 |
% \Switch{\Var{model}}{ |
| 809 |
% \Case{empty}{ |
| 810 |
% \Var{cmd} \Gets ""\; |
| 811 |
% } |
| 812 |
% \Case{gray, rgb, cmyk}{ |
| 813 |
% \Var{cmd} \Gets \Var{output}()\; |
| 814 |
% } |
| 815 |
% \Case{Gray}{ |
| 816 |
% \eIf{with xcolor}{ |
| 817 |
% (\Var{model}, \Var{values}) \Gets convert to gray\; |
| 818 |
% }{ |
| 819 |
% error(\Var{package}, \Var{option}, "Missing xcolor"), |
| 820 |
% \Var{cmd} \Gets no color\; |
| 821 |
% } |
| 822 |
% } |
| 823 |
% \Else{ |
| 824 |
% \eIf{with xcolor}{ |
| 825 |
% (\Var{model}, \Var{values}) \Gets convert to rgb\; |
| 826 |
% \Var{cmd} \Gets \Var{output}()\; |
| 827 |
% }{ |
| 828 |
% error(\Var{package}, \Var{option}, "Missing xcolor"), |
| 829 |
% \Var{cmd} \Gets no color\; |
| 830 |
% } |
| 831 |
% } |
| 832 |
% } |
| 833 |
% } |
| 834 |
% \Case{rgb values}{ |
| 835 |
% (\Var{model}, \Var{values}) \Gets ("rgb", (r,g,b))\; |
| 836 |
% \Var{cmd} \Gets \Var{output}()\; |
| 837 |
% } |
| 838 |
% \Case{without model}{ |
| 839 |
% \eIf{with xcolor}{ |
| 840 |
% (\Var{model}, \Var{values}) \Gets |
| 841 |
% get model and values(\Var{value})\; |
| 842 |
% \Switch{\Var{model}}{ |
| 843 |
% \Case{gray, rgb, cmyk}{ |
| 844 |
% \Var{cmd} \Gets \Var{output}()\; |
| 845 |
% } |
| 846 |
% \Case{Gray}{ |
| 847 |
% (\Var{model}, \Var{values}) \Gets convert to gray\; |
| 848 |
% \Var{cmd} \Gets \Var{output}()\; |
| 849 |
% } |
| 850 |
% \Else{ |
| 851 |
% (\Var{model}, \Var{values}) \Gets convert to rgb\; |
| 852 |
% \Var{cmd} \Gets \Var{output}()\; |
| 853 |
% } |
| 854 |
% } |
| 855 |
% }{ |
| 856 |
% error(\Var{package}, \Var{option}, "Missing xcolor"), |
| 857 |
% \Var{cmd} \Gets no color\; |
| 858 |
% } |
| 859 |
% } |
| 860 |
% } |
| 861 |
% \end{procedure} |
| 862 |
% |
| 863 |
% \begin{macro}{\HyColor@XZeroOneThreeFour} |
| 864 |
% \begin{macrocode} |
| 865 |
\def\HyColor@XZeroOneThreeFour#1#2#3#4{% |
| 866 |
\HyColor@IfModel{#1}{% |
| 867 |
\ifx\HyColor@model\HyColor@model@empty |
| 868 |
\let#2\@empty |
| 869 |
\else\ifx\HyColor@model\HyColor@model@gray |
| 870 |
\expandafter\HyColor@NormalizeNum |
| 871 |
\expandafter{\HyColor@values}#2% |
| 872 |
\else\ifx\HyColor@model\HyColor@model@rgb |
| 873 |
\expandafter\HyColor@NormalizeCommaRGB\HyColor@values\@nil#2% |
| 874 |
\else\ifx\HyColor@model\HyColor@model@cmyk |
| 875 |
\expandafter\HyColor@NormalizeCommaCMYK\HyColor@values\@nil#2% |
| 876 |
\else\ifx\HyColor@model\HyColor@model@Gray |
| 877 |
\HyColor@IfXcolor{% |
| 878 |
\convertcolorspec\HyColor@model\HyColor@values |
| 879 |
\HyColor@model@gray#2% |
| 880 |
\expandafter\HyColor@NormalizeNum\expandafter{#2}#2% |
| 881 |
\let\HyColor@model\HyColor@model@gray |
| 882 |
}{% |
| 883 |
\let#2\relax |
| 884 |
\HyColor@ErrorModelNoXcolor{#3}{#4}% |
| 885 |
}% |
| 886 |
\else |
| 887 |
\HyColor@IfXcolor{% |
| 888 |
\convertcolorspec\HyColor@model\HyColor@values |
| 889 |
\HyColor@model@rgb#2% |
| 890 |
\expandafter\HyColor@NormalizeCommaRGB#2\@nil#2% |
| 891 |
\let\HyColor@model\HyColor@model@rgb |
| 892 |
}{% |
| 893 |
\let#2\relax |
| 894 |
\HyColor@ErrorModelNoXcolor{#3}{#4}% |
| 895 |
}% |
| 896 |
\fi\fi\fi\fi\fi |
| 897 |
}{% |
| 898 |
\let#2\HyColor@values |
| 899 |
\ifx#2\@empty |
| 900 |
\let#2\relax |
| 901 |
\else |
| 902 |
\expandafter\HyColor@IfRGB\expandafter{\HyColor@values}{% |
| 903 |
\expandafter\HyColor@NormalizeCommaRGB\HyColor@values\@nil#2% |
| 904 |
}{% |
| 905 |
\HyColor@IfXcolor{% |
| 906 |
\expandafter\extractcolorspec\expandafter{\HyColor@values}#2% |
| 907 |
\edef\HyColor@model{\expandafter\@firstoftwo#2}% |
| 908 |
\edef\HyColor@values{\expandafter\@secondoftwo#2}% |
| 909 |
\ifx\HyColor@model\HyColor@model@gray |
| 910 |
\expandafter\HyColor@NormalizeNum\expandafter |
| 911 |
{\HyColor@values}#2% |
| 912 |
\else\ifx\HyColor@model\HyColor@model@rgb |
| 913 |
\expandafter\HyColor@NormalizeCommaRGB |
| 914 |
\HyColor@values\@nil#2% |
| 915 |
\else\ifx\HyColor@model\HyColor@model@cmyk |
| 916 |
\expandafter\HyColor@NormalizeCommaCMYK |
| 917 |
\HyColor@values\@nil#2% |
| 918 |
\else\ifx\HyColor@model\HyColor@model@Gray |
| 919 |
\convertcolorspec\HyColor@model\HyColor@values |
| 920 |
\HyColor@model@gray#2% |
| 921 |
\expandafter\HyColor@NormalizeNum\expandafter |
| 922 |
{\HyColor@values}#2% |
| 923 |
\let\HyColor@model\HyColor@model@gray |
| 924 |
\else |
| 925 |
\convertcolorspec\HyColor@model\HyColor@values |
| 926 |
\HyColor@model@rgb#2% |
| 927 |
\expandafter\HyColor@NormalizeCommaRGB#2\@nil#2% |
| 928 |
\let\HyColor@model\HyColor@model@rgb |
| 929 |
\fi\fi\fi\fi |
| 930 |
}{% |
| 931 |
\let#2\relax |
| 932 |
\HyColor@ErrorSpecNoXcolor{#3}{#4}% |
| 933 |
}% |
| 934 |
}% |
| 935 |
\fi |
| 936 |
}% |
| 937 |
} |
| 938 |
% \end{macrocode} |
| 939 |
% \end{macro} |
| 940 |
% |
| 941 |
% \subsubsection{Field options} |
| 942 |
% |
| 943 |
% \begin{macro}{\HyColor@FieldBColor} |
| 944 |
% \begin{macrocode} |
| 945 |
\let\HyColor@FieldBColor\HyColor@XZeroOneThreeFour |
| 946 |
% \end{macrocode} |
| 947 |
% \end{macro} |
| 948 |
% |
| 949 |
% \begin{macro}{\HyColor@FieldColor} |
| 950 |
% \begin{macrocode} |
| 951 |
\def\HyColor@FieldColor#1#2#3#4{% |
| 952 |
\let\HyColor@model\@empty |
| 953 |
\HyColor@XZeroOneThreeFour{#1}{#2}{#3}{#4}% |
| 954 |
\ifx#2\relax |
| 955 |
\let#2\@empty |
| 956 |
\else |
| 957 |
\ifx#2\@empty |
| 958 |
\else |
| 959 |
\ifx\HyColor@model\HyColor@model@gray |
| 960 |
\edef#2{#2 g}% |
| 961 |
\else\ifx\HyColor@model\HyColor@model@rgb |
| 962 |
\edef#2{#2 rg}% |
| 963 |
\else\ifx\HyColor@model\HyColor@model@cmyk |
| 964 |
\edef#2{#2 k}% |
| 965 |
\else |
| 966 |
\PackageError{#3}{Internal error: unsupported color model}\@ehc |
| 967 |
\fi\fi\fi |
| 968 |
\fi |
| 969 |
\fi |
| 970 |
} |
| 971 |
% \end{macrocode} |
| 972 |
% \end{macro} |
| 973 |
% |
| 974 |
% \subsubsection{Detection for naked RGB values} |
| 975 |
% |
| 976 |
% \begin{macro}{\HyColor@IfRGB} |
| 977 |
% \begin{macrocode} |
| 978 |
\newif\ifHyColor@result |
| 979 |
\begingroup\expandafter\expandafter\expandafter\endgroup |
| 980 |
\expandafter\ifx\csname pdfmatch\endcsname\relax |
| 981 |
\expandafter\@firstoftwo |
| 982 |
\else |
| 983 |
\expandafter\@secondoftwo |
| 984 |
\fi |
| 985 |
{% |
| 986 |
\begingroup |
| 987 |
\def\x#1{\endgroup |
| 988 |
\def\HyColor@IfRGB##1{% |
| 989 |
\HyColor@@IfRGB##1#1#1#1\@nil |
| 990 |
}% |
| 991 |
}% |
| 992 |
\x{ }% |
| 993 |
\edef\HyColor@TwoSpaces{\space\space}% |
| 994 |
\def\HyColor@@IfRGB#1 #2 #3 #4\@nil{% |
| 995 |
\HyColor@resulttrue |
| 996 |
\def\HyColor@temp{#4}% |
| 997 |
\ifx\HyColor@temp\HyColor@TwoSpaces |
| 998 |
\HyColor@CheckNum{#1}% |
| 999 |
\ifHyColor@result |
| 1000 |
\HyColor@CheckNum{#2}% |
| 1001 |
\ifHyColor@result |
| 1002 |
\HyColor@CheckNum{#3}% |
| 1003 |
\fi |
| 1004 |
\fi |
| 1005 |
\else |
| 1006 |
\HyColor@resultfalse |
| 1007 |
\fi |
| 1008 |
\ifHyColor@result |
| 1009 |
\let\HyColor@model\HyColor@model@rgb |
| 1010 |
\edef\HyColor@values{#1,#2,#3}% |
| 1011 |
\expandafter\@firstoftwo |
| 1012 |
\else |
| 1013 |
\expandafter\@secondoftwo |
| 1014 |
\fi |
| 1015 |
}% |
| 1016 |
\def\HyColor@zero{0}% |
| 1017 |
\def\HyColor@one{1}% |
| 1018 |
\def\HyColor@dot{.}% |
| 1019 |
\def\HyColor@CheckNum#1{% |
| 1020 |
\def\HyColor@temp{#1}% |
| 1021 |
\ifx\HyColor@temp\@empty |
| 1022 |
\HyColor@resultfalse |
| 1023 |
\else |
| 1024 |
\edef\HyColor@temp{\@car#1\@nil}% |
| 1025 |
\ifx\HyColor@temp\HyColor@zero |
| 1026 |
\else |
| 1027 |
\ifx\HyColor@temp\HyColor@one |
| 1028 |
\else |
| 1029 |
\ifx\HyColor@temp\HyColor@dot |
| 1030 |
\else |
| 1031 |
\HyColor@resultfalse |
| 1032 |
\fi |
| 1033 |
\fi |
| 1034 |
\fi |
| 1035 |
\fi |
| 1036 |
}% |
| 1037 |
}{% |
| 1038 |
\def\HyColor@MatchNum{% |
| 1039 |
(0*1\string\.0*|0*1|0+\string\.?[0-9]*|\string\.[0-9]+)% |
| 1040 |
}% |
| 1041 |
\def\HyColor@IfRGB#1{% |
| 1042 |
\ifnum\pdfmatch{^\HyColor@MatchNum\space\HyColor@MatchNum |
| 1043 |
\space\HyColor@MatchNum$}{#1}>\z@ |
| 1044 |
\let\HyColor@model\HyColor@model@rgb |
| 1045 |
\edef\HyColor@values{% |
| 1046 |
\expandafter\strip@prefix\pdflastmatch1,% |
| 1047 |
\expandafter\strip@prefix\pdflastmatch2,% |
| 1048 |
\expandafter\strip@prefix\pdflastmatch3% |
| 1049 |
}% |
| 1050 |
\HyColor@resulttrue |
| 1051 |
\expandafter\@firstoftwo |
| 1052 |
\else |
| 1053 |
\HyColor@resultfalse |
| 1054 |
\expandafter\@secondoftwo |
| 1055 |
\fi |
| 1056 |
}% |
| 1057 |
} |
| 1058 |
% \end{macrocode} |
| 1059 |
% \end{macro} |
| 1060 |
% |
| 1061 |
% \subsubsection{Options \xoption{*bordercolor}} |
| 1062 |
% |
| 1063 |
% \begin{procedure} |
| 1064 |
% \Param{value}{value of the option} |
| 1065 |
% \Param{cmd}{macro for result} |
| 1066 |
% \Param{package, option}{package and option for error message} |
| 1067 |
% \caption{HyperrefBorderColor(value, cmd, package, option)} |
| 1068 |
% \BlankLine |
| 1069 |
% \Switch{\Var{value}}{ |
| 1070 |
% \Case{empty}{ |
| 1071 |
% \Var{cmd} \Gets no color\; |
| 1072 |
% } |
| 1073 |
% \Case{with model}{ |
| 1074 |
% \eIf{with xcolor}{ |
| 1075 |
% (\Var{model}, \Var{values}) \Gets convert to rgb\; |
| 1076 |
% \Var{cmd} \Gets output values\; |
| 1077 |
% }{ |
| 1078 |
% \Switch{\Var{model}}{ |
| 1079 |
% \Case{rgb, gray}{ |
| 1080 |
% \Var{cmd} \Gets output values\; |
| 1081 |
% } |
| 1082 |
% \Else{ |
| 1083 |
% error(\Var{package}, \Var{option}, "Missing xcolor")\; |
| 1084 |
% \Var{cmd} \Gets no color\; |
| 1085 |
% } |
| 1086 |
% } |
| 1087 |
% } |
| 1088 |
% } |
| 1089 |
% \Case{rgb values}{ |
| 1090 |
% \Var{cmd} \Gets output values\; |
| 1091 |
% } |
| 1092 |
% \Case{without model}{ |
| 1093 |
% \eIf{with xcolor}{ |
| 1094 |
% (\Var{model}, \Var{values}) \Gets convert to rgb\; |
| 1095 |
% \Var{cmd} \Gets output values\; |
| 1096 |
% }{ |
| 1097 |
% error(\Var{package}, \Var{option}, "Missing xcolor"); |
| 1098 |
% \Var{cmd} \Gets no color\; |
| 1099 |
% } |
| 1100 |
% } |
| 1101 |
% } |
| 1102 |
% \end{procedure} |
| 1103 |
% |
| 1104 |
% \begin{macro}{\HyColor@HyperrefBorderColor} |
| 1105 |
% \begin{macrocode} |
| 1106 |
\def\HyColor@HyperrefBorderColor#1#2#3#4{% |
| 1107 |
\HyColor@IfModel{#1}{% |
| 1108 |
\HyColor@IfXcolor{% |
| 1109 |
\convertcolorspec\HyColor@model\HyColor@values |
| 1110 |
\HyColor@model@rgb#2% |
| 1111 |
\expandafter\HyColor@NormalizeCommaRGB#2\@nil#2% |
| 1112 |
}{% |
| 1113 |
\ifx\HyColor@model\HyColor@model@rgb |
| 1114 |
\expandafter\HyColor@NormalizeCommaRGB\HyColor@values\@nil#2% |
| 1115 |
\else |
| 1116 |
\ifx\HyColor@model\HyColor@model@gray |
| 1117 |
\expandafter\HyColor@NormalizeNum |
| 1118 |
\expandafter{\HyColor@values}#2% |
| 1119 |
\edef#2{#2 #2 #2}% |
| 1120 |
\else |
| 1121 |
\let#2\relax |
| 1122 |
\HyColor@ErrorModelNoXcolor{#3}{#4}% |
| 1123 |
\fi |
| 1124 |
\fi |
| 1125 |
}% |
| 1126 |
}{% |
| 1127 |
\let#2\HyColor@values |
| 1128 |
\ifx#2\@empty |
| 1129 |
\let#2\relax |
| 1130 |
\else |
| 1131 |
\expandafter\HyColor@IfRGB\expandafter{\HyColor@values}{% |
| 1132 |
\expandafter\HyColor@NormalizeCommaRGB\HyColor@values\@nil#2% |
| 1133 |
}{% |
| 1134 |
\HyColor@IfXcolor{% |
| 1135 |
\extractcolorspec{#1}#2% |
| 1136 |
\expandafter\convertcolorspec#2\HyColor@model@rgb#2% |
| 1137 |
\expandafter\HyColor@NormalizeCommaRGB#2\@nil#2% |
| 1138 |
}{% |
| 1139 |
\let#2\relax |
| 1140 |
\HyColor@ErrorSpecNoXcolor{#3}{#4}% |
| 1141 |
}% |
| 1142 |
}% |
| 1143 |
\fi |
| 1144 |
}% |
| 1145 |
} |
| 1146 |
% \end{macrocode} |
| 1147 |
% \end{macro} |
| 1148 |
% |
| 1149 |
% \subsection{Package \xpackage{attachfile2}} |
| 1150 |
% |
| 1151 |
% Before PDF-1.7 only RGB values are permitted in annotations. |
| 1152 |
% Since PDF-1.7 the color entry in annotations understands |
| 1153 |
% several color models, depending on the size of the color array: |
| 1154 |
% \begin{itemize} |
| 1155 |
% \item Zero entries: means transparent, not useful for |
| 1156 |
% file attachments. AR7/Linux and AR8/Linux show black instead. |
| 1157 |
% \item One entry: color model `gray'. |
| 1158 |
% \item Three entries: color model `rgb'. |
| 1159 |
% \item Four entries: color model `cmyk'. |
| 1160 |
% \end{itemize} |
| 1161 |
% An empty color specification is interpreted as ``no color''. |
| 1162 |
% |
| 1163 |
% \begin{macro}{\HyColor@DetectPdfVersion} |
| 1164 |
% \begin{macrocode} |
| 1165 |
\def\HyColor@DetectPdfVersion{% |
| 1166 |
\begingroup\expandafter\expandafter\expandafter\endgroup |
| 1167 |
\expandafter\ifx\csname Hy@pdfversion\endcsname\relax |
| 1168 |
\global\chardef\HyColor@PdfVersion=0 % |
| 1169 |
\else |
| 1170 |
\global\chardef\HyColor@PdfVersion=\Hy@pdfversion\relax |
| 1171 |
\fi |
| 1172 |
\global\let\HyColor@DetectPdfVersion\relax |
| 1173 |
} |
| 1174 |
% \end{macrocode} |
| 1175 |
% \end{macro} |
| 1176 |
% |
| 1177 |
% \begin{macro}{\HyColor@SpaceToComma} |
| 1178 |
% \begin{macrocode} |
| 1179 |
\def\HyColor@SpaceToComma#1 #2\@nil{% |
| 1180 |
#1% |
| 1181 |
\ifx\relax#2\relax |
| 1182 |
\expandafter\@gobble |
| 1183 |
\else |
| 1184 |
,% |
| 1185 |
\expandafter\@firstofone |
| 1186 |
\fi |
| 1187 |
{% |
| 1188 |
\HyColor@SpaceToComma#2\@nil |
| 1189 |
}% |
| 1190 |
}% |
| 1191 |
% \end{macrocode} |
| 1192 |
% \end{macro} |
| 1193 |
% |
| 1194 |
% \begin{macro}{\HyColor@AttachfileColor} |
| 1195 |
% \begin{macrocode} |
| 1196 |
\def\HyColor@AttachfileColor#1#2#3#4#5#6{% |
| 1197 |
\def#2{#1}% |
| 1198 |
\ifx#2\@empty |
| 1199 |
\let#3\@gobble |
| 1200 |
\let#4\@empty |
| 1201 |
\else |
| 1202 |
\HyColor@resultfalse |
| 1203 |
\HyColor@XZeroOneThreeFour{#1}#3{#5}{#6}% |
| 1204 |
\ifHyColor@result |
| 1205 |
\edef#2{% |
| 1206 |
[rgb]{\expandafter\HyColor@SpaceToComma#3 \@nil}% |
| 1207 |
}% |
| 1208 |
\fi |
| 1209 |
\ifx\HyColor@model\HyColor@model@rgb |
| 1210 |
\edef#4{/C[#3]}% hash-ok |
| 1211 |
\edef#3##1{% |
| 1212 |
#3 % |
| 1213 |
\noexpand\csname atfi@SETRGBCOLOR##1\noexpand\endcsname |
| 1214 |
}% |
| 1215 |
\else |
| 1216 |
\ifx\HyColor@model\HyColor@model@gray |
| 1217 |
\HyColor@DetectPdfVersion |
| 1218 |
\ifnum\HyColor@PdfVersion<7 % |
| 1219 |
\edef#4{/C[#3 #3 #3]}% hash-ok |
| 1220 |
\else |
| 1221 |
\edef#4{/C[#3]}% hash-ok |
| 1222 |
\fi |
| 1223 |
\edef#3##1{% |
| 1224 |
#3 % |
| 1225 |
\noexpand\csname atfi@SETGRAYCOLOR##1\noexpand\endcsname |
| 1226 |
}% |
| 1227 |
\else |
| 1228 |
\ifx\HyColor@model\HyColor@model@cmyk |
| 1229 |
\HyColor@DetectPdfVersion |
| 1230 |
\ifnum\HyColor@PdfVersion<7 % |
| 1231 |
\HyColor@IfModel{#1}{% |
| 1232 |
\HyColor@IfXcolor{% |
| 1233 |
\convertcolorspec\HyColor@model\HyColor@values |
| 1234 |
\HyColor@model@rgb#4% |
| 1235 |
\expandafter\HyColor@NormalizeCommaRGB#4\@nil#4% |
| 1236 |
\edef#4{/C[#4]}% hash-ok |
| 1237 |
}{% |
| 1238 |
\let#4\@empty |
| 1239 |
\HyColor@ErrorModelNoXcolor{#5}{#6}% |
| 1240 |
}% |
| 1241 |
}{% |
| 1242 |
\HyColor@IfXcolor{% |
| 1243 |
\extractcolorspec{#1}#4% |
| 1244 |
\expandafter\convertcolorspec#4% |
| 1245 |
\HyColor@model@rgb#4% |
| 1246 |
\expandafter\HyColor@NormalizeCommaRGB#4\@nil#4% |
| 1247 |
\edef#4{/C[#4]}% hash-ok |
| 1248 |
}{% |
| 1249 |
\let#4\@empty |
| 1250 |
\HyColor@ErrorSpecNoXcolor{#5}{#6}% |
| 1251 |
}% |
| 1252 |
}% |
| 1253 |
\else |
| 1254 |
\edef#4{/C[#3]}% hash-ok |
| 1255 |
\fi |
| 1256 |
\edef#3##1{% |
| 1257 |
#3 % |
| 1258 |
\noexpand\csname atfi@SETCMYKCOLOR##1\noexpand\endcsname |
| 1259 |
}% |
| 1260 |
\else |
| 1261 |
\ifx\HyColor@model\HyColor@model@empty |
| 1262 |
\PackageError{#5}{% |
| 1263 |
Color model `empty' is not permitted for option `#6'% |
| 1264 |
}\@ehc |
| 1265 |
\let#2\@empty |
| 1266 |
\let#3\@gobble |
| 1267 |
\let#4\@empty |
| 1268 |
\else |
| 1269 |
\ifx\HyColor@model\relax % (missing xcolor) |
| 1270 |
\let#3\@gobble |
| 1271 |
\let#4\@empty |
| 1272 |
\else |
| 1273 |
\PackageError{#5}{% |
| 1274 |
Internal error: unsupported color model% |
| 1275 |
}\@ehc |
| 1276 |
\fi |
| 1277 |
\fi |
| 1278 |
\fi |
| 1279 |
\fi |
| 1280 |
\fi |
| 1281 |
\fi |
| 1282 |
} |
| 1283 |
% \end{macrocode} |
| 1284 |
% \end{macro} |
| 1285 |
% |
| 1286 |
% \begin{macrocode} |
| 1287 |
%</package> |
| 1288 |
% \end{macrocode} |
| 1289 |
% |
| 1290 |
% \subsection{Patch for package \xpackage{xcolor}} |
| 1291 |
% |
| 1292 |
% Because the test files triggered a bug in package \xpackage{xcolor} |
| 1293 |
% of version 2007/01/21 v2.11. |
| 1294 |
% I contacted the author of \xpackage{xcolor} Uwe Kern. He responded |
| 1295 |
% with a test version 2007/03/27 v2.12a00 that fixes the problem. |
| 1296 |
% However, apparently he did not found the time for an official |
| 1297 |
% release yet. Thus I have reluctantly written the following |
| 1298 |
% patch package using the fixes of v2.12a00. |
| 1299 |
% |
| 1300 |
% The patch is immediately applied if package \xpackage{xcolor} |
| 1301 |
% is already loaded. |
| 1302 |
% Otherwise the patch is delayed using \cs{AfterPackage} if |
| 1303 |
% package \xpackage{scrlfile} is loaded. As last resort |
| 1304 |
% \cs{AtBeginDocument} is used. |
| 1305 |
% \begin{macrocode} |
| 1306 |
%<*xcolor> |
| 1307 |
\NeedsTeXFormat{LaTeX2e} |
| 1308 |
\ProvidesPackage{xcolor-patch}[2020/01/27 v1.10 xcolor patch] |
| 1309 |
% \end{macrocode} |
| 1310 |
% \begin{macrocode} |
| 1311 |
\RequirePackage{hopatch} |
| 1312 |
\hopatch@AfterPackage{xcolor}{% |
| 1313 |
% \end{macrocode} |
| 1314 |
% \begin{macro}{\XC@ifxcase} |
| 1315 |
% \begin{macrocode} |
| 1316 |
\long\def\reserved@a#1#2#3{% |
| 1317 |
\long\def\@@tmp##1##2{% |
| 1318 |
\ifx#1##1% |
| 1319 |
\toks@{##2}% |
| 1320 |
\expandafter\remove@to@nnil |
| 1321 |
\else |
| 1322 |
\expandafter\@@tmp |
| 1323 |
\fi |
| 1324 |
}% |
| 1325 |
\@@tmp#2#1{#3}\@nnil\the\toks@ |
| 1326 |
}% |
| 1327 |
\ifx\XC@ifxcase\reserved@a |
| 1328 |
\long\def\XC@ifxcase#1#2#3{% |
| 1329 |
\long\def\XC@if@##1##2{% |
| 1330 |
\ifx#1##1% |
| 1331 |
\toks@{##2}% |
| 1332 |
\expandafter\remove@to@nnil |
| 1333 |
\else |
| 1334 |
\expandafter\XC@if@ |
| 1335 |
\fi |
| 1336 |
}% |
| 1337 |
\XC@if@#2#1{#3}\@nnil |
| 1338 |
\the\toks@ |
| 1339 |
}% |
| 1340 |
\fi |
| 1341 |
% \end{macrocode} |
| 1342 |
% \end{macro} |
| 1343 |
% \begin{macro}{\XC@ifcase} |
| 1344 |
% \begin{macrocode} |
| 1345 |
\long\def\reserved@a#1#2#3{% |
| 1346 |
\long\def\@@tmp##1##2{% |
| 1347 |
\@expandtwoargs\in@{,#1,}{,##1,}% |
| 1348 |
\ifin@ |
| 1349 |
\toks@{##2}% |
| 1350 |
\expandafter\remove@to@nnil |
| 1351 |
\else |
| 1352 |
\expandafter\@@tmp |
| 1353 |
\fi |
| 1354 |
}% |
| 1355 |
\@@tmp#2{#1}{#3}\@nnil |
| 1356 |
\the\toks@ |
| 1357 |
}% |
| 1358 |
\ifx\XC@ifcase\reserved@a |
| 1359 |
\long\def\XC@ifcase#1#2#3{% |
| 1360 |
\long\def\XC@if@##1##2{% |
| 1361 |
\@expandtwoargs\in@{,#1,}{,##1,}% |
| 1362 |
\ifin@ |
| 1363 |
\toks@{##2}% |
| 1364 |
\expandafter\remove@to@nnil |
| 1365 |
\else |
| 1366 |
\expandafter\XC@if@ |
| 1367 |
\fi |
| 1368 |
}% |
| 1369 |
\XC@if@#2{#1}{#3}\@nnil |
| 1370 |
\the\toks@ |
| 1371 |
}% |
| 1372 |
\fi |
| 1373 |
% \end{macrocode} |
| 1374 |
% \end{macro} |
| 1375 |
% \begin{macro}{\XC@cnv@gray} |
| 1376 |
% \begin{macrocode} |
| 1377 |
\def\reserved@a#1,{% |
| 1378 |
\XC@ifxcase\tm{% |
| 1379 |
\XC@mod@rgb{% |
| 1380 |
\XC@calcN{#1}\@@tmp |
| 1381 |
\edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}% |
| 1382 |
}% |
| 1383 |
\XC@mod@cmy{% |
| 1384 |
\XC@calcC{#1}\@@tmp |
| 1385 |
\edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}% |
| 1386 |
}% |
| 1387 |
\XC@mod@cmyk{% |
| 1388 |
\XC@calcC{#1}\@@tmp |
| 1389 |
\edef\@@tmp{0,0,0,\@@tmp}% |
| 1390 |
}% |
| 1391 |
\XC@mod@RGB{% |
| 1392 |
\edef\@@scl{\rangeRGB}% |
| 1393 |
\XC@calcM{#1}\@@tmp |
| 1394 |
\edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}% |
| 1395 |
}% |
| 1396 |
\XC@mod@HTML{% |
| 1397 |
\edef\@@scl{\@cclv}% |
| 1398 |
\XC@calcM{#1}\@@tmp |
| 1399 |
\XC@calcH\@@tmp\@@tmp |
| 1400 |
\edef\@@tmp{\@@tmp\@@tmp\@@tmp}% |
| 1401 |
}% |
| 1402 |
\XC@mod@HSB{% |
| 1403 |
\edef\@@scl{\rangeHSB}% |
| 1404 |
\XC@calcM{#1}\@@tmp |
| 1405 |
\edef\@@tmp{0,0,\@@tmp}% |
| 1406 |
}% |
| 1407 |
\XC@mod@Gray{% |
| 1408 |
\edef\@@scl{\rangeGray}% |
| 1409 |
\XC@calcM{#1}\@@tmp |
| 1410 |
}% |
| 1411 |
}% |
| 1412 |
{% |
| 1413 |
\XC@calcN{#1}\@@tmp |
| 1414 |
\edef\@@tmp{0,0,\@@tmp}% |
| 1415 |
}% |
| 1416 |
}% |
| 1417 |
\ifx\XC@cnv@gray\reserved@a |
| 1418 |
\def\XC@cnv@gray#1,{% |
| 1419 |
\XC@ifxcase\tm{% |
| 1420 |
\XC@mod@rgb{% |
| 1421 |
\XC@calcN{#1}\@@tmp |
| 1422 |
\edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}% |
| 1423 |
}% |
| 1424 |
\XC@mod@gray{}% |
| 1425 |
\XC@mod@cmy{% |
| 1426 |
\XC@calcC{#1}\@@tmp |
| 1427 |
\edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}% |
| 1428 |
}% |
| 1429 |
\XC@mod@cmyk{% |
| 1430 |
\XC@calcC{#1}\@@tmp |
| 1431 |
\edef\@@tmp{0,0,0,\@@tmp}% |
| 1432 |
}% |
| 1433 |
\XC@mod@RGB{% |
| 1434 |
\edef\@@scl{\rangeRGB}% |
| 1435 |
\XC@calcM{#1}\@@tmp |
| 1436 |
\edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}% |
| 1437 |
}% |
| 1438 |
\XC@mod@HTML{% |
| 1439 |
\edef\@@scl{\@cclv}% |
| 1440 |
\XC@calcM{#1}\@@tmp |
| 1441 |
\XC@calcH\@@tmp\@@tmp |
| 1442 |
\edef\@@tmp{\@@tmp\@@tmp\@@tmp}% |
| 1443 |
}% |
| 1444 |
\XC@mod@HSB{% |
| 1445 |
\edef\@@scl{\rangeHSB}% |
| 1446 |
\XC@calcM{#1}\@@tmp |
| 1447 |
\edef\@@tmp{0,0,\@@tmp}% |
| 1448 |
}% |
| 1449 |
\XC@mod@Gray{% |
| 1450 |
\edef\@@scl{\rangeGray}% |
| 1451 |
\XC@calcM{#1}\@@tmp |
| 1452 |
}% |
| 1453 |
}% |
| 1454 |
{% |
| 1455 |
\XC@calcN{#1}\@@tmp |
| 1456 |
\edef\@@tmp{0,0,\@@tmp}% |
| 1457 |
}% |
| 1458 |
}% |
| 1459 |
\fi |
| 1460 |
% \end{macrocode} |
| 1461 |
% \end{macro} |
| 1462 |
% |
| 1463 |
% \subsubsection{Fix fragile \cs{@frameb@x}} |
| 1464 |
% |
| 1465 |
% \cs{fbox} becomes fragile, because the internal \cs{@frameb@x} |
| 1466 |
% is redefined by package \xpackage{xcolor}. The redefinition is |
| 1467 |
% no longer robust. Test file: |
| 1468 |
%\begin{quote} |
| 1469 |
%\begin{verbatim} |
| 1470 |
%\documentclass{article} |
| 1471 |
%\usepackage{xcolor} |
| 1472 |
%\makeatletter |
| 1473 |
%\protected@edef\x{\fbox{abc}} |
| 1474 |
%\@@end |
| 1475 |
%\end{verbatim} |
| 1476 |
%\end{quote} |
| 1477 |
% \begin{macrocode} |
| 1478 |
\@ifundefined{XC@frameb@x }{% |
| 1479 |
\expandafter\let\csname XC@frameb@x \endcsname\XC@frameb@x |
| 1480 |
\edef\XC@frameb@x{% |
| 1481 |
\noexpand\protect |
| 1482 |
\expandafter\noexpand\csname XC@frameb@x \endcsname |
| 1483 |
}% |
| 1484 |
\expandafter\ifx\csname XC@frameb@x \endcsname\@frameb@x |
| 1485 |
\let\@frameb@x\XC@frameb@x |
| 1486 |
\fi |
| 1487 |
}{}% |
| 1488 |
} |
| 1489 |
% \end{macrocode} |
| 1490 |
% \begin{macrocode} |
| 1491 |
%</xcolor> |
| 1492 |
% \end{macrocode} |
| 1493 |
%% \section{Installation} |
| 1494 |
% |
| 1495 |
% \subsection{Download} |
| 1496 |
% |
| 1497 |
% \paragraph{Package.} This package is available on |
| 1498 |
% CTAN\footnote{\CTANpkg{hycolor}}: |
| 1499 |
% \begin{description} |
| 1500 |
% \item[\CTAN{macros/latex/contrib/hycolor/hycolor.dtx}] The source file. |
| 1501 |
% \item[\CTAN{macros/latex/contrib/hycolor/hycolor.pdf}] Documentation. |
| 1502 |
% \end{description} |
| 1503 |
% |
| 1504 |
% |
| 1505 |
% |
| 1506 |
% \subsection{Package installation} |
| 1507 |
% |
| 1508 |
% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting |
| 1509 |
% \docstrip\ archive. The files are extracted by running the |
| 1510 |
% \xfile{.dtx} through \plainTeX: |
| 1511 |
% \begin{quote} |
| 1512 |
% \verb|tex hycolor.dtx| |
| 1513 |
% \end{quote} |
| 1514 |
% |
| 1515 |
% \paragraph{TDS.} Now the different files must be moved into |
| 1516 |
% the different directories in your installation TDS tree |
| 1517 |
% (also known as \xfile{texmf} tree): |
| 1518 |
% \begin{quote} |
| 1519 |
% \def\t{^^A |
| 1520 |
% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} |
| 1521 |
% hycolor.sty & tex/latex/hycolor/hycolor.sty\\ |
| 1522 |
% xcolor-patch.sty & tex/latex/hycolor/xcolor-patch.sty\\ |
| 1523 |
% hycolor.pdf & doc/latex/hycolor/hycolor.pdf\\ |
| 1524 |
% hycolor.dtx & source/latex/hycolor/hycolor.dtx\\ |
| 1525 |
% \end{tabular}^^A |
| 1526 |
% }^^A |
| 1527 |
% \sbox0{\t}^^A |
| 1528 |
% \ifdim\wd0>\linewidth |
| 1529 |
% \begingroup |
| 1530 |
% \advance\linewidth by\leftmargin |
| 1531 |
% \advance\linewidth by\rightmargin |
| 1532 |
% \edef\x{\endgroup |
| 1533 |
% \def\noexpand\lw{\the\linewidth}^^A |
| 1534 |
% }\x |
| 1535 |
% \def\lwbox{^^A |
| 1536 |
% \leavevmode |
| 1537 |
% \hbox to \linewidth{^^A |
| 1538 |
% \kern-\leftmargin\relax |
| 1539 |
% \hss |
| 1540 |
% \usebox0 |
| 1541 |
% \hss |
| 1542 |
% \kern-\rightmargin\relax |
| 1543 |
% }^^A |
| 1544 |
% }^^A |
| 1545 |
% \ifdim\wd0>\lw |
| 1546 |
% \sbox0{\small\t}^^A |
| 1547 |
% \ifdim\wd0>\linewidth |
| 1548 |
% \ifdim\wd0>\lw |
| 1549 |
% \sbox0{\footnotesize\t}^^A |
| 1550 |
% \ifdim\wd0>\linewidth |
| 1551 |
% \ifdim\wd0>\lw |
| 1552 |
% \sbox0{\scriptsize\t}^^A |
| 1553 |
% \ifdim\wd0>\linewidth |
| 1554 |
% \ifdim\wd0>\lw |
| 1555 |
% \sbox0{\tiny\t}^^A |
| 1556 |
% \ifdim\wd0>\linewidth |
| 1557 |
% \lwbox |
| 1558 |
% \else |
| 1559 |
% \usebox0 |
| 1560 |
% \fi |
| 1561 |
% \else |
| 1562 |
% \lwbox |
| 1563 |
% \fi |
| 1564 |
% \else |
| 1565 |
% \usebox0 |
| 1566 |
% \fi |
| 1567 |
% \else |
| 1568 |
% \lwbox |
| 1569 |
% \fi |
| 1570 |
% \else |
| 1571 |
% \usebox0 |
| 1572 |
% \fi |
| 1573 |
% \else |
| 1574 |
% \lwbox |
| 1575 |
% \fi |
| 1576 |
% \else |
| 1577 |
% \usebox0 |
| 1578 |
% \fi |
| 1579 |
% \else |
| 1580 |
% \lwbox |
| 1581 |
% \fi |
| 1582 |
% \else |
| 1583 |
% \usebox0 |
| 1584 |
% \fi |
| 1585 |
% \end{quote} |
| 1586 |
% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's |
| 1587 |
% TDS installing feature, then some files can already be in the right |
| 1588 |
% place, see the documentation of \docstrip. |
| 1589 |
% |
| 1590 |
% \subsection{Refresh file name databases} |
| 1591 |
% |
| 1592 |
% If your \TeX~distribution |
| 1593 |
% (\TeX\,Live, \mikTeX, \dots) relies on file name databases, you must refresh |
| 1594 |
% these. For example, \TeX\,Live\ users run \verb|texhash| or |
| 1595 |
% \verb|mktexlsr|. |
| 1596 |
% |
| 1597 |
% \subsection{Some details for the interested} |
| 1598 |
% |
| 1599 |
% \paragraph{Unpacking with \LaTeX.} |
| 1600 |
% The \xfile{.dtx} chooses its action depending on the format: |
| 1601 |
% \begin{description} |
| 1602 |
% \item[\plainTeX:] Run \docstrip\ and extract the files. |
| 1603 |
% \item[\LaTeX:] Generate the documentation. |
| 1604 |
% \end{description} |
| 1605 |
% If you insist on using \LaTeX\ for \docstrip\ (really, |
| 1606 |
% \docstrip\ does not need \LaTeX), then inform the autodetect routine |
| 1607 |
% about your intention: |
| 1608 |
% \begin{quote} |
| 1609 |
% \verb|latex \let\install=y\input{hycolor.dtx}| |
| 1610 |
% \end{quote} |
| 1611 |
% Do not forget to quote the argument according to the demands |
| 1612 |
% of your shell. |
| 1613 |
% |
| 1614 |
% \paragraph{Generating the documentation.} |
| 1615 |
% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate |
| 1616 |
% the documentation. The process can be configured by the |
| 1617 |
% configuration file \xfile{ltxdoc.cfg}. For instance, put this |
| 1618 |
% line into this file, if you want to have A4 as paper format: |
| 1619 |
% \begin{quote} |
| 1620 |
% \verb|\PassOptionsToClass{a4paper}{article}| |
| 1621 |
% \end{quote} |
| 1622 |
% An example follows how to generate the |
| 1623 |
% documentation with pdf\LaTeX: |
| 1624 |
% \begin{quote} |
| 1625 |
%\begin{verbatim} |
| 1626 |
%pdflatex hycolor.dtx |
| 1627 |
%makeindex -s gind.ist hycolor.idx |
| 1628 |
%pdflatex hycolor.dtx |
| 1629 |
%makeindex -s gind.ist hycolor.idx |
| 1630 |
%pdflatex hycolor.dtx |
| 1631 |
%\end{verbatim} |
| 1632 |
% \end{quote} |
| 1633 |
% |
| 1634 |
% \begin{History} |
| 1635 |
% \begin{Version}{2007/04/09 v1.0} |
| 1636 |
% \item |
| 1637 |
% First version. |
| 1638 |
% \end{Version} |
| 1639 |
% \begin{Version}{2007/04/11 v1.1} |
| 1640 |
% \item |
| 1641 |
% Line ends sanitized. |
| 1642 |
% \end{Version} |
| 1643 |
% \begin{Version}{2008/07/29 v1.2} |
| 1644 |
% \item |
| 1645 |
% Support for package \xpackage{attachfile2} added. |
| 1646 |
% \end{Version} |
| 1647 |
% \begin{Version}{2008/08/01 v1.3} |
| 1648 |
% \item |
| 1649 |
% Patch package \xpackage{xcolor-patch} added that fixes bugs in |
| 1650 |
% package \xpackage{xcolor} to get the test files running. |
| 1651 |
% \end{Version} |
| 1652 |
% \begin{Version}{2008/09/08 v1.4} |
| 1653 |
% \item |
| 1654 |
% Fix added to package \xpackage{xcolor-patch}: |
| 1655 |
% Fragile \cs{@frameb@x} (used in \cs{fbox}) is made robust. |
| 1656 |
% \end{Version} |
| 1657 |
% \begin{Version}{2009/10/02 v1.5} |
| 1658 |
% \item |
| 1659 |
% Doku fixes (Herbert Voss). |
| 1660 |
% \end{Version} |
| 1661 |
% \begin{Version}{2009/12/12 v1.6} |
| 1662 |
% \item |
| 1663 |
% Short info shortened. |
| 1664 |
% \end{Version} |
| 1665 |
% \begin{Version}{2011/01/30 v1.7} |
| 1666 |
% \item |
| 1667 |
% Package \xpackage{xcolor-patch} uses package \xpackage{hopatch}. |
| 1668 |
% \end{Version} |
| 1669 |
% \begin{Version}{2016/05/16 v1.8} |
| 1670 |
% \item |
| 1671 |
% Documentation updates. |
| 1672 |
% \end{Version} |
| 1673 |
% \begin{Version}{2019/12/15 v1.9} |
| 1674 |
% \item |
| 1675 |
% Documentation updates. |
| 1676 |
% \item |
| 1677 |
% Do not load \xpackage{xcolor-patch} by default. |
| 1678 |
% \end{Version} |
| 1679 |
% \begin{Version}{2020-01-27 v1.10} |
| 1680 |
% \item extra expansion step to avoid \verb|! LaTeX Error: Undefined color `[{rgb}]| errors in hyperref. |
| 1681 |
% \item add fix to Gray model from \xpackage{xcolor-patch}. |
| 1682 |
% \end{Version} |
| 1683 |
% \end{History} |
| 1684 |
% |
| 1685 |
% \PrintIndex |
| 1686 |
% |
| 1687 |
% \Finale |
| 1688 |
\endinput |