6

Is there any indentation tool for (la)tex?

I currently use TexShop under Mac OSX, so I can either use a TexShop plugin or a command line tool.

  • I just select the text I want indented and use command ] to indent, and command [ to unindent. Not very automated, but does work, and that way I have control of what it looks like. – Peter Grill Feb 23 '13 at 17:13
  • It shifts the entire block of text. I'm looking for a utility that can indent inner parts (e.g. subsections) more than their parents (e.g. sections). – Adam Matan Feb 23 '13 at 18:12
  • 1
    What about Emacs? ;) – mbork Feb 23 '13 at 18:20
  • As you are typing after a section, just use command ] on the first line, then all lines following will retain that indent (at least in TeXShop). Similarly if you are coming out of an indented block, use command [. For text that already exist select the block you want to indent and apply command ]. Any automated tool won't easily be able to work with custom environments or macros without some configuration set up. – Peter Grill Feb 23 '13 at 18:25
7

Just have a look to latexindent.pl. In my opinion an interesting tool. Have a look at LaTeX code sniffer and/or beautifier? for details.

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