Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LaTeX command for last modified

Tags:

date

latex

Is there a LaTeX command that prints the "last modified" date of the actual document? Since LaTeX projects consist of more than one file this command ideally prints the date of the actual file, not that of the project.

like image 470
DaClown Avatar asked Jan 22 '10 17:01

DaClown


2 Answers

pdfTeX provides the primitive \pdffilemoddate to query this information for files. (LuaTeX uses its own Lua functions for the same thing.) Since pdfTeX is used by default in all LaTeX distributions in the last few years (at least), there's no harm in using the new functionality unless you're dealing with very old production systems. Here's an example:

\documentclass{article}
\begin{document}
\def\parsedate #1:20#2#3#4#5#6#7#8\empty{20#2#3/#4#5/#6#7}
\def\moddate#1{\expandafter\parsedate\pdffilemoddate{#1}\empty}
this is the moddate: \moddate{\jobname.tex}
\end{document}

(Assuming the file has been modified since year 2000.)

like image 95
Will Robertson Avatar answered Sep 19 '22 18:09

Will Robertson


The package filemod seems to do exactly what you need. To get the last modified date of the file you just include the package in the usual way:

\usepackage{filemod}

and the modification time of the current document is printed by:

\filemodprintdate{\jobname}

you can also print the modification time, and there are many options to format the output.

like image 21
Grzenio Avatar answered Sep 18 '22 18:09

Grzenio