Alcides Fonseca

40.197958, -8.408312

The 80 characters per line limit is arbitrary and wrong

Everyone has their own writing style, indentation and formatting preferences. I certainly have mine (even if I am in the minority of preferring tabs to spaces), but I usually respect other people’s.

Except for the 80 character limit in LaTeX files.

I’ve been wanting to write this post for a while, mainly motivated by a very helpful co-author whose only annoyance was to impose this limit on me. But today Linus Torvalds came to my rescue and is backing my point.

Assume that your text is formatted to have an 80 char limit. If you introduce a word in the middle of the text, it will break the limit, and it will have to be reflowed (usually by your editor). However, it will cause a lot of lines to be different from the previous version in your version control diff. You can’t tell the actual introduced word, and it will make merging two commits on different lines less automatic.

Furthermore, if you have a smaller width, your text will be unreadable, like in the screenshot above.

Finally, if your editor supports reflowing text to fit the char limit, it will also support soft-wrap. Which is what I use to whatever window width I use. Because I split my screen in different ways (either using Rectangle or Amethyst), no fixed text width is useful for me. But soft-wrapping solves the issue with ease.

I’ve been focusing on LaTeX (or other long-form) text. But this also applies to code as well. Let the version control checked version be free of line breaks, and let editors adapt the formatting to the user, but always minimize the diffs for code reviewing and merging.