Использование makecell в табу: несовместимость с пакетами tcolorbox и todonotes

Использование makecell в табу: несовместимость с пакетами tcolorbox и todonotes

У меня возникла проблема при использовании пакета tabuс makecell и tcolorboxи todonotes. Вот мой минимальный пример кода:

\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}

Когда я исключаю строку с \makecell, все работает. Также, когда я исключаю пакеты todoи tcolorbox(и, конечно, строку с \todoкомандой, но сохраняю строку с \makecell), все работает.

Проблема возникает, когда я включаю хотя бы один из пакетов tcolorboxили todonotes. Затем я получаю следующую ошибку:

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

Также решение оттабу: Ошибка после обновленияне помогло.

Кто-нибудь знает, как это исправить?

Вот первая строка файла журнала:

Это pdfTeX, версия 3.14159265-2.6-1.40.19 (TeX Live 2018) (предварительно загруженный формат=pdflatex)

решение1

Новый пакет LaTeX3tabularrayявляется альтернативой устаревшему tabuпакету:

\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}

введите описание изображения здесь

решение2

Вот что можно сделать с помощью {NiceTabular}of nicematrix(совместимо с tcolorboxи 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}

Вам нужно несколько компиляций (т.к. nicematrixвнутри используются узлы PGF/Tikz).

Вывод кода выше

Связанный контент