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.

What is the difference between \\ and \tabularnewline? Is it same as the difference between \\ and newline?

Is \tabularnewline preferred over \\ when creating tables?

share|improve this question
    
Which package (if any) are you using for tabular material? –  percusse Oct 23 '12 at 15:01
    
@percusse I was wondering about the difference after seeing some questions and answers posted here. I tried searching for tabularnewline but it gave me lot of results, but wasn't able to find the difference. –  mythealias Oct 23 '12 at 15:11
    
No problem. As David mentioned, the doublebackslashes are redefined a lot so I was trying to narrow down the focus if it was specifically about one implementation. –  percusse Oct 23 '12 at 15:50
add comment

1 Answer

up vote 21 down vote accepted

If your tabular contains p-columns, then there is a ambiguity: Does \\ should end a line inside a cell or should it end a tabular row? The use of \newline and \tabularnewline make that clear, the first ends the line in a cell, the latter the row of the table.

See also \arraybackslash of package array that can be used to reset the meaning of \\ to be \tabularnewline, from the documentation:

\arraybackslash: Restore \\ for use in array and tabular environment (after \raggedright etc.).

\def\arraybackslash{\let\\\tabularnewline}
share|improve this answer
4  
+1 Heiko beat me by 30 seconds:-) so the main point is that `\` has many definitions in latex: in tables, in normal text in centering etc it is locally defined to whatever needs doing. –  David Carlisle Oct 23 '12 at 15:18
    
In my limited usage I have always seen \` end tabular row. So is \tabularnewline` for clarity for the user? (If it matters I usually use memoir and article document) –  mythealias Oct 23 '12 at 15:53
add comment

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.