
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
新的 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}
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 節點)。