I'm having trouble with a "Bad math environment delimiter" when using certain math environments inside tabu. Minimal example:



  \begin{tabu}{ X } 
    \[ b \]

This error only shows when xcolor is loaded and also appears when \[ is replaced with an equation, align, or gather environment, but not when using $$. The above example used to work a year ago and the error appeared recently after updating MikTex and all packages.

  • 2
    you should consider that tabu is not maintained, so it not respond on recent changes in many of packages. for example in array and it seems that in xcolor too. – Zarko Jan 9 at 2:37
  • @Zarko I don't think any change in xcolor is responsible for this, it all comes from change in array. – user4686 Jan 9 at 13:36

UPDATE 2019-01-14

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

This is not a full solution, only a first try!!!

At some place in the code tabu checks the "current group type" (What combinations of mode and \currentgrouptype exist?).

The problem is that array added an additional "color group" to p-columns to avoid that colors leaks out. This color group is active if a color package is used. When tabu tests the current group type it now gets a different answer then previously and so takes the wrong code path.

One possibility to get around the problem is to save the currentgrouptype before the color group and to use this value in the tabu code.

Attention I suspect that more places will need adjustments.


%Save the currentgrouptype before the color@begingroup:
\def\@startpbox#1{\bgroup \array@currentgrouptype\currentgrouptype
      \vrule \@height \ht\@arstrutbox \@width \z@

%Use the new \array@currentgrouptype
    %\showthe\currentgrouptype %14 in tl18, 5 in tl17
    \ifnum \array@currentgrouptype>12         % 
        \setbox\tabu@box =\hbox\bgroup
            \let\tabu@verticalspacing \tabu@verticalsp@lcr
            \d@llarbegin                % after \hbox ...
        \setbox\tabu@box \hbox\bgroup$\tabu@temp \bgroup
            \let\tabu@verticalspacing \tabu@verticalsp@pmb
}% \tabu@verticalmeasure


  }{\typeout{tabu patched}}{\typeout{tabu patch failed!}}

 {\typeout{tabu patched}}{\typeout{tabu patch failed!}}


  \[ b \]

  \[ b \]


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.