LaTeX forum ⇒ OthersPdfLatex Command Line Arguments to Change Output File Path

Information and discussion about other tools not listed above.
SiemensGeek
Posts: 5
Joined: Fri May 29, 2015 11:06 pm

PdfLatex Command Line Arguments to Change Output File Path

Postby SiemensGeek » Fri May 29, 2015 11:24 pm

I have written a function in Python that generates a report in a .tex file. I want to pass this path and file to PdfLatex to generate a .pdf file and then display this file. I have a working version using the following code:
subprocess.call(['C:\\texlive\\2014\\bin\\win32\\pdflatex.exe', 'C:\\Users\\KEY0000G\\Documents\\TeXfiles\\TEST.tex'])
to generate the pdf file, the problem is it creates the pdf file in the default directory. I have tried passing the output path and file name as a second command line argument but PdfLatex ignores it. I tried placing -o in front of the output file path and also -output-directory but it makes no difference, pdf file the .log file and .aux file show up in the default directory. To display the pdf file I am using :
subprocess.call(['C:\\Program Files\\Tracker Software\\PDF Viewer\\PDFXCview.exe', 'C:\\Users\\KEY0000G\\Documents\\Python Scripts\\Vectrix\\TEST.pdf']), which is the default directory. I have searched the internet, that's where -o and -output-file came from).

User avatar
Johannes_B
Site Moderator
Posts: 3584
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Fri May 29, 2015 11:38 pm

pdflatex -output-directory C:/Users/KEY0000G/Documents/TeXfiles TEST.tex
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

SiemensGeek
Posts: 5
Joined: Fri May 29, 2015 11:06 pm

Postby SiemensGeek » Sat May 30, 2015 3:16 am

Close enough! The command that finally worked is:

subprocess.call(['C:\\texlive\\2014\\bin\\win32\\pdflatex.exe', '-output-directory', 'C:/Users/KEY0000G/Documents/TeXfiles', 'C:\\Users\\KEY0000G\\Documents\\TeXfiles\\TEST.tex'])

Thank you very much.

User avatar
Johannes_B
Site Moderator
Posts: 3584
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sat May 30, 2015 3:16 pm

The important thing to note here is that LaTeX, even on a windows system, uses the forward slash to denote directories. The backslash is the excape character for control sequences.

Btw, forward slashes should work for all other windows things just as well.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.


Return to “Others”

Who is online

Users browsing this forum: No registered users and 1 guest