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?
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
A before-and-after example stolen from its documentation:
There is Nelson Beebe's tex-pretty: http://www.math.utah.edu/~beebe/software/tex-tools.html
I created a website that reformats the latex code to make indents correct.
It is a simple site that you put in your latex code and will do pretty print similar to Visual Studio. The nice thing about the site is that it also includes a copy button so you don't have to select all text when you get formatted code.
First of all, there is a LaTeX package to prettyprint LaTeX sources. You don't need to download it, it is in the base distribution, namely ltxdoc – Class for documented LaTeX macro files:
There is an emacs mode supporting ltxdoc markup of a file that may help you, it is called swiftex:
Also the AUC-TeX mode from emacs is a big help in keeping your LaTeX source code tidy (but is does not document the code itself).