[Tex/LaTex] tabu: Error since update

tabu

Since the last update of tabu.sty I get the following error:

! Improper \prevdepth. \tabu@verticalspacing ... tempdimc \t

Here is a MWE

\documentclass[a4paper,12pt]{report}
\usepackage{tabu}
\usepackage{amsmath}
\usepackage{xcolor}  
\newcolumntype{L}{>{\begin{varwidth}{0.91\linewidth}}l<{\end{varwidth}}}

\begin{document}    
\begin{tabu}{Lcc}
$\begin{pmatrix}
1 \\2\\3    
\end{pmatrix}$& 2& 3\\
\end{tabu}

\end{document}

The error occurs, when including pmatrix (or array) in a tabu-environment with a predefined column (using varwidth) AND strangely when including any other of a list of packages (like: color.sty, xcolor.sty, pstricks-add.sty, colortbl.sty, …) Everything worked fine before the update!

Does anyone know, how to fix this?

Here is the first line of the log file:

This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6930
64-bit) (preloaded format=latex 2019.1.13) 20 JAN 2019 12:55 entering
extended mode

Best Answer

I think this is the correct fix, if it survives some more testing I'll get tabu updated on ctan.

\documentclass[a4paper,12pt]{report}
\usepackage{tabu}
\usepackage{amsmath}
\usepackage{xcolor}  
\newcolumntype{L}{>{\begin{varwidth}{0.91\linewidth}}l<{\end{varwidth}}}

\makeatletter
\def\tabu@verticalmeasure{\everypar{}%
\unless\ifnum\currentgrouptype=14 \let\tabu@currentgrouptype\currentgrouptype\fi
    \ifnum \tabu@currentgrouptype>12         % 14=semi-simple, 15=math shift group
        \setbox\tabu@box =\hbox\bgroup
            \let\tabu@verticalspacing \tabu@verticalsp@lcr
            \d@llarbegin                % after \hbox ...
    \else
        \edef\tabu@temp{\ifnum\tabu@currentgrouptype=5\vtop
                        \else\ifnum\tabu@currentgrouptype=12\vcenter
                        \else\vbox\fi\fi}%
        \setbox\tabu@box \hbox\bgroup$\tabu@temp \bgroup
            \let\tabu@verticalspacing \tabu@verticalsp@pmb
    \fi
}
\makeatother

\begin{document}    
\begin{tabu}{Lcc}
$\begin{pmatrix}
1 \\2\\3    
\end{pmatrix}$& 2& 3\\
\end{tabu}

\end{document}
Related Question