summaryrefslogtreecommitdiff
path: root/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-filename.html
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-doc/doc/english/FAQ-en/html/FAQ-filename.html')
-rw-r--r--Master/texmf-doc/doc/english/FAQ-en/html/FAQ-filename.html54
1 files changed, 54 insertions, 0 deletions
diff --git a/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-filename.html b/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-filename.html
new file mode 100644
index 00000000000..b52d06b4802
--- /dev/null
+++ b/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-filename.html
@@ -0,0 +1,54 @@
+<head>
+<title>UK TeX FAQ -- question label filename</title>
+</head><body>
+<h3>What's the name of this file</h3>
+<p>One might want this so as to automatically generate a page header or
+footer recording what file is being processed. It's not easy...
+<p>TeX retains what it considers the name of the <em>job</em>, only, in
+the primitive <code>\</code><code>jobname</code>; this is the name of the file first
+handed to TeX, stripped of its directory name and of any extension
+(such as <code>.tex</code>). If no file was passed (i.e., you're using TeX
+interactively), <code>\</code><code>jobname</code> has the value <code>texput</code> (the name that's
+given to <code>.log</code> files in this case).
+<p>This is fine, for the case of a small document, held in a single file;
+most significant documents will be held in a bunch of files, and
+TeX makes no attempt to keep track of files input to the
+<em>job</em>. So the user has to keep track, himself - the only way
+is to patch the input commands and cause them to retain details of the
+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:
+<pre>
+ \def\ThisFile{\jobname}
+ \newcounter{FileStack}
+ \let\OrigInput\input
+ \renewcommand{\input}[1]{%
+ \stepcounter{FileStack}
+ \expandafter\let
+ \csname NameStack\theFileStack\endcsname
+ \ThisFile
+ \def\ThisFile{#1}%
+ \OrigInput{#1}%
+ \expandafter\let\expandafter
+ \ThisFile
+ \csname NameStack\theFileStack\endcsname
+ \addtocounter{FileStack}{-1}%
+ }
+</pre>
+(And similarly for <code>\</code><code>include</code>.) The code assumes you always use
+LaTeX syntax for <code>\</code><code>input</code>, i.e., always use braces around the
+argument.
+<p>The <i>FiNK</i> ("File Name Keeper") package provides a
+regular means of keeping track of the current file name (with its
+extension), in a macro <code>\</code><code>finkfile</code>. The bundle includes a
+<i>fink.el</i> that provides support under <i>emacs</i> with
+AUC-TeX.
+<dl>
+<dt><tt><i>fink.sty</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/fink.zip">macros/latex/contrib/fink</a> (<a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/fink.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/fink/">browse</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>
+</body>