10

Alternating work on a laptop, netbook and tablet the word wrap of a document is sometimes too long (for small screens) and too short (for large screens). This also got me thinking.

Is there a tool like HTMLTidy for LaTeX that can properly reformat/beautify a document?

Ideally it should include

  • Fixing of indentation and tag alignment (some editors do little to aid here)
  • Word wrapping (hard and soft) - but definitely context aware
  • Configuration options like for tabs vs spaces, wrapping width, tag alignment

cli tools like fold are not context aware enough (it would mangle commented sections and just focus on the wrapping aspect) and makes compilation fail at time.

This link mentions texpretty and this discussion mentions a LaTeX tidy perl script by Eric Hsu.

What experiences have you had, or what tools can be suggested (preferably cli and platform independent)?

8
  • 4
    Have a look at latexindent. Probably you might find it useful. In the official site you will find more info. Jul 15, 2013 at 7:49
  • @karlkoeller thanks for linking to it :) It's also on ctan This question looks quite similar to LaTeX code sniffer and/or beautifier?
    – cmhughes
    Jul 15, 2013 at 8:55
  • 2
    @cmhughes Not at all. I've provided the CTAN link in my comment... BTW: still waiting for an installable package to integrate it in WinEdt. Jul 15, 2013 at 8:58
  • Thanks. @cmhughes - this tool seems almost perfect for what I had in mind :). How do you handle wrapping or linewrap parameters? Jul 15, 2013 at 9:14
  • 1
    @cmhughes, latexindent nicely addresses the beautification issue, as a great tool, thanks. If we could leave this open (for a while) to see if someone has a workflow I can learn from for the multi-device, line-wrapping POV, that would be great. Jul 18, 2013 at 14:44

0

Browse other questions tagged or ask your own question.