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.
You could set the
\jobname variable via the compiler's command line option
-jobname like this:
pdflatex -jobname mydoc-2019-07-11 mydoc.tex
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