4

I am running Windows 7 and a recent (Dec 2014) distribution of TeX Live and a recent version of TeXmaker.

When invoking arara myFile.tex in the command line it returns "indent SUCCESS" and when opening myFile.tex it is indeed beautified/correctly indented.

However when setting up a macro in TeXmaker (via Users->Commands->User-defined "arara %.tex") TeXmaker returns:

Process started

Process exited normally

However the code is not beautified. Closing and opening the file does not help.

Do you have any ideas on how to make this work?

PS a minimal working example (working from command line - but not via TeXmaker) is:

% arara: indent
% arara: indent: {overwrite: yes}

\documentclass[10pt]{article}
\begin{document}
\begin{enumerate}
        \item a
    \item b
\end{enumerate}
\end{document}

PPS indent.log file output (when invoking via TeXmaker)

Thu Dec 11 15:41:00 2014

latexindent.pl version 2.0R, a script to indent .tex files

latexindent.pl lives here: C:/texlive/2014/bin/win32/

>

Directory for backup files and indent.log: .

file: tikpkzTEST.tex Reading defaultSettings.yaml from C:/texlive/2014/bin/win32/defaultSettings.yaml

Home directory is C:/Users/Björn To specify user settings you would put indentconfig.yaml here: C:/Users/Björn/indentconfig.yaml

Backup procedure: (...various backups...) Overwriting file: tikpkzTEST.tex

Line Count of tikpkzTEST.tex: 10 Line Count of indented tikpkzTEST.tex: 10

Line counts of original file and indented file match

PPPS arara.log file

11 Dec 2014 18:50:09.524 INFO Arara - Welcome to arara!

11 Dec 2014 18:50:09.524 INFO Arara - Processing file 'tikpkzTEST.tex', please wait.

11 Dec 2014 18:50:09.524 INFO DirectiveExtractor - Reading directives from

tikpkzTEST.tex.

11 Dec 2014 18:50:09.524 TRACE DirectiveExtractor - Directive found in line 1 with indent.

11 Dec 2014 18:50:09.524 TRACE DirectiveExtractor - Directive found in line 2 with indent: {overwrite: yes}.

11 Dec 2014 18:50:09.584 INFO DirectiveParser - Parsing directives.

11 Dec 2014 18:50:09.584 INFO TaskDeployer - Deploying tasks into commands.

11 Dec 2014 18:50:09.584 TRACE TaskDeployer - Task 'indent' found in >'C:\texlive\2014\texmf-dist\scripts\arara\rules'.

11 Dec 2014 18:50:09.728 TRACE TaskDeployer - Task 'indent' found in 'C:\texlive\2014\texmf-dist\scripts\arara\rules'.

11 Dec 2014 18:50:09.738 INFO CommandTrigger - Ready to run commands.

11 Dec 2014 18:50:09.738 INFO CommandTrigger - Running 'Indent'.

11 Dec 2014 18:50:09.738 TRACE CommandTrigger - Command: cmd /c latexindent.exe "tikpkzTEST.tex"

11 Dec 2014 18:50:10.048 TRACE CommandTrigger - Output logging:

11 Dec 2014 18:50:10.048 TRACE CommandTrigger - % arara: indent

% arara: indent: {overwrite: yes}

\documentclass[10pt]{article} \begin{document} \begin{enumerate} \item a \item b \item c \end{enumerate} \end{document} 11 Dec 2014 18:50:10.048 INFO CommandTrigger - 'Indent' was successfully executed. 11 Dec 2014 18:50:10.048 INFO CommandTrigger - Running 'Indent'. 11 Dec 2014 18:50:10.048 TRACE CommandTrigger - Command: cmd /c latexindent.exe -w >"tikpkzTEST.tex" 11 Dec 2014 18:50:10.348 TRACE CommandTrigger - Output logging: 11 Dec 2014 18:50:10.348 TRACE CommandTrigger - % arara: indent % arara: indent: {overwrite: yes}

\documentclass[10pt]{article}

\begin{document}

\begin{enumerate}

\item a

\item b

\item c

\end{enumerate}

\end{document}

11 Dec 2014 18:50:10.348 INFO CommandTrigger - 'Indent' was successfully executed.

11 Dec 2014 18:50:10.348 INFO CommandTrigger - All commands were successfully executed.

11 Dec 2014 18:50:10.348 INFO Arara - Done.

  • I'm not sure what you want with arara but you can indent your code using the TeXmaker menu, or not? – Sigur Dec 11 '14 at 13:46
  • 1
    @Sigur indent is a nice tool for automatic code indentation (latexindent from cmhughes). I do not think that TeXmaker is able to do such work. – LaRiFaRi Dec 11 '14 at 13:49
  • 1
    does the editor lock the file for writing? that is while the file is in texmaker can you edit it with anything (eg notepad) if it is locked then the perl script won't be able to edit it. – David Carlisle Dec 11 '14 at 14:06
  • 1
    There will be indent.log file in that directory. What does that say? – user11232 Dec 11 '14 at 14:29
  • 1
    @cmhughes So Finally this workaround worked for me. copy entire YAML folder with Tiny.pm from C:\Strawberry\perl\site\lib to C:\texlive\2014\tlpkg\tlperl\lib and any missing File:HomeDir modules from strawberry perl lib (similar version of perl in TeXLive ) to tlperl lib folder then latexindent.exe should fine. BTW IMO Bjorn Error of not updating the .tex file after latexindent in usercommand may be an issue pertaining to TeXmaker editor not arara or latexindent. Bjorn may be you post this issue tracker – texenthusiast Dec 13 '14 at 15:44
2

@texenthusiast has found a workaround for the problem:

In TeXmaker File menu press Reload Document from file to see updated the current file with indented contents.

So basicly you can set up arara/the command-line-version of latexindent to indent the code via TeXmaker:

(*) (Users->Commands->User-defined "arara %.tex" or "texmaker.exe" -w %.tex) or alternatively via (Options->quickbuild->...)

A minor inconvenience remains however: You will have to invoke latex-indent via ALT+SHIFT+F1 (as set up in (*)) and then you will additionaly have to choose "reload document" from the file menu. This should be good enough for most users.

  • Nice answer, glad you were able to work through it. If you're on Windows, you might also like TeXnicCenter or NotePad++ which reload the file automatically and ask for a simple confirmation from the user :) – cmhughes Dec 15 '14 at 17:15

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.