[Tex/LaTex] Missing number, treated as zero with nested tabu

colortabu

I have this minimal example:

\documentclass{article}
\usepackage{colortbl}
\usepackage{longtable}
\usepackage{tabu}

\begin{document}

\begin{longtabu} {|ll|}
  a & \begin{tabu}{l}
    1 \\
    red 2 \\
  \end{tabu} \\
\end{longtabu}

\end{document}

Using pdflatex from texlive 20120628 on cygwin gives me this error:

! Missing number, treated as zero.
<to be read again>
               \tabu@1.H0
l.13 \end{longtabu}

If I leave out \usepackage{colortbl} the error is gone. Unfortunately my actual document is a lot larger and I need this package.

Using pdflatex from MiKTex 2.9 gives me no error.

Where does this error come from and how can I fix it? I need to be able to compile this document using texlive as well.

Best Answer

Hmm appears tabu doesn't want to nest. This works round it:

\documentclass{article}
\usepackage{colortbl}
\usepackage{longtable}
\usepackage{tabu}

\begin{document}

\newsavebox\grumble
\savebox\grumble{%
\begin{tabu}{l}
    1 \\
    red 2 \\
  \end{tabu}%
}

\begin{longtabu} {|ll|}
  a & \usebox{\grumble} \\
\end{longtabu}

\end{document}

enter image description here

Related Question