[Tex/LaTex] Pretty printing LaTeX source


I am looking for a tool that reformats my LaTeX source code so that it becomes nice and readable. For programming languages like C, C++, etc. such pretty printers exist.

Are there any pretty printers for LaTeX source?

Best Answer

Although it has ben mentioned in some other posts, latexindent was missing here.

latexindent is a

PERL script to indent code within environments, and align delimited environments in .tex files.

It can be used from command line or through arara

A before-and-after example stolen from its documentation:

enter image description here

Related Question