When you write TeX source, how do you use your editor's word wrap?

jparker picture jparker · May 22, 2009 · Viewed 7.7k times · Source

Do you use "hard wrapping" (either yourself or automatically by your editor) by inserting newlines into your source document at a certain line length, or do you write your paragraphs in one continual line and let your editor "soft-wrap" for you?

Also, what editor do you use for this?

Note: I'm interested in how you wrap lines in your TeX source code (.tex file, general prose), not how TeX wraps lines for the final document.

Answer

Will Robertson picture Will Robertson · Jul 16, 2009

I recently switched to hard-wrapping per sentence (i.e., newline after sentence end only; one-to-one mapping between lines and sentences) for two reasons:

  • softwrap for a whole paragraph makes typos impossible to spot in version control diffs.
  • hardwrapped paragraphs look nice until you start to edit them, and if you re-flow a hard wrapped paragraph you end up with a whole bunch of lines changed in the diff for a possibly one word change.

Only wrapping per sentence fixes these two problems:

  • Small changes are comparatively easy to spot in a diff.
  • No re-flowing of text, only changes to, insertions of, or removal of single lines.

Looks a bit weird when you first look at it, but is the only compromise I've seen that addresses the two problems of soft and hard wrapping.

Of course, if you're working collaboratively, the answer is to use whatever the other people are using.