Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TeX/LaTeX code beautifier

1,134 views
Skip to first unread message

ila...@violet.berkeley.edu

unread,
Jul 30, 1990, 7:55:48 PM7/30/90
to
Is there a tool to assist in coding TeX and LaTeX documents and
macros? I have in mind something like "indent" for C. Among other
things, it indents program blocks, breaks lines and checks some of the
syntax.

Geraldo Veiga

casey.th...@gmail.com

unread,
Oct 20, 2015, 5:28:37 PM10/20/15
to
Excuse the bump but this post is high so it seems that people actually visit this often.
I have created one https://c.albert-thompson.com/latex-pretty/ It focuses on indenting blocks. It does not check syntax though.

Peter Flynn

unread,
Oct 20, 2015, 6:41:28 PM10/20/15
to
The answer is much the same as it was in 1990: most [La]TeX-sensitive
editors do something like this already. Emacs is possibly the locus
classicus.

In any case, indentation routines should use a small default indent (2
spaces, maybe 3) because many people write complex code which means many
indent levels. Having the default indent set to 7 or 8 is way too much.
The amount should of course be configurable anyway. Using TAB characters
to indent is strictly a no-no.

///Peter

Anonymous

unread,
Oct 25, 2015, 12:49:40 PM10/25/15
to
> > I have created one https://c.albert-thompson.com/latex-pretty/ It
> > focuses on indenting blocks. It does not check syntax though.
>
> The answer is much the same as it was in 1990: most
> [La]TeX-sensitive editors do something like this already. Emacs is
> possibly the locus classicus.

Actually a pretty-printer would be quite useful for formatting
machine-generated LaTeX code. When a script auto-generates LaTeX
code, it's cumbersome to do good indenting, and well-formatted LaTeX
within the script often uglifies the shell code that produces it.

So a pretty-printer is a good idea. But bizarre that it's a web tool.
This means using it for machine-produced code entails web-scraping.
It also means the content is shared with the webmaster. Ideally
someone would expand on an existing pretty-printer tool like /tidy/
(an HTML pretty-printer).

christopher.m...@gmail.com

unread,
May 26, 2017, 3:58:19 PM5/26/17
to
Perhaps latexindent.pl would be useful:

https://github.com/cmhughes/latexindent.pl

As a disclaimer, I'm the author.
Chris

S Gilles

unread,
May 27, 2017, 5:00:17 AM5/27/17
to
Perhaps LLF might be another option:

http://repo.or.cz/llf.git

Disclaimer: I'm the author of this one, because I wanted to be able
to fully reflow/beautify my LaTeX to 72 columns where possible (like
AUCTeX) but was in the process of abandoning Emacs.
0 new messages