summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-filename.html
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-filename.html')
-rw-r--r--Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-filename.html181
1 files changed, 100 insertions, 81 deletions
diff --git a/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-filename.html b/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-filename.html
index 807ac5b8872..81f528daa1e 100644
--- a/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-filename.html
+++ b/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-filename.html
@@ -19,90 +19,109 @@ file name. This is particularly difficult in the case of Plain TeX,
since the syntax of the <code>\</code><code>input</code> command is so peculiar.
<p/>In the case of LaTeX, the input commands have pretty regular
syntax, and the simplest <a href="FAQ-patch.html">patching techniques</a> can be
-used on them.
-<p/>If you&#8217;re not inputting things from a file that&#8217;s already been input,
-the job is almost trivial:
-<blockquote>
-<pre>
-\def\ThisFile{\jobname}
-\let\OldInput\input
-\renewcommand{\input}[1]{%
- \renewcommand{\ThisFile}{#1}%
- \OldInput#1%
-}
-</pre>
-</blockquote><p>
-With that, the macro <code>\</code><code>ThisFile</code> always contains the last thing
-input: it starts pointing at the base file of your document
-(<code>\</code><code>jobname</code>), and thereafter changes every time you use
-<code>\</code><code>input{</code><em>file</em><code>}</code>. Note that this is not satisfactory if your
-document contains things <em>other</em> than <code>\</code><code>input</code> commands. For
-example, in:
-<blockquote>
-<pre>
-\documentclass{article}
-... (macros above)
-\begin{document}
-\input{preamble}
-&#60;body of document&#62;
-\input{postamble}
-\end{document}
-</pre>
-</blockquote><p>
-<code>\</code><code>ThisFile</code> contains <code>postamble</code> throughout the
-&lt;<i>body of document</i>&gt;.
-<p/>Most ordinary users will quickly become irritated with the simplicity
-of of the <code>\</code><code>ThisFile</code> mechanism above. The following code is more
-cunning: it maintains details of the files you&#8217;ve &#8216;come through&#8217; to
-get to where you are, and it restores <code>\</code><code>ThisFile</code> to what the
-previous file was before returning.
-<blockquote>
-<pre>
-\def\ThisFile{\jobname}
-\newcounter{FileStack}
-\let\OrigInput\input
-\renewcommand{\input}[1]{%
- \stackinput{#1}{\OrigInput}%
-}
-\newcommand{\stackinput}[2]{%
- \stepcounter{FileStack}%
- \expandafter\let
- \csname NameStack\theFileStack\endcsname
- \ThisFile
- \def\ThisFile{#1}%
- #2#1%
- \expandafter\let\expandafter
- \ThisFile
- \csname NameStack\theFileStack\endcsname
- \addtocounter{FileStack}{-1}%
-}
-</pre>
-</blockquote><p>
-To do the same for <code>\</code><code>include</code>, we need the simple addition:
-<blockquote>
-<pre>
-\let\OrigInclude\include
-\renewcommand{\include}[1]{%
- \stackinput{#1}{\OrigInclude}%
-}
-</pre>
-</blockquote><p>
-Both examples of patching <code>\</code><code>input</code> assume you always use
-LaTeX syntax, i.e., always use braces around the argument.
-<p/>The <i>FiNK</i> (&#8220;File Name Keeper&#8221;) package provides a
-regular means of keeping track of the current file name (with its
-extension), in a macro <code>\</code><code>finkfile</code>. If you need the unadorned file
-name (without its &#8216;<code>.tex</code>&#8217;), use the commands:
-<blockquote>
-<pre>
-\def\striptexext#1.tex{#1}
-...
-\edef\ThisFile{\expandafter\stripext\finkfile}
-</pre>
-</blockquote><p>
+used on them. (Note that latex&#8217;s <code>\</code><code>input</code> command is itself a
+patch on top of the Plain TeX command. Our patches apply to the
+LaTeX version of the command, which is used as <code>\</code><code>input{</code><em>file</em><code>}</code>)
+<p/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<p/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<p/>It is possible to keep track of the name of the file currently being
+processed, but it&#8217;s surprisingly difficult (these FAQs offered
+code, for a long time, that just didn&#8217;t work in many cases).
+<p/>The <i>currfile</i> package provides a regular means of keeping
+track of the details of the current file (its name in
+<code>\</code><code>currfilename</code>, directory in <code>\</code><code>currfiledir</code>, as well as the
+file &#8216;base&#8217; name (less its extension) and its extension).
+<i>Currfile</i> does this with the help of a second package,
+<i>filehook</i>, which spots file operations that use <code>\</code><code>input</code>,
+<code>\</code><code>InputIfFileExists</code> and <code>\</code><code>include</code>, as well as package and
+class loading.
+<p/>The <i>FiNK</i> (&#8220;File Name Keeper&#8221;) package keeps track of the
+file name and extension, in a macro <code>\</code><code>finkfile</code>. <i>FiNK</i> is
+now deprecated, in favour of <i>currfile</i>, but remains available
+for use in old documents.
+
+
+
+
+
+
+
+
+
+
+
The <i>FiNK</i> bundle includes a <i>fink.el</i> that provides
support under <i>emacs</i> with AUC-TeX.
<dl>
+<dt><tt><i>currfile.sty</i></tt><dd><a href="http://mirror.ctan.org/macros/latex/contrib/currfile.zip">macros/latex/contrib/currfile</a> (or <a href="http://mirror.ctan.org/macros/latex/contrib/currfile/">browse the directory</a>); <a href="http://mirror.ctan.org/help/Catalogue/entries/currfile.html">catalogue entry</a>
+<dt><tt><i>filehook.sty</i></tt><dd><a href="http://mirror.ctan.org/macros/latex/contrib/filehook.zip">macros/latex/contrib/filehook</a> (or <a href="http://mirror.ctan.org/macros/latex/contrib/filehook/">browse the directory</a>); <a href="http://mirror.ctan.org/help/Catalogue/entries/filehook.html">catalogue entry</a>
<dt><tt><i>fink.sty</i></tt><dd><a href="http://mirror.ctan.org/macros/latex/contrib/fink.zip">macros/latex/contrib/fink</a> (or <a href="http://mirror.ctan.org/macros/latex/contrib/fink/">browse the directory</a>); <a href="http://mirror.ctan.org/help/Catalogue/entries/fink.html">catalogue entry</a>
</dl>
<p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=filename">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=filename</a>