Tabu での makecell の使用: パッケージ tcolorbox および todonotes との非互換性

Tabu での makecell の使用: パッケージ tcolorbox および todonotes との非互換性

tabumakecell および で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または の少なくとも 1 つのパッケージを含めると、問題が発生しますtodonotes。その後、次のエラーが発生しました。

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

また、解決策としてはtabu: アップデート以降のエラー役に立たなかった。

これを修正する方法を知っている人はいますか?

ログファイルの最初の行は次のとおりです。

これは pdfTeX、バージョン 3.14159265-2.6-1.40.19 (TeX Live 2018) です (プリロードされた形式 = pdflatex)

答え1

新しいLaTeX3パッケージtabularray古くなったパッケージの代替品です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}を使用して実行できる操作は次のとおりです。nicematrixtcolorboxtodonotes

\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 ノードが使用されるため)。

上記コードの出力

関連情報