在此表中,由于命令的原因,水平线\multicolumn
没有填满整个表格。
一种解决方案是添加额外的水平空间,就像注释行一样。还有
其他方法(更少的反复试验)可以做到这一点吗?谢谢。
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[version=3]{mhchem}
\usepackage{siunitx,booktabs}
\begin{document}
\begin{tabular}{l|cccccc}
\toprule
& \ce{COCl2(g)} & \ce{<-->} & \ce{CO(g)} & + & \ce{Cl2(g)} \\
\midrule
inizio & 1 & & & & \\ [1mm]
equilibrio & $1 - \alpha$ & & $\alpha$ & & $\alpha$ \\ [1mm]
moli totali & \multicolumn{6}{l}{$1 - \alpha + \alpha + \alpha = 1 + \alpha$} \\ [1mm]
%moli totali & \multicolumn{6}{l}{$1 - \alpha + \alpha + \alpha = 1 + \alpha\hspace{56mm}$} \\ [1mm]
frazioni molari & $\dfrac{1-\alpha}{1+\alpha}$ & & $\dfrac{\alpha}{1+\alpha}$ & & $\dfrac{\alpha}{1+\alpha}$ \\ [3mm]
pressioni parziali & $\left( \dfrac{1-\alpha}{1+\alpha}\right)P$ & & $\left( \dfrac{\alpha}{1+\alpha}\right) P$ & & $\left( \dfrac{\alpha}{1+\alpha}\right) P$ \\ [1mm]
\bottomrule
\end{tabular}
\end{document}
答案1
您只需要 6 列,因此请c
从列规范中删除一列。此外,由于所有 2-6 列都处于数学模式,因此请通过添加列规范来保留这些$
列。>{$}c<{$}
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[version=3]{mhchem}
\usepackage{siunitx,booktabs,array}
\begin{document}
\begin{tabular}{l*5{>{$}c<{$}}}
\toprule
& \ce{COCl2(g)} & \ce{<-->} & \ce{CO(g)} & + & \ce{Cl2(g)} \\
\midrule
inizio & 1 & & & & \\ [1mm]
equilibrio & 1 - \alpha & & \alpha & & \alpha \\ [1mm]
moli totali & \multicolumn{5}{l}{$1-\alpha+\alpha+\alpha = 1+\alpha$} \\ [1mm]
frazioni molari & \dfrac{1-\alpha}{1+\alpha} & & \dfrac{\alpha}{1+\alpha} & & \dfrac{\alpha}{1+\alpha} \\ [3mm]
pressioni parziali & \left(\dfrac{1-\alpha}{1+\alpha}\right)P & & \left(\dfrac{\alpha}{1+\alpha}\right) P & & \left(\dfrac{\alpha}{1+\alpha}\right)P \\ [1mm]
\bottomrule
\end{tabular}
\end{document}