Let's assume my document is called test.tex. Instead of creating a test.pdf I would like to add a suffix date stamp to the filename, e.g. test_2013_05_29 (test_yyyy_mm_dd). I am compiling with pdfLaTeX and I would like this to work both on Windows and on Mac.
2 Answers
Use the -jobname option (the order is important):
pdflatex -jobname=testDATE test.tex
(I am not sure how distribution-dependent this is, I am using This is pdfTeX, Version 3.1415926-2.5-1.40.13 (TeX Live 2013/dev))
Also, in GNU/Linux-like system you can make this automatic from the command line as
pdflatex -jobname=test_`date +%Y_%m_%d` test.tex
(not sure if the date command works in the same way in Mac)
This solution is not perfect with respect to the compilation process, since auxiliary files will be labeled in the same way, so compilation will be "discontinuous" across days, which may not be serious. I think it may be safer to do (the good old) change of name after compilation if you can, for example in GNU/Linux:
pdflatex test.tex && mv/cp test.pdf test_`date +%Y_%m_%d`.pdf
- 14,350
There's a package varsfromjobname, that allows you to extract certain parts from the name of the document.
Find it under http://www.ctan.org/tex-archive/macros/latex/contrib/varsfromjobname
- 13,168
- 5
- 53
- 93
\today(I often place it in a header) – Steven B. Segletes May 29 '13 at 19:49