My tables have subtables, for which I'm using tabularx
. To add footnote to the subtables, I'm using threeparttable
. But the numbering is all messed up. (Without threeparttable
, this issue is gone.) According to my research, this link seems to be the closest, but wasn't helpful for me. Can anyone help please? Here is my cold:
\documentclass[12pt]{article}
\usepackage{array, boldline}
\newcolumntype{Q}{>{\centering\arraybackslash}X}
\usepackage{booktabs}
\usepackage{subcaption}
\usepackage{tabularx}
\usepackage{threeparttable}
\begin{document}
Table \ref{tab:US} is the demand and supply in the U.S. with tables \ref{tab:A-US} and \ref{tab:B-US} for market A and B in the U.S.
\begin{table}
\caption{Demand and Supply in the U.S.} \label{tab:US}
\begin{threeparttable}
\centering
\begin{subtable}{0.8\textwidth}
\caption{Market A} \label{tab:A-US}
\begin{tabularx}{\textwidth}{QQQ}
\toprule
Price & Demand & Supply \\
\cmidrule{2-3}
35\tnote{a} & 230 & 940 \\
30 & 410 & 750 \\
\bottomrule
\end{tabularx}
\end{subtable}\qquad
\begin{subtable}{0.8\textwidth}
\caption{Market B} \label{tab:B-US}
\begin{tabularx}{\textwidth}{QQQ}
\toprule
Price & Demand & Supply \\
\cmidrule{2-3}
35 & 300 & 800 \\
30 & 500 & 650 \\
\bottomrule
\end{tabularx}
\end{subtable}
\begin{tablenotes}
\footnotesize
\item[a] This is a price.
\end{tablenotes}
\end{threeparttable}
\end{table}
Table \ref{tab:canada} is the demand and supply in Canada with tables \ref{tab:A-canada} and \ref{tab:B-canada} for market A and B in Canada.
\begin{table}
\caption{Demand and Supply in Canada} \label{tab:canada}
\begin{threeparttable}
\centering
\begin{subtable}{0.8\textwidth}
\caption{Market AA} \label{tab:A-canada}
\begin{tabularx}{\textwidth}{QQQ}
\toprule
Price & Demand & Supply \\
\midrule
35\tnote{a} & 200 & 900 \\
30 & 400 & 750 \\
\bottomrule
\end{tabularx}
\end{subtable}\qquad
\begin{subtable}{0.8\textwidth}
\caption{Market BB} \label{tab:B-canada}
\begin{tabularx}{\textwidth}{QQQ}
\toprule
Price & Demand & Supply \\
\midrule
35 & 300 & 800 \\
30 & 500 & 650 \\
\bottomrule
\end{tabularx}
\end{subtable}
\begin{tablenotes}
\footnotesize
\item[a] This is a price.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}