化學方程式中的分數不起作用

化學方程式中的分數不起作用

我正在嘗試在我的乳膠報告中輸入波伊斯方程,一切看起來都很好。這就是我通常編寫方程式的方式:

\begin{gather}

n_{CH_4}=\frac{COD}{64\frac{g}{mol}}

\intertext{Where:}

\begin{tabular}

    $n_{CH_4}$ is the amount of molecular methane in $mol$\\

    $COD$ is experimentally obtained value 
of chemical oxygen demand

\end{tabular}\nonumber

\label{eq: n}

\end{gather}

這就是它的樣子

在此輸入影像描述

對於博伊爾斯方程,我嘗試與\ch命令一起執行相同的操作,但它變得太長並且超出了我的頁面。我嘗試了許多其他選項,例如\split或 簡單的\\,但似乎沒有任何效果。現在,我求助於以下程式碼:

$C_nH_aO_bN_c$+$(n-\frac{a}{4}-\frac{b}{2}+\frac{3c}{4})$ $H_2O$ \longrightarrow 
    ($\frac{n}{2}$+$\frac{a}{8}$-$\frac{b}{4}$-$\frac{3c}{8})$ $CH_4+(\frac{n}{2}-\frac{a}{8}+\frac{b}{4}+\frac{3c}{8})CO_2+cNH_3$

分數仍然是關閉的,而且我的方程式旁邊也沒有編號標籤。它看起來是這樣的:

在此輸入影像描述

答案1

我強烈建議您使用化學軟體包(例如mhchem)來輸入和排版化學物質和方程式。我還使用siunitx 套件的\unit和宏來表達科學單位和數量。\qty

在此輸入影像描述

\documentclass{article} % or some other suitable document class
\usepackage{array}             % for '\newcolumntype' macro
\usepackage[version=4]{mhchem} % for '\ce' macro
\usepackage{amsmath}           % for 'multline*' environment
\usepackage{siunitx}           % for '\unit' and '\qty' macros

\newcolumntype{P}[1]{%  % 'p' col. type, w/ automatic hanging indentation
   >{\raggedright\arraybackslash\hangafter=1\hangindent=1em}p{#1}}
\sisetup{per-mode=symbol}

\begin{document}

\noindent
(bla bla bla \dots)
\[
 n_{\ce{CH4}}=\frac{\mathrm{COD}}{\qty{64}{\gram\per\mol}}
\]
where
\begin{center}
\begin{tabular}{ l P{3in} }
$n_{\ce{CH4}}$ & amount of molecular methane, in \unit{\mol} \\
$\mathrm{COD}$ & experimentally obtained value of chemical oxygen demand
\end{tabular}
\end{center}
Using a \texttt{multline*} environment and six instances of \texttt{\string\ce}:
\begin{multline*}
\ce{C_nH_aO_bN_c} 
+ \Bigl(n-\frac{a}{4}-\frac{b}{2}+\frac{3c}{4}\Bigr) \ce{H2O} \\ 
\ce{->}
\Bigl(\frac{n}{2}+\frac{a}{8}-\frac{b}{4}-\frac{3c}{8}\Bigr) \ce{CH4}
+\Bigl(\frac{n}{2}-\frac{a}{8}+\frac{b}{4}+\frac{3c}{8}\Bigr)\ce{CO2}+c\ce{NH3}
\end{multline*}

\end{document}

答案2

絕對有可能會對反應進行編號,例如使用chemmacros包裹。如果它們對於一行來說太長,我建議使用多行。

你不應該做的是對化學公式使用數學模式:它們不是數學變量,實際上應該垂直排版。一個應該使用chemformula(預設值chemmacros)或mhchem對於他們來說。

像這樣構造

($\frac{n}{2}$+$\frac{a}{8}$-$\frac{b}{4}$-$\frac{3c}{8})$

真的錯了。您不應該為加號和減號離開數學模式。錯誤的間距只是錯誤後果之一。

這是一個快速建議,也使用siunitx包裝單位和數量:

\documentclass{article}

\usepackage{chemmacros}
\chemsetup{
  reactions/own-counter = false % equations and reactions share counter
}
\NewChemReaction{multreaction}{multline}% new reaction type based on multline by amsmath

% setup siunitx (loaded by chemmacros)
\sisetup{
  per-mode = fraction
}

\usepackage{lipsum}% for sample text

\begin{document}

\begin{equation}
  n_{\ch{CH4}}=\frac{COD}{\qty{64}{\gram\per\mole}}
\end{equation}
Where:
\begin{itemize}
  \item $n_{\ch{CH4}}$ is the amount of molecular methane in \unit{\mole}
  \item $COD$ is experimentally obtained value of chemical oxygen demand
\end{itemize}
\lipsum[1]
\begin{multreaction}
C_{$n$}H_{$a$}O_{$b$}N_{$c$} + $\Bigl(n-\frac{a}{4}-\frac{b}{2}+\frac{3c}{4}\Bigr)$ H2O -> \\
    $\Bigl(\frac{n}{2}+\frac{a}{8}-\frac{b}{4}-\frac{3c}{8}\Bigr)$ CH4 +
    $\Bigl(\frac{n}{2}-\frac{a}{8}+\frac{b}{4}+\frac{3c}{8}\Bigr)$ CO2 + $c$ NH3
\end{multreaction}
\lipsum[2]

\end{document}

在此輸入影像描述

相關內容