From 26696c7b5cd5d64b091bace892fae871f282a1f8 Mon Sep 17 00:00:00 2001 From: Kenneth Odle Date: Wed, 5 Jun 2024 19:46:57 -0400 Subject: [PATCH] =?UTF-8?q?Updates=20to=20=C2=ABchemformula=C2=BB=20sectio?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 004/codex-004.tex | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/004/codex-004.tex b/004/codex-004.tex index 3b9b9be..cde6e04 100644 --- a/004/codex-004.tex +++ b/004/codex-004.tex @@ -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}