1

Would you help me to make the table below look better? I don't need a beautiful table, just some frequent practices to make it looks better.

MWE

\begin{table}[H]
\centering
\begin{adjustbox}{width=0.8\textwidth}
\begin{threeparttable}
\caption{Estimación de pKa para ácidos, alcoholes y aminoácidos}\label{table:estimación_pka_RM1_con_aminoácidos}
\begin{tabular}{|l|c|c|c|c|c|}
\hline
 & \textbf{} & \multicolumn{4}{c|}{\textbf{RM1}} \\ \hline
 &  & \multicolumn{2}{c|}{\textbf{COSMO}} & \multicolumn{2}{c|}{\textbf{SS-COSMO}} \\ \hline
 & p$Ka_{\textrm{exp}}$(298K) & p$Ka_{\textrm{calc}}$ & $\Delta$p$Ka$ & p$Ka_{\textrm{calc}}$ & $\Delta$p$Ka$ \\ \hline
\textbf{Ácidos}&  &  &  &  &  \\ \hline
acético & 4.75 & 2.1 & 2.6 & 4.2 & 0.6 \\ \hline
láctico & 3.86 & 0.7 & 3.2 & 5.0 & -1.2 \\ \hline
benzoico & 4.2 & 1.1 & 3.1 & 1.6 & 2.6 \\ \hline
\textbf{MAE} &  &  & 3.1 &  & 1.6 \\ \hline
\end{tabular}
\begin{tablenotes}
\item[a]{Desprotonación de referencia}
\item[b] {\scriptsize Sin valor experimental}
\item {\scriptsize Estimación.}
\end{tablenotes}
\end{threeparttable}
\end{adjustbox}
\end{table}
4
  • 1
    Have a look at tex.stackexchange.com/a/354998/36296 Sep 25, 2017 at 22:00
  • @samcarter that's really difficult for me. But thanks.
    – user134500
    Sep 25, 2017 at 22:09
  • Looks like a duplicate to me.
    – Johannes_B
    Sep 26, 2017 at 3:13
  • @Johannes_B it is not. The other question is about a long table, this is not.
    – user134500
    Sep 26, 2017 at 4:33

3 Answers 3

8

enter image description here

My suggestion is using

  • siunitx to align the numbers

  • booktabs for nicer table rules and spacing:

and not:

  • \begin{table}[H] this will disable most of the powerful floating mechanism of tex
  • \begin{adjustbox}{width=0.8\textwidth} this will mess up the font size in the table

\documentclass[12pt,twoside
%,draft
]{report}

\usepackage[headheight=18pt,a4paper, width=150mm, top=25mm, bottom=25mm, bindingoffset=6mm, headsep=18pt]{geometry}
\usepackage[spanish,es-noquoting]{babel}
%interprete de idioma castellano
\usepackage[utf8]{inputenc} %relacionado al input
\usepackage[T1]{fontenc} 
\usepackage{booktabs}
\usepackage{siunitx}


\begin{document}


\begin{table}
  \centering
  \begin{tabular}{@{} l *{5}{S[table-format=-1.2]} @{}}
\toprule
&  & \multicolumn{4}{c}{RM1} \\ 
\cmidrule{3-6}
&  & \multicolumn{2}{c}{COSMO} & \multicolumn{2}{c}{SS-COSMO} \\ 
\cmidrule(r{5pt}){3-4}\cmidrule(l{5pt}){5-6}
& {p$Ka_{\text{exp}}$(\SI{298}{K})} & {p$Ka_{\text{calc}}$} & {$\Delta$p$Ka$} & {p$Ka_{\text{calc}}$} & {$\Delta$p$Ka$} \\
 \midrule 
Ácidos&  &  &  &  &  \\ 
cloroacético & 2.85 & 0.5 & 2.4 & 1.4 & 1.5 \\ 
4-clorobutírico & 4.52 & 5.0 & -0.5 & 4.7 & -0.2 \\ 
2-cloropentanoico &  & -2.3 &  & 1.0 & \\ 
2-clorobutírico & 2.86 & 0.6 & 2.2 & 0.4 & 2.5 \\ 
3-clorobutírico & 4.05 & 3.7 & 0.4 & 3.8 & 0.3 \\ 
acetoacético & 3.6 & 3.4 & 0.2 & 2.0 & 1.6 \\ 
bromoacético & 2.69 & 1.2 & 1.5 & 1.1 & 1.6 \\ 
dicloro-acético & 1.41 & -3.2 & 4.6 & -2.5 & 3.9 \\ 
iodoacético & 3.12 & 2.1 & 1.1 & 2.8 & 0.3 \\ 
L-valina & 2.29 & -1.9 & 4.2 & 2.6 & -0.3 \\ 
L-alanina & 2.34 & -1.6 & 3.9 & 2.3 & 0.0 \\ 
trichloroacético & 0.7 & -7.0 & 7.7 & -4.7 & 5.4 \\ 
2-chloropropanoico & 2.83 & 0.8 & 2.0 & 0.2 & 2.6 \\ 
3-chloropropanoico & 3.98 & 3.4 & 0.6 & 5.2 & -1.3 \\ 
3-hidroxipropanoico & 4.51 & 3.8 & 0.8 & 3.5 & 1.0 \\ 
acético & 4.75 & {ref} & {ref} & {ref} & {ref} \\ 
fluoroacético & 2.59 & 1.9 & 0.7 & -0.3 & 2.9 \\ 
fórmico & 3.75 & 6.4 & -2.6 & 4.3 & -0.6 \\ 
pirúvico & 2.39 & -0.3 & 2.7 & 1.3 & 1.1 \\ 
glioxílico & 3.18 & 0.3 & 2.9 & 1.0 & 2.2 \\ 
propanoico & 4.86 & 4.9 & -0.1 & 4.5 & 0.3 \\ 
butanoico & 4.83 & 5.2 & -0.3 & 4.7 & 0.1 \\ 
acrílico & 4.25 & 4.6 & -0.3 & 1.5 & 2.7 \\ 
láctico & 3.86 & 3.3 & 0.6 & 5.6 & -1.7 \\ 
benzoico & 4.2 & 3.7 & 0.5 & 2.2 & 2.0 \\ 
\midrule
MAE &  &  & 1.8 &  & 1.7\\
\bottomrule
\end{tabular}
\end{table}
\end{document}

enter image description here

3
  • Yeah, it is good. Although I have a lot of different tables and edit them by hand is impossible. But great answer. Thanks..
    – user134500
    Sep 25, 2017 at 22:20
  • 1
    @HernanMiraola It's not impossible, just time consuming. However, the website you refer to does have the option of using booktabs rules: select "booktabs table style" instead of "default table style". That will remove the vertical lines, and use \toprule/\midrule/\bottomrule instead of \hline. Sep 25, 2017 at 22:42
  • Oh I havent explored that. Thanks a lot @TorbjørnT.!
    – user134500
    Sep 26, 2017 at 0:45
5

Not so different from samcarter's answer, but with some valuable tricks.

The symbol “pKa” should not appear in italics, so I defined a couple of macros to deal with this and to simplify input.

The notes should not be in \scriptsize, which is way too small.

Avoid scaling tables and also special characters in \label.

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}

\usepackage{threeparttable}
\usepackage{siunitx} % for numeric tables
\usepackage{booktabs} % for better tables

\newcommand{\pKa}[1]{%
  \textnormal{pKa}%
  \if\relax\detokenize{#1}\relax
  \else
    \ensuremath{_{\mathrm{#1}}}%
  \fi
}
\newcommand{\DpKa}{\ensuremath{\Delta}\pKa{}}

\begin{document}

\begin{table}[htp]

\begin{threeparttable}

\caption{Estimación de \pKa{} para ácidos, alcoholes y aminoácidos}
\label{table:estimacion_pka_RM1_con_aminoacidos}% <-- avoid accents in labels

\centering

\begin{tabular}{
  l
  S[table-format=1.2]
  S[table-format=-1.1]
  S[table-format=1.1]
  S[table-format=-1.1]
  S[table-format=-1.1]
}
\toprule
& & \multicolumn{4}{c}{RM1} \\
\cmidrule(lr){3-6}
& & \multicolumn{2}{c}{COSMO} & \multicolumn{2}{c}{SS-COSMO} \\
\cmidrule(lr){3-4} \cmidrule(lr){5-6}
 & {\pKa{exp} (\SI{298}{K})}
 & {\pKa{calc}}
 & {\DpKa}
 & {\pKa{calc}}
 & {\DpKa}
\\
\midrule
\textit{Ácidos} \\ 
acético          & 4.75 &   2.1 &   2.6 &   4.2 &   0.6 \\
fluoroacético    & 2.59 &  -0.8 &   3.3 &  -0.8 &   3.4 \\
fórmico\tnote{a} & 3.75 & {ref} & {ref} & {ref} & {ref} \\
pirúvico         & 2.39 &  -3.0 &   5.4 &   0.7 &   1.7 \\
glioxílico       & 3.18 &  -2.3 &   5.5 &   0.4 &   2.8 \\
propanoico       & 4.86 &   2.3 &   2.5 &   3.9 &   0.9 \\
butanoico        & 4.83 &   2.6 &   2.3 &   4.2 &   0.7 \\
acrílico         & 4.25 &   2.0 &   2.3 &   1.0 &   3.3 \\
láctico          & 3.86 &   0.7 &   3.2 &   5.0 &  -1.2 \\
benzoico         & 4.2  &   1.1 &   3.1 &   1.6 &   2.6 \\
\midrule
MAE              &      &       &   3.1 &       &   1.6 \\
\bottomrule
\end{tabular}
\begin{tablenotes}
\footnotesize
\item[a] Desprotonación de referencia
\item[b] Sin valor experimental
\item Estimación y comparación de \pKa{} calculados con RM1 y dos estrategias 
de solvatación: implícita (COSMO) y explícita-implícita(Solvateshell-COSMO). 
El \DpKa{} se realizó como $\DpKa=\pKa{exp}-\pKa{calc}$. La sigla SS significa
Solvateshell.
\end{tablenotes}
\end{threeparttable}

\end{table}

\end{document}

enter image description here

7
  • great, thanks! I will spent time using all this good answers.
    – user134500
    Sep 26, 2017 at 0:45
  • Do you think it is a duplicate? I don't know why they marked as duplicate.
    – user134500
    Sep 26, 2017 at 0:47
  • Can item a and b be put one besides another?
    – user134500
    Sep 26, 2017 at 1:02
  • also I don't know what means S[table-format=1.2] and S[table-format=1.1] would you explain it?
    – user134500
    Sep 26, 2017 at 1:07
  • and acording to this site: chemistry.stackexchange.com/questions/7347/… acid constant goes in italic (I don't like but it is convention).
    – user134500
    Sep 26, 2017 at 2:04
4

Some more improvements. I think this kind of table is more readable with alternate row colours. Also, pKa should be typed in roman characters:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{booktabs, makecell}
\usepackage{siunitx}
\usepackage[table, svgnames]{xcolor}
\usepackage{amsmath}
\DeclareMathOperator{\pKa}{pKa}

\begin{document}


\begin{table}
  \centering
\rowcolors*{8}{Gainsboro!50!Lavender}{Gainsboro!40!Lavender!40!white}
  \begin{tabular}{ l *{5}{S[table-format=-1.2]}}
\toprule
& & \multicolumn{4}{c}{RM1} \\
\cmidrule(l{2.6em}r{1.9em}){3-6}
& & \multicolumn{2}{c}{COSMO} & \multicolumn{2}{c}{SS-COSMO} \\
\cmidrule(r{5pt}){3-4}\cmidrule(l{5pt}){5-6}
& {\makecell{$\pKa_{\text{exp}}$\\ (\SI{298}{K})}} & {$\pKa_{\text{calc}}$} & {$\Delta(\pKa)$} & {$\pKa_{\text{calc}}$} & {$\Delta(\pKa)$} \\
 \midrule
 \hspace*{-\tabcolsep}\textbf{Ácidos}\smallskip \\
cloroacético & 2.85 & 0.5 & 2.4 & 1.4 & 1.5 \\
4-clorobutírico & 4.52 & 5.0 & -0.5 & 4.7 & -0.2 \\
2-cloropentanoico & & -2.3 & & 1.0 & \\
2-clorobutírico & 2.86 & 0.6 & 2.2 & 0.4 & 2.5 \\
3-clorobutírico & 4.05 & 3.7 & 0.4 & 3.8 & 0.3 \\
acetoacético & 3.6 & 3.4 & 0.2 & 2.0 & 1.6 \\
bromoacético & 2.69 & 1.2 & 1.5 & 1.1 & 1.6 \\
dicloro-acético & 1.41 & -3.2 & 4.6 & -2.5 & 3.9 \\
iodoacético & 3.12 & 2.1 & 1.1 & 2.8 & 0.3 \\
L-valina & 2.29 & -1.9 & 4.2 & 2.6 & -0.3 \\
L-alanina & 2.34 & -1.6 & 3.9 & 2.3 & 0.0 \\
trichloroacético & 0.7 & -7.0 & 7.7 & -4.7 & 5.4 \\
2-chloropropanoico & 2.83 & 0.8 & 2.0 & 0.2 & 2.6 \\
3-chloropropanoico & 3.98 & 3.4 & 0.6 & 5.2 & -1.3 \\
3-hidroxipropanoico & 4.51 & 3.8 & 0.8 & 3.5 & 1.0 \\
acético & 4.75 & {ref} & {ref} & {ref} & {ref} \\
fluoroacético & 2.59 & 1.9 & 0.7 & -0.3 & 2.9 \\
fórmico & 3.75 & 6.4 & -2.6 & 4.3 & -0.6 \\
pirúvico & 2.39 & -0.3 & 2.7 & 1.3 & 1.1 \\
glioxílico & 3.18 & 0.3 & 2.9 & 1.0 & 2.2 \\
propanoico & 4.86 & 4.9 & -0.1 & 4.5 & 0.3 \\
butanoico & 4.83 & 5.2 & -0.3 & 4.7 & 0.1 \\
acrílico & 4.25 & 4.6 & -0.3 & 1.5 & 2.7 \\
láctico & 3.86 & 3.3 & 0.6 & 5.6 & -1.7 \\
benzoico & 4.2 & 3.7 & 0.5 & 2.2 & 2.0 \\[-\aboverulesep]
\midrule
\hiderowcolors MAE & & & 1.8 & & 1.7\\
\bottomrule
\end{tabular}
\end{table}

\end{document} 

enter image description here

1
  • very nice table. thanks a lot Bernard! I will try at least some of the things you suggest..
    – user134500
    Sep 26, 2017 at 0:46

Your Answer

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