Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
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. –  Roelof Spijker Jan 16 '12 at 12:10

1 Answer 1

up vote 26 down vote accepted

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.

share|improve this answer
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 Jan 16 '12 at 13:15
    
@egrep you are right, thanks. updated the answer accordingly –  Frank Mittelbach Jan 16 '12 at 13:31
    
Note that the @user notifications don't work inside question and answer posts, only in comments and in the chat. –  Martin Scharrer Jan 16 '12 at 13:57
    
@Martin will try to remember next time –  Frank Mittelbach Jan 16 '12 at 14:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.