3

I want to use tabularray tables in lyx by redefining tabular environment. For this aim, I need to use \tabularnewline instead of \\ by \providecommand{\tabularnewline}{\\}. But, if I do this, the table is corrupted as in the figure. What is the reason for this, and how to tackle it?

enter image description here

\documentclass{article}
\usepackage{lmodern}
\usepackage{xcolor}
\usepackage{tabularray}

\providecommand{\tabularnewline}{\}

\begin{document}

\Large{WRONG}: \begin{tblr}{|c|c|c|} \hline \SetRow{lime!20} Item 1 & Item 2 & Item 3 \tabularnewline \hline text & text & text\tabularnewline \hline \end{tblr}

\vspace{1cm}

\Large{RIGHT}: \begin{tblr}{|c|c|c|} \hline \SetRow{lime!20} Item 1 & Item 2 & Item 3 \ \hline text & text & text\ \hline \end{tblr}

\end{document}

mert
  • 1,667
  • You might be interested in a module i wrote to use tabularray in lyx. You can get it here: https://github.com/Udi-Fogiel/LyX-Tabularray – Udi Fogiel Aug 03 '22 at 21:50

1 Answers1

4

tabularray must see a real \\ because it uses that to split the array in rows. So you must tell it to expand \tabularnewline first with [expand=\tabularnewline].

\documentclass{article}
\usepackage{lmodern}
\usepackage{xcolor}
\usepackage{tabularray}

\providecommand{\tabularnewline}{\}

\begin{document}

\Large{RIGHT}: \begin{tblr}[expand=\tabularnewline]{|c|c|c|} \hline \SetRow{lime!20} Item 1 & Item 2 & Item 3 \tabularnewline \hline text & text & text\tabularnewline \hline \end{tblr}

\end{document}

L.J.R.
  • 10,932