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.

  • 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/… – Herr K. Nov 6 '13 at 20:03
  • 1
    (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? – Herr K. Nov 6 '13 at 22:01
  • 1
    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 :) – Herr K. Nov 7 '13 at 0:32

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).

| improve this answer | |
  • 2
    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
  • @jfbu thanks for the follow-up :) It was clear that my 'answer' needed a lot of work, so I thought it was just easier simply to delete it. Feel free to post your own answer, I'm sure it'd receive some votes – cmhughes Mar 23 '15 at 18:44

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.