| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% graphicx-psmin package by Hendri Adriaens. |
| 4 |
% |
| 5 |
% Extract package files and examples and create documentation: |
| 6 |
% latex graphicx-psmin.dtx |
| 7 |
% latex graphicx-psmin.dtx |
| 8 |
% bibtex graphicx-psmin |
| 9 |
% makeindex -s gglo.ist -o graphicx-psmin.gls graphicx-psmin.glo |
| 10 |
% makeindex -s gind.ist -o graphicx-psmin.ind graphicx-psmin.idx |
| 11 |
% latex graphicx-psmin.dtx |
| 12 |
% latex graphicx-psmin.dtx |
| 13 |
% |
| 14 |
% To finish the installation you have to move the following |
| 15 |
% file into a directory searched by LaTeX: |
| 16 |
% graphicx-psmin.sty |
| 17 |
% |
| 18 |
%% --------------------------------------- |
| 19 |
%% Copyright (C) 2005-2020 Hendri Adriaens |
| 20 |
%% --------------------------------------- |
| 21 |
%% |
| 22 |
%% This work may be distributed and/or modified under the |
| 23 |
%% conditions of the LaTeX Project Public License, either version 1.3 |
| 24 |
%% of this license or (at your option) any later version. |
| 25 |
%% The latest version of this license is in |
| 26 |
%% http://www.latex-project.org/lppl.txt |
| 27 |
%% and version 1.3 or later is part of all distributions of LaTeX |
| 28 |
%% version 2003/12/01 or later. |
| 29 |
%% |
| 30 |
%% This work has the LPPL maintenance status "maintained". |
| 31 |
%% |
| 32 |
%% This Current Maintainer of this work is Hendri Adriaens. |
| 33 |
%% |
| 34 |
%% This work consists of the file graphicx-psmin.dtx and derived file |
| 35 |
%% graphicx-psmin.sty. |
| 36 |
%% |
| 37 |
%% The following files constitute the graphicx-psmin bundle and must be |
| 38 |
%% distributed as a whole: readme, graphicx-psmin.pdf, graphicx-psmin.sty |
| 39 |
%% and graphicx-psmin.dtx. |
| 40 |
%% |
| 41 |
% \fi |
| 42 |
% |
| 43 |
% \iffalse |
| 44 |
%<*batchfile> |
| 45 |
\begingroup |
| 46 |
\input docstrip |
| 47 |
\keepsilent |
| 48 |
\preamble |
| 49 |
\endpreamble |
| 50 |
\askforoverwritefalse |
| 51 |
\generate{ |
| 52 |
\file{graphicx-psmin.sty}{\from{graphicx-psmin.dtx}{graphicx-psmin}} |
| 53 |
\file{gxpsmpream.ble}{\from{graphicx-psmin.dtx}{preamble}} |
| 54 |
\file{graphicx-psmin.bib}{\from{graphicx-psmin.dtx}{bib}} |
| 55 |
} |
| 56 |
\endgroup |
| 57 |
%</batchfile> |
| 58 |
%<*driver> |
| 59 |
\documentclass[a4paper]{ltxdoc} |
| 60 |
\input{gxpsmpream.ble} |
| 61 |
\begin{document} |
| 62 |
\DocInput{graphicx-psmin.dtx} |
| 63 |
\let\Section\section\def\section*#1{\Section*{#1}\addcontentsline{toc}{section}{#1}} |
| 64 |
\bibliographystyle{plain} |
| 65 |
\bibliography{graphicx-psmin} |
| 66 |
\section*{Acknowledgements} |
| 67 |
The author is grateful to Thomas Greer and Uwe Kern for help and |
| 68 |
suggestions. Many thanks to Akira Kakuto for providing a dvips patch |
| 69 |
which makes this package possible. The author is greatly indebted to |
| 70 |
Karl Berry for support and for providing a test environment for the |
| 71 |
dvips patch on the TUG server. Finally a word of thanks for David Carlisle |
| 72 |
for providing a fix to make the package work with the latest \pf{graphicx} |
| 73 |
package. |
| 74 |
\PrintChangesX\PrintIndexX |
| 75 |
\end{document} |
| 76 |
%</driver> |
| 77 |
% \fi |
| 78 |
% |
| 79 |
% \changes{v1.0}{2005/08/18}{Initial release} |
| 80 |
% |
| 81 |
% \GetFileInfo{graphicx-psmin.sty} |
| 82 |
% |
| 83 |
% \CheckSum{310} |
| 84 |
% |
| 85 |
% \CharacterTable |
| 86 |
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
| 87 |
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z |
| 88 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 89 |
% Exclamation \! Double quote \" Hash (number) \# |
| 90 |
% Dollar \$ Percent \% Ampersand \& |
| 91 |
% Acute accent \' Left paren \( Right paren \) |
| 92 |
% Asterisk \* Plus \+ Comma \, |
| 93 |
% Minus \- Point \. Solidus \/ |
| 94 |
% Colon \: Semicolon \; Less than \< |
| 95 |
% Equals \= Greater than \> Question mark \? |
| 96 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 97 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 98 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 99 |
% Right brace \} Tilde \~} |
| 100 |
% |
| 101 |
%\title{\vspace*{-1cm}The \pf{graphicx-psmin} package |
| 102 |
%\thanks{This package can be downloaded from the CTAN mirrors: |
| 103 |
%\texttt{/macros/latex/contrib/graphicx-psmin}. See \texttt{graphicx-psmin.dtx} |
| 104 |
%for information on installing \pf{graphicx-psmin} into your \TeX\ or \LaTeX\ |
| 105 |
%distribution and for the license of this package.}} |
| 106 |
%\author{\mktitledecor Hendri Adriaens} |
| 107 |
%\date{\fileversion\ (\filedate)} |
| 108 |
%\maketitle |
| 109 |
% |
| 110 |
%\begin{abstract}\noindent |
| 111 |
%This package is an extension of the standard \pf{graphics} bundle |
| 112 |
%\cite{graphics} and provides a way to include repeated PostScript |
| 113 |
%graphics (ps, eps) only once in a PostScript document. This provides |
| 114 |
%a way to get smaller PostScript documents when having, for instance, |
| 115 |
%a logo on every page. This package only works when post-processed |
| 116 |
%with dvips, \emph{which should at least have version 5.95b!} The |
| 117 |
%difference for the pdf file is minimal (as Ghostscript already |
| 118 |
%includes only a single copy of graphics files). |
| 119 |
%\end{abstract} |
| 120 |
% |
| 121 |
%\begin{multicols}{2} |
| 122 |
%[\section*{Contents} |
| 123 |
%\setlength{\columnseprule}{.4pt} |
| 124 |
%\setlength{\columnsep}{18pt}] |
| 125 |
%\tableofcontents |
| 126 |
%\end{multicols} |
| 127 |
% |
| 128 |
%\section{Introduction}\label{sec:intro} |
| 129 |
%Including a PostScript graphic only once in a PostScript document |
| 130 |
%has been a hot issue for a long time in the \LaTeX\ world. It pops |
| 131 |
%up regularly at many newsgroups, but never a fully satisfying answer |
| 132 |
%was supplied. Some answers vaguely describe some |\special| |
| 133 |
%commands, but do not give the details, some suggest to use a \TeX\ |
| 134 |
%box (which does prevent \LaTeX\ from reading the graphic many times, |
| 135 |
%but still includes it many times in the PostScript) and some do |
| 136 |
%suggest to modify the PostScript file manually, which is far too |
| 137 |
%cumbersome. This package is an extension of the standard |
| 138 |
%\pf{graphics} bundle \cite{graphics} and supplies an automated |
| 139 |
%method to do this job. |
| 140 |
% |
| 141 |
%The technique used by this package has been described by Thomas |
| 142 |
%Greer \cite{greer} (see for more details \cite{PLRM}). The |
| 143 |
%implementation in \LaTeX\ boils down to the following steps. |
| 144 |
%\begin{enumerate} |
| 145 |
%\item Scan the graphics file for the bounding box. |
| 146 |
%\item Wrap the graphics file in a PostScript function that defines it |
| 147 |
%as an object which can be used multiple times. This function needs |
| 148 |
%the bounding box. |
| 149 |
%\item Write the entire code to the header of the PostScript file, |
| 150 |
%via the dvi file, using |\special|s. |
| 151 |
%\end{enumerate} |
| 152 |
%This will load the graphic in the header of the PostScript file. |
| 153 |
%When reusing the graphic, there is another PostScript function to be |
| 154 |
%inserted which will load the graphic from the graphic object. |
| 155 |
% |
| 156 |
%In this scheme, step 2 is the hardest one. The first implementation |
| 157 |
%of this method in this package attempted to load the entire graphics |
| 158 |
%file, line by line (which is slow), in a macro, add the necessary |
| 159 |
%PostScript code and write the content of the macro to the dvi using |
| 160 |
%|\special{!...}|. Unfortunately, this didn't work as dvips applied |
| 161 |
%its own line breaking mechanism to the content without taking into |
| 162 |
%account manual line breaks. This meant that the content of the |
| 163 |
%graphics file was modified when it arrived in the PostScript |
| 164 |
%document, often too much to be processed successfully again. |
| 165 |
% |
| 166 |
%The second attempt in this package wrote the entire graphics file to |
| 167 |
%hard disk, together with the PostScript function so that it could be |
| 168 |
%loaded using |\special{header=...}|. Besides still being slow, this |
| 169 |
%also meant a lot of hard disk overhead. |
| 170 |
% |
| 171 |
%After some discussion with Karl Berry a proposal for extending the |
| 172 |
%header special was posted on the \TeX-k mailinglist. The alternative |
| 173 |
%of changing the line breaking mechanism of dvips was not considered |
| 174 |
%as that could change the behavior in existing documents. The |
| 175 |
%proposal was to extend the header special by allowing |
| 176 |
%\begin{example} |
| 177 |
% \special{header={some file.ps} pre={pre code} post={post code}} |
| 178 |
%\end{example} |
| 179 |
%The package uses the two extra parameters in this special to pass |
| 180 |
%the PostScript function that will make an object of the graphics |
| 181 |
%file in |some file.ps| to the PostScript file. The |header| itself |
| 182 |
%still copies the file directly into the PostScript file, which |
| 183 |
%avoids needing to read the entire file with \TeX. |
| 184 |
% |
| 185 |
%As mentioned in the abstract, this only works when post-processed |
| 186 |
%with dvips, \emph{version v5.95b or newer!} It will, in general, not |
| 187 |
%make a significant difference in the size of your pdf file generated |
| 188 |
%by ps2pdf (Ghostscript).\footnote{As Ghostscript already embeds |
| 189 |
%graphics with size larger than \texttt{MaxInlineImageSize} only once |
| 190 |
%in the pdf.} However, it will decrease the size of your PostScript |
| 191 |
%file if you use the same graphic over and over in your document. |
| 192 |
% |
| 193 |
%\section{Using the package}\label{sec:use} |
| 194 |
%Using the package is very simple. Replace the loading of the |
| 195 |
%\pf{graphicx} package, like |
| 196 |
%\begin{example} |
| 197 |
% \usepackage[your options]{graphicx} |
| 198 |
%\end{example} |
| 199 |
%by |
| 200 |
%\begin{example} |
| 201 |
% \usepackage[your options]{graphicx-psmin} |
| 202 |
%\end{example} |
| 203 |
%This will load the \pf{graphicx} package internally, pass on all of |
| 204 |
%the options specified in |your options| to the \pf{graphicx} package |
| 205 |
%(for instance, |draft,dvips|) and make all definitions necessary to |
| 206 |
%do the job. |
| 207 |
% |
| 208 |
%\begin{command} |
| 209 |
% `\cs{loadgraphics}\oarg{bb}\marg{list of graphics}' |
| 210 |
%\end{command} |
| 211 |
%\DescribeMacro{\loadgraphics} Each graphic that you want to reuse in |
| 212 |
%the document, but which you want to be included only once, should be |
| 213 |
%listed in the command |\loadgraphics|. This command can only be used |
| 214 |
%\emph{in the preamble} of your document. Example: |
| 215 |
%\begin{example} |
| 216 |
% \loadgraphics{mylogo1.ps,mylogo2.eps} |
| 217 |
%\end{example} |
| 218 |
%If a graphics file does not contain a bounding box, you can include |
| 219 |
%that in the optional argument. This argument will be used for every |
| 220 |
%graphic in the list. Example |
| 221 |
%\begin{example} |
| 222 |
% \loadgraphics[0 0 250 420]{mylogo1.ps,mylogo2.eps} |
| 223 |
% \loadgraphics{mylogo3.ps} |
| 224 |
%\end{example} |
| 225 |
% |
| 226 |
%\DescribeMacro{\includegraphics} |
| 227 |
%That's all! You can use the usual \pf{graphicx} |\includegraphics| |
| 228 |
%command to include and scale or rotate your graphics. This command |
| 229 |
%will pick up the loaded graphics and use a PostScript function to |
| 230 |
%insert the graphic from the PostScript header. If the graphic has not |
| 231 |
%been loaded with |\loadgraphic|, the |\includegraphics| command |
| 232 |
%works as usual (see also the \pf{graphicx} documentation |
| 233 |
%\cite{graphics} or a \LaTeX\ manual like \cite{companion}). |
| 234 |
% |
| 235 |
%If the graphic does not contain bounding box information, then this |
| 236 |
%should be included in the |\loadgraphics| command as described |
| 237 |
%above. You can include it in the |\includegraphics| command as well, |
| 238 |
%but if the two bounding boxes are not equal, the result might be |
| 239 |
%unexpected. |
| 240 |
% |
| 241 |
%As mentioned before, the package only works with the dvips driver, |
| 242 |
%version 5.95b or newer. When running \LaTeX\ (not pdf\LaTeX), the |
| 243 |
%dvips driver will be loaded automatically by \pf{graphicx}, but you |
| 244 |
%can also specify it yourself when loading the \pf{graphicx-psmin} |
| 245 |
%package. Any options that you specify will be passed on to the |
| 246 |
%\pf{graphicx} package. When \pf{graphicx-psmin} finds out that you are |
| 247 |
%using another driver than dvips, it will generate an error message |
| 248 |
%and disable itself, after which the |\loadgraphics| command has no |
| 249 |
%function anymore and all graphics inclusion jobs are left to the |
| 250 |
%\pf{graphicx} package. |
| 251 |
% |
| 252 |
%To finish with, here is another example demonstrating the use of the |
| 253 |
%package. The example assumes that |figure.ps| is present in the |
| 254 |
%|figures| subdirectory and that |graphic.eps| is in the |graphics| |
| 255 |
%subdirectory. |
| 256 |
%\begin{example} |
| 257 |
% \documentclass{article} |
| 258 |
% \usepackage{graphicx-psmin} |
| 259 |
% \graphicspath{{figures/}{graphics/}} |
| 260 |
% \loadgraphics{figure.ps,graphic.eps} |
| 261 |
% \begin{document} |
| 262 |
% \includegraphics[scale=.2]{figure.ps} |
| 263 |
% \includegraphics[scale=.4]{figure.ps}\\ |
| 264 |
% \includegraphics[angle=45]{graphic.eps} |
| 265 |
% \includegraphics[angle=90]{graphic.eps} |
| 266 |
% \end{document} |
| 267 |
%\end{example} |
| 268 |
%When running a file like the one above and generating the PostScript |
| 269 |
%using dvips, one will see that both graphics are included only once |
| 270 |
%in the PostScript document and that including one of those graphics |
| 271 |
%another time, has almost no effect on the size of the generated |
| 272 |
%PostScript document. |
| 273 |
% |
| 274 |
% \StopEventually{} |
| 275 |
% |
| 276 |
% \section{Implementation}\label{sec:imple} |
| 277 |
% \begin{macrocode} |
| 278 |
% Initialize. |
| 279 |
%<*graphicx-psmin> |
| 280 |
\NeedsTeXFormat{LaTeX2e}[1995/12/01] |
| 281 |
\ProvidesPackage{graphicx-psmin} |
| 282 |
[2020/11/14 v1.2 single PostScript graphics inclusion (HA)] |
| 283 |
\DeclareOption*{\PassOptionsToPackage\CurrentOption{graphicx}} |
| 284 |
\ProcessOptions\relax |
| 285 |
\RequirePackage{graphicx} |
| 286 |
% \end{macrocode} |
| 287 |
% Check the requested driver. |
| 288 |
% \begin{macrocode} |
| 289 |
\def\gxpsm@tempa{dvips.def} |
| 290 |
\ifx\Gin@driver\gxpsm@tempa\else |
| 291 |
\PackageError{graphicx-psmin}{This package cannot be used with any |
| 292 |
\MessageBreak back end driver other than dvips!}\@ehd |
| 293 |
\def\loadgraphics{\@testopt\gxpsm@loadgraphics{}} |
| 294 |
\def\gxpsm@loadgraphics[#1]#2{} |
| 295 |
\expandafter\endinput |
| 296 |
\fi |
| 297 |
% \end{macrocode} |
| 298 |
% In draft mode, no graphics should be loaded, so we eat the argument |
| 299 |
% and hence all graphics will be handled by \pf{graphicx} from here. |
| 300 |
% \begin{macrocode} |
| 301 |
\ifGin@draft |
| 302 |
\def\loadgraphics{\@testopt\gxpsm@loadgraphics{}} |
| 303 |
\def\gxpsm@loadgraphics[#1]#2{} |
| 304 |
\expandafter\endinput |
| 305 |
\fi |
| 306 |
% \end{macrocode} |
| 307 |
% \begin{macro}{\gxpsm@loaded} |
| 308 |
% Initialize the list of loaded graphics. |
| 309 |
% \begin{macrocode} |
| 310 |
\def\gxpsm@loaded{} |
| 311 |
% \end{macrocode} |
| 312 |
% \end{macro} |
| 313 |
% \begin{macro}{\@namexdef} |
| 314 |
% \marg{csname}\\ |
| 315 |
% Defines the macro with name \meta{csname} using |\xdef|. |
| 316 |
% \begin{macrocode} |
| 317 |
\def\@namexdef#1{\expandafter\xdef\csname#1\endcsname} |
| 318 |
% \end{macrocode} |
| 319 |
% \end{macro} |
| 320 |
% \begin{macro}{\loadgraphics} |
| 321 |
% Load graphics. |
| 322 |
% \begin{macrocode} |
| 323 |
\def\loadgraphics{\@testopt\gxpsm@loadgraphics{}} |
| 324 |
% \end{macrocode} |
| 325 |
% \end{macro} |
| 326 |
% \begin{macro}{\gxpsm@loadgraphics} |
| 327 |
% \oarg{bb}\marg{list of graphics}\\ |
| 328 |
% Load each of the graphics in \meta{list of graphics} into the dvi |
| 329 |
% and eventually the PostScript using |\special|s. Use \meta{bb} for |
| 330 |
% the bounding box for all these graphics if specified. If not, we |
| 331 |
% search the file for the bounding box. |
| 332 |
% \begin{macrocode} |
| 333 |
\def\gxpsm@loadgraphics[#1]#2{% |
| 334 |
% \end{macrocode} |
| 335 |
% Loop over all graphics. |
| 336 |
% \begin{macrocode} |
| 337 |
\@for\gxpsm@file:=#2\do{% |
| 338 |
\begingroup |
| 339 |
% \end{macrocode} |
| 340 |
% If the file exists in the graphics path, continue. |
| 341 |
% \begin{macrocode} |
| 342 |
\gxpsm@checkfile\gxpsm@file{% |
| 343 |
% \end{macrocode} |
| 344 |
% If no explicit bounding box in |#1|, try finding one in the file, |
| 345 |
% otherwise use the one in |#1|. |
| 346 |
% \begin{macrocode} |
| 347 |
\ifx\@empty#1\@empty |
| 348 |
\Gread@eps{\Gin@base\Gin@ext}% |
| 349 |
\else |
| 350 |
\Gread@parse@bb#1 \\ |
| 351 |
\fi |
| 352 |
% \end{macrocode} |
| 353 |
% Save the bounding box for this graphic. |
| 354 |
% \begin{macrocode} |
| 355 |
\@namexdef{\Gin@base\Gin@ext @llx}{\Gin@llx}% |
| 356 |
\@namexdef{\Gin@base\Gin@ext @lly}{\Gin@lly}% |
| 357 |
\@namexdef{\Gin@base\Gin@ext @urx}{\Gin@urx}% |
| 358 |
\@namexdef{\Gin@base\Gin@ext @ury}{\Gin@ury}% |
| 359 |
% \end{macrocode} |
| 360 |
% Transform the PostScript internal name of the graphic as `|/|' can't |
| 361 |
% be used in variable names. |
| 362 |
% \begin{macrocode} |
| 363 |
\gxpsm@getcfile |
| 364 |
% \end{macrocode} |
| 365 |
% Write the graphic body together with the extra functions to the dvi |
| 366 |
% file using a header special. This requires dvips v5.95b or newer |
| 367 |
% to work! |
| 368 |
% \begin{macrocode} |
| 369 |
\AtBeginDvi{\special{header={\Gin@base\Gin@ext} |
| 370 |
pre={/\gxpsm@cfile-data^^Jcurrentfile^^J% |
| 371 |
<< /Filter /SubFileDecode^^J/DecodeParms << /EODCount 0 |
| 372 |
/EODString (*HA-EOD-??3.1416926!!*) >>^^J>> |
| 373 |
/ReusableStreamDecode filter^^J% |
| 374 |
\@percentchar\@percentchar BeginDocument: |
| 375 |
\Gin@base\Gin@ext^^J% |
| 376 |
} |
| 377 |
post={\@percentchar\@percentchar EndDocument^^J% |
| 378 |
*HA-EOD-??3.1416926!!*^^Jdef^^J/\gxpsm@cfile-form^^J% |
| 379 |
<< /FormType 1^^J/BBox |
| 380 |
[\Gin@llx\space\Gin@lly\space\Gin@urx\space\Gin@ury]^^J% |
| 381 |
/Matrix [1 0 0 1 0 0]^^J/PaintProc^^J{ pop^^J% |
| 382 |
/ostate save def^^J/showpage {} def^^J% |
| 383 |
/setpagedevice /pop load def^^J% |
| 384 |
\gxpsm@cfile-data 0 setfileposition |
| 385 |
\gxpsm@cfile-data cvx exec^^J% |
| 386 |
ostate restore^^J} bind^^J>> def% |
| 387 |
} |
| 388 |
}}% |
| 389 |
% \end{macrocode} |
| 390 |
% Add the file to the list of loaded graphics for |\includegraphics|. |
| 391 |
% \begin{macrocode} |
| 392 |
\xdef\gxpsm@loaded{% |
| 393 |
\gxpsm@loaded\ifx\gxpsm@loaded\@empty\else,\fi |
| 394 |
\Gin@base\Gin@ext |
| 395 |
}% |
| 396 |
}% |
| 397 |
\endgroup |
| 398 |
}% |
| 399 |
} |
| 400 |
% \end{macrocode} |
| 401 |
% \end{macro} |
| 402 |
% Avoid using |\loadgraphics| outside the preamble. |
| 403 |
% \begin{macrocode} |
| 404 |
\@onlypreamble\loadgraphics |
| 405 |
\@onlypreamble\gxpsm@loadgraphics |
| 406 |
% \end{macrocode} |
| 407 |
% \begin{macro}{\gxpsm@getcfile} |
| 408 |
% \begin{macro}{\gxpsm@g@tcfile} |
| 409 |
% These two macros replace any occurrence of `|/|' by `|_|' so that |
| 410 |
% the name can be used inside PostScript. This uses a well known |
| 411 |
% |\lowercase| trick. |
| 412 |
% \begin{macrocode} |
| 413 |
\def\gxpsm@getcfile{% |
| 414 |
\edef\gxpsm@tempa{% |
| 415 |
\noexpand\gxpsm@g@tcfile\Gin@base\Gin@ext\noexpand\@nil |
| 416 |
}% |
| 417 |
\gxpsm@tempa |
| 418 |
} |
| 419 |
\def\gxpsm@g@tcfile#1\@nil{% |
| 420 |
\begingroup\lccode`\/`\_\lowercase{\endgroup\def\gxpsm@cfile{#1}}% |
| 421 |
} |
| 422 |
% \end{macrocode} |
| 423 |
% \end{macro} |
| 424 |
% \end{macro} |
| 425 |
% \begin{macro}{\Ginclude@graphics} |
| 426 |
% \marg{file}\\ |
| 427 |
% We redefine this internal of \pf{graphics}. If the graphic has been |
| 428 |
% loaded, use a PostScript function to reload it from the header. |
| 429 |
% Else, follow the usual track of \pf{graphicx}. |
| 430 |
% \begin{macrocode} |
| 431 |
\def\Ginclude@graphics#1{% |
| 432 |
\begingroup |
| 433 |
% \end{macrocode} |
| 434 |
% Graphic exists? This will also produce |\Gin@base| and |\Gin@ext|. |
| 435 |
% \begin{macrocode} |
| 436 |
\gxpsm@checkfile{#1}{% |
| 437 |
% \end{macrocode} |
| 438 |
% Graphic loaded? |
| 439 |
% \begin{macrocode} |
| 440 |
\@expandtwoargs\in@{,\Gin@base\Gin@ext,}{,\gxpsm@loaded,}% |
| 441 |
\ifin@ |
| 442 |
% \end{macrocode} |
| 443 |
% If the user didn't supply a bounding box in the |\includegraphics| |
| 444 |
% command, use the one that we found while scanning the graphic. |
| 445 |
% \begin{macrocode} |
| 446 |
\ifGin@bbox\else |
| 447 |
\Gin@bboxtrue |
| 448 |
\edef\Gin@llx{\@nameuse{\Gin@base\Gin@ext @llx}}% |
| 449 |
\edef\Gin@lly{\@nameuse{\Gin@base\Gin@ext @lly}}% |
| 450 |
\edef\Gin@urx{\@nameuse{\Gin@base\Gin@ext @urx}}% |
| 451 |
\edef\Gin@ury{\@nameuse{\Gin@base\Gin@ext @ury}}% |
| 452 |
\fi |
| 453 |
% \end{macrocode} |
| 454 |
% Use \pf{graphics} internals to do computations etcetera and in the |
| 455 |
% end, use the graphic. |
| 456 |
% \begin{macrocode} |
| 457 |
\Gin@setfile{psdirect}{}{\Gin@base\Gin@ext}% |
| 458 |
\else |
| 459 |
% \end{macrocode} |
| 460 |
% This is the usual route from |\Ginclude@graphics| from \pf{graphics} |
| 461 |
% for non-loaded graphics. |
| 462 |
% \begin{macrocode} |
| 463 |
\@ifundefined{Gin@rule@\Gin@ext}{% |
| 464 |
\ifx\Gin@rule@*\@undefined |
| 465 |
\@latex@error{Unknown graphics extension: \Gin@ext}\@ehc |
| 466 |
\else |
| 467 |
\expandafter\Gin@setfile\Gin@rule@*{\Gin@base\Gin@ext}% |
| 468 |
\fi |
| 469 |
}{% |
| 470 |
\expandafter\expandafter\expandafter\Gin@setfile |
| 471 |
\csname Gin@rule@\Gin@ext\endcsname{\Gin@base\Gin@ext}% |
| 472 |
}% |
| 473 |
\fi |
| 474 |
}% |
| 475 |
\endgroup |
| 476 |
} |
| 477 |
% \end{macrocode} |
| 478 |
% \end{macro} |
| 479 |
% \begin{macro}{\gxpsm@checkfile} |
| 480 |
% \changes{v1.2}{2020/11/14}{Changes to work with the latest \pf{graphicx} package} |
| 481 |
% \marg{file}\marg{actions}\\ |
| 482 |
% This is part of \pf{graphics}' |\Ginclude@graphics| which checks a |
| 483 |
% graphic file in the graphics path. We perform \meta{actions} when |
| 484 |
% the file is all right. We separated this part as it is reused |
| 485 |
% several times in this package. |
| 486 |
% \begin{macrocode} |
| 487 |
\def\gxpsm@checkfile#1#2{% |
| 488 |
\let\input@path\Ginput@path |
| 489 |
\ifx\unquote@name\@undefined |
| 490 |
\filename@parse{#1}% |
| 491 |
\else |
| 492 |
\expandafter\filename@parse\expandafter{\detokenize{#1}}% |
| 493 |
\fi |
| 494 |
\ifx\filename@ext\relax |
| 495 |
\@for\Gin@temp:=\Gin@extensions\do{% |
| 496 |
\ifx\Gin@ext\relax |
| 497 |
\Gin@getbase\Gin@temp |
| 498 |
\fi |
| 499 |
}% |
| 500 |
\else |
| 501 |
\Gin@getbase{\Gin@sepdefault\filename@ext}% |
| 502 |
\ifx\Gin@ext\relax |
| 503 |
\@warning{File `#1' not found}% |
| 504 |
\def\Gin@base{\filename@area\filename@base}% |
| 505 |
\edef\Gin@ext{\Gin@sepdefault\filename@ext}% |
| 506 |
\fi |
| 507 |
\fi |
| 508 |
\ifx\Gin@ext\relax |
| 509 |
\@latex@error{File `#1' not found}% |
| 510 |
{I could not locate the file with any of these extensions:^^J% |
| 511 |
\Gin@extensions^^J\@ehc}% |
| 512 |
\else#2\fi |
| 513 |
} |
| 514 |
% \end{macrocode} |
| 515 |
% \end{macro} |
| 516 |
% \begin{macro}{\Ginclude@psdirect} |
| 517 |
% \changes{v1.1}{2005/09/20}{Added missing \cs{space}} |
| 518 |
% \marg{file}\\ |
| 519 |
% This inserts the PostScript function needed to reload \meta{file} |
| 520 |
% from the PostScript header. This is based on |\Ginclude@eps| from |
| 521 |
% dvips.def (\pf{graphics}). |
| 522 |
% \begin{macrocode} |
| 523 |
\def\Ginclude@psdirect#1{% |
| 524 |
\message{<#1>}% |
| 525 |
\bgroup |
| 526 |
\def\@tempa{!}% |
| 527 |
\gxpsm@getcfile |
| 528 |
\dimen@\Gin@req@width |
| 529 |
\[email protected]% |
| 530 |
\divide\dimen@\dimen@ii |
| 531 |
\@tempdima\Gin@req@height |
| 532 |
\divide\@tempdima\dimen@ii |
| 533 |
\special{ps:@beginspecial |
| 534 |
\Gin@llx\space @llx \Gin@lly\space @lly |
| 535 |
\Gin@urx\space @urx \Gin@ury\space @ury |
| 536 |
\ifx\Gin@scalex\@tempa\else\number\dimen@\space @rwi\fi |
| 537 |
\ifx\Gin@scaley\@tempa\else\space\number\@tempdima\space @rhi\fi |
| 538 |
\ifGin@clip\space @clip\fi\space @setspecial^^J |
| 539 |
save \gxpsm@cfile-form execform restore showpage @endspecial |
| 540 |
}% |
| 541 |
\egroup |
| 542 |
} |
| 543 |
% \end{macrocode} |
| 544 |
% \end{macro} |
| 545 |
% \begin{macrocode} |
| 546 |
%</graphicx-psmin> |
| 547 |
% \end{macrocode} |
| 548 |
% |
| 549 |
% \Finale |
| 550 |
% \endinput |
| 551 |
% |
| 552 |
%<*preamble> |
| 553 |
\usepackage{url} |
| 554 |
\usepackage{graphicx-psmin} |
| 555 |
\usepackage{fourier} |
| 556 |
\usepackage{xcolor} |
| 557 |
\usepackage[multiple]{footmisc} |
| 558 |
\usepackage{pst-char} |
| 559 |
\usepackage{listings} |
| 560 |
\lstnewenvironment{command}{% |
| 561 |
\lstset{columns=flexible,frame=single,backgroundcolor=\color{blue!20},% |
| 562 |
xleftmargin=\fboxsep,xrightmargin=\fboxsep,escapeinside=`',gobble=1}}{} |
| 563 |
\lstnewenvironment{example}{% |
| 564 |
\lstset{basicstyle=\footnotesize\ttfamily,columns=flexible,frame=single,% |
| 565 |
backgroundcolor=\color{yellow!20},xleftmargin=\fboxsep,% |
| 566 |
xrightmargin=\fboxsep,gobble=1}}{} |
| 567 |
\def\mktitledecor{% |
| 568 |
\rput[tl]{90}(-6.5,-23.56){% |
| 569 |
\psline[linewidth=1pt](0,1.5)(\paperheight,1.5)% |
| 570 |
\rput[lB](.075\paperheight,.5){\pscharpath[linecolor=blue!50,% |
| 571 |
fillcolor=yellow!20,fillstyle=solid,linewidth=.5pt]% |
| 572 |
{\Huge\bfseries\sffamily graphicx-psmin}% |
| 573 |
}% |
| 574 |
\rput[rB](.925\paperheight,.5){\pscharpath[linecolor=blue!50,% |
| 575 |
fillcolor=yellow!20,fillstyle=solid,linewidth=.5pt]% |
| 576 |
{\Huge\bfseries Documentation}% |
| 577 |
}% |
| 578 |
\psline[linewidth=1pt](0,0)(\paperheight,0)% |
| 579 |
}% |
| 580 |
} |
| 581 |
\makeatletter |
| 582 |
\def\tableofcontents{\@starttoc{toc}} |
| 583 |
\renewenvironment{theglossary}{% |
| 584 |
\section*{Version history}% |
| 585 |
\GlossaryParms \let\item\@idxitem \ignorespaces |
| 586 |
}{}% |
| 587 |
\def\changes@#1#2#3{% |
| 588 |
\protected@edef\@tempa{% |
| 589 |
\noexpand\glossary{\textbf{#1}\hfill\emph{(#2)}% |
| 590 |
\levelchar |
| 591 |
\ifx\saved@macroname\@empty |
| 592 |
\space\actualchar\generalname |
| 593 |
\else |
| 594 |
\expandafter\@gobble\saved@macroname |
| 595 |
\actualchar\string\verb\quotechar*% |
| 596 |
\verbatimchar\saved@macroname\verbatimchar |
| 597 |
\fi |
| 598 |
:\levelchar #3}% |
| 599 |
}% |
| 600 |
\@tempa\endgroup\@esphack |
| 601 |
} |
| 602 |
\makeatother |
| 603 |
\def\PrintChangesX{% |
| 604 |
\begingroup |
| 605 |
\let\efill\relax |
| 606 |
\PrintChanges |
| 607 |
\endgroup |
| 608 |
} |
| 609 |
\def\PrintIndexX{% |
| 610 |
\begingroup |
| 611 |
\setcounter{IndexColumns}{2}% |
| 612 |
\setlength\columnsep{18pt}% |
| 613 |
\setlength\columnseprule{.4pt}% |
| 614 |
\PrintIndex |
| 615 |
\endgroup |
| 616 |
} |
| 617 |
\def\pf#1{\textsf{#1}} |
| 618 |
\DisableCrossrefs |
| 619 |
\RecordChanges |
| 620 |
\CodelineIndex |
| 621 |
%</preamble> |
| 622 |
% |
| 623 |
%<*bib> |
| 624 |
@BOOK{companion, |
| 625 |
author = {Frank Mittelbach and Michel Goossens and Johannes Braams and David Carlisle and Chris Rowley}, |
| 626 |
title = {The {\LaTeX} {C}ompanion, {S}econd {E}dition}, |
| 627 |
year = {2004}, |
| 628 |
publisher = {{Addison-Wesley}} |
| 629 |
} |
| 630 |
|
| 631 |
@MISC{graphics, |
| 632 |
author = {David Carlisle}, |
| 633 |
title = {\pf{graphics} bundle}, |
| 634 |
howpublished = {\url{CTAN:/macros/latex/required/graphics}} |
| 635 |
} |
| 636 |
|
| 637 |
@MISC{greer, |
| 638 |
author = {Thomas Greer}, |
| 639 |
title = {Reusable content caching in PostScript}, |
| 640 |
howpublished = {\url{http://www.tgreer.com/eps_vdp2.html}} |
| 641 |
} |
| 642 |
|
| 643 |
@MISC{PLRM, |
| 644 |
author = {Adobe Systems Incorporated}, |
| 645 |
title = {PostScript language reference manual}, |
| 646 |
howpublished = {\url{http://www.adobe.com/products/postscript/pdfs/PLRM.pdf}} |
| 647 |
} |
| 648 |
%</bib> |