summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/oberdiek/grffile.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-06-17 23:22:07 +0000
committerKarl Berry <karl@freefriends.org>2007-06-17 23:22:07 +0000
commitf0c1f4cdb9fad83f293fd91d194538425f9f7633 (patch)
tree1bc04aef1c35fe6e07fb532c1fefbe3ad1b37be8 /Master/texmf-dist/source/latex/oberdiek/grffile.dtx
parentcc91b833be17617d7383dfa801a01ef5c95c3752 (diff)
oberdiek update (15jun07)
git-svn-id: svn://tug.org/texlive/trunk@4458 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/grffile.dtx')
-rw-r--r--Master/texmf-dist/source/latex/oberdiek/grffile.dtx207
1 files changed, 187 insertions, 20 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/grffile.dtx b/Master/texmf-dist/source/latex/oberdiek/grffile.dtx
index 05cb4cc8958..ef13a360725 100644
--- a/Master/texmf-dist/source/latex/oberdiek/grffile.dtx
+++ b/Master/texmf-dist/source/latex/oberdiek/grffile.dtx
@@ -66,7 +66,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: grffile 2007/04/11 v1.3 Extended file name support for graphics (HO)}
+\Msg{* Package: grffile 2007/06/13 v1.4 Extended file name support for graphics (HO)}
\Msg{************************************************************************}
\keepsilent
@@ -126,7 +126,7 @@ and the derived files
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{grffile.drv}%
- [2007/04/11 v1.3 Extended file name support for graphics (HO)]%
+ [2007/06/13 v1.4 Extended file name support for graphics (HO)]%
\documentclass{ltxdoc}
\usepackage{holtxdoc}
\begin{document}
@@ -135,7 +135,7 @@ and the derived files
%</driver>
% \fi
%
-% \CheckSum{356}
+% \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
@@ -156,7 +156,7 @@ and the derived files
% \GetFileInfo{grffile.drv}
%
% \title{The \xpackage{grffile} package}
-% \date{2007/04/11 v1.3}
+% \date{2007/06/13 v1.4}
% \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}}
%
% \maketitle
@@ -208,8 +208,13 @@ and the derived files
% \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.
+% 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}
@@ -224,12 +229,67 @@ and the derived files
% 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{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}}
%
@@ -304,7 +364,7 @@ and the derived files
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{grffile}%
- [2007/04/11 v1.3 Extended file name support for graphics (HO)]%
+ [2007/06/13 v1.4 Extended file name support for graphics (HO)]%
% \end{macrocode}
%
% \subsection{Catcode stuff}
@@ -345,6 +405,11 @@ and the derived files
\DeclareBoolOption[true]{babel}
\DeclareBoolOption[false]{extendedchars}
\DeclareBoolOption{space}
+\DeclareVoidOption{encoding}{%
+ \RequirePackage{stringenc}\relax
+}
+\DeclareStringOption{inputencoding}
+\DeclareStringOption{filenameencoding}
\DeclareDefaultOption{%
\PassOptionsToPackage\CurrentOption{graphics}%
}
@@ -371,6 +436,9 @@ and the derived files
% \end{macrocode}
% \begin{macrocode}
\ProcessKeyvalOptions*
+\AtBeginDocument{%
+ \DisableKeyvalOption[package=grffile]{Gin}{encoding}%
+}
% \end{macrocode}
% \begin{macrocode}
\RequirePackage{graphics}
@@ -387,6 +455,23 @@ and the derived files
% \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}
@@ -414,8 +499,34 @@ and the derived files
\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{#1}%
+ \noexpand\grffile@Ginclude@graphics{\grffile@filename}%
}%
\x
}
@@ -586,17 +697,68 @@ and the derived files
% 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@{}}
+% \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
-% \mbox{}\nobreak\hskip0pt minus\leftmargin
-% \usebox0
-% \nobreak\hskip0pt minus\rightmargin
+% \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
@@ -700,6 +862,11 @@ and the derived files
% \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