[pdftex] current filename and current filedate ?

George N. White III aa056 at chebucto.ns.ca
Fri Dec 19 13:13:01 CET 2003


On Fri, 19 Dec 2003, Heiko Oberdiek wrote:

> On Fri, Dec 19, 2003 at 07:31:39AM +0000, Robin Fairbairns wrote:
>
> > > I would like to obtain not only the date/time at which pdflatex is
> > > running, but I would like to obtain the date+time+name of the current
> > > file (which can be an include'd file; each one is a chapter, so this
> > > would make for a nice "this chapter was last edited on dec 3, 2004".  I
> > > am not using revision control, or any other fancy mechanism.   is this
> > > possible?
> >
> > no.
>
> It is possible to use \immediate\write18{...} to run an external
> program that gets and prepares the desired piece of information
> and writes the result into a file that can be input at TeX level.
> (Instead of the risky \write18 the external program can be run
> before. Then it collects the file dates of all desired files
> and writes these in a file with the file name.)
>
> > get it under revision control and use the check-in records.
>
> But having revision control is much better.

And very easy to do.  RCS is available for *n*x, OSX, and Win32 -- not
sure about earlier Mac OS's.  There are fancy commercial systems that
support multiple networked users, but if you aren't using version
control at all, RCS takes very little extra work.  Emacs includes
support for RCS so you don't have to run the checkin/checkout
commands manually.

Simply define something like:

\def\RCSId $Id: #1,v #2 #3/#4/#5 #6 #7 #8 #9 ${
  \def\fileRCSversion{#2}
  \def\fileRCSdate{#3-#4-#5}
  \def\fileRCStime{#6Z}
  }

RCS updates strings of the form "$Id:...$" with the version number
and timestamp, so the the following line in each file will set the
macros to the value for the file.

\RCSId $Id: getroi.tex,v 1.2 2003/12/04 19:23:56 gwhite Exp gwhite $

RCS also has "$Log: $" that let you insert a comment about the changes
made for each version you check in.

--
George N. White III  <aa056 at chebucto.ns.ca>
  Head of St. Margarets Bay, Nova Scotia, Canada


More information about the pdftex mailing list