summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/oberdiek/grffile.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/grffile.dtx')
-rw-r--r--Master/texmf-dist/source/latex/oberdiek/grffile.dtx324
1 files changed, 282 insertions, 42 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/grffile.dtx b/Master/texmf-dist/source/latex/oberdiek/grffile.dtx
index 5bd691494db..e1562c4e039 100644
--- a/Master/texmf-dist/source/latex/oberdiek/grffile.dtx
+++ b/Master/texmf-dist/source/latex/oberdiek/grffile.dtx
@@ -73,7 +73,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: grffile 2010/01/28 v1.11 Extended file name support for graphics (HO)}
+\Msg{* Package: grffile 2010/12/09 v1.13 Extended file name support for graphics (HO)}
\Msg{************************************************************************}
\keepsilent
@@ -146,7 +146,7 @@ and the derived files
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{grffile.drv}%
- [2010/01/28 v1.11 Extended file name support for graphics (HO)]%
+ [2010/12/09 v1.13 Extended file name support for graphics (HO)]%
\documentclass{ltxdoc}
\usepackage{holtxdoc}[2008/08/11]
\begin{document}
@@ -155,7 +155,7 @@ and the derived files
%</driver>
% \fi
%
-% \CheckSum{596}
+% \CheckSum{803}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -176,7 +176,7 @@ and the derived files
% \GetFileInfo{grffile.drv}
%
% \title{The \xpackage{grffile} package}
-% \date{2010/01/28 v1.11}
+% \date{2010/12/09 v1.13}
% \author{Heiko Oberdiek\\\xemail{heiko.oberdiek at googlemail.com}}
%
% \maketitle
@@ -328,18 +328,26 @@ and the derived files
% drivers \xoption{dvips} or \xoption{dvipdfm} do not allow
% spaces. However \pdfTeX's primitive \cs{pdfximage}
% uses curly braces to delimit the file name and allows spaces.
+% In case of \hologo{XeTeX} file names can be enclosed in quotes
+% to support spaces (at the cost that quotes no longer work).
% \item \cs{includegraphics} checks the existence of the file.
% Also it looks for the right extension if the extension is
-% not given. If \pdfTeX\ 1.30 is given, the file existence test
+% not given.
+%
+% If \pdfTeX\ 1.30 is given, the file existence test
% can be rewritten using a new primitive that allows spaces.
% This works in both modes DVI and PDF.
+%
+% In case of \hologo{XeTeX} the file existence test is rewritten
+% to automatically add quotes.
% \item Sometimes files are read as \TeX\ input files. For example,
% \verb|.bb| files or MPS files.
% \end{enumerate}
% If \pdfTeX\ 1.30 or greater is used in PDF mode then the
% graphics file names may contain spaces except for MPS files.
% Therefore option \xoption{space} is only enabled by default,
-% if the supported \pdfTeX\ in PDF mode is detected.
+% if the supported \pdfTeX\ in PDF mode is detected or \hologo{XeTeX}
+% is running.
% You can enable the option manually, if you know, your DVI driver
% supports spaces in its \cs{special} syntax and if there is no
% need to read the image file as \TeX\ input file (third context).
@@ -384,7 +392,7 @@ and the derived files
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{grffile}%
- [2010/01/28 v1.11 Extended file name support for graphics (HO)]%
+ [2010/12/09 v1.13 Extended file name support for graphics (HO)]%
% \end{macrocode}
%
% \subsection{Catcode stuff}
@@ -415,12 +423,14 @@ and the derived files
% \subsection{Options}
%
% \begin{macrocode}
-\RequirePackage{ifpdf}
+\RequirePackage{ifpdf}[2010/01/28]
+\RequirePackage{ifxetex}[2010/09/12]
\RequirePackage{kvoptions}[2006/08/17]
\SetupKeyvalOptions{%
family=Gin,%
prefix=grffile@%
}
+\DeclareDefaultOption{\@unknownoptionerror}
\DeclareBoolOption[true]{multidot}
\DeclareBoolOption[true]{babel}
\DeclareBoolOption[false]{extendedchars}
@@ -437,21 +447,25 @@ and the derived files
% Default setting for option \xoption{space}.
% \begin{macrocode}
\RequirePackage{pdftexcmds}[2007/11/11]
-\begingroup\expandafter\expandafter\expandafter\endgroup
-\expandafter\ifx\csname pdf@filesize\endcsname\relax
- \grffile@spacefalse
- \let\grffile@space@disabled\@empty
- \def\grffile@spacetrue{%
- \PackageWarning{grffile}{%
- Option `space' is not available,\MessageBreak
- because it needs pdfTeX >= 1.30%
- }%
- }%
+\ifxetex
+ \grffile@spacetrue
\else
- \ifpdf
- \grffile@spacetrue
- \else
+ \begingroup\expandafter\expandafter\expandafter\endgroup
+ \expandafter\ifx\csname pdf@filesize\endcsname\relax
\grffile@spacefalse
+ \let\grffile@space@disabled\@empty
+ \def\grffile@spacetrue{%
+ \PackageWarning{grffile}{%
+ Option `space' is not available,\MessageBreak
+ because it needs pdfTeX >= 1.30 or XeTeX%
+ }%
+ }%
+ \else
+ \ifpdf
+ \grffile@spacetrue
+ \else
+ \grffile@spacefalse
+ \fi
\fi
\fi
% \end{macrocode}
@@ -473,8 +487,13 @@ and the derived files
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\grffile@org@Ginclude@graphics}
% \begin{macrocode}
\let\grffile@org@Ginclude@graphics\Ginclude@graphics
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\Ginclude@graphics}
+% \begin{macrocode}
\renewcommand*{\Ginclude@graphics}{%
\ifx\grffile@filenameencoding\@empty
\else
@@ -520,8 +539,13 @@ and the derived files
\expandafter\grffile@Ginclude@graphics
\fi
}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\grffile@extchar@Ginclude@graphics}
+% \begin{macrocode}
\def\grffile@extchar@Ginclude@graphics#1{%
- \def\grffile@filename{#1}%
+ \toks@{#1}%
+ \edef\grffile@filename{\the\toks@}%
\ifx\grffile@inputencoding\@empty
\else
\ifx\grfile@filenameencoding\@empty
@@ -547,11 +571,16 @@ and the derived files
\fi
\fi
\fi
+ \toks@\expandafter{\grffile@filename}%
\edef\x{\endgroup
- \noexpand\grffile@Ginclude@graphics{\grffile@filename}%
+ \noexpand\grffile@Ginclude@graphics{\the\toks@}%
}%
\x
}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\grffile@inputenc@loop}
+% \begin{macrocode}
\def\grffile@inputenc@loop#1#2{%
\count@=`#1\relax
\loop
@@ -566,7 +595,9 @@ and the derived files
\repeat
}
% \end{macrocode}
+% \end{macro}
% Support for option \xoption{space}
+% \begin{macro}{\grffile@space@getbase}
% \begin{macrocode}
\def\grffile@space@getbase#1{%
\edef\grffile@tempa{%
@@ -581,26 +612,137 @@ and the derived files
}{%
}%
}
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname pdf@filesize\endcsname\relax
- \begingroup
- \let\on@line\@empty
- \PackageInfo{grffile}{%
- \string\grffile@IfFileExists\space without space support,%
- \MessageBreak
- because pdfTeX's \string\pdffilesize\space is not available%
+ \ifxetex
+% \end{macrocode}
+% \begin{macro}{\grffile@XeTeX@IfFileExists}
+% \begin{macrocode}
+ \long\def\grffile@XeTeX@IfFileExists#1{%
+ \openin\@inputcheck"#1" %
+ \ifeof\@inputcheck
+ \closein\@inputcheck
+ \expandafter\@secondoftwo
+ \else
+ \closein\@inputcheck
+ \expandafter\@firstoftwo
+ \fi
}%
- \endgroup
- \def\grffile@IfFileExists#1{%
- \IfFileExists{#1}{%
- \let\grffile@IFE@next\@firstoftwo
- }{%
- \let\grffile@IFE@next\@secondoftwo
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\grffile@IfFileExists}
+% \begin{macrocode}
+ \long\def\grffile@IfFileExists#1{%
+ \grffile@XeTeX@IfFileExists{#1}{%
+ \edef\grffile@file@found{#1}%
+ \@firstoftwo
+ }{%
+ \let\reserved@a\@secondoftwo
+ \ifx\input@path\@undefined
+ \else
+ \expandafter\@tfor\expandafter\reserved@b\expandafter
+ :\expandafter=\input@path\do{%
+ \grffile@XeTeX@IfFileExists{\reserved@b#1}{%
+ \edef\grffile@file@found{\reserved@b#1}%
+ \let\reserved@a\@firstoftwo
+ \@break@tfor
+ }{}%
+ }%
+ \fi
+ \reserved@a
+ }%
}%
- \grffile@IFE@next
- }%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\grffile@org@Gread@QTm}
+% Patch \cs{Gread@QTm} of \xfile{xetex.def}.
+% \begin{macrocode}
+ \def\grffile@org@Gread@QTm#1{%
+ \IfFileExists{\Gin@base.bb}{%
+ \Gread@eps{\Gin@base.bb}%
+ }{%
+ \G@measure@QTm{\Gin@base}{\Gin@ext}%
+ }%
+ }%
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+ \ifx\Gread@QTm\grffile@org@Gread@QTm
+% \end{macrocode}
+% \begin{macro}{\Gread@QTm}
+% \begin{macrocode}
+ \def\Gread@QTm#1{%
+ \grffile@IfFileExists{\Gin@base.bb}{%
+ \Gread@eps{\Gin@base.bb}%
+ }{%
+ \G@measure@QTm{\Gin@base}{\Gin@ext}%
+ }%
+ }%
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+ \PackageInfo{grffile}{\string\Gread@QTm\space patched}%
+ \else
+ \begingroup\expandafter\expandafter\expandafter\endgroup
+ \expandafter\ifx\csname Gread@QTm\endcsname\relax
+ \PackageWarning{grffile}{%
+ \string\Gread@QTm\space of xetex.def not found%
+ }%
+ \else
+% \end{macrocode}
+% \begin{macro}{\grffile@org@Gread@QTm}
+% \begin{macrocode}
+ \let\grffile@org@Gread@QTm\Gread@QTm
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\Gread@QTm}
+% \begin{macrocode}
+ \def\Gread@QTm#1{%
+ \let\grffile@saved@IfFileExists\IfFileExists
+ \let\IfFileExists\grffile@IfFileExists
+ \grffile@org@GreadQTm{#1}%
+ \let\IfFileExists\grffile@saved@IfFileExists
+ }%
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+ \fi
+ \fi
+ \else
+ \begingroup
+ \let\on@line\@empty
+ \PackageInfo{grffile}{%
+ \string\grffile@IfFileExists\space without space support,%
+ \MessageBreak
+ because pdfTeX's \string\pdffilesize\space is not available%
+ \MessageBreak
+ or XeTeX is not running%
+ }%
+ \endgroup
+% \end{macrocode}
+% \begin{macro}{\grffile@IfFileExists}
+% \begin{macrocode}
+ \long\def\grffile@IfFileExists#1{%
+ \IfFileExists{#1}{%
+ \let\grffile@IFE@next\@firstoftwo
+ }{%
+ \let\grffile@file@found\@filef@und
+ \let\grffile@IFE@next\@secondoftwo
+ }%
+ \grffile@IFE@next
+ }%
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+ \fi
\else
- \def\grffile@IfFileExists#1{%
+% \end{macrocode}
+% \begin{macro}{\grffile@IfFileExists}
+% \begin{macrocode}
+ \long\def\grffile@IfFileExists#1{%
\expandafter\expandafter\expandafter
\ifx\expandafter\expandafter\expandafter\\\pdf@filesize{#1}\\%
\let\reserved@a\@secondoftwo
@@ -624,7 +766,13 @@ and the derived files
\expandafter\@firstoftwo
\fi
}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
\fi
+% \end{macrocode}
+% \begin{macro}{\grffile@Ginclude@graphics}
+% \begin{macrocode}
\def\grffile@Ginclude@graphics#1{%
\begingroup
\ifgrffile@space
@@ -637,7 +785,10 @@ and the derived files
\grffile@org@Ginclude@graphics{#1}%
\endgroup
}%
-
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\grffile@filename@simple}
+% \begin{macrocode}
\def\grffile@filename@simple#1.#2\\{%
\ifx\\#2\\%
\def\filename@base{#1}%
@@ -647,7 +798,10 @@ and the derived files
\grffile@analyze@ext{#1}.{#2}\\%
\fi
}
-
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\grffile@analyze@ext}
+% \begin{macrocode}
\def\grffile@analyze@ext#1.#2\\{%
\let\grffile@next\relax
\ifx\\#2\\%
@@ -672,7 +826,10 @@ and the derived files
\fi
\grffile@next
}
-
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\grffile@try@extlist}
+% \begin{macrocode}
\def\grffile@try@extlist{%
\@for\grffile@temp:=\Gin@extensions\do{%
\grffile@IfFileExists{\filename@area\filename@base\grffile@temp}{%
@@ -686,7 +843,10 @@ and the derived files
\expandafter\grffile@use@last@ext\filename@base.\\%
\fi
}
-
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\grffile@use@last@ext}
+% \begin{macrocode}
\def\grffile@use@last@ext#1.#2\\{%
\ifx\\#2\\%
\edef\filename@base{\expandafter\filename@dot\filename@base\\}%
@@ -701,8 +861,10 @@ and the derived files
}%
}
% \end{macrocode}
+% \end{macro}
%
% Print current option setting
+% \begin{macro}{\grffile@option@status}
% \begin{macrocode}
\def\grffile@option@status#1{%
\begingroup
@@ -722,11 +884,80 @@ and the derived files
}%
\endgroup
}
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
\grffile@option@status{multidot}
\grffile@option@status{extendedchars}
\grffile@option@status{space}
% \end{macrocode}
%
+% \subsection{Fix \cs{Gin@ii} of package \xpackage{graphicx}}
+%
+% If the image file name contains the hash character
+% macro \cs{Gin@ii} of package \xpackage{graphicx} breaks.
+% \begin{macro}{\grffile@Gin@ii@graphicx}
+% \begin{macrocode}
+\def\grffile@Gin@ii@graphicx[#1]#2{%
+ \def\@tempa{[}%
+ \def\@tempb{#2}%
+ \ifx\@tempa\@tempb
+ \def\@tempa{\Gin@iii[#1][}% hash-ok
+ \expandafter\@tempa
+ \else
+ \begingroup
+ \@tempswafalse
+ \toks@{\Ginclude@graphics{#2}}%
+ \setkeys{Gin}{#1}%
+ \Gin@esetsize
+ \the\toks@
+ \endgroup
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\grffile@Gin@ii@fixed}
+% \begin{macrocode}
+\def\grffile@Gin@ii@fixed[#1]#2{%
+ \def\@tempa{[}%
+ \begingroup
+ \toks@={#2}%
+ \edef\@tempb{\the\toks@}%
+ \expandafter\endgroup
+ \ifx\@tempa\@tempb
+ \def\@tempa{\Gin@iii[#1][}% hash-ok
+ \expandafter\@tempa
+ \else
+ \begingroup
+ \@tempswafalse
+ \toks@{\Ginclude@graphics{#2}}%
+ \setkeys{Gin}{#1}%
+ \Gin@esetsize
+ \the\toks@
+ \endgroup
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\grffile@Fix@Gin@ii}
+% \begin{macrocode}
+\def\grffile@Fix@Gin@ii{%
+ \let\Gin@ii\grffile@Gin@ii@fixed
+ \begingroup
+ \escapechar=92 %
+ \PackageInfo{grffile}{\string\Gin@ii\space of package `graphicx' fixed}%
+ \endgroup
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+\ifx\Gin@ii\grffile@Gin@ii@graphicx
+ \grffile@Fix@Gin@ii
+\else
+ \AtBeginDocument{\grffile@Fix@Gin@ii}%
+\fi
+% \end{macrocode}
+%
% \begin{macrocode}
\grffile@RestoreCatcodes
% \end{macrocode}
@@ -1041,6 +1272,15 @@ showpage
% \item
% Undefined \cs{pdf@filesize} fixed.
% \end{Version}
+% \begin{Version}{2010/08/26 v1.12}
+% \item
+% Macro \cs{Gin@ii} of package \xpackage{graphicx} fixed
+% for the case that the file name contains a hash.
+% \end{Version}
+% \begin{Version}{2010/12/09 v1.13}
+% \item
+% Option \xoption{space} also supports \hologo{XeTeX}.
+% \end{Version}
% \end{History}
%
% \PrintIndex