On 28.05.2010, at 00:30, Tim Wescott wrote:

> Under the 'Article' document type, the title page will list the print date of 
> a document.
> 
> But I vastly prefer to insert my own date, or to list the save date of the 
> file -- it just makes more sense for tracking changes.
> 
> Is there a way to get LyX to do this? I didn't see it in the menus.

Assuming you are compiling with pdftex as backend (which is most probably the 
case, as all more or less recent LaTeX-Distributions use it by default -- even 
when compiling to dvi), you can use the  \pdffilemoddate{<filename>} built-in 
command to retrieve the "last modified" date of <filename>. 

LyXically and applied for the own source file this comes down to the following 
two lines, which should be inserted into your document's preamble:

\def\parsedate #1:20#2#3#4#5#6#7#8\empty{20#2#3/#4#5/#6#7}
\date{\expandafter\parsedate\pdffilemoddate{\jobname.tex}\empty}

(You can alter the display format, e.g., to use full stops instead of hyphens 
as separators, by modifying the \empty{} part of the first line.

I have found the basics of this trick on the net some time ago, so I do not 
want claim authorship for it. Note that in its current form \parsedate only 
works for the years 2000 -- 2099.

Daniel
 

Reply via email to