在 tcolorbox 中的表格中添加脚注

在 tcolorbox 中的表格中添加脚注

我已经使用 tcolorbox 放置了一个表格由@Ignasi 发布。

但是,我无法在表格下方放置脚注(或任何文本)。无论我之后写什么文本,\end{tabular}都会放在表格的右侧,但我希望此文本位于表格下方。

如果可能的话,我希望将 tcolorbox 保留在 minipage 内,因为我发现对齐 2 个 minipage 比对齐 2 个 tcolorbox 更容易。(但也许有一种简单的方法可以对齐 2 个 tcolorbox,而我只是不知道。)

关于如何让\end{tabular}命令后写的文本出现在表格下方,您有什么想法吗?

\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{booktabs}
\usepackage[left=19mm, right=19mm,top=18mm,bottom=18mm,includehead=true]{geometry}
\usepackage{caption}
\usepackage{tcolorbox, varwidth}
\tcbuselibrary{theorems}
\tcbuselibrary{skins}

\newtcolorbox[blend into=tables]{TableStyle1}[2][]{title={#2}, before upper=\centering, #1}    

\begin{document}




Some introductory text....


\begin{minipage}{0.33\textwidth}
\begin{TableStyle1}[capture=hbox, colback=white, colframe=blue!15, coltitle=black, fonttitle=\bfseries]{Proposed frequency of CT scans}
\setlength{\extrarowheight}{4mm}
\renewcommand{\tabcolsep}{3mm}
\begin{tabular}{m{24mm} m{24mm} m{16mm}}

Date & Scan & mSv \\
\midrule
early Jan 2024 & CT CAP & 24 mSv \\
May 2024 & CT AP | CXR & 16 mSv \\
Nov 2024 & CT AP | CXR & 16 mSv\\
Aug 2025 & CT CAP & 24 mSv \\
Aug 2026 & CT AP | CXR & 16 mSv \\
Aug 2027 & CT AP | CXR & 16 mSv\\
Aug 2028 & CT AP | CXR & 16 mSv \\
\textbf{TOTAL*}& & \textbf{176 mSv} \\
\end{tabular}
*This total includes the 48 mSv already obtained from previous scans.
\end{TableStyle1}
\vspace{5mm}
\end{minipage}


Some more text....

\end{document}

这是我当前得到的屏幕截图:

在此处输入图片描述

答案1

首先,关闭[collect=hbox]。minpage 所做的只是设置宽度。我将“脚注”放在里面\parbox以关闭居中。

\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{booktabs}
\usepackage[left=19mm, right=19mm,top=18mm,bottom=18mm,includehead=true]{geometry}
\usepackage{caption}
\usepackage{tcolorbox, varwidth}
\tcbuselibrary{theorems}
\tcbuselibrary{skins}

\newtcolorbox[blend into=tables]{TableStyle1}[2][]{title={#2}, before upper=\centering, #1}    

\begin{document}




Some introductory text....


\begin{minipage}{0.5\textwidth}% set width of title
\begin{TableStyle1}[colback=white, colframe=blue!15, coltitle=black, fonttitle=\bfseries]{Proposed frequency of CT scans}
\setlength{\extrarowheight}{4mm}
\renewcommand{\tabcolsep}{3mm}
\begin{tabular}{m{24mm} m{24mm} m{16mm}}

Date & Scan & mSv \\
\midrule
early Jan 2024 & CT CAP & 24 mSv \\
May 2024 & CT AP | CXR & 16 mSv \\
Nov 2024 & CT AP | CXR & 16 mSv\\
Aug 2025 & CT CAP & 24 mSv \\
Aug 2026 & CT AP | CXR & 16 mSv \\
Aug 2027 & CT AP | CXR & 16 mSv\\
Aug 2028 & CT AP | CXR & 16 mSv \\
\textbf{TOTAL*}& & \textbf{176 mSv} \\
%\bottomrule
\end{tabular}
\par\medskip
%\hrule% show available space
\parbox{\textwidth}{% turn off centering
*This total includes the 48 mSv already obtained from previous scans.}
\end{TableStyle1}
\vspace{5mm}
\end{minipage}


Some more text....

\end{document}

答案2

您可以使用\footnote,但不用capture=hbox

使用minipage{0.33\linewidth],我们有一个Overfull \hbox超过 97pt 的宽度。您需要0.53\linewidth或减少表格的宽度(您也可以使用tabularxtabularray包)

\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{booktabs}
\usepackage[left=19mm, right=19mm,top=18mm,bottom=18mm,includehead=true]{geometry}
\usepackage{caption}
\usepackage{tcolorbox, varwidth}
\tcbuselibrary{theorems}
\tcbuselibrary{skins}

\newtcolorbox[blend into=tables]{TableStyle1}[2][]{title={#2}, before upper=\centering, #1}    
\begin{document}
Some introductory text....

\begin{minipage}{0.53\linewidth}%<-- this line
\begin{TableStyle1}[colback=white, colframe=blue!15, coltitle=black, fonttitle=\bfseries]{Proposed frequency of CT scans}
\setlength{\extrarowheight}{4mm}
\renewcommand{\tabcolsep}{3mm}
\begin{tabular}{m{24mm} m{24mm} m{16mm}}

Date & Scan & mSv \\
\midrule
early Jan 2024 & CT CAP & 24 mSv \\
May 2024 & CT AP | CXR & 16 mSv \\
Nov 2024 & CT AP | CXR & 16 mSv\\
Aug 2025 & CT CAP & 24 mSv \\
Aug 2026 & CT AP | CXR & 16 mSv \\
Aug 2027 & CT AP | CXR & 16 mSv\\
Aug 2028 & CT AP | CXR & 16 mSv \\
\textbf{TOTAL\footnote{This total includes the 48 mSv already obtained from previous scans.}}& & \textbf{176 mSv} \\
\end{tabular}
\end{TableStyle1}
\vspace{5mm}
\end{minipage}%

Some more text....
\end{document}

在此处输入图片描述

答案3

您可以使用{NiceTabular}及其nicematrix内置命令\tabularnote

\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{booktabs}
\usepackage[left=19mm, right=19mm,top=18mm,bottom=18mm,includehead=true]{geometry}
\usepackage{caption}
\usepackage{tcolorbox, varwidth}
\tcbuselibrary{theorems}
\tcbuselibrary{skins}

\usepackage{nicematrix}
\usepackage{enumitem}

\newtcolorbox[blend into=tables]{TableStyle1}[2][]{title={#2}, before upper=\centering, #1}    
\begin{document}
Some introductory text....

\begin{minipage}{0.53\linewidth}%<-- this line
\begin{TableStyle1}[capture=hbox,colback=white, colframe=blue!15, coltitle=black, fonttitle=\bfseries]{Proposed frequency of CT scans}
\setlength{\extrarowheight}{4mm}
\renewcommand{\tabcolsep}{3mm}
\begin{NiceTabular}{m{24mm} m{24mm} m{16mm}}

Date & Scan & mSv \\
\midrule
early Jan 2024 & CT CAP & 24 mSv \\
May 2024 & CT AP | CXR & 16 mSv \\
Nov 2024 & CT AP | CXR & 16 mSv\\
Aug 2025 & CT CAP & 24 mSv \\
Aug 2026 & CT AP | CXR & 16 mSv \\
Aug 2027 & CT AP | CXR & 16 mSv\\
Aug 2028 & CT AP | CXR & 16 mSv \\
\textbf{TOTAL\tabularnote{This total includes the 48 mSv already obtained from previous scans.}}& & \textbf{176 mSv} \\
\end{NiceTabular}
\end{TableStyle1}
\vspace{5mm}
\end{minipage}%

Some more text....
\end{document}

上述代码的输出

相关内容