5

pdflatex command allows to specify an output name through --job-name= option. But can't insert the date and time automatically.

Emacs could do it:

(compile-command "pdflatex --job-name=myoutputname.pdf myfile.tex")

How can the compile-command be modified to automatically add the date and time in the output name?

luchonacho
  • 4,161
thomasb
  • 175
  • https://tex.stackexchange.com/questions/19182/how-to-influence-the-name-of-the-pdf-file-created-with-pdflatex-from-within-the – Masroor Sep 01 '17 at 11:27
  • It works perfectly though, but doesn't allow to insert the date automatically... Maybe the post should be in Emacs forum rather ? (Many thanks anyway !) – thomasb Sep 01 '17 at 11:42
  • Yes, it was not supposed to work perfectly. It was just a pointer. I faced this issue before where I had to control the .pdf output name of around 4000 files (to be auto compiled by a script). Finding no other alternative, I generated each of 4000 plus .tex file in runtime (using LaTeX :-)) and then generated the .pdf's. And you are welcome. – Masroor Sep 01 '17 at 13:05

1 Answers1

9

Presumably you can replace

"pdflatex --job-name=myoutputname.pdf myfile.tex"

by

(concat "pdflatex --job-name=myoutputname-"
    (format-time-string "%Y-%m-%d")
     ".pdf myfile.tex")

which produces

"pdflatex --job-name=myoutputname-2017-09-01.pdf myfile.tex"
David Carlisle
  • 757,742