2

Even after sudo apt-get install texlive-full on Linux I'm apparently missing latexindent. I can't configure any command with this application within TeXstudio because I get the following, as an example:

Error: Could not start the command: latexindent.pl -w "main".tex

Same error within the terminal calling from the same directory where I downloaded latexindent from its GitHub repository.

I checked for Perl in my system via info perl; it's installed.

How is this fixed?

  • Take a look at tex.stackexchange.com/questions/1092/… – cmhughes May 12 '18 at 18:17
  • @cmhughes I am not going through that. I edited my question too. – useranonis May 12 '18 at 18:21
  • 2
    Try removing the .pl extension so it's called as just latexindent not latexindent.pl. – Nicola Talbot May 12 '18 at 19:02
  • 2
    @useranonis the error message you presented "tlmgr: Remote repository is newer than local (2017 < 2018) " begs to differ and that TeXLive2018 is not installed, but 2017. You can check tlmgr --version to make sure. – Andreas Storvik Strauman May 12 '18 at 19:12
  • 2
    Please see the first two paragraphs of Section 3 of the manual, in particular In what follows, we will always refer to latexindent.pl, but depending on your operating system and preference, you might substitute latexindent.exe or simply latexindent. – cmhughes May 13 '18 at 8:31
6

TeX Live on Unix-like systems creates symbolic links from the bin/architecture directory to the relevant script, but the symbolic file links always omit the file extensions. For example, bin/x86_64-linux/latexindent links to ../../texmf-dist/scripts/latexindent/latexindent.pl

This is more consistent with Unix file naming schemes, but the scripts are often distributed with an extension for the benefit of non-Unix-like systems, such as Windows. Since the script is distributed and is on CTAN with the extension, the manual often references the script name with the extension. (If the package/script author isn't aware of this behaviour then they won't think to mention it in the manual.)

Conversely, TeX distributions on Windows may convert the script into an executable, in which case the extension becomes .exe (such as latexindent.exe).

As @cmhughes commented below section 3 of the latexindent manual states:

In what follows, we will always refer to latexindent.pl, but depending on your operating system and preference, you might substitute latexindent.exe or simply latexindent.

  • 1
    +1 many thanks for this :) You might reference the first few paragraphs of Section 3 of the manual available via texdoc latexindent as a PDF and online at latexindentpl.readthedocs.io/en/latest/sec-how-to-use.html – cmhughes May 13 '18 at 6:42
  • In what follows, we will always refer to latexindent.pl, but depending on your operating system and preference, you might substitute latexindent.exe or simply latexindent. – cmhughes May 13 '18 at 8:32
  • @cmhughes Thank you for the reference. (I thought it might help to have a more general answer, with latexindent as an example.) It's caught me out with makeglossaries-lite.lua. – Nicola Talbot May 13 '18 at 11:46
  • very nice :) I think your answer is great, and very helpful. I'm just going to note here that unix/linux terminals have an autocomplete feature when pressing the TAB button. For example, when I type latex at the terminal and then press TAB I receive a list of all of the different executables available to me that begin with latex. In this case, it includes latexindent. – cmhughes May 14 '18 at 14:49

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.