2

I want to switch from longtable to tabularray due to its more granular customization.

In longtable I can use a command with an argument which sets the whole row (with &). However tabularray does not like this and throws me an error.

MWE

\documentclass{scrartcl}

\usepackage{tabularray}
\usepackage{longtable} % for comparison


\newcommand{\myrow}[1]{
  Hello #1 & my name is #1 \\
}

\NewTableCommand{\myRow}[1]{
  Hello #1 & my name is #1 \\
}


\begin{document}

\begin{longtblr}{colspec={ll}}
  Hello & world \\
 % \myrow{Peter} % does not work
 % \myRow{Hans} % does not work either
\end{longtblr}


\begin{longtable}{ll}
  Hello & world \\
  \myrow{Peter}
  \myrow{Hans}
\end{longtable}

\end{document}

enter image description here

1 Answer 1

1

You can use the expand option.

\begin{longtblr}[expand=\myrow]{colspec={ll}}
  Hello & world \\
 \myrow{Peter} % does not work
 \myrow{Hans} % does not work either
\end{longtblr}

I think only one such macro can be expanded per table. It must be defined with \newcommand, not with \NewTableCommand.

0

You must log in to answer this question.

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