# [OS X TeX] print the latex source filename

Peter Dyballa Peter_Dyballa at Web.DE
Sat Mar 21 20:36:28 CET 2009

Am 21.03.2009 um 15:40 schrieb Alain Schremmer:

> That's the trouble: I am not getting any error. I am not getting
> anything … other than
>
> This is a text body!

That's correct!

Everything in the preamble does not find a way to materialise in the
body. You only see side-effects (font size, text width, etc.).

Heiko Oberdiek's code has one "executable:" \SourceFile. When it
executes, it executes the \hypersetup (and overwrites variables'
values, as mentioned before). \pdffilemoddate{} returns a date in a
form like that: D:20090304121314+01'00', i.e., D(ate):YYYYMMDDHHMMSS
+TZh'TZmin'. It's what PDF uses internally.

In the lines before the final \makeatother you can see variable names
which should look familiar to you (\year, \month, \day, \time). You
are using them for your time stamps. While these reflect the time of
compilation, \SourceFile overwrites them with the last modification
or save time of the source file. So, when you want to print the time
of the source file's compilation, you should not use Heiko Oberdiek's
code – or comment the "side-effect" code.

The four mentioned variables always exist and are initialised. \time
contains the minutes since midnight – to easily distinguish between
AM and PM, to whom it may concern! You could also use this:

\newcount\hours
\newcount\minutes
\hours\time \divide\hours 60
\edef\timehhmm{\ifnum\hours<10 0\fi\the\hours
:\ifnum\minutes<10 0\fi\the\minutes}
\newcommand\daytime{\edef\today{\today\,~\timehhmm}\today}

When you now put \daytime somewhere in your text body, the definition
of \today is updated, then \today is executed and something like
"<your \today definition> hh:mm" will be printed. You don't need the
calc package – because you can calculate, presumingly, and TeX also.
(Found somewhere, lhelp.sty?)

--
Greetings

Pete

"We need a president who's fluent in at least one language."
– Buck Henry