TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Tool for cleaning LaTeX code

Beamer presentation files are very structures, they have sections, in which you find subsections, which include frames that have titles and then itemizations lists consisting of many items.

It would be nice to have a program that auto-indents the input file based on this structure.

I have output of the following sort in mind:

      \item My first item
      \item My second item
      \item My third and very very long third item which occupies more than 
         my pre-specified line length which is (say) 80 characters. 
      \item My fourth item comprising a description
           \item[First Item]
              Described here.
share|improve this question

marked as duplicate by diabonas, egreg, Thorsten, lockstep, Stefan Kottwitz Apr 9 '12 at 10:54

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Note that this problem is much easier than the problem of general formatting of LaTeX code, since beamer input is so much more structured, and just dealing properly with a handful of commands, should be a great service. – Yossi Gil Apr 24 '12 at 16:45
up vote 2 down vote accepted

You don't need a special program for that. Just use an good editor. Vim, Emacs are able to auto-indent. Others maybe too.

If you have not so well formatted code, you have to reformat the code.

I can only speak for Vim. Here you just have to mark the code you want to reformat and then press


Give it a try.

share|improve this answer
my vim spell checks with z= – Yossi Gil Mar 20 '12 at 15:07
In emacs, you want to run M-x indent-region on the marked area. I think this is usually bound to Esc C-\ . – cm2 Mar 20 '12 at 16:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.