GeneralLaTeX formatter like HTML Tidy?

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Myaban
Posts: 1
Joined: Fri May 23, 2008 1:21 pm

LaTeX formatter like HTML Tidy?

Post by Myaban »

Is there a program that can bring messy (but correct) LaTeX code in a more readable form? I have some huge formulas that could use a standartized spacing, extra spaces before and after braces etc.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

markpace
Posts: 1
Joined: Mon Mar 28, 2011 2:59 pm

Re: LaTeX formatter like HTML Tidy?

Post by markpace »

I would also be interested in such a tool...

Any help?
hrothberht
Posts: 1
Joined: Tue Aug 30, 2011 11:02 am

LaTeX formatter like HTML Tidy?

Post by hrothberht »

I did some googling and there seem to be two options to pretty print/tidy/beautify LaTeX code:
  • TextMate seems to have this functionality, but TextMate is only for Mac OS X
  • There is a Perl script made by Eric Hsu here, though as he himself says: it's simple and naive.

    Running the Perl script requires an installation of Perl (obviously) and can be run in Windows via console by typing

    Code: Select all

    type inputfile.tex|perl LaTeXTidy-0.31.pl>outputfile.tex
Apart from these two, I haven't been able to find anything. I was a bit surprised to find such meagre results.
mikesol
Posts: 8
Joined: Sun Mar 22, 2009 8:42 am

Re: LaTeX formatter like HTML Tidy?

Post by mikesol »

I'm also interested in something like this, especially if it's Linux compatible.
leetcat
Posts: 1
Joined: Tue Oct 06, 2015 8:30 pm

Re: LaTeX formatter like HTML Tidy?

Post by leetcat »

Excuse the resurrection of an old thread. But I just created an online tool to format LaTeX code like HTML Tidy. I have not yet implemented personal preference of tab vs space. But It does most basic formatting.

http://c.albert-thompson.com/latex-pretty/
Post Reply