在 mhchem 中对齐数字反应

在 mhchem 中对齐数字反应

好的,所以我使用 mhchem 包,并且我已经使用序言来数字化每个方程式,但是这让我难以对齐方程式。

我希望我的方程式像这样排列:

\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage[danish]{babel}
\usepackage{fixltx2e}
\usepackage{amsmath}
\usepackage[version=3]{mhchem}
\usepackage{stmaryrd} %plimsommer = \minuso

\makeatletter
\newcounter{reaction}
\renewcommand\thereaction{rx:\,\Roman{reaction}}
\newcommand\reactiontag%
{\refstepcounter{reaction}\tag{\thereaction}}
\newcommand\reaction@[2][]%
{\begin{equation}\cee{#2}%
\ifx\@empty#1\@empty\else\label{#1}\fi%
\reactiontag\end{equation}}
\newcommand\reaction@nonumber[1]%
{\begin{equation*}\cee{#1}\end{equation*}}
\newcommand\reaction%
{\@ifstar{\reaction@nonumber}{\reaction@}}
\makeatother %This makes \reaction have numbering

\begin{document}

    \begin{align*}
        \cee{&CH4(g) + 2SO2(g) -> CO2(g) + 2H2O(g) \\
        &$\Delta H\textsubscript{I}^\minuso=-804.2\text{ kJ/mol}$\\
        &C2H6(g) + 3.5O2(g) -> 2CO2(g) + 3H2O(g) \\
        &$\Delta H\textsubscript{II}^\minuso=-1428.9\text{ kJ/mol}$\\
        &C3H8(g) + 5O2(g) -> 3CO2(g) + 4H2O(g)\\
        &$\Delta H\textsubscript{III}^\minuso=-2045.5\text{ kJ/mol}$}
        \end{align*}

\end{document}

但这不会有数字,就像这段代码一样

\reaction{CH4(g) + 2SO2(g) -> CO2(g) + 2H2O(g)}\\
$\Delta H\textsubscript{I}^\minuso=-804.2\text{ kJ/mol}$
\reaction{C2H6(g) + 3.5O2(g) -> 2CO2(g) + 3H2O(g)}\\
$\Delta H\textsubscript{II}^\minuso=-1428.9\text{ kJ/mol}$
\reaction{C3H8(g) + 5O2(g) -> 3CO2(g) + 4H2O(g)}\\
$\Delta H\textsubscript{III}^\minuso=-2045.5\text{ kJ/mol}$

你能帮我将最后的方程式与第一个方程式对齐吗?

答案1

如果您有最新的 TeX 发行版,则可以使用现有的软件包:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[danish]{babel}

\usepackage{chemmacros}[2015/09/23]
\chemsetup{
  formula = mhchem , % use mhchem for formulas
  modules = {reactions,thermodynamics} % load needed modules
}
% redefine \enthalpy to have standard subscript to the right:
\RenewChemState\enthalpy{
  symbol = H ,
  subscript-pos = right ,
  unit = \kilo\joule\per\mole
}
\sisetup{% unit settings
  per-mode = symbol
}

\begin{document}

\begin{reactions}
  CH4(g) + 2SO2(g)   &-> CO2(g) + 2H2O(g)  && {\enthalpy(I){-804.2}} \\
  C2H6(g) + 3.5O2(g) &-> 2CO2(g) + 3H2O(g) && {\enthalpy(II){-1428.9}} \\
  C3H8(g) + 5O2(g)   &-> 3CO2(g) + 4H2O(g) && {\enthalpy(III){-2045.5}}
\end{reactions}

\end{document}

相关内容