Good strategy for line breaks with paragraphs of LaTeX source
It is pretty much a personal decision. For myself, being a heavy user of version control systems, I tend to start every sentence on a new line. More than that, I try not to split any phrase across a linebreak. This makes diff output vastly easier to read. From this viewpoint, just about the worst thing you can do is to edit a bit of text in the middle of a long paragraph, then make your editor reflow the whole paragraph (M-q in emacs).
Of course, once you have collaborators, it becomes a matter of fine diplomacy to have your collaborators adhere to the same discipline. If they are not using version control themselves, it may be hard to convince them that such policies have any value.
git
supports word-by-word diff
's as shown by http://idnotfound.wordpress.com/2009/05/09/word-by-word-diffs-in-git/. The article provides some useful insights in using it together with LaTeX. And of course there is wdiff
, a GNU program for word-by-word diff
, to be used in conjunction with other versioning software.
I don't feel the need for explicit diffs
' when typing LaTeX, so I just use svn
without any special line breaks per sentence. But I do feel the need to let this useful tool to be known :).
As a version-control junkie, I subscribe to the view that (single) line breaks are the way of telling diff
what I want to see if something changes. Usually, this means one-sentence-to-one-line, since if something changes in a sentence then I want to see the whole sentence, but I don't want to see the whole paragraph. But sometimes it is a little finer than that: if I have a particularly complicated bit of inline maths then I'll separate that out using line breaks so that I can see if it's something in the maths or in the surrounding sentence that changed.
I use Emacs with longline-mode enabled so when editing a document, I get all the functionality of line-wraps (and paragraph reflows) with none of the grief from finding that I've messed up all my nice formatting.
When I converted to VCS, I had a lot of documents that were wrapped badly so I wrote a script (called fmtlatex
) to convert them to one-sentence-to-one-line mode. It's also linked off this page (see Stage Two) which I wrote when making the switch.