| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% File: grffile.dtx |
| 4 |
% Info: Extended file name support for graphics |
| 5 |
% |
| 6 |
% Copyright (C) 2006-2012 Heiko Oberdiek |
| 7 |
% 2016-2019 Oberdiek Package Support Group |
| 8 |
% https://github.com/ho-tex/grffile/issues |
| 9 |
% |
| 10 |
% This work may be distributed and/or modified under the |
| 11 |
% conditions of the LaTeX Project Public License, either |
| 12 |
% version 1.3c of this license or (at your option) any later |
| 13 |
% version. This version of this license is in |
| 14 |
% http://www.latex-project.org/lppl/lppl-1-3c.txt |
| 15 |
% and the latest version of this license is in |
| 16 |
% http://www.latex-project.org/lppl.txt |
| 17 |
% and version 1.3 or later is part of all distributions of |
| 18 |
% LaTeX version 2005/12/01 or later. |
| 19 |
% |
| 20 |
% This work has the LPPL maintenance status "maintained". |
| 21 |
% |
| 22 |
% This Current Maintainer of this work is |
| 23 |
% Oberdiek Package Support Group |
| 24 |
% |
| 25 |
% This work consists of the main source file grffile.dtx |
| 26 |
% and the derived files |
| 27 |
% grffile.sty, grffile.pdf, grffile.ins, grffile.drv, |
| 28 |
% grffile-test1.tex. |
| 29 |
% |
| 30 |
% Distribution: |
| 31 |
% CTAN:macros/latex/contrib/grffile/grffile.dtx |
| 32 |
% CTAN:macros/latex/contrib/grffile/grffile.pdf |
| 33 |
% |
| 34 |
% Unpacking: |
| 35 |
% (a) If grffile.ins is present: |
| 36 |
% tex grffile.ins |
| 37 |
% (b) Without grffile.ins: |
| 38 |
% tex grffile.dtx |
| 39 |
% (c) If you insist on using LaTeX |
| 40 |
% latex \let\install=y\input{grffile.dtx} |
| 41 |
% (quote the arguments according to the demands of your shell) |
| 42 |
% |
| 43 |
% Documentation: |
| 44 |
% (a) If grffile.drv is present: |
| 45 |
% latex grffile.drv |
| 46 |
% (b) Without grffile.drv: |
| 47 |
% latex grffile.dtx; ... |
| 48 |
% The class ltxdoc loads the configuration file ltxdoc.cfg |
| 49 |
% if available. Here you can specify further options, e.g. |
| 50 |
% use A4 as paper format: |
| 51 |
% \PassOptionsToClass{a4paper}{article} |
| 52 |
% |
| 53 |
% Programm calls to get the documentation (example): |
| 54 |
% pdflatex grffile.dtx |
| 55 |
% makeindex -s gind.ist grffile.idx |
| 56 |
% pdflatex grffile.dtx |
| 57 |
% makeindex -s gind.ist grffile.idx |
| 58 |
% pdflatex grffile.dtx |
| 59 |
% |
| 60 |
% Installation: |
| 61 |
% TDS:tex/latex/grffile/grffile.sty |
| 62 |
% TDS:doc/latex/grffile/grffile.pdf |
| 63 |
% TDS:doc/latex/grffile/test/grffile-test1.tex |
| 64 |
% TDS:source/latex/grffile/grffile.dtx |
| 65 |
% |
| 66 |
%<*ignore> |
| 67 |
\begingroup |
| 68 |
\catcode123=1 % |
| 69 |
\catcode125=2 % |
| 70 |
\def\x{LaTeX2e}% |
| 71 |
\expandafter\endgroup |
| 72 |
\ifcase 0\ifx\install y1\fi\expandafter |
| 73 |
\ifx\csname processbatchFile\endcsname\relax\else1\fi |
| 74 |
\ifx\fmtname\x\else 1\fi\relax |
| 75 |
\else\csname fi\endcsname |
| 76 |
%</ignore> |
| 77 |
%<*install> |
| 78 |
\input docstrip.tex |
| 79 |
|
| 80 |
\keepsilent |
| 81 |
\askforoverwritefalse |
| 82 |
|
| 83 |
\let\MetaPrefix\relax |
| 84 |
\preamble |
| 85 |
|
| 86 |
This is a generated file. |
| 87 |
|
| 88 |
Project: grffile |
| 89 |
|
| 90 |
Copyright (C) 2006-2012 Heiko Oberdiek |
| 91 |
2016-2019 Oberdiek Package Support Group |
| 92 |
https://github.com/ho-tex/grffile/issues |
| 93 |
|
| 94 |
This work may be distributed and/or modified under the |
| 95 |
conditions of the LaTeX Project Public License, either |
| 96 |
version 1.3c of this license or (at your option) any later |
| 97 |
version. This version of this license is in |
| 98 |
http://www.latex-project.org/lppl/lppl-1-3c.txt |
| 99 |
and the latest version of this license is in |
| 100 |
http://www.latex-project.org/lppl.txt |
| 101 |
and version 1.3 or later is part of all distributions of |
| 102 |
LaTeX version 2005/12/01 or later. |
| 103 |
|
| 104 |
This work has the LPPL maintenance status "maintained". |
| 105 |
|
| 106 |
This Current Maintainer of this work is Heiko Oberdiek. |
| 107 |
|
| 108 |
This work consists of the main source file grffile.dtx |
| 109 |
and the derived files |
| 110 |
grffile.sty, grffile.pdf, grffile.ins, grffile.drv, |
| 111 |
grffile-test1.tex. |
| 112 |
|
| 113 |
\endpreamble |
| 114 |
\let\MetaPrefix\DoubleperCent |
| 115 |
|
| 116 |
\generate{% |
| 117 |
% \file{grffile.ins}{\from{grffile.dtx}{install}}% |
| 118 |
% \file{grffile.drv}{\from{grffile.dtx}{driver}}% |
| 119 |
\usedir{tex/latex/grffile}% |
| 120 |
\file{grffile.sty}{\from{grffile.dtx}{new}}% |
| 121 |
\file{grffile-2017-06-30.sty}{\from{grffile.dtx}{package}}% |
| 122 |
% \usedir{doc/latex/grffile/test}% |
| 123 |
% \file{grffile-test1.tex}{\from{grffile.dtx}{test1}}% |
| 124 |
\nopreamble |
| 125 |
\nopostamble |
| 126 |
% \usedir{source/latex/grffile/catalogue}% |
| 127 |
% \file{grffile.xml}{\from{grffile.dtx}{catalogue}}% |
| 128 |
} |
| 129 |
|
| 130 |
\catcode32=13\relax% active space |
| 131 |
\let =\space% |
| 132 |
\Msg{************************************************************************} |
| 133 |
\Msg{*} |
| 134 |
\Msg{* To finish the installation you have to move the following} |
| 135 |
\Msg{* file into a directory searched by TeX:} |
| 136 |
\Msg{*} |
| 137 |
\Msg{* grffile.sty} |
| 138 |
\Msg{*} |
| 139 |
\Msg{* To produce the documentation run the file `grffile.dtx'} |
| 140 |
\Msg{* through LaTeX.} |
| 141 |
\Msg{*} |
| 142 |
\Msg{* Happy TeXing!} |
| 143 |
\Msg{*} |
| 144 |
\Msg{************************************************************************} |
| 145 |
|
| 146 |
\endbatchfile |
| 147 |
%</install> |
| 148 |
%<*ignore> |
| 149 |
\fi |
| 150 |
%</ignore> |
| 151 |
%<*driver> |
| 152 |
\NeedsTeXFormat{LaTeX2e} |
| 153 |
\ProvidesFile{grffile.drv}% |
| 154 |
\documentclass{ltxdoc} |
| 155 |
\usepackage{holtxdoc}[2011/11/22] |
| 156 |
\begin{document} |
| 157 |
\DocInput{grffile.dtx}% |
| 158 |
\end{document} |
| 159 |
%</driver> |
| 160 |
% \fi |
| 161 |
% |
| 162 |
% |
| 163 |
% \CharacterTable |
| 164 |
% {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 |
| 165 |
% 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 |
| 166 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 167 |
% Exclamation \! Double quote \" Hash (number) \# |
| 168 |
% Dollar \$ Percent \% Ampersand \& |
| 169 |
% Acute accent \' Left paren \( Right paren \) |
| 170 |
% Asterisk \* Plus \+ Comma \, |
| 171 |
% Minus \- Point \. Solidus \/ |
| 172 |
% Colon \: Semicolon \; Less than \< |
| 173 |
% Equals \= Greater than \> Question mark \? |
| 174 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 175 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 176 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 177 |
% Right brace \} Tilde \~} |
| 178 |
% |
| 179 |
% \GetFileInfo{grffile.drv} |
| 180 |
% |
| 181 |
% \title{The \xpackage{grffile} package\thanks{The documentation here |
| 182 |
% describes version 1.x, accessed via |
| 183 |
% \texttt{\string\usepackage\{grffile\}[=v1]}, |
| 184 |
% the current version 2.0 does nothing as the |
| 185 |
% current graphics package handles multiple dots, spaces and UTF-8 characters |
| 186 |
% in filenames}} |
| 187 |
% \date{\today} |
| 188 |
% \author{Heiko Oberdiek\thanks |
| 189 |
% {Please report any issues at https://github.com/ho-tex/grffile/issues}} |
| 190 |
% |
| 191 |
% \maketitle |
| 192 |
% |
| 193 |
% \begin{abstract} |
| 194 |
% The package extends the file name processing of package \xpackage{graphics} |
| 195 |
% to support a larger range of file names. For example, the file name |
| 196 |
% may contain several dots. Or in case of \pdfTeX\ in PDF mode the file name may |
| 197 |
% contain spaces. |
| 198 |
% \end{abstract} |
| 199 |
% |
| 200 |
% \tableofcontents |
| 201 |
% |
| 202 |
% \section{Usage} |
| 203 |
% |
| 204 |
% \subsection{Option \xoption{multidot}} |
| 205 |
% |
| 206 |
% The file name parsing of package \xpackage{graphics} is changed, in order |
| 207 |
% to detect known extensions. This allows both the use of dots inside the |
| 208 |
% base file name and extensions with several dots. |
| 209 |
% |
| 210 |
% Assume there are two files in the currect directory: \texttt{Hello.World.eps} |
| 211 |
% and \texttt{Hello.World.pdf}. \verb|\includegraphics{Hello.World}| will find |
| 212 |
% \verb|Hello.World.pdf| with driver \xoption{pdftex} or |
| 213 |
% \verb|Hello.World.eps| with driver \xoption{dvips}. |
| 214 |
% |
| 215 |
% \paragraph{Limitations:} Problem could occur on systems, which don't |
| 216 |
% use the dot as extension delimiter. These systems needs an own |
| 217 |
% \verb|texsys.cfg| containing definitions for \verb|\filename@parse|. |
| 218 |
% The author could not test that, due to a missing example. |
| 219 |
% |
| 220 |
% \subsection{Option \xoption{babel}} |
| 221 |
% |
| 222 |
% This option allows the use of shorthand characters of package |
| 223 |
% \xpackage{babel} inside the graphics file name. Additionally |
| 224 |
% the tilde `\textasciitilde' is supported. The option |
| 225 |
% is turned on as default. (In version v1.1 or below of this package, |
| 226 |
% the features of this option were part of option \xoption{extendedchars}.) |
| 227 |
% |
| 228 |
% Example: |
| 229 |
% \begin{quote} |
| 230 |
%\begin{verbatim} |
| 231 |
%\usepackage[frenchb]{babel} |
| 232 |
%\usepackage{grffile} |
| 233 |
%Image: \includegraphics{C:/path/image} |
| 234 |
%\end{verbatim} |
| 235 |
% \end{quote} |
| 236 |
% |
| 237 |
% \subsection{Option \xoption{extendedchars}} |
| 238 |
% |
| 239 |
% If the input encoding is the same encoding as the encoding that |
| 240 |
% is used for file names and the driver allows non-ascii characters. |
| 241 |
% Without option \xoption{extendedchars} the 8-bit characters |
| 242 |
% are expanded, if they are active characters. For example, |
| 243 |
% see the \LaTeX\ package \xpackage{inputenc}. However a |
| 244 |
% file name is not input for \LaTeX. Therefore this option |
| 245 |
% \xoption{extendedchars} removes the active status and |
| 246 |
% the 8-bit characters are not expandable any more. |
| 247 |
% |
| 248 |
% Example: |
| 249 |
% \begin{quote} |
| 250 |
% |\usepackage[latin1]{inputenc}|\\ |
| 251 |
% |\usepackage[extendedchars]{grffile}|\\ |
| 252 |
% |\includegraphics{|\texttt{B\"ackerstra\ss e}|}| |
| 253 |
% \end{quote} |
| 254 |
% |
| 255 |
% If the \verb|draft| option of the graphics package is enabled, the |
| 256 |
% file name is printed with the current font encoding for \verb|\ttfamily|. |
| 257 |
% Thus it is possible, that such characters are omitted or the wrong |
| 258 |
% characters are displayed, if the font encoding is not the same as |
| 259 |
% the file name encoding. |
| 260 |
% |
| 261 |
% \subsection{Option \xoption{encoding}} |
| 262 |
% |
| 263 |
% Consider the following scenario. Your file system is using |
| 264 |
% UTF-8 as encoding for file names. But you use \xoption{latin1} |
| 265 |
% as input encoding for your \TeX\ files, because some packages |
| 266 |
% are not ready for multi-byte encodings (\xpackage{listings}, \dots). |
| 267 |
% |
| 268 |
% Then this option \xoption{encoding} loads support for converting |
| 269 |
% encodings by loading package \xpackage{stringenc}. |
| 270 |
% The option is not defined after the preamble, because |
| 271 |
% \LaTeX\ limits package loading to the preamble. |
| 272 |
% |
| 273 |
% File names are converted, if package \xpackage{stringenc} is loaded |
| 274 |
% and the encodings are known, see options \xoption{inputencoding} and |
| 275 |
% \xoption{filenameencoding}. |
| 276 |
% |
| 277 |
% \subsubsection{Option \xoption{inputencoding}} |
| 278 |
% |
| 279 |
% Option \xoption{inputencoding} specifies the encoding |
| 280 |
% of the file name in your \TeX\ input file. |
| 281 |
% |
| 282 |
% Package \xpackage{inputenx} and package \xpackage{inputenc} |
| 283 |
% since version 2006/02/22 v1.1a remember the name of |
| 284 |
% the input encoding that is looked up by this package. |
| 285 |
% Therefore option \xoption{inputencoding} is usually |
| 286 |
% not mandatory. |
| 287 |
% |
| 288 |
% \subsubsection{Option \xoption{filenameencoding}} |
| 289 |
% |
| 290 |
% This is the encoding of the filename of your file |
| 291 |
% system. This option is mandatory, file names |
| 292 |
% are not converted without this option. The option |
| 293 |
% is disabled, if the value is empty. |
| 294 |
% |
| 295 |
% \subsubsection{Example} |
| 296 |
% |
| 297 |
% Back to the scenario where the file system uses UTF-8 and |
| 298 |
% the \LaTeX\ input files are encodind in latin1. |
| 299 |
% \begin{quote} |
| 300 |
%\begin{verbatim} |
| 301 |
%\usepackage[latin1]{inputenc}[2006/02/22] |
| 302 |
% % \usepackage[latin1]{inputenx} |
| 303 |
%\usepackage{graphicx} |
| 304 |
%\usepackage[encoding,filenameencoding=utf8]{grffile} |
| 305 |
%\end{verbatim} |
| 306 |
% \end{quote} |
| 307 |
% |
| 308 |
% For older versions of package \xoption{inputenc} option |
| 309 |
% \xoption{inputencoding} provides the necessary informations. |
| 310 |
% \begin{quote} |
| 311 |
%\begin{verbatim} |
| 312 |
%\usepackage[latin1]{inputenc} |
| 313 |
%\usepackage{graphicx} |
| 314 |
%\usepackage{grffile} |
| 315 |
%\grffilesetup{ |
| 316 |
% encoding, |
| 317 |
% inputencoding=latin1, |
| 318 |
% filenameencoding=utf8, |
| 319 |
%} |
| 320 |
%\end{verbatim} |
| 321 |
% \end{quote} |
| 322 |
% |
| 323 |
% \subsection{Option \xoption{space}} |
| 324 |
% |
| 325 |
% This option allows graphics file names that contain spaces |
| 326 |
% if possible. |
| 327 |
% |
| 328 |
% In general it is not possible to use space inside file names, |
| 329 |
% because \TeX\ considers the space character as termination in its |
| 330 |
% syntax for commands that expect a file name. |
| 331 |
% |
| 332 |
% Regarding graphics inclusion with the package \xpackage{graphics} |
| 333 |
% file names are used in two or three contexts: |
| 334 |
% \begin{enumerate} |
| 335 |
% \item The basic \cs{special} statement or primitive command for |
| 336 |
% graphics inclusion. The \cs{special} statements for |
| 337 |
% drivers \xoption{dvips} or \xoption{dvipdfm} do not allow |
| 338 |
% spaces. However \pdfTeX's primitive \cs{pdfximage} |
| 339 |
% uses curly braces to delimit the file name and allows spaces. |
| 340 |
% In case of \hologo{XeTeX} file names can be enclosed in quotes |
| 341 |
% to support spaces (at the cost that quotes no longer work). |
| 342 |
% \item \cs{includegraphics} checks the existence of the file. |
| 343 |
% Also it looks for the right extension if the extension is |
| 344 |
% not given. |
| 345 |
% |
| 346 |
% If \pdfTeX\ 1.30 is given, the file existence test |
| 347 |
% can be rewritten using a new primitive that allows spaces. |
| 348 |
% This works in both modes DVI and PDF. |
| 349 |
% |
| 350 |
% In case of \hologo{XeTeX} the file existence test is rewritten |
| 351 |
% to automatically add quotes. |
| 352 |
% \item Sometimes files are read as \TeX\ input files. For example, |
| 353 |
% \verb|.bb| files or MPS files. |
| 354 |
% \end{enumerate} |
| 355 |
% If \pdfTeX\ 1.30 or greater is used in PDF mode then the |
| 356 |
% graphics file names may contain spaces except for MPS files. |
| 357 |
% Therefore option \xoption{space} is only enabled by default, |
| 358 |
% if the supported \pdfTeX\ in PDF mode is detected or \hologo{XeTeX} |
| 359 |
% is running. |
| 360 |
% You can enable the option manually, if you know, your DVI driver |
| 361 |
% supports spaces in its \cs{special} syntax and if there is no |
| 362 |
% need to read the image file as \TeX\ input file (third context). |
| 363 |
% |
| 364 |
% \subsection{General use} |
| 365 |
% |
| 366 |
% The options can be given at many places: |
| 367 |
% |
| 368 |
% \begin{enumerate} |
| 369 |
% \item As package options:\\ |
| 370 |
% \verb|\usepackage[<options>]{grffile}| |
| 371 |
% \item Setup command of package \xpackage{grffile}:\\ |
| 372 |
% \verb|\grffilesetup{<options>}| |
| 373 |
% \item The options are also available as options |
| 374 |
% for package \xpackage{graphicx}:\\ |
| 375 |
% \verb|\setkeys{Gin}{<options>}| |
| 376 |
% \item If package \xpackage{graphicx} is loaded the options can also be |
| 377 |
% applied for a single image:\\ |
| 378 |
% \verb|\includegraphics[<options>]{...}| |
| 379 |
% \end{enumerate} |
| 380 |
% |
| 381 |
% \subsection{Default settings} |
| 382 |
% |
| 383 |
% \begin{quote} |
| 384 |
% \begin{tabular}{@{}lll@{}} |
| 385 |
% \xoption{multidot} & |true|\\ |
| 386 |
% \xoption{babel} & |true|\\ |
| 387 |
% \xoption{extendedchars} & |false|\\ |
| 388 |
% \xoption{space} & |true| & if \pdfTeX\ 1.30 or greater is used in PDF mode\\ |
| 389 |
% & |false| & otherwise |
| 390 |
% \end{tabular} |
| 391 |
% \end{quote} |
| 392 |
% |
| 393 |
% \StopEventually{ |
| 394 |
% } |
| 395 |
% |
| 396 |
% \section{Implementation} |
| 397 |
% |
| 398 |
% \subsection{New Package status.} |
| 399 |
% Changes to the core \verb|graphics| code have made the main features of this package |
| 400 |
% (supporting multiple dots and spaces in filenames) unneeded as they |
| 401 |
% are supported in the core code. The changes in the core also mean |
| 402 |
% some patches in this package no longer work. |
| 403 |
% |
| 404 |
% So by default this package does nothing but (especially if you have |
| 405 |
% rolled back other aspects of the latex code) you may want the |
| 406 |
% original version, which is available as |
| 407 |
% \begin{verbatim} |
| 408 |
% \usepackage{grffile}[=2017/06/30] |
| 409 |
% \end{verbatim} |
| 410 |
% \begin{macrocode} |
| 411 |
%<*new> |
| 412 |
\DeclareRelease{v1}{2017-06-30}{grffile-2017-06-30.sty} |
| 413 |
\DeclareCurrentRelease{}{2019-11-11} |
| 414 |
\ProvidesPackage{grffile}% |
| 415 |
[2019/11/11 v2.1 Extended file name support for graphics (legacy)]% |
| 416 |
\PackageInfo{grffile}{This package is an empty stub for compatibility} |
| 417 |
\DeclareOption*{} |
| 418 |
\ProcessOptions |
| 419 |
\RequirePackage{graphicx} |
| 420 |
%</new> |
| 421 |
% \end{macrocode} |
| 422 |
% \subsection{Identification} |
| 423 |
% |
| 424 |
% \begin{macrocode} |
| 425 |
%<*package> |
| 426 |
\NeedsTeXFormat{LaTeX2e} |
| 427 |
\ProvidesPackage{grffile}% |
| 428 |
[2017/06/30 v1.18 Extended file name support for graphics (HO)]% |
| 429 |
% \end{macrocode} |
| 430 |
% |
| 431 |
% \subsection{Catcode stuff} |
| 432 |
% |
| 433 |
% \begin{macrocode} |
| 434 |
\edef\grffile@RestoreCatcodes{% |
| 435 |
\catcode`\noexpand\=\the\catcode`\=\relax |
| 436 |
\catcode`\noexpand\:\the\catcode`\:\relax |
| 437 |
\catcode`\noexpand\.\the\catcode`\.\relax |
| 438 |
\catcode`\noexpand\'\the\catcode`\'\relax |
| 439 |
\catcode`\noexpand\<\the\catcode`\<\relax |
| 440 |
\catcode`\noexpand\>\the\catcode`\>\relax |
| 441 |
\catcode`\noexpand\*\the\catcode`\*\relax |
| 442 |
\catcode`\noexpand\^\the\catcode`\^\relax |
| 443 |
\catcode`\noexpand\~\the\catcode`\~\relax |
| 444 |
} |
| 445 |
\@makeother\= |
| 446 |
\@makeother\: |
| 447 |
\@makeother\. |
| 448 |
\@makeother\' |
| 449 |
\@makeother\< |
| 450 |
\@makeother\> |
| 451 |
\@makeother\* |
| 452 |
\catcode`\^=7 % |
| 453 |
\catcode`\~=\active |
| 454 |
% \end{macrocode} |
| 455 |
% |
| 456 |
% \subsection{Options} |
| 457 |
% |
| 458 |
% \begin{macrocode} |
| 459 |
\RequirePackage{ifpdf}[2010/01/28] |
| 460 |
\RequirePackage{ifxetex}[2010/09/12] |
| 461 |
\RequirePackage{kvoptions}[2006/08/17] |
| 462 |
\SetupKeyvalOptions{% |
| 463 |
family=Gin,% |
| 464 |
prefix=grffile@% |
| 465 |
} |
| 466 |
\DeclareDefaultOption{\@unknownoptionerror} |
| 467 |
\DeclareBoolOption[true]{multidot} |
| 468 |
\DeclareBoolOption[true]{babel} |
| 469 |
\DeclareBoolOption[false]{extendedchars} |
| 470 |
\DeclareBoolOption{space} |
| 471 |
\DeclareVoidOption{encoding}{% |
| 472 |
\RequirePackage{stringenc}\relax |
| 473 |
} |
| 474 |
\DeclareStringOption{inputencoding} |
| 475 |
\DeclareStringOption{filenameencoding} |
| 476 |
\DeclareDefaultOption{% |
| 477 |
\PassOptionsToPackage\CurrentOption{graphics}% |
| 478 |
} |
| 479 |
% \end{macrocode} |
| 480 |
% Default setting for option \xoption{space}. |
| 481 |
% \begin{macrocode} |
| 482 |
\RequirePackage{pdftexcmds}[2007/11/11] |
| 483 |
\ifxetex |
| 484 |
\grffile@spacetrue |
| 485 |
\else |
| 486 |
\begingroup\expandafter\expandafter\expandafter\endgroup |
| 487 |
\expandafter\ifx\csname pdf@filesize\endcsname\relax |
| 488 |
\grffile@spacefalse |
| 489 |
\let\grffile@space@disabled\@empty |
| 490 |
\def\grffile@spacetrue{% |
| 491 |
\PackageWarning{grffile}{% |
| 492 |
Option `space' is not available,\MessageBreak |
| 493 |
because it needs pdfTeX >= 1.30 or XeTeX% |
| 494 |
}% |
| 495 |
}% |
| 496 |
\else |
| 497 |
\ifpdf |
| 498 |
\grffile@spacetrue |
| 499 |
\else |
| 500 |
\grffile@spacefalse |
| 501 |
\fi |
| 502 |
\fi |
| 503 |
\fi |
| 504 |
% \end{macrocode} |
| 505 |
% \begin{macrocode} |
| 506 |
\ProcessKeyvalOptions* |
| 507 |
\AtBeginDocument{% |
| 508 |
\DisableKeyvalOption[package=grffile]{Gin}{encoding}% |
| 509 |
} |
| 510 |
% \end{macrocode} |
| 511 |
% \begin{macrocode} |
| 512 |
\RequirePackage{graphics} |
| 513 |
% \end{macrocode} |
| 514 |
% |
| 515 |
% \begin{macro}{\grffilesetup} |
| 516 |
% \begin{macrocode} |
| 517 |
\newcommand*{\grffilesetup}{% |
| 518 |
\setkeys{Gin}% |
| 519 |
} |
| 520 |
% \end{macrocode} |
| 521 |
% \end{macro} |
| 522 |
% |
| 523 |
% \begin{macro}{\grffile@org@Ginclude@graphics} |
| 524 |
% \begin{macrocode} |
| 525 |
\let\grffile@org@Ginclude@graphics\Ginclude@graphics |
| 526 |
% \end{macrocode} |
| 527 |
% \end{macro} |
| 528 |
% \begin{macro}{\Ginclude@graphics} |
| 529 |
% \begin{macrocode} |
| 530 |
\renewcommand*{\Ginclude@graphics}{% |
| 531 |
\ifx\grffile@filenameencoding\@empty |
| 532 |
\else |
| 533 |
\ifx\grffile@inputencoding\@empty |
| 534 |
\expandafter\ifx\csname inputencodingname\endcsname\relax |
| 535 |
\expandafter\ifx\csname |
| 536 |
CurrentInputEncodingOption\endcsname\relax |
| 537 |
\else |
| 538 |
\let\grffile@inputencoding\CurrentInputEncodingOption |
| 539 |
\fi |
| 540 |
\else |
| 541 |
\let\grffile@inputencoding\inputencodingname |
| 542 |
\fi |
| 543 |
\fi |
| 544 |
\ifx\grffile@inputencoding\@empty |
| 545 |
\else |
| 546 |
\grffile@extendedcharstrue |
| 547 |
\fi |
| 548 |
\fi |
| 549 |
\ifnum0\ifgrffile@babel 1\fi\ifgrffile@extendedchars 1\fi>\z@ |
| 550 |
\begingroup |
| 551 |
% \end{macrocode} |
| 552 |
% Support of babel's shorthand characters. |
| 553 |
% \begin{macrocode} |
| 554 |
\ifgrffile@babel |
| 555 |
\csname @safe@activestrue\endcsname |
| 556 |
% \end{macrocode} |
| 557 |
% Support of active tilde. |
| 558 |
% \begin{macrocode} |
| 559 |
\edef~{\string~}% |
| 560 |
% \end{macrocode} |
| 561 |
% Support of characters controlled by package \xpackage{inputenc}. |
| 562 |
% \begin{macrocode} |
| 563 |
\fi |
| 564 |
\ifgrffile@extendedchars |
| 565 |
\grffile@inputenc@loop\^^A\^^H% |
| 566 |
\grffile@inputenc@loop\^^K\^^K% |
| 567 |
\grffile@inputenc@loop\^^N\^^_% |
| 568 |
\grffile@inputenc@loop\^^?\^^ff% |
| 569 |
\fi |
| 570 |
\expandafter\grffile@extchar@Ginclude@graphics |
| 571 |
\else |
| 572 |
\expandafter\grffile@Ginclude@graphics |
| 573 |
\fi |
| 574 |
} |
| 575 |
% \end{macrocode} |
| 576 |
% \end{macro} |
| 577 |
% \begin{macro}{\grffile@extchar@Ginclude@graphics} |
| 578 |
% \begin{macrocode} |
| 579 |
\def\grffile@extchar@Ginclude@graphics#1{% |
| 580 |
\toks@{#1}% |
| 581 |
\edef\grffile@filename{\the\toks@}% |
| 582 |
\ifx\grffile@inputencoding\@empty |
| 583 |
\else |
| 584 |
\ifx\grfile@filenameencoding\@empty |
| 585 |
\else |
| 586 |
\ifx\grffile@inputencoding\grffile@filenameencoding |
| 587 |
\else |
| 588 |
\expandafter\ifx\csname StringEncodingConvert\endcsname\relax |
| 589 |
\PackageError{grffile}{% |
| 590 |
Package `stringenc' is not loaded,\MessageBreak |
| 591 |
omitting file name conversion% |
| 592 |
}\@ehc |
| 593 |
\else |
| 594 |
\StringEncodingConvert\grffile@temp\grffile@filename |
| 595 |
\grffile@inputencoding\grffile@filenameencoding |
| 596 |
\StringEncodingSuccessFailure{% |
| 597 |
\let\grffile@filename\grffile@temp |
| 598 |
}{% |
| 599 |
\PackageError{grffile}{% |
| 600 |
Filename conversion failed% |
| 601 |
}\@ehc |
| 602 |
}% |
| 603 |
\fi |
| 604 |
\fi |
| 605 |
\fi |
| 606 |
\fi |
| 607 |
% \toks@\expandafter{\grffile@filename}% |
| 608 |
\edef\x{\endgroup |
| 609 |
% \noexpand\grffile@Ginclude@graphics{\the\toks@}% |
| 610 |
\noexpand\grffile@Ginclude@graphics{\grffile@filename}% |
| 611 |
}% |
| 612 |
\x |
| 613 |
} |
| 614 |
% \end{macrocode} |
| 615 |
% \end{macro} |
| 616 |
% \begin{macro}{\grffile@inputenc@loop} |
| 617 |
% \begin{macrocode} |
| 618 |
\def\grffile@inputenc@loop#1#2{% |
| 619 |
\count@=`#1\relax |
| 620 |
\loop |
| 621 |
\begingroup |
| 622 |
\uccode`\~=\count@ |
| 623 |
\uppercase{% |
| 624 |
\endgroup |
| 625 |
\edef~{\string~}% |
| 626 |
}% |
| 627 |
\ifnum\count@<`#2\relax |
| 628 |
\advance\count@\@ne |
| 629 |
\repeat |
| 630 |
} |
| 631 |
% \end{macrocode} |
| 632 |
% \end{macro} |
| 633 |
% Support for option \xoption{space} |
| 634 |
% \begin{macro}{\grffile@space@getbase} |
| 635 |
% \begin{macrocode} |
| 636 |
\def\grffile@space@getbase#1{% |
| 637 |
\edef\grffile@tempa{% |
| 638 |
\def\noexpand\@tempa####1#1\noexpand\@nil{% |
| 639 |
\def\noexpand\Gin@base{####1}% |
| 640 |
}% |
| 641 |
}% |
| 642 |
\grffile@IfFileExists{\filename@area\filename@base#1}{% |
| 643 |
\grffile@tempa |
| 644 |
\expandafter\@tempa\grffile@file@found\@nil |
| 645 |
\edef\Gin@ext{#1}% |
| 646 |
}{% |
| 647 |
}% |
| 648 |
} |
| 649 |
% \end{macrocode} |
| 650 |
% \end{macro} |
| 651 |
% \begin{macrocode} |
| 652 |
\begingroup\expandafter\expandafter\expandafter\endgroup |
| 653 |
\expandafter\ifx\csname pdf@filesize\endcsname\relax |
| 654 |
\ifxetex |
| 655 |
% \end{macrocode} |
| 656 |
% \begin{macro}{\grffile@XeTeX@IfFileExists} |
| 657 |
% \begin{macrocode} |
| 658 |
\long\def\grffile@XeTeX@IfFileExists#1{% |
| 659 |
\openin\@inputcheck"#1" % |
| 660 |
\ifeof\@inputcheck |
| 661 |
\closein\@inputcheck |
| 662 |
\expandafter\@secondoftwo |
| 663 |
\else |
| 664 |
\closein\@inputcheck |
| 665 |
\expandafter\@firstoftwo |
| 666 |
\fi |
| 667 |
}% |
| 668 |
% \end{macrocode} |
| 669 |
% \end{macro} |
| 670 |
% \begin{macro}{\grffile@IfFileExists} |
| 671 |
% \begin{macrocode} |
| 672 |
\long\def\grffile@IfFileExists#1{% |
| 673 |
\grffile@XeTeX@IfFileExists{#1}{% |
| 674 |
\edef\grffile@file@found{#1}% |
| 675 |
\@firstoftwo |
| 676 |
}{% |
| 677 |
\let\reserved@a\@secondoftwo |
| 678 |
\ifx\input@path\@undefined |
| 679 |
\else |
| 680 |
\expandafter\@tfor\expandafter\reserved@b\expandafter |
| 681 |
:\expandafter=\input@path\do{% |
| 682 |
\grffile@XeTeX@IfFileExists{\reserved@b#1}{% |
| 683 |
\edef\grffile@file@found{\reserved@b#1}% |
| 684 |
\let\reserved@a\@firstoftwo |
| 685 |
\iftrue\@break@tfor\fi |
| 686 |
}{}% |
| 687 |
}% |
| 688 |
\fi |
| 689 |
\reserved@a |
| 690 |
}% |
| 691 |
}% |
| 692 |
% \end{macrocode} |
| 693 |
% \end{macro} |
| 694 |
% \begin{macro}{\grffile@org@Gread@QTm} |
| 695 |
% Patch \cs{Gread@QTm} of \xfile{xetex.def}. |
| 696 |
% \begin{macrocode} |
| 697 |
\def\grffile@org@Gread@QTm#1{% |
| 698 |
\IfFileExists{\[email protected]}{% |
| 699 |
\Gread@eps{\[email protected]}% |
| 700 |
}{% |
| 701 |
\G@measure@QTm{\Gin@base}{\Gin@ext}% |
| 702 |
}% |
| 703 |
}% |
| 704 |
% \end{macrocode} |
| 705 |
% \end{macro} |
| 706 |
% \begin{macrocode} |
| 707 |
\ifx\Gread@QTm\grffile@org@Gread@QTm |
| 708 |
% \end{macrocode} |
| 709 |
% \begin{macro}{\Gread@QTm} |
| 710 |
% \begin{macrocode} |
| 711 |
\def\Gread@QTm#1{% |
| 712 |
\grffile@IfFileExists{\[email protected]}{% |
| 713 |
\Gread@eps{\[email protected]}% |
| 714 |
}{% |
| 715 |
\G@measure@QTm{\Gin@base}{\Gin@ext}% |
| 716 |
}% |
| 717 |
}% |
| 718 |
% \end{macrocode} |
| 719 |
% \end{macro} |
| 720 |
% \begin{macrocode} |
| 721 |
\PackageInfo{grffile}{\string\Gread@QTm\space patched}% |
| 722 |
\else |
| 723 |
\begingroup\expandafter\expandafter\expandafter\endgroup |
| 724 |
\expandafter\ifx\csname Gread@QTm\endcsname\relax |
| 725 |
\@ifpackagelater{graphics}{2017/06/01} |
| 726 |
{} |
| 727 |
{% |
| 728 |
\PackageWarning{grffile}{% |
| 729 |
\string\Gread@QTm\space of xetex.def not found% |
| 730 |
}% |
| 731 |
}% |
| 732 |
\else |
| 733 |
% \end{macrocode} |
| 734 |
% \begin{macro}{\grffile@org@Gread@QTm} |
| 735 |
% \begin{macrocode} |
| 736 |
\let\grffile@org@Gread@QTm\Gread@QTm |
| 737 |
% \end{macrocode} |
| 738 |
% \end{macro} |
| 739 |
% \begin{macro}{\Gread@QTm} |
| 740 |
% \begin{macrocode} |
| 741 |
\def\Gread@QTm#1{% |
| 742 |
\let\grffile@saved@IfFileExists\IfFileExists |
| 743 |
\let\IfFileExists\grffile@IfFileExists |
| 744 |
\grffile@org@GreadQTm{#1}% |
| 745 |
\let\IfFileExists\grffile@saved@IfFileExists |
| 746 |
}% |
| 747 |
% \end{macrocode} |
| 748 |
% \end{macro} |
| 749 |
% \begin{macrocode} |
| 750 |
\fi |
| 751 |
\fi |
| 752 |
% \end{macrocode} |
| 753 |
% \begin{macro}{\grffile@org@Gread@eps} |
| 754 |
% \begin{macrocode} |
| 755 |
\let\grffile@org@Gread@eps\Gread@eps |
| 756 |
% \end{macrocode} |
| 757 |
% \end{macro} |
| 758 |
% \begin{macrocode} |
| 759 |
\def\grffile@temp#1\immediate\openin#2 #3\grffile@nil#4\grffile@NIL{% |
| 760 |
\begingroup |
| 761 |
\toks@{#2}% |
| 762 |
\edef\grffile@temp{\the\toks@}% |
| 763 |
\def\grffile@test{\@inputcheck####1}% |
| 764 |
\ifx\grffile@temp\grffile@test |
| 765 |
\expandafter\@firstoftwo |
| 766 |
\else |
| 767 |
\expandafter\@secondoftwo |
| 768 |
\fi |
| 769 |
{% |
| 770 |
\toks@{% |
| 771 |
#1% |
| 772 |
\immediate\openin\@inputcheck"##1"\relax |
| 773 |
#3% |
| 774 |
}% |
| 775 |
\expandafter\endgroup |
| 776 |
\expandafter\def\expandafter\Gread@eps |
| 777 |
\expandafter##\expandafter1\expandafter{% |
| 778 |
\the\toks@ |
| 779 |
}% |
| 780 |
\PackageInfo{grffile}{% |
| 781 |
\string\Gread@eps\space patched% |
| 782 |
}% |
| 783 |
}{% |
| 784 |
\@ifpackagelater{graphics}{2017/06/01} |
| 785 |
{} |
| 786 |
{% |
| 787 |
\PackageWarning{grffile}{% |
| 788 |
Unsupported \string\Gread@eps\space not patched% |
| 789 |
}% |
| 790 |
}% |
| 791 |
\endgroup |
| 792 |
}% |
| 793 |
}% |
| 794 |
\expandafter\grffile@temp\Gread@eps{#1}\grffile@nil |
| 795 |
\immediate\openin{} \grffile@nil\grffile@NIL |
| 796 |
% \end{macrocode} |
| 797 |
% \begin{macrocode} |
| 798 |
\else |
| 799 |
\begingroup |
| 800 |
\let\on@line\@empty |
| 801 |
\PackageInfo{grffile}{% |
| 802 |
\string\grffile@IfFileExists\space without space support,% |
| 803 |
\MessageBreak |
| 804 |
because pdfTeX's \string\pdffilesize\space is not available% |
| 805 |
\MessageBreak |
| 806 |
or XeTeX is not running% |
| 807 |
}% |
| 808 |
\endgroup |
| 809 |
% \end{macrocode} |
| 810 |
% \begin{macro}{\grffile@IfFileExists} |
| 811 |
% \begin{macrocode} |
| 812 |
\long\def\grffile@IfFileExists#1{% |
| 813 |
\IfFileExists{#1}{% |
| 814 |
\let\grffile@IFE@next\@firstoftwo |
| 815 |
}{% |
| 816 |
\let\grffile@file@found\@filef@und |
| 817 |
\let\grffile@IFE@next\@secondoftwo |
| 818 |
}% |
| 819 |
\grffile@IFE@next |
| 820 |
}% |
| 821 |
% \end{macrocode} |
| 822 |
% \end{macro} |
| 823 |
% \begin{macrocode} |
| 824 |
\fi |
| 825 |
\else |
| 826 |
% \end{macrocode} |
| 827 |
% \begin{macro}{\grffile@IfFileExists} |
| 828 |
% \begin{macrocode} |
| 829 |
\long\def\grffile@IfFileExists#1{% |
| 830 |
\expandafter\expandafter\expandafter |
| 831 |
\ifx\expandafter\expandafter\expandafter\\\pdf@filesize{#1}\\% |
| 832 |
\let\reserved@a\@secondoftwo |
| 833 |
\ifx\input@path\@undefined |
| 834 |
\else |
| 835 |
\expandafter\@tfor\expandafter\reserved@b\expandafter |
| 836 |
:\expandafter=\input@path\do{% |
| 837 |
\expandafter\expandafter\expandafter |
| 838 |
\ifx\expandafter\expandafter\expandafter |
| 839 |
\\\pdf@filesize{\reserved@b#1}\\% |
| 840 |
\else |
| 841 |
\edef\grffile@file@found{\reserved@b#1}% |
| 842 |
\let\reserved@a\@firstoftwo |
| 843 |
\@break@tfor |
| 844 |
\fi |
| 845 |
}% |
| 846 |
\fi |
| 847 |
\expandafter\reserved@a |
| 848 |
\else |
| 849 |
\edef\grffile@file@found{#1}% |
| 850 |
\expandafter\@firstoftwo |
| 851 |
\fi |
| 852 |
}% |
| 853 |
% \end{macrocode} |
| 854 |
% \end{macro} |
| 855 |
% \begin{macrocode} |
| 856 |
\fi |
| 857 |
% \end{macrocode} |
| 858 |
% \begin{macro}{\grffile@Ginclude@graphics} |
| 859 |
% \begin{macrocode} |
| 860 |
\def\grffile@Ginclude@graphics#1{% |
| 861 |
\begingroup |
| 862 |
\ifgrffile@space |
| 863 |
\let\Gin@getbase\grffile@space@getbase |
| 864 |
\fi |
| 865 |
\ifgrffile@multidot |
| 866 |
\let\filename@base\@empty |
| 867 |
\let\filename@simple\grffile@filename@simple |
| 868 |
\fi |
| 869 |
\grffile@org@Ginclude@graphics{#1}% |
| 870 |
\endgroup |
| 871 |
}% |
| 872 |
% \end{macrocode} |
| 873 |
% \end{macro} |
| 874 |
% \begin{macro}{\grffile@filename@simple} |
| 875 |
% \begin{macrocode} |
| 876 |
\def\grffile@filename@simple#1.#2\\{% |
| 877 |
\ifx\\#2\\% |
| 878 |
\def\filename@base{#1}% |
| 879 |
\let\filename@ext\relax |
| 880 |
\else |
| 881 |
\def\filename@base{}% |
| 882 |
\grffile@analyze@ext{#1}.{#2}\\% |
| 883 |
\fi |
| 884 |
} |
| 885 |
% \end{macrocode} |
| 886 |
% \end{macro} |
| 887 |
% \begin{macro}{\grffile@analyze@ext} |
| 888 |
% \begin{macrocode} |
| 889 |
\def\grffile@analyze@ext#1.#2\\{% |
| 890 |
\let\grffile@next\relax |
| 891 |
\ifx\\#2\\% |
| 892 |
\edef\filename@base{\filename@base#1}% |
| 893 |
\let\filename@ext\relax |
| 894 |
\def\grffile@next{\grffile@try@extlist}% |
| 895 |
\else |
| 896 |
\edef\filename@base{\filename@base #1}% |
| 897 |
\edef\filename@ext{\filename@dot#2\\}% |
| 898 |
\expandafter\ifx\csname Gin@rule@.\filename@ext\endcsname\relax |
| 899 |
\edef\filename@base{\filename@base.}% |
| 900 |
\def\grffile@next{\grffile@analyze@ext#2\\}% |
| 901 |
\else |
| 902 |
\grffile@IfFileExists{\filename@area\filename@base.\filename@ext}{% |
| 903 |
% success |
| 904 |
}{% |
| 905 |
\edef\filename@base{\filename@base.\filename@ext}% |
| 906 |
\let\filename@ext\relax |
| 907 |
\def\grffile@next{\grffile@try@extlist}% |
| 908 |
}% |
| 909 |
\fi |
| 910 |
\fi |
| 911 |
\grffile@next |
| 912 |
} |
| 913 |
% \end{macrocode} |
| 914 |
% \end{macro} |
| 915 |
% \begin{macro}{\grffile@try@extlist} |
| 916 |
% \begin{macrocode} |
| 917 |
\def\grffile@try@extlist{% |
| 918 |
\@for\grffile@temp:=\Gin@extensions\do{% |
| 919 |
\grffile@IfFileExists{\filename@area\filename@base\grffile@temp}{% |
| 920 |
\ifx\filename@ext\relax |
| 921 |
\edef\filename@ext{\expandafter\@gobble\grffile@temp\@empty}% |
| 922 |
\fi |
| 923 |
}{}% |
| 924 |
}% |
| 925 |
\ifx\filename@ext\relax |
| 926 |
\expandafter\let\expandafter\filename@base\expandafter\@empty |
| 927 |
\expandafter\grffile@use@last@ext\filename@base.\\% |
| 928 |
\fi |
| 929 |
} |
| 930 |
% \end{macrocode} |
| 931 |
% \end{macro} |
| 932 |
% \begin{macro}{\grffile@use@last@ext} |
| 933 |
% \begin{macrocode} |
| 934 |
\def\grffile@use@last@ext#1.#2\\{% |
| 935 |
\ifx\\#2\\% |
| 936 |
\edef\filename@base{\expandafter\filename@dot\filename@base\\}% |
| 937 |
\def\filename@ext{#1}% |
| 938 |
\expandafter\@gobble |
| 939 |
\else |
| 940 |
\edef\filename@base{\filename@base#1.}% |
| 941 |
\expandafter\@firstofone |
| 942 |
\fi |
| 943 |
{% |
| 944 |
\grffile@use@last@ext#2\\% |
| 945 |
}% |
| 946 |
} |
| 947 |
% \end{macrocode} |
| 948 |
% \end{macro} |
| 949 |
% |
| 950 |
% Print current option setting |
| 951 |
% \begin{macro}{\grffile@option@status} |
| 952 |
% \begin{macrocode} |
| 953 |
\def\grffile@option@status#1{% |
| 954 |
\begingroup |
| 955 |
\let\on@line\@empty |
| 956 |
\PackageInfo{grffile}{% |
| 957 |
Option `#1' is % |
| 958 |
\expandafter\ifx\csname ifgrffile@#1\expandafter\endcsname |
| 959 |
\csname iftrue\endcsname |
| 960 |
set to `true'% |
| 961 |
\else |
| 962 |
\expandafter\ifx\csname grffile@#1@disabled\endcsname\@empty |
| 963 |
not available% |
| 964 |
\else |
| 965 |
set to `false'% |
| 966 |
\fi |
| 967 |
\fi |
| 968 |
}% |
| 969 |
\endgroup |
| 970 |
} |
| 971 |
% \end{macrocode} |
| 972 |
% \end{macro} |
| 973 |
% \begin{macrocode} |
| 974 |
\grffile@option@status{multidot} |
| 975 |
\grffile@option@status{extendedchars} |
| 976 |
\grffile@option@status{space} |
| 977 |
% \end{macrocode} |
| 978 |
% |
| 979 |
% \subsection{Fix \cs{Gin@ii} of package \xpackage{graphicx}} |
| 980 |
% |
| 981 |
% If the image file name contains the hash character |
| 982 |
% macro \cs{Gin@ii} of package \xpackage{graphicx} breaks. |
| 983 |
% \begin{macro}{\grffile@Gin@ii@graphicx} |
| 984 |
% \begin{macrocode} |
| 985 |
\def\grffile@Gin@ii@graphicx[#1]#2{% |
| 986 |
\def\@tempa{[}% |
| 987 |
\def\@tempb{#2}% |
| 988 |
\ifx\@tempa\@tempb |
| 989 |
\def\@tempa{\Gin@iii[#1][}% hash-ok |
| 990 |
\expandafter\@tempa |
| 991 |
\else |
| 992 |
\begingroup |
| 993 |
\@tempswafalse |
| 994 |
\toks@{\Ginclude@graphics{#2}}% |
| 995 |
\setkeys{Gin}{#1}% |
| 996 |
\Gin@esetsize |
| 997 |
\the\toks@ |
| 998 |
\endgroup |
| 999 |
\fi |
| 1000 |
} |
| 1001 |
% \end{macrocode} |
| 1002 |
% \end{macro} |
| 1003 |
% \begin{macro}{\grffile@Gin@ii@fixed} |
| 1004 |
% \begin{macrocode} |
| 1005 |
\def\grffile@Gin@ii@fixed[#1]#2{% |
| 1006 |
\def\@tempa{[}% |
| 1007 |
\begingroup |
| 1008 |
\toks@={#2}% |
| 1009 |
\edef\@tempb{\the\toks@}% |
| 1010 |
\expandafter\endgroup |
| 1011 |
\ifx\@tempa\@tempb |
| 1012 |
\def\@tempa{\Gin@iii[#1][}% hash-ok |
| 1013 |
\expandafter\@tempa |
| 1014 |
\else |
| 1015 |
\begingroup |
| 1016 |
\@tempswafalse |
| 1017 |
\toks@{\Ginclude@graphics{#2}}% |
| 1018 |
\setkeys{Gin}{#1}% |
| 1019 |
\Gin@esetsize |
| 1020 |
\the\toks@ |
| 1021 |
\endgroup |
| 1022 |
\fi |
| 1023 |
} |
| 1024 |
% \end{macrocode} |
| 1025 |
% \end{macro} |
| 1026 |
% \begin{macro}{\grffile@Fix@Gin@ii} |
| 1027 |
% \begin{macrocode} |
| 1028 |
\def\grffile@Fix@Gin@ii{% |
| 1029 |
\let\Gin@ii\grffile@Gin@ii@fixed |
| 1030 |
\begingroup |
| 1031 |
\escapechar=92 % |
| 1032 |
\PackageInfo{grffile}{\string\Gin@ii\space of package `graphicx' fixed}% |
| 1033 |
\endgroup |
| 1034 |
} |
| 1035 |
% \end{macrocode} |
| 1036 |
% \end{macro} |
| 1037 |
% \begin{macrocode} |
| 1038 |
\ifx\Gin@ii\grffile@Gin@ii@graphicx |
| 1039 |
\grffile@Fix@Gin@ii |
| 1040 |
\else |
| 1041 |
\AtBeginDocument{\grffile@Fix@Gin@ii}% |
| 1042 |
\fi |
| 1043 |
% \end{macrocode} |
| 1044 |
% |
| 1045 |
% \begin{macrocode} |
| 1046 |
\grffile@RestoreCatcodes |
| 1047 |
% \end{macrocode} |
| 1048 |
% |
| 1049 |
% \begin{macrocode} |
| 1050 |
%</package> |
| 1051 |
% \end{macrocode} |
| 1052 |
% |
| 1053 |
% \section{Test} |
| 1054 |
% |
| 1055 |
% \subsection{Multidot with default rule} |
| 1056 |
% |
| 1057 |
% \begin{macrocode} |
| 1058 |
%<*test1> |
| 1059 |
\NeedsTeXFormat{LaTeX2e} |
| 1060 |
\documentclass{article} |
| 1061 |
\usepackage{filecontents} |
| 1062 |
% file grffile-test.mp: |
| 1063 |
% beginfig(1); |
| 1064 |
% draw fullcircle scaled 2cm withpen pencircle scaled 2mm; |
| 1065 |
% endfig; |
| 1066 |
% end |
| 1067 |
\begin{filecontents*}{grffile-test.1} |
| 1068 |
%!PS |
| 1069 |
%%BoundingBox: -32 -32 32 32 |
| 1070 |
%%Creator: MetaPost |
| 1071 |
%%CreationDate: 2004.06.16:1257 |
| 1072 |
%%Pages: 1 |
| 1073 |
%%EndProlog |
| 1074 |
%%Page: 1 1 |
| 1075 |
0 5.66928 dtransform truncate idtransform setlinewidth pop [] 0 setdash |
| 1076 |
1 setlinejoin 10 setmiterlimit |
| 1077 |
newpath 28.34645 0 moveto |
| 1078 |
28.34645 7.51828 25.35938 14.72774 20.04356 20.04356 curveto |
| 1079 |
14.72774 25.35938 7.51828 28.34645 0 28.34645 curveto |
| 1080 |
-7.51828 28.34645 -14.72774 25.35938 -20.04356 20.04356 curveto |
| 1081 |
-25.35938 14.72774 -28.34645 7.51828 -28.34645 0 curveto |
| 1082 |
-28.34645 -7.51828 -25.35938 -14.72774 -20.04356 -20.04356 curveto |
| 1083 |
-14.72774 -25.35938 -7.51828 -28.34645 0 -28.34645 curveto |
| 1084 |
7.51828 -28.34645 14.72774 -25.35938 20.04356 -20.04356 curveto |
| 1085 |
25.35938 -14.72774 28.34645 -7.51828 28.34645 0 curveto closepath stroke |
| 1086 |
showpage |
| 1087 |
%%EOF |
| 1088 |
\end{filecontents*} |
| 1089 |
\usepackage{graphicx} |
| 1090 |
\usepackage[multidot]{grffile}[2008/10/13] |
| 1091 |
\DeclareGraphicsRule{*}{mps}{*}{} % for pdflatex |
| 1092 |
\begin{document} |
| 1093 |
\includegraphics{grffile-test.1} |
| 1094 |
\end{document} |
| 1095 |
%</test1> |
| 1096 |
% \end{macrocode} |
| 1097 |
% |
| 1098 |
% \section{Installation} |
| 1099 |
% |
| 1100 |
% \subsection{Download} |
| 1101 |
% |
| 1102 |
% \paragraph{Package.} This package is available on |
| 1103 |
% CTAN\footnote{\url{http://ctan.org/pkg/grffile}}: |
| 1104 |
% \begin{description} |
| 1105 |
% \item[\CTAN{macros/latex/contrib/grffile/grffile.dtx}] The source file. |
| 1106 |
% \item[\CTAN{macros/latex/contrib/grffile/grffile.pdf}] Documentation. |
| 1107 |
% \end{description} |
| 1108 |
% |
| 1109 |
% |
| 1110 |
% \paragraph{Bundle.} All the packages of the bundle `oberdiek' |
| 1111 |
% are also available in a TDS compliant ZIP archive. There |
| 1112 |
% the packages are already unpacked and the documentation files |
| 1113 |
% are generated. The files and directories obey the TDS standard. |
| 1114 |
% \begin{description} |
| 1115 |
% \item[\CTAN{install/macros/latex/contrib/grffile.tds.zip}] |
| 1116 |
% \end{description} |
| 1117 |
% \emph{TDS} refers to the standard ``A Directory Structure |
| 1118 |
% for \TeX\ Files'' (\CTAN{tds/tds.pdf}). Directories |
| 1119 |
% with \xfile{texmf} in their name are usually organized this way. |
| 1120 |
% |
| 1121 |
% \subsection{Bundle installation} |
| 1122 |
% |
| 1123 |
% \paragraph{Unpacking.} Unpack the \xfile{oberdiek.tds.zip} in the |
| 1124 |
% TDS tree (also known as \xfile{texmf} tree) of your choice. |
| 1125 |
% Example (linux): |
| 1126 |
% \begin{quote} |
| 1127 |
% |unzip oberdiek.tds.zip -d ~/texmf| |
| 1128 |
% \end{quote} |
| 1129 |
% |
| 1130 |
% \paragraph{Script installation.} |
| 1131 |
% Check the directory \xfile{TDS:scripts/oberdiek/} for |
| 1132 |
% scripts that need further installation steps. |
| 1133 |
% Package \xpackage{attachfile2} comes with the Perl script |
| 1134 |
% \xfile{pdfatfi.pl} that should be installed in such a way |
| 1135 |
% that it can be called as \texttt{pdfatfi}. |
| 1136 |
% Example (linux): |
| 1137 |
% \begin{quote} |
| 1138 |
% |chmod +x scripts/oberdiek/pdfatfi.pl|\\ |
| 1139 |
% |cp scripts/oberdiek/pdfatfi.pl /usr/local/bin/| |
| 1140 |
% \end{quote} |
| 1141 |
% |
| 1142 |
% \subsection{Package installation} |
| 1143 |
% |
| 1144 |
% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting |
| 1145 |
% \docstrip\ archive. The files are extracted by running the |
| 1146 |
% \xfile{.dtx} through \plainTeX: |
| 1147 |
% \begin{quote} |
| 1148 |
% \verb|tex grffile.dtx| |
| 1149 |
% \end{quote} |
| 1150 |
% |
| 1151 |
% \paragraph{TDS.} Now the different files must be moved into |
| 1152 |
% the different directories in your installation TDS tree |
| 1153 |
% (also known as \xfile{texmf} tree): |
| 1154 |
% \begin{quote} |
| 1155 |
% \def\t{^^A |
| 1156 |
% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} |
| 1157 |
% grffile.sty & tex/latex/grffile/grffile.sty\\ |
| 1158 |
% grffile.pdf & doc/latex/grffile/grffile.pdf\\ |
| 1159 |
% test/grffile-test1.tex & doc/latex/grffile/test/grffile-test1.tex\\ |
| 1160 |
% grffile.dtx & source/latex/grffile/grffile.dtx\\ |
| 1161 |
% \end{tabular}^^A |
| 1162 |
% }^^A |
| 1163 |
% \sbox0{\t}^^A |
| 1164 |
% \ifdim\wd0>\linewidth |
| 1165 |
% \begingroup |
| 1166 |
% \advance\linewidth by\leftmargin |
| 1167 |
% \advance\linewidth by\rightmargin |
| 1168 |
% \edef\x{\endgroup |
| 1169 |
% \def\noexpand\lw{\the\linewidth}^^A |
| 1170 |
% }\x |
| 1171 |
% \def\lwbox{^^A |
| 1172 |
% \leavevmode |
| 1173 |
% \hbox to \linewidth{^^A |
| 1174 |
% \kern-\leftmargin\relax |
| 1175 |
% \hss |
| 1176 |
% \usebox0 |
| 1177 |
% \hss |
| 1178 |
% \kern-\rightmargin\relax |
| 1179 |
% }^^A |
| 1180 |
% }^^A |
| 1181 |
% \ifdim\wd0>\lw |
| 1182 |
% \sbox0{\small\t}^^A |
| 1183 |
% \ifdim\wd0>\linewidth |
| 1184 |
% \ifdim\wd0>\lw |
| 1185 |
% \sbox0{\footnotesize\t}^^A |
| 1186 |
% \ifdim\wd0>\linewidth |
| 1187 |
% \ifdim\wd0>\lw |
| 1188 |
% \sbox0{\scriptsize\t}^^A |
| 1189 |
% \ifdim\wd0>\linewidth |
| 1190 |
% \ifdim\wd0>\lw |
| 1191 |
% \sbox0{\tiny\t}^^A |
| 1192 |
% \ifdim\wd0>\linewidth |
| 1193 |
% \lwbox |
| 1194 |
% \else |
| 1195 |
% \usebox0 |
| 1196 |
% \fi |
| 1197 |
% \else |
| 1198 |
% \lwbox |
| 1199 |
% \fi |
| 1200 |
% \else |
| 1201 |
% \usebox0 |
| 1202 |
% \fi |
| 1203 |
% \else |
| 1204 |
% \lwbox |
| 1205 |
% \fi |
| 1206 |
% \else |
| 1207 |
% \usebox0 |
| 1208 |
% \fi |
| 1209 |
% \else |
| 1210 |
% \lwbox |
| 1211 |
% \fi |
| 1212 |
% \else |
| 1213 |
% \usebox0 |
| 1214 |
% \fi |
| 1215 |
% \else |
| 1216 |
% \lwbox |
| 1217 |
% \fi |
| 1218 |
% \else |
| 1219 |
% \usebox0 |
| 1220 |
% \fi |
| 1221 |
% \end{quote} |
| 1222 |
% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's |
| 1223 |
% TDS installing feature, then some files can already be in the right |
| 1224 |
% place, see the documentation of \docstrip. |
| 1225 |
% |
| 1226 |
% \subsection{Refresh file name databases} |
| 1227 |
% |
| 1228 |
% If your \TeX~distribution |
| 1229 |
% (\teTeX, \mikTeX, \dots) relies on file name databases, you must refresh |
| 1230 |
% these. For example, \teTeX\ users run \verb|texhash| or |
| 1231 |
% \verb|mktexlsr|. |
| 1232 |
% |
| 1233 |
% \subsection{Some details for the interested} |
| 1234 |
% |
| 1235 |
% \paragraph{Attached source.} |
| 1236 |
% |
| 1237 |
% The PDF documentation on CTAN also includes the |
| 1238 |
% \xfile{.dtx} source file. It can be extracted by |
| 1239 |
% AcrobatReader 6 or higher. Another option is \textsf{pdftk}, |
| 1240 |
% e.g. unpack the file into the current directory: |
| 1241 |
% \begin{quote} |
| 1242 |
% \verb|pdftk grffile.pdf unpack_files output .| |
| 1243 |
% \end{quote} |
| 1244 |
% |
| 1245 |
% \paragraph{Unpacking with \LaTeX.} |
| 1246 |
% The \xfile{.dtx} chooses its action depending on the format: |
| 1247 |
% \begin{description} |
| 1248 |
% \item[\plainTeX:] Run \docstrip\ and extract the files. |
| 1249 |
% \item[\LaTeX:] Generate the documentation. |
| 1250 |
% \end{description} |
| 1251 |
% If you insist on using \LaTeX\ for \docstrip\ (really, |
| 1252 |
% \docstrip\ does not need \LaTeX), then inform the autodetect routine |
| 1253 |
% about your intention: |
| 1254 |
% \begin{quote} |
| 1255 |
% \verb|latex \let\install=y\input{grffile.dtx}| |
| 1256 |
% \end{quote} |
| 1257 |
% Do not forget to quote the argument according to the demands |
| 1258 |
% of your shell. |
| 1259 |
% |
| 1260 |
% \paragraph{Generating the documentation.} |
| 1261 |
% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate |
| 1262 |
% the documentation. The process can be configured by the |
| 1263 |
% configuration file \xfile{ltxdoc.cfg}. For instance, put this |
| 1264 |
% line into this file, if you want to have A4 as paper format: |
| 1265 |
% \begin{quote} |
| 1266 |
% \verb|\PassOptionsToClass{a4paper}{article}| |
| 1267 |
% \end{quote} |
| 1268 |
% An example follows how to generate the |
| 1269 |
% documentation with pdf\LaTeX: |
| 1270 |
% \begin{quote} |
| 1271 |
%\begin{verbatim} |
| 1272 |
%pdflatex grffile.dtx |
| 1273 |
%makeindex -s gind.ist grffile.idx |
| 1274 |
%pdflatex grffile.dtx |
| 1275 |
%makeindex -s gind.ist grffile.idx |
| 1276 |
%pdflatex grffile.dtx |
| 1277 |
%\end{verbatim} |
| 1278 |
% \end{quote} |
| 1279 |
% |
| 1280 |
% \section{Catalogue} |
| 1281 |
% |
| 1282 |
% The following XML file can be used as source for the |
| 1283 |
% \href{http://mirror.ctan.org/help/Catalogue/catalogue.html}{\TeX\ Catalogue}. |
| 1284 |
% The elements \texttt{caption} and \texttt{description} are imported |
| 1285 |
% from the original XML file from the Catalogue. |
| 1286 |
% The name of the XML file in the Catalogue is \xfile{grffile.xml}. |
| 1287 |
% \begin{macrocode} |
| 1288 |
%<*catalogue> |
| 1289 |
<?xml version='1.0' encoding='us-ascii'?> |
| 1290 |
<!DOCTYPE entry SYSTEM 'catalogue.dtd'> |
| 1291 |
<entry datestamp='$Date$' modifier='$Author$' id='grffile'> |
| 1292 |
<name>grffile</name> |
| 1293 |
<caption>Extended file name support for graphics.</caption> |
| 1294 |
<authorref id='auth:oberdiek'/> |
| 1295 |
<copyright owner='Heiko Oberdiek' year='2006-2012'/> |
| 1296 |
<license type='lppl1.3'/> |
| 1297 |
<version number='1.18'/> |
| 1298 |
<description> |
| 1299 |
The package extends the file name processing of package |
| 1300 |
<xref refid='graphics'>graphics</xref> to support a larger range |
| 1301 |
of file names. For example, the file name may contain several dots. |
| 1302 |
|
| 1303 |
Or in case of <xref refid='pdftex'>pdfTeX</xref> in PDF mode the |
| 1304 |
file name may contain spaces. |
| 1305 |
<p/> |
| 1306 |
The package is part of the <xref refid='oberdiek'>oberdiek</xref> |
| 1307 |
bundle. |
| 1308 |
</description> |
| 1309 |
<documentation details='Package documentation' |
| 1310 |
href='ctan:/macros/latex/contrib/grffile/grffile.pdf'/> |
| 1311 |
<ctan file='true' path='/macros/latex/contrib/grffile/grffile.dtx'/> |
| 1312 |
<miktex location='oberdiek'/> |
| 1313 |
<texlive location='oberdiek'/> |
| 1314 |
<install path='/macros/latex/contrib/grffile/grffile.tds.zip'/> |
| 1315 |
</entry> |
| 1316 |
%</catalogue> |
| 1317 |
% \end{macrocode} |
| 1318 |
% |
| 1319 |
% \begin{thebibliography}{9} |
| 1320 |
% |
| 1321 |
% \bibitem{graphics} |
| 1322 |
% David Carlisle, Sebastian Rahtz: \textit{The \xpackage{graphics} package}; |
| 1323 |
% 2006/02/20 v1.0o; |
| 1324 |
% \CTAN{macros/latex/required/graphics/graphics.dtx}. |
| 1325 |
% |
| 1326 |
% \bibitem{graphicx} |
| 1327 |
% Sebastian Rahtz, Heiko Oberdiek: |
| 1328 |
% \textit{The \xpackage{graphicx} package}; |
| 1329 |
% 1999/02/16 v1.0f; |
| 1330 |
% \CTAN{macros/latex/required/graphics/graphicx.dtx}. |
| 1331 |
% |
| 1332 |
% \end{thebibliography} |
| 1333 |
% |
| 1334 |
% \begin{History} |
| 1335 |
% \begin{Version}{2004/07/18 v0.5} |
| 1336 |
% \item |
| 1337 |
% First version, published in newsgroup \xnewsgroup{de.comp.text.tex}:\\ |
| 1338 |
% \URL{``\link{Re: Dateinamenproblem}''}^^A |
| 1339 |
% {http://groups.google.com/group/de.comp.text.tex/msg/b85984095d1a3c95} |
| 1340 |
% \end{Version} |
| 1341 |
% \begin{Version}{2006/08/15 v1.0} |
| 1342 |
% \item |
| 1343 |
% File existence check by new primitives of pdfTeX 1.30. |
| 1344 |
% \item |
| 1345 |
% Implementation partly rewritten. |
| 1346 |
% \item |
| 1347 |
% New DTX framework. |
| 1348 |
% \end{Version} |
| 1349 |
% \begin{Version}{2006/08/17 v1.1} |
| 1350 |
% \item |
| 1351 |
% Adaptation to version 2.3 of package \xpackage{kvoptions}. |
| 1352 |
% \end{Version} |
| 1353 |
% \begin{Version}{2006/11/30 v1.2} |
| 1354 |
% \item |
| 1355 |
% New option \xoption{babel}. Before this feature was part |
| 1356 |
% of option \xoption{extendedchars}. |
| 1357 |
% \end{Version} |
| 1358 |
% \begin{Version}{2007/04/11 v1.3} |
| 1359 |
% \item |
| 1360 |
% Line ends sanitized. |
| 1361 |
% \end{Version} |
| 1362 |
% \begin{Version}{2007/06/13 v1.4} |
| 1363 |
% \item |
| 1364 |
% Encoding support added with options \xoption{encoding}, |
| 1365 |
% \xoption{inputencoding}, and \xoption{filenameencoding}. |
| 1366 |
% \end{Version} |
| 1367 |
% \begin{Version}{2007/08/16 v1.5} |
| 1368 |
% \item |
| 1369 |
% Bug fix in encoding support. |
| 1370 |
% \end{Version} |
| 1371 |
% \begin{Version}{2007/11/11 v1.6} |
| 1372 |
% \item |
| 1373 |
% Use of package \xpackage{pdftexcmds} for \LuaTeX\ support. |
| 1374 |
% \end{Version} |
| 1375 |
% \begin{Version}{2007/11/24 v1.7} |
| 1376 |
% \item |
| 1377 |
% Bug fix of broken previous version. |
| 1378 |
% \end{Version} |
| 1379 |
% \begin{Version}{2008/08/11 v1.8} |
| 1380 |
% \item |
| 1381 |
% Code is not changed. |
| 1382 |
% \item |
| 1383 |
% URLs updated. |
| 1384 |
% \end{Version} |
| 1385 |
% \begin{Version}{2008/10/13 v1.9} |
| 1386 |
% \item |
| 1387 |
% Fix for option `multidot' with default rule. |
| 1388 |
% \end{Version} |
| 1389 |
% \begin{Version}{2009/09/25 v1.10} |
| 1390 |
% \item |
| 1391 |
% Rewrite of `multidot' algorithm to fix a problem |
| 1392 |
% (`multidot' with \cs{graphicspath}). |
| 1393 |
% \end{Version} |
| 1394 |
% \begin{Version}{2010/01/28 v1.11} |
| 1395 |
% \item |
| 1396 |
% Undefined \cs{pdf@filesize} fixed. |
| 1397 |
% \end{Version} |
| 1398 |
% \begin{Version}{2010/08/26 v1.12} |
| 1399 |
% \item |
| 1400 |
% Macro \cs{Gin@ii} of package \xpackage{graphicx} fixed |
| 1401 |
% for the case that the file name contains a hash. |
| 1402 |
% \end{Version} |
| 1403 |
% \begin{Version}{2010/12/09 v1.13} |
| 1404 |
% \item |
| 1405 |
% Option \xoption{space} also supports \hologo{XeTeX}. |
| 1406 |
% \end{Version} |
| 1407 |
% \begin{Version}{2011/10/04 v1.14} |
| 1408 |
% \item |
| 1409 |
% Fix for option \xoption{space} support of \hologo{XeTeX} |
| 1410 |
% for EPS files (\cs{Gread@eps}). (Bug reported by Peter Davis.) |
| 1411 |
% \end{Version} |
| 1412 |
% \begin{Version}{2011/10/17 v1.15} |
| 1413 |
% \item |
| 1414 |
% Bug fix for option \xoption{space} support of \hologo{XeTeX}. |
| 1415 |
% Wrong usage of \cs{@break@tfor} fixed. |
| 1416 |
% (Bug reported by Martin Schr\"oder.) |
| 1417 |
% \end{Version} |
| 1418 |
% \begin{Version}{2012/04/05 v1.16} |
| 1419 |
% \item |
| 1420 |
% Some fix for option \xoption{extendedchars}. |
| 1421 |
% \end{Version} |
| 1422 |
% \begin{Version}{2016/05/16 v1.17} |
| 1423 |
% \item |
| 1424 |
% Documentation updates. |
| 1425 |
% \end{Version} |
| 1426 |
% \begin{Version}{2017/06/30 v1.18} |
| 1427 |
% \item |
| 1428 |
% Update to follow \xpackage{graphics} changes. |
| 1429 |
% \end{Version} |
| 1430 |
% \end{History} |
| 1431 |
% |
| 1432 |
% \PrintIndex |
| 1433 |
% |
| 1434 |
% \Finale |
| 1435 |
\endinput |