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?
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 arara
A before-and-after example stolen from its documentation:
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:
http://www.ctan.org/pkg/ltxdoc
There is an emacs mode supporting ltxdoc markup of a file that may help you, it is called swiftex:
http://www.ctan.org/pkg/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).
There is Nelson Beebe's tex-pretty: http://www.math.utah.edu/~beebe/software/tex-tools.html
How about a2ps
?
Assuming your LaTeX input file contains Latin1 characters only, you can do
a2ps -q -Eplain -R --encoding=latin1 --columns=1 -l 85 -o out.pdf in.tex
or something similar.