diff options
author | Karl Berry <karl@freefriends.org> | 2009-03-27 17:38:44 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-03-27 17:38:44 +0000 |
commit | efea67c15fb7c7523abed04b817bd49f99d020ba (patch) | |
tree | ec2e0c97068f16ab5b74734a6e99d1eb3b13f7a6 /Master/texmf-dist/tex | |
parent | 1fddf16fa42617a05e4c11e6b34975154fa057c9 (diff) |
import.sty update (24mar09)
git-svn-id: svn://tug.org/texlive/trunk@12533 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/import/import.sty (renamed from Master/texmf-dist/tex/latex/ltxmisc/import.sty) | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/Master/texmf-dist/tex/latex/ltxmisc/import.sty b/Master/texmf-dist/tex/latex/import/import.sty index 48c529a598e..cce424c46ad 100644 --- a/Master/texmf-dist/tex/latex/ltxmisc/import.sty +++ b/Master/texmf-dist/tex/latex/import/import.sty @@ -1,22 +1,30 @@ -% import.sty Ver 3.0 17-Dec-1997 Donald Arseneau (asnd@reg.triumf.ca) +% import.sty Ver 5.1 23-Mar-2009 Donald Arseneau (asnd@triumf.ca) % -% Allow input of a file with its own inputs from another directory. +% This software is in the public domain; free of any restrictions. +% +% Two new \LaTeX\ commands, "\import {full_path} {file}" and +% "\subimport {path_extension} {file}" are defined to input a file +% from another directory, allowing that file to find its own inputs +% (using "\input", "\includegraphics" etc.) in that directory. % -% \import {full_path} {file} \subimport {path_extension} {file} -% Also \includefrom, \subincludefrom, and * variants. +% Alias command names are "\inputfrom" and "\subinputfrom". % -% This software is free of any restrictions. +% Also provided are "\includefrom" and "\subincludefrom", which are +% based on the "\include" command, rather than "\input". There are +% also "*" variants described below. % % For example, if a remote file "/usr5/friend/work/report.tex" has contents: +% % My graph: \includegraphics{picture} % \input{explanation} +% % then you can safely input that file in your own document with the command % "\import{/usr5/friend/work/}{report}"; the explanation and picture will -% be taken from the remote directory. You can then import documents from -% other friends, even if they use the same file names. +% be taken from the "/usr5/friend/work/" directory. % -% The "\subimport" command allows imported files to import files themselves, -% using their own directory as the root of a "path_extension". Do not use +% The "\subimport" command takes a relative path instead of a full absolute +% file path, and it allows imported files to import files themselves, using +% their own directory as the root of another "path_extension". Do not use % both "\import" and "\subimport" in the same file. % % For example, if a file is imported (using either command) from directory @@ -32,7 +40,7 @@ % TEXINPUTS path, that other file will be read in preference to one in the % import directory. So here is the real behavior of the previous example: % Given the sequence "\import{abc/}{one}", "\subimport{lmn/uvw/}{two}" (in -% file one), "\input{three}" (in file two), LaTeX first looks for three.tex +% file one), "\input{three}" (in file two), \LaTeX\ first looks for three.tex % in the TEXINPUTS search path; if not found, it tries "abc/lmn/uvw/three"; % if that doesn't exist, it tries "abc/three"; if still not found, it tries % the defined "\input@path", if there is one. @@ -47,9 +55,20 @@ % % Presently, the paths are defined ``locally'' so input files must have % balanced grouping. +%====================== END INSTRUCTIONS =========================== -\newcommand{\import}{\global\let\import@path\@empty \@doimport\input} +\ProvidesPackage{import}[2009/03/23 \space v 5.1] +\ProcessOptions + +\@ifundefined{import}{% + \newcommand{\import}{\global\let\import@path\@empty \@doimport\input} +}{ + \PackageWarning{import}{\string\import\space command is already defined!^^J% + Defining only its \string\inputfrom\space alias.} +} +\newcommand{\inputfrom}{\global\let\import@path\@empty \@doimport\input} \newcommand{\subimport}{\@doimport\input} +\newcommand{\subinputfrom}{\@doimport\input} \newcommand{\includefrom}{\global\let\import@path\@empty \@doimport\include} \newcommand{\subincludefrom}{\@doimport\include} @@ -60,7 +79,7 @@ \def\@sub@import#1#2#3{% \begingroup \protected@edef\@tempa{\endgroup - \let\noexpand\IfFileExists\noexpand#2 + \let\noexpand\IfFileExists\noexpand#2% \noexpand\@import \noexpand#1% param 1 {\@ifundefined{input@path}{}{\input@path}}% 2 {\@ifundefined{Ginput@path}{}{\Ginput@path}}% 3 |