[Tex/LaTex] Multipage table using tcolorbox and tabularx

tabularxtcolorbox

Good day, Sirs and Madams!

I am experiencing issues while composing a big table over several pages. I'd like to use tcolorbox in combination with tabularx. Unfortunately, this does not work out as expected.

It would be great if someone could help me out how to achieve a table using the stated design that stretches over several pages.

Here's the MWE:

\documentclass{article}
\usepackage{blindtext}
\usepackage{tcolorbox}
\tcbuselibrary{breakable}
\usepackage{caption}
\usepackage{array,tabularx}
\usepackage{colortbl} 
\begin{document}

\begin{figure}
\tcbset{ before=,
            after=\hfil,
            size=small,
            fonttitle=\bfseries\normalsize, 
            fontupper=\small, 
            fontlower=\small, 
            center title}
\begin{tcolorbox}[tabularx*={
\arrayrulewidth 0.5mm}{X|X|X},title=Test]
\emph{A} & \emph{B} & \emph{C}
\\\hline
A & B & C \\
\blindtext[150] & \blindtext[150] & \blindtext[150] \\
\hline
\end{tcolorbox}
\caption{Test}
\label{fig:Test}
\end{figure}
\end{document}

Any help or hints are well appreciated.

I've tried using the [breakable] option from \tcbuselibrary{breakable} but wihtout any luck.

Best Answer

Here is my addition to David Carlisle's answer. I sorted things a little bit different and added some options which might be useful. Especially, the right edge problem is resolved and the caption put into the title.

enter image description here

Here is the code:

\documentclass{article}
\usepackage{blindtext}
\usepackage{tcolorbox}
\tcbuselibrary{breakable,skins}
\usepackage{caption}
\usepackage{array,tabularx,longtable}
\usepackage{colortbl,lipsum}
\usepackage[margin=2cm]{geometry}
\begin{document}

\begin{tcolorbox}[
  breakable=true,
  enhanced jigsaw,
  size=small,
  fonttitle=\bfseries\normalsize,
  fontupper=\small,
  fontlower=\small,
  center title,
  title={\captionsetup{skip=0pt}\captionof{table}{Test}},
  colbacktitle=blue!10,
  colframe=blue!50!black,
  colback=yellow!10,
  label=fig:Test
  ]
\def\LTpre{0pt}%
\begin{longtable}{
@{\extracolsep{\fill}}
>{\raggedright}p{.3\linewidth}|
>{\raggedright}p{.3\linewidth}|
>{\raggedright}p{.3\linewidth}
@{}}
\emph{A} & \emph{B} & \emph{C}\tabularnewline\hline
A & B & C \tabularnewline
\blindtext[1] & \blindtext[1] & \blindtext[1] \tabularnewline
\blindtext[1] & \blindtext[1] & \blindtext[1] \tabularnewline
\blindtext[1] & \blindtext[1] & \blindtext[1] \tabularnewline
\blindtext[1] & \blindtext[1] & \blindtext[1] \tabularnewline
\blindtext[1] & \blindtext[1] & \blindtext[1] \tabularnewline
\blindtext[1] & \blindtext[1] & \blindtext[1] \tabularnewline
\blindtext[1] & \blindtext[1] & \blindtext[1] \tabularnewline
\blindtext[1] & \blindtext[1] & \blindtext[1] \tabularnewline
\end{longtable}
\end{tcolorbox}

\end{document}
Related Question