I am trying to figure out a way to cleanly separate the TEX files from all of the intermediate and output files. Various approaches I've tried, including the one described by ‘Bundle’ TeX output in a directory don't seem to work. I'm using TexMaker + MikTex (portable). Ideally, I would like my file/directory structure to look something like this:

  • texproject
    • texfiles
      • 1.tex
      • 2.tex
    • intfiles
      • 1.out
      • 1.log
      • 1.aux
      • 2.out
      • 2.log
      • 2.aux
    • pdffiles
      • 1.pdf
      • 2.pdf

Instead, what I have, is the jumbled-up mess where all of these files live in the same directory. I've tried setting the ouput-directory, for example, on pdflatex but this doesn't work. The pdf file still gets created in the same place but now it doesn't show up in the previewer. This should be pretty easy to solve but I've so far been unsuccessful. How can I set up my environment to use the above structure when compiling?

Update: I believe I have narrowed this down to something specific to TexMaker. If the desired aux and out directories are passed via the command line to pdflatex, everything builds as it should. Yet, I get numerous message boxes popping up saying that files can't be found and the PDF doesn't display in the internal viewer. I can't see any obvious options within TexMaker to change to address this. So, has anyone been able to make the scenario I'm describing work with TexMaker?

  • 2
    Have you tried -aux_directory=../intfiles and -output-directory=../pdffiles? That should work with MikTeX. Commented Nov 16, 2011 at 16:41
  • @PeterGrill Well, it partially works; I've tried passing these parameters to PDFLATEX but there are still things that seem to be looking in the current directory for the output and intermediate files. Although build succeeds, numerous "can't find file" message boxes pop up and the internal pdf viewer can't seem to find the file
    – 3Sphere
    Commented Nov 16, 2011 at 17:36
  • Wondering if that has anything to do with .aux files from previous runs? I will try to test this later today when I am on my PC that has MikTeX. Commented Nov 16, 2011 at 17:48
  • @PeterGrill No, even when all aux files everywhere are cleared out it has this problem. Something (TexMaker?) is trying to write to a log file and can't find the file and the internal PDF viewer can't find the PDF; I'm thinking this is something TexMaker-specific because MikTex seems to build the files properly.
    – 3Sphere
    Commented Nov 16, 2011 at 17:58
  • Just tried that as well (using Win7+MikTex+Texmaker). Texmaker invokes pdflatex, which writes all files to the folders specified. Writing works and all files are created as they should. But then Texmaker tries to read and display the log in the integrated Messages/Log viewer and the pdf in the integrated pdf viewer and does not find the files.
    – matth
    Commented Nov 16, 2011 at 18:27

7 Answers 7


As suggested by lockstep, I write a short answer: AFAIK, this is currently not possible, because the path cannot be changed for the messages / log viewer and for the pdf viewer from within the Texmaker GUI. There is a feature request on the Texmaker issue list to make the path configurable: http://code.google.com/p/texmaker/issues/detail?id=97 Maybe you are lucky and in a later release this will be available. I personally would also use this new feature (and only backup the input folder, not the output folder).

  • Shared code.google link is dead
    – alper
    Commented Jan 12, 2023 at 14:08
  • 1
    Yes, Google code closed down years ago. It seems the developer of Texmaker prefers to work alone, there is no public git repository or issue tracker to my knowledge, at least not linked from the homepage: xm1math.net/texmaker/index.html But there is a contact form, so you can send a request to the developer.
    – matth
    Commented Jan 13, 2023 at 11:55

Since Texmaker 3.4, you can specify the option "Use a build directory for output", which creates a "build" folder in your project folder, and saves everything but the .tex file there. See the manual Now you can also specify the output directory as an option to pdflatex as e.g. -output-directory pdf. But you will also have a copy of the pdf in the build folder no matter what. And I haven't found a straight-forward way to have the output file in the root folder, either.

(And I also have a .gz file in the folders, but that might be an option you can turn off.)

  • 3
    note that you then need to update your biber / bibtex command as biber build/% (respectively bibtex build/%.aux). Regarding the pdf as output in the root folder, I am using a symbolic link (ln -s build/pdfName.pdf pdfName.pdf).
    – ebosi
    Commented Oct 22, 2015 at 9:50

For TeXstudio (since a fork from texmaker, it might be similar there):

  1. Add the options -aux_directory and -output-directory to the latex pdflatex and other commands, if needed.
  2. Change the appropriate lines (160 and 161 in my case) in the texstudio.ini file, in W7 usually located under


Modify the path for the two varables accordingly.



(double-backslashes by intention)


  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. A suggestion: Do us a favour and change your username to something more telling than "user1234". Commented Jan 22, 2014 at 9:40
  • @MartinSchröder I think your "add markup" change changed the meaning...? The answerer said "double backslash" not "triple" (although I don't use TeXStudio) and the original answer displays like that.
    – user202729
    Commented Nov 2, 2021 at 2:00

In Texstudio, if you want to save outputs of latex in a directory (and thereby have the directory that contains your source files uncluttered, set the -output-directory option of pdflatex command in Tools → Configure TextStudio → Commands Change the value of PdfLatex the -output-directory option and output is the directory you need the output files to be stored. It can be any name and in any location, but make sure you give is the full path (or relative path).

pdflatex -synctex=1 -interaction=nonstopmode -output-directory=output %.tex

enter image description here

The Linux version of Texstudio (that I am using) does not support -aux-directory option.

After doing that, if the pdf preview does not work, refer to this solution.

  • 1
    After doing this, I get an error when building the bibliography: "Process started: bibtex "filename.aux". I couldn't open file name `filename.aux'. Process exited with error(s)." And the bibliography is not created. Commented Dec 2, 2016 at 13:06

In TeXstudio (2.10.8) we can set a subdirectory, in this example named "output", as follows:

Menu > Options > Configure TeXstudio ...

  • Commands [Tab] > PdfLaTeX. Add key/value switch -output-directory=output.

    So my command changed from

    pdflatex.exe -synctex=1 -interaction=nonstopmode %.tex

    ... to ...

    pdflatex.exe -synctex=1 -interaction=nonstopmode -output-directory=output %.tex

    If you are using other build commands aside from "PdfLaTeX" then make analogous changes there. I'm only building against PdfLaTex so that's all I had to change.

  • Commands [Tab] > External PDF Viewer. I'm using Foxit Reader, so in my case I changed from ...


    ... to ...

     "C:\PROGRAM FILES (X86)\FOXIT SOFTWARE\FOXIT READER\FOXITREADER.EXE"  C:\Users\John\Documents\Sda\Code\Markup\Latex\Examples\output\?rm.pdf"

    It would be desirable to only need a relative path, something like \output\?rm.pdf, but so far I've only been able to get it working with the hardcoded absolute path.

  • Commands [Tab] > Biber (this is used for bibliographies with the biblatex package).


     biber.exe %

    ... to ...

     biber.exe -output-directory=output -input-directory=output %
  • Commands [Tab] > BibTeX (this is used for bibliographies with the bibtex package).


     bibtex.exe %.aux

    ... to ...

     bibtex.exe  output/%.aux
  • Build [Tab] > Additional Search Paths. Add \output (with the backslash) to "Log File" and "PDF File" fields.

With your source MyExample.tex file loaded in the current window press F5 (TeXstudio Menu > Tools > Build & View). After the build completes the PDF viewer should correctly pickup and display \output\MyExample.pdf.

This combines and updates @SisayChala's and @user44553's answers.

  • 1
    In my TeXstudio 2.12.10 installation, the above works, and relative paths are also accepted everywhere. Commented Aug 16, 2018 at 7:19
  • 1
    Unless you check 'Show Advanced Options' on the bottom-left, otherwise you can't find the 'Additional Search Paths' setting.
    – Yan An
    Commented Feb 17, 2022 at 18:11

I am not an expert in any of these but this is a solution that works for me (I am using texmaker under Linux but I am sure there are similar commands for Windows):

  1. Options>Configure Texmaker>Commands mark 'Use a "build" subdirectory for output files'
  2. Options>Configure Texmaker>Quick Build mark 'User' and type in the commands that you need for compliling the way you want. (You can use the 'wizard' if you need help.)
  3. add:

    |mkdir pdf|cp build/%.pdf pdf 

(Copying instead of moving provides the pdf-viewer from not finding the .pdf)

  • Welcome to TeX.Stackexchange! A similar approach is also used by ltx2any. Using this tool would have the advantage that it also adjusts the paths in synctex files etc. Commented Aug 30, 2018 at 13:13

If you are working on Linux, you might use symbolic links as a workaround, e.g. create the directories ../texfiles and ../pdffiles, then run the following script:

#! /bin/bash

for i in *.tex
  ln -s $(pwd)/$i ../texfiles

for i in *.pdf
  ln -s $(pwd)/$i ../pdffiles

The script can be expanded to update the directories dynamically (needs to be called via write18 or maybe a hook in TexMaker?).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .