# Tabu very recently stopped working with color/xcolor or with fancyvrb

Below is a MWE with a tabu table that compiled perfectly fine up until I updated packages today (Dec. 16, 2018) with TeX Live Utility.

\documentclass[11pt]{article}

\usepackage{amsmath}
\usepackage{xcolor}
\usepackage{tabu}

\title{Example}
\author{Andrew Turner}

\begin{document}
\maketitle

\begin{table}[h!]
\centering

\tabulinesep = 3pt

\begin{tabu} spread 0pt {X[c$$]X[c$$]} \hline
a & b \\ \hline
\end{tabu}

\caption{test}
\end{table}

\end{document}


After the update, trying to compile gives a whole bunch of errors like this:

! Missing \cr inserted.
<inserted text>
\cr
l.19 \end{tabu}

I'm guessing that you meant to end an alignment here.

! Misplaced \cr.
<inserted text> \cr

l.19 \end{tabu}

I can't figure out why you would want to use a tab mark
or \cr or \span just now. If something like a right brace
up above has ended a previous alignment prematurely,
you're probably due for more error messages, and you
might try typing S' now just to see what is salvageable.


If I comment out the xcolor package, this fixes the issue, or if I get rid of the spread 0pt and keep the xcolor package this also fixes the issue. I looked at what just updated in TeX Live Utility, and I wonder if it has to do with the recent update of colortbl.

Any help would be greatly appreciated.

Here is a further example. This is actually exact same, as recent version(s) of fancyvrb require package xcolor.

this is obsolete since release 3.2 (2019/01/08) of fancyvrb which does not load xcolor anymore.

\documentclass{article}
\usepackage{fancyvrb}
\usepackage{tabu}
\begin{document}
\begin{tabu}spread 0pt {XX}
A
&
B
\end{tabu}
\end{document}


breaks with

! Missing } inserted.
<inserted text>
}
l.10 \end{tabu}

?


Simply commenting out loading of fancyvrb it compiles, or using TL2017 (my TL2018 is already fully updated...) it compiles also.

• your log shows that it doesn't load colortbl, but it does load array so probably it needs a similar update to the update that colortbl needed.... – David Carlisle Dec 17 '18 at 1:03
• So the update to array that required an update to be made to colortbl possibly requires a similar change to be made to the tabu package? Thanks for your help. – Andrew Patrick Turner Dec 17 '18 at 1:35
• you should consider that tabu is not maintained, consequently changes in packages (for example in the array package), on which it is based, can be in conflict with it. – Zarko Dec 17 '18 at 4:47
• @jfbu I haven't had time to check yet but I assume it is % \changes{v2.4i}{2018/09/13}{Add group to prevent color leak (gh/72)} – David Carlisle Dec 17 '18 at 9:17
• @DavidCarlisle thanks I had missed that changes entry as I looked only at top of array.dtx file. – user4686 Dec 17 '18 at 9:41

# UPDATE 2019-01-14

An equivalent patch has been applied in tabu 2.9 which has been submitted to ctan.

This is due to fixing a color leak in p-columns in array which is used underneath tabu, longtable tabularx etc. The tabu package overwrites a number of array internals assuming an internal structure (and grouping levels) which doesn't any any longer exist the moment a color package is loaded.

After staring at the tabu code for a while I think (but I'm not yet sure) that it only needs adding \color@begingroup in one place.

\usepackage{etoolbox}

\makeatletter
\patchcmd\tabu@startpboxmeasure
{\aftergroup\tabu@endpboxmeasure}
{\aftergroup\tabu@endpboxmeasure
\color@begingroup
}{\typeout{tabu patched}}{\typeout{tabu patch failed!}}

\patchcmd\tabu@LT@startpbox
{\bgroup}{\bgroup\color@begingroup}
{\typeout{tabu patched}}{\typeout{tabu patch failed!}}
\makeatletter
`

This does fix the sample document above and the tests that I made so far. If others could check with their documents I would appreciate that. Of course in the end that or something else would then need to go into the tabu code.

### Update

Added a second patch in above needed to account for the same change made to longtable. Thanks to Ulrike Fischer for providing it (in a different question).

• Just for the link: The answer by Ulrike that contains the second patch is probably tex.stackexchange.com/a/468958/35864 – moewe Jan 11 at 9:47
• @moewe that's the one – Frank Mittelbach Jan 11 at 13:17
• I posted the following comment with an answer from Ulrike Fischer as well (tex.stackexchange.com/questions/468948/…): Is there a way to run this example with an older version of LaTeX as well (e.g. This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6840 64-bit))? At the moment it crashes with the mentioned version with a "! Extra }, or forgotten \endgroup. – albert Jan 14 at 12:29
• @albert with an older LaTeX you should have an older array.sty for which the above patch is not correct (but issue should not be there either so no patch is needed). Note that the TeX version is irrelveant it is the LaTeX version that matters. Anyhow it is not impossible that there are issue with tabu in the earlier versions as well -- it is essentially unmaintained since 2011, so if you have problems they may be well unrelated. We are currently setting up an emergency fix for tabu covering those issue we know about, but we will not going to maintain the package. That should hit CTAN soon. – Frank Mittelbach Jan 14 at 20:00
• @FrankMittelbach The problem I would have had is that the generated LaTeX code should work with newest version (so with the latex3/latex2e patch) as well as with older versions. Seen the fact that the fixed tabu package (thanks!) will be on CTAN and in the distributions the latex3/latex2e and tabu are "inline" so no need anymore for local fixes. – albert Jan 15 at 9:00