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?
2 Answers
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.
-
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?– zyyJan 30, 2021 at 4:11
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.
-
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? May 1, 2014 at 23:48
-
2@Mathematician: See What are underfull
\hbox
es and\vbox
es and how can I get rid of them? and the associated discussion surrounding the use of\\
.– Werner ♦May 1, 2014 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.– AdamMay 1, 2014 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? May 2, 2014 at 0:34
-
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 2, 2014 at 2:04
\\
doesn't break the paragraph. Therefore there is no\parskip
that is inserted (for one)...\\
is to be used for ending paragraphs. It's wrong in many ways.\\
to end a line or a paragraph?, or ultimately When to use\par
and when\\
.