2

I've been typsetting this last weeks and my code looked like something garbage. I wouldn't want to manually format this as it is tedious, and I wondered if there is such command to format latex source code automatically?

Sure I can format C language with indent or clang-format but how about tex files?

Googling end me up empty handed.

  • Does https://tex.stackexchange.com/q/100/86 look helpful? – Andrew Stacey Oct 03 '21 at 07:22
  • That seemed to work. I believe it's better to automate this with a makefile. Though I'm still open if there's an easier method without requiring to run latex->dvips->fmtlatex->latex->dvips. – harieamjari Oct 03 '21 at 07:56
  • 1
    see latexindent (which you could call from a makefile of course) (do you have a special reason to use latex/dvipsps2pdf ? most people use pdflatex ) – David Carlisle Oct 03 '21 at 09:55
  • I meant, "That seemed to work. I believe it's better to automate this long procedure of running 5 commands in a Makefile.". It was mentioned to create dvi from tex, not to compile it into pdf. I do use pdflatex. About latexindent, I see that's a possible solution, but due to my unmaintained unix OS and packages, running the perl script has provided me cryptic messages which then requires downloading extra packages in my unmaintained system. I hoped something like a command written in a compiled language (like standard C) with no required extra dependencies as I'm tight on space. But thank you. – harieamjari Oct 04 '21 at 11:11
  • Latexindent can be called from Conda or docker – cmhughes Jul 07 '22 at 12:30

0 Answers0