10

What does double backslash in LaTeX mean ? (please see example below)

label 2-1 & label 2-2 & label 3-3 & label 4-4 & label 5-5 \\

\verb= http:\\www.chinatex.org=\\

some line have \\ while other line don't, which makes me confused.

2 Answers 2

25

The \\ is context-dependent macro in LaTeX. It means that it is internally redefined in various situations and various LaTeX environments. By default it is \hfil\break and this can be used inside the paragraphs in order to "destroy" the normal paragraph formatting. Many LaTeX users use these destroyed paragraphs because they don't know that normal end of paragraph does the similar result.

The typical mistake of novice users is the usage of \\ at the end of the paragraph. Then we have \hfil\break\unskip\nobreak\hskip\parfillskip at the end of the paragraph and the \break consumes all followed removable items including \hskip\parfillskip. The bad paragraph is produced with the warning message "Underfull hbox (badness 10000)". But novice users don't read the log nor terminal messages, unfortunately.

The \\ is redefined as \cr primitive in tables. The \cr primitive isn't mentioned in common LaTeX manuals and LaTeX users are confused when TeX error message "Extra alignment tab has been changed to \cr" occurs.

The \\ is redefined by \par in centering environments etc.

The \\ macro is source of many confusions for LaTeX novice users.

Plain TeX does not define \\. This control sequence is reserved for user definitions.

Note curious example in our question: http:\\www.chinatex.org. I never seen such URL. Maybe you have meant http://www.chinatex.org.

2

A little searching led to this webpage: https://www.sharelatex.com/learn/Line_breaks_and_blank_spaces

(I did not write it, original author unlisted) But it also backs up my own experience: it is a linebreak. You can insert it either in body text as such.

Alternately, if you have a LaTeX table or math matrix, for example, you can also use it to mark the end of the row of data, and the data afterward will start to form the next row.

Happy Texxing!

10
  • 5
    You can but you ought not use it for breaking lines. It is properly used to end the row of a tabular alignment or array, and it may be used in a center environment. But it ought not be used it body text to create line breaks.
    – cfr
    Feb 1, 2015 at 3:50
  • @cfr You are right, of course.
    – Ken
    Feb 1, 2015 at 3:51
  • Welcome to TeX SE, by the way!
    – cfr
    Feb 1, 2015 at 3:53
  • 3
    @mpacer -- Doing so is an example of ad hoc formatting, which may be common in other software, but is generally not a good idea for the TeX world. (Sometimes manual formatting/intervention is needed, but it should be the exception, not the rule.) Section titles can be broken at odd points, but should they be? Using LaTeX, it is better to define once how large/long/etc. a section title should be then just use \section{This is an incredibly long section title; it will need to be broken into multiple lines at least once} and let TeX do the rest. Then you get consistent section formatting.
    – jon
    Feb 1, 2015 at 6:40
  • 2
    @mpacer another reason to avoid `\\` is the dreaded “no line here to end”, which sometimes pops up when you’ve used it (improperly) to produce a new line. Feb 1, 2015 at 10:45

You must log in to answer this question.

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