[OS X TeX] print the latex source filename
Alain Schremmer
schremmer.alain at gmail.com
Sat Mar 21 03:41:37 CET 2009
On Mar 20, 2009, at 9:57 AM, Peter Dyballa wrote:
>
> Am 20.03.2009 um 12:56 schrieb Alessandro Languasco:
>
>> Nice
>
> A bit nicer is this block of code from Heiko Oberdiek for
> "branding" the pdfTeX output also with the date of the source (it
> also uses \jobname):
>
> \makeatletter % following code needs hyperref
> \@ifundefined{pdffilemoddate}{%
> \PackageError{sourcetime}{%
> pdfTeX >= 1.30.0 required%
> }%
> \let\pdffilemoddate\@gobble
> }{}%
> \newcommand*{\SourceFile}[1]{%
> \edef\@SourceFileDate{\pdffilemoddate{#1}}%
> % empty in case of errors, but don't harm in next comparison
> \ifnum\pdfstrcmp{\@SourceFileDate}{\@CurrentSourceFileDate}>0 %
> \let\@CurrentSourceFileDate\@SourceFileDate
> \expandafter\@ParseDate\@SourceFileDate\@nil
> \hypersetup{%
> pdfcreationdate={\@SourceFileDate},%
> pdfmoddate={\@SourceFileDate}%
> }%
> \PackageInfo{sourcetime}{%
> Using file `#1'%
> }%
> \fi
> }
> \newcommand*{\@CurrentSourceFileDate}{}
> \expandafter\def\expandafter\@ParseDate\detokenize{D:}
> #1#2#3#4#5#6#7#8{%
> \year=#1#2#3#4\relax
> \month=#5#6\relax
> \day=#7#8\relax
> \@ParseTime
> }
> \def\@ParseTime #1#2#3#4#5\@nil{%
> \time=\numexpr #1#2 * 60 + #3#4\relax
> }
> \makeatother
> \SourceFile{\jobname.tex}
I haven't been able to make this code work. What does it do compared to:
\documentclass[11pt]{book}
\usepackage{calc}
\newcounter{hours}\newcounter{minutes}
\newcommand{\printtime}%
{%begin definition
\setcounter{hours}{\time/60}%
\setcounter{minutes}{\time-\value{hours}*60}%
\thehours:\theminutes%
}%end definition
\begin{document}
This file was saved as \jobname \hspace{1mm} on \today \hspace{1mm}
at \printtime.
\end{document}
Puzzled regards
--schremmer
More information about the macostex-archives
mailing list