![如何在多重对齐环境中减少线段之间的间距?](https://linux22.com/image/397134/%E5%A6%82%E4%BD%95%E5%9C%A8%E5%A4%9A%E9%87%8D%E5%AF%B9%E9%BD%90%E7%8E%AF%E5%A2%83%E4%B8%AD%E5%87%8F%E5%B0%91%E7%BA%BF%E6%AE%B5%E4%B9%8B%E9%97%B4%E7%9A%84%E9%97%B4%E8%B7%9D%EF%BC%9F.png)
目前,一条线的两段之间有很大间隙,导致其索引被推到下一条线。我该如何防止这种情况?
\documentclass{文章} \usepackage{amsmath} \usepackage{mhchem} \usepackage{amssymb} \开始{文档} 乙烷物质的总体形成:\ce{2 C(s) + 3 H2(g) -> C2H6(g)} \\ \开始{对齐}{2} \ce{2C(s) + 2O2(g) &-> 2CO2(g)} &\Delta H &= -786 kJ\\ \ce{3H2(g) + 3/2 O2(g) &-> H2O(l)} &\Delta H &= -858 kJ\\ \ce{2 CO2(克) + 3 H2O(升) &-> C2H6(克) + 7/2 O2 (克)} &\Delta H &= 1560 kJ\\ \nonumber \ce{2 C(s) + 3 H2(g) + 7/2 O2(g) &-> C2H6(g) + 7/2 O2(g)} &\indent \Delta H &= -786-858+1560\\ \nonumber & &&= -84 kJ \\ \nonumber &&\因此 \Delta H_{f(C_2H6)}^0 &= -84kJ \结束{对齐}{2} \结束{文档}
答案1
在这里,我\mathllap
在最后一行使用了。但正如您所看到的,还有一个剩余的边距问题需要考虑。
此外,\end{alignat}
不接受争论。
\documentclass{article}
\usepackage[pass,showframe]{geometry}
\usepackage{mathtools}
\usepackage{mhchem}
\usepackage{amssymb}
\begin{document}
Overall formation of ethane thingy: \ce{2 C(s) + 3 H2(g) -> C2H6(g)} \\
\begin{alignat}{2}
\ce{2C(s) + 2O2(g) &-> 2CO2(g)} &\Delta H &= -786 kJ\\
\ce{3H2(g) + 3/2 O2(g) &-> H2O(l)} &\Delta H &= -858 kJ\\
\ce{2 CO2(g) + 3 H2O(l) &-> C2H6(g) + 7/2 O2 (g)} &\Delta H &= 1560 kJ\\
\nonumber \ce{2 C(s) + 3 H2(g) + 7/2 O2(g) &-> C2H6(g) + 7/2 O2(g)} &\indent \Delta H &= -786-858+1560\\
\nonumber & &&= -84 kJ \\
\nonumber &&\mathllap{\therefore \Delta H_{f(C_2H6)}^0} &= -84kJ
\end{alignat}
\end{document}
您可以尝试打破剩下的长线,但也可能还有其他方法......
我也把你的kJ
单位弄直了,不过,正如 marmot 指出的那样,这个siunitx
包是专门为将单位应用于数量而定制的。
\documentclass{article}
\usepackage[pass,showframe]{geometry}
\usepackage{mathtools}
\usepackage{mhchem}
\usepackage{amssymb}
\begin{document}
Overall formation of ethane thingy: \ce{2 C(s) + 3 H2(g) -> C2H6(g)} \\
\begin{alignat}{2}
\ce{2C(s) + 2O2(g) &-> 2CO2(g)} &\Delta H &= -786 \mathrm{\,kJ}\\
\ce{3H2(g) + 3/2 O2(g) &-> H2O(l)} &\Delta H &= -858 \mathrm{\,kJ}\\
\ce{2 CO2(g) + 3 H2O(l) &-> C2H6(g) + 7/2 O2 (g)} &\Delta H &= 1560 \mathrm{\,kJ}\\
\nonumber \ce{2 C(s) + 3 H2(g) + 7/2 O2(g) &-> C2H6(g) + 7/2 O2(g)} &\indent \Delta H &= -786-858\\\nonumber&&&\phantom{{}={}}+1560\\
\nonumber & &&= -84 \mathrm{\,kJ} \\
\nonumber &&\mathllap{\therefore \Delta H_{f(C_2H6)}^0} &= -84\mathrm{\,kJ}
\end{alignat}
\end{document}
答案2
使用全页样式(一定是最短的 CTAN 手册,没人会读 :-)
你可以只添加序言
\usepackage{全页}
\documentclass{article}
\usepackage{fullpage}
\usepackage{amsmath}
\usepackage{mhchem}
\usepackage{amssymb}
\begin{document}
Overall formation of ethane thingy: \ce{2 C(s) + 3 H2(g) -> C2H6(g)} \\
\begin{alignat}{2}
\ce{2C(s) + 2O2(g) &-> 2CO2(g)} &\Delta H &= -786 kJ\\
\ce{3H2(g) + 3/2 O2(g) &-> H2O(l)} &\Delta H &= -858 kJ\\
\ce{2 CO2(g) + 3 H2O(l) &-> C2H6(g) + 7/2 O2 (g)} &\Delta H &= 1560 kJ\\
\nonumber \ce{2 C(s) + 3 H2(g) + 7/2 O2(g) &-> C2H6(g) + 7/2 O2(g)} &\indent \Delta H &= -786-858+1560\\
\nonumber & &&= -84 kJ \\
\nonumber &&\therefore \Delta H_{f(C_2H6)}^0 &= -84kJ
\end{alignat}
\end{document}
答案3
这确实会占用一点左边距,如果这不可接受,我认为您需要将最后一个术语分成两行。
\documentclass{article}
\usepackage{amsmath}
\usepackage{mhchem}
\usepackage{amssymb}
\begin{document}
Overall formation of ethane thingy: \ce{2 C(s) + 3 H2(g) -> C2H6(g)}%Underfull \hbox (badness 10000) \\
\begin{alignat}{2}
\ce{2C(s) + 2O2(g) &-> 2CO2(g)} &\Delta H &= -786 kJ\\
\ce{3H2(g) + 3/2 O2(g) &-> H2O(l)} &\Delta H &= -858 kJ\\
\ce{2 CO2(g) + 3 H2O(l) &-> C2H6(g) + 7/2 O2 (g)} &\Delta H &= 1560 kJ\\
\nonumber\hspace*{-250pt}\ce{2 C(s) + 3 H2(g) + 7/2 O2(g) &-> C2H6(g) + 7/2 O2(g)} &\Delta H &= -786-858+1560\\
\nonumber & &&= -84 kJ \\
\nonumber &\therefore& \Delta H_{f(C_2H6)}^0 &= -84kJ
\end{alignat}{2}
\end{document}
注意,我\therefore
稍微移动了背部,这样就不会太拥挤(这样显示屏会窄一点,需要的悬垂空间也小一点)。另外,切勿\\
在显示屏前使用。
答案4
如果空间有限,可以使用更多行:
\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[version=4]{mhchem}
\usepackage{siunitx}
\newcommand{\move}[2]{\hspace{#1}\makebox[0pt][r]{$\displaystyle#2$}}
\begin{document}
Overall formation of ethane thingy: \ce{2 C(s) + 3 H2(g) -> C2H6(g)}, in units~\si{\kilo\joule}
\begin{align}
\ce{2C(s) + 2O2(g) &-> 2CO2(g)} \\
\nonumber &\move{6em}{\Delta H} = -786 \\
\ce{3H2(g) + 3/2 O2(g) &-> H2O(l)} \\
\nonumber & \move{6em}{\Delta H} = -858 \\
\ce{2 CO2(g) + 3 H2O(l) &-> C2H6(g) + 7/2 O2 (g)} \\
\nonumber & \move{6em}{\Delta H} = 1560 \\
\ce{2 C(s) + 3 H2(g) + 7/2 O2(g) &-> C2H6(g) + 7/2 O2(g)} \\
\nonumber & \move{6em}{\Delta H} = -786-858+1560\\
\nonumber & \move{6em}{} = -84 \\
\nonumber & \move{6em}{\therefore \Delta H_{f(\ce{C_2H6})}^0} = \SI{-84}{\kilo\joule}
\end{align}
\end{document}