Updated «mhchem» section
This commit is contained in:
parent
38b03877c0
commit
8d754cbf10
@ -506,13 +506,50 @@ As it turns out, people have written a number of different packages over the yea
|
|||||||
|
|
||||||
\section{Package \texttt{mhchem}}
|
\section{Package \texttt{mhchem}}
|
||||||
|
|
||||||
For typesetting chemical equations:
|
This package is useful for typesetting chemical equations and reactions and has a fairly intuitive interface. For example, to typeset this equation:
|
||||||
|
|
||||||
|
\vspace{\baselineskip}
|
||||||
|
\noindent{}\ce{CO2 + C -> 2 CO}
|
||||||
|
\vspace{\baselineskip}
|
||||||
|
|
||||||
|
we would simply use this markup:
|
||||||
|
|
||||||
|
\begin{Verbatim}[]
|
||||||
\ce{CO2 + C -> 2 CO}
|
\ce{CO2 + C -> 2 CO}
|
||||||
|
\end{Verbatim}
|
||||||
|
|
||||||
|
As you can see, numbers placed after a letter are automatically formatted as a subscript. To format them as a superscript, we just use a caret (\texttt{\^}) before the number. For example, \verb|\ce{CrO4^2-}| produces \ce{CrO4^2-}. Pretty nifty, huh?
|
||||||
|
|
||||||
|
Note that the superscripts and subscripts are not stacked; this is the preferred method according to the IUPAC\footnote{International Union of Pure and Applied Chemistry} Green Book. But if you want them to be stacked, \texttt{mhchem} has this option:
|
||||||
|
|
||||||
|
\begin{Verbatim}[]
|
||||||
|
\mhchemoptions{layout=stacked}
|
||||||
|
\end{Verbatim}
|
||||||
|
|
||||||
|
\mhchemoptions{layout=stacked}
|
||||||
|
|
||||||
|
which will give us stacked superscripts:
|
||||||
|
|
||||||
|
\vspace{\baselineskip}
|
||||||
|
\noindent{}\ce{CrO4^2-}
|
||||||
|
\vspace{\baselineskip}
|
||||||
|
|
||||||
|
\mhchemoptions{layout=staggered-flat}
|
||||||
|
|
||||||
|
It also does a pretty nice job of rendering fractions. \verb|\ce{1/2H2O}| gives us \ce{1/2H2O}. That's not the preferred way according to IUPAC, however. To accomplish that, you should use \verb|\ce{(1/2)H2O}| which gives us \ce{(1/2)H2O}.
|
||||||
|
|
||||||
|
You can also do some fancier things. Here's another example from the manual:
|
||||||
|
|
||||||
|
\begin{Verbatim}[]
|
||||||
\ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-}
|
\ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-}
|
||||||
|
\end{Verbatim}
|
||||||
|
|
||||||
|
which will give us:
|
||||||
|
|
||||||
|
\vspace{\baselineskip}
|
||||||
|
\noindent{}\ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-}
|
||||||
|
\vspace{\baselineskip}
|
||||||
|
|
||||||
\ce{1/2H2O}
|
|
||||||
|
|
||||||
\section{Package \texttt{chemformula}}
|
\section{Package \texttt{chemformula}}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user