1

I have put a table inside a tcolorbox using this post by @Ignasi.

However, I am having trouble putting a footnote—or really any text—below the table. Whatever text I write after \end{tabular} is put to the RIGHT of the table, but I want this text to be BELOW the table.

If possible, I would like to keep the tcolorbox within a minipage, as I have found it easier to align 2 minipages than to align 2 tcolorboxs. (But maybe there is an easy way to align 2 tcolorboxs, and I am just ignorant of it.)

Any thoughts on how to get text that is written after the \end{tabular} command to appear BELOW the table?

\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}

Here is a screenshot of what I am getting currently:

enter image description here

Sam
  • 141

3 Answers3

2

First, turn off [collect=hbox]. All the minpage does is set the width. I put the "footnote" inside a \parbox to turn off the centering.

\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}

John Kormylo
  • 79,712
  • 3
  • 50
  • 120
  • Thank you.

    To be honest, I did not really understand the command [capture=hbox] when I included that command in my code. What does this command do?

    – Sam Nov 28 '23 at 00:03
  • It puts the contents into a single line of text. – John Kormylo Nov 28 '23 at 01:48
1

You can use \footnote, but without capture=hbox.

With minipage{0.33\linewidth], we have an Overfull \hbox of more than 97pt. You need 0.53\linewidth or reduce the widths of the table (you can also use the tabularx or tabularray packages)

\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}

enter image description here

pascal974
  • 4,652
0

You can use {NiceTabular} of nicematrix and its built-in command \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}

Output of the above code

F. Pantigny
  • 40,250