From ca6449b1a40c3ba024f1819af6ff8b7b2ddc22e6 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 28 Apr 2007 00:52:36 +0000 Subject: new package inversepath (26apr07) git-svn-id: svn://tug.org/texlive/trunk@4204 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/inversepath/inversepath.sty | 75 ++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/inversepath/inversepath.sty (limited to 'Master/texmf-dist/tex/latex/inversepath') diff --git a/Master/texmf-dist/tex/latex/inversepath/inversepath.sty b/Master/texmf-dist/tex/latex/inversepath/inversepath.sty new file mode 100644 index 00000000000..dc011e4421f --- /dev/null +++ b/Master/texmf-dist/tex/latex/inversepath/inversepath.sty @@ -0,0 +1,75 @@ +%% +%% This is file `inversepath.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% inversepath.dtx (with options: `package') +%% +%% __________________________________ +%% Copyright (C) 2007 Will Robertson +%% +%% License information appended. +%% +\ProvidesPackage{inversepath} + [26/04/2007 v0.1 Inverse relative paths] +\newcommand\inversepath[1]{% + \let\ip@origjobpath\ip@jobpath + \let\ip@directpath\@empty + \let\ip@inversepath\@empty + \ip@strippath#1/\@nil/% + \let\ip@jobpath\ip@origjobpath + \ip@inversepath} +\newcommand\absolutepath[1]{\def\ip@jobpath{#1}} +\def\ip@literaldotdot{..} +\def\ip@strippath#1/#2/{% + \ifx\@nil#2\relax + \def\ip@lastelement{#1}% + \else + \edef\ip@directpath{\ip@directpath#1/} + \def\@tempa{#1}% + \ifx\@tempa\ip@literaldotdot + \unless\ifdefined\ip@jobpath + \PackageError{inversepath} + {No absolute path specified} + {You must declare the file path of the main + file with \protect\absolutepath{} to be able to + resolve back-relative paths}% + \fi + \let\ip@olddirectpath\ip@directpath + \let\ip@oldinversepath\ip@inversepath + \let\ip@directpath\@empty + \let\ip@inversepath\@empty + \expandafter\ip@strippath\ip@jobpath\@nil/ + \let\@tempa\ip@lastelement + \let\ip@jobpath\ip@directpath + \let\ip@directpath\ip@olddirectpath + \let\ip@inversepath\ip@oldinversepath + \ifx\@tempa\@empty + \PackageError{inversepath} + {Absolute path too shallow to resolve + such a deep relative path} + {You're trying to go back more directories than you have!} + \fi + \edef\ip@inversepath{\@tempa/\ip@inversepath}% + \else + \edef\ip@inversepath{../\ip@inversepath}% + \fi + \def\@tempa{\ip@strippath#2/}% + \expandafter\@tempa + \fi} +%% +%% Copyright (C) 2006 by Will Robertson +%% +%% Distributable under the LaTeX Project Public License, +%% version 1.3c or higher (your choice). The latest version of +%% this license is at: http://www.latex-project.org/lppl.txt +%% +%% This work is "maintained" (as per LPPL maintenance status) +%% by Will Robertson. +%% +%% This work consists of the file inversepath.dtx +%% and the derived files inversepath.sty and inversepath.pdf. +%% +%% +%% End of file `inversepath.sty'. -- cgit v1.2.3