diff options
author | Karl Berry <karl@freefriends.org> | 2012-05-07 22:49:57 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-05-07 22:49:57 +0000 |
commit | 6dec32fb82f9e57953655c2dbddb68c5120c4322 (patch) | |
tree | 3d61735f257c8afab559b631f9401aded3a5fa24 /Master/texmf-dist/tex/latex/currfile/currfile.sty | |
parent | 00594439f07c4918772b72ae22786fb762b93f37 (diff) |
currfile (7may12)
git-svn-id: svn://tug.org/texlive/trunk@26244 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/currfile/currfile.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/currfile/currfile.sty | 73 |
1 files changed, 69 insertions, 4 deletions
diff --git a/Master/texmf-dist/tex/latex/currfile/currfile.sty b/Master/texmf-dist/tex/latex/currfile/currfile.sty index 9697d4679c2..01ed8381aee 100644 --- a/Master/texmf-dist/tex/latex/currfile/currfile.sty +++ b/Master/texmf-dist/tex/latex/currfile/currfile.sty @@ -1,7 +1,7 @@ \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{currfile}[% - 2011/09/18 - v0.5 + 2012/05/06 + v0.6 ydoc package to describe macros, environments, options etc.] \RequirePackage{kvoptions} \SetupKeyvalOptions{family=currfile,prefix=currfile@} @@ -20,6 +20,9 @@ \DeclareBoolOption[false]{fink}% }% \DeclareVoidOption{force}{\PassOptionsToPackage{force}{filehook}} +\DeclareBoolOption[false]{realmainfile}% +\let\ifcurrfile@realmainfile\relax +\DeclareBoolOption[false]{abspath}% \RequirePackage{filehook}[2011/01/09] \ProcessKeyvalOptions*\relax @@ -28,9 +31,26 @@ \xdef\currfile@maindir{\currfile@maindir}% \def\@tempa{./}% \ifx\@tempa\currfile@maindir - \global\let\currfile@maindir\empty + \global\let\currfile@maindir\@empty \fi \endgroup + +\expandafter\ifx\csname ifcurrfile@realmainfile\endcsname\relax + \ifcurrfile@abspath + \currfile@realmainfiletrue + \else + \currfile@realmainfilefalse + \fi +\fi + +\let\currfileabspath\@empty +\let\currfileabsdir\@empty +\ifcurrfile@abspath + \RequirePackage{currfile-abspath} +\else +\ifcurrfile@realmainfile + \RequirePackage{currfile-abspath} +\fi\fi \filehook@prefixwarg\filehook@every@atbegin{% \currfile@push \currfile@set{#1}% @@ -53,6 +73,11 @@ \global\let\currfileext\filename@ext \xdef\currfilename{\currfilebase\ifx\currfileext\@empty\else.\currfileext\fi}% \xdef\currfilepath{\currfiledir\currfilename}% + \ifcurrfile@abspath + \getabspath\currfilepath + \global\let\currfileabspath\theabspath + \xdef\currfileabsdir{\theabsdir\currfiledir}% + \fi \endgroup } \def\currfile@checkpath{% @@ -89,6 +114,17 @@ \endgroup \def\currfile@defaultext{tex} \@onelevel@sanitize\currfile@defaultext +\ifcurrfile@abspath +\def\currfile@push{% + \xdef\currfile@stack{% + {\currfiledir}% + {\currfilebase}% + {\currfileext}% + {\currfileabsdir}% + \currfile@stack + }% +} +\else \def\currfile@push{% \xdef\currfile@stack{% {\currfiledir}% @@ -97,6 +133,7 @@ \currfile@stack }% } +\fi \def\currfile@pop{% \ifx\currfile@stack\empty \PackageWarning{currfile}{File stack underflow!}% @@ -105,6 +142,18 @@ \expandafter\currfile@pop@\currfile@stack\relax \relax\relax\relax } +\ifcurrfile@abspath +\def\currfile@pop@#1#2#3#4#5\relax{% + \gdef\currfiledir{#1}% + \gdef\currfilebase{#2}% + \gdef\currfileext{#3}% + \xdef\currfilename{\currfilebase\ifx\currfileext\empty\else.\currfileext\fi}% + \xdef\currfilepath{\currfiledir\currfilename}% + \gdef\currfileabsdir{#4}% + \xdef\currfileabspath{\ifx\currfileabsdir\@empty\else\currfileabsdir\currfilename\fi}% + \gdef\currfile@stack{#5}% +} +\else \def\currfile@pop@#1#2#3#4\relax{% \gdef\currfiledir{#1}% \gdef\currfilebase{#2}% @@ -113,15 +162,31 @@ \xdef\currfilepath{\currfiledir\currfilename}% \gdef\currfile@stack{#4}% } +\fi \def\currfile@stack{} -\currfile@set{\currfile@maindir\jobname.\currfile@mainext} +\ifcurrfile@realmainfile + \getmainfile + \ifx\themainfile\@empty + \currfile@set{\currfile@maindir\jobname.\currfile@mainext} + \else + \currfile@set{\themainfile} + \fi +\else + \currfile@set{\currfile@maindir\jobname.\currfile@mainext} +\fi \currfile@push \let\currfile@stackinit\currfile@stack +\let\currfile@abspathfalse\relax +\let\currfile@abspathtrue\relax \newcommand*\ifcurrfilename{\begingroup\currfile@if\currfilename} \newcommand*\ifcurrfilebase{\begingroup\currfile@if\currfilebase} \newcommand*\ifcurrfileext{\begingroup\currfile@if\currfileext} \newcommand*\ifcurrfiledir{\begingroup\currfile@if\currfiledir} \newcommand*\ifcurrfilepath{\begingroup\currfile@if\currfilepath} +\ifcurrfile@abspath +\newcommand*\ifcurrfileabspath{\begingroup\currfile@if\currfileabspath} +\newcommand*\ifcurrfileabsdir{\begingroup\currfile@if\currfileabsdir} +\fi \newcommand*\ifcurrfile[1]{% \begingroup \edef\@tempb{#1}% |