Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using texmaker and PdfLaTeX. With the exception of changing the .tex filename, does anyone know how to modify the output file name based on a parameter?

I am aware that the following line...

%& -job-name=XYZ

if placed at the beginning of the document would be parsed as an additional parameter. In the above case this would instruct the generation of XYZ.pdf when typeset, therefore:

%& -job-name=XYZ_26Dec2012

would accordingly produce XYZ_26Dec2012.pdf

How can I get the 26Dec2012 to change based on the actual date (automatically), therefore keeping a chronology of working documents as they change over time?

share|improve this question
3  
A 'pure' solution is not possible, unless you are able to extend your engine to interpret special characters in the job-name. Without that support, one would need to execute some *TeX code first and then set the job-name. This is not possible, as discussed in How to influence the name of the pdf file created with pdfLaTeX (from within the source code)?. Hence, the remaining solutions involve writing a script to invoke the engine with an appropriate job-name, copying the file after compilation, or configuring the editor somehow to do one of these things. –  cyberSingularity Dec 26 '12 at 13:11
    
I suspected as much. After posting the above, I found some Python scripts somewhere that pretty much did that. Cant be arsed, too much effort for a bees-d*ck of a benefit.... –  Nicholas Hamilton Dec 26 '12 at 13:15
4  
You could also use some VCS (e.g. Git), in which you commit both source and PDF file, so that you can go back to meaningful point (these tend not to coincide with date changes). –  You Dec 26 '12 at 14:02
    
I'd also recommend a VCS for a history. If you don't want this, you can extend your "Quick Build" command with a script, that copies XYZ.pdf to XYZ_26Dec2012.pdf. –  Tim Hoffmann Mar 17 '13 at 23:47
    
Would you consider using arara in Texmaker to build your documents? –  StrongBad May 24 '13 at 16:58
show 1 more comment

1 Answer

If you use a unix system where the date command is available, you could replace

XYZ

by

XYZ_$(date +"%d%b%Y")

as the -jobname value, either in your first line at the beginning of your document (untested, I don't use texmaker) or in your compile command (tested).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.