[OS X TeX] print the latex source filename
Claus Gerhardt
gerhardt at me.com
Sat Mar 21 18:49:52 CET 2009
(* The attached script writes the file path, the creation date and the
modification date and the new commands
\theFile
\modDate
\creationDate
to a file filename.additions. Read this file via
\input{filename.additions}, then the above commands and their values
are available.
The script can be saved as TeXShop macro.*)
Claus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: additions.scpt.zip
Type: application/zip
Size: 9023 bytes
Desc: not available
URL: <http://tug.org/pipermail/macostex-archives/attachments/20090321/a8fb56d8/attachment.zip>
-------------- next part --------------
On Mar 21, 2009, at 15:40, Alain Schremmer wrote:
>
> On Mar 21, 2009, at 6:15 AM, Peter Dyballa wrote:
>
>> This records the time when the source file was compiled. The other
>> code reflects the time when the source file was saved. This does
>> make a difference: some time vs. a versioning time stamp.
>
> Since I am versioning all by myself ?
>
>> BTW: the compile time is usually recorded in the PDF output, so
>> it's not that useful to put it also in the text body.
>
>
>> You can see it on the command line with pdfinfo (from the xpdf
>> software), you can see it in Finder's inspector (quite the same
>> with ?-I),
>
> True but when you need an exam and you find a few copies lying on
> your desk, seemingly just what you need, you do want to check the
> compile date.
>
>> and you can also check it in Adobe or Acrobat Readers.
>
> No, because all Adobe applications are banned from my computer. (Too
> invasive.)
>
>> Although recently re-compiled the date of the source file's last
>> change is recorded. You can have both times by commenting, for
>> example, the line with ``pdfcreationdate={\@SourceFileDate},%?? in
>> the \hypersetup:
>>
>> Title: An UTF-8 LaTeX Example
>> Subject: ISO Latin-1 and ISO Latin-9 characters
>> Keywords: LaTeX, UTF8, ISO, Latin-1, Latin-2, Latin-9, ISO
>> 8859, LICR
>> Author: Peter Dyballa
>> Creator: LaTeX with hyperref package
>> Producer: pdfTeX-1.40.9
>> CreationDate: Sat Mar 21 11:11:22 2009
>> ModDate: Sat Mar 21 11:11:11 2009
>> Tagged: no
>> Pages: 4
>> Encrypted: no
>> Page size: 841.89 x 595.276 pts (A4)
>> File size: 141162 bytes
>> Optimized: no
>> PDF version: 1.4
>
> However, yes, it would be good to have both dates. Because I tend to
> over-compile because I tend to lose the pdf.
>
>> To implement it, in the preamble:
>>
>> \documentclass[]{<somecls>}
>>
>> \usepackage{hyperref} % necessary
>> \makeatletter
>> \@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}{} % produces date form
>> for PDF info
>> \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} % execution
>>
>> \begin{document}
>> This is a text body!
>> \end{document}
>>
>>
>> What are the errors you get?
>
> That's the trouble: I am not getting any error. I am not getting
> anything ? other than
>
> This is a text body!
>
> I even tried to move/copy
>
> \SourceFile{\jobname.tex}
>
> to within the document. No error, no stamp that I can see.
>
> So I must be missing something big!
>
>
> Here is the console:
>
> (/usr/local/gwTeX/texmf.texlive/tex/latex/base/bk11.clo))
> (/usr/local/gwTeX/texmf.texlive/tex/latex/hyperref/hyperref.sty
> (/usr/local/gwTeX/texmf.texlive/tex/latex/graphics/keyval.sty)
> (/usr/local/gwTeX/texmf.texlive/tex/latex/hyperref/pd1enc.def)
> (/usr/local/gwTeX/texmf.texlive/tex/latex/config/hyperref.cfg)
> (/Users/gpadnom/Library/texmf/tex/latex/kvoptions.sty)
> Implicit mode ON; LaTeX internals redefined
> (/usr/local/gwTeX/texmf.texlive/tex/latex/ltxmisc/url.sty))
> *hyperref using default driver hpdftex*
> (/usr/local/gwTeX/texmf.texlive/tex/latex/hyperref/hpdftex.def)
> (/usr/local/gwTeX/texmf.texlive/tex/latex/tools/calc.sty)
> No file DyballaCompile-Save.aux.
> (/Users/gpadnom/Library/texmf/tex/latex/nameref.sty) [1{/usr/local/
> gwTeX/texmf.
> local/fonts/map/pdftex/updmap/pdftex.map}] (./DyballaCompile-
> Save.aux) )</usr/l
> ocal/gwTeX/texmf.texlive/fonts/type1/bluesky/cm/cmr10.pfb>
> Output written on DyballaCompile-Save.pdf (1 page, 11179 bytes).
> Transcript written on DyballaCompile-Save.log.
>
> (Just in case: I am still using gwTeX on 10.4.11)
>
> Hopeful regards
> --schremmer
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ----------- Please Consult the Following Before Posting -----------
> TeX FAQ: http://www.tex.ac.uk/faq
> List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
> List Archive: http://tug.org/pipermail/macostex-archives/
> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
> List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex
>
More information about the macostex-archives
mailing list