1

After tabu package update X[-1] produces error when xcolor package is used:

\documentclass{article}

\usepackage{tabu}
\usepackage{xcolor}

\begin{document}

\begin{tabu} to \linewidth {X[-1]X[1]}
    cell 1 & cell 2 \\
    cell 3 & cell 4
\end{tabu}

\end{document}

error code:

Missing } inserted. \end{tabu}

X[-1] is usefull to produce fixed width tables with variable column width according to the content width. The code compiles without error when x[1] is used instead or when xcolor package is removed.

2

1 Answer 1

1

The new LaTeX3 package tabularray is an alternative to the outdated tabu package:

\documentclass{article}

\usepackage{tabularray}
\usepackage{xcolor}

\begin{document}

\begin{tblr}{
  width = \linewidth,
  colspec = {X[-1]X[1]},
  hlines,
  vlines,
  row{odd} = {blue8},
  row{even} = {purple8},
}
  cell 1 & cell 2 \\
  cell 3 & cell 4
\end{tblr}

\end{document}

enter image description here

You must log in to answer this question.

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