4

I have the following problem, I am trying to make the caption of my table as big as the table itself. The floatrow package seems to do the trick. But in my case the caption for a reason I do not understand is always slightly to long - about 0.2 cm or so. No idea how to change that, help would be very much appreciated.

Minimal working example:

  \documentclass[a4paper]{article}
  \usepackage[english]{babel}
  \usepackage{siunitx}
  \DeclareSIUnit\Molar{M}
  \DeclareSIUnit\rpm{rpm}

  \usepackage{caption}

  \usepackage{floatrow}

  \begin{document}

  \begin{table}[!htb]

  \ttabbox{
  \caption{Concentrations used to prepare the sulfitolysis buffers. Literature references refer to the source of the 
  $Na_{2}SO_{3}$ and $Na_{2}S_{4}O_{3}$ concent...} 
  }{

  \begin{tabular}{llllll}
  \hline
  Name  & $Na_{2}S_{4}O_{3}$ & GuHCl & Urea & pH & Lit.  \\ 

  S1      &     \SI{20}{\milli\Molar}    & -     &  \SI{8}{\Molar} & 8.3  \\ 
  S2      &     \SI{80}{\milli\Molar}    & \SI{7}{\Molar} &  -  & 7.3  \\ 
  S3     &  \SI{80}{\milli\Molar}    & \SI{7}{\Molar} &  -  & 9.3 \\ 

  \end{tabular}
  }

  \end{table}

  \end{document}

What I get is:enter image description here

2

You have unprotected end-of-lines, which I inserted and marked.

I also made some changes to the table, using S columns and moving the units to the header (feel free to undo these changes) and used mhchem with the \ce command for chemical formulas.

Avoid ! in the position specifier and remember to add p.

\documentclass[a4paper]{article}
\usepackage[english]{babel}

\usepackage{booktabs}
\usepackage{caption}
\usepackage{floatrow}
\usepackage[version=4]{mhchem}
\usepackage{siunitx}
\DeclareSIUnit\Molar{M}
\DeclareSIUnit\rpm{rpm}

\begin{document}

\begin{table}[htbp]

\ttabbox{% <--- missing
  \caption{Concentrations used to prepare the sulfitolysis buffers. 
    Literature references refer to the source of the 
    \ce{Na2SO3} and \ce{Na2S4O3} concent...}% <--- MISSING
  }{% <--- MISSING
  \begin{tabular}{
    l
    S[table-format=2.0]
    S[table-format=1.0]
    S[table-format=1.0]
    S[table-format=1.1]
    c
  }
  \toprule
  Name & {\ce{Na2S4O3}}        & {Gu\ce{HCl}}    & {Urea}          & {pH} & Lit.  \\
       & {(\si{\milli\Molar})} & {(\si{\Molar})} & {(\si{\Molar})} \\
  \midrule
  S1   & 20    & {--} & 8    & 8.3  \\ 
  S2   & 80    & 7    & {--} & 7.3  \\ 
  S3   & 80    & 7    & {--} & 9.3 \\ 
  \bottomrule
  \end{tabular}% <--- MISSING
}

\end{table}

\end{document}

enter image description here

The same output can be obtained in a less demanding way with threeparttable:

\documentclass[a4paper]{article}
\usepackage[english]{babel}

\usepackage{booktabs}
\usepackage{caption}
\usepackage{threeparttable}
\usepackage[version=4]{mhchem}
\usepackage{siunitx}
\DeclareSIUnit\Molar{M}
\DeclareSIUnit\rpm{rpm}

\begin{document}

\begin{table}[htbp]
\centering

\begin{threeparttable}

\caption{Concentrations used to prepare the sulfitolysis buffers. 
    Literature references refer to the source of the 
    \ce{Na2SO3} and \ce{Na2S4O3} concent...}

\begin{tabular}{
  l
  S[table-format=2.0]
  S[table-format=1.0]
  S[table-format=1.0]
  S[table-format=1.1]
  c
}
\toprule
Name & {\ce{Na2S4O3}}        & {Gu\ce{HCl}}    & {Urea}          & {pH} & Lit.  \\
     & {(\si{\milli\Molar})} & {(\si{\Molar})} & {(\si{\Molar})} \\
\midrule
S1   & 20    & {--} & 8    & 8.3  \\ 
S2   & 80    & 7    & {--} & 7.3  \\ 
S3   & 80    & 7    & {--} & 9.3 \\ 
\bottomrule
\end{tabular}

\end{threeparttable}

\end{table}

\end{document}

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.