3

I have a problem when using the package tabu with makecell and tcolorbox and todonotes. This is my minimal example code:

\documentclass[a4paper]{scrreprt}
\usepackage{tcolorbox}
\usepackage{todonotes}
\usepackage{tabu,makecell}
\begin{document}
\noindent \begin{tabu} to \textwidth {@{}lXX}
normal line & A & B \\
line with makecell & \makecell[tl]{A\\C} & \makecell[tl]{B\\D\\E}
\end{tabu}
\todo{To Do: ...}
\end{document}

When I exclude the line with \makecell, everything works. Also when I exclude the packages todo and tcolorbox (and of course, the line with \todo command, but keep the line with \makecell), everything works.

The problem occurs when I include at least one of the packages tcolorbox or todonotes. Then I got the following error:

./test-tabu.tex:9: Improper \prevdepth.
\tabu@verticalspacing ...tempdimc \the \prevdepth 
                                              \@tempdima \dimexpr \ht 
\t...
l.9 \end{tabu}

Also the solution from tabu: Error since update didn't help.

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 (TeX Live 2018) (preloaded format=pdflatex)

Sebastiano
  • 54,118
nr87
  • 31

2 Answers2

1

The new LaTeX3 package tabularray is an alternative to the outdated tabu package:

\documentclass[a4paper]{scrreprt}

\usepackage{tcolorbox} \usepackage{todonotes} \usepackage{tabularray}

\begin{document}

\noindent \begin{tblr}{ width = \textwidth, colspec = {@{}lXX}, } normal line & A & B \ line with makecell & \SetCell{t,l}{A\C} & \SetCell{t,l}{B\D\E} \ \end{tblr} \todo{To Do: ...}

\end{document}

enter image description here

L.J.R.
  • 10,932
0

Here is what you can do with {NiceTabular} of nicematrix (compatible with tcolorbox and todonotes).

\documentclass[a4paper]{scrreprt}

\usepackage{tcolorbox} \usepackage{todonotes} \usepackage{nicematrix}

\begin{document}

\noindent \begin{NiceTabular}{@{}lXX} normal line & A & B \ line with makecell & \Block[t,l]{}{A\C} & \Block[t,l]{}{B\D\E} \ \end{NiceTabular}

\bigskip \todo{To Do: ...}

\end{document}

You need several compilations (because nicematrix uses PGF/Tikz nodes under the hood).

Output of the above code

F. Pantigny
  • 40,250