I'm trying to create two subtables with equal width (and horizontally aligned),
but the second table is getting rendered (pdflatex) smaller than the first one even with equal width specified. Changing the width of the second table shifted it to the right. Can someone help?
MWE:
\documentclass{scrartcl}
\usepackage{float}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{booktabs}
\begin{document}
\begin{table}[H]
\caption{\textbf{blabla.} bla.}\label{tblfoo}
\centering
\begin{subtable}[t]{\textwidth}
\centering
\caption{RefSeq-derived synthetic metagenome}
\begin{tabular}{@{}lrrrrr@{}}
& Kraken & Kaiju & Centrifuge & MetaPhlAn 2 & MGX \\
\midrule
TP & 12,059,412 & 9,329,288 & 12,611,380 & 414,943 & 12,566,362 \\
FP & 18,748 & 185,899 & 53,092 & 7,171 & 20,698 \\
FN & 1,281,840 & 3,844,813 & 695,528 & 12,937,886 & 772,940 \\
\midrule
Sensitivity & 0.9039 & 0.7082 & \textbf{0.9477} & 0.0311 & 0.9421 \\
Precision & \textbf{0.9984} & 0.9805 & 0.9958 & 0.9830 & \textbf{0.9984} \\
Accuracy & 0.9027 & 0.6983 & \textbf{0.9440} & 0.0311 & 0.9406 \\
F1 score & 0.9488 & 0.8224 & \textbf{0.9712} & 0.0602 & 0.9694 \\
\bottomrule
\end{tabular}
\end{subtable}
\vspace*{5mm}
\centering
\begin{subtable}[t]{\textwidth}
\centering
\caption{GenBank-derived synthetic metagenome}
\begin{tabular}{@{}lrrrrr@{}}
& Kraken & Kaiju & Centrifuge & MetaPhlAn 2 & MGX \\
\midrule
TP & 1,851,436 & 2,592,655 & 2,175,122 & 92,383 & 3,976,270 \\
FP & 398,899 & 1,230,445 & 864,989 & 10,378 & 734,389 \\
FN & 9,629,665 & 8,56,900 & 8,839,889 & 11,777,239 & 7,169,341 \\
\midrule
Sensitivity & 0.1613 & 0.2435 & 0.1975 & 0.0078 & \textbf{0.3568} \\
Precision & 0.8227 & 0.6782 & 0.7155 & \textbf{0.8990} & 0.8441 \\
Accuracy & 0.1558 & 0.2182 & 0.1831 & 0.0078 & \textbf{0.3347} \\
F1 score & 0.2697 & 0.3583 & 0.3095 & 0.0154 & \textbf{0.5015} \\
\bottomrule
\end{tabular}
\end{subtable}
\end{table}
\end{document}
Best Answer
I suggest you use
tabular*
instead oftabular
environments. In particular, you may want to set both widths to\textwidth
, as is done in the following example.