I'm having a problem with formatting a tcolorbox
so that it contains a table and its width fits the width of the table. A MWE of my code is as follows:
\documentclass{standalone}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{colortbl}
\usepackage{array}
\usepackage{tikz}
\usepackage{tcolorbox}
\tcbuselibrary{skins, breakable}
\begin{document}
\begin{tcolorbox}[skin = enhanced jigsaw, tabularx = {p{2cm}p{3cm}}, capture = hbox, breakable = false, title = {Test}, label = {test}, center]
\textbf{Column 1} & \textbf{Column 2}\tabularnewline\midrule
1 & 2\tabularnewline
3 & 4\tabularnewline
5 & 6\tabularnewline
\end{tcolorbox}
\end{document}
LuaLaTeX throws the following errors when trying to compile it:
Argument of \TX@get@body has an extra }. \end{tcolorbox}
Paragraph ended before \TX@get@body was complete. \end{tcolorbox}
Missing } inserted. \end{tcolorbox}
The same code compiles fine without the hbox
option but I can't seem to find any information on the incompatibility between it and tabularx
. Setting or unsetting explicit table column widths (e.g., with p
) has no effect. Please advise.
tabularx = {cc}
looks wrong, there should always be at least oneX
column otherwisetabularx
can do nothing useful. – David Carlisle Nov 15 '18 at 11:20