6

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?

4
  • 4
    \\ doesn't break the paragraph. Therefore there is no \parskip that is inserted (for one)...
    – Werner
    May 1, 2014 at 23:31
  • 6
    Your teacher was wrong. It's unfortunately common belief that \\ is to be used for ending paragraphs. It's wrong in many ways.
    – egreg
    May 1, 2014 at 23:34
  • Possible duplicate: Should I use \\ to end a line or a paragraph?, or ultimately When to use \par and when \\.
    – Werner
    May 1, 2014 at 23:45
  • @egreg: Please provide an answer indicating why using `\` is wrong and how to best use it. May 2, 2014 at 0:40

2 Answers 2

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.

1
  • 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, 2021 at 4: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.

7
  • 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 \hboxes and \vboxes 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.
    – Adam
    May 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

Not the answer you're looking for? Browse other questions tagged .