我有一张包含一些化学方程式的表格,有些方程式不止一行。我可以将它们全部对齐到反应箭头上,而周围又不留太多空白吗?将反应分成几部分是我目前最好的解决方案:
\documentclass[10pt]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[a4paper,left=35mm,right=20mm, top=25mm, bottom=25mm]{geometry}
\usepackage{textcomp}
\usepackage[version=4]{mhchem}
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{tabulary}
\begin{document}
\begin{tabulary}{\linewidth}{LrclR}
corrosion product & \multicolumn{3}{c}{degradation process} & max. T\textcelsius\\
\toprule
Malachite & \ce{CuCO3.CH(OH)2} & \ce{->T[380\textcelsius]} & \ce{2CuO + H2O + CO2} & 380\\
\addlinespace
Azurite & \ce{2CuCO3.Cu(OH)2} & \ce{->T[320--355\textcelsius]} & \ce{CuCO3.Cu(OH)2 + CuO + CO2 + H2O} & 390\\
& \ce{CuCO3.Cu(OH)2} & \ce{->T[390\textcelsius]} & \ce{CuO + O2 + H2O} & \\
\addlinespace
Atacamite & \ce{CU(OH)3Cl} & \ce{->T[250\textcelsius]} & \ce{CuO.CuCl2 + CuO +H2O} & 400\\
& \ce{CuO.CuCl2 + 1/2 O2} & \ce{->T[400\textcelsius]} & \ce{2CuO + Cl2} & \\
\bottomrule
\end{tabulary}
\end{document}
但它看起来有点粗糙。有没有更优雅的方法来做到这一点?
答案1
通过确定哪一个最宽,你可以获得相等长度的中心箭头:
\documentclass[10pt]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[a4paper,left=35mm,right=20mm, top=25mm, bottom=25mm]{geometry}
\usepackage{textcomp}
\usepackage[version=4]{mhchem}
\usepackage{booktabs}
\newlength{\cewidth}
\newcommand{\cet}[1]{\makebox[\cewidth]{#1}}
\begin{document}
\settowidth{\cewidth}{\scriptsize 320--355\textcelsius}
\begin{tabular}{@{} l r@{}c@{}l r@{}}
\toprule
\begin{tabular}[t]{@{}c@{}} Corrosion \\ product \end{tabular} &
\multicolumn{3}{c}{Degradation process} &
\begin{tabular}[t]{@{}c@{}} Max.\\ T\textcelsius \end{tabular} \\
\midrule
Malachite
& \ce{CuCO3.CH(OH)2} & \ce{->T[\cet{380\textcelsius}]} & \ce{2CuO + H2O + CO2} & 380\\
\addlinespace
Azurite
& \ce{2CuCO3.Cu(OH)2} & \ce{->T[320--355\textcelsius]} & \ce{CuCO3.Cu(OH)2 + CuO + CO2 + H2O}
& 390\\
& \ce{CuCO3.Cu(OH)2} & \ce{->T[\cet{390\textcelsius}]} & \ce{ CuO + O2 + H2O} & \\
\addlinespace
Atacamite
& \ce{CU(OH)3Cl} & \ce{->T[\cet{250\textcelsius}]} & \ce{CuO.CuCl2 + CuO +H2O} & 400\\
& \ce{CuO.CuCl2 + 1/2 O2} & \ce{->T[\cet{400\textcelsius}]} & \ce{ 2CuO + Cl2} & \\
\bottomrule
\end{tabular}
\end{document}
使用另一个技巧,您可以将标题置于箭头上方的中心:
\documentclass[10pt]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[a4paper,left=35mm,right=20mm, top=25mm, bottom=25mm]{geometry}
\usepackage{textcomp}
\usepackage[version=4]{mhchem}
\usepackage{booktabs}
\newlength{\cewidth}
\newcommand{\cet}[1]{\makebox[\cewidth]{#1}}
\begin{document}
\settowidth{\cewidth}{\scriptsize 320--355\textcelsius}
\begin{tabular}{@{} l r@{}c@{}l r@{}}
\toprule
\begin{tabular}[t]{@{}c@{}} Corrosion \\ product \end{tabular} &
& \makebox[0pt]{Degradation process} & &
\begin{tabular}[t]{@{}c@{}} Max.\\ T\textcelsius \end{tabular} \\
\midrule
Malachite
& \ce{CuCO3.CH(OH)2} & \ce{->T[\cet{380\textcelsius}]} & \ce{2CuO + H2O + CO2} & 380\\
\addlinespace
Azurite
& \ce{2CuCO3.Cu(OH)2} & \ce{->T[320--355\textcelsius]} & \ce{CuCO3.Cu(OH)2 + CuO + CO2 + H2O}
& 390\\
& \ce{CuCO3.Cu(OH)2} & \ce{->T[\cet{390\textcelsius}]} & \ce{ CuO + O2 + H2O} & \\
\addlinespace
Atacamite
& \ce{CU(OH)3Cl} & \ce{->T[\cet{250\textcelsius}]} & \ce{CuO.CuCl2 + CuO +H2O} & 400\\
& \ce{CuO.CuCl2 + 1/2 O2} & \ce{->T[\cet{400\textcelsius}]} & \ce{ 2CuO + Cl2} & \\
\bottomrule
\end{tabular}
\end{document}
我将文本插入带有箭头的列中,但\makebox[0pt]{...}
文本在里面不占用任何宽度(从 TeX 的角度来看),并粘在这个零宽度框的两侧。当然,这只有在相邻列足够宽的情况下才能起作用。
答案2
您可以尝试消除 LaTeX 默认在列之间插入的空白 - 至少在三个中心列周围。
\documentclass[a4paper,10pt]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[left=35mm, right=20mm, vmargin=25mm]{geometry}
\usepackage[version=4]{mhchem}
\usepackage{textcomp,booktabs,tabulary}
\begin{document}
\noindent
\begin{tabulary}{\linewidth}{@{} L l@{}c@{}l R @{}}
Corrosion product
& \multicolumn{3}{c}{Degradation process}
& Max.\ T\textcelsius\\
\toprule
Malachite & \ce{CuCO3.CH(OH)2}
& \ce{->T[380\textcelsius]}
& \ce{2CuO + H2O + CO2} & 380\\
\addlinespace
Azurite & \ce{2CuCO3.Cu(OH)2}
& \ce{->T[320--355\textcelsius]}
& \ce{CuCO3.Cu(OH)2 + CuO + CO2 + H2O} & 390\\
& \ce{CuCO3.Cu(OH)2}
& \ce{->T[390\textcelsius]}
& \ce{CuO + O2 + H2O} & \\
\addlinespace
Atacamite & \ce{CU(OH)3Cl}
& \ce{->T[250\textcelsius]}
& \ce{CuO.CuCl2 + CuO +H2O} & 400\\
& \ce{CuO.CuCl2 + 1/2 O2}
& \ce{->T[400\textcelsius]}
& \ce{2CuO + Cl2} & \\
\bottomrule
\end{tabulary}
\end{document}