2 %% This is file
'pyx.def',
4 %% Copyright (C
) 2003,2006 Michael Schindler
<m
-schindler@users.sourceforge.net
>
6 %% this file is based on `dvips.def
' from the Standard LaTeX `Graphics Bundle',
7 %% available via ftp from CTAN
9 %% `pyx.def
' may be distributed under the terms of the LaTeX Project Public
10 %% License, as described in lppl.txt in the base LaTeX distribution.
11 %% Either version 1.0 or, at your option, any later version.
14 % TODO: - documentation
16 \ProvidesFile{pyx.def}
17 [2006/05/17 driver-dependant file]
19 % %%%%%% auxiliary macros %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% <<<
20 % used in DEF file only:
21 % check if #1 is in [0,1]
25 \ifdim\dimen@<\z@\dimen@\maxdimen\fi
27 \PackageError{color}{Argument `#1' not in range
[0,1]}\@ehd
32 % %%%%%% (1a
) gray
, cmyk
, rgb and RGB colors
%%%%%%%%%%%%%%%%%%%%%%%%%%% <<<
33 % used in color.sty
: \color@gray
, cmyk
, rgb
, RGB
, hsb
34 % these commands are created with \csname as a
35 % combination of
'color@' and
'gray'/'cmyk'/'rgb'/'RGB'/'hsb'
36 % in color.sty by \@undeclaredcolor
37 % gray
, cmyk
, rgb
, hsb all take numbers in
[0,1] as first
argument(s
)
38 % RGB takes numbers in
[0,255] as first arguments
41 \c@lor@arg
{#
2}% % check the argument
42 \edef#
1{gray #
2}% % prepare for command
45 \def\color@cmyk#
1#
2{\c@lor@@cmyk#
2\@@#
1} % \@@ is only a separator for the arguments
!
46 \def\c@lor@@cmyk#
1,#
2,#
3,#
4\@@#
5{%
51 \edef#
5{cmyk #
1 #
2 #
3 #
4}% #
5 is always \current@
color (only once a
\tempa
)
54 \def\color@rgb#
1#
2{\c@lor@@rgb#
2\@@#
1}
55 \def\c@lor@@rgb#
1,#
2,#
3\@@#
4{%
59 \edef#
4{rgb #
1 #
2 #
3}%
62 \def\color@RGB#
1#
2{\c@lor@@RGB#
2\@@#
1}
63 \def\c@lor@@RGB#
1,#
2,#
3\@@#
4{%
64 \c@lor@RGB@rgb
{#
1}\@tempa
% renormalise
65 \c@lor@RGB@rgb
{#
2}\@tempb
66 \c@lor@RGB@rgb
{#
3}\@tempc
67 \c@lor@@rgb\@tempa
,\@tempb
,\@tempc\@@#
4% % call with normalised values
69 \def\c@lor@RGB@rgb#
1#
2{%
71 \divide\dimen@\@cclv
% divide by
255
72 \edef#
2{\strip@pt\dimen@
}} % strip the number
74 \def\color@hsb#
1#
2{\c@lor@@hsb#
2\@@#
1}
75 \def\c@lor@@hsb#
1,#
2,#
3\@@#
4{%
79 \edef#
4{hsb #
1 #
2 #
3}% this is the string defining the color in the special.
80 % % it is stored in the variable \current@color
83 % %%%%%% (1b
) "texnamed" colors
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% <<<
84 % used in color.sty
: \color@named \col@...
85 % like above with the use of \csname
87 \def\color@named#
1#
2{\c@lor@@named#
2,,\@@#
1}
88 \def\c@lor@@named#
1,#
2,#
3\@@#
4{%
89 \@ifundefined
{col@#
1}%
90 {\PackageError
{color
}{Undefined color `#
1'}\@ehd}%
91 {\edef#4{texnamed #1}}% % arguments 2,3 are thrown away? Maybe an error detection mechanism
92 } % \col@#1 is defined by \define@color@named
93 \def\current@color{texnamed Black}
94 \def\define@color@named#1#2{% for \DefineNamedColor only
95 \expandafter\let\csname col@#1\endcsname\@nnil}
97 % %%%%%% (1c) "pyxcolor" colors %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% <<<
99 % use with \textcolor[pyxcolor]{Name}
100 % where Name has to be defined in PyX as 'color.cmyk.Name
', 'color.rgb.red
', ...
101 % Attention! PyX has to do the error detection if the color is not defined!
103 \def\color@pyx#1#2{\c@olor@@pyx#2\@@#1}
104 \def\c@olor@@pyx#1\@@#2{%
105 \edef#2{pyxcolor #1}}
107 % %%%%%% (1) colors general %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% <<<
109 % \set@color is called by \@(un)declaredcolor in color.sty
110 % This is the starting string of the special
113 \special{PyX:color_begin \current@color
114 }\aftergroup\reset@color} % the 'group
' is the one in \@textcolor: arguments 1 and 3
115 \def\reset@color{\special{PyX:color_end}}
117 % BACKGROUND COLOR is disabled
118 \def\set@page@color{\PackageError{color}{Please adjust the pagecolor in PyX, not in LaTeX!}}
121 % %%%%%% (2) eps-file inclusion %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% <<<
123 \def\Ginclude@eps#1{%
127 \dimen@=0.996264009963\Gin@req@width
128 \@tempdima=0.996264009963\Gin@req@height
129 \special{PyX:epsinclude\space
130 file=\Gin@base\Gin@ext\space
135 \ifx\Gin@scalex\@tempa\else width=\strip@pt\dimen@\space\fi
136 \ifx\Gin@scaley\@tempa\else height=\strip@pt\@tempdima\space\fi
137 \ifGin@clip clip=1\fi}%
140 % bmp, oztex, pntg, pict file inclusions:
141 % not available anymore
142 % \Ginclude@bmp eventually used in graphics(x).sty
143 % \Ginclude@pntg eventually used in graphics(x).sty
144 % \Ginclude@pict eventually used in graphics(x).sty
146 \def\Ginclude@bmp#1{%
147 \PackageError{color}{bmp file inclusion is not supported in PyX. Please use eps files.}}
148 \def\Ginclude@pntg#1{
149 \PackageError{color}{pntg file inclusion is not supported in PyX. Please use eps files.}}
150 \def\Ginclude@pict#1{
151 \PackageError{color}{pict file inclusion is not supported in PyX. Please use eps files.}}
155 %\def\Gin@PS@raw#1{\special{ps: #1}}
156 %\def\Gin@PS@restored#1{\special{" #1}}
157 %\def\Gin@PS@literal@header#1{\AtBeginDvi{\special{! #1}}}
158 %\def\Gin@PS@file@header#1{\AtBeginDvi{\special{header=#1}}}
160 \def\Gin@extensions{.eps,.ps}
161 \@namedef{Gin@rule@.ps}#1{{eps}{.ps}{#1}}
162 \@namedef{Gin@rule@.eps}#1{{eps}{.eps}{#1}}
163 \@namedef{Gin@rule@*}#1{{eps}{\Gin@ext}{#1}}
167 % %%%%%% (3) rotations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% <<<
168 \def\Grot@start{\special{PyX:rotate_begin \Grot@angle}}
169 \def\Grot@end{\special{PyX:rotate_end}}
172 % %%%%%% (4) scalings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% <<<
174 \def\Gscale@start{\special{PyX:scale_begin \Gscale@x\space \Gscale@y}}
175 \def\Gscale@end{\special{PyX:scale_end}}
179 % vim:foldmethod=marker:foldmarker=<<<,>>>
182 %% End of file `pyx.def'.