I have a document with tables where I automatically create cross-references based on the contents of some cells. For this, I use the collcell package to pass the cell contents to a macro.

I'm currently using tabular (with array) and tabularx, but I'd like to move some of these tables to tabu. Unfortunately, tabu and \collectcell don't play well together. MNWE (I replaced the linkification automation by a simple use of \meaning to show what's going on):




  foo & bar \\
  foo & bar \\




With tabular or tabularx, \collectcell captures the content of the cell. But with tabu, it also captures tokens inserted before the cell content, including \tabu@cellleft which is automatically inserted by tabu.

What can I replace \collectcell with in my column definitions so that only the cell content is captured?

I want to keep column definitions that work both in tabu and non-tabu environments, because I use both. I can't just make the decision based on the environment names, because I define some wrappers around tabularx and I use other environments from the tabu package (longtabu is one of my reasons for moving to tabu).

Ideally I'd like to keep being able to nest column type definitions (as I do now with T using t, and \ttfamily not ending up in the collected cell content), but if it's really needed I can arrange to always put collectcell at the innermost level around the built-in column types (l, X, p, …).

  • tabu doesn't play well with many other packages, I'm afraid.
    – egreg
    Nov 20, 2015 at 20:49

2 Answers 2


The new LaTeX3 package tabularray is an alternative to the outdated tabu package. You can use cmd option for cells, rows or columns with tblr environment.






  foo & bar \\


enter image description here


This turns out not to require much code. Override \collectcell to read everything up to \tabu@cellleft, then call the original \collectcell. Use \tabu@ifenvir to check whether the current environment is a tabu or longtabu.


You must log in to answer this question.

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