11

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.

  • 2
    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 01:03
  • 1
    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 01:35
  • 2
    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 04:47
  • 1
    @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 09:17
  • 1
    @DavidCarlisle thanks I had missed that changes entry as I looked only at top of array.dtx file. –  Dec 17 '18 at 09:41

1 Answers1

13

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).

  • 1
    Just for the link: The answer by Ulrike that contains the second patch is probably https://tex.stackexchange.com/a/468958/35864 – moewe Jan 11 '19 at 09:47
  • @moewe that's the one – Frank Mittelbach Jan 11 '19 at 13:17
  • I posted the following comment with an answer from Ulrike Fischer as well (https://tex.stackexchange.com/questions/468948/longtabu-and-color-compatibility/468958#468958): 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 '19 at 12:29
  • 1
    @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 '19 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 '19 at 09:00
  • @albert in a case like that you can try to wrap a patch into @ifpackagelater so that it is only applied on defined circumstances. Not great but ... – Frank Mittelbach Jan 15 '19 at 12:50
  • @FrankMittelbach thanks, that was also one of the suggestions in the comments of https://tex.stackexchange.com/questions/470107/incompatibility-of-fix-in-latex3-latex2e-in-respect-to-unmaintained-tabu-packa – albert Jan 15 '19 at 12:56
  • The patch helped, thank you for posting. However, the updated tabu package is still not available. – Oleksandr Jan 18 '19 at 20:58
  • @Oleksandr not sure where you looked, it is on CTAN: https://www.ctan.org/pkg/tabu and it also has made it at least into TeXLive afaik – Frank Mittelbach Jan 19 '19 at 09:29
  • @Frank, yes, when i checked two days ago in MikTeX Console, it did not show new version of tabu. Now, it is ok. – Oleksandr Jan 20 '19 at 22:21
  • @FrankMittelbach Thank you very much for this patch. This originally worked for me, but now that the new tabu-fixed version has been released, the original MWE from my post above has errors again, with or without the patch you provided here. Any thoughts on this? – Andrew Patrick Turner Feb 20 '19 at 16:28
  • @AndrewPatrickTurner you might try the new (though not yet final) patched version at https://github.com/tabu-fixed/tabu – Frank Mittelbach Feb 25 '19 at 21:14
  • For me, it is still broken, by the way, in one of the documents. the only difference with working documents is that i use following inline math formulas inside table cells: $\begin{aligned} \notag. \aligntab\begin{cases} 0, if a \leq 10 \ \frac{b}{c}, otherwise \end{cases} \notag \end{aligned}$. PS. aligntab is defined as \newcommand{\aligntab}{&}. – Oleksandr Mar 07 '19 at 17:23
  • i found out that it is combo of cases and \frac, that is still causing the issue. once i remove any of them, it works. – Oleksandr Mar 07 '19 at 17:35