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 just started using Notepad++ and SumatraPDF for my LaTeX stuff.

When compiling a .tex file using pdflatex, one can specify an option -output-directory=<folder> to save all the auxiliary files in <folder>. Is there a way to make latexindent do something similar? That is, when I run latexindent.pl -w foo.tex, I want it save the backup and log files in a folder that I specify.

share|improve this question
BTW, here's a nice guide in setting up Notepad++ to run pdflatex: LaTeX Editing Using Notepad++, besides of course this one on TeX.SX: tex.stackexchange.com/questions/43984/… –  Kevin C Nov 6 '13 at 20:03
(As the author) Thanks for trying latexindent! That's a great idea; it's not currently possible, but I'll add it to the to-do list. Presumably you would want to specify the settings in a yaml file with switches (something like): backupDirectory: /my/output/directory and logfileDirectory: /some/other/directory? –  cmhughes Nov 6 '13 at 20:20
@cmhughes: Thank you for writing such a nice script! Ideally I'd like to have a switch that does exactly what -output-directory=<folder> does in pdflatex; for example, as in latexindent.pl -w -output-directory=<path to folder> foo.tex. I suppose this will imply a change in the .pl file (but I'm not sure). Settings in a yaml file would imply that all backup and log files will be saved in those same folder(s) regardless of where foo.tex was initially saved, right? –  Kevin C Nov 6 '13 at 22:01
There are a few different yaml files- you have defaultSettings.yaml, and then your own files which can reside anywhere; in particular, you can have localSettings.yaml which overrides anything else. Most of the script's behaviour is controlled from yaml, so my first instinct is to put it in there. I hope to get to the to-do list at some point soon.... –  cmhughes Nov 7 '13 at 0:04
@cmhughes: Thanks! I'm looking forward to the next update in latexindent :) –  Kevin C Nov 7 '13 at 0:32

1 Answer 1

up vote 2 down vote accepted

The latest version (available on github) contains a switch, -c=/path/to/cruft/directory that performs in the way you described. You can use it as follows, for example

latexindent.pl -w -c=/home/cmhughes/Desktop myfile.tex

which will output all of the 'cruft' (indent.log, myfile.bak*) to /home/cmhughes/Desktop. It performs a check to make sure that the directory exists- if it doesn't, then the script will exit.

I did think about implementing this in the yaml files, but since indent.log writes information about the contents of these files, I found myself going round in circles. As such, the suggestion to use a command line switch makes the most sense.

I have also updated the arara rule which can be used as, for example,

% arara: indent: { cruft: /home/cmhughes/Desktop }

I have found the arara rule does not like it when the directories contain spaces (but the command line version doesn't mind).

share|improve this answer
I'm making a few more changes today and tomorrow, and then I'll get the new version uploaded to ctan, which will hopefully get included into texlive –  cmhughes Nov 10 '13 at 17:43
Excellent! Thank you! –  Kevin C Nov 10 '13 at 19:43

Your Answer


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.