[comp.text.tex] Summary: getting UNIX environ info into .dvi

vjcarey@sphunix.sph.jhu.edu ("Vincent J. Carey") (04/10/91)

 
Summary of UNIX-based methods for "portably" getting FILEID
information of .tex source into the .dvi file.  (By portable,
I mean that the .tex file does not identify itself; at
processing time, its location is obtained from the system
and encoded in the resulting .dvi file.)
 
1) Use the ability of tex/latex to take information from
the invocation.  Here is a script that does this for
a latex document, so that the variable \fileid can
be used at will in the document and will expand to the
absolute pathname with hostname prepended
 
FN=`basename $1 .tex`.tex
FILEID=`hostname`:`pwd`/$FN
FILEID=`echo $FILEID | tr _ .`
echo Inserting $FILEID...
virtex "&"lplain \\def\\fileid{$FILEID}\\input $1
 
2) Use rcs or make.  The details of these approaches
are a little lengthy, and require a principled preparation.
I will forward the details supplied to me to interested
readers.  The rcs (or sccs) method is probably the best for
serious document tracking, but probably should be combined
with the "portable" method like the one described above.
This is because the rcs/sccs keywords are expanded
when the document is "gotten" from the archive, but the
resulting .tex source may be moved elsewhere and modified
("illegitimately", in that the changes should not be permitted
without rcs accounting.)  Then the rcs information, embedded
in the .tex source and any ensuing .dvi file, will be incorrect,
but the dynamically embedded fileid cannot be mistaken.
 
3) Use a script and UNIX file-editing filters to replace
tokens in the text with dynamically obtained environment
information.  Complicated, inelegant, fragile, and the
only one I was able to conceive on my own.
 
Thanks to
aci10@eng.cam.ac.uk
bclause@valhalla.cs.wright.edu
rolfl@hedda.uio.no
pcolsen@super.super.org
asnd@reg.triumf.ca
mernst@theory.lcs.mit.edu
bed_gdg%shsu.decnet@relay.the.net
 
--
-------------------------------------------------------------------------
--
Vincent J. Carey
Department of Biostatistics
Johns Hopkins School of Public Health
 
vjcarey@sphunix.sph.jhu.edu