I've been trying to install arara and latexindent to get automatic indentation in TeXstudio. I've managed to install arara, and latexindent seems to be working fine. But I can't figure out how to run latexindent through arara. I've tried putting the files in arara/rules. But running arara file.tex in the command line shows: Running Indent... FAILURE. But it works if the latexindentfiles are in the same folder as the tex file.

How am I supposed to do it?

OS: Windows 10

Fri Jan  8 13:38:41 2016
latexindent.exe version 2.1R, a script to indent .tex files
latexindent.exe lives here: C:/Users/Username/Documents/!LaTeX Documents/test/

latexindent.exe is a standalone script and caches the required perl modules
onto your system. If you'd like to see their location in your log file, indent.log, 
call the script with the tracing option, e.g latexindent.exe -t myfile.tex

Directory for backup files and indent.log:  
ERROR  There seems to be a yaml formatting error in defaultSettings.yaml
       Please check it for mistakes- you can find a working version at https://github.com/cmhughes/latexindent.pl
       if you would like to overwrite your current version

       Exiting, no indendation done.
  • 2
    It sounds like arara is picking up the latexindent rule, as it says Running Indent... It sounds like it is latexindent itself that is failing. If you run arara in verbose mode, and make sure to allow it to write a log file, it should tell you more. For example, arara --verbose --log myfile.tex. Are you sure that latexindent runs correctly without arara? – cmhughes Jan 8 '16 at 12:33
  • We would need more info, I am afraid. :) Which OS are you running? Can you run latexindent without any errors? – Paulo Cereda Jan 8 '16 at 12:36
  • @cmhughes Added the error log. latexindent works normally. And so does arara if all the latexindent files are in the same folder as the .tex – Kitegi Jan 8 '16 at 12:43
  • 2
    I see that you're on Windows; are you using latexindent as part of a TeX distribution, or did you install it yourself? Do you have defaultSettings.yaml in the same directory as latexindent.exe? Can you post all of indent.log? – cmhughes Jan 8 '16 at 12:59
  • 1
    It looks like the latexindent.exe is being called correctly from arara, so that's good news :) The main thing to check is that you have a copy of defaultSettings.yaml in C:/Users/Username/Documents/!LaTeX Documents/test/. It might be worth grabbing a fresh copy from ctan or else from raw.githubusercontent.com/cmhughes/latexindent.pl/master/… – cmhughes Jan 8 '16 at 14:10

Managed to solve it. It seems that the latexindent that I downloaded was conflicting with the one already installed by MikTeX.

So I unistalled latexindent from MikTeX by going to Start -> MikTeX 2.9 -> Maintenance (Admin) -> Package Manager (Admin) and uninstalling latexindent.
I then went to Program Files\MiKTeX 2.9\miktex\bin\x64 and deleted latexindent.exe
And finally, I added my own latexindent directory to PATH in System -> Environment Variables -> PATH by adding C:\Users\Username\latexindent, where I put all the latexindent files.

| improve this answer | |
  • 3
    Good work! On Windows you don't need latexindent.pl :) just curious, how come you don't let Miktex manage the files? – cmhughes Jan 8 '16 at 18:18
  • 2
    Cool! I was about to create a Windows virtual install in order to track the error down. :) – Paulo Cereda Jan 8 '16 at 18:20
  • @cmhughes I'm not sure how to do that. The latexindent folder in MikTeX didn't have the .exe file in it. And I don't know how to make it look for the exe file instead of the .pl. – Kitegi Jan 8 '16 at 18:23

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.