I'm using the LaTeX Workshop extension in Visual Studio Code and am encountering issues when trying to integrate latexindent to beautify my LaTeX documents. Despite following the usual setup steps, latexindent doesn't seem to respond when I save my LaTeX files. Here are the details:

  • Error Message: Initially, I received the error "Can not find latexindent in PATH."
  • Current Setup: I've added the path to latexindent in my .vscode/settings.json file like this:
"latex-workshop.latexindent.path": "C:\\Program Files\\MiKTeX\\miktex\\bin\\x64\\latexindent.exe",

After this, the error message stopped, but latexindent still doesn't seem to work.

  • Latexindent Paths:

    • CMD: where latexindent shows it's located at C:\Program Files\MiKTeX\miktex\bin\x64\latexindent.exe.
    • I also found latexindent.bat scripts in the following directories:
      • C:\Users\FooBar\.vscode\extensions\.d6384404-cc70-4dc8-b829-16736260131e\scripts\
      • C:\Users\FooBar\.vscode\extensions\james-yu.latex-workshop-9.18.0\scripts\
    • There is a Perl script in C:\Users\FooBar\AppData\Roaming\MiKTeX\scripts\latexindent\latexindent.pl.
  • Logs: I don't see any errors in C:\Users\FooBar\AppData\Local\MiKTeX\miktex\log\latexindent.log.

  • Settings: I haven't set anything for "latex-workshop.latexindent.args".

Nothing happens when I save a LaTeX file - no beautification or formatting. I'm not sure what I'm missing or doing wrong. Could anyone help me troubleshoot this issue?

Additional Info: I'm using MiKTeX on Windows 10

  • does latexindent work when you call it directly via the terminal? And do you have Perl installed (the usual problem is that it needs Perl)?
    – Cube707
    Jan 25 at 13:11
  • Windows users shouldn't need perl, there's a stand alone executable, latexindent.exe
    – cmhughes
    Jan 25 at 20:45
  • I've tried repeatedly to influence change with Miktex, and have never succeeded... All ideas welcome
    – cmhughes
    Jan 26 at 9:28
  • Folks, thanks for your kind support. Being frustrated with this issue |I uninstalled and reinstalled MiKTex with Chocolatey, and the problem is somehow fixed!
    – Foad
    Jan 26 at 11:20
  • 2
    I’m voting to close this question because resolved in comments
    – cmhughes
    Feb 15 at 19:31