10

Is there a way to set the spacing of the commands of \newline and \\ for the whole document? (I am aware that I shouldn't use them, unless it is really necessary.)

5
  • 3
    What precisely do you want to happen? Are you asking, for example, how to add an extra 6pt whenever a \newline or \\ takes effect? (Note that \\ already has a different effect in multi-line math displays, and may have different effect in tables than it does in text.) Jun 7, 2019 at 0:54
  • 1
    Yes, I would like to add a few extra pt whenever I use \newline or \\ in my text. Thanks for the note, I was aware of the tables but not of the multi-line math displays - I will keep that in mind.
    – TeXlearner
    Jun 7, 2019 at 1:00
  • 1
    \\ gets redefined a lot. Even \centering and \raggedright redefine it. Jun 7, 2019 at 2:14
  • \\ is for making in-paragraph line breaks so the whole point is that it produces a normal baseline to baseline space, you can use \\[5pt] to add an additional space where needed. Jun 7, 2019 at 6:55
  • Thanks yo everyone! With the help of your hints and the answer of @DavidCarlisle I was able to understand the case in my document and now see that no altering of the the commands is needed :-)
    – TeXlearner
    Jun 9, 2019 at 12:45

1 Answer 1

13

\newline and the default definition of \\ do not set any vertical space at all, they just set horizontal space (to pad out the line allowing a line to be short).

abc abc\newline abc abc

is

abc abc\nolinebreak\hspace{\fill}\linebreak abc abc

So there is no vertical space specified: the line spacing is specified for the whole paragraph as \baselineskip and the value at the end of the paragraph is used for all the lines in that paragraph.

If you use the optional argument to \\ eg \\[10pt] then it ends up being

abc abc\vadjust{\vspace{10pt}}\nolinebreak\hspace{\fill}\linebreak abc abc

Which means that line breaking for the paragraph happens as before, then after the line that contained the \vadjust (which is the line ending with \\[10pt]) an additional 10pt space is added.

6
  • Thank you very much for the explanation! In fact I found out that in my document must have been a different "error" so that \newline and `\` showed a different line spacing than expected. I suspect that some glue was the trigger. If anyone is interested in actually altering the commands, I found the solution here: tex.stackexchange.com/a/266139/188437
    – TeXlearner
    Jun 9, 2019 at 12:43
  • Would it make a difference in the line vertical spacing between abc abc \\[10pt] abc and {abc abc \\[10pt]} {abc}
    – js bibra
    Dec 3, 2019 at 13:59
  • @jsbibra no, why would you add the braces? Dec 3, 2019 at 15:30
  • as in this question-- tex.stackexchange.com/questions/519071/…
    – js bibra
    Dec 3, 2019 at 15:40
  • 1
    @Andyc you can use \\[2pt] in the scope of \raggedright or \centering in a p column, but you almost never want extra space between lines of the same paragraph surely?? between paragraphs you can use \vspace or \bigskip or whatever as normal. Sep 28, 2020 at 6:50

You must log in to answer this question.

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