tcolorbox longtabu breakable 不重复标题

tcolorbox longtabu breakable 不重复标题

tabu我在环境中制作了一个长表tcolorbox,但我无法在第二页重复标题:

我尝试过endfirsthead

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[frenchb]{babel}
\usepackage{microtype}
\usepackage{datatool}
\usepackage{filecontents}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{tcolorbox}
\usepackage{colortbl}

\tcbuselibrary{skins, hooks, breakable}

\begin{document}

\begin{filecontents*}{mydata3.csv}
  A;B;C;D
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
  a1;b1;c1;d1
  a2; "b21 and b22";c2;d2
\end{filecontents*}

\shorthandoff{;}\DTLsetseparator{;}
\begin{tcolorbox}[enhanced, fontupper=\scriptsize,
  title=Titre,
  colframe=black!20,
  boxsep=0pt, rightupper=0pt, leftupper=0pt, toptitle=1mm,
  breakable,
  bottomtitle=1mm, top=0pt, bottom=0pt]

  \DTLloaddb{mydata3}{mydata3.csv}
  \begin{longtabu}{X[1,l,m]|X[5,l,m]|X[1,l,m]|X[5,l,m]}
    \rowcolor{red}
    \color{white}AA&
    \color{white}BB &
    \color{white}CC&
    \color{white}DD\endfirsthead
    \rowcolor{red}
    \color{white}AA&
    \color{white}BB &
    \color{white}CC&
    \color{white}DD\endhead
    \DTLforeach{mydata3}{%
      \A=A, \B=B, \C=C, \D=D}{%
      \DTLiffirstrow{}{\\}
      \A & \B & \C & \D}
  \end{longtabu}
\shorthandon{;}

\end{tcolorbox}
\end{document}

在此处输入图片描述

相关内容