创建表的良好做法

创建表的良好做法

你能帮我把下面的表格改好看点吗?我不需要一张漂亮的表格,只需要一些经常练习就能让它看起来更好。

平均能量损失

\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}

答案1

在此处输入图片描述

我的建议是使用

  • siunitx对齐数字

  • booktabs为了更好的表格规则和间距:

并不是:

  • \begin{table}[H]这将禁用 tex 的大部分强大浮动机制
  • \begin{adjustbox}{width=0.8\textwidth}这会弄乱表格中的字体大小

\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}

在此处输入图片描述

答案2

与 samcarter 的答案没有太大区别,但是有一些有价值的技巧。

符号“pKa”不应以斜体出现,因此我定义了几个宏来处理这个问题并简化输入。

纸币不应该放在 中\scriptsize,因为它太小了。

避免缩放表格以及中的特殊字符\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}

在此处输入图片描述

答案3

还有更多改进。我认为这种表格使用交替行颜色更易读。此外,pKa应使用罗马字符输入:

\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} 

在此处输入图片描述

相关内容