Updates to «chemformula» section

This commit is contained in:
Kenneth John Odle 2024-06-05 19:46:57 -04:00
parent e9be3083b1
commit 26696c7b5c

View File

@ -581,18 +581,37 @@ will give us this reaction:
\noindent{}\ch{$2n$ Na + $n$ Cl2 -> $2n$ NaCl}
\vspace{\baselineskip}
We can also write the names of substances underneath them by using a ! and two pairs of parentheses. This code:
\begin{Verbatim}[]
\ch{!( sodium )( $2n$ Na ) + !( chlorine )( $n$ Cl2 ) -> !( s
odium\ chloride )( $2n$ NaCl )}
\end{Verbatim}
gives us this example:
\vspace{\baselineskip}
\noindent{}\ch{!( sodium )( $2n$ Na ) + !( chlorine )( $n$ Cl2 ) -> !( sodium\ chloride )( $2n$ NaCl )}
\vspace{\baselineskip}
Notice that we had to use spaces inside the parentheses so that the package will know how to format these separate types of input. Also, because a space delineates different inputs, in order to get that space in ``sodium chloride'' we had to escape the space with a backward slash.
Again, there are lots of options to customize the output. Here's one with fractions:
\begin{Verbatim}[]
\ch{3/2}
\ch[frac-style=xfrac]{3/2}
\ch{3/2} (vertical fraction) \quad
\ch[frac-style=xfrac]{3/2} (diagonal fraction)
\end{Verbatim}
which gives us:
\vspace{\baselineskip}
\noindent{}\ch{3/2} \par
\noindent{}\ch[frac-style=xfrac]{3/2}
\noindent{}\ch{3/2} (vertical fraction) \quad
\noindent{}\ch[frac-style=xfrac]{3/2} (diagonal fraction)
\vspace{\baselineskip}
Like I said, this one operates a lot like \texttt{mhchem}. If \texttt{mhchem} works for you, there's no need to look further. But if you need more control over the appearance of your formulas and equations, \texttt{chemformula} will give you a lot of that control.
\section{Package \texttt{chemfig}}
@ -604,6 +623,10 @@ Glucose:
-[:-10](-[6,0.7]OH)-[:130]O-[:190]?(-[:150,0.7]-[2,0.7]OH)}
\chemfig{*6(-=(-OH)-=(-OH)-=)}
\chemfig{**6(---(-OH)---)}
\chemfig{HO-*6(-=-=-=)}
\chapter{A \texttt{git} Workflow}