When I switched to using a VCS then I had a load of documents that I was writing that were not in suitable format for putting in to a VCS. In particular, the one-sentence-per-line rule was not in force. So I wrote one. I now use it for similar circumstances as you describe: when collaborators send me something and I want to import it in to my VCS. It's available from github: direct link and the relevant page about my experiences switching to a VCS. It's a perl script and the documentation is embedded: perldoc fmtlatex
should provide it.
When using this program, I LaTeX the document first and then dvips
to produce a postscript file. Then I run fmtlatex
on it, and run latex+dvips
again (being sure not to overwrite the original one). Doing diff original.ps new.ps
will tell me if there's any functional difference between the two documents - it should just produce something about timestamps. If you have a document that does produce a significant difference, please send it to me (if possible) as that's evidence of a bug. (All this is in the documentation.)
I also have a script for swapping dollars for their LaTeX equivalents which is available also on github.
ggVG=
? – Richard Herron Apr 9 '11 at 16:24ggVG=
(or the slightly more efficientgg=G
) only re-indents but does not reflow the text. I prefer breaking paragraphs into lines (usuallytw=80
), but some of the automatic generators create one line for each paragraph.gg=G
does not handle that. Emacs reflow region command does it perfectly. – Aditya Apr 9 '11 at 18:30