When I was initially learning to use LaTeX, the professor who taught me the basics instructed me to use \\ as a way to end a previous line and start a new line of text. However, many of the veteran users on this forum are opposed to this method. Is there a method that is objectively better (and not just preferred) over the others and why?
Asked
Active
Viewed 4,082 times
6
Mathematician
- 3,363
2 Answers
4
The \\ is a line break, not a paragraph break. In word processors, it is Alt-enter. It's like page break: use sparingly.
To create a new paragraph, use enter twice.
Linebreaks are only used if you specifically want the line to break there, such as in poetry. As in worp processors, line breaks keep the same paragraph alive.
Use para ends such as double entres, if you want the document to create a new para.
wendy.krieger
- 955
-
Thanks for the comment, however I think one of the principles of coding is to be explicit, while blank lines are not explicit (to the compiler), what if the definition of blank lines changes? – zyy Jan 30 '21 at 04:11
0
Using \\ there is the danger of badboxes creation so this is not a good option. If I want to leave some vertical space and go to another line I usually use \vspace{} with a small value. I don't know if this is the best way to achieve this or even a good way, but it does the trick with no downsides so far.
Adam
- 4,684
-
OK. You said that there is the danger of creating badboxes. My document compiles just fine with the badboxes. What is so "bad" about them? – Mathematician May 01 '14 at 23:48
-
2@Mathematician: See What are underfull
\hboxes and\vboxes and how can I get rid of them? and the associated discussion surrounding the use of\\. – Werner May 01 '14 at 23:51 -
The document compiles, but it is not that beautiful. Sometimes you can't even see the ugly part with naked eye. LaTeX is a perfectionist. When there is a badbox something ugly is happening. It might not bother you at all (it might also bother you a lot sometimes) but the ugly part exists. So try to avoid badboxes to have a perfect output. – Adam May 01 '14 at 23:54
-
@Werner: I looked at your link, but did not find the answer to my question. WEhat is so "bad" about the badboxes? – Mathematician May 02 '14 at 00:34
-
@Adam: I understand that LaTeX does not like badboxes and the "errors" mean that something in my code is ugly. But, I guess the long and the short of my question is why should I care? – Mathematician May 02 '14 at 00:34
-
@Mathematician you should care because sometimes the boxes are so bad that you can see them at once and your document will be far from ok. I mean it. If the badbox has a high level of badness trust me you won't like it. Also you want to know what happen in your code. If you have written 100 pages of text using your method then you may have a lot of badboxes which means that you may have a lot of lines that are very ugly being underful and others being overful with text sticking out of the margins. Take care of it so not to worry about what might happen in your document. – Adam May 02 '14 at 00:53
-
1@Mathematician: Bad boxes are just indications where TeX's "paragraph setting algorithm" have difficulty laying out the lines in an optimal way. Ultimately if the visual is okay, then a little badness here/there is also okay. It's just an automated measure of what the algorithm returns that gives the user an indication of whether/not they need to investigate and reword/rephrase/adjust. – Werner May 02 '14 at 02:04
\\doesn't break the paragraph. Therefore there is no\parskipthat is inserted (for one)... – Werner May 01 '14 at 23:31\\is to be used for ending paragraphs. It's wrong in many ways. – egreg May 01 '14 at 23:34\\to end a line or a paragraph?, or ultimately When to use\parand when\\. – Werner May 01 '14 at 23:45\\is wrong and how to best use it. – Mathematician May 02 '14 at 00:40