From 4a3dacbf99dd46514cee178e616c31d1fe44ed58 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 10 Dec 2010 00:12:53 +0000 Subject: currfile 0.2 (10dec10) git-svn-id: svn://tug.org/texlive/trunk@20702 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/source/latex/currfile/currfile.dtx | 124 ++++++++++++++++++--- 1 file changed, 106 insertions(+), 18 deletions(-) (limited to 'Master/texmf-dist/source/latex') diff --git a/Master/texmf-dist/source/latex/currfile/currfile.dtx b/Master/texmf-dist/source/latex/currfile/currfile.dtx index f2520147cfb..03a66bedbd9 100644 --- a/Master/texmf-dist/source/latex/currfile/currfile.dtx +++ b/Master/texmf-dist/source/latex/currfile/currfile.dtx @@ -19,7 +19,7 @@ %% This work consists of the files currfile.dtx, currfile.ins %% and the derived file currfile.sty. %% -%% $Id: standalone.dtx 1803 2010-04-03 13:59:44Z martin $ +%% $Id: currfile.dtx 1911 2010-12-08 19:29:13Z martin $ % \fi % % \iffalse @@ -29,13 +29,14 @@ %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{currfile} %<*package> - [2010/04/08 v0.1 Current input file name and path] + [2010/12/08 v0.2 Current input file name and path] % % %<*driver> \documentclass{ltxdoc} \usepackage{currfile}[2010/04/08] \usepackage{ifpdf} +\usepackage{booktabs} \usepackage{hyperref} \EnableCrossrefs \CodelineIndex @@ -49,7 +50,7 @@ % % \fi % -% \CheckSum{148} +% \CheckSum{209} % % \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 @@ -69,6 +70,9 @@ % % % \changes{v0.1}{2010/04/08}{Initial version} +% \changes{v0.2}{2010/04/10}{Now work for all files, not only for \cs{input} and \cs{include} files. +% Added package option 'fink' to define the same macros as the 'fink' package. +% } % % \GetFileInfo{currfile.dtx} % @@ -89,7 +93,7 @@ % {\LARGE\sffamily The \emph{currfile} Package\\[\medskipamount]} % {\large Martin Scharrer \\[\medskipamount]\normalsize % \url{martin@scharrer-online.de}\\[.8ex] -% \url{http://www.ctan.org/pkg/standalone/}\\[\bigskipamount]} +% \url{http://www.ctan.org/pkg/currfile/}\\[\bigskipamount]} % {\large Version \fileversion\ -- \filedate}\\ % \end{center} % \vspace{1.2em}% @@ -111,20 +115,46 @@ % Special care is taken to keep the file information of |\include|d files till the final |\clearpage| command, so that page header and footer of the last page % will hold the correct data. % -% Only files loaded with the \LaTeX{} macros |\input| or |\include| and the main file are taken into account. Files loaded using package macros like |\usepackage| or internal -% macros \cs{@input} and \cs{@@input} are ignored. +% Since v0.2 all files are are taken into account, i.e.\ files read using |\input|, |\include|, |\InputIfFileExists|, |\usepackage|, |\RequirePackage| and even +% |\LoadClass| and similar macros. Before v0.2 only |\input| or |\include| and the main file were taken into account. % -% More detailed information can be found in the implementation section (\ref{sec:impl}) if required. +% This package uses the |filehook| package written by the same author. See there for possible incompatibilities with classes or other packages. +% +% More detailed information can be found in the implementation section \ref{sec:impl} if required. % % \subsection*{Package Options} % The package provides two options |mainext| and |maindir| which can be used to provide the extension and directory of the main file. % This is required if the above macros should be used for the main file itself and if this does has a file extension other than `|.tex|' (e.g.\ a |.dtx| file) -% or is not located in the current directory. +% or is not located in the current directory. To provide support for the macros defined by the |fink| package (see section~\ref{sec:fink}) a |fink| option exists. % -% \section{Similar Packages} +% \section{Compatibility with the \texttt{fink} package}\label{sec:fink} % The |fink| package (\emph{fi}le \emph{n}ame \emph{k}eeper) provides a similar functionality. It has inspired this package in several points (e.g.\ package % options). However, it does not exclude package and other preamble files and does not take care to change the filename \emph{after} the |\clearpage| of -% |\include|. +% |\include|. The author of \texttt{fink} is now discontinuing it in favour of this package. +% Existing documents which use |fink| should either rename the related macros as shown by Table~\ref{tab:fink} or use the |fink| option of |currfile| which defines +% the |fink| macros to use the |currfile| ones. +% +% Because both packages do basically the same thing, especially patch the same macros, there are incompatible and should not be loaded both. +% In consent with the |fink| package author this package will undo most of the |fink| code if it was already loaded or prevent it from being loaded afterwards. +% +% \begin{table} +% \belowcaptionskip=\abovecaptionskip +% \abovecaptionskip=0pt +% \caption{Conversion from \texttt{fink} package to \texttt{currfile}.} +% \label{tab:fink} +% \centering +% \begin{tabular}{lll} +% \toprule +% \texttt{fink} & \texttt{currfile} & Example Result \\ +% \midrule +% \cs{finkdir} & \cs{currfiledir} & \ttfamily\currfiledir \\ +% \cs{finkbase} & \cs{currfilebase} & \ttfamily\currfilebase \\ +% \cs{finkext} & \cs{currfileext} & \ttfamily\currfileext \\ +% \cs{finkfile} & \cs{currfilename} & \ttfamily\currfilename \\ +% \cs{finkpath} & \cs{currfilepath} & \ttfamily\currfilepath \\ +% \bottomrule +% \end{tabular} +% \end{table} % % \StopEventually{} % @@ -139,15 +169,36 @@ % \begin{macrocode} \RequirePackage{kvoptions} \SetupKeyvalOptions{family=currfile,prefix=currfile@} -\DeclareStringOption[tex]{mainext} -\DeclareStringOption[]{maindir} + +\@ifl@aded{\@pkgextension}{fink}{% + \DeclareStringOption[\fnk@mainext]{mainext}% + \DeclareStringOption[\fnk@maindir]{maindir}% + \DeclareBoolOption[true]{fink}% + \PackageWarning{currfile}{Package 'fink' detected. % + The 'fink' option will default to 'true'. % + If set to 'false' no 'fink' macros will be changed but they will stop + working correctly!}{}{}{}% +}{% + \DeclareStringOption[tex]{mainext}% + \DeclareStringOption[\@currdir]{maindir}% + \DeclareBoolOption[false]{fink}% +}% \ProcessKeyvalOptions*\relax + +\begingroup +\xdef\currfile@mainext{\currfile@mainext}% +\xdef\currfile@maindir{\currfile@maindir}% +\def\@tempa{./}% +\ifx\@tempa\currfile@maindir + \global\let\currfile@maindir\empty +\fi +\endgroup % \end{macrocode} % % % \subsection{File Hooks} % The \pkg{filehook} package is used to execute the macros at the correct places. -% The internal, not user, interface is used to make sure that the file names are valid for all other hooks. +% The internal interface, not the user-interface, is used to make sure that the file names are valid for all other hooks. % % \begin{macrocode} \RequirePackage{filehook} @@ -161,11 +212,11 @@ \filehook@appendwarg\filehook@include@after{% \currfile@pop } -\filehook@prefixwarg\filehook@input@atbegin{% +\filehook@prefixwarg\filehook@atbegin{% \currfile@push \currfile@set{#1}% } -\filehook@appendwarg\filehook@input@atend{% +\filehook@appendwarg\filehook@atend{% \currfile@pop } % \end{macrocode} @@ -242,6 +293,10 @@ % \end{macrocode} % \end{macro} % +% \iffalse +% \def\dindent{} +% \fi +% % \begin{macro}{\currfile@stack} % \begin{macro}{\currfile@stackinit} % Place |\jobname| values on stack and use this as init value. @@ -254,9 +309,42 @@ % \end{macro} % \end{macro} % -% \iffalse -% \def\dindent{} -% \fi +% +% \subsection{Fink Macros} +% +% The |fink| option defines all |fink| package macros to use the ones provided +% by this package. If the |fink| package was loaded beforehand the restoration +% of these macros must be avoided at the end of this file +% (|fink|s |\InputIfFileExists| was then used to load this package). +% If the package was not loaded its version is set to a dummy value and its +% options to this package options. If |fink| is attempted to be loaded later +% it will trigger an package option clash if different option are used. +% Otherwise it will be taken as already loaded and not loaded ``again''. +% +% \begin{macrocode} +\ifcurrfile@fink + \def\finkfile{\currfilename}% + \def\finkdir{\currfiledir}% + \def\finkpath{\currfilepath}% + \def\finkbase{\currfilebase}% + \def\finkext{\currfileext}% + \@ifl@aded{\@pkgextension}{fink}{% + \def\fink@restore#1{}% + }{% + \@namedef{ver@fink.sty}{2010/12/06}% + \expandafter\edef\csname opt@fink.sty\endcsname{% + maindir=\currfile@maindir,mainext=\currfile@mainext + }% + }% +\else + \@ifl@aded{\@pkgextension}{fink}{}{% + \AtBeginOfFile{fink.sty}{% + \PackageError{currfile}{Package class with deprecated 'fink'. % + Load 'currfile' with the 'fink' option or see the upgrade guide in the manual}{}{}{}% + }% + }% +\fi +% \end{macrocode} % % \iffalse % -- cgit v1.2.3