GeneralChange pdf location

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
haaj86
Posts: 21
Joined: Mon Apr 06, 2009 11:18 pm

Change pdf location

Post by haaj86 »

Hi, what command line can I use to change the location of the pdf, I do not want it to be in the same folder as the tex file. Also, I am not looking to change the editor's settings, because I am working on three different reports and I just need one of them to produce the pdf in another directory.

Thanks.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: Change pdf location

Post by frabjous »

The texlive version has an -output-directory command line option, e.g.:

pdflatex -output-directory=DIR myfile.tex

Not sure about other distributions.

I don't know of a command to put in the .tex file to do it.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Change pdf location

Post by localghost »

As frabjous already mentioned, there is the possibility to redirect the output as described. It works for TeX Live but I'm not sure if it does for MiKTeX by default. Moreover it is possible to make the compiler parsing the first line of a source file so that the line below is interpreted as if given on the command line.

Code: Select all

%& -output-directory=<path of the output file>
As far as I know this line parsing is disabled in TeX Live but enabled in MiKTeX by default. But in TeX Live it can be enabled by a command line option.

Code: Select all

pdflatex -parse-first-line
You can add this line in the according settings of your editor if necessary.


Thorsten
haaj86
Posts: 21
Joined: Mon Apr 06, 2009 11:18 pm

Re: Change pdf location

Post by haaj86 »

Thanks frabjous and localghost for the suggestions, I will try it. Cheers
Post Reply