1

I would like to know how to reduce the size of this table, since it is larger than the text width on one page. Or should I fix the width of each column? If yes how?

\begin{document}

\begin{table}[!htbp]
  \centering
\caption{Comparison of the CCSHR estimators based on beta and logit-normal distributions}
\begin{tabular}{c|ccc|ccc}
\toprule
   & \multicolumn{3}{c|}{pH 1.4} & \multicolumn{3}{c}{pH 2.2} \\
\midrule
 & \multicolumn{1}{c}{\textit{N}$_{\text{max}}$ (nm)} & {\textit{C}$_{\text{D}}$\textsuperscript{'}} (µM)& \textit{D} & \textit{A}$_{\text{max}}$ (µm) & \textit{D}$_{\text{D}}$\textsuperscript{'} (µm) & \textit{A} \\
\\[-1em]
{Molecule AB} & \multicolumn{1}{c}{2.0 ± 0.2} & {7.9 ± 0.6} & {4.7 ± 0.1} & {7.8 ± 0.3} & {26 ± 6} & {0.87 ± 0.09} \\
{Molecule C} & \multicolumn{1}{c}{9.2 ± 0.2} & {25.9 ± 1.4} & {2.07 ± 0.04} & {1.8 ± 0.3} & {70 ± 5} & {0.19 ± 0.06} \\
%\bottomrule
\hline 
\end{tabular}
\label{tab:addlabel}
\end{table}

tex tex tex text tex tex tex t ex text text  tex tex tex text tex tex tex t ex text text tex tex tex text tex tex tex t ex text text tex tex tex text tex tex tex t ex text text 

\end{document}

Result

I solve it while adding this line command: \setlength{\tabcolsep}{.085cm}

However I have a discontinued vertical line before column Amax. Do you know how to fix it?enter image description here

  • 2
    Please post code as code and not as image. Use the {} button to format it here. – TeXnician Jul 3 '17 at 17:55
  • @koleygr The link I've posted treats all table dimensions, especially width... At least the first point of the answer is called "1. My table/tabular is too wide. What can I do to make it fit?" – TeXnician Jul 3 '17 at 18:05
  • I mean this: tex.stackexchange.com/questions/97505/… the prevous was alread a duplicate – koleygr Jul 3 '17 at 18:05
  • @TeXnician.. ok...Sorry. Didn't realize on time! – koleygr Jul 3 '17 at 18:06
  • I found a way to fix it: \setlength{\tabcolsep}{.085cm} – Mathy Jul 4 '17 at 8:26
1

The problem with the gap in the vertical line is caused by \\[-1em].


My suggestion is redo the table a bit and remove all the vertical lines:

\documentclass{article}

\usepackage{booktabs}
\usepackage{amsmath}
\usepackage[separate-uncertainty=true]{siunitx}

\begin{document}

\begin{table}[!htbp]
  \centering
    \caption{Comparison of the CCSHR estimators based on beta and logit-normal distributions}
    \label{tab:addlabel}
    \setlength{\tabcolsep}{.12cm}
    \begin{tabular}{
        @{}
        l
        @{\hspace*{0.25cm}}
        S[table-format = 1.1(2)]
        S[table-format = 2.1(2)]
        S[table-format = 1.2(2)]
        @{\hspace*{0.25cm}}
        S[table-format = 1.1(2)]
        S[table-format = 2.0(2)]
        S[table-format = 1.2(2)]
        @{}
    }
        \toprule
      & \multicolumn{3}{c}{pH 1.4} 
      & \multicolumn{3}{c}{pH 2.2} \\\addlinespace
%       \cmidrule(l{0cm}r{0.25cm}){2-4}\cmidrule(r{-0.0cm}l{0cm}){5-7}
        & {$N_{\text{max}}$(\si{nm})} 
        & {$C_{\text{D}}'$(\si{\mu M})}
        & {\textit{D}} 
        & {$A_{\text{max}}$(\si{\mu m})}
        & {$D_{\text{D}}'$(\si{\mu m})}
        & {\textit{A}} \\
        \cmidrule(l{0cm}r{0.25cm}){2-4}\cmidrule(r{-0.0cm}l{0cm}){5-7}
        Mol.\ AB & 2.0 +- 0.2 & 7.9 +- 0.6 & 4.7 +- 0.1 & 7.8 +- 0.3 & 26 +- 6 & 0.87 +- 0.09 \\
        Mol.\ C & 9.2 +- 0.2 & 25.9 +- 1.4 & 2.07 +- 0.04 & 1.8 +- 0.3 & 70 +- 5 & 0.19 +- 0.06 \\
        \bottomrule
    \end{tabular}
\end{table}

tex tex tex text tex tex tex t ex text text  tex tex tex text tex tex tex t ex text text tex tex tex text tex tex tex t ex text text tex tex tex text tex tex tex t ex text text 

\end{document}

enter image description here

  • (+1) my excuse for almost the same answer: me and my internet connection are on vacation, so all here is very slow (connection, reaction time, my typing ...), so didn't observe your answer before send mine. (!1:0 for you) – Zarko Jul 4 '17 at 15:32
  • @Zarko Don't worry, I think you using tabularx is already enough difference to justify a separate answer. Wish you a nice vacation! – user36296 Jul 4 '17 at 15:34
1

without knowing anything bout your page layout (your provided code hasn't preamble!) is hard to say anything what can be cure for your problem. For example with preamble

\documentclass{article}
\usepackage[margin=30mm]{geometry}

works fine. Consequently the most of my answer is dedicated to off-topic issues:

\documentclass{article}
\usepackage{booktabs, tabularx}
\usepackage{siunitx}

\usepackage{amsmath}
\usepackage{caption}

 \usepackage{lipsum}

\begin{document}
    \begin{table}[!htbp]
\sisetup{separate-uncertainty=true}
\setlength\tabcolsep{2.5pt}
\centering
    \caption{Comparison of the CCSHR estimators based on beta and logit-normal distributions}
\sisetup{separate-uncertainty=true}
\setlength\tabcolsep{2.5pt}
\begin{tabularx}{\linewidth}{@{}
                  >{\raggedright}X 
                                 S[table-format=1.1(1)]
                                 S[table-format=2.1(1)]
                                 S[table-format=1.2(1)]
%
                                 S[table-format=1.1(1)]
                                 S[table-format=2.0(1)]
                                 S[table-format=1.2(1)]
                        @{}}
    \toprule
   &    \multicolumn{3}{c}{pH 1.4} 
        &   \multicolumn{3}{c}{pH 2.2}                                  \\
    \cmidrule(lr){2-4}\cmidrule(lr){5-7}
Molecule
    & {$N_{\max}$ (nm)} & {$C_{\text{D}}'$ (\si{\micro\mole})} & {$D$}
        & {$A_{\max}$ (µm)} & {$D_{\text{D}}'$ (µm)} & {$A$}            \\
    \midrule
Molecule AB & 2.0(2) & 7.9(6)  & 4.7(1)  & 7.8(3) & 26(6) & 0.87(9)  \\
Molecule C  & 9.2(2) & 25.9(14) & 2.07(4)  & 1.8(3) & 70(5) & 0.19(6)  \\
    \bottomrule
\end{tabularx}
\label{tab:addlabel}
\end{table}
\lipsum[1]
\end{document}

enter image description here

Edit: well, samcarter beat me with almost the same solution for 30 minutes! I recognize this when already upload my answer (my bed!). So in the first delete my answer, now I make small corrections of the first version of my answer and reopen it (because between them are (slightly of) slightly differences :).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.