15

In plain TeX \cr is used to mark the end of a row in a table. In LaTeX \\ is usually used instead.

\\ takes an optional argument, which \cr does not support. But I never use that anyway, I prefer booktabs' \addlinespace.

As I have found out recently \\ does not always work, see this bug which was closed with this commit which adds a subsection to the documentation explaining that \cr should be used instead. If the last column of a table is a S column (defined by the siunitx package) and text is appended to this column (with the array package's <{...} syntax) the spacing is wrong when using \\ but correct when using \cr.

So I am wondering: Why not always use \cr instead of \\ to denote the end of a row in a table?

  • one advantage of \\ is that it facilitates some constructions of tabular contents because TeX does not see the hidden \cr. In fact one sometimes wishes the & too had been abstracted by LaTeX. – user4686 May 26 '18 at 14:10
  • The definition of \\ changes with different environments. Not just tabular and array, but also environments like center. – John Kormylo May 26 '18 at 14:27
  • Also, \\ can take an optional argument (vertical space), whereas \cr does not. – Steven B. Segletes May 26 '18 at 16:22
  • 15
    Bottom line of course is I should fix this in siunitx ... – Joseph Wright May 26 '18 at 16:29
21

The argument against using \cr is really the generic argument that applies to any use of undocumented internal interfaces in any software.

\cr is not a documented latex command, the documented commands to end table rows are \\ and \tabularnewline.

In the default implementation, if you are not using the * form or [] argument, \\ basically just does \cr so using \cr directly comes to the same thing. However as it isn't a documented latex command the implementation of tables could change so that they were not equivalent, also conversions of latex to html etc have no reason to expect to see \cr in a document and so may fail.

If some package has a bug that means \cr is needed then that's a bug that should be fixed, or if some package defines an environment where \cr is expected then it is that package documentation not latex documentation (or this answer) that says if you should use it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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