summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-09-18 22:30:38 +0000
committerKarl Berry <karl@freefriends.org>2011-09-18 22:30:38 +0000
commitc3ed4e03e9ea716aafea65c70f9db17984fcf3a9 (patch)
treefded714a15211a4b635510b5ca9f2205f4edbff5 /Master
parent37b598addb36d4147027a2296f0fc112c5dd84ba (diff)
currfile 0.5 (18sep11)
git-svn-id: svn://tug.org/texlive/trunk@24006 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/currfile/README3
-rw-r--r--Master/texmf-dist/doc/latex/currfile/currfile.pdfbin197187 -> 180294 bytes
-rw-r--r--Master/texmf-dist/source/latex/currfile/currfile.dtx144
-rw-r--r--Master/texmf-dist/source/latex/currfile/currfile.ins4
-rw-r--r--Master/texmf-dist/tex/latex/currfile/currfile.sty56
5 files changed, 148 insertions, 59 deletions
diff --git a/Master/texmf-dist/doc/latex/currfile/README b/Master/texmf-dist/doc/latex/currfile/README
index 1c0578a76d9..8b8e724f89d 100644
--- a/Master/texmf-dist/doc/latex/currfile/README
+++ b/Master/texmf-dist/doc/latex/currfile/README
@@ -1,7 +1,8 @@
LaTeX package 'currfile'
~~~~~~~~~~~~~~~~~~~~~~~~
-Copyright (c) 2010 by Martin Scharrer <martin@scharrer-online.de>
+Copyright (c) 2010-2011 by Martin Scharrer <martin@scharrer-online.de>
WWW: http://latex.scharrer-online.de/
+Code repository: https://bitbucket.org/martin_scharrer/currfile
Provides macros holding the file name information (dir, base name, extension, full name and full path) for
files read by LaTeX's \input and \include macros.
diff --git a/Master/texmf-dist/doc/latex/currfile/currfile.pdf b/Master/texmf-dist/doc/latex/currfile/currfile.pdf
index 98c06af72d5..4ba5882829d 100644
--- a/Master/texmf-dist/doc/latex/currfile/currfile.pdf
+++ b/Master/texmf-dist/doc/latex/currfile/currfile.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/currfile/currfile.dtx b/Master/texmf-dist/source/latex/currfile/currfile.dtx
index a1c159a4d53..5f225883417 100644
--- a/Master/texmf-dist/source/latex/currfile/currfile.dtx
+++ b/Master/texmf-dist/source/latex/currfile/currfile.dtx
@@ -17,33 +17,22 @@
%% The Current Maintainer of this work is Martin Scharrer.
%%
%% This work consists of the files currfile.dtx, currfile.ins
-%% and the derived file currfile.sty.
+%% and currfile.sty.
%%
-%% $Id: currfile.dtx 2036 2011-01-09 17:51:42Z martin $
+%% $Id$
% \fi
%
% \iffalse
%<*driver>
-\ProvidesFile{currfile.dtx}
-%</driver>
-%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-%<package>\ProvidesPackage{currfile}
-%<*package>
- [2011/01/09 v0.4 Current input file name and path]
-%</package>
-%
-%<*driver>
-\documentclass{ydoc}[2011/01/09]
-\usepackage{currfile}[2011/01/09]
+\ProvidesFile{currfile.dtx}[2011/09/18 v0.5 DTX file for currfile package]
+\documentclass{ydoc}[2011/03/19]
+\usepackage{currfile}[2011/09/18]
\usepackage{ifpdf}
\usepackage{booktabs}
\usepackage{hyperref}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
-\providecommand*\pkg{\texttt}
-\providecommand*\opt{\texttt}
-\let\cs\Macro
\begin{document}
\DocInput{currfile.dtx}
\PrintChanges
@@ -52,7 +41,7 @@
%</driver>
% \fi
%
-% \CheckSum{258}
+% \CheckSum{344}
%
% \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
@@ -77,6 +66,7 @@
% }
% \changes{v0.3}{2011/01/03}{Update to use new version of filehook.}
% \changes{v0.4}{2011/01/09}{Added if-macros and sanitized currfile macros.}
+% \changes{v0.5}{2011/09/18}{Added support for \cs{input@path} and files with multiple dots.}
%
% \GetFileInfo{currfile.dtx}
%
@@ -86,29 +76,14 @@
% \DoNotIndex{\csname,\endcsname,\DeclareBoolOption,\DeclareStringOption}
% \DoNotIndex{\SetupKeyvalOptions,\begingroup,\endgroup,\@gobble,\edef}
% \DoNotIndex{\message,\jobname,\@namedef}
-%
-% \ifpdf
-% \hypersetup{%
-% pdfauthor = {Martin Scharrer <martin@scharrer-online.de>},
-% pdftitle = {The currfile package},
-% pdfsubject = {Documentation of LaTeX package 'currfile'},
-% pdfkeywords = {current filename, filename, file, name, LaTeX, TeX}
-% }%
-% \fi
-% \clearpage
-% \null
-% \vspace*{-2em}
-% \begin{center}
-% {\LARGE\sffamily The \emph{currfile} Package\\[\medskipamount]}
-% {\large Martin Scharrer \\[\medskipamount]\normalsize
-% \url{martin@scharrer-online.de}\\[.8ex]
-% \url{http://www.ctan.org/pkg/currfile/}\\[\bigskipamount]}
-% {\large Version \fileversion\ -- \filedate}\\
-% \end{center}
-% \vspace{1.2em}%
+%
+% \author{Martin Scharrer}
+% \email{martin@scharrer-online.de}
+% \maketitle
%
% \begin{abstract}
% This small package provides the file name and path information of the current input file as \LaTeX{} macros.
+% It properly supports file name with multiple dots and the \cs{input@path} feature used by some packages like \pkg{import}.
% \end{abstract}
%
% \section{Usage}
@@ -124,7 +99,7 @@
% However this special characters might not be displayed correctly in all fonts. A good font is text-type (\Macro\ttfamily, \Macro\texttt{\ldots}),
% but other fonts can be used using the \pkg{url} package, e.g.: |\urlstyle{rm}\expandafter\nolinkurl\expandafter{\currfilename}|.
%
-% Special care is taken to keep the file information of \Macro\included files till the final \Macro\clearpage command, so that page header and footer of the last page
+% Special care is taken to keep the file information of \Macro\included files till the final \Macro\clearpage command, so that page header and footer of the last page
% will hold the correct data.
%
% Since v0.2 all files are are taken into account, i.e.\ files read using \Macro\input, \Macro\include, \Macro\InputIfFileExists, \Macro\usepackage, \Macro\RequirePackage and even
@@ -190,12 +165,19 @@
%
% \StopEventually{}
%
-%
% \section{Implementation}\label{sec:impl}
%
% \iffalse
-%<*package>
+%<*currfile.sty>
% \fi
+%
+% \subsection{Package header}
+%
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+\ProvidesPackage{currfile}[2011/01/09 v0.4 Current input file name and path]
+% \begin{macrocode}
+%
% \subsection{Options}
%
% \begin{macrocode}
@@ -251,16 +233,23 @@
%
% \begin{macro}{\currfile@set}
% Sets the file information which are parsed by \LaTeX's \Macro\filename@parse.
+% \changes{2011/09/18}{v0.5}{Now supports path elements from \cs{input@path}.}
+% \changes{2011/09/18}{v0.5}{Now supports multiple dots in the file name.}
% \begin{macrocode}
\def\currfile@set#1{%
\begingroup
- \edef\@tempa{#1}%
- \@onelevel@sanitize\@tempa
- \expandafter\filename@parse\expandafter{\@tempa}%
+ \edef\@filef@und{#1}%
+ \ifx\input@path\@undefined\else
+ \currfile@checkpath
+ \fi
+ \@onelevel@sanitize\@filef@und
+ \let\filename@simple\currfile@parseext
+ \let\filename@base\@gobble
+ \expandafter\filename@parse\expandafter{\@filef@und}%
\global\let\currfiledir\filename@area
\global\let\currfilebase\filename@base
- \xdef\currfileext{\ifx\filename@ext\relax tex\else\filename@ext\fi}%
- \xdef\currfilename{\currfilebase\ifx\currfileext\empty\else.\currfileext\fi}%
+ \global\let\currfileext\filename@ext
+ \xdef\currfilename{\currfilebase\ifx\currfileext\@empty\else.\currfileext\fi}%
\xdef\currfilepath{\currfiledir\currfilename}%
\endgroup
%<debug> \expandafter\gdef\expandafter\dindent\expandafter{\dindent\space}%
@@ -270,9 +259,69 @@
% \end{macro}
%
%
+% \begin{macro}{\currfile@checkpath}
+% This loop is placed in an own macro for efficiency reasons.
+% In the majority of cases it should not be needed and having it as
+% a macro avoids the need to skip over this code as part of a conditional clause
+% for every read file.
+% \changes{2011/09/18}{v0.5}{New macro as part of the \cs{input@path} support.}
+% \begin{macrocode}
+\def\currfile@checkpath{%
+ \openin\@inputcheck\@filef@und\relax
+ \ifeof\@inputcheck
+ \expandafter\@tfor
+ \expandafter\@tempb
+ \expandafter:\expandafter=\input@path\do{%
+ \openin\@inputcheck\@tempb\@filef@und\relax
+ \ifeof\@inputcheck\else
+ \edef\@filef@und{\@tempb\@filef@und}%
+ \@break@tfor
+ \fi
+ }%
+ \fi
+ \closein\@inputcheck
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\currfile@parseext}
+% Replacement for \Macro\filename@simple to allow multiple dots in a filename.
+% This needs |\let\filename@base\@gobble| before it is called.
+% \changes{2011/09/18}{v0.5}{New macro as part of the multi-dot support.}
+% \begin{macrocode}
+\begingroup
+\@makeother{.}
+\gdef\currfile@parseext#1.#2\\{%
+ \ifx\\#2\\%
+ \ifx\filename@base\@gobble
+ \def\filename@base{#1}%
+ \let\filename@ext\currfile@defaultext%
+ \else
+ \def\filename@ext{#1}%
+ \fi
+ \else
+ \edef\filename@base{\filename@base.#1}%
+ \def\@tempa{\currfile@parseext#2\\}%
+ \expandafter\@tempa
+ \fi
+}
+\endgroup
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\currfile@defaultext}
+% Holds the default extension `|tex|' with catcode \emph{other} like \Macro\jobname.
+% \changes{2011/09/18}{v0.5}{New macro as part of the multi-dot support.}
+% \begin{macrocode}
+\def\currfile@defaultext{tex}
+\@onelevel@sanitize\currfile@defaultext
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{File Stack}
% The file information are pushed and popped on a stack to save and restore them when
-% entering and leaving a sub-file, respectively. This is quite similar to the way
+% entering and leaving a sub-file, respectively. This is quite similar to the way
% \LaTeX\ saves file base names and extension as well as the `@' status (letter or other) for
% package and class files.
%
@@ -437,7 +486,8 @@
% \end{macrocode}
%
% \iffalse
-%</package>
+%</currfile.sty>
% \fi
+%
% \Finale
\endinput
diff --git a/Master/texmf-dist/source/latex/currfile/currfile.ins b/Master/texmf-dist/source/latex/currfile/currfile.ins
index 9f0428e33f9..95922358f3f 100644
--- a/Master/texmf-dist/source/latex/currfile/currfile.ins
+++ b/Master/texmf-dist/source/latex/currfile/currfile.ins
@@ -1,7 +1,7 @@
-% $Id$
% See file 'currfile.dtx' for copyright and licence.
%
\input docstrip.tex
\keepsilent
-\generate{\nopreamble\file{currfile.sty}{\from{currfile.dtx}{package}}}
+\askforoverwritefalse
+\generate{\nopreamble\file{currfile.sty}{\from{currfile.dtx}{currfile.sty}}}
\endbatchfile
diff --git a/Master/texmf-dist/tex/latex/currfile/currfile.sty b/Master/texmf-dist/tex/latex/currfile/currfile.sty
index e686b93fe32..dd7dd5937f2 100644
--- a/Master/texmf-dist/tex/latex/currfile/currfile.sty
+++ b/Master/texmf-dist/tex/latex/currfile/currfile.sty
@@ -16,12 +16,11 @@
%% The Current Maintainer of this work is Martin Scharrer.
%%
%% This work consists of the files currfile.dtx, currfile.ins
-%% and the derived file currfile.sty.
+%% and currfile.sty.
%%
-%% $Id: currfile.dtx 2036 2011-01-09 17:51:42Z martin $
+%% $Id$
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-\ProvidesPackage{currfile}
- [2011/01/09 v0.4 Current input file name and path]
+\ProvidesPackage{currfile}[2011/01/09 v0.4 Current input file name and path]
\RequirePackage{kvoptions}
\SetupKeyvalOptions{family=currfile,prefix=currfile@}
@@ -59,16 +58,55 @@
}
\def\currfile@set#1{%
\begingroup
- \edef\@tempa{#1}%
- \@onelevel@sanitize\@tempa
- \expandafter\filename@parse\expandafter{\@tempa}%
+ \edef\@filef@und{#1}%
+ \ifx\input@path\@undefined\else
+ \currfile@checkpath
+ \fi
+ \@onelevel@sanitize\@filef@und
+ \let\filename@simple\currfile@parseext
+ \let\filename@base\@gobble
+ \expandafter\filename@parse\expandafter{\@filef@und}%
\global\let\currfiledir\filename@area
\global\let\currfilebase\filename@base
- \xdef\currfileext{\ifx\filename@ext\relax tex\else\filename@ext\fi}%
- \xdef\currfilename{\currfilebase\ifx\currfileext\empty\else.\currfileext\fi}%
+ \global\let\currfileext\filename@ext
+ \xdef\currfilename{\currfilebase\ifx\currfileext\@empty\else.\currfileext\fi}%
\xdef\currfilepath{\currfiledir\currfilename}%
\endgroup
}
+\def\currfile@checkpath{%
+ \openin\@inputcheck\@filef@und\relax
+ \ifeof\@inputcheck
+ \expandafter\@tfor
+ \expandafter\@tempb
+ \expandafter:\expandafter=\input@path\do{%
+ \openin\@inputcheck\@tempb\@filef@und\relax
+ \ifeof\@inputcheck\else
+ \edef\@filef@und{\@tempb\@filef@und}%
+ \@break@tfor
+ \fi
+ }%
+ \fi
+ \closein\@inputcheck
+}
+\begingroup
+\@makeother{.}
+\gdef\currfile@parseext#1.#2\\{%
+ \ifx\\#2\\%
+ \ifx\filename@base\@gobble
+ \def\filename@base{#1}%
+ \let\filename@ext\currfile@defaultext%
+ \else
+ \def\filename@ext{#1}%
+ \fi
+ \else
+ \edef\filename@base{\filename@base.#1}%
+ \def\@tempa{\currfile@parseext#2\\}%
+ \expandafter\@tempa
+ \fi
+}
+\endgroup
+\def\currfile@defaultext{tex}
+\@onelevel@sanitize\currfile@defaultext
\def\currfile@push{%
\xdef\currfile@stack{%
{\currfiledir}%