Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

What approach is recommended regarding line breaks when writing paragraphs of LaTeX?

  • Should a new line be started at the end of each sentence?
  • Is it better to manually start new lines or to let the editor wrap the line?

No doubt such decisions have implications for version control, debugging, collaboration, automaticity of writing, and so on.

What is considered good practice? Or is it a completely personal decision?

Let me know if this should be community wiki.

share|improve this question
2  
    
I suggest community wiki. –  Matthew Leingang Oct 21 '10 at 12:54
    
@Matt Okay, although I don't seem to be able to make it so. –  Jeromy Anglim Oct 21 '10 at 13:03

3 Answers 3

up vote 12 down vote accepted

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.

share|improve this answer

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 to convert them to one-sentence-to-one-line mode. It's linked off this page (see Stage Two) which I wrote when making the switch.

share|improve this answer
    
You recommend in your page to use longlines-mode. For me it seems to break the TeX-Sync. Did you experience this? BTW: it doesn't happen with visual-line-mode. –  Dror Mar 2 '13 at 9:04
    
@Dror What is the "TeX-Sync"? –  Loop Space Mar 2 '13 at 18:43
    
My bad... SyncTeX - the LaTeX PDF synchronization tool. –  Dror Mar 2 '13 at 19:56
    
@Dror Don't use it so wouldn't know anything about it. Soory. –  Loop Space Mar 2 '13 at 23:46
    
@AndrewStacey Is there any chance your fmtlatex perl script would be converted to lua some day (sorry, no perl skills here...)? The reason is that lua is always present as soon as luatex is. –  cjorssen Jun 9 at 22:27

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 :).

share|improve this answer
1  
+1 for pointing this out! –  Janus Dec 3 '10 at 2:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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