Using pdflatex in batch scripts to build pdf's with different version numbers?

by Halkaz00   Last Updated July 11, 2019 20:23 PM

In developing documentation for software a new version of .tex files are made as the software is developed. I'd like to be able to build the corresponding pdf's without hard-coding the name of the .tex file every time a new version is made. Is there any way to do this directly? I haven't found any documentation on this possibility, such as passing a variable set to the file name into the pdflatex command.

As an example: I have a source .tex file named myfile_v1.0.tex in the directory I'm currently working in. In the future, a file named myfile_v1.1.tex will replace the previous version .tex file so that an updated pdf for the new software documentation can be built. I'd like to be able to build the pdf's from the source .tex file, no matter the name of the source .tex file, since it will be changing consistently.

Tags : pdftex windows


Answers 1


You could set the \jobname variable via the compiler's command line option -jobname like this:

pdflatex -jobname mydoc-2019-07-11 mydoc.tex

where mydoc.tex is your input file and mydoc-2019-07-11.pdf would be the produced output file.

From within the .tex file you can also access the file name by \jobname which would expand in this case to mydoc-2019-07-11.

siracusa
siracusa
July 11, 2019 19:44 PM

Related Questions


Updated May 16, 2016 08:09 AM

Updated June 27, 2016 09:09 AM

Updated May 28, 2018 08:23 AM

Updated December 07, 2017 19:23 PM

Updated March 01, 2018 18:23 PM