diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-11 23:53:47 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-11 23:53:47 +0000 |
commit | 00a8b88691d82bb5e6292611a8fddea93820ffeb (patch) | |
tree | 6ec1c3a05a04a25bd086c891640e869c2397dfad /Master/texmf-dist/source/latex/graphics | |
parent | 4ffb5f8d78b0f3883dbc8cd8ab60a7097e5313fa (diff) |
trunk/Master/texmf-dist/source/latex/graphics
git-svn-id: svn://tug.org/texlive/trunk@311 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/graphics')
-rw-r--r-- | Master/texmf-dist/source/latex/graphics/color.dtx | 890 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/graphics/drivers.dtx | 1662 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/graphics/epsfig.dtx | 141 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/graphics/graphics.dtx | 1782 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/graphics/graphics.ins | 116 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/graphics/graphicx.dtx | 863 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/graphics/keyval.dtx | 401 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/graphics/lscape.dtx | 134 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/graphics/pstcol.dtx | 159 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/graphics/trig.dtx | 308 |
10 files changed, 6456 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/graphics/color.dtx b/Master/texmf-dist/source/latex/graphics/color.dtx new file mode 100644 index 00000000000..5a31f82a9d6 --- /dev/null +++ b/Master/texmf-dist/source/latex/graphics/color.dtx @@ -0,0 +1,890 @@ +% +% \iffalse +% +%% color.dtx Copyright (C) 1994--1999 David Carlisle +%% +%% This file is part of the Standard LaTeX `Graphics Bundle'. +%% It may be distributed under the terms of the LaTeX Project Public +%% License, as described in lppl.txt in the base LaTeX distribution. +%% Either version 1.0 or, at your option, any later version. +%% +%<*dtx> + \ProvidesFile{color.dtx} +%</dtx> +%<package>\NeedsTeXFormat{LaTeX2e}[1995/12/01] +%<package>\ProvidesPackage{color} +%<driver> \ProvidesFile{color.drv} +% \fi +% \ProvidesFile{color.dtx} + [1999/02/16 v1.0i Standard LaTeX Color (DPC)] +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\newenvironment{option}[1]{\expandafter\macro\expandafter{% + \csname ds@#1\endcsname}}{\endmacro} +\begin{document} + \DocInput{color.dtx} +\end{document} +%</driver> +% \fi +% +% \GetFileInfo{color.dtx} +% +% \title{The \textsf{color} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{D. P. Carlisle} +% \date{\filedate} +% \maketitle +% +% \CheckSum{426} +% +% +% \title{The implementation of the \LaTeX\ Colour interface.} +% +% \section{Introduction} +% This package implements \LaTeX\ support for colour, for those +% \texttt{dvi} drivers that can produce coloured text. +% +% The user level documentation of this package is contained in the +% document \emph{Packages in the `graphics' bundle} in the file +% \texttt{grfguide.tex}. +% +% \StopEventually{} +% +% +% \section{Options} +% +% \changes{v0.2a}{1994/04/13} +% {TEMP KLUDGE for Feb 94 release of 2e: +% Add extra groups} +% \changes{v0.2d}{1994/05/13} +% {All support for Feb 1994 release removed (so used optional arg +% of \cs{NeedsTeXFormat}).} +% \changes{v1.0}{1996/05/29} +% {Version 1 at last} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% First we save the catcodes of some characters, and set them to +% fixed values whilst this file is being read. +% \changes{v0.3b}{1994/09/14} +% {Save and restore catcodes} +% \begin{macrocode} +\edef\Gin@codes{% + \catcode`\noexpand\^^A\the\catcode`\^^A\relax + \catcode`\noexpand\"\the\catcode`\"\relax + \catcode`\noexpand\*\the\catcode`\*\relax + \catcode`\noexpand\!\the\catcode`\!\relax + \catcode`\noexpand\:\the\catcode`\:\relax} +\catcode`\^^A=\catcode`\% +\catcode`\"=12 +\catcode`\*=11 +\catcode`\!=12 +\catcode`\:=12 +% \end{macrocode} +% +% \begin{macro}{\Gin@driver} +% Initalise the macro to hold the driver file name. +% \begin{macrocode} +\providecommand\Gin@driver{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\c@lor@error} +% \changes{v1.0d}{1997/01/07} +% {Macro added for graphics/2350} +% Helper macro for error handling (redefined by the monochrome option +% to make errors warnings). +% \begin{macrocode} +\def\c@lor@error#1{% + \@latex@error{Undefined color #1}\@ehd} +% \end{macrocode} +% \end{macro} +% +% \begin{option}{monochrome} +% The |monochrome| option should be used \emph{in addition} +% to one of the standard driver options. +% \changes{v0.3j}{1995/06/16} +% {Use single hash for latex/1557} +% \changes{v1.0b}{1996/10/29} +% {Add \cs{colors@false}} +% \changes{v1.0d}{1997/01/07} +% {Add \cs{c@lor@error} for graphics/2350} +% \begin{macrocode} +\DeclareOption{monochrome}{% + \def\c@lor@error#1{\PackageInfo{color}{Undefined color #1}}% + \AtEndOfPackage{% + \colors@false + \def\set@color{% + \c@lor@special\m@ne + {color push \current@color}\aftergroup\reset@color}% + \def\reset@color{\c@lor@special\m@ne{color pop}}% + \def\set@page@color{% + \c@lor@special\m@ne{background \current@color}}% + \def\define@color#1#2{% + \c@lor@special\m@ne{define #1 #2}}}} +% \end{macrocode} +% \end{option} +% +% \begin{option}{debugshow} +% The |debugshow| option turns on debugging info (perhaps). +% \changes{v1.0a}{1996/09/16} +% {debugshow option added} +% \begin{macrocode} +\DeclareOption{debugshow}{\catcode`\^^A=9 \let\GDebug\typeout} +% \end{macrocode} +% \end{option} +% +% Now the options for supported drivers. +% +% \begin{option}{dvips} +% \begin{option}{xdvi} +% Tom Rokicki's dvips driver, and the X Windows previer, xdvi which uses +% (a subset of) the same |\specials|. +% \begin{macrocode} +\DeclareOption{dvips}{\def\Gin@driver{dvips.def}% + \def\c@lor@namefile{dvipsnam.def}} +\DeclareOption{xdvi}{\ExecuteOptions{dvips,monochrome}} +% \end{macrocode} +% \end{option} +% \end{option} +% +% \begin{option}{dvipdf} +% \changes{v1.0c}{1996/10/31} +% {dvipdf added} +% Sergey Lesenko's dvipdf driver. +% \begin{macrocode} +\DeclareOption{dvipdf}{\def\Gin@driver{dvipdf.def}} +% \end{macrocode} +% \end{option} +% +% \begin{option}{dvipdfm} +% \changes{v1.0h}{1999/01/13} +% {dvipdfm added} +% Mark Wick's dvipdfm driver. +% \begin{macrocode} +\DeclareOption{dvipdfm}{\def\Gin@driver{dvipdfm.def}} +% \end{macrocode} +% \end{option} +% +% \begin{option}{pdftex} +% \changes{v1.0e}{1997/06/07} +% {pdftex added} +% Han The Thanh's \TeX\ variant. +% \begin{macrocode} +\DeclareOption{pdftex}{\def\Gin@driver{pdftex.def}} +% \end{macrocode} +% \end{option} +% +% \begin{option}{dvipsone} +% \begin{option}{dviwindo} +% \changes{v0.3k}{1995/09/07} +% {Merge dviwindo and dvipsone options} +% The drivers of the Y\&Y \TeX\ system. +% (Which use the same |\specials|). +% \begin{macrocode} +\DeclareOption{dvipsone}{\def\Gin@driver{dvipsone.def}} +\DeclareOption{dviwindo}{\ExecuteOptions{dvipsone}} +% \end{macrocode} +% \end{option} +% \end{option} +% +% \begin{option}{emtex} +% \begin{option}{dviwin} +% Freely available drivers for PCs. +% \begin{macrocode} +\DeclareOption{emtex}{\def\Gin@driver{emtex.def}} +\DeclareOption{dviwin}{\def\Gin@driver{dviwin.def}} +% \end{macrocode} +% \end{option} +% \end{option} +% +% \begin{option}{oztex} +% \changes{v1.0f}{1997/09/09} +% {Merge dvips and oztex options} +% The Oz\TeX\ system for a Macintosh. +% Since release 3 of Oz\TeX, merge with dvips back end. +% \begin{macrocode} +\DeclareOption{oztex}{\ExecuteOptions{dvips}} +% \end{macrocode} +% \end{option} +% +% \begin{option}{textures} +% Blue sky's Textures system on a Macintosh. +% \begin{macrocode} +\DeclareOption{textures}{\def\Gin@driver{textures.def}} +% \end{macrocode} +% \end{option} +% +% \begin{option}{pctexps} +% \begin{option}{pctexwin} +% \begin{option}{pctexhp} +% \begin{option}{pctex32} +% \changes{v1.0b}{1996/10/29} +% {pctex32 option added} +% The drivers for PTI's \TeX\ system on PCs. +% \begin{macrocode} +\DeclareOption{pctexps}{\def\Gin@driver{pctexps.def}} +\DeclareOption{pctexwin}{\def\Gin@driver{pctexwin.def}} +\DeclareOption{pctexhp}{\def\Gin@driver{pctexhp.def}} +\DeclareOption{pctex32}{\def\Gin@driver{pctex32.def}} +% \end{macrocode} +% \end{option} +% \end{option} +% \end{option} +% \end{option} +% +% \begin{option}{truetex} +% \begin{option}{tcidvi} +% \changes{v1.0b}{1996/10/29} +% {truetex and tcidvi options added} +% The drivers of the Kinch \TeX\ system on PCs, and its +% version with extra |\special| handling dll's as shipped with +% TCI's Scientific Word. +% \begin{macrocode} +\DeclareOption{truetex}{\def\Gin@driver{truetex.def}} +\DeclareOption{tcidvi}{\def\Gin@driver{tcidvi.def}} +% \end{macrocode} +% \end{option} +% \end{option} +% +% \begin{option}{vtex} +% \changes{v1.0g}{1998/05/27} +% {vtex option added} +% V\TeX\ driver. +% \begin{macrocode} +\DeclareOption{vtex}{\def\Gin@driver{vtex.def}} +% \end{macrocode} +% \end{option} +% +% \begin{option}{dvi2ps} +% \begin{option}{dvialw} +% \begin{option}{dvilaser} +% \begin{option}{dvitops} +% \begin{option}{psprint} +% \begin{option}{pubps} +% \begin{option}{ln} +% \changes{v1.0b}{1996/10/29} +% {old driver options depreciated} +% Old, probably obsolete, drivers commented out. See the section +% on `Driver support' in grfguide to see how to re-enable these +% options in |color.cfg| if you need them. +% \begin{macrocode} +%\DeclareOption{dvi2ps}{\def\Gin@driver{dvi2ps.def}} +%\DeclareOption{dvialw}{\def\Gin@driver{dvialw.def}} +%\DeclareOption{dvilaser}{\def\Gin@driver{dvilaser.def}} +%\DeclareOption{dvitops}{\def\Gin@driver{dvitops.def}} +%\DeclareOption{psprint}{\def\Gin@driver{psprint.def}} +%\DeclareOption{pubps}{\def\Gin@driver{pubps.def}} +%\DeclareOption{ln}{\def\Gin@driver{ln.def}} +% \end{macrocode} +% \end{option} +% \end{option} +% \end{option} +% \end{option} +% \end{option} +% \end{option} +% \end{option} +% +% +% \begin{option}{dvipsnames} +% \begin{option}{nodvipsnames} +% By default the named colour model has no pre-declared names. +% The |dvipsnames| option predeclares all the names in the colour +% prologue of dvips. The |dvips| option automatically implies +% |dvipsnames| unless this choice is overruled with the |nodvipsnames| +% option. For other drivers, eg |textures| you may use this option to +% explicitly request that these names be declared. +% \begin{macrocode} +\DeclareOption{dvipsnames}{\def\c@lor@namefile{dvipsnam.def}} +\DeclareOption{nodvipsnames}{\let\c@lor@namefile\relax} +% \end{macrocode} +% \end{option} +% \end{option} +% +% \begin{option}{usenames} +% The |usenames| option modifies the behaviour of |\DefineNamedColor| +% So that it declares the same name as a ```user's colour'' for use in +% a |\color| command, as well as a name in the |named| colour model. +% The normal behaviour is just to decalare the name in the named colour +% model. +% \begin{macrocode} +\let\c@lor@usename\@gobble +% \end{macrocode} +% +% \begin{macrocode} +\DeclareOption{usenames}{% + \def\c@lor@usename#1{% + \expandafter\color@named\csname\string\color @#1\endcsname{#1}}} +% \end{macrocode} +% \end{option} +% +% \section{Using Colours} +% +% \subsection{Declarative form} +% +% \begin{macro}{\color} +% |\color{|\emph{declared-colour}|}| switches to the colour +% \emph{declared-colour}, which must previously have been defined +% using |\definecolor|. This colour will stay in effect until the end of +% the current \TeX\ group. +% +% |\color[|\emph{model}|]{|\emph{colour-specification}|}| is similar +% to the above, but uses a colour not declared by |\definecolor|. The +% allowed \emph{model}'s vary depending on the driver. The syntax of +% the \emph{colour-specification} argument depends on the model. +% +% \changes{v0.3a}{1994/07/20} +% {Make \cs{color} robust} +% \begin{macrocode} +\DeclareRobustCommand\color{% + \@ifnextchar[\@undeclaredcolor\@declaredcolor} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@undeclaredcolor} +% \changes{v0.2c}{1994/05/09} +% {Improve error messages} +% \changes{v0.3a}{1994/07/20} +% {New internal implementation of colour commands} +% Call the driver-dependent command |\color@|\meta{model} to define +% |\current@color|, then call |\set@color| to change the current colour +% accordingly. +% \begin{macrocode} +\def\@undeclaredcolor[#1]#2{% + \@ifundefined{color@#1}% + {\c@lor@error{model `#1'}}% + {\csname color@#1\endcsname\current@color{#2}% + \set@color}% + \ignorespaces} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@declaredcolor}% +% \changes{v0.1c}{1994/04/01} +% {Add \cs{ignorespaces}} +% \changes{v0.1e}{1994/05/14} +% {Minor change to error message} +% \changes{v0.3a}{1994/07/20} +% {New internal implementation of colour commands} +% |\let| |\current@color| to the internal representation of the colour +% if the colour has been declared, otherwise generate an error. +% Finally call |\set@color| to effect the colour change. +% \begin{macrocode} +\def\@declaredcolor#1{% + \@ifundefined{\string\color @#1}% + {\c@lor@error{`#1'}}% + {\expandafter\let\expandafter\current@color + \csname\string\color @#1\endcsname + \set@color}% + \ignorespaces} +% \end{macrocode} +% \end{macro} +% +% \subsection{Command (Argument) Form} +% +% \begin{macro}{\textcolor} +% |\textcolor{|\emph{declared-colour}|}{|\emph{text}|}| and +% |\textcolor[|\emph{model}|]{|\emph{colour-spec}|}{|\emph{text}|}| +% are just alternative syntax for |\color|, in +% which the groups are added implicitly. Thus \emph{text} appears in the +% specified colour, but then the colour reverts to its previous value. +% The naming is by analogy with |\textrm| (as opposed to |\rm| and +% |\rmfamily|) although it is slightly a misnomer as the command also +% works in math-mode. +% +% Since December 95, in fact this command has one other difference +% from |\color|. It calls |\leavevmode| to ensure the start of +% horizontal mode. Specifically this means that a construction +% such as +%\begin{verbatim} +% xxx\parbox[t]{1cm}{\textcolor{red}{a}..... +%\end{verbatim} +% now works as expected, with the |xxx| and the red |a| lining up +% correctly. +% \changes{v0.3a}{1994/07/20} +% {Stop command being \cs{long}, and make robust.} +% \changes{v0.3l}{1995/12/07} +% {Add \cs{leavevmode}} +% \begin{macrocode} +\def\textcolor#1#{\@textcolor{#1}} +\def\@textcolor#1#2#3{\protect\leavevmode{\color#1{#2}#3}} +% \end{macrocode} +% \end{macro} +% +% \subsection{Background (Page) Colour} +% +% \begin{macro}{\pagecolor} +% |\pagecolor|, which has the same argument forms as |\color|, specifies +% the background colour for the current, and all following, pages. It is +% a global declaration which does not respect \TeX\ groups. +% +% \changes{v0.1c}{1994/04/01} +% {end the group even if the colour command generates an error} +% \changes{v0.3c}{1994/09/19} +% {Use \cs{color} to parse arguments} +% \begin{macrocode} +\def\pagecolor{% + \begingroup + \let\ignorespaces\endgroup + \let\set@color\set@page@color + \color} +% \end{macrocode} +% \end{macro} +% +% \section{Defining Colours} +% +% \begin{macro}{\definecolor} +% |\definecolor{|\emph{name}|}{|\emph{model}|}{|\emph{colour-spec}|}| +% defines the color \emph{name}, which may then be used in subsequent +% |\color| or |\textcolor| commands to refer to a colour specified by +% \emph{colour-spec} in the colour model \emph{model}. +% +% |\definecolor| associates the \emph{name} the to a colour in +% \emph{model}. So |\color{|\emph{name}|}| would check \emph{name} +% then issue a |\special| for the colour model \emph{model}. +% +% |\definecolor| just calls an internal macro that defines the colour +% for a particular model. This macro must have been defined by the +% driver file that supports the requested \emph{model}. +% +% \changes{v0.1b}{1994/03/15} +% {change name from \cs{newcolor} to \cs{definecolor}} +% \changes{v0.1e}{1994/05/14} +% {Minor change to error message} +% \changes{v0.3a}{1994/07/20} +% {New internal implementation of colour commands} +% \changes{v0.3f}{1994/10/04} +% {Give info about redefinitions} +% \begin{macrocode} +\def\definecolor#1#2#3{% + \@ifundefined{color@#2}% + {\c@lor@error{model `#2'}}% + {\@ifundefined{\string\color @#1}{}% + {\PackageInfo{color}{Redefining color #1}}% + \csname color@#2\expandafter\endcsname + \csname\string\color @#1\endcsname{#3}}} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\DefineNamedColor} +% \changes{v0.3d}{1994/09/29} +% {Macro added} +% \changes{v0.3e}{1994/10/03} +% {usenames option added} +% \changes{v0.3f}{1994/10/04} +% {Give info about redefinitions} +% +% Driver files may opt to define a `named' colour model. +% Placing colour names rather than numeric specifications into the dvi +% file has certain advantages, in that post processing software can +% tune the colour specifications to the particular technology being +% used, and more easily make colour separations for that colour. +% The disadvantage is that the driver must `know' the colour +% names. +% +% The `color1' drivers (dvips) currently ignore the specification of +% the colour, and once a name is defined, just put the colour name in +% the dvi file. For dvips, The header file \texttt{color.pro} is used to +% give the cmyk equivalents of the names. +% +% The `color2' drivers (textures) use a special postscript operator +% that takes both the name and the cmyk equivalent. so if the names are +% no being used, fall back' definitions in the cmyk model are available. +% These drivers also allow a numeric value to affect the `density' +% of the colour to use. +% +% Drivers based on `color3' do not support named colours at the dvi +% level, but to ease document portability, the named model is still +% defined, but the |\special|'s just put the colour specifications, not +% the names, into the dvi file. +% +% Normally after a colour, say |JungleGreen|, has been declared with:\\ +% |\DefineNamedColor{named}{JungleGreen}{cmyk}{1,2,3,4}|\\ +% it is available in the `named' colour model, for +% instance by\\ +% |\color[named]{JungleGreen}|\\ +% A user may give a more convenient name, using\\ +% |\definecolor{mygreen}{named}{JungleGreen}|\\ +% If however you are happy with the original names, and want to use +% them directly, as in |\color{JungleGreen}| without specifying +% |[named]| all the time, just give the package option |usenames|, which +% will redefine |\DefineNamedColor|, so that the colour name is declared +% as a user-colour as well as a name in the `named' model. +% \begin{macrocode} +\def\DefineNamedColor#1#2#3#4{% + \@ifundefined{define@color@#1}% + {\c@lor@error{model `#1'}}% + {\@ifundefined{color@#3}% + {\c@lor@error{model `#3'}}% + {\@ifundefined{c@lor@#1@#2}{}% + {\PackageInfo{color}{Redefining color #2 in named color model}}% + \csname color@#3\endcsname\@tempa{#4}% + \csname define@color@#1\endcsname{#2}\@tempa + \c@lor@usename{#2}}}} +\@onlypreamble\DefineNamedColor +% \end{macrocode} +% \end{macro} +% +% \section{Colour Switch} +% +% \begin{macro}{\ifcolors@} +% This boolean can be tested by higher level macros that may want to +% alter their behaviour if a monochrome driver is being used. +% \begin{macrocode} +\newif\ifcolors@ +\colors@true +% \end{macrocode} +% \end{macro} +% +% \section{Whatsit\ldots} +% +% \begin{macro}{\c@lor@special} +% Some drivers can not support all the features of this package. They +% should always put a \meta{whatsit} in the current list though. the +% following macro has most of the features of |\special|, but does not +% put anything into the |dvi| file. It does write to the log file or the +% terminal (depending on the value of |#1|). +% \begin{macrocode} +\def\c@lor@special#1#2{% + \edef\@tempa{\write#1{#2}}\@tempa} +% \end{macrocode} +% \end{macro} +% +% \section{Processing Options} +% +% A local configuration file may declare more options. +% It should also make one driver option the default, by calling +% |\ExecuteOptions| with the appropriate option. +% \begin{macrocode} +\InputIfFileExists{color.cfg}{}{} +% \end{macrocode} +% +% After the options are processed, load the appropriate driver file. +% If a site wants a default driver (eg |dvips|) it just needs to put +% |\ExecuteOptions{dvips}| in a |color.cfg| file. +% \changes{v0.3b}{1994/09/14} +% {New style of loading driver files} +% \begin{macrocode} +\ProcessOptions +% \end{macrocode} +% +% \begin{macrocode} +\if!\Gin@driver! + \PackageError{color} + {No driver specified} + {You should make a default driver option in a file \MessageBreak + color.cfg\MessageBreak + eg: \protect\ExecuteOptions{dvips}% + } +\else + \PackageInfo{color}{Driver file: \Gin@driver} + \@ifundefined{ver@\Gin@driver}{\input{\Gin@driver}}{} +\fi +% \end{macrocode} +% +% \begin{macrocode} +\@ifundefined{c@lor@namefile}{}{\input{\c@lor@namefile}} +% \end{macrocode} +% +% \section{Default Colour} +% +% \begin{macro}{\normalcolor} +% Early versions of this package redefined |\reset@font| to reset the +% color as well. Current versions do not do this (there are too many +% |\reset@font| commands hidden in strange places) and so defines a +% separate command, |\normalcolor| to reset the colour to the colour in +% effect at the start of the document. +% +% |\normalcolor| is defined (to |\relax|) in the \LaTeX\ kernel, so it +% is safe to use this in macros that may possibly be used in +% conjunction with colour. It will have no effect until the |color| +% package is also loaded. +% \changes{v0.2b}{1994/04/18} +% {Only reset the colour with \cmd{\reset@font} not +% \cmd{\normalfont}} +% \changes{v0.2d}{1994/05/13} +% {Stop changing \cs{reset@font}. Use the new \cs{normalfont} +% instead.} +% \begin{macrocode} +\def\normalcolor{\let\current@color\default@color\set@color} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\default@color} +% Internal macro to store the `default' colour used by |\normalcolor|. +% \begin{macrocode} +\AtBeginDocument{\let\default@color\current@color} +% \end{macrocode} +% \end{macro} +% +% |\current@color| contains an internal representation of the colour +% at this point in the document. (This can only be an approximation to +% the truth as the `macro layer' of \TeX\ does not know where the output +% routine is going to re-insert floats. This is why drivers must +% maintain their own stack of colours in order to fully support these +% commands. +% +% For dvips, the |\current@color| it is something like `|Black|' or +% `|rgb 0 1 0|', but other packages should not rely on any particular +% format for this macro. +% +% The driver file \emph{must} initialise |\current@color| to a +% specification for Black. This initialisation can not occur here, as +% the possible colour models (and thus the syntax for `black') +% are not known at this point. +% +% \section{Higher Level Commands} +% +% With the basic colour primitives specified above we may define a few +% higer level commands for coloured boxes etc. This is still quite a low +% level and presumably packages and classes making use of colour will +% define more appropriate document-level commands. +% +% \subsection{Colour Block} +% +% \begin{macro}{\color@block} +% |\color@block{|\emph{width}|}{|\emph{height}|}{|\emph{depth}|}|\\ +% Should take up no space for \TeX, but produce a block in the current +% colour of the specified size. It is mainly used for producing box +% backgrounds. +% +% The definition here works by selecting a colour, and then drawing a +% \TeX\ rule (unless |\ifcolors@false|). This allows the `driver +% independent' colour specials to be used. However it is defined using +% |\providecommand|, so that this file will not over-write any other +% definition of this command. A graphics package may want to define it +% using a special to produce (for example) a PostScript line. Producing +% the line in the |\special| has the advantage that on a preview that +% does not understand |\special|s, the line is automatically omited, +% without needing to modify the source of the document (for instance by +% adding the |monochrome| option). +% +% \begin{macrocode} +\def\color@block#1#2#3{% + {\set@color\rlap{\ifcolors@\vrule\@width#1\@height#2\@depth#3\fi}}} +% \end{macrocode} +% \end{macro} +% +% \subsection{Coloured Boxes} +% +% \begin{macro}{\colorbox} +% |\colorbox| takes the same argument forms as |\textcolor|, but the +% colour specifies the \emph{background} colour of the box. +% \changes{v0.3b}{1994/09/14} +% {New implementation} +% \begin{macrocode} +\def\colorbox#1#{\color@box{#1}} +% \end{macrocode} +% \end{macro} +% +% \changes{v0.3i}{1995/04/27} +% {Move \cs{leavevmode} for graphics/1521} +% \begin{macro}{\color@box} +% \begin{macrocode} +\def\color@box#1#2{\color@b@x\relax{\color#1{#2}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fcolorbox} +% |\fcolorbox| has an extra \emph{colour-spec} argument, and puts a +% frame of the first colour around a box with a background specified by +% the second colour. If an optional argument is given, it specifies the +% colour model for both colours. +% \changes{v0.3b}{1994/09/14} +% {New implementation} +% \begin{macro}{\fcolorbox} +% \begin{macrocode} +\def\fcolorbox#1#{\color@fbox{#1}} +% \end{macrocode} +% +% \begin{macrocode} +\def\color@fbox#1#2#3{% + \color@b@x{\fboxsep\z@\color#1{#2}\fbox}{\color#1{#3}}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% + +% \begin{macro}{\color@b@x} +% Internal macro for |\colorbox| and |\fcolorbox|. +% \changes{v0.3b}{1994/09/14} +% {Macro added.} +% \changes{v0.3i}{1995/04/27} +% {Add \cs{leavevmode} for graphics/1521} +% \begin{macrocode} +\long\def\color@b@x#1#2#3{% + \leavevmode + \setbox\z@\hbox{\kern\fboxsep{\set@color#3}\kern\fboxsep}% + \dimen@\ht\z@\advance\dimen@\fboxsep\ht\z@\dimen@ + \dimen@\dp\z@\advance\dimen@\fboxsep\dp\z@\dimen@ + {#1{#2\color@block{\wd\z@}{\ht\z@}{\dp\z@}% + \box\z@}}} +% \end{macrocode} +% \end{macro} +% +% +% \section{Extra Groups} +% Turning on extra groups in the standard \LaTeX\ commands, so that +% colour commands are scoped corectly. +% +% Like |\normalcolor|, the following five commands are defined in the +% kernel, with empty definitions (|\relax|). This means that they can +% be used to make macros in packages `colour safe'. The commands +% will not have any effect unless a user also uses this colour +% package, when the `active definitions' here will take effect and +% keep colour commands correctly scoped. +% +% \begin{macro}{\color@setgroup} +% This is to be used in contexts (eg `lrbox') where text is to be +% saved and used after some other, unknown, text that may contain +% colour commands. A matching |\color@endgroup| should be used at the +% end of the text. +% \changes{v0.2d}{1994/05/13} +% {Macro added} +% \begin{macrocode} +\def\color@setgroup{\begingroup\set@color} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\color@begingroup} +% This is to be used at the start of contexts that may contain colour +% commands, but where it is not necessary to save the current colour. +% Examples of this are in the box commands of |ltboxes.dtx| where +% user-supplied text is saved internally in a box between +% |\color@begingroup|, |\color@endgroup|, but the box is used before +% any other colour commands could intervene. A matching +% |\color@endgroup| should be used at the end of the text. +% \changes{v0.2d}{1994/05/13} +% {New definition, was previously like \cs{color@setgroup}} +% \begin{macrocode} +\let\color@begingroup\begingroup +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\color@endgroup} +% To be used to close the `group' started by one of the above two +% commands. The |\endgraf| in its definition is required in the case +% of groups of text in vertical `par' mode, but doesn't do any harm in +% horizontal `LR' contexts. +% \changes{v0.2d}{1994/05/13} +% {New definition, was previously just \cs{endroup}} +% \begin{macrocode} +\def\color@endgroup{\endgraf\endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\color@hbox} +% To be used to open a `coloured hbox' +% \changes{v0.3g}{1994/11/08} +% {Macro added} +% \begin{macrocode} +\def\color@hbox{\hbox\bgroup\color@begingroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\color@vbox} +% To be used to open a `coloured hbox' +% \changes{v0.3h}{1994/11/22} +% {Macro added} +% \begin{macrocode} +\def\color@vbox{\vbox\bgroup\color@begingroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\color@endbox} +% To be used to close a `coloured hbox' +% \changes{v0.3g}{1994/11/08} +% {Macro added} +% \begin{macrocode} +\def\color@endbox{\color@endgroup\egroup} +% \end{macrocode} +% \end{macro} +% +% +% \changes{v0.2d}{1994/05/13} +% {tabbing support removed (now in kernel)} +% +% \changes{v0.3l}{1995/12/07} +% {\cs{underbar} removed (now in kernel)} +% +% \changes{v0.3h}{1994/11/22} +% {marginpar, phantom and smash now supported in kernel} +% +% \changes{v0.3l}{1995/12/07} +% {\cs{showhyphens} removed (now in kernel)} +% +% +% \section{Predefining Colours} +% +% As long as the driver file has defined sufficient colour models, we +% define a few colours, just to get people started. +% +% \begin{macro}{black} +% \begin{macro}{white} +% Black and white `colours'. +% \begin{macrocode} +\ifx\color@gray\@undefined + \ifx\color@rgb\@undefined + \else + \definecolor{black}{rgb}{0,0,0} + \definecolor{white}{rgb}{1,1,1} + \fi +\else + \definecolor{black}{gray}{0} + \definecolor{white}{gray}{1} +\fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{red} +% \begin{macro}{green} +% \begin{macro}{blue} +% Additive primaries. +% \begin{macrocode} +\ifx\color@rgb\@undefined\else + \definecolor{red}{rgb}{1,0,0} + \definecolor{green}{rgb}{0,1,0} + \definecolor{blue}{rgb}{0,0,1} +\fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{cyan} +% \begin{macro}{magenta} +% \begin{macro}{yellow} +% Subtractive primaries. +% \begin{macrocode} +\ifx\color@cmyk\@undefined\else + \definecolor{cyan}{cmyk}{1,0,0,0} + \definecolor{magenta}{cmyk}{0,1,0,0} + \definecolor{yellow}{cmyk}{0,0,1,0} +\fi +% \end{macrocode} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \section{And Finally} +% +% Restore Catcodes +% \begin{macrocode} +\Gin@codes +\let\Gin@codes\relax +% \end{macrocode} +% +% \Finale +% diff --git a/Master/texmf-dist/source/latex/graphics/drivers.dtx b/Master/texmf-dist/source/latex/graphics/drivers.dtx new file mode 100644 index 00000000000..19f013d4ef6 --- /dev/null +++ b/Master/texmf-dist/source/latex/graphics/drivers.dtx @@ -0,0 +1,1662 @@ +% +% \iffalse +% +%% drivers.dtx Copyright (C) 1994 David Carlisle Sebastian Rahtz +%% Copyright (C) 1995 1996 1997 1998 1999 David Carlisle +%% +%% This file is part of the Standard LaTeX `Graphics Bundle'. +%% It may be distributed under the terms of the LaTeX Project Public +%% License, as described in lppl.txt in the base LaTeX distribution. +%% Either version 1.0 or, at your option, any later version. +%% +%<template, >\ProvidesFile{template.def} +%<dvips, >\ProvidesFile{dvips.def} +%<dvipsnames>\ProvidesFile{dvipsnam.def} +%<dvipdf, >\ProvidesFile{dvipdf.def} +%<emtex, >\ProvidesFile{emtex.def} +%<dviwin, >\ProvidesFile{dviwin.def} +%<dvipsone, >\ProvidesFile{dvipsone.def} +%<pctexps, >\ProvidesFile{pctexps.def} +%<pctex32, >\ProvidesFile{pctex32.def} +%<pctexwin, >\ProvidesFile{pctexwin.def} +%<pctexhp, >\ProvidesFile{pctexhp.def} +%<truetex, >\ProvidesFile{truetex.def} +%<tcidvi, >\ProvidesFile{tcidvi.def} +%<oztex, >\ProvidesFile{oztex.def} +%<textures, >\ProvidesFile{textures.def} +%<dvialw, >\ProvidesFile{dvialw.def} +%<dvilaser, >\ProvidesFile{dvilaser.def} +%<psprint, >\ProvidesFile{psprint.def} +%<dvi2ps, >\ProvidesFile{dvi2ps.def} +%<pubps, >\ProvidesFile{pubps.def} +%<dvitops, >\ProvidesFile{dvitops.def} +%<ln, >\ProvidesFile{ln.def} +% +%<*driver> + \NeedsTeXFormat{LaTeX2e} + \ProvidesFile{drivers.dtx} +%</driver> + [1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)] +% +%<*driver> + \documentclass{ltxdoc} + \GetFileInfo{drivers.dtx} + \begin{document} + \title{Graphics drivers for \LaTeXe\thanks + {Version \fileversion, revised \filedate}} + \author{Sebastian Rahtz and David Carlisle} + \date{\filedate} + \maketitle + \DocInput{drivers.dtx} + \end{document} +%</driver> +% \fi +% +% \CheckSum{1541} +% +% +% \providecommand\OzTeX{O\kern-.03em z\kern-.15em\TeX} +% +% \section{Driver files} +% +% This file implements some of the currently supported drivers. +% If the driver you use is not in this list then a `.def' file +% may be distributed with This graphics bundle, +% or may be distributed with your driver. +% +% If not, send us some details of the driver's |\special| syntax, and +% we will try to produce a suitable file. +% +% Note that some of these files are for drivers to which we have no +% access, so they are untested. Please send any corrections to the +% latexbugs address. +% +% +% +% +% \StopEventually{} +% +% +% \section{Colour} +% +% Most of the drivers that support colour use one of three methods. +% \begin{itemize} +% \item color1: `dvips' style colour specials. +% \item color2: `textures' style colour specials. +% \item color3: Colour implemented via literal PostScript specials. +% \item color4: Colour implemented by specials that only support RGB +% ie Red Green Blue specified as integers in the range +% 0--255. Other models converted to this within \TeX. +% \end{itemize} +% Some drivers do not use any of these modules and have their own code. +% Note that drivers using the `color3' code can not fully support the +% \LaTeX\ colour commands. +% \begin{macrocode} +%<*color1|color2|color3|color4> +% \end{macrocode} +% +% \begin{macrocode} +\def\c@lor@arg#1{% + \dimen@#1\p@ + \ifdim\dimen@<\z@\dimen@\maxdimen\fi + \ifdim\dimen@>\p@ + \PackageError{color}{Argument `#1' not in range [0,1]}\@ehd + \fi} +% \end{macrocode} +% +% Need to make sure of a trailing .0 for textures. Apparently it +% is OK to always add a . as 1.3. is accepted by textures. +% textures gray special is reversed, so just use rgb instead. +% +% \begin{macrocode} +\def\color@gray#1#2{% + \c@lor@arg{#2}% +%<color4> \c@lor@rgb@RGB\@tempa +%<color1> \edef#1{gray #2}% +%<color2> \edef#1{rgb #2. #2. #2.}% +%<color3> \edef#1{#2 setgray}% +%<color4> \edef#1{\@tempa\@tempa\@tempa}% + } +% \end{macrocode} +% +% \begin{macrocode} +\def\color@cmyk#1#2{\c@lor@@cmyk#2\@@#1} +\def\c@lor@@cmyk#1,#2,#3,#4\@@#5{% + \c@lor@arg{#4}% +%<color4> \dimen@ii#4\p@ + \c@lor@arg{#1}% +%<color4> \c@lor@cmyk@RGB\@tempa + \c@lor@arg{#2}% +%<color4> \c@lor@cmyk@RGB\@tempb + \c@lor@arg{#3}% +%<color4> \c@lor@cmyk@RGB\@tempc +%<color1> \edef#5{cmyk #1 #2 #3 #4}% +%<color2> \edef#5{cmyk #1. #2. #3. #4.}% +%<color3> \edef#5{#1 #2 #3 #4 setcmykcolor}% +%<color4> \edef#5{\@tempa\@tempb\@tempc}% + } +% \end{macrocode} +% +% A 0--1 range value will have been left in |\dimen@| by |\c@lor@arg|. +% The black value (0--1) will be stored in |\dimen@ii|. +% Covert to 0--255 integer, and leave in |#1|. +% \begin{macrocode} +%<*color4> +\def\c@lor@cmyk@RGB#1{% + \advance\dimen@-\p@ + \advance\dimen@\dimen@ii + \dimen@-\@cclv\dimen@ + \divide\dimen@\p@ + \count@\ifdim\dimen@<\z@\z@\else\dimen@\fi + \edef#1{\the\count@\space}} +%</color4> +% \end{macrocode} +% +% \begin{macrocode} +\def\color@rgb#1#2{\c@lor@@rgb#2\@@#1} +\def\c@lor@@rgb#1,#2,#3\@@#4{% + \c@lor@arg{#1}% +%<color4> \c@lor@rgb@RGB\@tempa + \c@lor@arg{#2}% +%<color4> \c@lor@rgb@RGB\@tempb + \c@lor@arg{#3}% +%<color4> \c@lor@rgb@RGB\@tempc +%<color1> \edef#4{rgb #1 #2 #3}% +%<color2> \edef#4{rgb #1. #2. #3.}% +%<color3> \edef#4{#1 #2 #3 setrgbcolor}% +%<color4> \edef#4{\@tempa\@tempb\@tempc}% + } +% \end{macrocode} +% +% A 0--1 range value will have been left in |\dimen@| by |\c@lor@arg|. +% Convert to 0--255 integer, and leave in |#1|. +% \begin{macrocode} +%<*color4> +\def\c@lor@rgb@RGB#1{% + \dimen@\@cclv\dimen@ + \count@\dimen@ + \divide\count@\p@ + \edef#1{\the\count@\space}} +%</color4> +% \end{macrocode} +% +% \begin{macrocode} +\def\color@RGB#1#2{\c@lor@@RGB#2\@@#1} +% \end{macrocode} +% +% \begin{macrocode} +\def\c@lor@@RGB#1,#2,#3\@@#4{% +%<!color4> \c@lor@RGB@rgb{#1}\@tempa +%<!color4> \c@lor@RGB@rgb{#2}\@tempb +%<!color4> \c@lor@RGB@rgb{#3}\@tempc +%<!color4> \c@lor@@rgb\@tempa,\@tempb,\@tempc\@@#4% +%<color4> \edef#4{#1 #2 #3}% + } +% \end{macrocode} +% % Convert 0--255 integer, |#1|, to 0--1 real, and leave in |#2|. +% \begin{macrocode} +%<*!color4> +\def\c@lor@RGB@rgb#1#2{% + \dimen@#1\p@ + \divide\dimen@\@cclv + \edef#2{\strip@pt\dimen@}} +%</!color4> +% \end{macrocode} +% +% \begin{macrocode} +%<*color1|color3> +\def\color@hsb#1#2{\c@lor@@hsb#2\@@#1} +% \end{macrocode} +% +% \begin{macrocode} +\def\c@lor@@hsb#1,#2,#3\@@#4{% + \c@lor@arg{#1}% + \c@lor@arg{#2}% + \c@lor@arg{#3}% +%<color1> \edef#4{hsb #1 #2 #3}% +%<color3> \edef#4{#1 #2 #3 sethsbcolor}% + } +%</color1|color3> +% \end{macrocode} +% +% \begin{macrocode} +\def\color@named#1#2{\c@lor@@named#2,,\@@#1} +% \end{macrocode} +% +% \begin{macrocode} +\def\c@lor@@named#1,#2,#3\@@#4{% + \@ifundefined{col@#1}% + {\PackageError{color}{Undefined color `#1'}\@ehd}% +%<color1&!dvipsone> {\edef#4{ #1}}% +%<color2> {\edef#4{ #1 \if!#2!\else #2.\fi}}% +%<color3|dvipsone|color4> {\edef#4{\csname col@#1\endcsname}}% + } +% \end{macrocode} +% +% Conversion from |\special| syntax to PostScript (for PSTricks). +% \begin{macrocode} +%<*color1|color2> +\def\c@lor@to@ps#1 #2\@@{\csname c@lor@ps@#1\endcsname#2 \@@} +%</color1|color2> +%<*color3> +\def\c@lor@to@ps#1\@@{#1} +%</color3> +%<*color4> +\def\c@lor@to@ps#1#2 #3 #4\@@{% + #1#2 255 div #3 255 div #4 255 div setrgbcolor} +%</color4> +% \end{macrocode} +% +% \begin{macrocode} +%<*color1> +\def\c@lor@ps@#1 #2\@@{TeXDict begin #1 end} +\def\c@lor@ps@rgb#1\@@{#1 setrgbcolor} +\def\c@lor@ps@hsb#1\@@{#1 sethsbcolor} +\def\c@lor@ps@cmyk#1\@@{#1 setcmykcolor} +\def\c@lor@ps@gray#1\@@{#1 setgray} +%</color1> +%<*color2> +\def\c@lor@to@ps@#1 #2\@@{\csname c@lor@ps@#1@\endcsname#2 \@@} +\def\c@lor@ps@#1 #2\@@{% + \expandafter\expandafter\expandafter + \c@lor@to@ps@\csname col@#1\expandafter\endcsname\space#2. \@@{#1}} +\def\c@lor@ps@rgb#1. #2. #3. #4\@@{#1 #2 #3 setrgbcolor} +\def\c@lor@ps@rgb@#1. #2. #3. #4. #5\@@#6{#1 #2 #3 setrgbcolor} +\def\c@lor@ps@cmyk#1. #2. #3. #4. #5. #6\@@{#1 #2 #3 #4 setcmykcolor} +\def\c@lor@ps@cmyk@#1. #2. #3. #4. #5. #6\@@#7{% + #1 #2 #3 #4 (#7) findcustomcmykcolor + \if!\@firstofone#5!1 \else#5 \fi setcustomcolor} +%</color2> +% \end{macrocode} +% +% \begin{macrocode} +%<color1&!dvipsone>\def\current@color{ Black} +%<color1&dvipsone>\def\current@color{gray 0} +%<color2>\def\current@color{rgb 0. 0. 0.} +%<color3>\def\current@color{0 setgray} +%<color4>\def\current@color{0 0 0} +% \end{macrocode} +% +% \begin{macrocode} +%<*color1> +\def\set@color{% +%<!dvipsone&!dvipdf> \special{color push \current@color +%<dvipsone> \special{color push}\special{color \current@color +%<dvipdf> \special{pdf: /C \current@color\space<< + }\aftergroup\reset@color} +\def\reset@color{\special{% +%<!dvipdf> color pop}} +%<dvipdf> pdf: /C >> }} +\def\set@page@color{\special{% +%<!dvipdf> background \current@color}} +%<dvipdf> pdf: /BG \current@color}} +\def\define@color@named#1#2{% +%<!dvipsone> \expandafter\let\csname col@#1\endcsname\@nnil} +%<dvipsone> \expandafter\edef\csname col@#1\endcsname{#2}} +%</color1> +%<*color2> +\def\set@color{% + \special{color push}% + \special{color \current@color}% + \aftergroup\reset@color} +\def\reset@color{\special{color pop}} +\def\set@page@color{\c@lor@special\sixt@@n{background \current@color}} +\def\define@color@named#1#2{% + \AtBeginDvi{\special{color define #1 #2}}% + \expandafter\edef\csname col@#1\endcsname{#2}} +%</color2> +%<*color3> +\def\set@color{% + \Gin@PS@raw{\current@color}\aftergroup\reset@color} +\def\reset@color{\Gin@PS@raw{\current@color}} +%</color3> +%<*color4> +\def\set@color{% + \special{textcolor: \current@color}\aftergroup\reset@color} +\def\reset@color{\special{textcolor: \current@color}} +%</color4> +%<*color3|color4> +\def\set@page@color{% + \c@lor@special\sixt@@n{background color ignored: \current@color}} +\def\define@color@named#1#2{% + \expandafter\edef\csname col@#1\endcsname{#2}} +%</color3|color4> +% \end{macrocode} +% +% \begin{macrocode} +%</color1|color2|color3|color4> +% \end{macrocode} +% +% \begin{macrocode} +%<*colorfix> +\AtBeginDocument{% + \let\@ldc@l@r\color + \def\color{\if@inlabel\leavevmode\fi\@ldc@l@r}% + \let\@lduseb@x\usebox + \def\usebox#1{\@lduseb@x{#1}\set@color}} +%</colorfix> +% \end{macrocode} +% +% \begin{macrocode} +%<*dvipsnames> +\DefineNamedColor{named}{GreenYellow} {cmyk}{0.15,0,0.69,0} +\DefineNamedColor{named}{Yellow} {cmyk}{0,0,1,0} +\DefineNamedColor{named}{Goldenrod} {cmyk}{0,0.10,0.84,0} +\DefineNamedColor{named}{Dandelion} {cmyk}{0,0.29,0.84,0} +\DefineNamedColor{named}{Apricot} {cmyk}{0,0.32,0.52,0} +\DefineNamedColor{named}{Peach} {cmyk}{0,0.50,0.70,0} +\DefineNamedColor{named}{Melon} {cmyk}{0,0.46,0.50,0} +\DefineNamedColor{named}{YellowOrange} {cmyk}{0,0.42,1,0} +\DefineNamedColor{named}{Orange} {cmyk}{0,0.61,0.87,0} +\DefineNamedColor{named}{BurntOrange} {cmyk}{0,0.51,1,0} +\DefineNamedColor{named}{Bittersweet} {cmyk}{0,0.75,1,0.24} +\DefineNamedColor{named}{RedOrange} {cmyk}{0,0.77,0.87,0} +\DefineNamedColor{named}{Mahogany} {cmyk}{0,0.85,0.87,0.35} +\DefineNamedColor{named}{Maroon} {cmyk}{0,0.87,0.68,0.32} +\DefineNamedColor{named}{BrickRed} {cmyk}{0,0.89,0.94,0.28} +\DefineNamedColor{named}{Red} {cmyk}{0,1,1,0} +\DefineNamedColor{named}{OrangeRed} {cmyk}{0,1,0.50,0} +\DefineNamedColor{named}{RubineRed} {cmyk}{0,1,0.13,0} +\DefineNamedColor{named}{WildStrawberry}{cmyk}{0,0.96,0.39,0} +\DefineNamedColor{named}{Salmon} {cmyk}{0,0.53,0.38,0} +\DefineNamedColor{named}{CarnationPink} {cmyk}{0,0.63,0,0} +\DefineNamedColor{named}{Magenta} {cmyk}{0,1,0,0} +\DefineNamedColor{named}{VioletRed} {cmyk}{0,0.81,0,0} +\DefineNamedColor{named}{Rhodamine} {cmyk}{0,0.82,0,0} +\DefineNamedColor{named}{Mulberry} {cmyk}{0.34,0.90,0,0.02} +\DefineNamedColor{named}{RedViolet} {cmyk}{0.07,0.90,0,0.34} +\DefineNamedColor{named}{Fuchsia} {cmyk}{0.47,0.91,0,0.08} +\DefineNamedColor{named}{Lavender} {cmyk}{0,0.48,0,0} +\DefineNamedColor{named}{Thistle} {cmyk}{0.12,0.59,0,0} +\DefineNamedColor{named}{Orchid} {cmyk}{0.32,0.64,0,0} +\DefineNamedColor{named}{DarkOrchid} {cmyk}{0.40,0.80,0.20,0} +\DefineNamedColor{named}{Purple} {cmyk}{0.45,0.86,0,0} +\DefineNamedColor{named}{Plum} {cmyk}{0.50,1,0,0} +\DefineNamedColor{named}{Violet} {cmyk}{0.79,0.88,0,0} +\DefineNamedColor{named}{RoyalPurple} {cmyk}{0.75,0.90,0,0} +\DefineNamedColor{named}{BlueViolet} {cmyk}{0.86,0.91,0,0.04} +\DefineNamedColor{named}{Periwinkle} {cmyk}{0.57,0.55,0,0} +\DefineNamedColor{named}{CadetBlue} {cmyk}{0.62,0.57,0.23,0} +\DefineNamedColor{named}{CornflowerBlue}{cmyk}{0.65,0.13,0,0} +\DefineNamedColor{named}{MidnightBlue} {cmyk}{0.98,0.13,0,0.43} +\DefineNamedColor{named}{NavyBlue} {cmyk}{0.94,0.54,0,0} +\DefineNamedColor{named}{RoyalBlue} {cmyk}{1,0.50,0,0} +\DefineNamedColor{named}{Blue} {cmyk}{1,1,0,0} +\DefineNamedColor{named}{Cerulean} {cmyk}{0.94,0.11,0,0} +\DefineNamedColor{named}{Cyan} {cmyk}{1,0,0,0} +\DefineNamedColor{named}{ProcessBlue} {cmyk}{0.96,0,0,0} +\DefineNamedColor{named}{SkyBlue} {cmyk}{0.62,0,0.12,0} +\DefineNamedColor{named}{Turquoise} {cmyk}{0.85,0,0.20,0} +\DefineNamedColor{named}{TealBlue} {cmyk}{0.86,0,0.34,0.02} +\DefineNamedColor{named}{Aquamarine} {cmyk}{0.82,0,0.30,0} +\DefineNamedColor{named}{BlueGreen} {cmyk}{0.85,0,0.33,0} +\DefineNamedColor{named}{Emerald} {cmyk}{1,0,0.50,0} +\DefineNamedColor{named}{JungleGreen} {cmyk}{0.99,0,0.52,0} +\DefineNamedColor{named}{SeaGreen} {cmyk}{0.69,0,0.50,0} +\DefineNamedColor{named}{Green} {cmyk}{1,0,1,0} +\DefineNamedColor{named}{ForestGreen} {cmyk}{0.91,0,0.88,0.12} +\DefineNamedColor{named}{PineGreen} {cmyk}{0.92,0,0.59,0.25} +\DefineNamedColor{named}{LimeGreen} {cmyk}{0.50,0,1,0} +\DefineNamedColor{named}{YellowGreen} {cmyk}{0.44,0,0.74,0} +\DefineNamedColor{named}{SpringGreen} {cmyk}{0.26,0,0.76,0} +\DefineNamedColor{named}{OliveGreen} {cmyk}{0.64,0,0.95,0.40} +\DefineNamedColor{named}{RawSienna} {cmyk}{0,0.72,1,0.45} +\DefineNamedColor{named}{Sepia} {cmyk}{0,0.83,1,0.70} +\DefineNamedColor{named}{Brown} {cmyk}{0,0.81,1,0.60} +\DefineNamedColor{named}{Tan} {cmyk}{0.14,0.42,0.56,0} +\DefineNamedColor{named}{Gray} {cmyk}{0,0,0,0.50} +\DefineNamedColor{named}{Black} {cmyk}{0,0,0,1} +\DefineNamedColor{named}{White} {cmyk}{0,0,0,0} +%</dvipsnames> +% \end{macrocode} +% +% \section{dvips} +% A \LaTeXe\ graphics driver file for Tom Rokicki's \emph{dvips} +% driver; tested with version 5.58f. +% +% \begin{macrocode} +%<*dvips> +% \end{macrocode} +% +% \subsection{Colour} +% Uses the generic `color1' code. +% +% \subsection{File inclusion} +% +% \begin{macro}{\Ginclude@eps} +% |#1| input file (or command) +% \begin{macrocode} +\def\Ginclude@eps#1{% + \message{<#1>}% + \bgroup +% \end{macrocode} +% \emph{dvips} likes to work with its own pixel resolution, so +% mangle the sizes slightly. +% \begin{macrocode} + \def\@tempa{!}% + \dimen@\Gin@req@width + \dimen@ii.1bp% + \divide\dimen@\dimen@ii + \@tempdima\Gin@req@height + \divide\@tempdima\dimen@ii + \special{PSfile="#1"\space + llx=\Gin@llx\space + lly=\Gin@lly\space + urx=\Gin@urx\space + ury=\Gin@ury\space + \ifx\Gin@scalex\@tempa\else rwi=\number\dimen@\space\fi + \ifx\Gin@scaley\@tempa\else rhi=\number\@tempdima\space\fi + \ifGin@clip clip\fi}% + \egroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Ginclude@bmp} +% |#1| input file; if zero size is requested, the graphic will +% come at `natural' size. +% \begin{macrocode} +\def\Ginclude@bmp#1{% + \message{<#1>}% + \dimen@\Gin@req@height + \advance\dimen@ by-\Gin@lly bp + \kern-\Gin@llx bp\raise\Gin@req@height\hbox{% + \ifdim\Gin@urx bp=\z@ + \ifdim\Gin@ury bp=\z@ + \special{em: graph #1}% + \else + \special{em: graph #1,\Gin@urx bp}% + \fi + \else + \special{em: graph #1,\Gin@urx bp,\Gin@ury bp}% + \fi + }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Ginclude@pict} +% \begin{macro}{\Ginclude@pntg} +% \begin{macro}{\oztex@include} +% PICT/PNTG format from the Mac. Actually only currently supported by +% the version of dvips distributed with \OzTeX, and with the built in +% \OzTeX\ drivers, but put here anyway as it is not much code and +% increases portability between the systems as now |[dvips]| and +% |[oztex]| share the same back end. +% \begin{macrocode} +\def\oztex@include#1#2{% + \dimen@1bp% + \divide\Gin@req@width\dimen@ + \divide\Gin@req@height\dimen@ + \special{#1=#2\space + \@width=\number\Gin@req@width \space + \@height=\number\Gin@req@height}} +% \end{macrocode} +% +% \begin{macrocode} +\def\Ginclude@pntg{\oztex@include{pntg}} +\def\Ginclude@pict{\oztex@include{pict}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Rotation} +% \begin{macrocode} +\def\Grot@start{% + \special{ps: gsave currentpoint + currentpoint translate \Grot@angle\space neg + rotate neg exch neg exch translate}} +\def\Grot@end{\special{ps: currentpoint grestore moveto}} +% \end{macrocode} +% \subsection{Scaling} +% \begin{macrocode} +\def\Gscale@start{\special{ps: currentpoint currentpoint translate + \Gscale@x\space \Gscale@y\space scale neg exch neg exch translate}} +\def\Gscale@end{\special{ps: currentpoint currentpoint translate + 1 \Gscale@x\space div 1 \Gscale@y\space div scale + neg exch neg exch translate}} +% \end{macrocode} +% +% \section{Literal Postscript} +% +% Raw PostScript code, no save/restore. +% \begin{macrocode} +\def\Gin@PS@raw#1{\special{ps: #1}} +% \end{macrocode} +% +% PostScript code, to be surrounded by save/restore by the driver. +% Coordinate system standard PostScript, but with origin +% at current (\TeX) position. +% \begin{macrocode} +\def\Gin@PS@restored#1{\special{" #1}} +% \end{macrocode} +% +% PostScript code to be inserted in the Header section of the final +% PostScript. Must be issued on the first page of a document. +% \begin{macrocode} +\def\Gin@PS@literal@header#1{\AtBeginDvi{\special{! #1}}} +% \end{macrocode} +% +% Name of external file, the contents of which are to be inserted in +% the Header section of the final PostScript. Must be issued on the +% first page of a document. +% \begin{macrocode} +\def\Gin@PS@file@header#1{\AtBeginDvi{\special{header=#1}}} +% \end{macrocode} +% +% \begin{macrocode} +%</dvips> +% \end{macrocode} +% +% +% \section{dvipdf} +% A \LaTeXe\ graphics driver file for \emph{dvipdf} driver. +% +% \begin{macrocode} +%<*dvipdf> +% \end{macrocode} +% +% \subsection{Colour} +% Uses the generic `color1' code. +% +% \subsection{File inclusion} +% +% \begin{macro}{\Ginclude@eps} +% |#1| input file (or command) +% \begin{macrocode} +\def\Ginclude@eps#1{% + \message{<#1>}% + \bgroup +% \end{macrocode} +% \emph{dvips} likes to work with its own pixel resolution, so +% mangle the sizes slightly. +% \begin{macrocode} + \def\@tempa{!}% + \dimen@\Gin@req@width + \dimen@ii.1bp% + \divide\dimen@\dimen@ii + \@tempdima\Gin@req@height + \divide\@tempdima\dimen@ii + \special{PSfile="#1"\space + llx=\Gin@llx\space + lly=\Gin@lly\space + urx=\Gin@urx\space + ury=\Gin@ury\space + \ifx\Gin@scalex\@tempa\else rwi=\number\dimen@\space\fi + \ifx\Gin@scaley\@tempa\else rhi=\number\@tempdima\space\fi + \ifGin@clip clip\fi}% + \egroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Ginclude@bmp} +% |#1| input file; if zero size is requested, the graphic will +% come at `natural' size. +% \begin{macrocode} +\def\Ginclude@bmp#1{% + \message{<#1>}% + \dimen@\Gin@req@height + \advance\dimen@ by-\Gin@lly bp + \kern-\Gin@llx bp\raise\Gin@req@height\hbox{% + \ifdim\Gin@urx bp=\z@ + \ifdim\Gin@ury bp=\z@ + \special{pdf: /GRAPH #1}% + \else + \special{pdf: /GRAPH #1 \number\Gin@req@width sp}% + \fi + \else + \special{pdf: /GRAPH #1 \number\Gin@req@width sp + \number\Gin@req@height sp}% + \fi}} +% \end{macrocode} +% \end{macro} +% +% \subsection{Rotation} +% \begin{macrocode} +\def\Grot@start{% +\special{pdf: /ROT \Grot@angle\space << }} +\def\Grot@end{\special{pdf: /ROT >> }} +% \end{macrocode} +% +% \subsection{Scaling} +% \begin{macrocode} +\def\Gscale@start{\special{pdf: /S \Gscale@x\space \Gscale@y\space << }} +\def\Gscale@end{\special{pdf: /S \space >> }} +% \end{macrocode} +% +% \section{Literal Postscript} +% +% Raw PostScript code, no save/restore. +% \begin{macrocode} +\def\Gin@PS@raw#1{\special{ps: #1}} +% \end{macrocode} +% +% PostScript code, to be surrounded by save/restore by the driver. +% Coordinate system standard PostScript, but with origin +% at current (\TeX) position. +% \begin{macrocode} +\def\Gin@PS@restored#1{\special{" #1}} +% \end{macrocode} +% +% PostScript code to be inserted in the Header section of the final +% PostScript. Must be issued on the first page of a document. +% \begin{macrocode} +\def\Gin@PS@literal@header#1{\AtBeginDvi{\special{! #1}}} +% \end{macrocode} +% +% Name of external file, the contents of which are to be inserted in +% the Header section of the final PostScript. Must be issued on the +% first page of a document. +% \begin{macrocode} +\def\Gin@PS@file@header#1{\AtBeginDvi{\special{header=#1}}} +% \end{macrocode} +% +% \subsection{File extensions} +% +% \begin{macrocode} +\@namedef{Gin@rule@.msp}#1{{bmp}{.bb}{#1}} +\@namedef{Gin@rule@.jpg}#1{{bmp}{.bb}{#1}} +\@namedef{Gin@rule@.bmp}#1{{bmp}{.bb}{#1}} +% \end{macrocode} +% +% \begin{macrocode} +%</dvipdf> +% \end{macrocode} +% +% \section{\OzTeX} +% +% A \LaTeXe\ graphics driver file for \OzTeX\ +% (versions 1.42 and later), +% by Andrew Trevorrow. +% \begin{macrocode} +%<*oztex> +% \end{macrocode} +%\subsection{Graphics inclusion} +% \begin{macrocode} +\def\Ginclude@eps{\Oztex@Include{epsf}} +\def\Ginclude@pntg{\Oztex@Include{pntg}} +\def\Ginclude@pict{\Oztex@Include{pict}} +\def\Oztex@Include#1#2{% + \ifGin@clip + \typeout{No clipping support in OzTeX}% + \fi + \divide\Gin@req@width by 65781% convert sp to bp + \divide\Gin@req@height by 65781% + \special{#1=#2\space + width=\number\Gin@req@width \space + height=\number\Gin@req@height + }% +} +%</oztex> +% \end{macrocode} +%\section{Textures} +% A \LaTeXe\ graphics driver file for Blue Sky's Textures +% +% \textbf{WARNING! There is ongoing work to produce a new version of +% the textures support. Do not rely on anything in this file being in +% the next version!} +% +% +% \begin{macrocode} +%<*textures> +% \end{macrocode} +% \subsection{Graphics inclusion} +% +% +% \begin{macrocode} +\PackageInfo{graphics/color} + {This file uses the advanced color support\MessageBreak + available in textures1.7\MessageBreak + If you are using color with an earlier version\MessageBreak + of textures, edit graphics.ins where marked,\MessageBreak + and re-latex graphics.ins.\MessageBreak\MessageBreak + If you are using textures1.7\MessageBreak + you may want to delete this warning\MessageBreak + from textures.def.\MessageBreak\MessageBreak + The code for scaling/rotation and file inclusion\MessageBreak + in this file is still rudimentary, and does not\MessageBreak + use textures' full capabilities.\MessageBreak\MessageBreak + A new textures.def is currently being developed\@gobble} +% \end{macrocode} +% +% +% \begin{macrocode} +\def\Ginclude@eps{\Textures@Include{illustration}} +\def\Ginclude@pict{\Textures@Include{pictfile}} +\def\Textures@Include#1#2{% + \def\@tempa{!}% + \ifx\Gin@scaley\@tempa + \let\Gin@scaley\Gin@scalex + \else + \ifx\Gin@scalex\@tempa\let\Gin@scalex\Gin@scaley\fi + \fi + \setlength\@tempdima{\Gin@scalex pt}% + \setlength\@tempdimb{\Gin@scaley pt}% + \ifdim\@tempdima>\@tempdimb + \let\Gin@scalex\Gin@scaley + \fi + \ifGin@clip + \typeout{no clipping support in Textures}% + \fi + \@tempdimb=1000sp% + \setlength\@tempdima{\Gin@scalex\@tempdimb}% + \special{#1 #2\space scaled \number\@tempdima}% +} +% \end{macrocode} +% \subsection{Rotation} +% This code was written when no unprotected postscript code was allowed; +% it could almost certainly be rewritten now with `rawpostscript'. +% \begin{macrocode} +\def\Grot@start{\special{postscript + 0 0 transform + grestore + matrix currentmatrix + 3 1 roll + itransform + dup 3 -1 roll + dup 4 1 roll exch + translate + \Grot@angle\space neg rotate + neg exch neg exch translate + gsave}} +\def\Grot@end{\special{postscript grestore setmatrix gsave}} +% \end{macrocode} +% \subsection{Colour} +% This will only work for versions 1.6 and Version 1.7 uses `color2'. +% \begin{macrocode} +%<color3>\def\Gin@PS@raw#1{\special{rawpostscript #1}} +%</textures> +% \end{macrocode} +% +% \section{dvialw} +% A \LaTeXe\ graphics driver file for dvialw, by Nelson Beebe +% \begin{macrocode} +%<*dvialw> +% \end{macrocode} +% \subsection{Rotation} +% \begin{macrocode} +\def\Ginclude@eps#1{% + \def\@tempa{!}% + \ifx\Gin@scaley\@tempa + \let\Gin@scaley\Gin@scalex + \else + \ifx\Gin@scalex\@tempa\let\Gin@scalex\Gin@scaley\fi + \fi + \ifGin@clip + \typeout{no clipping support in dvialw}% + \fi + \special{language "PS", + literal "\Gin@scalex\space + \Gin@scaley\space scale", + position = "bottom left", + include "#1\space"}% +} +%</dvialw> +% \end{macrocode} +% \section{emtex} +% A \LaTeXe\ graphics driver file for Eberhard Mattes' emTeX +% \begin{macrocode} +%<*emtex> +% \end{macrocode} +% \subsection{Graphics file inclusion} +% \begin{macrocode} +\def\Ginclude@bmp#1{% + \raise\Gin@req@height\hbox{\special{em:graph #1}}% +\typeout{WARNING: emtex does not permit graphics to be scaled}% +} +%</emtex> +% \end{macrocode} +% \section{dvilaser/ps} +% A \LaTeXe\ graphics driver file for Arbortext's dvilaser/ps +% \begin{macrocode} +%<*dvilaser> +% \end{macrocode} +%\subsection{Graphic file inclusion} +% \begin{macrocode} +\def\Ginclude@eps#1{% +\ifGin@clip + \typeout{no clipping support in dvilaser/ps}% +\fi +\special{ps: epsfile #1\space \the\Gin@req@width}% +} +%</dvilaser> +% \end{macrocode} +% \section{psprint} +% A \LaTeXe\ graphics driver file for Trevorrow's psprint +% \begin{macrocode} +%<*psprint> +% \end{macrocode} +%\subsection{Graphic file inclusion} +% \begin{macrocode} +\def\Ginclude@eps#1{% + \def\@tempa{!}% + \ifx\Gin@scaley\@tempa + \let\Gin@scaley\Gin@scalex + \else + \ifx\Gin@scalex\@tempa\let\Gin@scalex\Gin@scaley\fi + \fi + \ifGin@clip + \typeout{no clipping support in psprint}% + \fi + \special{#1\space + \Gin@scalex\space \Gin@scaley\space scale + \Gin@llx\space neg + \Gin@lly \space neg translate +}% +} +%</psprint> +% \end{macrocode} +% \section{dvipsone} +% +% A \LaTeXe\ graphics driver file for Y\&Y's dvipsone +% \begin{macrocode} +%<*dvipsone> +% \end{macrocode} +% +% \subsection{Graphic file inclusion} +% +% PostScript Files. +% \begin{macrocode} +\def\Ginclude@eps#1{% + \message{<#1>}% + \bgroup + \def\@tempa{!}% + \dimen@\Gin@req@width + \dimen@ii.1bp% + \divide\dimen@\dimen@ii + \@tempdima\Gin@req@height + \divide\@tempdima\dimen@ii + \special{PSfile="#1"\space + llx=\Gin@llx\space + lly=\Gin@lly\space + urx=\Gin@urx\space + ury=\Gin@ury\space + \ifx\Gin@scalex\@tempa\else rwi=\number\dimen@\space\fi + \ifx\Gin@scaley\@tempa\else rhi=\number\@tempdima\space\fi + \ifGin@clip clip\fi}% + \egroup} +% \end{macrocode} +% +% Tiff files. +% \begin{macrocode} +\def\Ginclude@tiff#1{% +\message{<#1>}% + \special{insertimage: #1 \number\Gin@req@width\space + \number\Gin@req@height}} +% \end{macrocode} +% +% Windows Metafiles. +% \begin{macrocode} +\def\Ginclude@wmf#1{% + \message{<#1>}% + \special{insertmf: #1 0 0 \number\Gin@req@width\space + \number\Gin@req@height}} +% \end{macrocode} +% +% \begin{macrocode} +% \end{macrocode} +% +% \begin{macrocode} +\def\Gin@PS@raw#1{\special{ps: #1}} +% \end{macrocode} +% +% \subsection{Rotation} +% \begin{macrocode} +\def\Grot@start{% + \special{ps: gsave currentpoint + currentpoint translate \Grot@angle\space + rotate neg exch neg exch translate}} +\def\Grot@end{% + \special{ps: currentfont currentpoint grestore moveto setfont}} +% \end{macrocode} +% +% \subsection{Scaling} +% \begin{macrocode} +\def\Gscale@start{\special{ps: currentpoint currentpoint translate + \Gscale@x\space \Gscale@y\space scale neg exch neg exch translate}} +\def\Gscale@end{\special{ps: currentpoint currentpoint translate + 1 \Gscale@x\space div 1 \Gscale@y\space div scale + neg exch neg exch translate}} +% \end{macrocode} +% +% \subsection{File Extensions} +% +% \begin{macrocode} +\@namedef{Gin@rule@.wmf}#1{{wmf}{}{#1}} +\@namedef{Gin@rule@.clp}#1{{wmf}{}{#1}} +% \end{macrocode} +% +% \section{Literal Postscript} +% +% Raw PostScript code, no save/restore. +% \begin{macrocode} +\def\Gin@PS@raw#1{\special{ps: #1}} +% \end{macrocode} +% +% PostScript code, to be surrounded by save/restore by the driver. +% Coordinate system standard PostScript, but with origin +% at current (\TeX) position. +% \begin{macrocode} +\def\Gin@PS@restored#1{\special{" #1}} +% \end{macrocode} +% +% PostScript code to be inserted in the Header section of the final +% PostScript. Must be issued on the first page of a document. +% \begin{macrocode} +\def\Gin@PS@literal@header#1{\AtBeginDvi{\special{headertext=#1}}} +% \end{macrocode} +% +% Name of external file, the contents of which are to be inserted in +% the Header section of the final PostScript. Must be issued on the +% first page of a document. +% \begin{macrocode} +\def\Gin@PS@file@header#1{\AtBeginDvi{\special{header=#1}}} +% \end{macrocode} +% +% \begin{macrocode} +%</dvipsone> +% \end{macrocode} +% +% \section{dviwindo} +% A \LaTeXe\ graphics driver file for Y\&Y's dviwindo. +% +% This driver now uses the same file as |dvipsone|. +% +% \section{dvitops} +% A \LaTeXe\ graphics driver file for James Clark's dvitops +% \begin{macrocode} +%<*dvitops> +% \end{macrocode} +% \subsection{Rotation} +% \begin{macrocode} +\newcount\Grot@count +\Grot@count=\@ne +\def\Grot@start{\special{dvitops: origin + rot\the\@tempdima}% +\special{dvitops: begin rot\the\Grot@count}}% +\def\Grot@end{\special{dvitops: end}% +\special{dvitops: rotate rot\the\Grot@count \space + \Grot@angle}% +\global\advance\Grot@count by\@ne}% +% \end{macrocode} +% \subsection{Graphic file inclusion} +% \begin{macrocode} +\def\Ginclude@eps#1{% +% These cause an arithmetic overflow, so I've commented them +% out. Presumably they were there for some reason. +% Any dvitops users out there?? +% \multiply\Gin@req@width by \@m +% \multiply\Gin@req@height by \@m +\ifGin@clip + \typeout{no clipping support in dvitops}% +\fi +\special{import #1\space \the\Gin@req@width\space + \the\Gin@req@height\space fill}} +% \end{macrocode} +% +% \begin{macrocode} +%</dvitops> +% \end{macrocode} +% +%\section{dvi2ps} +% A \LaTeXe\ graphics driver file for original dvi2ps +% \begin{macrocode} +%<*dvi2ps> +% \end{macrocode} +% +% \subsection{Graphic file inclusion} +% \begin{macrocode} +\def\Ginclude@eps#1{% + \def\@tempa{!}% + \ifx\Gin@scaley\@tempa + \let\Gin@scaley\Gin@scalex + \else + \ifx\Gin@scalex\@tempa\let\Gin@scalex\Gin@scaley\fi + \fi + \ifGin@clip + \typeout{no clipping support in dvi2ps}% + \fi + \special{psfile=#1\space + hscale=\Gin@scalex\space 1000 mul + vscale=\Gin@scaley\space 1000 mul}} +% \end{macrocode} +% +% \begin{macrocode} +%</dvi2ps> +% \end{macrocode} +% +% \section{pctexps} +% A \LaTeXe\ graphics driver file for Personal TeX's PTI Laser/PS; +% from information supplied by Lance Carnes and Tao Wang +% |<pti@crl.com>|. +% \begin{macrocode} +%<*pctexps> +% \end{macrocode} +% +% \subsection{Graphic file inclusion} +% +% \begin{macrocode} +\def\Ginclude@eps#1{% +\message{<#1>}% + \ifGin@clip + \typeout{no clipping support in pctexps}% + \fi + \Gin@req@width.03515\Gin@req@width + \Gin@req@height.03515\Gin@req@height + \special{ps:#1\space x=\strip@pt\Gin@req@width cm, + y=\strip@pt\Gin@req@height cm}} +% \end{macrocode} +% +% \begin{macrocode} +\def\Ginclude@ps#1{% +\message{<#1>}% + \ifGin@clip + \typeout{no clipping support in pctexps}% + \fi + \hbox{\kern-\Gin@llx bp\raise-\Gin@lly bp\hbox{\special{ps:#1}}}% + \typeout{^^J% +---------------------------------------------------------^^J% +.ps graphics without bounding box information cannot be^^J% +scaled. If the file actually contains the information,^^J% +please rename the file to .eps file extension.^^J% +---------------------------------------------------------^^J}} +% \end{macrocode} +% +% \begin{macrocode} +\def\Gin@extensions{.eps,.ps} +\@namedef{Gin@rule@.ps}#1{{ps}{.ps}{#1}} +\@namedef{Gin@rule@.eps}#1{{eps}{.eps}{#1}} +% \end{macrocode} +% +% \begin{macrocode} +\def\Gin@PS@raw#1{\special{ps::#1}} +\def\Grot@start{% + \special{ps::gsave currentpoint + currentpoint translate \Grot@angle\space + rotate neg exch neg exch translate}} +\def\Grot@end{\special{ps:: currentpoint grestore moveto}} +% \end{macrocode} +% +% \begin{macrocode} +\def\Gscale@start{\special{ps:: currentpoint currentpoint translate + \Gscale@x\space \Gscale@y\space scale neg exch neg exch translate}} +\def\Gscale@end{\special{ps:: currentpoint currentpoint translate + 1 \Gscale@x\space div 1 \Gscale@y\space div scale + neg exch neg exch translate}} +% \end{macrocode} +% +% \begin{macrocode} +%</pctexps> +% \end{macrocode} +% +% \section{pctex32} +% A \LaTeXe\ graphics driver file for Personal TeX's PC TeX for 32 bit +% Windows; Code supplied by Tao Wang |<pti@crl.com>|. +% +% \subsection{Colour} +% Uses the generic `color1' code. +% +% \begin{macrocode} +%<*pctex32> +% \end{macrocode} +% +% \subsection{Graphic file inclusion}% +% \begin{macrocode} +% including PostScript graphics +\def\Ginclude@eps#1{% + \message{<#1>}% + \bgroup + \def\@tempa{!}% + \dimen@\Gin@req@width + \dimen@ii.1bp% + \divide\dimen@\dimen@ii + \@tempdima\Gin@req@height + \divide\@tempdima\dimen@ii + \special{PSfile="#1"\space + llx=\Gin@llx\space + lly=\Gin@lly\space + urx=\Gin@urx\space + ury=\Gin@ury\space + \ifx\Gin@scalex\@tempa\else rwi=\number\dimen@\space\fi + \ifx\Gin@scaley\@tempa\else rhi=\number\@tempdima\space\fi + \ifGin@clip clip\fi}% + \egroup} +% \end{macrocode} +% +% including BMP graphics +% \begin{macrocode} +\def\Ginclude@bmp#1{% +\message{<#1>}% + \ifGin@clip + \typeout{no clipping support for BMP graphics in PCTeX32}% + \fi + \Gin@req@width.03515\Gin@req@width + \Gin@req@height.03515\Gin@req@height + \special{bmp:#1\space x=\strip@pt\Gin@req@width cm, + y=\strip@pt\Gin@req@height cm}} +% \end{macrocode} +% +% including WMF graphics +% \begin{macrocode} +\def\Ginclude@wmf#1{% +\message{<#1>}% + \ifGin@clip + \typeout{no clipping support for WMF graphics in PCTeX32}% + \fi + \Gin@req@width.03515\Gin@req@width + \Gin@req@height.03515\Gin@req@height + \special{wmf:#1\space x=\strip@pt\Gin@req@width cm, + y=\strip@pt\Gin@req@height cm}} +% \end{macrocode} +% +% \subsection{Scaling and Rotating} +% PostScript rotation and scaling +% \begin{macrocode} +\def\Grot@start{% + \special{ps:: gsave currentpoint + currentpoint translate \Grot@angle\space neg + rotate neg exch neg exch translate}} +\def\Grot@end{\special{ps:: currentpoint grestore moveto}} +\def\Gscale@start{\special{ps:: currentpoint currentpoint translate + \Gscale@x\space \Gscale@y\space scale neg exch neg exch translate}} +\def\Gscale@end{\special{ps:: currentpoint currentpoint translate + 1 \Gscale@x\space div 1 \Gscale@y\space div scale + neg exch neg exch translate}} +% \end{macrocode} +% +% \begin{macrocode} +\def\Gin@PS@raw#1{\special{ps:: #1}} +\def\Gin@PS@restored#1{\special{" #1}} +% \end{macrocode} +% +% \subsection{Default Extensions} +% +% \begin{macrocode} +\def\Gin@extensions{.eps,.ps,.wmf,.bmp} +\@namedef{Gin@rule@.ps}#1{{eps}{.ps}{#1}} +\@namedef{Gin@rule@.eps}#1{{eps}{.eps}{#1}} +\@namedef{Gin@rule@.bmp}#1{{bmp}{}{#1}} +\@namedef{Gin@rule@.wmf}#1{{wmf}{}{#1}} +% \end{macrocode} +% +% \begin{macrocode} +%</pctex32> +% \end{macrocode} +% +% \section{pctexwin} +% A \LaTeXe\ graphics driver file for Personal TeX's PC TeX for Windows; +% from information supplied by Lance Carnes and Tao Wang +% |<pti@crl.com>|. +% \begin{macrocode} +%<*pctexwin> +% \end{macrocode} +% +% \subsection{Graphic file inclusion} +% +% \begin{macrocode} +\def\Ginclude@eps#1{% +\message{<#1>}% + \ifGin@clip + \typeout{no clipping support in pctexwin}% + \fi + \Gin@req@width.03515\Gin@req@width + \Gin@req@height.03515\Gin@req@height + \special{eps:#1\space x=\strip@pt\Gin@req@width cm, + y=\strip@pt\Gin@req@height cm}} +% \end{macrocode} +% +% \begin{macrocode} +\def\Ginclude@ps#1{% +\message{<#1>}% + \ifGin@clip + \typeout{no clipping support in pctexwin}% + \fi + \hbox{\kern-\Gin@llx bp\raise-\Gin@lly bp\hbox{\special{ps:#1}}}% + \typeout{^^J% +---------------------------------------------------------^^J% +.ps graphics without bounding box information cannot be^^J% +scaled. If the file actually contains the information,^^J% +please rename the file to .eps file extension.^^J% +---------------------------------------------------------^^J% +}} +% \end{macrocode} +% +% \begin{macrocode} +\def\Ginclude@bmp#1{% +\message{<#1>}% + \ifGin@clip + \typeout{no clipping support in pctexwin}% + \fi + \Gin@req@width.03515\Gin@req@width + \Gin@req@height.03515\Gin@req@height + \special{bmp:#1\space x=\strip@pt\Gin@req@width cm, + y=\strip@pt\Gin@req@height cm}} +% \end{macrocode} +% +% \begin{macrocode} +\def\Ginclude@wmf#1{% +\message{<#1>}% + \ifGin@clip + \typeout{no clipping support in pctexwin}% + \fi + \Gin@req@width.03515\Gin@req@width + \Gin@req@height.03515\Gin@req@height + \special{wmf:#1\space x=\strip@pt\Gin@req@width cm, + y=\strip@pt\Gin@req@height cm}} +% \end{macrocode} +% +% \begin{macrocode} +\def\Gin@extensions{.eps,.ps,.wmf,.bmp} +\@namedef{Gin@rule@.bmp}#1{{bmp}{}{#1}} +\@namedef{Gin@rule@.wmf}#1{{wmf}{}{#1}} +\@namedef{Gin@rule@.ps}#1{{ps}{.ps}{#1}} +\@namedef{Gin@rule@.eps}#1{{eps}{.eps}{#1}} +% \end{macrocode} +% +% \begin{macrocode} +%</pctexwin> +% \end{macrocode} +% +% \section{pctexhp} +% A \LaTeXe\ graphics driver file for Personal TeX's PTI Laser/HP; +% from information supplied by Lance Carnes and Tao Wang +% |<pti@crl.com>|. +% \begin{macrocode} +%<*pctexhp> +% \end{macrocode} +% \subsection{Graphic file inclusion} +% \begin{macrocode} +\def\Ginclude@pcl#1{% +\message{<#1>}% + \ifGin@clip + \typeout{no clipping support in pctexhp}% + \fi + \hbox{\kern-\Gin@llx bp\raise-\Gin@lly bp\hbox{\special{pcl:#1}}}% + \typeout{WARNING: pctexhp does not permit graphics to be scaled}} +\@namedef{Gin@rule@.pcl}#1{{pcl}{}{#1}} +\def\Gin@extensions{.pcl} +%</pctexhp> +% \end{macrocode} +% +% \section{pubps} +% A \LaTeXe\ graphics driver file for Arbortext's PUBps; +% information from Peter R Wilson |pwilson@rdrc.rpi.edu|. +% \begin{macrocode} +%<*pubps> +% \end{macrocode} +% \subsection{Rotation} +% \begin{macrocode} +\def\Grot@start{\special{ps: gsave currentpoint + currentpoint translate \Grot@angle\space + rotate neg exch neg exch translate}} +\def\Grot@end{\special{ps: currentpoint grestore moveto}} +%</pubps> +% \end{macrocode} +% +% \section{dviwin} +% A \LaTeXe\ graphics driver file for Hippocrates Sendoukas' dviwin +% \begin{macrocode} +%<*dviwin> +% \end{macrocode} +% \subsection{Graphic file inclusion} +% Dviwin sorts out the graphics type itself based on extension. +% They all use the same |\special|, so as far as graphics.sty is +% concerned they are all the same `type'. Use `bmp' for the type +% as that is as good a name as any. Make this the default. +% \begin{macrocode} +\@namedef{Gin@rule@*}#1{{bmp}{}{#1}} +\def\Ginclude@bmp#1{% + \raise\Gin@req@height\hbox{% + \special{anisoscale #1, + \the\Gin@req@width\space \the\Gin@req@height}}} +% \end{macrocode} +% The only exception is EPS files, as they may be read for BoundingBox +% \begin{macrocode} +\@namedef{Gin@rule@.ps}#1{{eps}{.ps}{#1}} +\@namedef{Gin@rule@.eps}#1{{eps}{.eps}{#1}} +\let\Ginclude@eps\Ginclude@bmp +% \end{macrocode} +% Add a few default extensions so |\includegraphics{a}| +% will pick up |a.eps| or |a.wmf|. +% This list can be reset with |\DeclareGraphicsExtensions|. +% Other extensions not in the list may be used explicitly, eg +% |\includegraphics{a.gif}| should work as long as dviwin has access +% to a gif filter. If |.gif| is added using |\DeclareGraphicsExtensions| +% then |\includegraphics{a}| would also find |a.gif|. +% \begin{macrocode} +\def\Gin@extensions{.eps,.ps,.wmf,.tif} +% \end{macrocode} +% +% \begin{macrocode} +%</dviwin> +% \end{macrocode} +% +% \section{ln} +% A \LaTeXe\ graphics driver file for B Hamilton Kelly's ln03 driver. +% Untested, but based on the graphics macros distributed with the +% driver. +% \begin{macrocode} +%<*ln> +% \end{macrocode} +% \subsection{Graphic file inclusion} +% \begin{macrocode} +\def\Ginclude@sixel#1{\special{ln03:sixel #1}} +%</ln> +% \end{macrocode} +% +% \section{trutex} +% A \LaTeXe\ graphics driver file for Kinch `truetex' driver. +% \begin{macrocode} +%<*truetex> +% \end{macrocode} +% +% \subsection{Colour} +% Uses the `color4' colour code. +% +% \subsection{Graphic file inclusion} +% +% EPS File inclusion: DVIPS style. +% \begin{macrocode} +\def\Ginclude@eps#1{% + \message{<#1>}% + \bgroup + \def\@tempa{!}% + \dimen@\Gin@req@width + \dimen@ii.1bp% + \divide\dimen@\dimen@ii + \@tempdima\Gin@req@height + \divide\@tempdima\dimen@ii + \special{PSfile="#1"\space + llx=\Gin@llx\space + lly=\Gin@lly\space + urx=\Gin@urx\space + ury=\Gin@ury\space + \ifx\Gin@scalex\@tempa\else rwi=\number\dimen@\space\fi + \ifx\Gin@scaley\@tempa\else rhi=\number\@tempdima\space\fi + \ifGin@clip clip\fi}% + \egroup} +% \end{macrocode} +% +% bmp File Inclusion. +% \begin{macrocode} +\def\Ginclude@bmp#1{% + \message{<#1>}% + \special{bmpfile #1}} +% \end{macrocode} +% +% tif(f) File inclusion +% \begin{macrocode} +\def\Ginclude@tiff#1{% + \message{<#1>}% + \special{tifffile #1}} +% \end{macrocode} +% +% \subsection{Literal PostScript} +% This is not supported, so uses `nops' code. +% +% \subsection{Default Rules} +% Support (e)ps, tif and bmp, default to eps. +% \begin{macrocode} +\def\Gin@extensions{.eps,.ps} +\@namedef{Gin@rule@.ps}#1{{eps}{.ps}{#1}} +\@namedef{Gin@rule@.eps}#1{{eps}{.eps}{#1}} +\@namedef{Gin@rule@.tif}#1{{tiff}{}{#1}} +\@namedef{Gin@rule@.bmp}#1{{bmp}{}{#1}} +% \end{macrocode} +% +% \begin{macrocode} +\@namedef{Gin@rule@*}#1{{eps}{\Gin@ext}{#1}} +% \end{macrocode} +% +% \begin{macrocode} +%</truetex> +% \end{macrocode} +% +% \section{tcidvi} +% A \LaTeXe\ graphics driver file for Scientific Word/Workplace. +% Actually for the Kinch truetex driver, augmented with extra +% |\special| handling with the DLL supplied with SW. +% \begin{macrocode} +%<*tcidvi> +% \end{macrocode} +% +% \subsection{Colour} +% Uses the `color4' colour code. +% +% The above colours are handled by the Kinch-supplied dll +% The TCI dll adds support for |\colorbox|, but only grey scale +% The code below accepts any color model, but only the red +% component is used. +% \begin{macrocode} +\AtBeginDocument{\def\color@block#1#2#3{% + {\rlap{\ifcolors@ + \@defaultunits\count@\current@color\@nnil + \dimen@\count@\p@ + \divide\dimen@\@cclv + \dimen@ii#2% + \advance\dimen@ii#3% + \lower#3\hbox{% + \special{language "Scientific Word";% + type "greybox";% + greyscale \strip@pt\dimen@;% + height \the\dimen@ii;% + width \the#1;% + depth 0pt;}}% + \fi}}}} +% \end{macrocode} +% +% \subsection{Graphic file inclusion} +% +% EPS File inclusion. +% \begin{macrocode} +\def\Ginclude@eps#1{% + \message{<#1>}% + \raise\Gin@req@height\hbox{% +% \end{macrocode} +% +% If the bounding box has been changed by a trim or viewport +% key then need to calculate the crop ratios based on the original +% bb coordinates. (This assumes that clip key is also used). +% \begin{macrocode} + \ifx\Gin@ollx\@undefined + \else + \@tempdimb \Gin@ourx bp% + \advance\@tempdimb-\Gin@ollx bp% + \@tempdima\Gin@llx bp% + \advance\@tempdima-\Gin@ollx bp% + \Gscale@div\TCI@cropleft\@tempdima\@tempdimb + \@tempdima\Gin@urx bp% + \advance\@tempdima-\Gin@ollx bp% + \Gscale@div\TCI@cropright\@tempdima\@tempdimb + \@tempdimb \Gin@oury bp% + \advance\@tempdimb-\Gin@olly bp% + \@tempdima\Gin@lly bp% + \advance\@tempdima-\Gin@olly bp% + \Gscale@div\TCI@cropbottom\@tempdima\@tempdimb + \@tempdima\Gin@ury bp% + \advance\@tempdima-\Gin@olly bp% + \Gscale@div\TCI@croptop\@tempdima\@tempdimb + \fi +% \end{macrocode} +% +% \begin{macrocode} + \special{% + language \TCI@language;% + type \TCI@type;% + valid_file \TCI@validfile;% + width \the\Gin@req@width;% + height \the\Gin@req@height;% + depth 0pt;% + original-width \the\Gin@nat@width;% + original-height \the\Gin@nat@height;% + cropleft "\TCI@cropleft";% + croptop "\TCI@croptop";% + cropright "\TCI@cropright";% + cropbottom "\TCI@cropbottom";% + filename '#1';% + \ifx\TCI@temp\@empty\else tempfilename \TCI@temp;\fi + }}} +% \end{macrocode} +% +% Default values so documents produced elsewhere should work +% \begin{macrocode} +\def\TCI@language{"Scientific Word"} +\def\TCI@type{"GRAPHIC"} +\def\TCI@validfile{'F'} +\def\TCI@cropleft{0} +\def\TCI@croptop{1} +\def\TCI@cropright{1} +\def\TCI@cropbottom{0} +\let\TCI@temp\@empty +% \end{macrocode} +% +% Non PS Graphic files. +% +% File inclusion macro is always the same. Use a different name though +% as LaTeX thinks it can read eps files for BoundingBox. +% \begin{macrocode} +\let\Ginclude@bmp\Ginclude@eps +% \end{macrocode} +% +% \subsection{Literal PostScript} +% This is not supported, so uses `nops' code. +% +% \subsection{Default Rules} +% SW always gives the full name with extension. +% So leave this list empty. +% \begin{macrocode} +\def\Gin@extensions{} +% \end{macrocode} +% +% .ps .PS .eps .EPS are (E)PS +% rest are `bmp' which is a catch all type for anything +% that the inport filter can handle. +% \begin{macrocode} +\@namedef{Gin@rule@.ps}#1{{eps}{.ps}{#1}} +\@namedef{Gin@rule@.eps}#1{{eps}{.eps}{#1}} +\@namedef{Gin@rule@.PS}#1{{eps}{.PS}{#1}} +\@namedef{Gin@rule@.EPS}#1{{eps}{.EPS}{#1}} +% \end{macrocode} +% +% \begin{macrocode} +\@namedef{Gin@rule@*}#1{{bmp}{\Gin@ext}{#1}} +% \end{macrocode} +% +% \begin{macrocode} +%</tcidvi> +% \end{macrocode} +% +% \section{Literal Postscript} +% Most drivers writing to PostScript allow some form of `literal' +% PostScript |\special| that inserts code into the final PostScript +% output. However Non-PS drivers can not support this (and some PS +% one's can't either). The code here makes all these commands no ops. +% Individual driver sections may define the commands to do something +% useful. +% +% \begin{macrocode} +%<*nops> +% \end{macrocode} +% +% Raw PostScript code, no save/restore. Coordinate system unspecified. +% \begin{macrocode} +\def\Gin@PS@raw#1{} +% \end{macrocode} +% +% PostScript code, to be surrounded by save/restore by the driver. +% Coordinate system standard PostScript, but with origin +% at current (\TeX) position. +% \begin{macrocode} +\def\Gin@PS@restored#1{} +% \end{macrocode} +% +% PostScript code to be inserted in the Header section of the final +% PostScript. Must be issued on the first page of a document. +% \begin{macrocode} +\def\Gin@PS@literal@header#1{} +% \end{macrocode} +% +% Name of external file, the contents of which are to be inserted in +% the Header section of the final PostScript. Must be issued on the +% first page of a document. +% \begin{macrocode} +\def\Gin@PS@file@header#1{} +% \end{macrocode} +% +% \begin{macrocode} +%</nops> +% \end{macrocode} +% +% \section{Graphics Inclusion Rules} +% \begin{macrocode} +%<*psrules> +% \end{macrocode} +% +% \begin{macrocode} +\def\Gin@extensions{.eps,.ps} +% \end{macrocode} +% +% \begin{macrocode} +\@namedef{Gin@rule@.ps}#1{{eps}{.ps}{#1}} +\@namedef{Gin@rule@.eps}#1{{eps}{.eps}{#1}} +% \end{macrocode} +% +% \begin{macrocode} +\@namedef{Gin@rule@*}#1{{eps}{\Gin@ext}{#1}} +% \end{macrocode} +% +% \begin{macrocode} +%</psrules> +%<*psrulesZ> +% \end{macrocode} +% +% \begin{macrocode} +\def\Gin@extensions{.eps,.ps,.eps.gz,.ps.gz,.eps.Z} +% \end{macrocode} +% +% \begin{macrocode} +\@namedef{Gin@rule@.ps}#1{{eps}{.ps}{#1}} +\@namedef{Gin@rule@.eps}#1{{eps}{.eps}{#1}} +\@namedef{Gin@rule@.pz}#1{{eps}{.bb}{`gunzip -c #1}} +\@namedef{Gin@rule@.eps.Z}#1{{eps}{.eps.bb}{`gunzip -c #1}} +\@namedef{Gin@rule@.ps.Z}#1{{eps}{.ps.bb}{`gunzip -c #1}} +\@namedef{Gin@rule@.ps.gz}#1{{eps}{.ps.bb}{`gunzip -c #1}} +\@namedef{Gin@rule@.eps.gz}#1{{eps}{.eps.bb}{`gunzip -c #1}} +% \end{macrocode} +% +% \begin{macrocode} +\@namedef{Gin@rule@*}#1{{eps}{\Gin@ext}{#1}} +% \end{macrocode} +% +% \begin{macrocode} +%</psrulesZ> +%<*dosrules> +% \end{macrocode} +% +% \begin{macrocode} +%<!psrulesZ>\def\Gin@extensions{.eps,.ps,.pcx,.bmp} +% \end{macrocode} +% +% \begin{macrocode} +\@namedef{Gin@rule@.pcx}#1{{bmp}{}{#1}} +\@namedef{Gin@rule@.bmp}#1{{bmp}{}{#1}} +\@namedef{Gin@rule@.msp}#1{{bmp}{}{#1}} +% \end{macrocode} +% +% \begin{macrocode} +%</dosrules> +%<*macrules> +%\def\Gin@extensions{{},.ps,.eps,.pict} +%\@namedef{Gin@rule@.ps}#1{{eps}{.ps}{#1}} +%\@namedef{Gin@rule@.eps}#1{{eps}{.eps}{#1}} +\@namedef{Gin@rule@.pict}#1{{pict}{}{#1}} +\@namedef{Gin@rule@.pntg}#1{{pntg}{}{#1}} +%\@namedef{Gin@rule@}#1{{pict}{\relax}{#1}} +%</macrules> +%<*tiffrules> +\@namedef{Gin@rule@.tif}#1{{tiff}{}{#1}} +%</tiffrules> +% \end{macrocode} +% +% \Finale +% diff --git a/Master/texmf-dist/source/latex/graphics/epsfig.dtx b/Master/texmf-dist/source/latex/graphics/epsfig.dtx new file mode 100644 index 00000000000..abd37b593d8 --- /dev/null +++ b/Master/texmf-dist/source/latex/graphics/epsfig.dtx @@ -0,0 +1,141 @@ +% +% \iffalse +% +%% epsfig.dtx Copyright (C) 1994-1996 1999 Sebastian Rahtz +%% +%% This file is part of the Standard LaTeX `Graphics Bundle'. +%% It may be distributed under the terms of the LaTeX Project Public +%% License, as described in lppl.txt in the base LaTeX distribution. +%% Either version 1.0 or, at your option, any later version. +%% +%<*dtx> + \ProvidesFile{epsfig.dtx} +%</dtx> +%<package>\NeedsTeXFormat{LaTeX2e}[1994/06/01] +%<package>\ProvidesPackage{epsfig} +%<driver> \ProvidesFile{epsfig.drv} +% \fi +% \ProvidesFile{epsfig.dtx} + [1999/02/16 v1.7a (e)psfig emulation (SPQR)] +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\begin{document} + \DocInput{epsfig.dtx} +\end{document} +%</driver> +% \fi +% +% \GetFileInfo{epsfig.dtx} +% +% \title{The \textsf{epsfig} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{Sebastian Rahtz\\spqr@ftp.tex.ac.uk} +% \date{\filedate} +% \maketitle +% +% \CheckSum{176} +% +% \StopEventually{} +% +% \section{Preface} +% \begin{macrocode} +%<*package> +\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{graphicx}} +\ProcessOptions +\RequirePackage{graphicx} +% \end{macrocode} +% \subsection{Emulation of `psfig' syntax} +% Emulate "epsfig.sty", and most varieties of psfig +% \begin{macro}{\psfig,\epsfig} +% \begin{macrocode} +\def\psfig#1{% + \let\Gin@ewidth\Gin@exclamation\let\Gin@eheight\Gin@ewidth + \def\Gin@req@sizes{% + \def\Gin@scalex{1}\let\Gin@scaley\Gin@exclamation + \Gin@req@height\Gin@nat@height + \Gin@req@width\Gin@nat@width}% + \begingroup + \let\Gfigname\relax + \@tempswafalse + \toks@{\Ginclude@graphics{\Gfigname}}% + \setkeys{Gin}{#1}% + \Gin@esetsize + \ifx\Gfigname\relax\ErrorNoFile\else + \the\toks@ + \fi + \endgroup} +\define@key{Gin}{figure}{\def\Gfigname{#1}} +\define@key{Gin}{file}{\def\Gfigname{#1}} +\define@key{Gin}{prolog}{\typeout{epsfig: header files are not needed}} +\define@key{Gin}{silent}[]{} +\def\psdraft{\Gin@drafttrue} +\def\psfull{\Gin@draftfalse} +\def\pssilent{\typeout{epsfig option `silent' ignored}} +\def\psnoisy{\typeout{epsfig option `noisy' ignored}} +\let\epsfig\psfig +\def\psfigdriver#1{\makeatletter\input{#1.def}\makeatother} +% \end{macrocode} +% \end{macro} +% \subsection{Emulation of `epsf' syntax} +% Emulate Rokicki's "epsf.tex" supplied with the ever-popular dvips. +% \begin{macro}{\epsfbox,\epsffile} +% \begin{macrocode} +\newdimen\epsfxsize +\newdimen\epsfysize +\epsfysize\z@ +\epsfxsize\z@ +\def\epsfsize#1#2{\epsfxsize} +\def\epsfbox{% + \@ifnextchar[% + {\Gin@bboxtrue\epsf@bb@box}% + {\Gin@bboxfalse\epsf@box}% +} +\def\epsf@bb@box[#1#2]{% + \expandafter\Gread@parse@bb#1#2 \\ + \epsf@box} +\def\epsf@box#1{% + \bgroup + \def\Gin@req@sizes{% + \epsfxsize\epsfsize{\Gin@nat@width}{\Gin@nat@height}% + \ifdim\epsfxsize=\z@ + \ifdim\epsfysize=\z@ + \Gin@req@height\Gin@nat@height + \Gin@req@width\Gin@nat@width + \else + \let\Gin@scalex\Gin@exclamation + \Gin@req@height\epsfysize + \Gscale@div\Gin@scaley\Gin@req@height\Gin@nat@height + \Gin@req@width\Gin@scaley\Gin@nat@width + \fi + \else + \Gin@req@width\epsfxsize + \Gscale@div\Gin@scalex\Gin@req@width\Gin@nat@width + \ifdim\epsfysize=\z@ + \let\Gin@scaley\Gin@exclamation + \Gin@req@height\Gin@scalex\Gin@nat@height + \else + \Gin@req@height\epsfysize + \Gscale@div\Gin@scaley\Gin@req@height\Gin@nat@height + \fi + \fi + }% + \Ginclude@graphics{#1}% + \egroup + \epsfysize\z@ + \epsfxsize\z@ +} +\let\epsffile\epsfbox +\def\epsfclipon{\Gin@cliptrue} +\def\epsfclipoff{\Gin@clipfalse} +\def\epsfverbosetrue{\typeout{epsf verbose option ignored}} +\def\epsfverbosefalse{\typeout{epsf verbose option ignored}} +%</package> +% \end{macrocode} +% \end{macro} +% +% \Finale +% + diff --git a/Master/texmf-dist/source/latex/graphics/graphics.dtx b/Master/texmf-dist/source/latex/graphics/graphics.dtx new file mode 100644 index 00000000000..91c16e9141a --- /dev/null +++ b/Master/texmf-dist/source/latex/graphics/graphics.dtx @@ -0,0 +1,1782 @@ +% +% \iffalse +% +%% graphics.dtx Copyright (C) 1994 David Carlisle Sebastian Rahtz +%% Copyright (C) 1995--1999 2001 David Carlisle +%% +%% This file is part of the Standard LaTeX `Graphics Bundle'. +%% It may be distributed under the terms of the LaTeX Project Public +%% License, as described in lppl.txt in the base LaTeX distribution. +%% Either version 1.0 or, at your option, any later version. +%% +%<*dtx> + \ProvidesFile{graphics.dtx} +%</dtx> +%<package>\NeedsTeXFormat{LaTeX2e}[1995/12/01] +%<package>\ProvidesPackage{graphics} +%<driver> \ProvidesFile{graphics.drv} +% \fi +% \ProvidesFile{graphics.dtx} + [2001/07/07 v1.0n Standard LaTeX Graphics (DPC,SPQR)] +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\newenvironment{option}[1]{\expandafter\macro\expandafter{% + \csname ds@#1\endcsname}}{\endmacro} +\begin{document} + \DocInput{graphics.dtx} +\end{document} +%</driver> +% \fi +% +% \GetFileInfo{graphics.dtx} +% +% \title{The \textsf{graphics} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{D. P. Carlisle\and S. P. Q. Rahtz} +% \date{\filedate} +% \maketitle +% +% \CheckSum{1158} +% +% \changes{v0.3a}{1994/02/24} +% {First DPC version (after prototype by SPQR).} +% \changes{v0.4e}{1994/05/30} +% {Rename egraphics to graphicx} +% \changes{v1.0}{1996/05/29} +% {Version 1 at last} +% +% +% \def\star{{\ttfamily*}} +% \makeatletter +% \def\Describe@Macro#1{\endgroup +% \setbox0=\lastbox\llap{\PrintDescribeMacro{#1}}}% +% \makeatother +% \marginparsep0pt +% +% \section{Introduction} +% +% This package implements various `graphics' functions. The main +% features are a) inclusion of `graphics' files. b) Rotation of sections +% of the page, c) Scaling of sections of the page. +% +% The design is split into three `levels'. +% \begin{itemize} +% \item The user interface. This is the collection of commands designed +% to appear in a document text. Actually two separate user interface +% have been implemented. The `standard' interface, described here, and a +% more powerful, and more `user-friendly' interface provided by the +% |graphicx| package. +% \item The core functions. These functions, which are also implemented +% in this file do all the `main work'. The `user-interface functions +% just collect together the information from any optional-arguments or +% star-forms, and then call one of these functions. +% \item The driver files. It is not possible to achieve the +% functionality of this package just using \TeX. The |dvi| driver used +% must be given additional instructions. (Using the |\special| command +% of \TeX.) Unfortunately, the capabilities of various drivers differ, +% and the syntax required to pass instructions to the drivers is also +% not standardised. So the `core functions' never access |\special| +% directly, but rather call a series of commands that must be defined in +% a special file customised for each driver. The accompanying file, +% |drivers.dtx| has suitable files for a range of popular drivers. +% \end{itemize} +% +% \section{Package Options} +% Most of the options, such as |dvips|, |textures| etc., specify the +% driver that is to be used to print the document. You may wish to set +% up a configuration file so that this option always takes effect, even +% if not specified in the document. To do this, produce a file +% |graphics.cfg| containing the line:\\ +% |\ExecuteOptions{dvips}|\\ +% (or whichever other driver you wish.) +% +% Apart from the driver options there are a few other options to control +% the behaviour of the package. +% \begin{description} +% \item[draft] +% Do not include graphics files, but instead print a box of the size +% the graphic would take up, and the file name. This greatly speeds up +% previewing on most systems. +% \item[final] +% Turns off the |draft| option. +% \item[debugshow] +% Show a lot of tracing information on the terminal. If you are not me +% you probably do not want to use this option. +% \item[hiderotate] +% Do not show rotated text. Sometimes useful if your previewer can not +% rotate text. +% \item[hidescale] +% Do not show scaled text. +% \item[hiresbb] +% Look for Bounding Box lines of the form |%%HiResBoundingBox| instead +% of the standard |%%BoundingBox|. These are used by some applications +% to get round the restriction that BoundingBox comments should only +% have integer values. +% \end{description} +% +% \section{Standard Interface} +% +% \subsection{Graphics Inclusion} +% +% \DescribeMacro +% \includegraphics\star\oarg{llx,lly}\oarg{urx,ury}\marg{file}\\ +% Include a graphics file. +% +% If \star\ is present, then the graphic is `clipped' to the size +% specified. If \star\ is omitted, then any part of the graphic that is +% outside the specified `bounding box' will over-print the surrounding +% text. +% +% If the optional arguments are omitted, then the size of the graphic +% will be determined by reading an external file as described below. +% If \oarg{urx,ury} is present, then it should specify the coordinates +% of the top right corner of the image, as a pair of \TeX\ dimensions. +% If the units are ommited they default to |bp|. So |[1in,1in]| and +% |[72,72]| are equivalent. If only one optional argument appears, the +% lower left corner of the image is assumed to be at |[0,0]|. Otherwise +% \oarg{llx,lly} may be used to specify the cordinates of this point. +% +% \DescribeMacro +% \graphicspath\marg{dir-list}\\ +% This optional declaration may be used to specify a list of directories +% in which to search for graphics files. The format is as for the +% \LaTeXe\ primitive |\input@path|, a list of directories, each in a +% |{}| group (even if there is only one in the list). For example: +% |\graphicspath{{eps/}{tiff/}}| +% would cause the system to look in the subdirectories |eps| and |tiff| +% of the current directory. The default setting of this path is +% |\input@path| that is: graphics files will be found wherever \TeX\ +% files are found. +% +% \DescribeMacro +% \DeclareGraphicsExtensions\marg{ext-list}\\ +% This specifies the behaviour of the system when the argument to +% |\includegraphics| does not have an extension specified. +% Here \marg{ext-list} should be a comma-separated list of file +% extensions, each with a leading period (\texttt{.}). +% A file name is produced by appending \emph{sep} and one extension. +% If a file is found, the system acts as if that extension had been +% specified. If not, the next extension in \emph{ext-list} is tried. +% \changes{v1.0m}{2001/06/07}{Extended documentation (CAR) graphics/3228} +% +% Each use of |\DeclareGraphicsExtensions| overwrites all previous +% definitions. It is not possible to add an extension to an +% existing list. +% +% Early versions of this package defined a default argument for this +% command. This has been removed. +% +% \DescribeMacro +% \DeclareGraphicsRule +% \marg{ext}\marg{type}\marg{read-file}\marg{command}\\ +% Any number of these declarations can be made. They determine how the +% system behaves when a file with extension \emph{ext} is specified. +% (The extension may be specified explicitly or, if the argument to +% |\includegraphics| does not have an extension, it may be a default +% extension from the \emph{ext-list} specified with +% |\DeclareGraphicsExtensions|.) +% +% \emph{ext} is the \emph{extension} of the file. Any file with this +% extension will be processed by this graphics rule. Normally a file +% with an extension for which no rule has been declared will generate an +% error, however you may use |*| as the extension to define a +% \emph{default rule}. For instance the |dvips| driver file declares all +% files to be of type |eps| unless a more specific rule is declared. +% +% Since Version v0.6, extensions should be specified including the |.| +% that is, |.eps| not |eps|. +% +% \emph{type} is the `type' of file involved. All files of the same type +% will be input with the same internal command (which must be defined in +% a `driver file'). For example files with extensions |ps|, |eps|, +% |ps.gz| may all be classed as type |eps|. +% +% \emph{read-file} determines the extension of the file that should be +% read to determine size information. It may be the same as \emph{ext} +% but it may be different, for example |.ps.gz| files are not readable +% easily by \TeX, so you may want to put the bounding box information in +% a separate file with extension |.ps.bb|. If \emph{read-file} is empty, +% |{}|, then the system will not try to locate an external file for size +% info, and the size must be specified in the arguments of +% |\includegraphics|. As a special case |*| may be used to denote the +% same extension as the graphic file. This is mainly of use in +% conjuction with using |*| as the extension, as in that case the +% particular graphic extension is not known. For example +%\begin{verbatim} +% \DeclareGraphicsRule{*}{eps}{*}{} +%\end{verbatim} +% This would declare a default rule, such that all unknown extensions +% would be treated as EPS files, and the graphic file would be read for +% a BoundingBox comment. +% +% If the driver file specifies a procedure for +% reading size files for \emph{type}, that will be used, otherwise the +% procedure for reading |eps| files will be used. Thus the size of +% bitmap files may be specified in a file with a PostScript style +% |%%BoundingBox| line, if no other specific format is available. +% +% \emph{command} is usually empty, but if non empty it is used in place +% of the filename in the |\special|. Within this argument, |#1| may be +% used to denote the filename. Thus using the dvips driver, one may +% use\\ +% |\DeclareGrahicsRule{.ps.gz}{eps}{.ps.bb}{`zcat #1}|\\ +% the final argument causes dvips to use the |zcat| command to unzip the +% file before inserting it into the PostScript output. +% +% \subsection{Rotation} +% +% \DescribeMacro +% \rotatebox\marg{angle}\marg{text}\\ +% Rotate \emph{text} \emph{angle} degrees anti-clockwise. Normally +% the rotation is about the left-hand end of the baseline of +% \emph{text}. +% +% \subsection{Scaling} +% +% \DescribeMacro +% \scalebox\marg{h-scale}\oarg{v-scale}\marg{text}\\ +% Scale \emph{text} by the specified amounts. If \emph{v-scale} is +% omitted, the vertical scale factor is the same as the horizontal one. +% +% \DescribeMacro +% \resizebox\star\marg{h-length}\marg{v-length}\marg{text}\\ +% Scale \emph{text} so that the width is \emph{h-length}. +% If |!| is used as either length argument, the other argument is used +% to determine a scale factor that is used in both directions. +% Normally \emph{v-length} refers to the height of the box, but in the +% star form, it refers to the `height + depth'. +% As normal for \LaTeXe\ box length arguments, |\height|, +% |\width|, |\totalheight| and |\depth| may be used to refer to the +% original size of the box. +% +% \section{The Key=Value Interface} +% As mentioned in the introduction, apart from the above `standard +% interface', there is an alternative syntax to the |\includegraphics| +% and |\rotatebox| commands that some people may prefer. It is provided +% by the accompanying |graphicx| package. +% +% \StopEventually{} +% +% \section{The Graphics Kernel Functions} +% +% \subsection{Graphics Inclusion} +% +% \DescribeMacro +% {\Ginclude@graphics}\marg{file}\\ +% Insert the contents of the file \emph{file} at the current point. +% |\Ginclude@graphics| may use the four macros |\Gin@llx|, |\Gin@lly|, +% |\Gin@urx|, |\Gin@ury| to determine the `bounding box' of the graphic. +% The result will be a \TeX\ box of width $\mathit{urx}-\mathit{llx}$ +% and height $\mathit{ury}-\mathit{lly}$. If |\Gin@clip| is \meta{true} +% then part of the graphic that is outside this box should not be +% displayed. (Not all drivers can support this `clipping'.) Normally all +% these parameters are set by the `user interface level'. +% +% +% \DescribeMacro +% {\Gread@eps}\marg{file}\\ +% For each \emph{type} of graphics file supported, the driver file must +% define |\Ginclude@|\emph{type} and, optionally |\Gread@|\emph{type}. +% The read command is responsible for obtaining size information from +% the file specified in the |\DeclareGraphicsRule| command. However the +% kernel defines a function, |\Gread@eps|, which can read PostScript +% files to find the +% |%%BoundingBox| comment. This function will be used for any type for +% which a specific function has not been declared. |\Gread@eps| accepts +% a generalised version of the bounding box comment. \TeX\ units may be +% used (but there must be no space before the unit). If the unit is +% omitted |bp| is assumed. So\\ +% |%%BoundingBox 0 0 2in 3in|\\ +% Would be accepted by this function, to produce a 2in wide, by 3in high +% graphic. +% +% \subsection{Rotation} +% +% \DescribeMacro +% {\Grot@box}\\ +% Rotate the contents of |\box0| through |\Grot@angle| degrees +% (anti-clockwise). The user-interface is responsible for setting the +% macro |\Grot@angle|, and putting the appropriate text in |\Grot@box|. +% +% \subsection{Scaling} +% +% \DescribeMacro +% {\Gscale@box}\marg{xscale}\oarg{yscale}\marg{text}\\ +% (The second argument is not optional.) +% Scale \emph{text} by the appropriate scale factors. +% +% \DescribeMacro +% {\Gscale@box@dd}\marg{dima}\marg{dimb}\marg{text}\\ +% Scale \emph{text} in both directions by a factor +% \emph{dima}/\emph{dimb}. +% +% \DescribeMacro +% {\Gscale@box@dddd} +% \marg{dima}\marg{dimb}\marg{dimc}\marg{dimd}\marg{text}\\ +% Scale \emph{text} in horizontally by a factor \emph{dima}/\emph{dimb}, +% and vertically by a factor of \emph{dimc}/\emph{dimd}. +% +% \DescribeMacro +% {\Gscale@div}\marg{cmd}\marg{dima}\marg{dimb}\\ +% Define the macro \emph{cmd} to be the ratio of the lengths +% \emph{dima}/\emph{dimb}. +% +% +% \section{Interface to the Driver Files} +% +% \subsection{Graphics Inclusion} +% +% Each driver file must declare that its driver can include graphics of +% certain \emph{types}. It does this by declaring for each type a +% command of the form:\\ +% |\Ginclude@|\emph{type}\\ +% The Graphics kernel function will call this driver-defined function +% with the filename as argument, and certain additional information will +% be provided as follows.: +% +% \noindent\begin{tabular}{p{.4\textwidth}p{.5\textwidth}} +% |\Gin@llx|, |\Gin@lly|,\newline +% |\Gin@urx|, |\Gin@ury| &Macros storing the `bounding box'\\ +% |\Gin@nat@width|\newline |\Gin@nat@height| & +% Registers storing the natural size.\\ +% |\Gin@req@width|\newline |\Gin@req@height| & +% Registers storing the required size, after scaling.\\ +% |\Gin@scalex|, |\Gin@scaley| & macros with the scale factors. A value +% of |!| means: Scale by the same amount as the other direction.\\ +% |\ifGin@clip| & |\newif| token, true if the graphic should be +% `clipped' to the bounding box. +% \end{tabular} +% +% Optionally the driver may define a command of the form:\\ +% |\Gread@|\emph{type}\\ +% This is responsible for reading an external file to find the bounding +% box information. If such a command is not declared, but a read-file is +% specified the command |\Gread@eps|, which is defined in the Graphics +% Kernel will be used. +% +% \subsection{Literal Postscript} +% Drivers that are producing PostScript output may want to define +% the following macros. They each take one argument which should be +% passed to an appropriate special. They are not used directly by this +% package but allow other packages to use the standard configuration +% file and package options to customise to various drivers:\\ +% |\Gin@PS@raw|, Literal PostScript special.\\ +% |\Gin@PS@restored|, Literal PostScript special, the driver will +% surround this with a save-restore pair.\\ +% |\Gin@PS@literal@header|, Postscript to be inserted in the header +% section of the PostScript file.\\ +% |\Gin@PS@file@header|, external file to be inserted in the header +% section of the PostScript file. +% +% +% \subsection{Rotation} +% +% |\Grot@start|, |\Grot@end| These macros must be defined to insert the +% appropriate |\special| to rotate the text between them by +% |\Grot@angle| degrees. The kernel function will make sure that the +% correct \TeX\ spacing is produced, these functions only need insert +% the |\special|. +% +% \subsection{Scaling} +% +% |\Gscale@start|, |\Gscale@end|, as for rotation, but here scale the +% text by |\Gscale@x| and |\Gscale@y|. +% +% +% \section{Implementation} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \subsection{Initialisation} +% +% \begin{macro}{\Gin@codes} +% First we save the catcodes of some characters, and set them to +% fixed values whilst this file is being read. +% \changes{v0.5a}{1994/07/20} +% {Save and restore catcodes} +% \begin{macrocode} +\edef\Gin@codes{% + \catcode`\noexpand\^^A\the\catcode`\^^A\relax + \catcode`\noexpand\"\the\catcode`\"\relax + \catcode`\noexpand\*\the\catcode`\*\relax + \catcode`\noexpand\!\the\catcode`\!\relax + \catcode`\noexpand\:\the\catcode`\:\relax} +% \end{macrocode} +% +% \begin{macrocode} +\catcode`\^^A=\catcode`\% +\@makeother\"% +\catcode`\*=11 +\@makeother\!% +\@makeother\:% +% \end{macrocode} +% \end{macro} +% +% We will need to have an implementation of the trigonometric +% functions for the rotation feature. May as well load it now. +% \begin{macrocode} +\RequirePackage{trig} +% \end{macrocode} +% +% \begin{macro}{\Grot@start} +% \begin{macro}{\Grot@end} +% Initialise the rotation primitives. +% \begin{macrocode} +\providecommand\Grot@start{\@latex@error{Rotation not supported}\@ehc + \global\let\Grot@start\relax} +\providecommand\Grot@end{} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\Gscale@start} +% \begin{macro}{\Gscale@end} +% Initialise the scaling primitives. +% \begin{macrocode} +\providecommand\Gscale@start{\@latex@error{Scaling not supported}\@ehc + \global\let\Gscale@start\relax} +\providecommand\Gscale@end{} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\Gread@BBox} +% \changes{v1.0b}{1996/10/29} +% {Moved to initial section, for hiresbb option} +% |%%BoundingBox| as a macro for testing with |\ifx|. +% This may be redefined by the hiresbb option. +% \begin{macrocode} +\edef\Gread@BBox{\@percentchar\@percentchar BoundingBox} +% \end{macrocode} +% \end{macro} +% +% \subsection{Options} +% +% \begin{option}{draft} +% \begin{option}{final} +% \changes{v0.3i}{1994/03/23} +% {notdraft option added} +% \changes{v0.4a}{1994/04/13} +% {Rename option to nodraft} +% \changes{v0.4d}{1994/05/06} +% {Rename option to final} +% \begin{macrocode} +\DeclareOption{draft}{\Gin@drafttrue} +\DeclareOption{final}{\Gin@draftfalse} +% \end{macrocode} +% \end{option} +% \end{option} +% +% \begin{macro}{\ifGin@draft} +% True in draft mode. +% \begin{macrocode} +\newif\ifGin@draft +% \end{macrocode} +% \end{macro} +% +% \begin{option}{hiresbb} +% \changes{v1.0b}{1996/10/29} +% {hiresbb option added} +% If given this option the package will look for bounding box comments +% of the form |%%HiResBoundingBox| (which typically have real values) +% instead of the standard |%%BoundingBox| (which should have integer +% values). +% \begin{macrocode} +\DeclareOption{hiresbb}{% + \edef\Gread@BBox{\@percentchar\@percentchar HiResBoundingBox}} +% \end{macrocode} +% \end{option} +% +% \begin{macro}{\Gin@driver} +% Driver in use. +% \begin{macrocode} +\providecommand\Gin@driver{} +% \end{macrocode} +% \end{macro} +% +% \begin{option}{dvips} +% \changes{v0.3g}{1994/03/15} +% {Use dvips def file not development version} +% \begin{option}{xdvi} +% Tomas Rockiki's PostScript driver (unix, MSDOS, VMS\ldots). +% The |X11| previewer |xdvi| supports basically the same set of +% |\specials|. +% \begin{macrocode} +\DeclareOption{dvips}{\def\Gin@driver{dvips.def}} +\DeclareOption{xdvi}{\ExecuteOptions{dvips}} +% \end{macrocode} +% \end{option} +% \end{option} +% +% \begin{option}{dvipdf} +% \changes{v1.0c}{1996/10/31} +% {dvipdf added} +% Sergey Lesenko's dvipdf driver. +% \begin{macrocode} +\DeclareOption{dvipdf}{\def\Gin@driver{dvipdf.def}} +% \end{macrocode} +% \end{option} +% +% \begin{option}{dvipdfm} +% \changes{v1.0k}{1999/01/13} +% {dvipdfm added} +% Mark Wick's dvipdfm driver. +% \begin{macrocode} +\DeclareOption{dvipdfm}{\def\Gin@driver{dvipdfm.def}} +% \end{macrocode} +% \end{option} +% +% \begin{option}{pdftex} +% \changes{v1.0d}{1997/06/07} +% {pdftex added} +% Han The Thanh's \TeX\ variant. +% \begin{macrocode} +\DeclareOption{pdftex}{\def\Gin@driver{pdftex.def}} +% \end{macrocode} +% \end{option} +% +% \begin{option}{dvipsone} +% \begin{option}{dviwindo} +% \changes{v0.3c}{1994/03/04} +% {dviwindo support.} +% \changes{v0.7c}{1995/09/07} +% {Merge dviwindo option with dvipsone} +% The drivers for the Y\&Y \TeX\ system. +% \begin{macrocode} +\DeclareOption{dvipsone}{\def\Gin@driver{dvipsone.def}} +\DeclareOption{dviwindo}{\ExecuteOptions{dvipsone}} +% \end{macrocode} +% \end{option} +% \end{option} +% +% \begin{option}{emtex} +% \begin{option}{dviwin} +% Two freely available sets of drivers for MSDOS, OS/2 and Windows. +% \begin{macrocode} +\DeclareOption{emtex}{\def\Gin@driver{emtex.def}} +\DeclareOption{dviwin}{\def\Gin@driver{dviwin.def}} +% \end{macrocode} +% \end{option} +% \end{option} +% +% \begin{option}{oztex} +% \changes{v1.0f}{1997/09/09} +% {Merge dvips and oztex options} +% Oz\TeX\ (Macintosh). +% Since release 3 of Oz\TeX, merge with dvips back end. +% \begin{macrocode} +\DeclareOption{oztex}{\ExecuteOptions{dvips}} +% \end{macrocode} +% \end{option} +% +% \begin{option}{textures} +% Textures (Macintosh). +% \begin{macrocode} +\DeclareOption{textures}{\def\Gin@driver{textures.def}} +% \end{macrocode} +% \end{option} +% +% \begin{option}{pctexps} +% \begin{option}{pctexwin} +% \begin{option}{pctexhp} +% \begin{option}{pctex32} +% \changes{v1.0b}{1996/10/29} +% {pctex32 option added} +% PC\TeX\ (MSDOS/Windows) . +% \begin{macrocode} +\DeclareOption{pctexps}{\def\Gin@driver{pctexps.def}} +\DeclareOption{pctexwin}{\def\Gin@driver{pctexwin.def}} +\DeclareOption{pctexhp}{\def\Gin@driver{pctexhp.def}} +\DeclareOption{pctex32}{\def\Gin@driver{pctex32.def}} +% \end{macrocode} +% \end{option} +% \end{option} +% \end{option} +% \end{option} +% +% \begin{option}{truetex} +% \changes{v1.0b}{1996/10/29} +% {truetex and tcidef options added} +% \begin{option}{tcidvi} +% Kinch TrueTeX, and its version with extended special support as +% shipped by Scientific Word. +% \begin{macrocode} +\DeclareOption{truetex}{\def\Gin@driver{truetex.def}} +\DeclareOption{tcidvi}{\def\Gin@driver{tcidvi.def}} +% \end{macrocode} +% \end{option} +% \end{option} +% +% \begin{option}{vtex} +% \changes{v1.0h}{1998/05/27} +% {vtex option added} +% V\TeX\ driver. +% \begin{macrocode} +\DeclareOption{vtex}{\def\Gin@driver{vtex.def}} +% \end{macrocode} +% \end{option} +% +% \begin{option}{dvi2ps} +% \begin{option}{dvialw} +% \begin{option}{dvilaser} +% \begin{option}{dvitops} +% \begin{option}{psprint} +% \begin{option}{pubps} +% \begin{option}{ln} +% \changes{v0.6b}{1994/12/12} +% {ln support (untested)} +% \changes{v1.0b}{1996/10/29} +% {options for historic drivers depreciated} +% If \emph{anyone} is using any of these driver options +% would they let me know. All these are essentially untried +% and untested as far as I know. +% \begin{macrocode} +%\DeclareOption{dvi2ps}{\def\Gin@driver{dvi2ps.def}} +%\DeclareOption{dvialw}{\def\Gin@driver{dvialw.def}} +%\DeclareOption{dvilaser}{\def\Gin@driver{dvilaser.def}} +%\DeclareOption{dvitops}{\def\Gin@driver{dvitops.def}} +%\DeclareOption{psprint}{\def\Gin@driver{psprint.def}} +%\DeclareOption{pubps}{\def\Gin@driver{pubps.def}} +%\DeclareOption{ln}{\def\Gin@driver{ln.def}} +% \end{macrocode} +% \end{option} +% \end{option} +% \end{option} +% \end{option} +% \end{option} +% \end{option} +% \end{option} +% +% \begin{option}{debugshow} +% You probably don't want to use this\ldots +% \begin{macrocode} +\DeclareOption{debugshow}{\catcode`\^^A=9 \let\GDebug\typeout} +% \end{macrocode} +% \end{option} +% +% A local configuration file may define more options. +% It should also make one driver option the default, by calling +% |\ExecuteOptions| with the appropriate option. +% \changes{v0.4f}{1994/07/27} +% {Add missing 3rd argument to \cs{InputIfFileExists}} +% \begin{macrocode} +\InputIfFileExists{graphics.cfg}{}{} +% \end{macrocode} +% +% \begin{option}{hiderotate} +% \changes{v0.4a}{1994/04/13} +% {Rename option to hiderotate} +% \begin{macrocode} +\DeclareOption{hiderotate}{% + \def\Grot@start{\begingroup\setbox\z@\hbox\bgroup} + \def\Grot@end{\egroup\endgroup}} +% \end{macrocode} +% \end{option} +% +% \begin{option}{hidescale} +% \changes{v0.4a}{1994/04/13} +% {Rename option to hidescale} +% \begin{macrocode} +\DeclareOption{hidescale}{% + \def\Gscale@start{\begingroup\setbox\z@\hbox\bgroup} + \def\Gscale@end{\egroup\endgroup}} +% \end{macrocode} +% \end{option} +% +% After the options are processed, load the appropriate driver file. +% If a site wants a default driver (eg |textures|) it just needs to put +% |\ExecuteOptions{textures}| in a |graphics.cfg| file. +% \begin{macrocode} +\ProcessOptions +% \end{macrocode} +% +% Check that a driver has been specified (either as an option, or as a +% default option in the configuration file). Then load the `def' file +% for that option, if it has not already been loaded by some other +% package (for instance the \textsf{color} package). +% \changes{v0.5c}{1994/10/03} +% {Error if no driver specified} +% \begin{macrocode} +\if!\Gin@driver! + \PackageError{graphics} + {No driver specified} + {You should make a default driver option in a file \MessageBreak + graphics.cfg\MessageBreak + eg: \protect\ExecuteOptions{textures}% + } +\else + \PackageInfo{graphics}{Driver file: \Gin@driver} + \@ifundefined{ver@\Gin@driver}{\input{\Gin@driver}}{} +\fi +% \end{macrocode} +% +% +% \subsection{Graphics Inclusion} +% +% This Graphics package uses a lot of dimension registers. \TeX\ only +% has a limited number of registers, so rather than allocate new ones, +% re-use some existing \LaTeX\ registers. This is safe as long as all +% uses of the registers are \emph{local}, and that you can be sure +% that you \emph{never} need to have access to both uses within the +% same scope. +% +% \begin{macro}{\Gin@llx} +% \begin{macro}{\Gin@lly} +% \begin{macro}{\Gin@urx} +% \begin{macro}{\Gin@ury} +% In fact these four lengths are now stored as macros not as dimen +% registers, mainly so that integer |bp| lengths may be passed exactly. +% \changes{v0.7a}{1995/04/11} +% {Bounding box coords no longer in registers} +% \begin{macrocode} +\def\Gin@llx{0} +\let\Gin@lly\Gin@llx +\let\Gin@urx\Gin@llx +\let\Gin@ury\Gin@llx +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\Gin@nat@width} +% \begin{macro}{\Gin@nat@height} +% The `natural' size of the graphic, before any scaling. +% \begin{macrocode} +\let\Gin@nat@width\leftmarginv +\let\Gin@nat@height\leftmarginvi +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\ifGin@clip} +% This switch is \meta{true} if any graphics outside the specified +% bounding box (really viewport) should not be printed. +% \begin{macrocode} +\newif\ifGin@clip +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DeclareGraphicsExtensions} +% \changes{v0.6a}{1994/11/29} +% {Remove optional argument, ignore spaces in main argument.} +% Declare a comma separated list of default extensions to be used +% if the file is specified with no extension. +% \begin{macrocode} +\newcommand\DeclareGraphicsExtensions[1]{% + \edef\Gin@extensions{\zap@space#1 \@empty}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gin@extensions} +% Initialise the list of possible extensions. +% \changes{v0.4b}{1994/04/20} +% {Use \cmd{\providecommand} in case a previous def file has +% already defined it} +% \begin{macrocode} +\providecommand\Gin@extensions{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\includegraphics} +% Top level command for the standard interface, just look for a |*|. +% \begin{macrocode} +\def\includegraphics{% + \@ifstar + {\Gin@cliptrue\Gin@i}% + {\Gin@clipfalse\Gin@i}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gin@i} +% If an optional argument is present, call |\Gin@ii| to process it, +% otherwise call |\Ginclude@graphics|. +% \changes{v0.3e}{1994/03/09} +% {Now specify ll before ur coordinate} +% \begin{macrocode} +\def\Gin@i{% + \@ifnextchar[%] + \Gin@ii + {\Gin@bboxfalse\Ginclude@graphics}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gin@ii} +% Look for a second optional argument. +% \begin{macrocode} +\def\Gin@ii[#1]{% + \@ifnextchar[%] + {\Gin@iii[#1]} + {\Gin@iii[0,0][#1]}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gin@iii} +% Set the cordinates of the {\bfseries l}lower {\bfseries l}eft corner, +% and the cordinates of the {\bfseries u}pper {\bfseries r}ight +% corner. The cordinates may be any \TeX\ dimension, defaulting to |bp|. +% \changes{v0.6c}{1994/12/15} +% {(Denis Roegel) Extra group to keep bb settings local} +% \begin{macrocode} +\def\Gin@iii[#1,#2][#3,#4]#5{% + \begingroup + \Gin@bboxtrue + \Gin@defaultbp\Gin@llx{#1}% + \Gin@defaultbp\Gin@lly{#2}% + \Gin@defaultbp\Gin@urx{#3}% + \Gin@defaultbp\Gin@ury{#4}% + \Ginclude@graphics{#5}% + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gin@defaultbp} +% \changes{v0.7a}{1995/04/11}{Macro added} +% \begin{macro}{\Gin@def@bp} +% \changes{v0.7a}{1995/04/11}{Macro added} +% This macro grabs a length, |#2|, which may or may not have a unit, +% and if a unit is supplied, converts to `bp' and stores the value in +% |#1|. If a unit is not supplied `bp' is assumed, and |#2| is directly +% stored in |#1|. Note that supplying `bp' is not quite the same as +% supplying no units, as in the former case a convertion via `pt' and +% back to `bp' takes place which can introduce rounding error. The error +% is invisibly small but files conforming to Adobe DSC should have +% \emph{integer} Bounding Box Coordinates, and conceivably some drivers +% might demand integer values. +% (Although most seem to accept real values (if they accept bounding box +% coordinates at all) in the |\special|. This is the reason why the +% mechanism uses |\def| and not \TeX\ lengths, as in earlier releases of +% the package. +% \begin{macrocode} +\def\Gin@defaultbp#1#2{% + \afterassignment\Gin@def@bp\dimen@#2bp\relax{#1}{#2}} +% \end{macrocode} +% +% \begin{macrocode} +\def\Gin@def@bp#1\relax#2#3{% + \if!#1!% + \def#2{#3}% + \else + \dimen@.99626\dimen@ + \edef#2{\strip@pt\dimen@}% + \fi} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\DeclareGraphicsRule} +% Declare what actions should be taken for a particular file +% extension. +% +% |#1| extension, |#2| type, |#3| read-file, |#4| command, +% \changes{v0.5d}{1994/10/24} +% {(Arthur Ogawa) Check arg3 is *, not arg2.} +% \begin{macrocode} +\def\DeclareGraphicsRule#1#2#3#4{% + \edef\@tempa{\string *}\def\@tempb{#3}% + \expandafter\edef\csname Gin@rule@#1\endcsname##1% + {{#2}% + {\ifx\@tempa\@tempb\noexpand\Gin@ext\else#3\fi}% + {\ifx\indent#4\indent##1\else#4\fi}}} +% \end{macrocode} +% \end{macro} +% +% An example rule base. +%\begin{verbatim} +% ext type read command +% \DeclareGrahicsRule{.ps} {eps} {.ps} {} +% \DeclareGrahicsRule{.eps} {eps} {.eps} {} +% \DeclareGrahicsRule{.ps.gz}{eps} {.ps.bb} {`zcat #1} +% \DeclareGrahicsRule{.pcx} {bmp} {} {} +%\end{verbatim} +% +% \begin{macro}{\graphicspath} +% User level command to set the input path for graphics files. +% A list of directories, each in a |{}| group. +% \begin{macrocode} +\def\graphicspath#1{\def\Ginput@path{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Ginput@path} +% The default graphic path is |\input@path|. +% \begin{macrocode} +\ifx\Ginput@path\@undefined + \let\Ginput@path\input@path +\fi +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gin@getbase} +% \changes{v0.6a}{1994/11/29} +% {remove \cs{Gin@sep}} +% Given a possible extension, |#1|, check whether the file exists. If +% it does set |\Gin@base| and |\Gin@ext| to the filename stripped of +% the extension, and the extension, respectively. +% \begin{macrocode} +\def\Gin@getbase#1{% + \edef\Gin@tempa{% + \def\noexpand\@tempa####1#1\space{% + \def\noexpand\Gin@base{####1}}}% + \IfFileExists{\filename@area\filename@base#1}% + {\Gin@tempa + \expandafter\@tempa\@filef@und + \edef\Gin@ext{#1}}{}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gin@ext} +% Initialise the macro to hold the extension. +% \begin{macrocode} +\let\Gin@ext\relax +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gin@sepdefault} +% \changes{v0.6a}{1994/11/29} +% {remove \cs{Gin@sep}} +% This must match the token used by |\filename@parse| to delimit the +% extension. +% \begin{macrocode} +\def\Gin@sepdefault{.} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Ginclude@graphics} +% The main internal function implementing graphics file inclusion. +% |#1| is the file name. +% \changes{v0.4c}{1994/04/28} +% {Improve the wording of error messages} +% \changes{v0.5a}{1994/07/20} +% {Add default (*) rule possibility} +% \changes{v0.6a}{1994/11/29} +% {remove \cs{Gin@sepdefault}} +% \begin{macrocode} +\def\Ginclude@graphics#1{% + \begingroup + \let\input@path\Ginput@path + \filename@parse{#1}% + \ifx\filename@ext\relax + \@for\Gin@temp:=\Gin@extensions\do{% + \ifx\Gin@ext\relax + \Gin@getbase\Gin@temp + \fi}% + \else + \Gin@getbase{\Gin@sepdefault\filename@ext}% +% \end{macrocode} +% \changes{v0.4d}{1994/05/06} +% {Make file not found a warning not an error} +% \changes{v0.6a}{1994/11/29} +% {remove \cs{Gin@sep}} +% If the user supplied an explicit extension, just give a warning if the +% file does not exist. (It may be created later.) +% \begin{macrocode} + \ifx\Gin@ext\relax + \@warning{File `#1' not found}% + \def\Gin@base{\filename@area\filename@base}% +% \end{macrocode} +% \changes{v0.6c}{1994/12/15} +% {(Piet van Oostrum) include `.' in \cs{Gin@ext}}% +% \begin{macrocode} + \edef\Gin@ext{\Gin@sepdefault\filename@ext}% + \fi + \fi +% \end{macrocode} +% If no extension is supplied, it is an error if the file does not +% exist, as there is no way for the system to know which extension to +% supply. +% \begin{macrocode} + \ifx\Gin@ext\relax + \@latex@error{File `#1' not found}% + {I could not locate the file with any of these extensions:^^J% + \Gin@extensions^^J\@ehc}% + \else + \@ifundefined{Gin@rule@\Gin@ext}% +% \end{macrocode} +% \changes{v0.5a}{1994/07/20} +% {Add default (*) rule possibility} +% Handle default rule. +% \begin{macrocode} + {\ifx\Gin@rule@*\@undefined + \@latex@error{Unknown graphics extension: \Gin@ext}\@ehc + \else + \expandafter\Gin@setfile\Gin@rule@*{\Gin@base\Gin@ext}% + \fi}% + {\expandafter\expandafter\expandafter\Gin@setfile + \csname Gin@rule@\Gin@ext\endcsname{\Gin@base\Gin@ext}}% + \fi + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ifGread@} +% True if a file should be read to obtain the natural size. +% \begin{macrocode} +\newif\ifGread@\Gread@true +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gin@setfile} +% Set a file to the size specified in arguments, or in a `read file'. +% \changes{v0.5d}{1994/10/24} +% {(Arthur Ogawa) Add missing \cs{expandafter}} +% \begin{macrocode} +\def\Gin@setfile#1#2#3{% + \ifx\\#2\\\Gread@false\fi + \ifGin@bbox\else + \ifGread@ + \csname Gread@% + \expandafter\ifx\csname Gread@#1\endcsname\relax + eps% + \else + #1% + \fi + \endcsname{\Gin@base#2}% + \else +% \end{macrocode} +% \changes{v0.5a}{1994/07/20} +% {New error trap for missing size arguments} +% \changes{v0.7f}{1995/11/10} +% {Use \cs{Gin@nosize}} +% By now the natural size should be known either from arguments or +% from the file. If not generate an error. (The \textsf{graphicx} +% interface relaxes this condition slightly.) +% \begin{macrocode} + \Gin@nosize{#3}% + \fi + \fi +% \end{macrocode} +% \changes{v0.7a}{1995/04/11}{\cs{Gin@viewport@code} added.} +% The following call will modify the `natural size' if the user has +% supplied a viewport or trim specification. (Not available in the +% standard interface.) +% \begin{macrocode} + \Gin@viewport@code +% \end{macrocode} +% Save the natural size, and then call |\Gin@req@sizes| whic (in the +% key-val interface) will calculate the required size from the natural +% size, and any scaling info. +% \begin{macrocode} + \Gin@nat@height\Gin@ury bp% + \advance\Gin@nat@height-\Gin@lly bp% + \Gin@nat@width\Gin@urx bp% + \advance\Gin@nat@width-\Gin@llx bp% + \Gin@req@sizes +% \end{macrocode} +% +% Call |\Ginclude@|\emph{type} to include the figure unless +% this is not defined, or draft mode is being used. +% \changes{v0.7h}{1996/02/20} +% {missing \texttt{@} added in \texttt{Gread@} csnames} +% \begin{macrocode} + \expandafter\ifx\csname Ginclude@#1\endcsname\relax + \Gin@drafttrue + \expandafter\ifx\csname Gread@#1\endcsname\relax + \@latex@error{Can not include graphics of type: #1}\@ehc + \global\expandafter\let\csname Gread@#1\endcsname\@empty + \fi + \fi + \leavevmode + \ifGin@draft + \hb@xt@\Gin@req@width{% + \vrule\hss + \vbox to \Gin@req@height{% + \hrule \@width \Gin@req@width + \vss + \edef\@tempa{#3}% + \rlap{ \ttfamily\expandafter\strip@prefix\meaning\@tempa}% + \vss + \hrule}% + \hss\vrule}% + \else +% \end{macrocode} +% \changes{v0.3i}{1994/3/23} +% {Add file list info} +% Support |\listfiles| and then set the final box to the required size. +% \begin{macrocode} + \@addtofilelist{#3}% + \ProvidesFile{#3}[Graphic file (type #1)]% + \setbox\z@\hbox{\csname Ginclude@#1\endcsname{#3}}% + \dp\z@\z@ + \ht\z@\Gin@req@height + \wd\z@\Gin@req@width + \box\z@ + \fi} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\Gin@exclamation} +% \changes{v0.7g}{1995/12/06}{Macro added} +% Catcode 12 |!|, in case of French, or other language styles. +% \begin{macrocode} +\def\Gin@exclamation{!} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gin@req@sizes} +% \begin{macro}{\Gin@scalex} +% \begin{macro}{\Gin@scaley} +% \begin{macro}{\Gin@req@height} +% \begin{macro}{\Gin@req@width} +% In the standard interface there is no scaling, so the required size +% is the same as the natural size. In other interfaces |\Gin@req@sizes| +% will be responsible for setting these parameters. Here we can set them +% globally. +% \changes{v0.3g}{1994/03/15} +% {Initialise y-scale to !!} +% \changes{v1.0g}{1998/05/14} +% {Fix !! usage in changes entries. graphics/2724} +% \begin{macrocode} +\let\Gin@req@sizes\relax +\def\Gin@scalex{1}% +\let\Gin@scaley\Gin@exclamation +\let\Gin@req@height\Gin@nat@height +\let\Gin@req@width\Gin@nat@width +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\Gin@viewport@code} +% In the standard interface there is no possibility of specifying +% a viewport, so this is a no-op. +% \changes{v0.7a}{1995/04/11}{Macro added} +% \begin{macrocode} +\let\Gin@viewport@code\relax +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gin@nosize} +% \changes{v0.7f}{1995/11/10} +% {Macro added} +% This command is called in the case that the graphics type +% specifies no `read file' and the user supplied no size arguments. +% In the standard interface can only generate an error. +% \begin{macrocode} +\def\Gin@nosize#1{% + \@latex@error + {Cannot determine size of graphic in #1 (no size specifed)}% + \@ehc} +% \end{macrocode} +% \end{macro} +% +% \subsection{Reading the BoundingBox in EPS files} +% +% \begin{macro}{\ifGin@bbox} +% \changes{v0.7a}{1995/04/11}{Name changed from \cs{ifGin@viewport}} +% This switch should be set \meta{true} once a size has been found, +% either in an argument, or in an external file. +% \begin{macrocode} +\newif\ifGin@bbox +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gread@eps} +% Read an EPS file (|#1|) and search for a line +% starting with |%%BoundingBox| and returns the result +% by setting four dimension registers +% |\Gin@llx|, |\Gin@lly|, |\Gin@urx| and |\Gin@ury|. +% \changes{v0.5e}{1994/1l/02} +% {Fix the catcodes of \cs{endlinechar} and ctrl-D} +% \changes{v0.7a}{1995/04/11} +% {Fix more catcodes, for binary headers of eps files} +% \begin{macrocode} +\def\Gread@eps#1{% + \begingroup +% \end{macrocode} +% Make it reasonably safe to have binary headers in the EPS file +% before the bounding box line. +% \begin{macrocode} + \@tempcnta\z@ + \loop\ifnum\@tempcnta<\@xxxii + \catcode\@tempcnta14 % + \advance\@tempcnta\@ne + \repeat + \catcode`\^^?14 % + \let\do\@makeother + \dospecials +% \end{macrocode} +% Make sure tab and space are accepted as white space. +% \changes{v1.0e}{1997/09/02} +% {Allow TAB in DSC comments graphics/2587} +% \changes{v1.0i}{1999/01/07} +% {Fix catcode of hyphen. graphics/2846} +% \begin{macrocode} + \catcode`\ 10 % + \catcode`\^^I10 % + \catcode\endlinechar5 % + \@makeother\:% + \@makeother\-% +% \end{macrocode} +% The first thing we need to do is to open the +% information file, if possible. +% \changes{v0.4d}{1994/05/06} +% {Improve the error message if the info file is not there.} +% \begin{macrocode} + \immediate\openin\@inputcheck#1 % + \ifeof\@inputcheck + \@latex@error{File `#1' not found}\@ehc + \else +% \end{macrocode} +% Now we'll scan lines until we find one that starts with +% |%%BoundingBox:| +% We need to reset the catcodes to read the file, and so this +% is done in a group. +% \begin{macrocode} + \Gread@true + \let\@tempb\Gread@false + \loop + \read\@inputcheck to\@tempa + \ifeof\@inputcheck + \Gread@false + \else + \expandafter\Gread@find@bb\@tempa:.\\% + \fi + \ifGread@ + \repeat + \immediate\closein\@inputcheck + \fi +% \end{macrocode} +% \changes{v0.3i}{1994/03/23} +% {Wording of error message improved} +% \changes{v1.0}{1996/05/29} +% {Use \cs{@gtempa} not \cs{g@tempa} /2090} +% \begin{macrocode} + \ifGin@bbox\else + \@latex@error + {Cannot determine size of graphic in #1 (no BoundingBox)}% + \@ehc + \gdef\@gtempa{0 0 72 72 }% + \fi + \endgroup + \expandafter\Gread@parse@bb\@gtempa\\} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gread@find@bb} +% If a line in the EPS file starts with a |%%BoundingBox:|, we +% will examine it more closely. Note using the `extra' argument |#2#3| +% causes any space after the |:| to be gobbled. +% \begin{macrocode} +\long\def\Gread@find@bb#1:#2#3\\{% + \def\@tempa{#1}% + \ifx\@tempa\Gread@BBox + \Gread@test@atend#2#3()\\% + \fi} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\Gread@test@atend} +% Determine if the stuff following the |%%BoundingBox| is `(atend)', +% which will involve further reading of the file. This is accomplished +% by making |\@tempb| into a no-op, so that finding a |%%BoundingBox| +% does not stop the loop. +% \begin{macrocode} +\def\Gread@test@atend#1(#2)#3\\{% + \def\@tempa{#2}% + \ifx\@tempa\Gread@atend + \Gread@true + \let\@tempb\relax + \else + \gdef\@gtempa{#1}% + \@tempb + \Gin@bboxtrue + \fi} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\Gread@parse@bb} +% We have |%%BoundingBox| and what follows is not `(atend)' so we +% will parse the rest of the line as a BB with four elements. +% PostScript files should never have units specified in the +% BoundingBox comment, but we allow arbitrary \TeX\ units in external +% files, or in other interfaces. +% \begin{macrocode} +\def\Gread@parse@bb#1 #2 #3 #4 #5\\{% + \Gin@defaultbp\Gin@llx{#1}% + \Gin@defaultbp\Gin@lly{#2}% + \Gin@defaultbp\Gin@urx{#3}% + \Gin@defaultbp\Gin@ury{#4}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gread@atend} +% |atend| as a macro for testing with |\ifx|. +% \begin{macrocode} +\def\Gread@atend{atend} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Rotation} +% +% As above, we will re-use some existing local registers. +% +% \begin{macro}{\Grot@height} +% \begin{macro}{\Grot@left} +% \begin{macro}{\Grot@right} +% \begin{macro}{\Grot@depth} +% Final Rotated box dimensions +% \begin{macrocode} +\let\Grot@height\@ovxx +\let\Grot@left\@ovyy +\let\Grot@right\@ovdx +\let\Grot@depth\@ovdy +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\Grot@h} +% \begin{macro}{\Grot@l} +% \begin{macro}{\Grot@r} +% \begin{macro}{\Grot@d} +% Original box dimensions +% \begin{macrocode} +\let\Grot@l\@ovro +\let\Grot@r\@ovri +\let\Grot@h\@xdim +\let\Grot@d\@ydim +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\Grot@x} +% \begin{macro}{\Grot@y} +% Coordinates of centre of rotation. +% \begin{macrocode} +\let\Grot@x\@linelen +\let\Grot@y\@dashdim +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\rotatebox} +% The angle is specified by |#1|. The box to be rotated is |#2|. +% In the standard interface the centre of rotation is $(0,0)$. +% Then finally call |\Grot@box| to rotate the box. +% \changes{v0.3f}{1994/03/11}{Remove star form} +% \changes{v0.3h}{1994/03/17}{Fix Typo} +% \changes{v0.7a}{1995/04/11}{\cs{leavevmode} added graphics/1521} +% \changes{v1.0n}{2001/07/07} +% {Made long (CAR) graphics/2908 and 3345} +% \begin{macrocode} +\long\def\rotatebox#1#2{% + \leavevmode + \Grot@setangle{#1}% + \setbox\z@\hbox{{#2}}% + \Grot@x\z@ + \Grot@y\z@ + \Grot@box} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\Grot@setangle} +% Set the internal macro used by |\Grot@box|. In the standard +% interface this is trivial, but other interfaces may have more +% interesting definitions. For example: +%\begin{verbatim} +% \def\Grot@setangle#1{% +% \dimen@#1\p@ +% \dimen@-57.2968\dimen@ +% \edef\Grot@angle{\strip@pt\dimen@}} +%\end{verbatim} +% This would cause the argument of |\rotatebox| to be interpreted as +% an angle specified in \emph{radians}, \emph{clockwise}. +% \begin{macrocode} +\def\Grot@setangle#1{\edef\Grot@angle{#1}} +% \end{macrocode} +% \end{macro} +% +% \subsection{Deriving a `bounding box' for rotated object} +% We want to know the size of a `bounding box' enclosing the rotated +% box. +% We define two formulae (as \TeX\ macros) to work out the $x$ and $y$ +% coordinates of vertices of the rotated box +% in relation to its original coordinates (ie its width, height +% and depth). The box we visualize with vertices $B$, $C$, +% $D$ and $E$ is illustrated below. The vertex +% $S$ is the reference point on the baseline. $O$ is the centre of +% rotation, which in the standard interface is always $S$. +% +% \begin{center} +% \setlength{\unitlength}{3pt}% +% +% \begin{picture}(34,36)(12,44) +% \thicklines +% \put(20,52){\dashbox{1}(20,21){}} +% \put(20,80){\line(0,-1){36}} +% \put(12,58){\line(1, 0){34}} +% \put(41,59){A} +% \put(40,74){B} +% \put(21,74){C} +% \put(21,49){D} +% \put(40,49){E} +% \put(21,59){S} +% \put(33,65){O} +% \put(33,65){\circle*{1}} +% \end{picture} +% \end{center} +% +% The formulae are, for a point $P$ and angle $\alpha$: +%\[ +% \begin{array}{l} +% P'_x = P_x - O_x \\ +% P'_y = P_y - O_y \\ +% P''_x = ( P'_x \times \cos(\alpha)) - ( P'_y \times \sin(\alpha) ) \\ +% P''_y = ( P'_x \times \sin(\alpha)) + ( P'_y \times \cos(\alpha) ) \\ +% P'''_x = P''_x + O_x + L_x \\ +% P'''_y = P''_y + O_y +% \end{array} +% \] +% The `extra' horizontal translation $L_x$ at the end is calculated so +% that the leftmost point of the resulting box has $x$-coordinate $0$. +% This is desirable as \TeX\ boxes must have the reference point at +% the left edge of the box. +% +% \begin{macro}{\Grot@Px} +% Work out new $x$ coordinate of point after rotation. The parameters +% |#2| and |#3| are the original $x$ and $y$ coordinates of the point. +% The new $x$ coordinate is stored in |#1|. +% \begin{macrocode} +\def\Grot@Px#1#2#3{% + #1\Grot@cos#2% + \advance#1-\Grot@sin#3} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\Grot@Py} +% Work out new $y$ coordinate of point after rotation. The parameters +% |#2| and |#3| are the original $x$ and $y$ coordinates of the point. +% The new $y$ coordinate is stored in |#1|. +% \begin{macrocode} +\def\Grot@Py#1#2#3{% + #1\Grot@sin#2% + \advance#1\Grot@cos#3} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Grot@box} +% This is the tricky bit. We can rotate the box, but then need +% to work out how much space to leave for it on the page. +% +% We simplify matters by working out first which quadrant we are in, and +% then picking just the right values. +% +% \begin{macrocode} +\def\Grot@box{% + \begingroup +% \end{macrocode} +% We are going to need to know the sine and cosine +% of the angle; simplest to calculate these now. +% \begin{macrocode} + \CalculateSin\Grot@angle + \CalculateCos\Grot@angle + \edef\Grot@sin{\UseSin\Grot@angle}% + \edef\Grot@cos{\UseCos\Grot@angle}% +^^A \GDebug{Rotate: angle \Grot@angle, sine is \Grot@sin, +^^A cosine is \Grot@cos}% +% \end{macrocode} +% Save the four extents of the original box. +% \begin{macrocode} + \Grot@r\wd\z@ \advance\Grot@r-\Grot@x + \Grot@l\z@ \advance\Grot@l-\Grot@x + \Grot@h\ht\z@ \advance\Grot@h-\Grot@y + \Grot@d-\dp\z@ \advance\Grot@d-\Grot@y +% \end{macrocode} +% Now a straightforward test to see which quadrant we are +% operating in; +% \begin{macrocode} + \ifdim\Grot@sin\p@>\z@ + \ifdim\Grot@cos\p@>\z@ +% \end{macrocode} +% First quadrant: +% Height=$By$, Right=$Ex$, Left=$Cx$, Depth=$Dy$ +% \begin{macrocode} + \Grot@Py\Grot@height \Grot@r\Grot@h%B + \Grot@Px\Grot@right \Grot@r\Grot@d%E + \Grot@Px\Grot@left \Grot@l\Grot@h%C + \Grot@Py\Grot@depth \Grot@l\Grot@d%D + \else +% \end{macrocode} +% Second quadrant: +% Height=$Ey$, Right=$Dx$, Left=$Bx$, Depth=$Cy$ +% \begin{macrocode} + \Grot@Py\Grot@height \Grot@r\Grot@d%E + \Grot@Px\Grot@right \Grot@l\Grot@d%D + \Grot@Px\Grot@left \Grot@r\Grot@h%B + \Grot@Py\Grot@depth \Grot@l\Grot@h%C + \fi + \else + \ifdim\Grot@cos\p@<\z@ +% \end{macrocode} +% Third quadrant: +% Height=$Dy$, Right=$Cx$, Left=$Ex$, Depth=$By$ +% \begin{macrocode} + \Grot@Py\Grot@height \Grot@l\Grot@d%D + \Grot@Px\Grot@right \Grot@l\Grot@h%C + \Grot@Px\Grot@left \Grot@r\Grot@d%E + \Grot@Py\Grot@depth \Grot@r\Grot@h%B + \else +% \end{macrocode} +% Fourth quadrant: +% Height=$Cy$, Right=$Bx$, Left=$Dx$, Depth=$Ey$ +% \begin{macrocode} + \Grot@Py\Grot@height \Grot@l\Grot@h%C + \Grot@Px\Grot@right \Grot@r\Grot@h%B + \Grot@Px\Grot@left \Grot@l\Grot@d%D + \Grot@Py\Grot@depth \Grot@r\Grot@d%E + \fi + \fi +% \end{macrocode} +% Now we should translate back by $(O_x,O_y)$, but \TeX\ can not really +% deal with boxes that do not have the reference point at the left edge. +% (Everything with a $-$ve $x$-coordinate would over-print earlier +% text). So we modify the horizontal translation so that the +% reference point as understood by \TeX\ \emph{is} at the left edge. +% This means that the `centre of rotation' is not fixed by |\rotatebox|, +% but typically moves horizontally. We also need to find the image of +% the original reference point, $S$, as that is where the rotation +% specials must be inserted. +% +% \begin{macrocode} + \advance\Grot@height\Grot@y + \advance\Grot@depth\Grot@y + \Grot@Px\dimen@ \Grot@x\Grot@y + \Grot@Py\dimen@ii \Grot@x\Grot@y + \dimen@-\dimen@ \advance\dimen@-\Grot@left + \dimen@ii-\dimen@ii \advance\dimen@ii\Grot@y +% \end{macrocode} +% +% \begin{macrocode} +^^A \GDebug{Rotate: (l,r,h,d)^^J% +^^A Original \the\Grot@l,\the\Grot@r,\the\Grot@h,\the\Grot@d,^^J% +^^A New..... \the\Grot@left,\the\Grot@right,% +^^A \the\Grot@height,\the\Grot@depth}% +% \end{macrocode} +% +% \begin{macrocode} + \setbox\z@\hbox{% + \kern\dimen@ + \raise\dimen@ii\hbox{\Grot@start\box\z@\Grot@end}}% + \ht\z@\Grot@height + \dp\z@-\Grot@depth + \advance\Grot@right-\Grot@left\wd\z@\Grot@right + \leavevmode\box\z@ + \endgroup} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Stretching and Scaling} +% +% +% \begin{macro}{\scalebox} +% The top level |\scalebox|. If the vertical scale factor is omitted it +% defaults to the horizontal scale factor, |#1|. +% \changes{v0.3d}{1994/03/06}{Better support for negative arguments.} +% \begin{macrocode} +\def\scalebox#1{% + \@ifnextchar[{\Gscale@box{#1}}{\Gscale@box{#1}[#1]}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gscale@box} +% Internal version of |\scalebox|. +% \changes{v0.7a}{1995/04/11} +% {\cs{leavevmode} moved earlier. graphics/1521} +% \changes{v1.0j}{1999/01/07} +% {made long. graphics/2908} +% \begin{macrocode} +\long\def\Gscale@box#1[#2]#3{% + \leavevmode + \def\Gscale@x{#1}\def\Gscale@y{#2}% + \setbox\z@\hbox{{#3}}% + \setbox\tw@\hbox{\Gscale@start\rlap{\copy\z@}\Gscale@end}% + \ifdim#2\p@<\z@ + \ht\tw@-#2\dp\z@ + \dp\tw@-#2\ht\z@ + \else + \ht\tw@#2\ht\z@ + \dp\tw@#2\dp\z@ + \fi + \ifdim#1\p@<\z@ + \hb@xt@-#1\wd\z@{\kern-#1\wd\z@\box\tw@\hss}% + \else + \wd\tw@#1\wd\z@ + \box\tw@ + \fi} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\reflectbox} +% Just an abbreviation for the appropriate scale to get reflection. +% \changes{v0.3e}{1994/03/09}{Macro added} +% \begin{macrocode} +\def\reflectbox{\Gscale@box-1[1]} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\resizebox} +% \changes{v0.3b}{1994/03/01}{Recode \cmd\resizebox.} +% \changes{v0.7b}{1995/04/27} +% {Add \cs{leavevmode} for graphics/1512} +% Look for a |*|, which specifies that a final vertical size refers to +% `height + depth' not just `height'. +% \begin{macrocode} +\def\resizebox{% + \leavevmode + \@ifstar{\Gscale@@box\totalheight}{\Gscale@@box\height}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gscale@@box} +% Look for the |!| in the arguments. +% \changes{v0.5a}{1994/07/20} +% {Support French active !!} +% \changes{v0.5d}{1994/10/24} +% {Correct the support for !!} +% \changes{v0.7g} +% {1995/12/06}{Use \cs{Gin@exclamation}} +% \begin{macrocode} +\def\Gscale@@box#1#2#3{% + \let\@tempa\Gin@exclamation + \expandafter\def\expandafter\@tempb\expandafter{\string#2}% + \expandafter\def\expandafter\@tempc\expandafter{\string#3}% + \ifx\@tempb\@tempa + \ifx\@tempc\@tempa + \toks@{\mbox}% + \else + \toks@{\Gscale@box@dd{#3}#1}% + \fi + \else + \ifx\@tempc\@tempa + \toks@{\Gscale@box@dd{#2}\width}% + \else + \toks@{\Gscale@box@dddd{#2}\width{#3}#1}% + \fi + \fi + \the\toks@} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gscale@box@dd} +% Scale the text |#3| in both directions by a factor $|#1|/|#2|$. +% \changes{v0.3i}{1994/03/23} +% {Missing percent added} +% \changes{v1.0i}{1999/01/07} +% {made long. graphics/2908} +% \begin{macrocode} +\long\def\Gscale@box@dd#1#2#3{% + \@begin@tempboxa\hbox{#3}% + \setlength\@tempdima{#1}% + \setlength\@tempdimb{#2}% + \Gscale@div\@tempa\@tempdima\@tempdimb + \Gscale@box\@tempa[\@tempa]{\box\@tempboxa}% + \@end@tempboxa} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gscale@box@dddd} +% Scale the text |#5| horizontally by a factor $|#1|/|#2|$ and +% vertically by a factor $|#3|/|#4|$. +% \changes{v0.3i}{1994/03/23} +% {Missing percent added} +% \changes{v0.7e}{1995/09/29} +% {Add \cs{ifGin@iso} code added} +% \changes{v1.0i}{1999/01/07} +% {made long. graphics/2908} +% \begin{macrocode} +\long\def\Gscale@box@dddd#1#2#3#4#5{% + \@begin@tempboxa\hbox{#5}% + \setlength\@tempdima{#1}% + \setlength\@tempdimb{#2}% + \Gscale@div\@tempa\@tempdima\@tempdimb + \setlength\@tempdima{#3}% + \setlength\@tempdimb{#4}% + \Gscale@div\@tempb\@tempdima\@tempdimb + \ifGin@iso + \ifdim\@tempa\p@>\@tempb\p@ + \let\@tempa\@tempb + \else + \let\@tempb\@tempa + \fi + \fi + \Gscale@box\@tempa[\@tempb]{\box\@tempboxa}% + \@end@tempboxa} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ifGin@iso} +% If this flag is true, then specifying two lengths to |\resizebox| +% scales the box by the same factor in either direction, such that +% neither length \emph{exceeds} the stated amount. No user interface +% to this flag in the standard package, but it is used by the +% |keepaspectratio| key to |\includegraphics| in the \textsf{graphicx} +% package. +% \changes{v0.7e}{1995/09/29} +% {Maco added} +% \begin{macrocode} +\newif\ifGin@iso +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gscale@div} +% The macro |#1| is set to the ratio of the lengths |#2| and |#3|. +% \changes{v0.7a}{1995/04/11} +% {Add trap for division by 0} +% \changes{v0.7d}{1995/09/27} +% {Use \cs{setlength} to support calc package} +% \changes{v1.0a}{1996/09/16} +% {Stop infinite loop if 2nd arg zero. graphics/2259} +% \begin{macrocode} +\def\Gscale@div#1#2#3{% + \setlength\dimen@{#3}% + \ifdim\dimen@=\z@ + \PackageError{graphics}{Division by 0}\@eha + \dimen@#2% + \fi + \edef\@tempd{\the\dimen@}% + \setlength\dimen@{#2}% + \count@65536\relax + \ifdim\dimen@<\z@ + \dimen@-\dimen@ + \count@-\count@ + \fi + \ifdim\dimen@>\z@ + \loop + \ifdim\dimen@<8192\p@ + \dimen@\tw@\dimen@ + \divide\count@\tw@ + \repeat + \dimen@ii\@tempd\relax + \divide\dimen@ii\count@ + \divide\dimen@\dimen@ii + \fi + \edef#1{\strip@pt\dimen@}} +% \end{macrocode} +% \end{macro} +% +% Restore Catcodes +% \begin{macrocode} +\Gin@codes +\let\Gin@codes\relax +% \end{macrocode} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \Finale +% diff --git a/Master/texmf-dist/source/latex/graphics/graphics.ins b/Master/texmf-dist/source/latex/graphics/graphics.ins new file mode 100644 index 00000000000..e991c95944c --- /dev/null +++ b/Master/texmf-dist/source/latex/graphics/graphics.ins @@ -0,0 +1,116 @@ +%% +%% This file is part of the Standard LaTeX `Graphics Bundle'. +%% It may be distributed under the terms of the LaTeX Project Public +%% License, as described in lppl.txt in the base LaTeX distribution. +%% Either version 1.0 or, at your option, any later version. +%% + +% This file requires docstrip version 2.4 available from +% ftp.dante.de tex-archive/macros/latex/unpacked/docstrip.tex + +\input docstrip + + +\preamble +\endpreamble + +\keepsilent +\askforoverwritefalse + +\usedir{tex/latex/graphics} + +% The packages + +\generate{\file{graphics.sty}{\from{graphics.dtx}{package}}} + +\generate{\file{color.sty}{\from{color.dtx}{package}}} + +\generate{\file{graphicx.sty}{\from{graphicx.dtx}{package}}} + +\generate{\file{trig.sty}{\from{trig.dtx}{package}}} + +\generate{\file{keyval.sty}{\from{keyval.dtx}{package}}} + +\generate{\file{epsfig.sty}{\from{epsfig.dtx}{package}}} + +\generate{\file{pstcol.sty}{\from{pstcol.dtx}{package}}} + +\generate{\file{lscape.sty}{\from{lscape.dtx}{package}}} + + +%% Generate a `template' .def file as an example for a new driver. +%% (This is not set up yet.) +%%\generate{\file{template.def}{% +%% \from{drivers.dtx}{template}}} + + +% These ones probably work +\generate{% + \file{dvips.def}{% + \from{drivers.dtx}{dvips,color1,psrulesZ,dosrules,macrules}} + \file{dvipdf.def}{% + \from{drivers.dtx}{dvipdf,color1,psrulesZ}} + \file{dvipsone.def}{% + \from{drivers.dtx}{tiffrules,dvipsone,color1,dosrules,psrules}} + \file{dviwin.def}{% + \from{drivers.dtx}{dviwin,nops}} + \file{emtex.def}{% + \from{drivers.dtx}{emtex,dosrules,nops}} +% OzTeX (>3.0) uses dvips.def +% \file{oztex.def}{% +% \from{drivers.dtx}{oztex,macrules,nops}} + \file{pctexps.def}{% + \from{drivers.dtx}{pctexps,color3,colorfix}} + \file{pctex32.def}{% + \from{drivers.dtx}{pctex32,color1}} + \file{pctexhp.def}{% + \from{drivers.dtx}{pctexhp,nops}} + \file{pctexwin.def}{% + \from{drivers.dtx}{pctexwin,nops}} + \file{truetex.def}{% + \from{drivers.dtx}{truetex,color4,nops}} + \file{tcidvi.def}{% + \from{drivers.dtx}{tcidvi,color4,nops}} + \file{dvipsnam.def}{% + \from{drivers.dtx}{dvipsnames}}} + + +% these ones are largely untested and no longer generated by default. +%\generate{% +% \file{pubps.def}{% +% \from{drivers.dtx}{pubps,psrules}} +% \file{psprint.def}{% +% \from{drivers.dtx}{psprint,psrules}} +%% The textures code generated by this option does more or less work +%% I believe, but it does not use all of textures features, and as I +%% have not got a Mac to test it on, it seems better to remove it for +%% now. +%% This release of the graphics distribution contains a textures.def +%% written by Arthur Ogawa which is distributed as a separate file. +%% It should however be installed in the same directory as the .def +%% files generated by this .ins installation script. +%% \file{textures.def}{% +%% \from{drivers.dtx}{textures,color2,macrules}} +%% +%%%% Old versions of textures (prior to 1.7) do not have colour specials. +%%%% To use colour with these versions, uncomment the next two lines. +%% +%%%% \file{textures.def}{% +%%%% \from{drivers.dtx}{textures,color3,colorfix,macrules}} +%% +%% +% \file{ln.def}{% +% \from{drivers.dtx}{ln}} +% \file{dvi2ps.def}{% +% \from{drivers.dtx}{dvi2ps,psrules}} +% \file{dvitops.def}{% +% \from{drivers.dtx}{dvitops,psrules}} +% \file{dvilaser.def}{% +% \from{drivers.dtx}{dvilaser,psrules}} +% \file{dvialw.def}{% +% \from{drivers.dtx}{dvialw,psrules}}} +% +% +% + +\endbatchfile diff --git a/Master/texmf-dist/source/latex/graphics/graphicx.dtx b/Master/texmf-dist/source/latex/graphics/graphicx.dtx new file mode 100644 index 00000000000..9d897477845 --- /dev/null +++ b/Master/texmf-dist/source/latex/graphics/graphicx.dtx @@ -0,0 +1,863 @@ +% +% \iffalse +% +%% graphicx.dtx Copyright (C) 1994 David Carlisle Sebastian Rahtz +%% Copyright (C) 1995 1996 1997 1999 David Carlisle +%% +%% This file is part of the Standard LaTeX `Graphics Bundle'. +%% It may be distributed under the terms of the LaTeX Project Public +%% License, as described in lppl.txt in the base LaTeX distribution. +%% Either version 1.0 or, at your option, any later version. +%% +%<*dtx> + \ProvidesFile{graphicx.dtx} +%</dtx> +%<package>\NeedsTeXFormat{LaTeX2e}[1995/12/01] +%<package>\ProvidesPackage{graphicx} +%<driver> \ProvidesFile{graphicx.drv} +% \fi +% \ProvidesFile{graphicx.dtx} + [1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)] +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\newenvironment{key}[2]{\expandafter\macro\expandafter{% + \csname KV@#1@#2\endcsname}}{\endmacro} +% +\begin{document} + \DocInput{graphicx.dtx} +\end{document} +%</driver> +% \fi +% +% \GetFileInfo{graphicx.dtx} +% +% \title{The \textsf{graphicx} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{D. P. Carlisle\and S. P. Q. Rahtz} +% \date{\filedate} +% \maketitle +% +% \CheckSum{593} +% +% \changes{v0.3}{1994/03/01} +% {First DPC version (after prototype by SPQR).} +% \changes{v0.4b}{1994/05/30} +% {Rename from egraphics. 8+3 name for CDROM} +% \changes{v1.0}{1996/05/29} +% {Version 1 at last} +% +% \def\star{{\ttfamily*}} +% \makeatletter +% \def\Describe@Macro#1{\endgroup +% \setbox0=\lastbox\llap{\PrintDescribeMacro{#1}}}% +% \makeatother +% \marginparsep0pt +% +% \section{Introduction} +% +% This package provides an alternative interface to the \LaTeXe\ +% graphics functions. The command names provided are the same as in the +% standard package, and they use the same internal functions. However +% the meaning of the optional arguments is different. Note \emph{only} +% the optional arguments have changed: any document which only uses the +% graphics commands with the mandatory arguments and/or the star-forms +% will work identically (with essentially identical implementation) with +% the two packages. +% +% \section{Key=Value Interface} +% When the decision to produce \LaTeXe\ was made, certain `guiding +% principles' were made (and published in the original announcement). +% One of these was that all new features would `conform to the +% conventions of version 2.09'. Specifically this meant that new +% commands would obey the same basic syntax rules for arguments as the +% existing commands. +% +% Standard \LaTeX\ optional arguments are \emph{positional}. If a +% command were to take three optional arguments, then there would be no +% way of specifying only the third, one would have to give all three, +% even if the first two were repeats of the default values. Basically +% this means that `standard' optional arguments are not suitable if +% there is more than one option. Various existing packages (for +% \LaTeX~2.09) have recognised this, and used `named arguments' in +% various forms. Perhaps the two most noticeable are |psfig| and +% |pstricks|. With `named arguments' (sometimes called `attributes') +% each option is not tied to a particular position, but rather given a +% name (or key) and any options that must be set are set by explicitly +% associating this name with the desired value. +% +% The members of the \LaTeX3 project do appreciate the importance of +% this kind of syntax, but felt that rather than extending the syntax of +% \LaTeX\ in an uncoordinated way, it would be better to keep with +% `standard arguments' in \LaTeXe, which is intended as a `consolidation +% of existing \LaTeX\ variants'. The long term planning for an eventual +% \LaTeX3 release will then be able to consider the whole \LaTeX\ +% user interface, and a suitable syntax for named arguments. It is +% important that such an interface design is not hampered by having to +% retain compatibility with earlier attempts at a named argument +% syntax. For this reason this |graphicx| package, which uses the named +% argument mechanism from the |keyval| package should be considered `non +% standard' although it is supported by the same mechanism, and same +% authors as the `standard' |graphics| package. +% +% \section{The User Interface} +% +% \DescribeMacro +% \includegraphics\star\oarg{key-val list}\marg{file}\\ +% \DescribeMacro +% \includegraphics\star\oarg{llx,lly}\oarg{urx,ury}\marg{file}\\ +% Include a graphics file. +% +% The star form is just for +% compatibility with the standard interface, and essentially just adds +% |clip| to the keys specified. Similarly the second, two-optional +% argument form is for increased compatibility with the standard +% package. The two optional argument form is not needed in the |keyval| +% interface. +% +% Various `keys' or named arguments are supported. +% \begin{description} +% \item[bb] Set the bounding box. The argument should be four +% dimensions, separated by spaces. +% \item[bbllx,bblly,bburx,bbury] Set the bounding box. Mainly for +% compatibility with older packages. |bbllx=a,bblly=b,bburx=c,bbury=d| +% is equivalent to |bb = a b c d|. +% \item[natwidth,natheight] Again an alternative to |bb|. +% |natheight=h,natwidth=w| is equivalent to |bb = 0 0 h w|. +% \item[viewport] Modify the bounding box specified in the file. +% The four values specify a bounding box \emph{relative} to the +% |llx|,|lly| coordinate of the original box. +% \item[trim] Modify the bounding box specified in the file. +% The four values specify the amounts to remove from +% the left, bottom, right and top of the original box. +% \item[hiresbb] Boolean valued key. Defaults to |true|. +% Causes \TeX\ to look for |%%HiResBoundingBox| comments rather than +% the standard |%%BoundingBox|. May be set to |false| to override +% a default setting of true specified by the |hiresbb| package option. +% \item[angle] Rotation angle. +% \item[origin] Rotation origin (see |\rotatebox|, below). +% \item[width] Required width, a dimension (default units |bp|). The +% graphic will be scaled to make the width the specified dimension. +% \item[height] Required height. a dimension (default units |bp|). +% \item[totalheight] Required totalheight (ie height $+$ depth). a +% dimension (default units |bp|). Most useful after a rotation (when the +% height might be zero). +% \item[keepaspectratio] Boolean valued key (like |clip|). If it is set +% to true, modify the meaning of the |width| and |height| (and +% |totalheight|) keys such that if both are specified then rather than +% distort the figure the figure is scaled such that neither dimension +% \emph{exceeds} the stated dimensions. +% \item[scale] Scale factor. +% \item[clip] Either `true' or `false' (or no value, which is equivalent +% to `true'). Clip the graphic to the bounding box (or viewport if one +% is specified). +% \item[draft] a boolean valued key, like `clip'. locally switches to +% draft mode, ie.\ do not include the graphic, but leave the +% correct space, and print the filename. +% \item[type] Specify the file type. (Normally determined from the file +% extension.) +% \item[ext] Specify the file extension. +% \emph{Only} for use with |type|. +% \item[read] Specify the `read file' which is used for determining the +% size of the graphic. \emph{Only} for use with |type|. +% \item[command] Specify the file command. +% \emph{Only} for use with |type|. +% \end{description} +% +% The arguments are interpreted left to right. |clip|, |draft|, |bb|,, +% and |bbllx| etc.\ have the same effect wherever they appear. but the +% scaling and rotation keys interact. +% +% Any scaling that is specified \emph{before} rotation, is handled by +% the internal graphics inclusion function. Rotation, or any later +% scaling is handled by implicitly calling |\rotatebox| or |\scalebox|. +% So |[height=1in,angle=90]| scales the graphic to 1in, then rotates it, +% so it is one inch wide. |[angle=90,height=1in]| first rotates, then +% scales the result so that it is 1in high. A driver that can scale +% included graphics, but not arbitrary text will not be able to support +% the second form, as it will require a call to |\scalebox|, but the +% first form should work as there the scaling is handled by +% |\Ginclude@graphics|. +% +% \DescribeMacro +% \rotatebox\oarg{key-val list}\marg{angle}\marg{text}\\ +% Rotate \emph{text}. +% +% The keys supported by |\rotatebox| are: +% \begin{description} +% \item[origin] Specify the centre of rotation. |origin=|\meta{label}, +% where the labels are up to two of |lrctbB| (|B| denotes the +% baseline, as for PSTricks). +% \item[x,y] An alternative to +% |origin|. |x=|\meta{dimen}|,y=|\meta{dimen} The $x,y$ coordinate of +% the centre of rotation. As usual |\height| etc may be used. +% \item[units] Specify the units used in the main argument. eg +% |units=-360| would mean that the argument refered to degrees +% \emph{clockwise} instead of the default anti-clockwise rotation. +% \end{description} +% +% As an example |\rotatebox[origin=c]{180}{text}| will rotate ``text'' +% around its centre, thus creating a final box of the same dimensions as +% the original box. This is to be contrasted to the default behaviour, +% which rotates around the reference point on the baseline, thus +% producing a box that is mainly \emph{below} the baseline. +% +% \StopEventually{} +% +% +% \section{Implementation} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% One new option is handled by keyval. It suppresses the error +% normally generated if an unknow keyval key is used. +% (This helps porting between drivers that use extended interfaces.) +% \changes{v1.0e}{1999/01/10}{new unknownkeysallowed option} +% \begin{macrocode} +\DeclareOption{unknownkeysallowed} + {\PassOptionsToPackage\CurrentOption{keyval}} +% \end{macrocode} +% +% All other options are handled by the \textsf{graphics} package. +% \begin{macrocode} +\DeclareOption*{\PassOptionsToPackage\CurrentOption{graphics}} +% \end{macrocode} +% +% \begin{macrocode} +\ProcessOptions +% \end{macrocode} +% +% This package requires these two building blocks. +% \begin{macrocode} +\RequirePackage{keyval,graphics} +% \end{macrocode} +% +% +% \subsection{Graphics Inclusion} +% +% +% First we declare the `bounding box' keys. These all use +% |\Gin@defaultbp| so that the \meta{value} can be given as a length in +% the usual \TeX\ units such as |cm| or as an integer, taken as |bp|. +% +% \begin{key}{Gin}{bb} +% \begin{macrocode} +\define@key{Gin}{bb} + {\Gin@bboxtrue\Gread@parse@bb#1 \\} +% \end{macrocode} +% \end{key} +% +% \begin{key}{Gin}{bbllx} +% \begin{key}{Gin}{bblly} +% \begin{key}{Gin}{bburx} +% \begin{key}{Gin}{bbury} +% \changes{v0.3b}{1994/03/11}{use bbllx not llx} +% \changes{v0.3b}{1994/03/11}{add natheight and natwidth} +% \changes{v0.6a}{1995/04/11}{New \cs{Gin@defaultbb} code} +% \changes{v0.6b}{1995/06/26}{typos fixed for graphics/1685} +% \begin{macrocode} +\define@key{Gin}{bbllx} + {\Gin@bboxtrue\Gin@defaultbp\Gin@llx{#1}} +\define@key{Gin}{bblly} + {\Gin@bboxtrue\Gin@defaultbp\Gin@lly{#1}} +\define@key{Gin}{bburx} + {\Gin@bboxtrue\Gin@defaultbp\Gin@urx{#1}} +\define@key{Gin}{bbury} + {\Gin@bboxtrue\Gin@defaultbp\Gin@ury{#1}} +% \end{macrocode} +% \end{key} +% \end{key} +% \end{key} +% \end{key} +% +% \begin{key}{Gin}{hiresbb} +% \changes{v1.0b}{1996/10/29} +% {hiresbb key added} +% If set to true (the default) \TeX\ will look for bounding box +% comments of the form |%%HiResBoundingBox| (which typically have +% real values) instead of the standard |%%BoundingBox| (which should +% have integer values). +% It may be set to false to override a package option of hiresbb. +% \begin{macrocode} +\define@key{Gin}{hiresbb}[true]{% + \edef\Gread@BBox{% + \@percentchar\@percentchar + \csname if#1\endcsname HiRes\fi + BoundingBox}} +% \end{macrocode} +% \end{key} +% +% \begin{key}{Gin}{natheight} +% \begin{key}{Gin}{natheight} +% \changes{v0.6d}{1995/09/22} +% {typos fixed in natheight and natwidth keys} +% \begin{macrocode} +\let\KV@Gin@natwidth\KV@Gin@bburx +\let\KV@Gin@natheight\KV@Gin@bbury +% \end{macrocode} +% \end{key} +% \end{key} +% +% \begin{key}{Gin}{viewport} +% \begin{key}{Gin}{trim} +% \changes{v0.6a}{1995/04/11}{viewport and trim keys added} +% \changes{v0.6c}{1995/09/07}{arithmetic in viewport key fixed} +% A `viewport' is a user-specified area of the graphic to be included. +% It should not be confused with the `Bounding Box' of a PS file. +% In fact, the origin for a viewport specification is the (llx,lly) +% lower left coordinate of the bounding box. If a viewport is +% specified, and clipping is turned on, clipping is based on the +% viewport, not on the boundingbox. +% +% Both `viewport' and `trim' were suggested (and originally, but +% differently, implemented) by Arthur Ogawa. +% \begin{macrocode} +\define@key{Gin}{viewport} + {\let\Gin@viewport@code\Gin@viewport\Gread@parse@vp#1 \\} +\define@key{Gin}{trim} + {\let\Gin@viewport@code\Gin@trim\Gread@parse@vp#1 \\} +% \end{macrocode} +% \end{key} +% \end{key} +% +% \begin{macro}{\Gread@parse@vp} +% Grabs four bounding box values like |\Gread@parse@bp| but saves them +% in alternative macros that are used in the viewport and trim cases to +% modify the bounding box read from the file. +% \begin{macrocode} +\def\Gread@parse@vp#1 #2 #3 #4 #5\\{% + \Gin@defaultbp\Gin@vllx{#1}% + \Gin@defaultbp\Gin@vlly{#2}% + \Gin@defaultbp\Gin@vurx{#3}% + \Gin@defaultbp\Gin@vury{#4}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gin@viewport} +% \changes{v1.0c}{1996/10/31}{Original bb saved} +% If a viewport is specified, reset the bounding box cordinates +% by adding the original origin, |\Gin@llx|, |\Gin@lly| to the new +% values specified as the viewport. The original Bounding box +% coordinates are saved in |\Gin@ollx|\ldots\ some drivers +% might need this information (currently just |tcidvi|). +% \begin{macrocode} +\def\Gin@viewport{% + \let\Gin@ollx\Gin@llx + \let\Gin@olly\Gin@lly + \let\Gin@ourx\Gin@urx + \let\Gin@oury\Gin@ury + \dimen@\Gin@llx\p@\advance\dimen@ \Gin@vurx\p@ + \edef\Gin@urx{\strip@pt\dimen@}% + \dimen@\Gin@lly\p@\advance\dimen@ \Gin@vury\p@ + \edef\Gin@ury{\strip@pt\dimen@}% + \dimen@\Gin@llx\p@\advance\dimen@ \Gin@vllx\p@ + \edef\Gin@llx{\strip@pt\dimen@}% + \dimen@\Gin@lly\p@\advance\dimen@ \Gin@vlly\p@ + \edef\Gin@lly{\strip@pt\dimen@}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gin@trim} +% \changes{v1.0c}{1996/10/31}{Original bb saved} +% If a trim is specified, reset the bounding box cordinates +% by trimming the four specified values off each side of the +% graphic. +% \begin{macrocode} +\def\Gin@trim{% + \let\Gin@ollx\Gin@llx + \let\Gin@olly\Gin@lly + \let\Gin@ourx\Gin@urx + \let\Gin@oury\Gin@ury + \dimen@\Gin@llx\p@\advance\dimen@ \Gin@vllx\p@ + \edef\Gin@llx{\strip@pt\dimen@}% + \dimen@\Gin@lly\p@\advance\dimen@ \Gin@vlly\p@ + \edef\Gin@lly{\strip@pt\dimen@}% + \dimen@\Gin@urx\p@\advance\dimen@ -\Gin@vurx\p@ + \edef\Gin@urx{\strip@pt\dimen@}% + \dimen@\Gin@ury\p@\advance\dimen@ -\Gin@vury\p@ + \edef\Gin@ury{\strip@pt\dimen@}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gin@vllx} +% \begin{macro}{\Gin@vlly} +% \begin{macro}{\Gin@vurx} +% \begin{macro}{\Gin@vury} +% Four macros to hold the modifiers for the bounding box for viewport +% and trim specifications. +% \begin{macrocode} +\let\Gin@vllx\Gin@llx\let\Gin@vlly\Gin@llx +\let\Gin@vurx\Gin@llx\let\Gin@vury\Gin@llx +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{key}{Gin}{angle} +% Specify a rotation. This is just handled by wrapping the +% |\includegraphics| command in a call to the internal version of +% |\rotatebox|. Normally this is the `standard' version but if an +% |origin| key is used in |\includegraphics| then the \emph{keyval} +% version of origin is used, and the |origin| key is passed on. +% \begin{macrocode} +\define@key{Gin}{angle} + {\Gin@esetsize + \@tempswatrue + \edef\@tempa{\toks@{\noexpand\Gin@erotate{#1}{\the\toks@}}}% + \@tempa} +% \end{macrocode} +% \end{key} +% +% \begin{key}{Gin}{origin} +% Pass the origin key value on to |\rotatebox|. |\Gin@erotate| is +% initialised to |\Grot@box@std| later in the file, after the latter has +% been defined. +% \changes{v0.6e}{1995/09/28} +% {key added} +% \begin{macrocode} +\define@key{Gin}{origin}[c]{% + \def\Gin@erotate{\Grot@box@kv[origin=#1]}} +% \end{macrocode} +% \end{key} +% +% \begin{key}{Gin}{width} +% \begin{key}{Gin}{height} +% Save the required height and width. The actual scaling is done later. +% \begin{macrocode} +\define@key{Gin}{width}{\def\Gin@ewidth{#1}} +\define@key{Gin}{height}{\def\Gin@eheight{#1}} +% \end{macrocode} +% \end{key} +% \end{key} +% +% \begin{key}{Gin}{totalheight} +% \changes{v0.6a}{1995/04/11}{New totalheight key} +% The same as |height| key, but locally changes |\Gin@eresize| to +% |\totalheight| from its default value of |\height|. +% \begin{macrocode} +\define@key{Gin}{totalheight}{% + \def\Gin@eresize{\totalheight}\def\Gin@eheight{#1}} +% \end{macrocode} +% \end{key} +% +% \begin{key}{Gin}{keepaspectratio} +% Boolean valued key (like |clip|). If it is set to true, +% modify the meaning of the |width| and |height| (and |totalheight|) +% keys such that if both are specified then rather than distort the +% figure the figure is scaled such that neither dimension \emph{exceeds} +% the stated dimensions. +% \changes{v0.6e}{1995/09/28} +% {key added} +% \changes{v0.6h}{1995/12/06} +% {Name changed to keepaspectratio} +% \begin{macrocode} +\define@key{Gin}{keepaspectratio}[true]{% + \lowercase{\Gin@boolkey{#1}}{iso}} +% \end{macrocode} +% \end{key} +% +% \begin{key}{Gin}{scale} +% \changes{v0.6h}{1995/12/06} +% {Use \cs{Gin@exclamation}} +% If the scaling is being handled externally, wrap |\includegraphics| in +% the internal form of |\scalebox|, otherwise locally define +% |\Gin@req@sizes| to calculate the required sizes based on +% scale factor. +% \begin{macrocode} +\define@key{Gin}{scale}{% + \if@tempswa + \edef\@tempa{\toks@{\noexpand\Gscale@box{#1}[#1]{\the\toks@}}}% + \@tempa + \else + \def\Gin@req@sizes{% + \def\Gin@scalex{#1}\let\Gin@scaley\Gin@exclamation + \Gin@req@height\Gin@scalex\Gin@nat@height + \Gin@req@width\Gin@scalex\Gin@nat@width}% + \fi + \@tempswatrue} +% \end{macrocode} +% \end{key} +% +% \begin{key}{Gin}{draft} +% Locally set the draft switch to true. This is used by the code in +% \textsf{graphics} package to suppress the file inclusion. +% \begin{macrocode} +\define@key{Gin}{draft}[true]{% + \lowercase{\Gin@boolkey{#1}}{draft}} +% \end{macrocode} +% \end{key} +% +% \begin{key}{Gin}{clip} +% Locally set the clip switch to true. This is used by the code in +% \textsf{graphics} package to suppress the printing of anything outside +% the bounding box specified. +% \begin{macrocode} +\define@key{Gin}{clip}[true]{% + \lowercase{\Gin@boolkey{#1}}{clip}} +% \end{macrocode} +% \end{key} +% +% \begin{key}{Gin}{type} +% If you use `type' you must use no extension in the main argument +% and you must use `ext'. You can also use `read' and `command'. +% \changes{v0.5a}{1994/11/29} +% {remove \cs{Gin@sep}} +% \begin{macrocode} +\define@key{Gin}{type}{% + \def\Ginclude@graphics##1{% + \begingroup + \def\Gin@base{##1}% + \edef\@tempa{{#1}{\Gin@eread}{\Gin@ecom{##1\Gin@eext}}}% + \expandafter\Gin@setfile\@tempa + \endgroup}} +% \end{macrocode} +% \end{key} +% +% \begin{key}{Gin}{ext} +% \changes{v1.0d}{1997/06/09}{initialise ext to empty} +% Specify an extension, for use with the `type' key. +% \begin{macrocode} +\define@key{Gin}{ext}{\def\Gin@eext{#1}} +\let\Gin@eext\@empty +% \end{macrocode} +% \end{key} +% +% \begin{key}{Gin}{read} +% Specify a read file, for use with the `type' key. +% You may want to globally set this to |*| using |\setkeys|. +% |*| means read the graphic file for size info, as in +% |\DeclareGraphicsRule|. +% \changes{v0.5a}{1994/11/29} +% {Add default * possibility.} +% \begin{macrocode} +\define@key{Gin}{read}{% + \def\Gin@eread{#1}% + \def\@tempa{*}\ifx\@tempa\Gin@eread\def\Gin@eread{\Gin@eext}\fi} +\let\Gin@eread\@empty +% \end{macrocode} +% \end{key} +% +% \begin{key}{Gin}{command} +% Specify a command, for use with the `type' key. +% \begin{macrocode} +\define@key{Gin}{command}{\def\Gin@ecom##1{#1}} +\let\Gin@ecom\@firstofone +% \end{macrocode} +% \end{key} +% +% \begin{macro}{\Gin@boolkey} +% Helper function for defining boolean valued functions. The order of +% arguments allows |\lowercase| to only act on the user-supplied +% argument. +% \changes{v0.4a}{1994/04/14}{Make `empty'!=true so clip!= works} +% \begin{macrocode} +\def\Gin@boolkey#1#2{% + \csname Gin@#2\ifx\relax#1\relax true\else#1\fi\endcsname} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gin@esetsize} +% \changes{v0.6h}{1995/12/06} +% {Use \cs{Gin@exclamation}} +% Arrange for the final size to be set, either by wrapping the include +% graphics call in |\scalebox|, or by redefining |\Gin@req@sizes| +% appropriately. +% \begin{macrocode} +\def\Gin@eresize{\height} +\def\Gin@esetsize{% + \let\@tempa\Gin@exclamation + \if@tempswa +% \end{macrocode} +% External. Wrap the |\includegraphics| command in a call to the +% internal form of |\scalebox| to handle the rotation. +% \begin{macrocode} + \edef\@tempa{\toks@{\noexpand + \Gscale@@box\noexpand\Gin@eresize + {\Gin@ewidth}{\Gin@eheight}{\the\toks@}}}% + \@tempa + \else +% \end{macrocode} +% Internal. Handle scaling with the |\includegraphics| command directly +% rather than calling |\scalebox|. +% \begin{macrocode} + \ifx\Gin@ewidth\@tempa + \ifx\Gin@eheight\@tempa +% \end{macrocode} +% No resizing. +% \begin{macrocode} + \else +% \end{macrocode} +% Just height specified. +% \changes{v0.6e}{1995/09/28} +% {Use \cs{setlength} to support calc package} +% \changes{v0.6h}{1995/12/06} +% {Use \cs{Gin@exclamation}} +% \begin{macrocode} + \let\Gin@@eheight\Gin@eheight + \def\Gin@req@sizes{% + \Gscale@div\Gin@scaley\Gin@@eheight\Gin@nat@height + \let\Gin@scalex\Gin@exclamation + \setlength\Gin@req@height\Gin@@eheight + \Gin@req@width\Gin@scaley\Gin@nat@width}% + \fi + \else + \ifx\Gin@eheight\@tempa +% \end{macrocode} +% Just width specified. +% \changes{v0.6e}{1995/09/28} +% {Use \cs{setlength} to support calc package} +% \changes{v0.6h}{1995/12/06} +% {Use \cs{Gin@exclamation}} +% \begin{macrocode} + \let\Gin@@ewidth\Gin@ewidth + \def\Gin@req@sizes{% + \Gscale@div\Gin@scalex\Gin@@ewidth\Gin@nat@width + \let\Gin@scaley\Gin@exclamation + \setlength\Gin@req@width\Gin@@ewidth + \Gin@req@height\Gin@scalex\Gin@nat@height}% + \else +% \end{macrocode} +% Both height and width specified. +% \begin{macrocode} + \let\Gin@@ewidth\Gin@ewidth + \let\Gin@@eheight\Gin@eheight +% \end{macrocode} +% \changes{v0.6g}{1995/11/10} +% {Use \cs{ifGin@iso} to support isoscale key} +% At this point can locally redefine |\Gin@nosize|. Instead +% of generating an error, just set the `natural' size to be the +% `requested size'. Previous versions of this package did not +% allow the use of |height| and |width| unless the natural size was +% known as otherwise \LaTeX\ can not calculate the scale factor. +% However many drivers (especially for bitmap formats) can work this out +% themselves, so as long as both |height| and |width| are given, so +% \LaTeX\ knows the size to leave, accept this. This assumes the code in +% the driver file will use the `required height' information, not the +% scale factors, which will be set to 1!. +% \changes{v1.0a}{1996/08/05} +% {Missing percent added for graphics/2244} +% \begin{macrocode} + \def\Gin@nosize##1{% + \KV@Gin@natwidth\Gin@@ewidth + \KV@Gin@natheight\Gin@@eheight}% +% \end{macrocode} +% +% \begin{macrocode} + \def\Gin@req@sizes{% + \Gscale@div\Gin@scalex\Gin@@ewidth\Gin@nat@width + \Gscale@div\Gin@scaley\Gin@@eheight\Gin@nat@height +% \end{macrocode} +% \changes{v0.6f}{1995/09/29} +% {Use \cs{ifGin@iso} to support isoscale key} +% Donald Arseneau requested this feature. If both |height| +% and |width| are chosen, choose the smaller scale factor rather than +% distort the graphic. This mode is turned on with the +% \textsf{keepaspectratio} key. +% \begin{macrocode} + \ifGin@iso + \ifdim\Gin@scaley\p@>\Gin@scalex\p@ + \let\Gin@scaley\Gin@scalex + \else + \let\Gin@scalex\Gin@scaley + \fi + \fi + \Gin@req@width\Gin@scalex\Gin@nat@width + \Gin@req@height\Gin@scaley\Gin@nat@height}% + \fi + \fi + \fi + \let\Gin@ewidth\Gin@exclamation + \let\Gin@eheight\Gin@ewidth} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gin@req@height} +% \begin{macro}{\Gin@req@width} +% The required final size. +% \begin{macrocode} +\newdimen\Gin@req@height +\newdimen\Gin@req@width +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\Gin@outer@scalex} +% \begin{macro}{\Gin@outer@scaley} +% Scale factors to pass to |\scalebox|. +% \begin{macrocode} +\let\Gin@outer@scalex\relax +\let\Gin@outer@scaley\relax +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\Gin@angle} +% Rotation angle. +% \begin{macrocode} +\let\Gin@angle\relax +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Gin@ewidth} +% \changes{v0.6h}{1995/12/06} +% {Use \cs{Gin@exclamation}} +% \begin{macro}{\Gin@eheight} +% Final size, initialised for no scaling. +% \begin{macrocode} +\let\Gin@ewidth\Gin@exclamation +\let\Gin@eheight\Gin@ewidth +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\Gin@scalex} +% \begin{macro}{\Gin@scaley} +% \changes{v0.6h}{1995/12/06} +% {Use \cs{Gin@exclamation}} +% Scale factors. Initialised for no scaling. +% \begin{macrocode} +\def\Gin@scalex{1} +\let\Gin@scaley\Gin@exclamation +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\Gin@i} +% Use the same top level |\includegraphics| command as the standard +% interface. This will set the clipping switch, and then call |\Gin@i|. +% \changes{v0.3c}{1994/03/15}{Dont locally initialise width/height} +% \changes{v0.3c}{1994/03/15}{Always call \cmd{\Gin@ii}} +% \changes{v0.4c}{1994/09/12}{Use `standard' version if two opt.\ args.} +% \begin{macrocode} +\def\Gin@i{% + \def\Gin@req@sizes{% + \Gin@req@height\Gin@nat@height + \Gin@req@width\Gin@nat@width}% + \@ifnextchar[\Gin@ii{\Gin@ii[]}} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\Gin@ii} +% Look for a second optional argument. +% If one optional argument is present, call |\setkeys| to process it, +% \begin{macrocode} +\def\Gin@ii[#1]#2{% + \def\@tempa{[}\def\@tempb{#2}% + \ifx\@tempa\@tempb + \def\@tempa{\Gin@iii[#1][}% + \expandafter\@tempa + \else + \begingroup + \@tempswafalse + \toks@{\Ginclude@graphics{#2}}% + \setkeys{Gin}{#1}% + \Gin@esetsize + \the\toks@ + \endgroup + \fi} +% \end{macrocode} +% \end{macro} +% +% \changes{v0.4b}{1994/05/06} +% {Remove incorrect initialisation of \cs{Gin@scalex}} +% +% \section{Rotation} +% +% \begin{macro}{\rotatebox} +% Look for an optional argument. +% \changes{v0.3b}{1994/03/11}{Remove star form} +% \begin{macrocode} +\def\rotatebox{% + \@ifnextchar[\Grot@box@kv\Grot@box@std} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Grot@box@std} +% If no KV argument, just repeat the standard definition. +% \begin{macrocode} +\def\Grot@box@std#1#2{% + \Grot@setangle{#1}% + \setbox\z@\hbox{{#2}}% + \Grot@x\z@ + \Grot@y\z@ + \Grot@box} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Grot@box@kv} +% \begin{macrocode} +\def\Grot@box@kv[#1]#2#3{% + \@begin@tempboxa\hbox{#3}% + \Grot@x\width \divide\Grot@x\tw@ + \Grot@y\height \advance\Grot@y-\depth \divide\Grot@y\tw@ + \setkeys{Grot}{#1}% + \setbox\z@\box\@tempboxa + \Grot@setangle{#2}% + \Grot@box + \@end@tempboxa} +% \end{macrocode} +% \end{macro} +% +% +% There are two ways of specifying the centre of rotation. +% +% \begin{key}{Grot}{origin} +% |origin=|\meta{label}, where the labels are up to two of |lrctbB| +% (|B| denotes the baseline, as for PSTricks). +% \begin{macrocode} +\define@key{Grot}{origin}[c]{% + \@tfor\@tempa:=#1\do{% + \if l\@tempa \Grot@x\z@\else + \if r\@tempa \Grot@x\width\else + \if t\@tempa \Grot@y\height\else + \if b\@tempa \Grot@y-\depth\else + \if B\@tempa \Grot@y\z@\fi\fi\fi\fi\fi}} +% \end{macrocode} +% \end{key} +% +% \begin{key}{Grot}{x} +% \begin{key}{Grot}{y} +% |x=|\meta{dimen}|,y=|\meta{dimen} The $x,y$ coordinate of the centre +% of rotation. As usual |\height| etc may be used. +% \begin{macrocode} +\define@key{Grot}{x}{\setlength\Grot@x{#1}} +\define@key{Grot}{y}{\setlength\Grot@y{#1}} +% \end{macrocode} +% \end{key} +% \end{key} +% +% \begin{key}{Grot}{units} +% `units' specifies the number or units in one anti-clockwise circle. +% So the default is $360$. $-360$ gives clockwise rotation, $6.283185$ +% gives radians etc. +% \begin{macrocode} +\define@key{Grot}{units}{% + \def\Grot@setangle##1{% + \dimen@##1\p@ + \dimen@ii#1\p@ + \divide\dimen@ii360\relax + \divide\dimen@\dimen@ii + \edef\Grot@angle{\number\dimen@}}} +% \end{macrocode} +% \end{key} +% +% \begin{macro}{\Gin@erotate} +% Initialise the rotation command to use in |\includegraphics|. +% \changes{v0.6e}{1995/09/28}{macro added} +% \begin{macrocode} +\let\Gin@erotate\Grot@box@std +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \Finale +% diff --git a/Master/texmf-dist/source/latex/graphics/keyval.dtx b/Master/texmf-dist/source/latex/graphics/keyval.dtx new file mode 100644 index 00000000000..6cc3f169a37 --- /dev/null +++ b/Master/texmf-dist/source/latex/graphics/keyval.dtx @@ -0,0 +1,401 @@ +% +% \iffalse +%% keyval.dtx Copyright (C) 1993 1994 1995 1997 1998 1999 David Carlisle +%% +%% This file is part of the Standard LaTeX `Graphics Bundle'. +%% It may be distributed under the terms of the LaTeX Project Public +%% License, as described in lppl.txt in the base LaTeX distribution. +%% Either version 1.0 or, at your option, any later version. +%% +% +%<*dtx> + \ProvidesFile{keyval.dtx} +%</dtx> +%<*!plain> +%<package&!plain>\NeedsTeXFormat{LaTeX2e} +%<package&!plain>\ProvidesPackage{keyval} +%<driver> \ProvidesFile{keyval.drv} +% \fi +% \ProvidesFile{keyval.dtx} + [1999/03/16 v1.13 key=value parser (DPC)] +% +% \iffalse +%</!plain> +%<*driver> +\documentclass{ltxdoc} +\usepackage{keyval} +\begin{document} + \DocInput{keyval.dtx} +\end{document} +%</driver> +% \fi +% +% \GetFileInfo{keyval.dtx} +% \title{The \textsf{keyval} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{David Carlisle} +% \date{\filedate} +% \maketitle +% +% \begin{abstract} +% A \LaTeX\ package implementing a system allowing the setting +% of parameters (or `named arguments' with a +% \meta{key}${}={}$\meta{value} syntax. +% +% Eg: |\foo[height=3in, shadow = true ]{bar}| +% \end{abstract} +% +% \CheckSum{149} +% +% \changes{v1.03} +% {1993/10/13}{Initial version} +% \changes{v1.04}{1993/11/15} +% {Upgrade after comments from Timothy van Zandt} +% \changes{v1.05}{1993/11/17} +% {Further small improvements} +% \changes{v1.06}{1994/02/01} +% {Update to LaTeX2e} +% \changes{v1.07}{1994/03/15} +% {New style ltxdoc} +% \changes{v1.08}{1994/09/12} +% {Improve docstrip handling} +% \changes{v1.09}{1995/09/21} +% {Move a comma for graphics/1698} +% +% +% This package implements a system of defining and using sets of +% parameters, which are set using the syntax \meta{key}=\meta{value}. +% +% For each keyword in such a set, there exists a function which is +% called whenever the parameter appears in a parameter list. For +% instance if the set |dpc| is to have the keyword |scale| then I +% would define.\\ +% | \define@key{dpc}{scale}{scale ({\tt\string#1})\\}|\\ +% The first argument of |\define@key| is the set of keywords being +% used, the second is the keyword, and the third is the function to +% call. This function will be given as |#1| the \meta{value} specified +% by the user. +% +% Normally it is an error to omit the `=\meta{value}' however if an +% optional \meta{value} is supplied when the keyword is defined, then +% just the keyword need be supplied.\\ +% |\define@key{dpc}{clip}[true]{...}|\\ +% For `|clip|' you can go `|clip = true|' or `|clip = false|' or +% just `|clip|', which is the same as `|clip = true|' +% +% To use these keywords, just call `|\setkeys|' with a comma +% separated list of settings, each of the form +% \meta{key}=\meta{value}, or just \meta{key}. Any white space around +% the `|=|' and `|,|' is ignored. +% +% As the \meta{key} is passed as a macro argument, if it consists +% entirely of a |{ }| group, the outer braces are stripped off. Thus +% |,key=foo,| and |,key={foo},| are equivalent. This fact enables one to +% `hide' any commas or equals signs that must appear in the value. i.e.\ +% in |foo={1,2,3},bar=4|, |foo| gets the value |1,2,3|, the comma after +% |1| does not terminate the keyval pair, as it is `hidden' by the +% braces. +% +% Empty entries, with nothing between the commas, are silently ignored. +% This means that it is not an error to have a comma after the last +% term, or before the first. +% +% \section{Example} +% +% We may extend the examples above to give a `fake' graphics +% inclusion macro, with a syntax similar to that used in the psfig +% macros. +% +% \makeatletter +% \def\dpcgraphics{\@ifnextchar[\@dpcgraphics{\@dpcgraphics[]}} +% +% |\dpcgraphics| has one optional argument which is passed through +% |\setkeys|, and one mandatory argument, the filename. It actually +% just typesets its arguments, for demonstration. +% +% \def\@dpcgraphics[#1]#2{{\setkeys{dpc}{#1}INPUT: #2}}% +% +% \define@key{dpc}{scale}{scale ({\tt\string#1\relax})\\} +% \define@key{dpc}{height}{height ({\tt#1})\\} +% \define@key{dpc}{width}{width ({\tt#1})\\} +% \define@key{dpc}{bb}{bounding box ({\tt#1})\\} +% \define@key{dpc}{clip}[true]{clip ({\tt\string#1\relax})\\} +% \makeatother +% +% The declared keys are: |scale|, |height|, |width|, |bb|, +% and |clip|. Except for the last, they must all be given a value if +% used. +% +% Note how in the following, any white space arround |=| or |,| is +% ignored, as are the `empty' arguments caused by extra commas. Note +% also that each macro receives \emph{exactly} the tokens that you +% specify as arguments, no premature expansion is done. +% +% \begin{verbatim} +% \def\dpcgraphics{\@ifnextchar[\@dpcgraphics{\@dpcgraphics[]}} +% \def\@dpcgraphics[#1]#2{{\setkeys{dpc}{#1}INPUT: #2}} +% +% \define@key{dpc}{scale}{scale ({\tt\string#1\relax})\\} +% \define@key{dpc}{clip}[true]{clip ({\tt\string#1\relax})\\} +% \end{verbatim} +% +% \begin{minipage}{.4\textwidth} +% \begin{verbatim} +% \def\scalemacro{9} +% \dpcgraphics +% [ height =4in, , +% width = 3in, +% scale = \scalemacro, +% bb = 20 20 300 400 , +% clip, +% ]{aaa} +% \end{verbatim} +% \end{minipage} +% \hfill +% \begin{minipage}{.4\textwidth} +% \def\scalemacro{9} +%\dpcgraphics +% [ height =4in, , +% width = 3in, +% scale = \scalemacro , +% bb = 20 20 300 400 , +% clip , +% ]{aaa} +% \end{minipage} +% +% +% \section{The Internal Interface} +% A declaration of the form:\\ +% |\define@key{family}{key}{...}|\\ +% Defines a macro |\KV@prefix@key| with one argument. When used in a +% keyval list, the macro receives the value as its argument. +% +% A declaration of the form:\\ +% |\define@key{family}{key}[default]{...}|\\ +% Defines a macro |\KV@family@key| as above, however it also defines the +% macro |\KV@family@key@default| as a macro with no arguments, and +% definition\\ +% |\KV@family@key{default}|. +% +% Thus if macros are defined using |\define@key|, the use of a key with +% no value \ldots|,foo,|\ldots\ is always equivalent to the use of the +% key with some value, \ldots|,foo=default,|\ldots. However a package +% writer may wish that the `default' behaviour for some key is not +% directly equivalent to using that key with a value. (In particular, as +% pointed out to me by Timothy Van Zandt, you may wish to omit error +% checking on the default value as you know it is correct.) In these +% cases one simply needs to define the two macros +% |\KV@|\meta{family}|@key| and |\KV@|\meta{family}|@key@default| +% directly using |\def| (or |\newcommand|). I do not supply a user +% interface for this type of definition, but it is supported in the +% sense that I will try to ensure that any future upgrades of this +% package do not break styles making use of these `low level' +% definitions. +% +% \StopEventually{} +% +% \section{The Macros} +% +% From version~1.05, all `internal' macros associated to keys have names +% of the form:\\ +% |\KV@|\meta{family}|@|\meta{key} or +% |\KV@|\meta{family}|@|\meta{key}|@|\meta{default} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \begin{macro}{\setkeys} +% The top level macro. |#2| should be a comma separated values of the +% form \meta{key} |=| \meta{value} or just simply \meta{key}. +% The macro associated with this key in the `family' |#1| is called with +% argument \meta{value}. The second form is only allowed if the key was +% declared with a default value. +% \begin{macrocode} +\def\setkeys#1#2{% +% \end{macrocode} +% Save the `family' for later. Then begin acting on the comma +% separated list. +% \changes{v1.11}{1998/06/05} +% {Make \cs{@tempc} safe (in case it is an \cs{if}.} +% \begin{macrocode} + \def\KV@prefix{KV@#1@}% + \let\@tempc\relax + \KV@do#2,\relax,} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\KV@do} +% Iterate down the list of comma separated argument pairs. +% \begin{macrocode} +\def\KV@do#1,{% + \ifx\relax#1\empty\else + \KV@split#1==\relax + \expandafter\KV@do\fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\KV@split} +% Split up the keyword and value, and call the appropriate command. +% This macro was slightly reorganised for version 1.04, after some +% suggestions from Timothy Van Zandt. +% \begin{macrocode} +\def\KV@split#1=#2=#3\relax{% + \KV@@sp@def\@tempa{#1}% + \ifx\@tempa\@empty\else + \expandafter\let\expandafter\@tempc + \csname\KV@prefix\@tempa\endcsname + \ifx\@tempc\relax +%<plain> \KV@err +%<!plain> \KV@errx + {\@tempa\space undefined}% + \else + \ifx\@empty#3\@empty + \KV@default + \else + \KV@@sp@def\@tempb{#2}% + \expandafter\@tempc\expandafter{\@tempb}\relax + \fi + \fi + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\KV@default} +% Run the default code, or raise an error. +% \begin{macrocode} +\def\KV@default{% + \expandafter\let\expandafter\@tempb + \csname\KV@prefix\@tempa @default\endcsname + \ifx\@tempb\relax + \KV@err{No value specified for \@tempa}% + \else + \@tempb\relax + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\KV@err} +% \changes{v1.10}{1997/11/10} +% {Use \cs{PackageError}} +% \changes{v1.12}{1998/11/18} +% {Option system added} +% Error messages. +% \begin{macrocode} +%<plain>\def\KV@err#1{\errmessage{key-val: #1}} +%<*!plain> +\DeclareOption{unknownkeysallowed}{% + \def\KV@errx#1{\PackageInfo{keyval}{#1}}} +\DeclareOption{unknownkeyserror}{% + \def\KV@errx#1{\PackageError{keyval}{#1}\@ehc}} +\ExecuteOptions{unknownkeyserror} +\let\KV@err\KV@errx +\ProcessOptions +%</!plain> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\KV@@sp@def} +% \changes{v1.10}{1997/11/10} +% {Reorganise to not require doubled hash tokens, and to not +% lose initial brace groups.} +% \begin{macro}{\KV@@sp@b} +% \begin{macro}{\KV@@sp@c} +% \begin{macro}{\KV@@sp@d} +% |\KV@@sp@def|\meta{cmd}\meta{token list} is like |\def|, except that +% a space token at the beginning or end of \meta{token list} is +% removed before making the assignment. \meta{token list} may not +% contain the token |\@nil|, unless it is within a brace group. +% The names of these commands were changed at version~1.05 to ensure +% that they do not clash with `internal' macros in a key family `sp'. +% +% Since v1.10, |#| may appear in the second argument without it +% needing to be doubled as |##|. Also earlier versions would +% drop any initial brace group, so |{abc}d| would incorrectly +% be treated as |abcd|. The current version only removes brace +% groups that surround the entire value, so |{abcd}| \emph{is} treated +% correctly as |abcd|. In fact, two levels of bracing are removed, if +% you require the entire argument to be a single brace group, you must +% use |{{{abcd}}}|. +% +% \begin{macrocode} +\def\@tempa#1{% +% \end{macrocode} +% +% \begin{macrocode} +\def\KV@@sp@def##1##2{% + \futurelet\KV@tempa\KV@@sp@d##2\@nil\@nil#1\@nil\relax##1}% +% \end{macrocode} +% +% Early release removed initial space by having an `extra' argument +% in |\KV@@sp@b| but that removed too many braces, so now make +% |\KV@@sp@b| explicitly remove a single space token. That unfortunately +% means we need the new |\KV@@sp@d| command to add a space token if +% one was not there before. +% \begin{macrocode} +\def\KV@@sp@d{% + \ifx\KV@tempa\@sptoken + \expandafter\KV@@sp@b + \else + \expandafter\KV@@sp@b\expandafter#1% + \fi}% +% \end{macrocode} +% +% \begin{macrocode} +\def\KV@@sp@b#1##1 \@nil{\KV@@sp@c##1}% +% \end{macrocode} +% +% \begin{macrocode} +%<plain>\def\@sptoken{#1}% +% \end{macrocode} +% +% Make the above definitions, inserting the space token where needed. +% \begin{macrocode} + } +\@tempa{ } +% \end{macrocode} +% +% \begin{macrocode} +\def\KV@@sp@c#1\@nil#2\relax#3{\KV@toks@{#1}\edef#3{\the\KV@toks@}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\KV@toks@} +% Macro register used above to prevent |#| doubling. +% Avoid uding one of the normal scratch registers, as this code +% is not in a local group. +% \begin{macrocode} +\newtoks\KV@toks@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\define@key} +% Define the command associated to the key |#2| in the family |#1|. +% First looks for a default argument (the default value for the +% key) +% \begin{macrocode} +\def\define@key#1#2{% + \@ifnextchar[{\KV@def{#1}{#2}}{\@namedef{KV@#1@#2}####1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\KV@def} +% Make the definitions of the command, and the default value. +% \begin{macrocode} +\def\KV@def#1#2[#3]{% + \@namedef{KV@#1@#2@default\expandafter}\expandafter + {\csname KV@#1@#2\endcsname{#3}}% + \@namedef{KV@#1@#2}##1} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% \Finale +% +\endinput diff --git a/Master/texmf-dist/source/latex/graphics/lscape.dtx b/Master/texmf-dist/source/latex/graphics/lscape.dtx new file mode 100644 index 00000000000..9168ec24425 --- /dev/null +++ b/Master/texmf-dist/source/latex/graphics/lscape.dtx @@ -0,0 +1,134 @@ +% +% \iffalse +% +%% lscape.dtx Copyright (C) 1994 1999-2000 David Carlisle +%% +%% This file is part of the Standard LaTeX `Graphics Bundle'. +%% It may be distributed under the terms of the LaTeX Project Public +%% License, as described in lppl.txt in the base LaTeX distribution. +%% Either version 1.0 or, at your option, any later version. +%% +%<*dtx> + \ProvidesFile{lscape.dtx} +%</dtx> +%<package>\NeedsTeXFormat{LaTeX2e}[1994/06/01] +%<package>\ProvidesPackage{lscape} +%<driver> \ProvidesFile{lscape.drv} +% \fi +% \ProvidesFile{lscape.dtx} + [2000/10/22 v3.01 Landscape Pages (DPC)] +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\usepackage{lscape} +\begin{document} + \DocInput{lscape.dtx} +\end{document} +%</driver> +% \fi +% +% \GetFileInfo{lscape.dtx} +% +% \title{The \textsf{lscape} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{D. P. Carlisle} +% \date{\filedate} +% +% \CheckSum{69} +% +% \begin{landscape} +% \maketitle +% +% All text, within the \texttt{landscape} environment is rotated through +% 90 degrees. The environment may span several pages. It works well +% with, and was originally created for, use with \textsf{longtable} to +% produce long wide tables. +% +% All the work is done by the \textsf{graphics} package, the trick is to +% call it at the right place in the output routine to rotate the current +% page before the page head and foot are added. +% +% +% \StopEventually{\end{landscape}} +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \changes{v1.00}{1992/04/28}{Initial release} +% \changes{v2.00}{1992/11/18}{Support for footnotes and floats. +% Special thanks to Sarah J. McQuay for testing this release} +% \changes{v3.00}{1994/10/05}{Update using LaTeX2e graphics package} +% \changes{v3.01}{1999/06/22}{Added better pdfTeX support +% by Scott Pakin, from graphics/3063} +% +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% Here is what Scott Pakin wrote about the pdftex option: +% \begin{quote} +% I've made a minor improvement to lscape.dtx that I'd like to share +% with the world. My addition makes lscape rotate the PDF "paper" -- +% not just the text on the page -- when given the "pdftex" option. +% (Naturally, this works only with pdfLaTeX.) The result is that the +% text is viewable online without the reader having to rotate his/her +% head 90 degrees. The document still prints normally. +% \end{quote} +% +% +% \begin{macrocode} +\newif\ifGin@pdftex +\Gin@pdftexfalse +\DeclareOption{pdftex}{% + \PassOptionsToPackage\CurrentOption{graphics} + \Gin@pdftextrue +} +\DeclareOption*{\PassOptionsToPackage\CurrentOption{graphics}} +\ProcessOptions +\RequirePackage{graphics} +% \end{macrocode} +% +% \begin{macrocode} +\let\LS@makecol=\@makecol +\let\LS@makefcolumn=\@makefcolumn +\def\LS@rot{% + \setbox\@outputbox\vbox{\hbox{\rotatebox{90}{\box\@outputbox}}}} +% \end{macrocode} +% +% First set up the page size for landscape. +% \begin{macrocode} +\def\landscape{% + \clearpage + \begingroup + \vsize=\textwidth + \hsize=\textheight + \linewidth=\hsize + \columnwidth=\hsize + \@colroom=\vsize + \textheight=\vsize + \@colht=\vsize +% \end{macrocode} +% Rotate the page body (text and float pages). +% \begin{macrocode} + \def\@makecol{\LS@makecol\LS@rot}% + \def\@makefcolumn##1{\LS@makefcolumn{##1}\LS@rot}} +% \end{macrocode} +% +% Restore everything. This is where the pdftex option makes a +% difference. +% \begin{macrocode} +\def\endlandscape{% + \ifGin@pdftex + \pdfpageattr{/Rotate 90} + \fi + \clearpage + \endgroup + \global\@colht=\textheight + \global\vsize=\textheight + \global\@colroom=\textheight} +%</package> +% \end{macrocode} +% +% +% \Finale +% diff --git a/Master/texmf-dist/source/latex/graphics/pstcol.dtx b/Master/texmf-dist/source/latex/graphics/pstcol.dtx new file mode 100644 index 00000000000..7fba93a1dd1 --- /dev/null +++ b/Master/texmf-dist/source/latex/graphics/pstcol.dtx @@ -0,0 +1,159 @@ +% +% \iffalse +% +%% pstcol.dtx Copyright (C) 1994--1996 1999 David Carlisle +%% +%% This file is part of the Standard LaTeX `Graphics Bundle'. +%% It may be distributed under the terms of the LaTeX Project Public +%% License, as described in lppl.txt in the base LaTeX distribution. +%% Either version 1.0 or, at your option, any later version. +%% +%<*dtx> + \ProvidesFile{pstcol.dtx} +%</dtx> +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{pstcol} +%<driver> \ProvidesFile{pstcol.drv} +% \fi +% \ProvidesFile{pstcol.dtx} + [2001/06/20 v1.1 PSTricks color colompatibility (DPC)] +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\begin{document} +\DocInput{pstcol.dtx} +\end{document} +%</driver> +% \fi +% +% \CheckSum{98} +% +% \GetFileInfo{pstcol.dtx} +% +% \changes{v0.1}{1994/10/27} +% {Initial version} +% \changes{v1.0}{1996/10/28} +% {Documentation improvements} +% +% \title{\textsf{pstcol} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{David Carlisle} +% \date{\filedate} +% +% +% \maketitle +% +% \begin{abstract} +% Hopefully temporary package modifying PSTricks colour interface to +% work with standard LaTeX colours. +% \end{abstract} +% +% \StopEventually{} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% Require PSTricks +%%%%%%%%%%%%%%%%%% +% \begin{macrocode} +\let\saved@gray\color@gray +\RequirePackage{pstricks} +\let\color@gray\saved@gray +% \end{macrocode} +% +% Require Colour +%%%%%%%%%%%%%%%% +% \begin{macrocode} +\DeclareOption*{\PassOptionsToPackage\CurrentOption{color}} +\ProcessOptions +\RequirePackage{color} +% \end{macrocode} +% +% Redefine PST access functions in terms of color.sty +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \begin{macrocode} +\def\pst@getcolor#1#2{% +\@ifundefined{\string\color@#1}% +{\@pstrickserr{Color `#1' not defined}\@eha}% + {\edef#2{\expandafter\expandafter\expandafter + \c@lor@to@ps\csname\string\color @#1\endcsname\@@}}} +% \end{macrocode} +% +% \begin{macrocode} +\def\pst@usecolor#1{#1\space} +% \end{macrocode} +% +% Redefine some predefined colors that are in pst but not in color.sty +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \begin{macrocode} +\definecolor{darkgray}{gray}{.25} +\definecolor{gray}{gray}{.5} +\definecolor{lightgray}{gray}{.75} +\definecolor{gradbegin}{rgb}{0,1,1} +\definecolor{gradend}{rgb}{0,.1,.95} +% \end{macrocode} +% +% Redeclare the default colours with the new definitions +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \begin{macrocode} +\psset@bordercolor{white} +\psset@doublecolor{white} +\psset@linecolor{black} +\psset@fillcolor{white} +\psset@hatchcolor{black} +\psset@gridcolor{black} +\psset@gridlabelcolor{black} +\psset@shadowcolor{darkgray} +\psset@subgridcolor{gray} +% \end{macrocode} +% +% +% Redefine the PST user-definition commands in terms of |\definecolor| +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \begin{macrocode} +\def\newgray#1{% + \definecolor{#1}{gray}} +% \end{macrocode} +% +% \begin{macrocode} +\def\newrgbcolor#1#2{% + \newrgbcolorx{#1}#2\@@} +\def\newrgbcolorx#1#2 #3 #4\@@{% + \definecolor{#1}{rgb}{#2,#3,#4}} +% \end{macrocode} +% +% \begin{macrocode} +\def\newcmykcolor#1#2{% + \newcmykcolorx{#1}#2\@@} +\def\newcmykcolorx#1#2 #3 #4 #5\@@{% + \definecolor{#1}{cmyk}{#2,#3,#4,#5}} +% \end{macrocode} +% +% \changes{v1.1}{2001/06/20}{Added redefinitions for PSTricks' +% predefined color commands (CAR) graphics/3233} +% Finally, redefine some predefined user commands from pst +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \begin{macrocode} +\renewcommand\black {\color{black}} +\renewcommand\darkgray {\color{darkgray}} +\renewcommand\gray {\color{gray}} +\renewcommand\lightgray{\color{lightgray}} +\renewcommand\white {\color{white}} +\renewcommand\blue {\color{blue}} +\renewcommand\red {\color{red}} +\renewcommand\green {\color{green}} +\renewcommand\yellow {\color{yellow}} +\renewcommand\magenta {\color{magenta}} +\renewcommand\cyan {\color{cyan}} +% \end{macrocode} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \Finale +% + diff --git a/Master/texmf-dist/source/latex/graphics/trig.dtx b/Master/texmf-dist/source/latex/graphics/trig.dtx new file mode 100644 index 00000000000..8540ec3dee7 --- /dev/null +++ b/Master/texmf-dist/source/latex/graphics/trig.dtx @@ -0,0 +1,308 @@ +% \iffalse +%% File: trig.dtx Copyright (C) 1993 1994 1995 1996 1997 1999 David Carlisle +%% +%% This file is part of the Standard LaTeX `Graphics Bundle'. +%% It may be distributed under the terms of the LaTeX Project Public +%% License, as described in lppl.txt in the base LaTeX distribution. +%% Either version 1.0 or, at your option, any later version. +%% +% +%<*dtx> + \ProvidesFile{trig.dtx} +%</dtx> +%<*!plain> +%<package&!plain>\NeedsTeXFormat{LaTeX2e} +%<package&!plain>\ProvidesPackage{trig} +%<driver> \ProvidesFile{trig.drv} +% \fi +% \ProvidesFile{trig.dtx} + [1999/03/16 v1.09 sin cos tan (DPC)] +% +% \iffalse +%</!plain> +%<*driver> +\documentclass{ltxdoc} +\usepackage{trig} +\begin{document} + \DocInput{trig.dtx} +\end{document} +%</driver> +% \fi +% +% \GetFileInfo{trig.dtx} +% \title{The \textsf{trig} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{David Carlisle} +% \date{\filedate} +% \maketitle +% +% \CheckSum{246} +% +% \changes{v1.00}{1993/00/00}{Undocumented versions} +% \changes{v1.05}{1993/10/07}{Documented, added tan} +% \changes{v1.06}{1994/02/01}{Update for LaTeX2e} +% \changes{v1.07}{1994/03/15}{Use ltxdoc} +% \changes{v1.08}{1994/10/16}{Change \cs{@xc} to \cs{nin@ty}} +% +% \section{Introduction} +% +% These macros implement the trigonometric functions, sin, cos and tan. +% In each case two commands are defined. For instance the command +% |\CalculateSin{33}| may be isued at some point, and then anywhere +% later in the document, the command |\UseSin{33}| will return the +% decimal expansion of $\sin(33^\circ)$. +% +% The arguments to these macros do not have to be whole numbers, +% although in the case of whole numbers, \LaTeX\ or plain \TeX\ counters +% may be used. In \TeX{}Book syntax, arguments must be of type: +% \meta{optional signs}\meta{factor} +% +% Some other examples are:\\ +% |\CalculateSin{22.5}|, |\UseTan{\value{mycounter}}|, +% |\UseCos{\count@}|. +% +% Note that unlike the psfig macros, these save all previously +% computed values. This could easily be changed, but I thought that in +% many applications one would want many instances of the +% same value. (eg rotating all the headings of a table by the +% \emph{same} amount). +% +% I don't really like this need to pre-calculate the values, I +% originally implemented |\UseSin| so that it automatically calculated +% the value if it was not pre-stored. This worked fine in testing, until +% I remembered why one needs these values. You want to be able to say +% |\dimen2=\UseSin{30}\dimen0|. Which means that |\UseSin| must +% \emph{expand} to a \meta{factor}. +% +% \StopEventually{} +% +% \section{The Macros} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \begin{macro}{\nin@ty}\begin{macro}{\@clxx} +% \begin{macro}{\@lxxi}\begin{macro}{\@mmmmlxviii} +% Some useful constants for converting between degrees and radians. +% $$\frac{\pi}{180}\simeq\frac{355}{113\times180}=\frac{71}{4068}$$ +% \begin{macrocode} +\chardef\nin@ty=90 +\chardef\@clxx=180 +\chardef\@lxxi=71 +\mathchardef\@mmmmlxviii=4068 +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% The approximation to $\sin$. I experimented with various +% approximations based on Tchebicheff polynomials, and also some +% approximations from a SIAM handbook `Computer Approximations' However +% the standard Taylor series seems sufficiently accurate, and used by +% far the fewest \TeX\ tokens, as the coefficients are all rational. +% \begin{eqnarray*} +% \sin(x)& \simeq& x - (1/3!)x^3 + (1/5!)x^5 - (1/7!)x^7 + (1/9!)x^9\\ +% &\simeq&\frac{((((7!/9!x^2-7!/7!)x^2+7!/5!)x^2 +7!/3!)x^2+7!/1!)x} +% {7!}\\ +% &=&\frac{((((1/72x^2-1)x^2+42)x^2 +840)x^2+5040)x} +% {5040} +% \end{eqnarray*} +% The nested form used above reduces the number of operations required. +% In order to further reduce the number of operations, and more +% importantly reduce the number of tokens used, we can precompute the +% coefficients. Note that we can not use $9!$ as the denominator as +% this would cause overflow of \TeX's arithmetic. +% \begin{macro}{\@coeffz}\begin{macro}{\@coeffa}\begin{macro}{\@coeffb} +% \begin{macro}{\@coeffc}\begin{macro}{\@coeffd} +% Save the coefficients as |\|(|math|)|char|s. +% \begin{macrocode} +\chardef\@coeffz=72 +%\chardef\@coefa=1 +\chardef\@coefb=42 +\mathchardef\@coefc=840 +\mathchardef\@coefd=5040 +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\TG@rem@pt} +% The standard trick of getting a real number out of a \meta{dimen}. +% This gives a maximum accuracy of approx.\ 5 decimal places, which +% should be sufficient. It puts a space after the number, perhaps it +% shouldn't. +% \begin{macrocode} +{\catcode`t=12\catcode`p=12\gdef\noPT#1pt{#1}} +\def\TG@rem@pt#1{\expandafter\noPT\the#1\space} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TG@term} +% Compute one term of the above nested series. Multiply the previous sum +% by $x^2$ (stored in |\@tempb|, then add the next coefficient, |#1|. +% \begin{macrocode} +\def\TG@term#1{% + \dimen@\@tempb\dimen@ + \advance\dimen@ #1\p@} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TG@series} +% Compute the above series. the value in degrees will be in |\dimen@| +% before this is called. +% \begin{macrocode} +\def\TG@series{% + \dimen@\@lxxi\dimen@ + \divide \dimen@ \@mmmmlxviii +% \end{macrocode} +% |\dimen@| now contains the angle in radians, as a \meta{dimen}. We +% need to remove the units, so store the same value as a \meta{factor} +% in |\@tempa|. +% \begin{macrocode} + \edef\@tempa{\TG@rem@pt\dimen@}% +% \end{macrocode} +% Now put $x^2$ in |\dimen@| and |\@tempb|. +% \begin{macrocode} + \dimen@\@tempa\dimen@ + \edef\@tempb{\TG@rem@pt\dimen@}% +% \end{macrocode} +% The first coefficient is $1/72$. +% \begin{macrocode} + \divide\dimen@\@coeffz + \advance\dimen@\m@ne\p@ + \TG@term\@coefb + \TG@term{-\@coefc}% + \TG@term\@coefd +% \end{macrocode} +% Now the cubic in $x^2$ is completed, so we need to multiply by $x$ and +% divide by $7!$. +% \begin{macrocode} + \dimen@\@tempa\dimen@ + \divide\dimen@ \@coefd} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\CalculateSin} +% If this angle has already been computed, do nothing, else store the +% angle, and call |\TG@@sin|. +% \begin{macrocode} +\def\CalculateSin#1{{% + \expandafter\ifx\csname sin(\number#1)\endcsname\relax + \dimen@=#1\p@\TG@@sin + \expandafter\xdef\csname sin(\number#1)\endcsname + {\TG@rem@pt\dimen@}% + \fi}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\CalculateCos} +% As above, but use the relation $\cos(x) = \sin(90-x)$. +% \begin{macrocode} +\def\CalculateCos#1{{% + \expandafter\ifx\csname cos(\number#1)\endcsname\relax + \dimen@=\nin@ty\p@ + \advance\dimen@-#1\p@ + \TG@@sin + \expandafter\xdef\csname cos(\number#1)\endcsname + {\TG@rem@pt\dimen@}% + \fi}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TG@reduce} +% Repeatedly use one of the the relatations +% $\sin(x)=\sin(180-x)=\sin(-180-x)$ to get $x$ in the range $-90 \leq +% x\leq 90$. Then call |\TG@series|. +% \begin{macrocode} +\def\TG@reduce#1#2{% +\dimen@#1#2\nin@ty\p@ + \advance\dimen@#2-\@clxx\p@ + \dimen@-\dimen@ + \TG@@sin} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TG@@sin} +% Slightly cryptic, but it seems to work\ldots +% \begin{macrocode} +\def\TG@@sin{% + \ifdim\TG@reduce>+% + \else\ifdim\TG@reduce<-% + \else\TG@series\fi\fi}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\UseSin} +% \begin{macro}{\UseCos} +% Use a pre-computed value. +% \begin{macrocode} +\def\UseSin#1{\csname sin(\number#1)\endcsname} +\def\UseCos#1{\csname cos(\number#1)\endcsname} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% A few shortcuts to save space. +% \begin{macrocode} +\chardef\z@num\z@ +\expandafter\let\csname sin(0)\endcsname\z@num +\expandafter\let\csname cos(0)\endcsname\@ne +\expandafter\let\csname sin(90)\endcsname\@ne +\expandafter\let\csname cos(90)\endcsname\z@num +\expandafter\let\csname sin(-90)\endcsname\m@ne +\expandafter\let\csname cos(-90)\endcsname\z@num +\expandafter\let\csname sin(180)\endcsname\z@num +\expandafter\let\csname cos(180)\endcsname\m@ne +% \end{macrocode} +% +% \begin{macro}{\CalculateTan} +% Originally I coded the Taylor series for tan, but it seems to be +% more accurate to just take the ratio of the sine and cosine. +% This is accurate to 4 decimal places for angles up to +% $50^\circ$, after that the accuracy tails off, giving +% 57.47894 instead of 57.2900 for $89^\circ$. +% \begin{macrocode} +\def\CalculateTan#1{{% + \expandafter\ifx\csname tan(\number#1)\endcsname\relax + \CalculateSin{#1}% + \CalculateCos{#1}% + \@tempdima\UseCos{#1}\p@ + \divide\@tempdima\@iv + \@tempdimb\UseSin{#1}\p@ + \@tempdimb\two@fourteen\@tempdimb + \divide\@tempdimb\@tempdima + \expandafter\xdef\csname tan(\number#1)\endcsname + {\TG@rem@pt\@tempdimb}% + \fi}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\UseTan} +% Just like |\UseSin|. +% \begin{macrocode} +\def\UseTan#1{\csname tan(\number#1)\endcsname} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\two@fourteen} +% \begin{macro}{\@iv} +% two constants needed to keep the division within \TeX's range. +% \begin{macrocode} +\mathchardef\two@fourteen=16384 +\chardef\@iv=4 +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% Predefine $\tan(\pm90)$ to be an error. +% \begin{macrocode} +\expandafter\def\csname tan(90)\endcsname{\errmessage{Infinite tan !}} +\expandafter\let\csname tan(-90)\expandafter\endcsname + \csname tan(90)\endcsname +% \end{macrocode} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \Finale +% +\endinput |