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)?

  • 4
    Have a look at latexindent. Probably you might find it useful. In the official site you will find more info. – karlkoeller Jul 15 '13 at 07: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 '13 at 08: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. – karlkoeller Jul 15 '13 at 08:58
  • Thanks. @cmhughes - this tool seems almost perfect for what I had in mind :). How do you handle wrapping or linewrap parameters? – Forkrul Assail Jul 15 '13 at 09:14
  • The script doesn't (or at least it shouldn't) do anything with line breaks- it only does indentation :).... @karlkoeller sorry I missed your ctan link. I made an arara rule for the script- I was hoping that would help users of all editors :) – cmhughes Jul 15 '13 at 09:32
  • @cmhughes I would like to integrate it independently of arara. I'll ask Harish for a contact of yours, if you don't mind, so we can talk about it privately. – karlkoeller Jul 15 '13 at 09:38
  • To Forkrul: if the link I provided solved the issue, could we close this as a duplicate? @karlkoeller sure, no problem :) – cmhughes Jul 15 '13 at 10: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. – Forkrul Assail Jul 18 '13 at 14:44

0 Answers0