7

I am very new to LaTeX.

A newline in the input file does not mean anything to LaTeX. An empty line in the input file means a new paragraph.

Trouble is, when I view my sources with different text editors on different displays, they look very different (and always bad). So I find myself chopping lines to the about 80-th character or so.

This brings the MS Word problem - introduce a line, or even a single word, and you need to edit the whole following paragraph in order that it is nicely positioned on the display (talking about the .tex file).

Using --soft-wrap wraps lines around, but is not pleasing to the eye, plus a single move of the cursor could scroll a whole screen - hardly intuative.

How do I write .tex source file, so that anyone - using an IDE or just any editor, can view and edit them comfortable?

Vorac
  • 743

3 Answers3

5

Third way is my personal preference. It is helpful for diffs and if you use a repository to keep track of your code. Then let your editor soft wrap long sentences.

  • This sounds like a very logical and clean solution. I'll try it out! – Vorac Feb 19 '14 at 09:12
  • +1 One sentence, one line! This is semantically correct and can be valuable if you put your source code under versioning control! – Dror Feb 19 '14 at 11:42
4

I use an editor with word wrap on. If you're using Windows, Notepad++ is great. In Linux there are many great editors, but even gedit automatically wraps lines. If you're using Eclipse, its soft-wrap feature is kinda buggy and I never really found it very well suited to Latex editing, but it's still better than hard-wrapping, because as you said, you have to redo it any time you change to a different screen size (and doing so wreaks havoc on the diff of any version control you might be using), which is tedious.

TLDR: best practice in this is, imho, to let your text editor soft-wrap the lines for you.

Acrofales
  • 213
  • I am tempted to accept your answer as least evil alternative. Two problems remain. 1) on a non-configured editor, lines will be very ugly. 2) Navigating with the arrow keys becomes significantly more difficult - pressing down can scroll 10 lines or only 1. Moving to the middle of the paragraph is far worse - here the End key is no rescue to us. – Vorac Feb 19 '14 at 08:34
3

Use something like emacs+auxtex. It's got a keyboard shortcut for formatting paragraphs, regions and sections, i.e., it does nice line breaks and indenting.

Alex
  • 5,362