2

Hi I was working on a Supplementary Table and happen to have very big values (order of tens of thousands) as well as very small values (third-fourth significant digit after zero) having to coexist in the same longtable environment.

As per this suggestion from Mico, I better go for two separate tables; however, I wanted to know whether a solution is available to have everything living in one environment.

Below the code (mostly from Mico) I slightly readapted it to fit the caption and avoid it to be repeated on the next page. If not possible to have one single table, would be feasible to remove the headers from the second table (see images) and has it as a continuation of the first? enter image description here enter image description here enter image description here

\documentclass[12pt]{report}
\usepackage[T1]{fontenc}
\usepackage[letterpaper,margin=1in]{geometry}

\usepackage{longtable,booktabs,siunitx}

\providecommand\tnd{{--}}
\providecommand\mc[1]{\multicolumn{1}{c}{#1}}
\newcommand{\bcaption}[2]{\caption[\textbf{#1}]{\textbf{#1} #2}}

\begin{document}

\begingroup
\footnotesize
\setlength\tabcolsep{0pt}
\setlength\LTleft{0pt}
\setlength\LTright{0pt}
\sisetup{group-minimum-digits=4}

\begin{longtable}{
    @{\extracolsep{\fill}}
        l  
        *{2}{S[table-format= 5.0]
             S[table-format= 5.0]
             S[table-format=-1.2, table-space-text-post=\%]<{\%}
             S[table-format= 5.0]
             S[table-format= 6.0]}
}

\bcaption{Short caption}{Long caption.}
\label{table:param_est-2} \\

\toprule
& \multicolumn{10}{c}{Approach} \\
\cmidrule{2-11}
& \multicolumn{5}{c}{Linear reference}  
& \multicolumn{5}{c}{Pangenome graph} \\
\cmidrule{2-6} \cmidrule{7-11}
& {\textit{exp}} & {\textit{med}} & \mc{$R^2$} & {\textit{MinQ}} & {\textit{MaxQ}} 
& {\textit{exp}} & {\textit{med}} & \mc{$R^2$} & {\textit{MinQ}} & {\textit{MaxQ}} \\
\cmidrule{2-11}
\endhead

\midrule
\multicolumn{11}{r}{(table continued on next page)}\\
\endfirsthead % prevent caption to be repeated

\bottomrule
\endlastfoot

nAR & 2555 & 2527 & 86.30 & 2335 & 2902 & 2495 & 2432 & 86.30 & 2304 & 2886 \\
nAFR & 29247 & 29321 & 59.50 & 9338 & 48364 & 30250 & 30836 & 59.50 & 10086 & 47949 \\
nG1 & 21615 & 20035 & 6.47 & 1407 & 45583 & 20695 & 19127 & 6.47 & 1046 & 45266 \\
nG2 & 21615 & 19569 & 13.88 & 997 & 47504 & 21391 & 19116 & 13.88 & 803 & 46953 \\
nBE & 25837 & 26073 & -1.28 & 2284 & 47676 & 25644 & 25645 & -1.28 & 2244 & 47876 \\
nEUR & 18824 & 12674 & 38.45 & 2117 & 45728 & 18574 & 12452 & 38.45 & 1789 & 44654 \\
nCEA & 30985 & 31087 & 49.41 & 11954 & 48772 & 28813 & 29113 & 49.41 & 9025 & 47363 \\
nPAP & 13278 & 10605 & 60.58 & 3712 & 35011 & 14031 & 10917 & 60.58 & 4121 & 35112 \\
nAFR-G1/BE/G2 & 27808 & 26002 & 93.57 & 17564 & 43458 & 25815 & 23931 & 93.57 & 16429 & 41473 \\
nN-NR & 2194 & 2151 & 94.50 & 1898 & 2706 & 2495 & 2429 & 94.50 & 2027 & 2901 \\
nD-D1/2 & 22918 & 19979 & 35.39 & 2513 & 48300 & 25192 & 24594 & 35.39 & 2731 & 48524 \\
nD-N & 17098 & 12169 & 43.85 & 2918 & 43354 & 16834 & 12423 & 43.85 & 2885 & 41932 \\
nAR-D-N & 19197 & 16445 & 22.00 & 1924 & 45600 & 18903 & 16445 & 22.00 & 1890 & 44981 \\
nAR-M & 23054 & 23128 & 99.80 & 19655 & 26341 & 19148 & 18975 & 99.80 & 16653 & 22435 \\
tdAFR-G1 & 97428 & 96736 & 50.95 & 56437 & 139325 & 94479 & 91173 & 50.95 & 55451 & 137513 \\
tdAFR-G2 & 94122 & 90719 & 50.93 & 55657 & 138184 & 95821 & 91886 & 50.93 & 56422 & 138758 \\
tdOA1 & 62685 & 57826 & 46.18 & 45729 & 96452 & 58110 & 54272 & 46.18 & 45663 & 90268 \\
tOAbot1 & 60630 & 54566 & 46.09 & 43497 & 93941 & 55656 & 51883 & 46.09 & 42971 & 85418 \\
tdOA2 & 49041 & 46917 & 24.25 & 40837 & 63729 & 47796 & 46030 & 24.25 & 40525 & 60121 \\
tOAbot2 & 46734 & 44773 & 24.22 & 37999 & 62973 & 45749 & 43668 & 24.22 & 37920 & 59744 \\
tdG2-BE & 73268 & 66597 & 22.40 & 50387 & 117577 & 72338 & 65073 & 22.40 & 50455 & 111864 \\
tdEUR-CEA & 38696 & 37550 & 11.25 & 30900 & 52793 & 37609 & 36408 & 11.25 & 30728 & 49491 \\
taD2-CEA & 30035 & 28725 & 1.79 & 20541 & 45124 & 29038 & 27876 & 1.79 & 20859 & 40769 \\
taBE-EUR & 24468 & 23277 & 0.87 & 11001 & 43495 & 24042 & 23406 & 0.87 & 11101 & 39080 \\
taD1-PAP & 44550 & 43098 & 17.72 & 31204 & 65179 & 43254 & 41473 & 17.72 & 31478 & 62175 \\
taAR-PAP & 52415 & 49013 & 33.25 & 37303 & 80960 & 49523 & 46828 & 33.25 & 36939 & 71169 \\
taN-EUR-CEA & 42778 & 40926 & 18.74 & 33088 & 56748 & 41427 & 39956 & 18.74 & 33298 & 55674 \\
taN-G2 & 52918 & 50734 & 30.19 & 43033 & 71761 & 51816 & 49771 & 30.19 & 42818 & 68086 \\

\end{longtable}

\sisetup{group-digits=none}
\begin{longtable}{
    @{\extracolsep{\fill}}
        l  
        *{2}{S[table-format= 1.4]
             S[table-format= 1.4]
             S[table-format=-1.2, table-space-text-post=\%]<{\%}
             S[table-format= 1.4]
             S[table-format= 1.4]}
}

\toprule
& \multicolumn{10}{c}{Approach} \\
\cmidrule{2-11}
& \multicolumn{5}{c}{Linear reference}  
& \multicolumn{5}{c}{Pangenome graph} \\
\cmidrule{2-6} \cmidrule{7-11}
& {\textit{exp}} & {\textit{med}} & \mc{$R^2$} & {\textit{MinQ}} & {\textit{MaxQ}} 
& {\textit{exp}} & {\textit{med}} & \mc{$R^2$} & {\textit{MinQ}} & {\textit{MaxQ}} \\
\cmidrule{2-11}
\endfirsthead

%keeps format consistent between the two tables
%\multicolumn{11}{l}{(table continued from preceding page)}\\
%\addlinespace
%\toprule
%\endhead

\midrule
\multicolumn{11}{r}{(table continued on next page)}\\
\endfoot

\bottomrule
\endlastfoot

rPAP & 0.0170 & 0.0132 & 10.55 & 0.0103 & 0.0327 & 0.0194 & 0.0132 & 10.55 & 0.0104 & 0.0346 \\
rEUR-CEA & 0.0194 & 0.0140 & 5.76 & 0.0103 & 0.0386 & 0.0183 & 0.0133 & 5.76 & 0.0103 & 0.0392 \\
paD2-CEA & 0.0510 & 0.0519 & -1.23 & 0.0075 & 0.0948 & 0.0515 & 0.0517 & -1.23 & 0.0073 & 0.0953 \\
paBE-EUR & 0.2775 & 0.2879 & -1.18 & 0.0756 & 0.4675 & 0.2768 & 0.2813 & -1.18 & 0.0694 & 0.4824 \\
paD1-PAP & 0.0539 & 0.0533 & -1.22 & 0.0071 & 0.0973 & 0.0521 & 0.0523 & -1.22 & 0.0089 & 0.0949 \\
paAR-PAP & 0.0528 & 0.0541 & -1.19 & 0.0055 & 0.0958 & 0.0522 & 0.0528 & -1.19 & 0.0066 & 0.0965 \\
paN-EUR-CEA & 0.0489 & 0.0473 & -1.23 & 0.0046 & 0.0943 & 0.0482 & 0.0452 & -1.23 & 0.0047 & 0.0953 \\
paN-G2 & 0.0510 & 0.0529 & -1.13 & 0.0057 & 0.0944 & 0.0526 & 0.0539 & -1.13 & 0.0057 & 0.0956 \\
m78 & 0.0005 & 0.0005 & 17.87 & 0.0000 & 0.0009 & 0.0005 & 0.0005 & 17.87 & 0.0001 & 0.0009 \\
m87 & 0.0005 & 0.0005 & -0.75 & 0.0000 & 0.0009 & 0.0005 & 0.0006 & -0.75 & 0.0001 & 0.0009 \\
m810 & 0.0005 & 0.0005 & 3.59 & 0.0001 & 0.0009 & 0.0005 & 0.0005 & 3.59 & 0.0001 & 0.0010 \\
m108 & 0.0004 & 0.0004 & 4.04 & 0.0000 & 0.0009 & 0.0005 & 0.0005 & 4.04 & 0.0000 & 0.0009 \\
m1011 & 0.0005 & 0.0006 & -0.19 & 0.0001 & 0.0010 & 0.0006 & 0.0006 & -0.19 & 0.0001 & 0.0010 \\
m1110 & 0.0003 & 0.0003 & 26.86 & 0.0000 & 0.0009 & 0.0003 & 0.0003 & 26.86 & 0.0000 & 0.0009 \\
m1112 & 0.0005 & 0.0005 & 18.87 & 0.0000 & 0.0010 & 0.0006 & 0.0006 & 18.87 & 0.0000 & 0.0010 \\
m1211 & 0.0006 & 0.0007 & 21.04 & 0.0001 & 0.0010 & 0.0007 & 0.0007 & 21.04 & 0.0001 & 0.0010 \\
m1213 & 0.0001 & 0.0001 & 36.13 & 0.0000 & 0.0004 & 0.0001 & 0.0001 & 36.13 & 0.0000 & 0.0005 \\
m1312 & 0.0003 & 0.0003 & 40.14 & 0.0000 & 0.0009 & 0.0004 & 0.0003 & 40.14 & 0.0000 & 0.0009 \\
m1\textunderscore1011 & 0.0005 & 0.0005 & -0.99 & 0.0001 & 0.0010 & 0.0006 & 0.0006 & -0.99 & 0.0001 & 0.0010 \\
m1\textunderscore1110 & 0.0005 & 0.0005 & 1.39 & 0.0001 & 0.0009 & 0.0005 & 0.0005 & 1.39 & 0.0000 & 0.0009 \\
m1\textunderscore1113 & 0.0005 & 0.0005 & 1.39 & 0.0001 & 0.0009 & 0.0005 & 0.0005 & 1.39 & 0.0001 & 0.0010 \\
m1\textunderscore1311 & 0.0005 & 0.0005 & 0.72 & 0.0000 & 0.0009 & 0.0005 & 0.0004 & 0.72 & 0.0000 & 0.0009 \\
\end{longtable}
\endgroup

\end{document}
2
  • Are you asking how to specify a column type that will display all numbers except those in the R^2 column -- whether they be 4- to 6-digits integers or decimals with up to 4 digits -- using a single "scientific notation" format? E.g., 29247 would be displayed as 2.946E5, whereas 0.0170 would be displayed as 1.7E-2, where "E" could be "10^". Please advise.
    – Mico
    Commented Jul 24 at 11:57
  • 1
    @Mico all correct, with the exception that I wish to preserve numbers in the thousand range as they are displayed e.g. 29247 with the conventional S[table-format=5.0] while only decimal numbers are in scientific format (ideally 10^). Then, have the latter aligned with the first unit of the thousand range as in the previous solution. Thanks again!
    – Matteo
    Commented Jul 24 at 12:18

0

You must log in to answer this question.

Browse other questions tagged .