summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/oberdiek/grffile.dtx
blob: ef13a3607255c8c36e1f091720c8fbec6522213b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
% \iffalse meta-comment
%
% Copyright (C) 2006, 2007 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 2007/06/13 v1.4 Extended file name support for graphics (HO)}
\Msg{************************************************************************}

\keepsilent
\askforoverwritefalse

\preamble

This is a generated file.

Copyright (C) 2006, 2007 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}%
  [2007/06/13 v1.4 Extended file name support for graphics (HO)]%
\documentclass{ltxdoc}
\usepackage{holtxdoc}
\begin{document}
  \DocInput{grffile.dtx}%
\end{document}
%</driver>
% \fi
%
% \CheckSum{437}
%
% \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{2007/06/13 v1.4}
% \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 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,
%  fontencoding=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}%
  [2007/06/13 v1.4 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}
\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*
\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@fileencoding\@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\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}
%
% \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{macros/latex/contrib/oberdiek/oberdiek-tds.zip}]
% \end{description}
%
% \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\\
%   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.
%   \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}
% \end{History}
%
% \PrintIndex
%
% \Finale
\endinput