diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/grffile.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/oberdiek/grffile.dtx | 640 |
1 files changed, 640 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/grffile.dtx b/Master/texmf-dist/source/latex/oberdiek/grffile.dtx new file mode 100644 index 00000000000..e4e8ee5a404 --- /dev/null +++ b/Master/texmf-dist/source/latex/oberdiek/grffile.dtx @@ -0,0 +1,640 @@ +% \iffalse meta-comment +% +% Copyright (C) 2006 by Heiko Oberdiek <oberdiek@uni-freiburg.de> +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3 of this license or (at your option) any later +% version. The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of +% LaTeX version 2005/12/01 or later. +% +% This work has the LPPL maintenance status "maintained". +% +% This Current Maintainer of this work is Heiko Oberdiek. +% +% This work consists of the main source file grffile.dtx +% and the derived files +% grffile.sty, grffile.pdf, grffile.ins, grffile.drv. +% +% Distribution: +% CTAN:macros/latex/contrib/oberdiek/grffile.dtx +% CTAN:macros/latex/contrib/oberdiek/grffile.pdf +% +% Unpacking: +% (a) If grffile.ins is present: +% tex grffile.ins +% (b) Without grffile.ins: +% tex grffile.dtx +% (c) If you insist on using LaTeX +% latex \let\install=y\input{grffile.dtx} +% (quote the arguments according to the demands of your shell) +% +% Documentation: +% (a) If grffile.drv is present: +% latex grffile.drv +% (b) Without grffile.drv: +% latex grffile.dtx; ... +% The class ltxdoc loads the configuration file ltxdoc.cfg +% if available. Here you can specify further options, e.g. +% use A4 as paper format: +% \PassOptionsToClass{a4paper}{article} +% +% Programm calls to get the documentation (example): +% pdflatex grffile.dtx +% makeindex -s gind.ist grffile.idx +% pdflatex grffile.dtx +% makeindex -s gind.ist grffile.idx +% pdflatex grffile.dtx +% +% Installation: +% TDS:tex/latex/oberdiek/grffile.sty +% TDS:doc/latex/oberdiek/grffile.pdf +% TDS:source/latex/oberdiek/grffile.dtx +% +%<*ignore> +\begingroup + \def\x{LaTeX2e} +\expandafter\endgroup +\ifcase 0\ifx\install y1\fi\expandafter + \ifx\csname processbatchFile\endcsname\relax\else1\fi + \ifx\fmtname\x\else 1\fi\relax +\else\csname fi\endcsname +%</ignore> +%<*install> +\input docstrip.tex +\Msg{************************************************************************} +\Msg{* Installation} +\Msg{* Package: grffile 2006/08/17 v1.1 Extended file name support for graphics (HO)} +\Msg{************************************************************************} + +\keepsilent +\askforoverwritefalse + +\preamble + +This is a generated file. + +Copyright (C) 2006 by Heiko Oberdiek <oberdiek@uni-freiburg.de> + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3 of this license or (at your option) any later +version. The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of +LaTeX version 2005/12/01 or later. + +This work has the LPPL maintenance status "maintained". + +This Current Maintainer of this work is Heiko Oberdiek. + +This work consists of the main source file grffile.dtx +and the derived files + grffile.sty, grffile.pdf, grffile.ins, grffile.drv. + +\endpreamble + +\generate{% + \file{grffile.ins}{\from{grffile.dtx}{install}}% + \file{grffile.drv}{\from{grffile.dtx}{driver}}% + \usedir{tex/latex/oberdiek}% + \file{grffile.sty}{\from{grffile.dtx}{package}}% +} + +\obeyspaces +\Msg{************************************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* file into a directory searched by TeX:} +\Msg{*} +\Msg{* grffile.sty} +\Msg{*} +\Msg{* To produce the documentation run the file `grffile.drv'} +\Msg{* through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{************************************************************************} + +\endbatchfile +%</install> +%<*ignore> +\fi +%</ignore> +%<*driver> +\NeedsTeXFormat{LaTeX2e} +\ProvidesFile{grffile.drv}% + [2006/08/17 v1.1 Extended file name support for graphics (HO)] +\documentclass{ltxdoc} +\usepackage{holtxdoc} +\begin{document} + \DocInput{grffile.dtx} +\end{document} +%</driver> +% \fi +% +% \CheckSum{346} +% +% \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 +% 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 +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% \GetFileInfo{grffile.drv} +% +% \title{The \xpackage{grffile} package} +% \date{2006/08/17 v1.1} +% \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} +% +% \maketitle +% +% \begin{abstract} +% The package extends the file name processing of package \xpackage{graphics} +% to support a larger range of file names. For example, the file name +% may contain several dots. Or in case of \pdfTeX\ in PDF mode the file name may +% contain spaces. +% \end{abstract} +% +% \tableofcontents +% +% \section{Usage} +% +% \subsection{Option \xoption{multidot}} +% +% The file name parsing of package \xpackage{graphics} is changed, in order +% to detect known extensions. This allows both the use of dots inside the +% base file name and extensions with several dots. +% +% Assume there are two files in the currect directory: \texttt{Hello.World.eps} +% and \texttt{Hello.World.pdf}. \verb|\includegraphics{Hello.World}| will find +% \verb|Hello.World.pdf| with driver \xoption{pdftex} or +% \verb|Hello.World.eps| with driver \xoption{dvips}. +% +% \paragraph{Limitations:} Problem could occur on systems, which don't +% use the dot as extension delimiter. These systems needs an own +% \verb|texsys.cfg| containing definitions for \verb|\filename@parse|. +% The author could not test that, due to a missing example. +% +% \subsection{Option \xoption{extendedchars}} +% +% If the input encoding is the same encoding as the encoding that +% is used for file names and the driver allows non-ascii characters, +% then this option can be used to use file names with such characters. +% +% Example: +% \begin{verbatim} +% \usepackage[latin1]{inputenc} +% \usepackage[extendedchars]{grffile} +% \includegraphics{Bäckerstraße} +% \end{verbatim} +% +% If the \verb|draft| option of the graphics package is enabled, the +% file name is printed with the current font encoding for \verb|\ttfamily|. +% Thus it is possible, that such characters are omitted or the wrong +% characters are displayed, if the font encoding is not the same as +% the file name encoding. +% +% \paragraph{Limitations:} As mentioned above. The \verb|inputenc| package +% is used to determine the encoding of the special characters in the file +% name. What if the document uses utf-8 inputenc, but the system use latin1 +% encoding to create files? The option "extendedchar" will work anyway, but +% the file name has to be handed over to \verb|\includegraphics| using latin1 +% encoding. +% +% \subsection{Option \xoption{space}} +% +% This option allows graphics file names that contain spaces +% if possible. +% +% In general it is not possible to use space inside file names, +% because \TeX\ considers the space character as termination in its +% syntax for commands that expect a file name. +% +% Regarding graphics inclusion with the package \xpackage{graphics} +% file names are used in two or three contexts: +% \begin{enumerate} +% \item The basic \cs{special} statement or primitive command for +% graphics inclusion. The \cs{special} statements for +% 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. +% \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 +% can be rewritten using a new primitive that allows spaces. +% This works in both modes DVI and PDF. +% \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. +% 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). +% +% \subsection{General use} +% +% The options can be given at many places: +% +% \begin{enumerate} +% \item As package options:\\ +% \verb|\usepackage[<options>]{grffile}| +% \item Setup command of package \xpackage{grffile}:\\ +% \verb|\grffilesetup{<options>}| +% \item The options are also available as options +% for package \xpackage{graphicx}:\\ +% \verb|\setkeys{Gin}{<options>}| +% \item If package \xpackage{graphicx} is loaded the options can also be +% applied for a single image:\\ +% \verb|\includegraphics[<options>]{...}| +% \end{enumerate} +% +% \subsection{Default settings} +% +% \begin{quote} +% \begin{tabular}{@{}lll@{}} +% \xoption{multidot} & \verb|true|\\ +% \xoption{extendedchars} & \verb|false|\\ +% \xoption{space} & \verb|true| & if \pdfTeX\ 1.30 or greater is used in PDF mode\\ +% & \verb|false| & otherwise +% \end{tabular} +% \end{quote} +% +% \StopEventually{ +% } +% +% \section{Implementation} +% +% \subsection{Identification} +% +% \begin{macrocode} +%<*package> +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{grffile}% + [2006/08/17 v1.1 Extended file name support for graphics (HO)] +% \end{macrocode} +% +% \subsection{Catcode stuff} +% +% \begin{macrocode} +\edef\grffile@RestoreCatcodes{% + \catcode`\noexpand\=\the\catcode`\=\relax + \catcode`\noexpand\:\the\catcode`\:\relax + \catcode`\noexpand\.\the\catcode`\.\relax + \catcode`\noexpand\'\the\catcode`\'\relax + \catcode`\noexpand\<\the\catcode`\<\relax + \catcode`\noexpand\>\the\catcode`\>\relax + \catcode`\noexpand\*\the\catcode`\*\relax + \catcode`\noexpand\^\the\catcode`\^\relax + \catcode`\noexpand\~\the\catcode`\~\relax +} +\@makeother\= +\@makeother\: +\@makeother\. +\@makeother\' +\@makeother\< +\@makeother\> +\@makeother\* +\catcode`\^=7 % +\catcode`\~=\active +% \end{macrocode} +% +% \subsection{Options} +% +% \begin{macrocode} +\RequirePackage{ifpdf} +\RequirePackage{kvoptions}[2006/08/17] +\SetupKeyvalOptions{ + family=Gin, + prefix=grffile@ +} +\DeclareBoolOption[true]{multidot} +\DeclareBoolOption[false]{extendedchars} +\DeclareBoolOption{space} +\DeclareDefaultOption{% + \PassOptionsToPackage\CurrentOption{graphics}% +} +% \end{macrocode} +% Default setting for option \xoption{space}. +% \begin{macrocode} +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname pdffilesize\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% + }% + }% +\else + \ifpdf + \grffile@spacetrue + \else + \grffile@spacefalse + \fi +\fi +% \end{macrocode} +% \begin{macrocode} +\ProcessKeyvalOptions* +% \end{macrocode} +% \begin{macrocode} +\RequirePackage{graphics} +% \end{macrocode} +% +% \begin{macro}{\grffilesetup} +% \begin{macrocode} +\newcommand*{\grffilesetup}{% + \setkeys{Gin}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\let\grffile@org@Ginclude@graphics\Ginclude@graphics +\renewcommand*{\Ginclude@graphics}{% + \ifgrffile@extendedchars + \begingroup +% \end{macrocode} +% Support of babel's shorthand characters. +% \begin{macrocode} + \csname @safe@activestrue\endcsname +% \end{macrocode} +% Support of active tilde. +% \begin{macrocode} + \edef~{\string~}% +% \end{macrocode} +% Support of characters controlled by package \xpackage{inputenc}. +% \begin{macrocode} + \grffile@inputenc@loop\^^A\^^H% + \grffile@inputenc@loop\^^K\^^K% + \grffile@inputenc@loop\^^N\^^_% + \grffile@inputenc@loop\^^?\^^ff% + \expandafter\grffile@extchar@Ginclude@graphics + \else + \expandafter\grffile@Ginclude@graphics + \fi +} +\def\grffile@extchar@Ginclude@graphics#1{% + \edef\x{\endgroup + \noexpand\grffile@Ginclude@graphics{#1}% + }% + \x +} +\def\grffile@inputenc@loop#1#2{% + \count@=`#1\relax + \loop + \begingroup + \uccode`\~=\count@ + \uppercase{% + \endgroup + \edef~{\string~}% + }% + \ifnum\count@<`#2\relax + \advance\count@\@ne + \repeat +} +% \end{macrocode} +% Support for option \xoption{space} +% \begin{macrocode} +\def\grffile@space@getbase#1{% + \edef\grffile@tempa{% + \def\noexpand\@tempa####1#1\noexpand\@nil{% + \def\noexpand\Gin@base{####1}% + }% + }% + \grffile@IfFileExists{\filename@area\filename@base#1}{% + \grffile@tempa + \expandafter\@tempa\grffile@file@found\@nil + \edef\Gin@ext{#1}% + }{% + }% +} +\def\grffile@IfFileExists#1{% + \expandafter\ifx\expandafter\\\pdffilesize{#1}\\% + \let\reserved@a\@secondoftwo + \ifx\input@path\@undefined + \else + \expandafter\@tfor\expandafter\reserved@b\expandafter + :\expandafter=\input@path\do{% + \expandafter\ifx\expandafter\\\pdffilesize{\reserved@b#1}\\% + \else + \edef\grffile@file@found{\reserved@b#1}% + \let\reserved@a\@firstoftwo + \@break@tfor + \fi + }% + \fi + \expandafter\reserved@a + \else + \edef\grffile@file@found{#1}% + \expandafter\@firstoftwo + \fi +} + +\def\grffile@Ginclude@graphics#1{% + \begingroup + \ifgrffile@space + \let\Gin@getbase\grffile@space@getbase + \fi + \ifgrffile@multidot + \let\filename@base\@empty + \let\filename@simple\grffile@filename@simple + \fi + \grffile@org@Ginclude@graphics{#1}% + \endgroup +}% + +\def\grffile@filename@simple#1.#2\\{% + \ifx\\#2\\% + \let\filename@ext\relax + \else + \expandafter\ifx\csname + Gin@rule@.\filename@dot #2\\\endcsname\relax + \edef\filename@base{\filename@base #1.}% + \grffile@ReturnAfterFiFiBase{\grffile@filename@simple #2\\}% + \else + \edef\filename@ext{\filename@dot #2\\}% + \fi + \fi + \edef\filename@base{\filename@base #1}% +} +\def\grffile@ReturnAfterFiFiBase#1#2\filename@base#3{\fi\fi#1} +% \end{macrocode} +% +% Print current option setting +% \begin{macrocode} +\def\grffile@option@status#1{% + \begingroup + \let\on@line\@empty + \PackageInfo{grffile}{% + Option `#1' is % + \expandafter\ifx\csname ifgrffile@#1\expandafter\endcsname + \csname iftrue\endcsname + set to `true'% + \else + \expandafter\ifx\csname grffile@#1@disabled\endcsname\@empty + not available% + \else + set to `false'% + \fi + \fi + }% + \endgroup +} +\grffile@option@status{multidot} +\grffile@option@status{extendedchars} +\grffile@option@status{space} +% \end{macrocode} +% +% \begin{macrocode} +\grffile@RestoreCatcodes +% \end{macrocode} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% \section{Installation} +% +% \paragraph{CTAN.} This package is available on +% CTAN\footnote{\url{ftp://ftp.ctan.org/tex-archive/}}: +% \begin{description} +% \item[\CTAN{macros/latex/contrib/oberdiek/grffile.dtx}] The source file. +% \item[\CTAN{macros/latex/contrib/oberdiek/grffile.pdf}] Documentation. +% \end{description} +% +% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting +% \docstrip\ archive. The files are extracted by running the +% \xfile{.dtx} through \plainTeX: +% \begin{quote} +% \verb|tex grffile.dtx| +% \end{quote} +% +% \paragraph{TDS.} Now the different files must be moved into +% the different directories in your installation TDS tree +% (also known as \xfile{texmf} tree): +% \begin{quote} +% \sbox0{^^A +% \begin{tabular}{@{}>{\ttfamily}l@{$\quad\rightarrow\quad$}>{\ttfamily}l@{}} +% grffile.sty & tex/latex/oberdiek/grffile.sty\\ +% grffile.pdf & doc/latex/oberdiek/grffile.pdf\\ +% grffile.dtx & source/latex/oberdiek/grffile.dtx\\ +% \end{tabular}^^A +% }% +% \ifdim\wd0>\linewidth +% \mbox{}\nobreak\hskip0pt minus\leftmargin +% \usebox0 +% \nobreak\hskip0pt minus\rightmargin +% \else +% \usebox0 +% \fi +% \end{quote} +% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's +% TDS installing feature, then some files can already be in the right +% place, see the documentation of \docstrip. +% +% \paragraph{Refresh file databases.} If your \TeX~distribution +% (\teTeX, \mikTeX, \dots) rely on file databases, you must refresh +% these. For example, \teTeX\ users run \verb|texhash| or +% \verb|mktexlsr|. +% +% \subsection{Some details for the interested} +% +% \paragraph{Attached source.} +% +% The PDF documentation on CTAN also includes the +% \xfile{.dtx} source file. It can be extracted by +% AcrobatReader 6 or higher. Another option is \textsf{pdftk}, +% e.g. unpack the file into the current directory: +% \begin{quote} +% \verb|pdftk grffile.pdf unpack_files output .| +% \end{quote} +% +% \paragraph{Unpacking with \LaTeX.} +% The \xfile{.dtx} chooses its action depending on the format: +% \begin{description} +% \item[\plainTeX:] Run \docstrip\ and extract the files. +% \item[\LaTeX:] Generate the documentation. +% \end{description} +% If you insist on using \LaTeX\ for \docstrip\ (really, +% \docstrip\ does not need \LaTeX), then inform the autodetect routine +% about your intension: +% \begin{quote} +% \verb|latex \install=y\input{grffile.dtx}| +% \end{quote} +% Do not forget to quote the argument according to the demands +% of your shell. +% +% \paragraph{Generating the documentation.} +% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate +% the documentation. The process can be configured by the +% configuration file \xfile{ltxdoc.cfg}. For instance, put this +% line into this file, if you want to have A4 as paper format: +% \begin{quote} +% \verb|\PassOptionsToClass{a4paper}{article}| +% \end{quote} +% An example follows how to generate the +% documentation with pdf\LaTeX: +% \begin{quote} +%\begin{verbatim} +%pdflatex grffile.dtx +%makeindex -s gind.ist grffile.idx +%pdflatex grffile.dtx +%makeindex -s gind.ist grffile.idx +%pdflatex grffile.dtx +%\end{verbatim} +% \end{quote} +% +% \begin{thebibliography}{9} +% +% \bibitem{graphics} +% David Carlisle, Sebastian Rahtz: \textit{The \xpackage{graphics} package}; +% 2006/02/20 v1.0o; +% \CTAN{macros/latex/required/graphics/graphics.dtx}. +% +% \bibitem{graphicx} +% Sebastian Rahtz, Heiko Oberdiek: +% \textit{The \xpackage{graphicx} package}; +% 1999/02/16 v1.0f; +% \CTAN{macros/latex/required/graphics/graphicx.dtx}. +% +% \end{thebibliography} +% +% \begin{History} +% \begin{Version}{2004/07/18 v0.5} +% \item +% First version. +% \end{Version} +% \begin{Version}{2006/08/15 v1.0} +% \item +% File existence check by new primitives of pdfTeX 1.30. +% \item +% Implementation partly rewritten. +% \item +% New DTX framework. +% \end{Version} +% \begin{Version}{2006/08/17 v1.1} +% \item +% Adaptation to version 2.3 of package \xpackage{kvoptions}. +% \end{Version} +% \end{History} +% +% \PrintIndex +% +% \Finale +\endinput |