22

Consider the following example:

\begin{array}{l}
line 1 \\
line 2 \\
\end{array}

Is the \\ in the last line completely optional or are there circumstances under which it has any effect?

1
  • 4
    If you want to add a horizonal line at the bottom. You need the \\ there. If you don't want anything underneath then the \\ is superfluous and has no effect. Commented Jan 16, 2012 at 12:10

1 Answer 1

27

As @whlt3 said it is required if you intend to have a final horizontal line \hline or a partical line via \cline{...} or if you want to have some extra space blow that line produced via the optional argument of \\. If not then it is completely optional. I would however suggest to use \\ on all lines as that allows you to easily add or reorder rows in your table without the need to worry about the row markers.

However, as @egreg pointed out this is only true for tabular or array environments: within amsmath environments such as align the \\functions as a row separator so that a final \\will result in a spurious extra row.

4
  • 11
    While a final \\ is optional in array or tabular environments, it mustn't be used in environments such as align or gather, where it produces a spurious blank line.
    – egreg
    Commented Jan 16, 2012 at 13:15
  • @egrep you are right, thanks. updated the answer accordingly Commented Jan 16, 2012 at 13:31
  • Note that the @user notifications don't work inside question and answer posts, only in comments and in the chat. Commented Jan 16, 2012 at 13:57
  • @Martin will try to remember next time Commented Jan 16, 2012 at 14:31

You must log in to answer this question.

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