50

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

Is \tabularnewline preferred over \\ when creating tables?

3
  • Which package (if any) are you using for tabular material?
    – percusse
    Oct 23, 2012 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, 2012 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, 2012 at 15:50

1 Answer 1

49

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}
2
  • 5
    +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. Oct 23, 2012 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, 2012 at 15:53

You must log in to answer this question.

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