% \iffalse meta-comment
%
% Copyright (C) 2006-2008 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,
%    grffile-test1.tex.
%
% 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:doc/latex/oberdiek/test/grffile-test1.tex
%    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 2008/10/13 v1.9 Extended file name support for graphics (HO)}
\Msg{************************************************************************}

\keepsilent
\askforoverwritefalse

\let\MetaPrefix\relax
\preamble

This is a generated file.

Copyright (C) 2006-2008 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,
   grffile-test1.tex.

\endpreamble
\let\MetaPrefix\DoubleperCent

\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}}%
  \usedir{doc/latex/oberdiek/test}%
  \file{grffile-test1.tex}{\from{grffile.dtx}{test1}}%
}

\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{* And install the following script file:}
\Msg{*}
\Msg{*     }
\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}%
  [2008/10/13 v1.9 Extended file name support for graphics (HO)]%
\documentclass{ltxdoc}
\usepackage{holtxdoc}[2008/08/11]
\begin{document}
  \DocInput{grffile.dtx}%
\end{document}
%</driver>
% \fi
%
% \CheckSum{474}
%
% \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{2008/10/13 v1.9}
% \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{babel}}
%
% This option allows the use of shorthand characters of package
% \xpackage{babel} inside the graphics file name. Additionally
% the tilde `\textasciitilde' is supported. The option
% is turned on as default. (In version v1.1 or below of this package,
% the features of this option were part of option \xoption{extendedchars}.)
%
% Example:
% \begin{quote}
%\begin{verbatim}
%\usepackage[frenchb]{babel}
%\usepackage{grffile}
%Image: \includegraphics{C:/path/image}
%\end{verbatim}
% \end{quote}
%
% \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.
% Without option \xoption{extendedchars} the 8-bit characters
% are expanded, if they are active characters. For example,
% see the \LaTeX\ package \xpackage{inputenc}. However a
% file name is not input for \LaTeX. Therefore this option
% \xoption{extendedchars} removes the active status and
% the 8-bit characters are not expandable any more.
%
% Example:
% \begin{quote}
%   |\usepackage[latin1]{inputenc}|\\
%   |\usepackage[extendedchars]{grffile}|\\
%   |\includegraphics{|\texttt{B\"ackerstra\ss e}|}|
% \end{quote}
%
% 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.
%
% \subsection{Option \xoption{encoding}}
%
% Consider the following scenario. Your file system is using
% UTF-8 as encoding for file names. But you use \xoption{latin1}
% as input encoding for your \TeX\ files, because some packages
% are not ready for multi-byte encodings (\xpackage{listings}, \dots).
%
% Then this option \xoption{encoding} loads support for converting
% encodings by loading package \xpackage{stringenc}.
% The option is not defined after the preamble, because
% \LaTeX\ limits package loading to the preamble.
%
% File names are converted, if package \xpackage{stringenc} is loaded
% and the encodings are known, see options \xoption{inputencoding} and
% \xoption{filenameencoding}.
%
% \subsubsection{Option \xoption{inputencoding}}
%
% Option \xoption{inputencoding} specifies the encoding
% of the file name in your \TeX\ input file.
%
% Package \xpackage{inputenx} and package \xpackage{inputenc}
% since version 2006/02/22 v1.1a remember the name of
% the input encoding that is looked up by this package.
% Therefore option \xoption{inputencoding} is usually
% not mandatory.
%
% \subsubsection{Option \xoption{filenameencoding}}
%
% This is the encoding of the filename of your file
% system. This option is mandatory, file names
% are not converted without this option. The option
% is disabled, if the value is empty.
%
% \subsubsection{Example}
%
% Back to the scenario where the file system uses UTF-8 and
% the \LaTeX\ input files are encodind in latin1.
% \begin{quote}
%\begin{verbatim}
%\usepackage[latin1]{inputenc}[2006/02/22]
% % \usepackage[latin1]{inputenx}
%\usepackage{graphicx}
%\usepackage[encoding,filenameencoding=utf8]{grffile}
%\end{verbatim}
% \end{quote}
%
% For older versions of package \xoption{inputenc} option
% \xoption{inputencoding} provides the necessary informations.
% \begin{quote}
%\begin{verbatim}
%\usepackage[latin1]{inputenc}
%\usepackage{graphicx}
%\usepackage{grffile}
%\grffilesetup{
%  encoding,
%  inputencoding=latin1,
%  filenameencoding=utf8,
%}
%\end{verbatim}
% \end{quote}
%
% \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} & |true|\\
%   \xoption{babel}    & |true|\\
%   \xoption{extendedchars} & |false|\\
%   \xoption{space} & |true| & if \pdfTeX\ 1.30 or greater is used in PDF mode\\
%                   & |false| & otherwise
% \end{tabular}
% \end{quote}
%
% \StopEventually{
% }
%
% \section{Implementation}
%
% \subsection{Identification}
%
%    \begin{macrocode}
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{grffile}%
  [2008/10/13 v1.9 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[true]{babel}
\DeclareBoolOption[false]{extendedchars}
\DeclareBoolOption{space}
\DeclareVoidOption{encoding}{%
  \RequirePackage{stringenc}\relax
}
\DeclareStringOption{inputencoding}
\DeclareStringOption{filenameencoding}
\DeclareDefaultOption{%
  \PassOptionsToPackage\CurrentOption{graphics}%
}
%    \end{macrocode}
%    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%
    }%
  }%
\else
  \ifpdf
    \grffile@spacetrue
  \else
    \grffile@spacefalse
  \fi
\fi
%    \end{macrocode}
%    \begin{macrocode}
\ProcessKeyvalOptions*
\AtBeginDocument{%
  \DisableKeyvalOption[package=grffile]{Gin}{encoding}%
}
%    \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}{%
  \ifx\grffile@filenameencoding\@empty
  \else
    \ifx\grffile@inputencoding\@empty
      \expandafter\ifx\csname inputencodingname\endcsname\relax
        \expandafter\ifx\csname
            CurrentInputEncodingOption\endcsname\relax
        \else
          \let\grffile@inputencoding\CurrentInputEncodingOption
        \fi
      \else
        \let\grffile@inputencoding\inputencodingname
      \fi
    \fi
    \ifx\grffile@inputencoding\@empty
    \else
      \grffile@extendedcharstrue
    \fi
  \fi
  \ifnum0\ifgrffile@babel 1\fi\ifgrffile@extendedchars 1\fi>\z@
    \begingroup
%    \end{macrocode}
%    Support of babel's shorthand characters.
%    \begin{macrocode}
      \ifgrffile@babel
        \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}
      \fi
      \ifgrffile@extendedchars
        \grffile@inputenc@loop\^^A\^^H%
        \grffile@inputenc@loop\^^K\^^K%
        \grffile@inputenc@loop\^^N\^^_%
        \grffile@inputenc@loop\^^?\^^ff%
      \fi
      \expandafter\grffile@extchar@Ginclude@graphics
  \else
    \expandafter\grffile@Ginclude@graphics
  \fi
}
\def\grffile@extchar@Ginclude@graphics#1{%
  \def\grffile@filename{#1}%
  \ifx\grffile@inputencoding\@empty
  \else
    \ifx\grfile@filenameencoding\@empty
    \else
      \ifx\grffile@inputencoding\grffile@filenameencoding
      \else
        \expandafter\ifx\csname StringEncodingConvert\endcsname\relax
          \PackageError{grffile}{%
            Package `stringenc' is not loaded,\MessageBreak
            omitting file name conversion%
          }\@ehc
        \else
          \StringEncodingConvert\grffile@temp\grffile@filename
              \grffile@inputencoding\grffile@filenameencoding
          \StringEncodingSuccessFailure{%
            \let\grffile@filename\grffile@temp
          }{%
            \PackageError{grffile}{%
              Filename conversion failed%
            }\@ehc
          }%
        \fi
      \fi
    \fi
  \fi
  \edef\x{\endgroup
    \noexpand\grffile@Ginclude@graphics{\grffile@filename}%
  }%
  \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\expandafter\expandafter
  \ifx\expandafter\expandafter\expandafter\\\pdf@filesize{#1}\\%
    \let\reserved@a\@secondoftwo
    \ifx\input@path\@undefined
    \else
      \expandafter\@tfor\expandafter\reserved@b\expandafter
          :\expandafter=\input@path\do{%
        \expandafter\expandafter\expandafter
        \ifx\expandafter\expandafter\expandafter
            \\\pdf@filesize{\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\\%
    \ifx\filename@base\@empty
      \let\filename@ext\relax
    \else
      \grffile@ReturnAfterFiFiBase{%
        \edef\filename@base{\expandafter\filename@dot\filename@base\\}%
        \edef\filename@ext{#1}%
      }%
    \fi
  \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\fi\edef\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{Test}
%
% \subsection{Multidot with default rule}
%
%    \begin{macrocode}
%<*test1>
\NeedsTeXFormat{LaTeX2e}
\documentclass{article}
\usepackage{filecontents}
% file grffile-test.mp:
% beginfig(1);
%   draw fullcircle scaled 2cm withpen pencircle scaled 2mm;
% endfig;
% end
\begin{filecontents*}{grffile-test.1}
%!PS
%%BoundingBox: -32 -32 32 32
%%Creator: MetaPost
%%CreationDate: 2004.06.16:1257
%%Pages: 1
%%EndProlog
%%Page: 1 1
 0 5.66928 dtransform truncate idtransform setlinewidth pop [] 0 setdash
 1 setlinejoin 10 setmiterlimit
newpath 28.34645 0 moveto
28.34645 7.51828 25.35938 14.72774 20.04356 20.04356 curveto
14.72774 25.35938 7.51828 28.34645 0 28.34645 curveto
-7.51828 28.34645 -14.72774 25.35938 -20.04356 20.04356 curveto
-25.35938 14.72774 -28.34645 7.51828 -28.34645 0 curveto
-28.34645 -7.51828 -25.35938 -14.72774 -20.04356 -20.04356 curveto
-14.72774 -25.35938 -7.51828 -28.34645 0 -28.34645 curveto
7.51828 -28.34645 14.72774 -25.35938 20.04356 -20.04356 curveto
25.35938 -14.72774 28.34645 -7.51828 28.34645 0 curveto closepath stroke
showpage
%%EOF
\end{filecontents*}
\usepackage{graphicx}
\usepackage[multidot]{grffile}[2008/10/13]
\DeclareGraphicsRule{*}{mps}{*}{} % for pdflatex
\begin{document}
\includegraphics{grffile-test.1}
\end{document}
%</test1>
%    \end{macrocode}
%
% \section{Installation}
%
% \subsection{Download}
%
% \paragraph{Package.} 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{Bundle.} All the packages of the bundle `oberdiek'
% are also available in a TDS compliant ZIP archive. There
% the packages are already unpacked and the documentation files
% are generated. The files and directories obey the TDS standard.
% \begin{description}
% \item[\CTAN{install/macros/latex/contrib/oberdiek.tds.zip}]
% \end{description}
% \emph{TDS} refers to the standard ``A Directory Structure
% for \TeX\ Files'' (\CTAN{tds/tds.pdf}). Directories
% with \xfile{texmf} in their name are usually organized this way.
%
% \subsection{Bundle installation}
%
% \paragraph{Unpacking.} Unpack the \xfile{oberdiek.tds.zip} in the
% TDS tree (also known as \xfile{texmf} tree) of your choice.
% Example (linux):
% \begin{quote}
%   |unzip oberdiek.tds.zip -d ~/texmf|
% \end{quote}
%
% \paragraph{Script installation.}
% Check the directory \xfile{TDS:scripts/oberdiek/} for
% scripts that need further installation steps.
% Package \xpackage{attachfile2} comes with the Perl script
% \xfile{pdfatfi.pl} that should be installed in such a way
% that it can be called as \texttt{pdfatfi}.
% Example (linux):
% \begin{quote}
%   |chmod +x scripts/oberdiek/pdfatfi.pl|\\
%   |cp scripts/oberdiek/pdfatfi.pl /usr/local/bin/|
% \end{quote}
%
% \subsection{Package installation}
%
% \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}
% \def\t{^^A
% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}}
%   grffile.sty & tex/latex/oberdiek/grffile.sty\\
%   grffile.pdf & doc/latex/oberdiek/grffile.pdf\\
%   test/grffile-test1.tex & doc/latex/oberdiek/test/grffile-test1.tex\\
%   grffile.dtx & source/latex/oberdiek/grffile.dtx\\
% \end{tabular}^^A
% }^^A
% \sbox0{\t}^^A
% \ifdim\wd0>\linewidth
%   \begingroup
%     \advance\linewidth by\leftmargin
%     \advance\linewidth by\rightmargin
%   \edef\x{\endgroup
%     \def\noexpand\lw{\the\linewidth}^^A
%   }\x
%   \def\lwbox{^^A
%     \leavevmode
%     \hbox to \linewidth{^^A
%       \kern-\leftmargin\relax
%       \hss
%       \usebox0
%       \hss
%       \kern-\rightmargin\relax
%     }^^A
%   }^^A
%   \ifdim\wd0>\lw
%     \sbox0{\small\t}^^A
%     \ifdim\wd0>\linewidth
%       \ifdim\wd0>\lw
%         \sbox0{\footnotesize\t}^^A
%         \ifdim\wd0>\linewidth
%           \ifdim\wd0>\lw
%             \sbox0{\scriptsize\t}^^A
%             \ifdim\wd0>\linewidth
%               \ifdim\wd0>\lw
%                 \sbox0{\tiny\t}^^A
%                 \ifdim\wd0>\linewidth
%                   \lwbox
%                 \else
%                   \usebox0
%                 \fi
%               \else
%                 \lwbox
%               \fi
%             \else
%               \usebox0
%             \fi
%           \else
%             \lwbox
%           \fi
%         \else
%           \usebox0
%         \fi
%       \else
%         \lwbox
%       \fi
%     \else
%       \usebox0
%     \fi
%   \else
%     \lwbox
%   \fi
% \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.
%
% \subsection{Refresh file name databases}
%
% If your \TeX~distribution
% (\teTeX, \mikTeX, \dots) relies on file name 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 intention:
% \begin{quote}
%   \verb|latex \let\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, published in newsgroup \xnewsgroup{de.comp.text.tex}:\\
%     \URL{``\link{Re: Dateinamenproblem}''}^^A
%     {http://groups.google.com/group/de.comp.text.tex/msg/b85984095d1a3c95}
%   \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}
%   \begin{Version}{2006/11/30 v1.2}
%   \item
%     New option \xoption{babel}. Before this feature was part
%     of option \xoption{extendedchars}.
%   \end{Version}
%   \begin{Version}{2007/04/11 v1.3}
%   \item
%     Line ends sanitized.
%   \end{Version}
%   \begin{Version}{2007/06/13 v1.4}
%   \item
%     Encoding support added with options \xoption{encoding},
%     \xoption{inputencoding}, and \xoption{filenameencoding}.
%   \end{Version}
%   \begin{Version}{2007/08/16 v1.5}
%   \item
%     Bug fix in encoding support.
%   \end{Version}
%   \begin{Version}{2007/11/11 v1.6}
%   \item
%     Use of package \xpackage{pdftexcmds} for \LuaTeX\ support.
%   \end{Version}
%   \begin{Version}{2007/11/24 v1.7}
%   \item
%     Bug fix of broken previous version.
%   \end{Version}
%   \begin{Version}{2008/08/11 v1.8}
%   \item
%     Code is not changed.
%   \item
%     URLs updated.
%   \end{Version}
%   \begin{Version}{2008/10/13 v1.9}
%   \item
%     Fix for option `multidot' with default rule.
%   \end{Version}
% \end{History}
%
% \PrintIndex
%
% \Finale
\endinput
