I use to put all files that are generated by compiler in a folder called build with the instruction

pdflatex -output-directory=build myfile.tex

How do I set this folder as default so I wouldn't need to write it every time I compile?

I tried to edit the pdfconfig file following the documentation reference of MikTeX .ini.

    ;; Create the output directory if '--output-directory=DIR'
    ;; refers to a non-existing directory.
    CreateOutputDirectory = build

However it only states the directory to be created when the directory input of the option --output-directory does not exist.

I didn't find any way of setting a default value for --output-directory option, so I would thank any orientation with this.

  • @Marijn Second answer (write wrapper) works (of course it does.), first answer (set texmf.cnf) doesn't. – so they're not exact duplicate (if "in theory" there's some specific way to override output-directory apart from this method, it would not be applicable to the other question which specifically asks for file-line-error)
    – user202729
    Dec 27, 2021 at 11:08
  • 1
    It seems there's no such config item or environment variable. (TEXMFOUTPUT is only used when the default or specified output directory is not writable.) How about defining a command alias? Dec 27, 2021 at 11:09
  • @Marjin In general the answer is there, but I was looking for an specific answer. Is there any command to setup that property directly?
    – SDEscobedo
    Dec 27, 2021 at 11:14
  • @user202729 I assumed all command line flags could be set through texmf.cnf (therefore I suggested the duplicate) but apparently this is not the case.
    – Marijn
    Dec 27, 2021 at 11:15
  • 1
    @SDEscobedo MikTeX is a distribution, not a particular program. // If you mean you can't modify the pdflatex executable to do what you want by default, it kind of make sense because otherwise it will break other scripts/programs that depends on pdflatex. // Compare, you can't set echo to add -n by default, or ls to add --color=auto by default either without defining an alias (... if you use some bash)
    – user202729
    Dec 27, 2021 at 11:45


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.