4

When using multiline cells with tabularray like in the example below, I have the problem that my editor (emacs) recognizes the \\ that indicate a newline in a cell as the end of a row and thus messes up aligning the table in the editor. So is there a way to use another command instead of \\ for the multiline cells or map it to another macro. I tried \newcommand{\nl}{\\}, but this doesn' work (it stretches the table to the right).

\documentclass{article} \usepackage{tabularray} \begin{document} \begin{tblr}{colspec={clr},hlines} one & {left\\leftttt} & three \\ one & two & {right\\rightttt} \\ \end{tblr} \end{document} 

(Example from here).

2
  • See tex.stackexchange.com/a/630796/250119 for a working hack for that. (also maybe ask L.J.R to implement it "officially" as a feature (possibly with a warning), it's not like tabularnewline has another usage anyway) Commented Jun 22, 2022 at 12:14
  • You could use \cr whithin tables Commented Jun 23, 2022 at 15:16

1 Answer 1

6

You can use your \nl command to break multiline cells by using varwidth library of tabularray package (and you don't need to enclose them with curly braces):

\documentclass{article} \usepackage{tabularray} \UseTblrLibrary{varwidth} \SetTblrInner[tblr]{measure=vbox} \newcommand{\nl}{\\} \begin{document} \begin{tblr}{colspec={clr},hlines} one & left\nl leftttt & three \\ center\nl centerrrr & two & right\nl rightttt \\ \end{tblr} \bigskip \begin{tblr}{colspec={clr},hlines} one & {left\\leftttt} & three \\ {center\\centerrrr} & two & {right\\rightttt} \\ \end{tblr} \end{document} 

enter image description here

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.