summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/oberdiek/hycolor.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-08-01 00:27:39 +0000
committerKarl Berry <karl@freefriends.org>2008-08-01 00:27:39 +0000
commit8a00bd89dba03208646e631956e764f533e00d69 (patch)
treeeeea7569633ab198d18e9ef9b16d82d869a7092c /Master/texmf-dist/source/latex/oberdiek/hycolor.dtx
parent35912ac29c031e29b7a225f07c48881d428729d2 (diff)
oberdiek attachfile2 v2.4, hycolor v1.2, atbegshi v1.9 update (31jul08)
git-svn-id: svn://tug.org/texlive/trunk@9965 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.dtx337
1 files changed, 319 insertions, 18 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/hycolor.dtx b/Master/texmf-dist/source/latex/oberdiek/hycolor.dtx
index 2bd99182451..0881c019ecd 100644
--- a/Master/texmf-dist/source/latex/oberdiek/hycolor.dtx
+++ b/Master/texmf-dist/source/latex/oberdiek/hycolor.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
+% Copyright (C) 2007, 2008 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
@@ -17,7 +17,7 @@
% 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.
+% hycolor-test1.tex, hycolor-test2.tex, hycolor-test3.tex.
%
% Distribution:
% CTAN:macros/latex/contrib/oberdiek/hycolor.dtx
@@ -54,6 +54,7 @@
% TDS:doc/latex/oberdiek/hycolor.pdf
% TDS:doc/latex/oberdiek/test/hycolor-test1.tex
% TDS:doc/latex/oberdiek/test/hycolor-test2.tex
+% TDS:doc/latex/oberdiek/test/hycolor-test3.tex
% TDS:source/latex/oberdiek/hycolor.dtx
%
%<*ignore>
@@ -69,7 +70,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: hycolor 2007/04/11 v1.1 Code for color options of hyperref/bookmark (HO)}
+\Msg{* Package: hycolor 2008/07/29 v1.2 Code for color options of hyperref/bookmark (HO)}
\Msg{************************************************************************}
\keepsilent
@@ -80,7 +81,7 @@
This is a generated file.
-Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
+Copyright (C) 2007, 2008 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
@@ -97,7 +98,7 @@ 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.
+ hycolor-test1.tex, hycolor-test2.tex, hycolor-test3.tex.
\endpreamble
\let\MetaPrefix\DoubleperCent
@@ -110,6 +111,7 @@ and the derived files
\usedir{doc/latex/oberdiek/test}%
\file{hycolor-test1.tex}{\from{hycolor.dtx}{test,test1}}%
\file{hycolor-test2.tex}{\from{hycolor.dtx}{test,test2}}%
+ \file{hycolor-test3.tex}{\from{hycolor.dtx}{test,test3}}%
}
\obeyspaces
@@ -139,7 +141,7 @@ and the derived files
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{hycolor.drv}%
- [2007/04/11 v1.1 Code for color options of hyperref/bookmark (HO)]%
+ [2008/07/29 v1.2 Code for color options of hyperref/bookmark (HO)]%
\documentclass{ltxdoc}
\usepackage{holtxdoc}[2007/11/11]
\usepackage[ruled]{algorithm2e}
@@ -183,7 +185,7 @@ and the derived files
%</driver>
% \fi
%
-% \CheckSum{1043}
+% \CheckSum{1389}
%
% \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
@@ -204,7 +206,7 @@ and the derived files
% \GetFileInfo{hycolor.drv}
%
% \title{The \xpackage{hycolor} package}
-% \date{2007/04/11 v1.1}
+% \date{2008/07/29 v1.2}
% \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}}
%
% \maketitle
@@ -277,8 +279,12 @@ and the derived files
% |Hyp.*color| & all & no & no\\
% |Hyp.*bordercolor| & |gray|, |rgb| & yes & no\\
% |Field.*color| & |gray|, |rgb|, |cmyk| & yes & yes\\
+% |AtFi.color| & |gray|, |rgb| & yes & no\\
% \end{tabular}
% \end{quote}
+% ``RGB color'' means that the color value can be given as
+% space separated RGB numbers (real numbers in the range
+% from 0 to 1).
% Explanation of the color option prefixes:
% \begin{quote}
% \begin{tabular}{@{}ll@{}}
@@ -289,10 +295,10 @@ and the derived files
% package options or |\hypersetup|\\
% |Field| & Package \xpackage{hyperref}:
% Form field options\\
+% |AtFi| & Package \xpackage{attachfile2}: option \xoption{color}\\
% \end{tabular}
% \end{quote}
%
-%
% \StopEventually{
% }
%
@@ -302,7 +308,7 @@ and the derived files
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{hycolor}%
- [2007/04/11 v1.1 Code for color options of hyperref/bookmark (HO)]%
+ [2008/07/29 v1.2 Code for color options of hyperref/bookmark (HO)]%
% \end{macrocode}
%
% \subsection{Normalization}
@@ -471,7 +477,7 @@ and the derived files
% \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()}
+% \caption{MainColorOptionAlgorithm(key, value, cmd)}
% \BlankLine
% DefSanitized(\ArgSty{temp}, \ArgSty{value})\;
% Call option specific algorithm(\ArgSty{key}, \ArgSty{temp}, \ArgSty{cmd})\;
@@ -483,7 +489,8 @@ and the derived files
% 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}|
+% |rgbcolor=|\meta{r} \meta{g} \meta{b} $\equiv$
+% |color=[rgb]{|\meta{r}|,|\meta{g}|,|\meta{b}|}|
% \end{quote}
% Package \xpackage{bookmark} stores the result in macro \cs{BKM@color}.
% The empty string is interpreted as \emph{no color}.
@@ -493,6 +500,7 @@ and the derived files
% \Param{cmd}{macro for result}
% \Param{package}{package name for error message}
% \Param{option}{option name for error message}
+% \caption{BookmarkColor(value, cmd, package, option)}
% \BlankLine
% \Switch{\Var{value}}{
% \Case{empty}{
@@ -876,6 +884,7 @@ and the derived files
%
% \begin{macro}{\HyColor@IfRGB}
% \begin{macrocode}
+\newif\ifHyColor@result
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname pdfmatch\endcsname\relax
\expandafter\@firstoftwo
@@ -883,7 +892,6 @@ and the derived files
\expandafter\@secondoftwo
\fi
{%
- \newif\ifHyColor@result
\begingroup
\def\x#1{\endgroup
\def\HyColor@IfRGB##1{%
@@ -948,8 +956,10 @@ and the derived files
\expandafter\strip@prefix\pdflastmatch2,%
\expandafter\strip@prefix\pdflastmatch3%
}%
+ \HyColor@resulttrue
\expandafter\@firstoftwo
\else
+ \HyColor@resultfalse
\expandafter\@secondoftwo
\fi
}%
@@ -963,7 +973,7 @@ and the derived files
% \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)}
+% \caption{HyperrefBorderColor(value, cmd, package, option)}
% \BlankLine
% \Switch{\Var{value}}{
% \Case{empty}{
@@ -1045,26 +1055,167 @@ and the derived files
% \end{macrocode}
% \end{macro}
%
+% \subsection{Package \xpackage{attachfile2}}
+%
+% Before PDF-1.7 only RGB values are permitted in annotations.
+% Since PDF-1.7 the color entry in annotations understands
+% several color models, depending on the size of the color array:
+% \begin{itemize}
+% \item Zero entries: means transparent, not useful for
+% file attachments. AR7/Linux and AR8/Linux show black instead.
+% \item One entry: color model `gray'.
+% \item Three entries: color model `rgb'.
+% \item Four entries: color model `cmyk'.
+% \end{itemize}
+% An empty color specification is interpreted as ``no color''.
+%
+% \begin{macro}{\HyColor@DetectPdfVersion}
+% \begin{macrocode}
+\def\HyColor@DetectPdfVersion{%
+ \begingroup\expandafter\expandafter\expandafter\endgroup
+ \expandafter\ifx\csname Hy@pdfversion\endcsname\relax
+ \global\chardef\HyColor@PdfVersion=0 %
+ \else
+ \global\chardef\HyColor@PdfVersion=\Hy@pdfversion\relax
+ \fi
+ \global\let\HyColor@DetectPdfVersion\relax
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\HyColor@SpaceToComma}
+% \begin{macrocode}
+\def\HyColor@SpaceToComma#1 #2\@nil{%
+ #1%
+ \ifx\relax#2\relax
+ \expandafter\@gobble
+ \else
+ ,%
+ \expandafter\@firstofone
+ \fi
+ {%
+ \HyColor@SpaceToComma#2\@nil
+ }%
+}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\HyColor@AttachfileColor}
+% \begin{macrocode}
+\def\HyColor@AttachfileColor#1#2#3#4#5#6{%
+ \def#2{#1}%
+ \ifx#2\@empty
+ \let#3\@gobble
+ \let#4\@empty
+ \else
+ \HyColor@resultfalse
+ \HyColor@XZeroOneThreeFour{#1}#3{#5}{#6}%
+ \ifHyColor@result
+ \edef#2{%
+ [rgb]{\expandafter\HyColor@SpaceToComma#3 \@nil}%
+ }%
+ \fi
+ \ifx\HyColor@model\HyColor@model@rgb
+ \edef#4{/C[#3]}% hash-ok
+ \edef#3##1{%
+ #3 %
+ \noexpand\csname atfi@SETRGBCOLOR##1\noexpand\endcsname
+ }%
+ \else
+ \ifx\HyColor@model\HyColor@model@gray
+ \HyColor@DetectPdfVersion
+ \ifnum\HyColor@PdfVersion<7 %
+ \edef#4{/C[#3 #3 #3]}% hash-ok
+ \else
+ \edef#4{/C[#3]}% hash-ok
+ \fi
+ \edef#3##1{%
+ #3 %
+ \noexpand\csname atfi@SETGRAYCOLOR##1\noexpand\endcsname
+ }%
+ \else
+ \ifx\HyColor@model\HyColor@model@cmyk
+ \HyColor@DetectPdfVersion
+ \ifnum\HyColor@PdfVersion<7 %
+ \HyColor@IfModel{#1}{%
+ \HyColor@IfXcolor{%
+ \convertcolorspec\HyColor@model\HyColor@values
+ \HyColor@model@rgb#4%
+ \expandafter\HyColor@NormalizeCommaRGB#4\@nil#4%
+ \edef#4{/C[#4]}% hash-ok
+ }{%
+ \let#4\@empty
+ \HyColor@ErrorModelNoXcolor{#5}{#6}%
+ }%
+ }{%
+ \HyColor@IfXcolor{%
+ \extractcolorspec{#1}#4%
+ \expandafter\convertcolorspec#4%
+ \HyColor@model@rgb#4%
+ \expandafter\HyColor@NormalizeCommaRGB#4\@nil#4%
+ \edef#4{/C[#4]}% hash-ok
+ }{%
+ \let#4\@empty
+ \HyColor@ErrorSpecNoXcolor{#5}{#6}%
+ }%
+ }%
+ \else
+ \edef#4{/C[#3]}% hash-ok
+ \fi
+ \edef#3##1{%
+ #3 %
+ \noexpand\csname atfi@SETCMYKCOLOR##1\noexpand\endcsname
+ }%
+ \else
+ \ifx\HyColor@model\HyColor@model@empty
+ \PackageError{#5}{%
+ Color model `empty' is not permitted for option `#6'%
+ }\@ehc
+ \let#2\@empty
+ \let#3\@gobble
+ \let#4\@empty
+ \else
+ \ifx\HyColor@model\relax % (missing xcolor)
+ \let#3\@gobble
+ \let#4\@empty
+ \else
+ \PackageError{#5}{%
+ Internal error: unsupported color model%
+ }\@ehc
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macrocode}
%</package>
% \end{macrocode}
%
-% \section{Test}]
+% \section{Test}
%
% \begin{macrocode}
%<*test1>
-\ProvidesFile{hycolor-test1.tex}[2007/04/11 test file 1]
+\ProvidesFile{hycolor-test1.tex}[2008/07/29 test file 1]
%</test1>
% \end{macrocode}
%
% \begin{macrocode}
%<*test2>
-\ProvidesFile{hycolor-test2.tex}[2007/04/11 test file 2]
+\ProvidesFile{hycolor-test2.tex}[2008/07/29 test file 2]
\let\pdfmatch\relax
%</test2>
% \end{macrocode}
%
% \begin{macrocode}
+%<test3>\ProvidesFile{hycolor-test3.tex}[2008/07/29 test file 3]
+% \end{macrocode}
+%
+% \begin{macrocode}
%<*test>
% \end{macrocode}
% \begin{macrocode}
@@ -1107,7 +1258,7 @@ and the derived files
\Expect*{\@ResultErrorMessage}*{\@ExpectErrorMessage}%
}
-\usepackage{hycolor}
+\usepackage{hycolor}[2008/07/29]
%</test>
% \end{macrocode}
%
@@ -1335,6 +1486,151 @@ and the derived files
%</test1|test2>
% \end{macrocode}
%
+% \subsection{Test for package \xpackage{attachfile2}}
+%
+% \begin{macrocode}
+%<*test3>
+\def\atfi@SETRGBCOLORtest{set-rgb}
+\def\atfi@SETGRAYCOLORtest{set-gray}
+\def\atfi@SETCMYKCOLORtest{set-cmyk}
+\def\Test#1#2#3#4#5{%
+ \begingroup
+ \setbox0=\hbox{%
+ \begingroup
+ \chardef\HyColor@PdfVersion=6 %
+ \HyColor@AttachfileColor{#1}\spec\inlinemacro\annot
+ \TestPackageName\TestOptionName
+ \edef\inline{\inlinemacro{test}}%
+ \expandafter\Expect\expandafter{\spec}{#2}%
+ \expandafter\Expect\expandafter{\inline}{#3}%
+ \expandafter\Expect\expandafter{\annot}{#4}%
+ \endgroup
+ \begingroup
+ \chardef\HyColor@PdfVersion=7 %
+ \HyColor@AttachfileColor{#1}\spec\inlinemacro\annot
+ \TestPackageName\TestOptionName
+ \edef\inline{\inlinemacro{test}}%
+ \expandafter\Expect\expandafter{\spec}{#2}%
+ \expandafter\Expect\expandafter{\inline}{#3}%
+ \expandafter\Expect\expandafter{\annot}{#5}%
+ \endgroup
+ }%
+ \Expect*{\the\wd0}{0.0pt}%
+ \endgroup
+}
+\newif\ifError
+\def\TestError[#1]#2#3#4#5#6{%
+ \begingroup
+ \global\Errorfalse
+ \let\OrgPackageError\PackageError
+ \def\PackageError##1##2##3{%
+ \edef\TestTemp{##1}%
+ \ifx\TestTemp\TestPackageName
+ \Expect*{\ifError too many errors\else ok\fi}{ok}%
+ \Expect*{#6}*{##2}%
+ \global\Errortrue
+ \else
+ \OrgPackageError{##1}{##2}{##3}%
+ \fi
+ }%
+ \setbox0=\hbox{%
+ \begingroup
+ \chardef\HyColor@PdfVersion=#1 %
+ \HyColor@AttachfileColor{#2}\spec\inlinemacro\annot
+ \TestPackageName\TestOptionName
+ \edef\inline{\inlinemacro{test}}%
+ \expandafter\Expect\expandafter{\spec}{#3}%
+ \expandafter\Expect\expandafter{\inline}{#4}%
+ \expandafter\Expect\expandafter{\annot}{#5}%
+ \endgroup
+ \ifx\\#6\\%
+ \else
+ \Expect*{\ifError ok\else missing error\fi}{ok}%
+ \fi
+ }%
+ \Expect*{\the\wd0}{0.0pt}%
+ \endgroup
+}
+\def\NoEmptyModel{%
+ Color model `empty' is not permitted for option `\TestOptionName'%
+}
+\def\ModelNoXcolor#1#2{%
+ Color model `#1' is not supported\MessageBreak
+ without package `xcolor' in\MessageBreak
+ `\TestOptionName=[#1]{#2}'% hash-ok
+}
+\def\SpecNoXColor#1{%
+ This color specification is not supported\MessageBreak
+ without package `xcolor' in\MessageBreak
+ `test-option=#1'%
+}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\begin{qstest}{AttachfileColor}{AttachfileColor}
+ \Test{}{}{}{}{}%
+ \Test{0.1 0.2 0.3}{[rgb]{.1,.2,.3}}{.1 .2 .3 set-rgb}%
+ {/C[.1 .2 .3]}{/C[.1 .2 .3]}%
+ \Test{[gray]{0.4}}{[gray]{0.4}}{.4 set-gray}%
+ {/C[.4 .4 .4]}{/C[.4]}%
+ \Test{[rgb]{0.3,.2,.1}}{[rgb]{0.3,.2,.1}}{.3 .2 .1 set-rgb}%
+ {/C[.3 .2 .1]}{/C[.3 .2 .1]}%
+ \Test{0.0 1.0 1}{[rgb]{0,1,1}}{0 1 1 set-rgb}%
+ {/C[0 1 1]}{/C[0 1 1]}%
+ \Test{[gray]1}{[gray]1}{1 set-gray}{/C[1 1 1]}{/C[1]}%
+ \TestError[6]{[empty]{}}{}{}{}\NoEmptyModel
+ \TestError[7]{[empty]{}}{}{}{}\NoEmptyModel
+ \TestError[6]{[cmyk]{.1,.2,.3,.4}}{[cmyk]{.1,.2,.3,.4}}%
+ {.1 .2 .3 .4 set-cmyk}{}%
+ {\ModelNoXcolor{cmyk}{.1,.2,.3,.4}}%
+ \TestError[7]{[cmyk]{.1,.2,.3,.4}}{[cmyk]{.1,.2,.3,.4}}%
+ {.1 .2 .3 .4 set-cmyk}{/C[.1 .2 .3 .4]}{}%
+ \TestError[6]{red}{red}{}{}{\SpecNoXColor{red}}%
+ \TestError[7]{red}{red}{}{}{\SpecNoXColor{red}}%
+\end{qstest}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\usepackage{xcolor}
+\definecolor[named]{MyGreen}{rgb}{0,0.7,0}
+\definecolor{mygreen}{named}{MyGreen}
+\definecolor{graynine}{gray}{0.9}
+\definecolor{GraySix}{Gray}{9}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\begin{qstest}{AttachfileColorX}{AttachfileColorX}
+ \Test{}{}{}{}{}%
+ \Test{0.1 0.2 0.3}{[rgb]{.1,.2,.3}}{.1 .2 .3 set-rgb}%
+ {/C[.1 .2 .3]}{/C[.1 .2 .3]}%
+ \Test{[gray]{0.4}}{[gray]{0.4}}{.4 set-gray}%
+ {/C[.4 .4 .4]}{/C[.4]}%
+ \Test{[rgb]{0.3,.2,.1}}{[rgb]{0.3,.2,.1}}{.3 .2 .1 set-rgb}%
+ {/C[.3 .2 .1]}{/C[.3 .2 .1]}%
+ \Test{0.0 1.0 1}{[rgb]{0,1,1}}{0 1 1 set-rgb}%
+ {/C[0 1 1]}{/C[0 1 1]}%
+ \Test{[gray]1}{[gray]1}{1 set-gray}{/C[1 1 1]}{/C[1]}%
+ \Test{red}{red}{1 0 0 set-rgb}{/C[1 0 0]}{/C[1 0 0]}%
+ \Test{black}{black}{0 set-gray}{/C[0 0 0]}{/C[0]}%
+ \Test{cyan}{cyan}{1 0 0 0 set-cmyk}{/C[0 1 1]}{/C[1 0 0 0]}%
+ \Test{[named]{black}}{[named]{black}}{0 0 0 set-rgb}%
+ {/C[0 0 0]}{/C[0 0 0]}%
+ \Test{[Gray]{9}}{[Gray]{9}}{.6 set-gray}{/C[.6 .6 .6]}{/C[.6]}%
+ \Test{[HTML]{0080FF}}{[HTML]{0080FF}}{0 .50195 1 set-rgb}%
+ {/C[0 .50195 1]}{/C[0 .50195 1]}%
+ \Test{graynine}{graynine}{.9 set-gray}{/C[.9 .9 .9]}{/C[.9]}%
+ \Test{GraySix}{GraySix}{.6 set-gray}{/C[.6 .6 .6]}{/C[.6]}%
+ \Test{[wave]{500}}{[wave]{500}}{0 1 .49846 set-rgb}%
+ {/C[0 1 .49846]}{/C[0 1 .49846]}%
+ \TestError[6]{[empty]{}}{}{}{}\NoEmptyModel
+ \TestError[7]{[empty]{}}{}{}{}\NoEmptyModel
+\end{qstest}
+% \end{macrocode}
+%
+% \begin{macrocode}
+%</test3>
+% \end{macrocode}
+%
% \begin{macrocode}
%<*test>
\begin{document}
@@ -1405,6 +1701,7 @@ and the derived files
% hycolor.pdf & doc/latex/oberdiek/hycolor.pdf\\
% test/hycolor-test1.tex & doc/latex/oberdiek/test/hycolor-test1.tex\\
% test/hycolor-test2.tex & doc/latex/oberdiek/test/hycolor-test2.tex\\
+% test/hycolor-test3.tex & doc/latex/oberdiek/test/hycolor-test3.tex\\
% hycolor.dtx & source/latex/oberdiek/hycolor.dtx\\
% \end{tabular}^^A
% }^^A
@@ -1534,6 +1831,10 @@ and the derived files
% \item
% Line ends sanitized.
% \end{Version}
+% \begin{Version}{2008/07/29 v1.2}
+% \item
+% Support for package \xpackage{attachfile2} added.
+% \end{Version}
% \end{History}
%
% \PrintIndex