Debian Codegraph @

texmf-dist/doc/latex/chemmacros/chemmacros-manual.tex

raw
1 % --------------------------------------------------------------------------
2 % the CHEMMACROS package v6.2a 2022/03/12
3 %
4 % comprehensive support for typesetting chemistry documents
5 %
6 % --------------------------------------------------------------------------
7 % Web: https://github.org/cgnieder/chemmacros/
8 % E-Mail: [email protected]
9 % --------------------------------------------------------------------------
10 % If you have any ideas, questions, suggestions or bugs to report, please
11 % feel free to contact us.
12 % --------------------------------------------------------------------------
13 % Copyright 2011--2021 Clemens Niederberger
14 % 2022-- Clemens Niederberger & Sonja K.
15 %
16 % This work may be distributed and/or modified under the
17 % conditions of the LaTeX Project Public License, either version 1.3c
18 % of this license or (at your option) any later version.
19 % The latest version of this license is in
20 % http://www.latex-project.org/lppl.txt
21 % and version 1.3c or later is part of all distributions of LaTeX
22 % version 2008/05/04 or later.
23 %
24 % This work has the LPPL maintenance status `maintained'.
25 %
26 % The Current Maintainers of this work are Clemens Niederberger and Sonja K.
27 % --------------------------------------------------------------------------
28 % arara: pdflatex: { interaction: nonstopmode }
29 % arara: biber
30 % arara: pdflatex: { interaction: nonstopmode }
31 % arara: pdflatex: { interaction: nonstopmode }
32 \documentclass{chemmacros-manual}
33
34 \usepackage[T1]{fontenc}
35
36 \addbibresource{\jobname.bib}
37 \addbibresource{cnltx.bib}
38
39 \begin{filecontents*}[overwrite]{\jobname.bib}
40 @book{iupac:greenbook,
41 author = {E. Richard Cohan and Tomislav Cvita\v{s} and Jeremy G. Frey and
42 Bertil Holmstr\"om and Kozo Kuchitsu and Roberto Marquardt and Ian Mills and
43 Franco Pavese and Martin Quack and J\"urgen Stohner and Herbert L. Strauss and
44 Michio Takami and Anders J Thor} ,
45 title = {``Quantities, Symbols and Units in Physical Chemistry'', \acs{iupac}
46 Green Book} ,
47 shorttitle = {The \acs{iupac} Green Book} ,
48 sorttitle = {Quantities, Symbols and Units in Physical Chemistry} ,
49 indexsorttitle = {Quantities, Symbols and Units in Physical Chemistry} ,
50 edition = {3rd Edition. 2nd Printing} ,
51 year = {2008} ,
52 publisher = {\acs{iupac} \&\ RSC Publishing, Cambridge}
53 }
54 @book{iupac:redbook,
55 author = {Neil G. Connelly and Ture Damhus and Richard M. Hartshorn and
56 Alan T. Hutton} ,
57 title = {``Nomenclature of Inorganic Chemistry'', \acs{iupac} Red Book} ,
58 shorttitle = {The \acs{iupac} Red Book} ,
59 sorttitle = {Nomenclature of Inorganic Chemistry} ,
60 indexsorttitle = {Nomenclature of Inorganic Chemistry} ,
61 year = {2005} ,
62 publisher = { \acs{iupac} \&\ RSC Publishing, Cambridge} ,
63 isbn = {0-85404-438-8}
64 }
65 @book{iupac:bluebook,
66 author = {R. Panico and W. H. Powell and J-C. Richer},
67 title = {``Nomenclature of Organic Chemistry, Sections A, B, C, D, E, F,
68 and H'', \acs{iupac} Blue Book},
69 shorttitle = {The \acs{iupac} Blue Book} ,
70 sorttitle = {Nomenclature of Organic Chemistry} ,
71 indexsorttitle = {Nomenclature of Organic Chemistry} ,
72 edition = {\mkbibacro{draft}},
73 date = {2004-10-07},
74 url =
75 {http://old.iupac.org/reports/provisional/abstract04/BB-prs310305/CompleteDraft.pdf},
76 urldate = {2013-07-07}
77 }
78 @misc{eu:ghsystem_regulation,
79 author = {{The European Parliament and The Council of the European Union}},
80 sortname = {European Parliament and The Council of the European Union} ,
81 title = {Regulation (EC) No 1272/2008 of the European Parliament and of
82 the Council} ,
83 subtitle = {on classification, labelling and packaging of substances and
84 mixtures, amending and repealing Directives 67/548/EEC and 1999/45/EC, and
85 amending Regulation (EC) No 1907/2006} ,
86 journal = {Official Journal of the European Union} ,
87 date = {2008-12-16}
88 }
89 @online{unece:ghsystem_implementation,
90 author = {{United Nations Economic Commission for Europe}} ,
91 title = {GHS Implementation} ,
92 url =
93 {http://www.unece.org/trans/danger/publi/ghs/implementation_e.html} ,
94 urldate = {2012-03-20} ,
95 date = {2012-03-20}
96 }
97 @online{cnltx:chemmacros-dev,
98 author = {Clemens Niederberger} ,
99 title = {chemmacros development} ,
100 url = {http://www.cnltx.de/2015/06/chemmacros-development/} ,
101 urldate = {2015-07-16} ,
102 date = {2015-06-14}
103 }
104 @online{cnltx:modular-chemmacros,
105 author = {Clemens Niederberger} ,
106 title = {modular chemmacros} ,
107 url = {http://www.cnltx.de/2015/06/modular-chemmacros/} ,
108 urldate = {2015-07-16} ,
109 date = {2015-06-08}
110 }
111 @online{cnltx:chemmacros-update-how,
112 author = {Clemens Niederberger} ,
113 title = {a new chemmacros -- but how?} ,
114 url = {http://www.cnltx.de/2015/07/a-new-chemmacros-but-how/} ,
115 urldate = {2015-07-16} ,
116 date = {2015-07-15}
117 }
118 @package{pkg:glossaries-extra,
119 title = {glossaries-extra},
120 author = {Nicola L. C. Talbot},
121 date = {2020-04-01},
122 version = {1.45},
123 url = {https://ctan.org/pkg/glossaries-extra/}
124 }
125 @package{pkg:xltabular,
126 title = {xltabular},
127 author = {Herbert Voß and Rolf Niepraschk},
128 date = {2020-11-04},
129 version = {0.2e},
130 url = {https://ctan.org/pkg/xltabular/}
131 }
132 \end{filecontents*}
133
134 \newpackagename\chemformula{chemformula}
135 \newpackagename\ghsystem{ghsystem}
136 \newpackagename\chemgreek{chemgreek}
137
138 \newname\hensel{Martin Hensel}
139 \newname\pedersen{Bj\o rn Pedersen}
140 \newname\leandriis{Sonja K.}
141
142 \renewcommand*\dictumauthorformat[1]{#1}
143 \renewcommand*\raggeddictumtext{}
144
145 \AtBeginDocument{\renewcommand*\reftextfaraway[1]{starting on page~\pageref{#1}}}
146
147 \usepackage{bookmark}
148
149 \begin{document}
150
151 \part{Preliminaries}
152 \section{License}\label{sec:licence-requ-readme}
153 \license
154
155 \section{Motivation and Background}\label{sec:motiv-backgr}
156 This package grew from a small collection of personal helper macros back
157 in~2010 into a rather big package supporting various different chemical
158 typesetting tasks. I hope I have achieved the following points with this
159 package:
160 \begin{itemize}
161 \item Intuitive usage as far as the syntax of the commands is concerned.
162 \item A comprehensive set of macros! If there are any needs you might have
163 with respect to typesetting of chemistry which is not supported by this
164 package\footnote{Not including needs already solved by other packages such
165 as \pkg{chemnum} or \pkg{chemfig}.} then let me know so \chemmacros\ can
166 be extended.
167 \item The commands shall not only make typesetting easier and faster but
168 also the document source more readable with respect to semantics
169 (\code{\cs{ortho}-dichlorobenzene} is easier to read and understand than
170 \code{\cs*{textit}\Marg{o}-dichlorobenzene}); the first variant in my
171 opinion also is more in the spirit of \LaTeXe.
172 \item As much customizability as I could think of so every user can adapt
173 the commands to his or her own wishes. Every now and then users have
174 wishes which can't be solved with the available options. Almost always
175 I'll add options then. If you find something please contact me, see
176 section~\vref{sec:sugg-bug-reports}.
177 \item Default settings that are compliant with the recommendations of the
178 \acf{iupac}.
179 \end{itemize}
180 Especially the last point in the past needed some pushing from users to get
181 things right in many places. If you find anything not compliant with
182 \ac{iupac} recommendations please contact me, see
183 section~\vref{sec:sugg-bug-reports}. Don't forget to add references for the
184 corresponding \ac{iupac} recommendation.
185
186 \section{The Structure of \chemmacros}\label{sec:structure-chemmacros}
187 \subsection{General Structure}
188 Since version~5.0 the \chemmacros\ package has a strictly modular
189 structure\sinceversion{5.0}. On the one hand this eases maintenance but it
190 will also allow for easy and quick extension in the future. In a way it is a
191 logical consequence from \chemmacros' history: since version~2.0, \ie, since
192 the fall of~2011 \chemmacros\ already had modular options.
193
194 Since version~6.0 the different modules of \chemmacros\ are divided into three
195 groups:
196 \begin{enumerate}
197 \item Core modules which provide underlying functionality or basic
198 functionality and which are not of direct interest from a user perspective
199 but might be if you plan to write a module yourself (see
200 section~\ref{sec:own-modules} for details). These modules are described in
201 part~\ref{part:core-modules} of this manual.
202 \item Main modules which provide all the stuff for typesetting and which are
203 always loaded. These modules are described in
204 part~\ref{part:main-modules} of this manual.
205 \item Additional modules which are also loaded in the default setup. They
206 are not loaded if \chemmacros\ is loaded with the minimal setup:
207 \cs*{usepackage}\Oarg{minimal}\Marg{chemmacros}. These modules are described in
208 part~\ref{part:additional-modules} of this manual.
209 \end{enumerate}
210
211 \subsection{\chemmacros' Options}\label{sec:using-chemm-opti}
212 Prior to v5.0 \chemmacros\ had quite a number of load-time options.
213 \chemmacros\ v6.0 has only two:
214 \begin{options}
215 \keybool{minimal}\Initial{false}
216 Loads \chemmacros\ with the basic preset of modules.
217 \keyval{modules}{comma separated list of module names}\Initial
218 When \option{minimal} is used this option allows to load additional
219 modules.
220 \end{options}
221 These options only can be used in the optional argument of
222 \cs*{usepackage}. \emph{All} other of \chemmacros' options are set using the
223 command
224 \begin{commands}
225 \command{chemsetup}[\oarg{module}\marg{option list}]
226 \chemmacros' setup command.
227 \end{commands}
228
229 When an option is described then in the left margin the module the option
230 belongs to is denoted. This looks something like this:
231 \begin{options}
232 \keyval{option}{value}\Module{module}\Initial
233 Description of \option{option}. The module is printed in the left margin.
234 The default value to the right is the setting the option has when
235 \chemmacros\ is loaded. This can be an explicit setting but the option
236 can also be empty.
237 \keychoice{choice-option}{list,of,\default{choices}}\Module{module}\Initial{list}
238 Description of \option{choice-option}. A choice option can only be used
239 with a predefined list of values. If one of the values is underlined it
240 means that the option can be used without value in which case the
241 underlined value is chosen. If no value is underlined then a value
242 \emph{has} to be given by the user.
243 \keybool{boolean-option}\Module{module}\Initial{true}
244 Description of \option{boolean-option}. A boolean option is a choice
245 option with exactly the two values \code{true} and \code{false}. If the
246 option is called without value then the underlined value is chosen (which
247 is always \code{true} for a boolean option).
248 \end{options}
249
250 An option or list of options belonging to a module \chemmodule{module} can be
251 set in two ways:
252 \begin{sourcecode}
253 % first possibility:
254 \chemsetup[module]{
255 option1 = value ,
256 option2 = value
257 }
258 % second possibility:
259 \chemsetup{
260 module/option1 = value ,
261 module/option2 = value
262 }
263 \end{sourcecode}
264 The second way allows to set options belonging to different modules with one
265 call of \cs{chemsetup}.
266
267 \chemmacros\ has some core options which don't belong to any of the modules
268 described in parts~\ref{part:main-modules} and~\ref{part:additional-modules}.
269 Those options have no module denoted in the left margin next to their
270 descriptions and are also set without specifying a module:
271 \begin{sourcecode}
272 \chemsetup{
273 option1 = value ,
274 option2 = value
275 }
276 \end{sourcecode}
277 Some internal modules may also define core options, \eg, the \chemmodule{lang}
278 module, see section~\vref{sec:lang-module}.
279
280 \subsection{Support Package \chemformula}\label{sec:supp-pack-chemf}
281 \chemformula\ provides means of typesetting chemical formulas and reactions.
282 You will see its macros \cs{ch} and \cs{chcpd} every now and then in this
283 manual. When using \chemmacros\ you can consider the \chemformula\
284 package~\cite{pkg:chemformula} to be loaded as \chemmacros\ makes use of it in
285 various places. \chemmacros\ and \chemformula\ are tightly intertwined.
286 Nevertheless you should be able to use the \pkg{mhchem}~\cite{pkg:mhchem}
287 package with \chemmacros\ without problems. Please see
288 section~\vref{sec:using-mhchem} for details and \latin{caveat}s.
289
290 A historical note: \chemformula\ started as a part of \chemmacros\ in
291 January~2012. Since July~2013 it is a completely independent package -- from
292 \chemformula's point of view. It is maintained independently and has a manual
293 of its own.
294
295 \subsection{Upgrading from version $5.x$}
296 People upgrading from versions $<6.0$ will find that almost everything they
297 know from earlier versions is the same in versions $6.x$. But there are
298 important and \emph{breaking} differences:
299 \begin{itemize}
300 \item The compatibility mode and all its commands have been dropped.
301 \item The option \option{modules} now is a load-time option and cannot be
302 set through \cs{chemsetup} any more. The command \cs{usechemmodule} has
303 been dropped.
304 \item Per default \emph{all} modules are now loaded. A new option
305 \option{minimal} allows to load \chemmacros\ with smallest subset
306 necessary. Then additional modules can be added with the
307 \option{modules}.
308 \item A new module \module{reactants} has been added, thanks to \leandriis!
309 \end{itemize}
310
311 \part{Main Modules}\label{part:main-modules}
312
313 The modules described in this part are always loaded by \chemmacros, even in
314 the minimal setup.
315
316 \section{The \chemmodule*{acid-base} Module}\label{sec:acid-base-module}
317
318 Easy representation of \pH, \pKa \ldots
319 \begin{commands}
320 \command{pH} \pH
321 \command{pOH} \pOH
322 \command{Ka} \Ka, depends on language settings, see
323 section~\vref{sec:lang-module}. The translations can be adapted.
324 \command{Kb} \Kb
325 \command{Kw} \Kw
326 \command{pKa}[\oarg{num}] \cs{pKa}: \pKa, \cs{pKa}\Oarg{1}: \pKa[1], depends
327 on language settings, see section~\vref{sec:lang-module}. The translations
328 can be adapted.
329 \command{pKb}[\oarg{num}] \cs{pKb}: \pKb, \cs{pKb}\Oarg{1}: \pKb[1]
330 \command{p}[\marg{anything}] \eg\ \cs{p}\Marg{\cs{Kw}} \p{\Kw}
331 \end{commands}
332
333 \begin{example}[side-by-side]
334 \Ka\ \Kb\ \pKa\ \pKa[1] \pKb\ \pKb[1]
335 \end{example}
336
337 \begin{cnltxquote}[{\citetitle{iupac:greenbook} \cite[][p.\,103]{iupac:greenbook}}]
338 The operator \p{} \textelp{} shall be printed in Roman type.
339 \end{cnltxquote}
340
341 There is one option which changes the style the \p{} is typeset, other options
342 allow to change the subscript of the constants:
343 \begin{options}
344 \keychoice{p-style}{italics,slanted,upright}\Module{acid-base}\Initial{upright}
345 Set the style of the \p{} operator.
346 \keyval{K-acid}{text}\Module{acid-base}\Initial{\cs{ChemTranslate}\Marg{K-acid}}
347 The subscript to \cs{Ka} and \cs{pKa}.
348 \keyval{K-base}{text}\Module{acid-base}\Initial{\cs{ChemTranslate}\Marg{K-base}}
349 The subscript to \cs{Kb} and \cs{pKb}.
350 \keyval{K-water}{text}\Module{acid-base}\Initial{\cs{ChemTranslate}\Marg{K-water}}
351 The subscript to \cs{Kw}.
352 \keyval{eq-constant}{text}\Module{acid-base}\Initial{K}
353 The\sinceversion{5.4} symbol of the constants.
354 \end{options}
355 \begin{example}
356 \pH, \pKa \par
357 \chemsetup[acid-base]{p-style=slanted} \pH, \pKa \par
358 \chemsetup[acid-base]{p-style=italics} \pH, \pKa
359 \end{example}
360
361 As you can see the default subscripts of \cs{Kw}, \cs{Ka} and \cs{Kb} are
362 lowercase letters. The literature is inconclusive about if this is the right
363 way or if uppercase letters should be preferred. In textbooks the uppercase
364 variant usually seems to be used while journals seem to prefer the lowercase
365 variant. \chemmacros' default follows the usage in
366 \citetitle{iupac:greenbook}~\cite{iupac:greenbook}. If you want to change
367 this you have two possibilities:
368
369 \begin{example}
370 % this works only in the preamble:
371 % \DeclareTranslation{English}{K-acid}{\mathrm{A}}% use your language here
372 % alternative:
373 \chemsetup{acid-base/K-acid=\mathrm{A}}% overwrites language dependent settings
374 \pKa
375 \end{example}
376
377 The\sinceversion{5.4} constants \Ka, \Kb, and \Kw\ were defined using the
378 following commands:
379 \begin{commands}
380 \command{NewChemEqConstant}[\marg{cs}\marg{name}\marg{subscript}]
381 Define the constant \meta{cs} with the name \meta{name} and the subscript
382 \meta{subscript}. This also defines the default translation with the key
383 \meta{name} using \meta{subscript} as fallback translation (see
384 section~\vref{sec:lang-module} for details). It also defines the option
385 \meta{name} for setting the subscript.
386 \command{RenewChemEqConstant}[\marg{cs}\marg{name}\marg{default appearance}]
387 The same as \cs{NewChemEqConstant} but renews an existing command.
388 \command{DeclareChemEqConstant}[\marg{cs}\marg{name}\marg{default appearance}]
389 The same as \cs{NewChemEqConstant} but overwrites existing commands.
390 \command{ProvideChemEqConstant}[\marg{cs}\marg{name}\marg{default appearance}]
391 The same as \cs{NewChemEqConstant} but doesn't throw an error if \meta{cs}
392 already exists.
393 \end{commands}
394
395 This is how \cs{Ka} is defined:
396 \begin{sourcecode}
397 \NewChemEqConstant\Ka{K-acid}{\mathrm{a}}
398 \end{sourcecode}
399
400 \section{The \chemmodule*{charges} Module}\label{sec:charges-module}
401
402 The \chemmodule{charges} module loads the module \chemmodule{formula}.
403
404 \subsection{Charge Symbols}
405 \begin{commands}
406 \command{fplus} \fplus\ formal positive charge
407 \command{fminus} \fminus\ formal negative charge
408 \command{scrp} \scrp\ scriptstyle positive charge (\eg, for usage in
409 \pkg{chemfig}'s~\cite{pkg:chemfig} formulas).
410 \command{scrm} \scrm\ scriptstyle negative charge (\eg, for usage in
411 \pkg{chemfig}'s formulas).
412 \command{fscrp} \fscrp\ scriptstyle formal positive charge (\eg, for usage
413 in \pkg{chemfig}'s formulas).
414 \command{fscrm} \fscrm\ scriptstyle formal negative charge (\eg, for usage
415 in \pkg{chemfig}'s formulas).
416 \command{fsscrp} \fsscrp\ scriptscriptstyle formal positive charge (\eg, for
417 usage in \pkg{chemfig}'s formulas).
418 \command{fsscrm} \fsscrm\ scriptscriptstyle formal negative charge (\eg, for
419 usage in \pkg{chemfig}'s formulas).
420 \end{commands}
421
422 \subsection{Ion Charges}\label{sec:ion-charges}
423 Simple displaying of (real) charges. It is worth noting that these commands
424 really are relics from a time when \chemmacros\ tried hard to be compliant
425 with \pkg{mhchem} and \chemformula\ didn't exist, yet. \textbf{They are still
426 provided for backwards compatibility but \emph{my recommendation is to use}
427 \cs{ch} (see the documentation of the \chemformula\
428 package~\cite{pkg:chemformula}) \emph{and forget about these commands:}}
429 \begin{commands}
430 \command{pch}[\oarg{number}]
431 positive charge
432 \command{mch}[\oarg{number}]
433 negative charge
434 \command{fpch}[\oarg{number}]
435 formal positive charge
436 \command{fmch}[\oarg{number}]
437 formal negative charge
438 \end{commands}
439 \begin{example}[side-by-side]
440 A\pch\ B\mch[3] C\fpch[2] D\fmch
441 \end{example}
442
443 \subsection{Partial Charges and Similar Stuff}\label{sec:part-charg-simil}
444
445 The next ones probably are seldomly needed but nevertheless useful:
446 \begin{commands}
447 \command{delp} \delp\ partial positive charge
448 \command{delm} \delm\ partial negative charge
449 \command{fdelp} \fdelp\ partial formal positive charge
450 \command{fdelm} \fdelm\ partial formal negative charge
451 \end{commands}
452
453 These macros for example can be used with the \cs{ox} command (see
454 section~\vref{sec:redox-module}) or with the \pkg{chemfig} package:
455 \begin{example}
456 \chemsetup{
457 charges/circled = all,
458 redox/parse = false,
459 redox/pos = top
460 }
461 \ch{"\ox{\delp,H}" -{} "\ox{\delm,Cl}"} \hspace*{1cm}
462 \chemfig{\chemabove[3pt]{\charge{90=\|,180=\|,270=\|}{Br}}{\delm}-\chemabove[3pt]{H}{\delp}}
463 \end{example}
464
465 \subsection{Charge Options}
466
467 \begin{options}
468 \keychoice{circled}{formal,\default{all},none}\Module{charges}\Initial{formal}
469 \chemmacros\ uses two different kinds of charges which indicate the usage
470 of real ($+/-$) and formal (\fplus/\fminus) charges. The option
471 \code{formal} distinguishes between them, option \code{none} displays them
472 all without circle, option \code{all} circles all.
473 \keychoice{circletype}{chem,math}\Module{charges}\Initial{chem}
474 This option switches between two kinds of circled charge symbols:
475 \cs{fplus} \fplus/\cs{fminus} \fminus\ (\code{chem}) and
476 \verbcode+$\oplus$+ $\oplus$/\verbcode+$\ominus$+ $\ominus$ (\code{math}).
477 \keyval{partial-format}{\LaTeX\ code}\Module{charges}\Initial{\cs*{tiny}}
478 Code which formats the macros defined with \cs{NewChemPartialCharge} (see
479 section~\ref{sec:own-charge-macros}).
480 \end{options}
481
482 \subsection{Own Charge Macros}\label{sec:own-charge-macros}
483 Just in case the existing macros don't fit you needs there are commands for
484 defining new ones or modifying the existing ones. These commands define
485 macros like those described in section~\vref{sec:ion-charges}.
486
487 \begin{commands}
488 \command{NewChemCharge}[\marg{cs}\marg{charge symbol}]
489 Defines a new macro \meta{cs}. Raises an error if \meta{cs} already
490 exists.
491 \command{RenewChemCharge}[\marg{cs}\marg{charge symbol}]
492 Redefines a new macro \meta{cs}. Raises an error if \meta{cs} doesn't
493 exist.
494 \command{DeclareChemCharge}[\marg{cs}\marg{charge symbol}]
495 Defines a macro \meta{cs}. Silently overwrites \meta{cs} if it exists.
496 \command{ProvideChemCharge}[\marg{cs}\marg{charge symbol}]
497 Defines a new macro \meta{cs}. Does nothing if \meta{cs} already exists.
498 \end{commands}
499 An example of usage is the definition of the existing ion charge macros:
500 \begin{sourcecode}
501 \NewChemCharge\fpch{\fplus}
502 \NewChemCharge\fmch{\fminus}
503 \end{sourcecode}
504
505 These commands define macros like those described in
506 section~\vref{sec:part-charg-simil}.
507 \begin{commands}
508 \command{NewChemPartialCharge}[\marg{cs}\marg{charge symbol}]
509 Defines a new macro \meta{cs}. Raises an error if \meta{cs} already
510 exists.
511 \command{RenewChemPartialCharge}[\marg{cs}\marg{charge symbol}]
512 Redefines a new macro \meta{cs}. Raises an error if \meta{cs} doesn't
513 exist.
514 \command{DeclareChemPartialCharge}[\marg{cs}\marg{charge symbol}]
515 Defines a macro \meta{cs}. Silently overwrites \meta{cs} if it exists.
516 \command{ProvideChemPartialCharge}[\marg{cs}\marg{charge symbol}]
517 Defines a new macro \meta{cs}. Does nothing if \meta{cs} already exists.
518 \end{commands}
519 An example of usage is the definition of the existing partial charge macros:
520 \begin{sourcecode}
521 \NewChemPartialCharge\fdelp{\fplus}
522 \NewChemPartialCharge\fdelm{\fminus}
523 \end{sourcecode}
524
525 \section{The \chemmodule*{nomenclature} Module}\label{sec:nomenclature-module}
526
527 The \chemmodule{nomenclature} module loads the \chemmodule{tikz} module. It
528 also loads the package \pkg{scrlfile} which is part of the
529 \KOMAScript\ bundle~\cite{bnd:koma-script}.
530
531 \subsection{The \cs*{iupac} Command}
532
533 Similar to the \pkg{bpchem} package~\cite{pkg:bpchem} \chemmacros\ provides a
534 command\footnote{The idea and initial implementation is shamelessly borrowed
535 from \pkg{bpchem} by \pedersen.} for typesetting \ac{iupac} names. Why is
536 that useful? \ac{iupac} names can get very long. So long indeed that they
537 span over more than two lines, especially in two-column documents. This means
538 they must be allowed to be broken more than one time. This is what the
539 following command does.
540 \begin{commands}
541 \command{iupac}[\marg{IUPAC name}]
542 Inside this command use \sym{\textbar} indicate a breaking point
543 \sym{\textasciicircum} as a shortcut for \cs*{textsuperscript}. \sym{-},
544 \sym{(} and \sym{)} allow words to be broken while still allow the rest of
545 word to be hyphenated, likewise \sym{[} and \sym{]}.
546 \end{commands}
547
548 \begin{example}
549 \begin{minipage}{.4\linewidth}
550 \iupac{%
551 Tetra|cyclo[2.2.2.1^{1,4}]-un|decane-2-dodecyl-%
552 5-(hepta|decyl|iso|dodecyl|thio|ester)%
553 }
554 \end{minipage}
555 \end{example}
556
557 The \cs{iupac} command is more of a semantic command. In many cases you can
558 achieve (nearly) the same thing by using \cs*{-} instead of \sym{\textbar},
559 and \cs*{textsuperscript} instead of \sym{\textasciicircum} without
560 \cs{iupac}. There are some important differences, though:
561 \begin{itemize}
562 \item The character \sym{-} inserts a small space before the hyphen and
563 removes a small space after it. Also usually words with hyphens are only
564 allowed to break at the hyphen. Inside \cs{iupac} the hyphen will not
565 prevent further hyphenation. The amount of inserted space can be
566 customized.
567 \item The character \sym{\textbar} not only prevents ligatures but also
568 inserts a small space. The amount of inserted space can be customized.
569 \item The characters \sym{(} and \sym{)} allow the word to be hyphenated and
570 don't prevent further hyphenation, likewise \sym{[} and \sym{]}.
571 \item \sinceversion{5.3}The character \sym{'} is printed as \cs{chemprime}.
572 \item \sinceversion{5.8c}The character \sym{=} is printed ad
573 \cs{nonbreakinghyphen}.
574 \end{itemize}
575 \begin{example}[side-by-side]
576 \huge\iupac{2,4-Di|chlor|pentan} \par
577 2,4-Dichlorpentan
578 \end{example}
579 \begin{commands}
580 \command{chemprime}
581 Prints\sinceversion{5.3} a prime character in superscript position. It is
582 defined as \verbcode+\ensuremath{{}^{\prime}}+.
583 \command{nonbreakinghyphen}
584 Prints\sinceversion{5.8c} a hyphen which doesn't allow a line-break after
585 it. It is defined as \verbcode+\mbox{-}\nobreak\hspace{0pt}+.
586 \end{commands}
587
588 The spaces inserted by \sym{-} and \sym{\textbar} can be
589 customized.
590 \begin{options}
591 \keyval{hyphen-pre-space}{dim}\Module{nomenclature}\Initial{.01em}
592 Set the space that is inserted before the hyphen set with \sym{-}.
593 \keyval{hyphen-post-space}{dim}\Module{nomenclature}\Initial{-.03em}
594 Set the space that is inserted after the hyphen set with \sym{-}.
595 \keyval{break-space}{dim}\Module{nomenclature}\Initial{.01em}
596 Set the space inserted by \sym{\textbar}.
597 \end{options}
598
599 The command \cs{iupac} serves another purpose, too, however. Regardless of
600 the setting of the \option{iupac} option (see below) all the commands
601 presented in this section are always defined \emph{inside} \cs{iupac}. Quite
602 a number of the naming commands have very general names: \cs{meta}, \cs{D},
603 \cs{E}, \cs{L}, \cs{R}, \cs{S}, \cs{trans} and so forth\footnote{Please read
604 section~\vref{sec:one-letter-commands} before you consider using the
605 one-letter commands}. This means they either are predefined already (\cs{L}
606 \L) or are easily defined by another package or class (the \pkg{cool} package
607 defines both \cs{D} and \cs{E}, for example). In order to give you control
608 which commands are defined in which way, there is the option \option{iupac}:
609 \begin{options}
610 \keychoice{iupac}{auto,restricted,strict}\Module{nomenclature}\Initial{auto}
611 Take care of how \ac{iupac} naming commands are defined.
612 \end{options}
613 It has three modes:
614 \begin{itemize}
615 \item \keyis{iupac}{auto}: if the commands are \emph{not} defined by any
616 package or class you're using they are available generally, otherwise only
617 \emph{inside} \cs{iupac}.
618 \item \keyis{iupac}{restricted}: all naming commands are \emph{only} defined
619 inside \cs{iupac}. If the commands are defined by another package they of
620 course have that meaning outside. They're not defined outside otherwise.
621 \item \keyis{iupac}{strict}: \chemmacros\ overwrites any other definition and
622 makes the commands available throughout the document. Of course the
623 commands can be redefined (but only in the document body). They will still
624 be available inside \cs{iupac} then.
625 \end{itemize}
626 Table~\vref{tab:iupac_modes} demonstrates the different modes.
627
628 \begin{table}
629 \centering
630 \caption{Demonstration of \option*{iupac}'s modes.}\label{tab:iupac_modes}
631 \begin{tabular}{lccc}
632 \toprule
633 & auto & restricted & strict \\
634 \midrule
635 \cs{L} & \L & \L & \iupac{\L} \\
636 \cs{iupac}\Marg{\cs{L}} & \iupac{\L} & \iupac{\L} & \iupac{\L} \\
637 \cs{D} & \D & --- & \D \\
638 \cs{iupac}\Marg{\cs{D}} & \iupac{\D} & \iupac{\D} & \iupac{\D} \\
639 \bottomrule
640 \end{tabular}
641 \end{table}
642
643 \subsection{Macros Defined (Not Only) For Usage in \cs*{iupac}}
644
645 \subsection{One-letter Macros}\label{sec:one-letter-commands}
646 For some of the macros explained in this section one-letter commands are
647 defined -- with a \latin{caveat} in mind, though: they are not actively
648 recommended. One-letter commands seldomly have meaningful names and often
649 they've also been defined by other packages. This means they make
650 collaboration more difficult than it needs to be and are a source for package
651 conflicts. \chemmacros\ solves the latter problem by only providing them
652 inside the argument of \cs{iupac}. The one exception \chemmacros\ makes is
653 the command \cs{p} (for things like \pH) which is and will remain an official
654 command (see section~\vref{sec:acid-base-module}). For all other one-letter
655 macros alternatives with more meaningful names exist.
656
657 \subsection{Greek Letters}\label{par:greek_letters}
658
659 Greek letters in compound names are typeset upright. Here are a few examples
660 for the existing macros:
661 \begin{commands}
662 \command{chemalpha}[\quad\chemalpha]
663 Upright lowercase alpha
664 \command{chembeta}[\quad\chembeta]
665 Upright lowercase alpha
666 \command{chemgamma}[\quad\chemgamma]
667 Upright lowercase alpha
668 \command{chemdelta}[\quad\chemdelta]
669 Upright lowercase alpha
670 \end{commands}
671 There exist two commands for each of the twenty-four Greek letters: a
672 lowercase and an uppercase version (\cs{chemalpha} and \cs{chemAlpha}). Those
673 commands are actually provided by the \chemgreek\ package. For more details
674 read section~\vref{sec:greek-module} and also refer to \chemgreek's
675 documentation.
676
677 There are a number of one-letter commands that some people may find convenient
678 to use which use above mentioned commands to print Greek letters inside
679 \cs{iupac}. They're listed in table~\vref{tab:iupac-greek-shortcuts}.
680
681 \begin{table}
682 \centering
683 \caption{\acs*{iupac} shortcuts for Greek letters.}
684 \label{tab:iupac-greek-shortcuts}
685 \begin{tabular}{*9l}
686 \toprule
687 macro &
688 \cs{a} & \cs{b} & \cs{g} & \cs{d} &
689 \cs{k} & \cs{m} & \cs{n} & \cs{w} \\
690 \midrule
691 letter &
692 \iupac{\a} & \iupac{\b} & \iupac{\g} & \iupac{\d} &
693 \iupac{\k} & \iupac{\m} & \iupac{\n} & \iupac{\w} \\
694 \bottomrule
695 \end{tabular}
696 \end{table}
697
698 \begin{example}
699 \iupac{5\chemalpha-androstan-3\chembeta-ol} \par
700 \iupac{\chemalpha-(tri|chloro|methyl)-\chemomega
701 -chloro|poly(1,4-phenylene|methylene)}
702 \end{example}
703
704 \subsection{Hetero Atoms and added Hydrogen}
705
706 Attachments to hetero atoms and added hydrogen atoms are indicated by italic
707 letters~\cite{iupac:greenbook}. \chemmacros\ defines a few macros for the
708 most common ones.
709 \begin{commands}
710 \iupaccs[H]{hydrogen}{The italic H for hydrogen.}
711 \iupaccs[O]{oxygen}{The italic O for oxygen.}
712 \iupaccs[N]{nitrogen}{The italic N for nitrogen.}
713 \iupaccs[Sf]{sulfur}{The italic S for sulfur.}
714 \iupaccs[P]{phosphorus}{The italic P for phosphorus.}
715 \end{commands}
716 \begin{example}[side-by-side]
717 \iupac{\nitrogen-methyl|benz|amide}
718
719 \iupac{3\hydrogen-pyrrole}
720
721 \iupac{\oxygen-ethyl hexanethioate}
722 \end{example}
723
724 \subsection{Cahn-Ingold-Prelog}\label{par:cip}
725 \begin{commands}
726 \command{cip}[\marg{conf}]
727 Typeset Cahn-Ingol-Prelog descriptors, \eg: \cs{cip}\Marg{R,S}
728 \cip{R,S}. \meta{conf} may be a csv list of entries.
729 \iupaccs[R]{rectus}{The rectus descriptor.}
730 \iupaccs[S]{sinister}{The sinister descriptor.}
731 \end{commands}
732
733 Both these commands and the entgegen/zusammen descriptors get a small
734 additional amount of kerning after the closing parenthesis. This amount can
735 be changed through the following option:
736 \begin{options}
737 \keyval{cip-kern}{dim}\Module{nomenclature}\Initial{.075em}
738 Set the amount of kerning after the closing parenthesis.
739 \end{options}
740 The entries typeset by and implemented with \cs{cip} can be customized
741 further:
742 \begin{options}
743 \keyval{cip-outer-format}{format}\Initial{\cs*{upshape}}
744 \sinceversion{5.8}The format of parentheses and commas typeset by
745 \cs{cip}.
746 \keyval{cip-inner-format}{format}\Initial{\cs*{itshape}}
747 \sinceversion{5.8}The format of the entries in \cs{cip}. This format
748 works additive to the outer format.
749 \keyval{cip-number-format}{format}\Initial{\cs*{upshape}}
750 \changedversion{6.0}The format of numbers in \cs{cip}. This format works
751 additive to the outer format and is applied to Arabic figures only.
752 \end{options}
753
754 \subsection{Fischer}
755 \begin{commands}
756 \iupaccs[D]{dexter}{The dexter descriptor.}
757 \iupaccs[L]{laevus}{The laevus descriptor.}
758 \end{commands}
759
760 \subsection{cis/trans, zusammen/entgegen, syn/anti \& tert}
761 \begin{itemize}
762 \item \cs{cis} \iupac{\cis} \quad \cs{trans} \iupac{\trans}
763 \item \cs{fac} \iupac{\fac} \quad \cs{mer} \iupac{\mer}
764 \item \cs{sin} \iupac{\sin} \quad \cs{ter} \iupac{\ter}
765 \item \cs{zusammen} \iupac{\zusammen} \quad \cs{entgegen} \iupac{\entgegen}
766 \item \cs{syn} \iupac{\syn} \quad \cs{anti} \iupac{\anti}
767 \item \cs{tert} \iupac{\tert}
768 \end{itemize}
769 An alias for \cs{entgegen} is \cs{E} and an alias for \cs{zusammen} is
770 \cs{Z}.
771
772 \subsection{ortho/meta/para}
773 \begin{center}
774 \cs{ortho} \iupac{\ortho} \quad
775 \cs{meta} \iupac{\meta} \quad
776 \cs{para} \iupac{\para}
777 \end{center}
778
779 Although these commands are provided I like to cite
780 \citetitle{iupac:bluebook}~\cite{iupac:bluebook}:
781
782 \begin{cnltxquote}[{\cite[][p.\,90]{iupac:bluebook}}]
783 The letters \iupac{\ortho}, \iupac{\meta}, and \iupac{\para} have been used
784 in place of \textit{ortho}, \textit{meta}, and \textit{para}, respectively,
785 to designate the 1,2-, 1,3-, and 1,4- isomers of disubstituted benzene.
786 This usage is strongly discouraged and is not used in preferred \acs{iupac}
787 names.
788 \end{cnltxquote}
789
790 \subsection{Absolute Configuration}
791 \begin{commands}
792 \command{Rconf}[\oarg{letter}]
793 \cs{Rconf}: \Rconf \quad \cs{Rconf}\oarg{}: \Rconf[]
794 \command{Sconf}[\oarg{letter}]
795 \cs{Sconf}: \Sconf \quad \cs{Sconf}\oarg{}: \Sconf[]
796 \end{commands}
797
798 \subsection{Coordination Chemistry}
799
800 \chemmacros\ provides a few commands useful in coordination chemistry:
801 \begin{commands}
802 \command{bridge}[\marg{num}\quad\bridge{3}]
803 Denote bridging ligand connection.
804 \command{hapto}[\marg{num}\quad\hapto{5}]
805 Denote hapticity.
806 \command{dento}[\marg{num}\quad\dento{2}]
807 Denote denticity.
808 \end{commands}
809 \begin{example}
810 Ferrocene = \iupac{bis(\hapto{5}cyclo|penta|dienyl)iron} \par
811 \iupac{tetra-\bridge{3}iodido-tetrakis[tri|methyl|platinum(IV)]}
812 \end{example}
813
814 Two options allow customization:
815 \begin{options}
816 \keychoice{bridge-number}{sub,super}\Module{nomenclature}\Initial{sub}
817 Appends the number as a subscript or superscript, depending on the choice.
818 The \ac{iupac} recommendation is the subscript~\cite{iupac:redbook}.
819 \keybool{coord-use-hyphen}\Module{nomenclature}\Initial{true}
820 Append a hyphen to \cs{hapto}, \cs{dento} and \cs{bridge} or don't.
821 \end{options}
822
823 The default behavior\sinceversion{5.8} of \cs{hapto} and \cs{dento} has
824 changed with version~5.8 to follow \ac{iupac} recommendations.
825
826 \subsection{Examples}
827 \begin{example}
828 \iupac{\dexter-Wein|s\"aure} =
829 \iupac{\cip{2S,3S}-Wein|s\"aure} \par
830 \iupac{\dexter-($-$)-Threose} =
831 \iupac{\cip{2S,3R}-($-$)-2,3,4-Tri|hydroxy|butanal} \par
832 \iupac{\cis-2-Butene} =
833 \iupac{\zusammen-2-Butene}, \par
834 \iupac{\cip{2E,4Z}-Hexa|diene} \par
835 \iupac{\meta-Xylol} =
836 \iupac{1,3-Di|methyl|benzene}
837 \end{example}
838
839 \subsection{Own \cs*{iupac} Macros And Shorthands}
840
841 If you find any commands missing you can define them using
842 \begin{commands}
843 \command{NewChemIUPAC}[\marg{cs}\marg{declaration}]
844 Define a new \ac{iupac} command that is in any case defined inside of
845 \cs{iupac} regardless if \meta{cs} is defined elsewhere already.
846 \command{ProvideChemIUPAC}[\marg{cs}\marg{declaration}]
847 Define a new \ac{iupac} command that is in any case defined inside of
848 \cs{iupac} regardless if \meta{cs} is defined elsewhere already only if
849 the corresponding \ac{iupac} macro is not defined, yet.
850 \command{RenewChemIUPAC}[\marg{cs}\marg{declaration}]
851 Redefine an existing \ac{iupac} command that is in any case defined inside
852 of \cs{iupac} regardless if \meta{cs} is defined elsewhere already.
853 \command{DeclareChemIUPAC}[\marg{cs}\marg{declaration}]
854 Define a new \ac{iupac} command that is in any case defined inside of
855 \cs{iupac} regardless if \meta{cs} is defined elsewhere already. This
856 silently overwrites an existing \ac{iupac} macro definition.
857 \command{LetChemIUPAC}[\marg{cs1}\marg{cs2}]
858 Defines \meta{cs1} to be an alias of \meta{cs2}.
859 \end{commands}
860 A command defined in this way will obey the setting of the option
861 \option{iupac}. This means any existing command is only overwritten with
862 \keyis{iupac}{strict}. However, \cs{NewChemIUPAC} will \emph{not} change the
863 definition of an existing \ac{iupac} naming command but issue an error if the
864 \ac{iupac} naming command already exists. \cs{DeclareChemIUPAC} \emph{will}
865 overwrite an existing \ac{iupac} command.
866 \begin{example}
867 \NewChemIUPAC\endo{\textsc{endo}}
868 \RenewChemIUPAC\anti{\textsc{anti}}
869 \iupac{(2-\endo,7-\anti)-2-bromo-7-fluoro|bicyclo[2.2.1]heptane}
870 \end{example}
871
872 \cs{RenewChemIUPAC} allows you to redefine the existing \ac{iupac} naming
873 commands.
874 \begin{example}[side-by-side]
875 \iupac{\meta-Xylol} \par
876 \RenewChemIUPAC\meta{\textup{m}}
877 \iupac{\meta-Xylol}
878 \end{example}
879
880 There's also a way for defining new \ac{iupac} shorthands or changing the
881 existing ones:
882 \begin{commands}
883 \command{NewChemIUPACShorthand}[\meta{shorthand token}\meta{control sequence}]
884 Defines a new \ac{iupac} shorthand. Inside \cs{iupac} it will be equal to
885 using \meta{control sequence}. This throws an error if \meta{shorthand
886 token} is already defined.
887 \command{RenewChemIUPACShorthand}[\meta{shorthand token}\meta{control sequence}]
888 Redefines an existing \ac{iupac} shorthand. This throws an error if
889 \meta{shorthand token} is not defined, yet.
890 \command{DeclareChemIUPACShorthand}[\meta{shorthand token}\meta{control sequence}]
891 Defines a new \ac{iupac} shorthand or redefines an existing one.
892 \command{ProvideChemIUPACShorthand}[\meta{shorthand token}\meta{control sequence}]
893 Provides a new \ac{iupac} shorthand. Does nothing if \meta{shorthand
894 token} is already defined.
895 \command{RemoveChemIUPACShorthand}[\meta{shorthand token}]
896 Deletes an existing \ac{iupac} shorthand.
897 \end{commands}
898
899 \subsection{Latin Phrases}
900
901 \chemmacros\ provides a command for typesetting Latin phrases:
902 \begin{commands}
903 \command{latin}[\oarg{options}\marg{phrase}]
904 Typesets \meta{phrase} according to the option \option{format} described
905 below.
906 \command{insitu}[\quad\insitu]
907 \command{invacuo}[\quad\invacuo]
908 \command{abinitio}[\quad\abinitio]
909 \end{commands}
910
911 If you additionally load \pkg{chemstyle}~\cite{pkg:chemstyle} said package
912 will \emph{not} define its own \cs{latin}.
913
914 The last three commands mentioned above are defined through
915 \begin{commands}
916 \command{NewChemLatin}[\marg{cs}\marg{phrase}]
917 Define a new Latin phrase. Gives an error if \meta{cs} already exists.
918 \command{DeclareChemLatin}[\marg{cs}\marg{phrase}]
919 Define a new Latin phrase. Silently redefined existing macros.
920 \command{RenewChemLatin}[\marg{cs}\marg{phrase}]
921 Redefine an existing Latin phrase. Gives an error if \meta{cs} doesn't
922 exist.
923 \command{ProvideChemLatin}[\marg{cs}\marg{phrase}]
924 Define a new Latin phrase only if \meta{cs} doesn't exist.
925 \end{commands}
926 \begin{example}[side-by-side]
927 \NewChemLatin\ltn{latin text}\ltn
928 \end{example}
929 You can change the appearance with this option:
930 \begin{options}
931 \keyval{format}{definition}\Module{nomenclature}\Initial{\cs*{emph}}
932 \changedversion{5.7}Sets the format for the Latin phrases.
933 \end{options}
934
935 \section{The \chemmodule*{particles} Module}\label{sec:particles-module}
936
937 The \chemmodule{particles} module loads the modules \chemmodule{charges} and
938 \chemmodule{formula}.
939
940 \subsection{Provided Particle Macros}
941 The \chemmodule{particles} defines a number of macros which can be used for
942 typesetting common particles in the running text. Most of them don't make
943 much sense in \pkg{chemformula}~\cite{pkg:chemformula}'s \cs{ch}, though,
944 which doesn't mean that they can't be used there, of course:
945 \begin{center}
946 \cs{el} \el\ \cs{prt} \prt\ \cs{ntr} \ntr\ \cs{Hyd} \Hyd\ \cs{Oxo} \Oxo\
947 \cs{water} \water\ \cs{El} \El\ \cs{Nuc} \Nuc\ \cs{ba} \ba
948 \end{center}
949 All of these macros are defined using \pkg{chemformula}'s \cs{chcpd}. The
950 details are explained in section~\vref{sec:defin-own-part}.
951
952 The macros \cs{Nuc} and \cs{ba} are special: they have an optional argument
953 for the following options:
954 \begin{options}
955 \keychoice{elpair}{dots,dash,false}\Module{particles}\Initial{false}
956 Determine how the electron pair of the nucleophiles is displayed. The
957 electron pair is drawn using \chemformula's \cs{chlewis} macro.
958 \keyval{space}{dim}\Module{particles}\Initial{.1em}
959 Sets\sinceversion{5.3} the space that is inserted between the electron
960 pair and the negative charge sign.
961 \end{options}
962 Both options can of course also be set with \cs{chemsetup}.
963
964 \begin{example}[side-by-side]
965 \ba[elpair=dots] \Nuc[elpair=dash]
966
967 \chemsetup[particles]{elpair=false}
968 \ba\ \Nuc
969 \end{example}
970
971 \subsection{Defining Own Particle Macros}\label{sec:defin-own-part}
972
973 There are two sets of macros, one for defining particles and one for defining
974 nucleophiles.
975 \begin{commands}
976 \command{NewChemParticle}[\marg{cs}\marg{formula}]
977 Defines a new macro \meta{cs}. \meta{formula} is any valid \chemformula\
978 input (this depends on the setting of the \option{formula} option,
979 see~\vref{sec:formula-module}). Raises an error if \meta{cs} already
980 exists.
981 \command{RenewChemParticle}[\marg{cs}\marg{formula}]
982 Redefines a new macro \meta{cs}. \meta{formula} is any valid \chemformula\
983 input (this depends on the setting of the \option{formula} option,
984 see~\vref{sec:formula-module}). Raises an error if \meta{cs} doesn't
985 exist.
986 \command{DeclareChemParticle}[\marg{cs}\marg{formula}]
987 Defines a macro \meta{cs}. \meta{formula} is any valid \chemformula\
988 input (this depends on the setting of the \option{formula} option,
989 see~\vref{sec:formula-module}). Silently overwrites \meta{cs} if it
990 exists.
991 \command{ProvideChemParticle}[\marg{cs}\marg{formula}]
992 Defines a new macro \meta{cs}. \meta{formula} is any valid \chemformula\
993 input (this depends on the setting of the \option{formula} option,
994 see~\vref{sec:formula-module}). Does nothing if \meta{cs} already
995 exists.
996 \end{commands}
997 An example of usage is the definition of the existing particle macros:
998 \begin{sourcecode}
999 \NewChemParticle\el {e-}
1000 \NewChemParticle\prt{p+}
1001 \NewChemParticle\ntr{n^0}
1002 \end{sourcecode}
1003
1004 The following set defines macros like \cs{Nuc}
1005 \begin{commands}
1006 \command{NewChemNucleophile}[\marg{cs}\marg{formula}]
1007 Defines a new macro \meta{cs}. \meta{formula} is any valid \chemformula\
1008 input (this depends on the setting of the \option{formula} option,
1009 see~\vref{sec:formula-module}). Note that \meta{formula} will get a
1010 trailing negative charge! Raises an error if \meta{cs} already exists.
1011 \command{RenewChemNucleophile}[\marg{cs}\marg{formula}]
1012 Redefines a new macro \meta{cs}. \meta{formula} is any valid \chemformula\
1013 (this depends on the setting of the \option{formula} option,
1014 see~\vref{sec:formula-module}). Note that \meta{formula} will get a
1015 trailing negative charge! Raises an error if \meta{cs} doesn't exist.
1016 \command{DeclareChemNucleophile}[\marg{cs}\marg{formula}]
1017 Defines a macro \meta{cs}. \meta{formula} is any valid \chemformula\
1018 (this depends on the setting of the \option{formula} option,
1019 see~\vref{sec:formula-module}). Note that \meta{formula} will get a
1020 trailing negative charge! Silently overwrites \meta{cs} if it exists.
1021 \command{ProvideChemNucleophile}[\marg{cs}\marg{formula}]
1022 Defines a new macro \meta{cs}. \meta{formula} is any valid \chemformula\
1023 (this depends on the setting of the \option{formula} option,
1024 see~\vref{sec:formula-module}). Note that \meta{formula} will get a
1025 trailing negative charge! Does nothing if \meta{cs} already exists.
1026 \end{commands}
1027 An example of usage is the definition of the existing nucleophile macros:
1028 \begin{sourcecode}
1029 \NewChemNucleophile\Nuc{Nu}
1030 \NewChemNucleophile\ba {ba}
1031 \end{sourcecode}
1032 A macro defined this way will have an optional argument for the
1033 \option{elpair} option.
1034
1035 \section{The \chemmodule*{phases} Module}\label{sec:phases-module}
1036
1037 The \chemmodule{phases} module loads the \chemmodule{formula} module.
1038
1039 \subsection{Basics}
1040
1041 These commands are intended to indicate the phase of a compound.
1042 \begin{center}
1043 \cs{sld} \sld \quad \cs{lqd} \lqd \quad \cs{gas} \gas \quad \cs{aq} \aq
1044 \end{center}
1045 \begin{example}
1046 \ch{C\sld{} + 2 H2O\lqd{} -> CO2\gas{} + 2 H2\gas}\par
1047 To make it complete: NaCl\aq.
1048 \end{example}
1049
1050 The \ac{iupac} recommendation to indicate the state of aggregation is to put
1051 it in parentheses after the compound \cite{iupac:greenbook}. However, you
1052 might want to put it as a subscript which is also very common.
1053
1054 \begin{cnltxquote}[{\citetitle{iupac:greenbook}~\cite[][p.\,54]{iupac:greenbook}}]
1055 The \textelp{} symbols are used to represent the states of aggregation of
1056 chemical species. The letters are appended to the formula in parentheses
1057 and should be printed in Roman (upright) type without a full stop (period).
1058 \end{cnltxquote}
1059
1060 There are two options to customize the output:
1061 \begin{options}
1062 \keychoice{pos}{side,sub}\Module{phases}\Initial{side}
1063 Switch the position of the phase indicator.
1064 \keyval{space}{dim}\Module{phases}\Initial{.1333em}
1065 Change the default spacing between compound a phase indicator if
1066 \keyis{pos}{side}. A \TeX\ dimension.
1067 \end{options}
1068 \begin{example}
1069 \chemsetup[phases]{pos=sub}
1070 \ch{C\sld{} + 2 H2O\lqd{} -> CO2\gas{} + 2 H2\gas}\par
1071 To make it complete: NaCl\aq.
1072 \end{example}
1073
1074 All those phase commands have an optional argument:
1075 \begin{example}[side-by-side]
1076 \ch{H2O "\lqd[\qty{5}{\celsius}]"}
1077 \end{example}
1078
1079 There is also a generic phase command:
1080 \begin{commands}
1081 \command{phase}[\marg{phase}]
1082 If you need a phase indicator just once or twice. You can use it to
1083 denote a phase for which there is no phase command, yet.
1084 \end{commands}
1085
1086 \subsection{Define Own Phases}
1087 Depending on the subject of your document you might need to indicate other
1088 states of aggregation. You can easily define them.
1089 \begin{commands}
1090 \command{NewChemPhase}[\marg{cs}\marg{symbol}]
1091 Define a new phase command. See section~\vref{sec:lang-depend} for a way
1092 to define language dependent settings. Gives an error if \meta{cs}
1093 already exists.
1094 \command{DeclareChemPhase}[\marg{cs}\marg{symbol}]
1095 Define a new phase command. See section~\vref{sec:lang-depend} for a way to
1096 define language dependent settings. Overwrites previous definitions of
1097 \meta{cs}.
1098 \command{RenewChemPhase}[\marg{cs}\marg{symbol}]
1099 Redefine an existing phase command. See section~\vref{sec:lang-depend} for
1100 a way to define language dependent settings. Gives an error if \meta{cs}
1101 is not defined.
1102 \command{ProvideChemPhase}[\marg{cs}\marg{symbol}]
1103 Define a new phase command. See section~\vref{sec:lang-depend} for a way
1104 to define language dependent settings. Does nothing if \meta{cs} is
1105 already defined.
1106 \end{commands}
1107
1108 \begin{example}
1109 % preamble:
1110 \NewChemPhase\aqi{aq,$\infty$} % aqueous solution at infinite dilution
1111 \NewChemPhase\cd {cd} % condensed phase
1112 \NewChemPhase\lc {lc} % liquid crystal
1113 \ch{NaOH\aqi} \ch{H2O\cd} \ch{U\phase{cr}} \ch{A\lc}\par
1114 \chemsetup[phases]{pos=sub}
1115 \ch{NaOH\aqi} \ch{H2O\cd} \ch{U\phase{cr}} \ch{A\lc}
1116 \end{example}
1117
1118 \subsection{Language Dependencies}\label{sec:lang-depend}
1119 For each phase command a translation into the custom language can be defined.
1120 If a phase is declared with \cs{NewChemPhase} no translation exists and
1121 for every \pkg{babel} language the literal string is used that was provided
1122 as a definition. Let's say you define the phase
1123 \begin{sourcecode}
1124 \NewChemPhase\liquid{l}
1125 \end{sourcecode}
1126 and want to add the German translation ``f\/l''. Then you could do
1127 \begin{sourcecode}
1128 \DeclareTranslation{German}{phase-liquid}{f\/l}
1129 \end{sourcecode}
1130 This way, when you use it in a German document using the appropriate
1131 \pkg{babel} option using \cs*{liquid} would correctly translate. For this the
1132 package \pkg{translations}~\cite{pkg:translations} is used. The \acs{id}
1133 always is \code{phase-\meta{csname}} where \meta{csname} is the name of the
1134 phase command you defined without leading backslash.
1135
1136 See section~\vref{sec:lang-module} for predefined translations and general
1137 language options of \chemmacros.
1138
1139 \section{The \chemmodule*{symbols} Module}\label{sec:symbols-module}
1140
1141 The \chemmodule{symbols} module defines a few symbols chemists need now and
1142 then. It loads the package \pkg{amstext}~\cite{pkg:amstext}.
1143 \begin{commands}
1144 \command{transitionstatesymbol}
1145 This is self-explaining: \transitionstatesymbol
1146 \command{standardstate}
1147 Again self-explaining: \standardstate
1148 \command{changestate}
1149 The uppercase delta used in \state^{}{H} for example.
1150 \end{commands}
1151
1152 \section{The \chemmodule*{formula} Module}\label{sec:formula-module}
1153
1154 The \chemmodule{formula} module loads the \pkg{amstext}
1155 package~\cite{pkg:amstext} and the \chemmodule{charges} module.
1156
1157 \subsection{For Users}
1158 There are different packages which provide means for typesetting chemical
1159 formulas:
1160 \begin{itemize}
1161 \item \pkg{chemformula}~\cite{pkg:chemformula}. This package started as a
1162 part of \chemmacros\ and thus goes naturally together with \chemmacros,
1163 see also \vref{sec:supp-pack-chemf}.
1164 \item \pkg{mhchem}~\cite{pkg:mhchem}. This is the \enquote{older brother} of
1165 \chemformula.
1166 \item \pkg{chemfig}~\cite{pkg:chemfig}. The easiest and most complete of the
1167 packages for drawing skeletal formulas.
1168 \item \XyMTeX~\cite{pkg:xymtex}. A very comprehensive alternative for
1169 typesetting chemistry.
1170 \end{itemize}
1171 In order to help authors getting a consistent layout \chemmacros\ does not
1172 make a choice which package to use for typesetting formulas. Although
1173 \chemformula\ is well tested and preferred users can choose other packages if
1174 they like.
1175
1176 this is done with the following general option:
1177 \begin{options}
1178 \keyval{formula}{method}\Initial{chemformula}
1179 This\sinceversion{5.1} option let's you choose how chemical formulas are
1180 typeset. Available methods are
1181 \begin{itemize}
1182 \item \pkg{chemformula}
1183 \item \pkg{mhchem}
1184 \item \pkg{chemist}\sinceversion{5.6} (from the \XyMTeX\ bundle)
1185 \item \pkg{chemfig}\sinceversion{5.6}
1186 \end{itemize}
1187 The corresponding package with the same name is loaded.
1188 \end{options}
1189 If you explicitly set this option the corresponding package is loaded
1190 immediately and the method is set up. Otherwise the option will be set by
1191 \chemmacros\ at the end of the preamble.
1192
1193 If\sinceversion{5.2} you load a method package in a way that a unique choice
1194 is possible then \chemmacros\ will set the method accordingly if you haven't
1195 set the option by yourself. If \emph{no} unique choice is possible
1196 \chemmacros\ will raise a warning and choose \pkg{chemformula} regardless if
1197 the package is loaded or not. In this case if you want to use another method
1198 you'll have to choose manually. \emph{All automatic choices only happen at the
1199 end of the preamble}.
1200
1201 \subsection{Using the \pkg*{chemformula} Package}
1202 If you set \keyis{formula}{chemformula} the \chemmodule{formula} module
1203 makes it possible that you can set all \chemformula\ options via the
1204 \cs{chemsetup} command using the module \module{formula}, for example:
1205 \begin{sourcecode}
1206 \chemsetup[chemformula]{format=\sffamily}
1207 \end{sourcecode}
1208
1209 Everywhere where \chemmacros\ typesets chemical formulas \chemformula's macros
1210 \cs{chcpd} or \cs{ch} are used, for example in the reaction environments
1211 provided by the \chemmodule{reactions} module.
1212
1213 \emph{This method is the recommended choice!}
1214
1215 \subsection{Using the \pkg*{mhchem} Package}\sinceversion{5.1}\label{sec:using-mhchem}
1216 If you set \keyis{formula}{mhchem} the \chemmodule{formula} module makes
1217 it possible that you can set all of \pkg{mhchem}'s options via the
1218 \cs{chemsetup} command using the module \module{mhchem}, for example:
1219 \begin{sourcecode}
1220 \chemsetup[mhchem]{format=\sffamily}
1221 \end{sourcecode}
1222
1223 Everywhere where \chemmacros\ typesets chemical formulas \pkg{mhchem}'s macro
1224 \cs{ce} is used, for example in the reaction environments provided by the
1225 \chemmodule{reactions} module.
1226
1227 There are some \latin{caveat}s if you use this method:
1228 \begin{itemize}
1229 \item This method has not been extensively tested, yet. There may be errors
1230 and wrong output at unexpected places.
1231 \item Using this method effectively disables the different values of the
1232 \module{particles} option \option{elpair} (see
1233 section~\ref{sec:particles-module}).
1234 \item The different kinds of formal charges provided by the
1235 \chemmodule{charges} module (see section~\ref{sec:ion-charges}) are
1236 disabled. Formal charges always use the math method now.
1237 \item There may also be other incompatibilities (\eg, \pkg{mhchem} has it's
1238 own method of setting upright Greek letters so it may or may not disable
1239 \chemmacros' mechanism).
1240 \end{itemize}
1241
1242 \subsection{Using the \pkg*{chemfig} Package}\sinceversion{5.6}\label{sec:using-chemfig}
1243 Everywhere where \chemmacros\ typesets chemical formulas \pkg{chemfig}'s macro
1244 \cs{printatom} is used, for example in the reaction environments provided by
1245 the \chemmodule{reactions} module.
1246
1247 There are some \latin{caveat}s if you use this method:
1248 \begin{itemize}
1249 \item This method has not been extensively tested, yet. There may be errors
1250 and wrong output at unexpected places.
1251 \item Using this method effectively disables the different values of the
1252 \module{particles} option \option{elpair} (see
1253 section~\ref{sec:particles-module}).
1254 \item The different kinds of formal charges provided by the
1255 \chemmodule{charges} module (see section~\ref{sec:ion-charges}) are
1256 disabled. Formal charges always use the math method now.
1257 \item The reaction environments by the \chemmodule{reactions} module may
1258 work only to a limited respect. If you plan to use them consider using
1259 methods \pkg{chemformula} or \pkg{mhchem} instead.
1260 \end{itemize}
1261
1262 \subsection{Using the \pkg*{chemist} Package}\sinceversion{5.6}\label{sec:using-chemist}
1263 Everywhere where \chemmacros\ typesets chemical formulas \pkg{chemist}'s macro
1264 \cs{ChemForm} is used, for example in the reaction environments provided by
1265 the \chemmodule{reactions} module.
1266
1267 There are some \latin{caveat}s if you use this method:
1268 \begin{itemize}
1269 \item This method has not been extensively tested, yet. There may be errors
1270 and wrong output at unexpected places.
1271 \item Using this method effectively disables the different values of the
1272 \module{particles} option \option{elpair} (see
1273 section~\ref{sec:particles-module}).
1274 \item The different kinds of formal charges provided by the
1275 \chemmodule{charges} module (see section~\ref{sec:ion-charges}) are
1276 disabled. Formal charges always use the math method now.
1277 \item The reaction environments by the \chemmodule{reactions} module may
1278 work only to a limited respect. If you plan to use them consider using
1279 methods \pkg{chemformula} or \pkg{mhchem} instead\footnote{On the other
1280 hand \XyMTeX\ (and especially the \pkg{chemist} package) provides quite
1281 a number of chemical reaction environments itself.}.
1282 \end{itemize}
1283
1284 \subsection{For Module Writers}
1285
1286 There are two macros for module writers:
1287 \begin{commands}
1288 \explcommand{chemmacros_chemformula:n}[ \marg{formula}]
1289 This is only a wrapper for \cs{chcpd} or \cs{ce}. It is recommended that
1290 module writers use this macro (or a variant thereof) inside of
1291 \chemmacros' macros whenever they want to display a chemical formula.
1292 Writers who prefer traditional \LaTeXe\ programming over expl3 should use
1293 \cs*{chemmacros@formula}.
1294 \explcommand{chemmacros_reaction:n}[ \marg{reaction}]
1295 This is only a wrapper for \cs{ch} or \cs{ce}. It is recommended that
1296 module writers use this macro (or a variant thereof) inside of
1297 \chemmacros' macros whenever they want to display a chemical reaction.
1298 Writers who prefer traditional \LaTeXe\ programming over expl3 should use
1299 \cs*{chemmacros@reaction}.
1300 \end{commands}
1301
1302 \section{The \chemmodule*{greek} Module}\label{sec:greek-module}
1303
1304 The \chemmodule{greek} module loads the \pkg{chemgreek}
1305 package~\cite{pkg:chemgreek}.
1306
1307 This module provides one option:
1308 \begin{options}
1309 \keyval{greek}{mapping}
1310 A valid value is any valid \chemgreek\ \meta{mapping}. \chemmacros\ will
1311 warn you if no mapping has been chosen or if you are using the
1312 \code{default} or the \code{var-default} mapping because this means that
1313 no upright Greek letters are available.
1314 \end{options}
1315 If you load a \chemgreek\ support package which allows an unambiguous choice
1316 of a mapping \chemgreek\ will make this choice automatically. This means if
1317 you say
1318 \begin{sourcecode}
1319 \usepackage{upgreek}
1320 \usepackage{chemmacros}
1321 \end{sourcecode}
1322 then \chemmacros\ will use \pkg{upgreek}'s upright Greek letters. If you
1323 have
1324 \begin{sourcecode}
1325 \usepackage{upgreek}
1326 \usepackage{chemmacros}
1327 \usepackage{textgreek}
1328 \end{sourcecode}
1329 then no unambiguous choice is possible and you should choose a mapping
1330 yourself, for example:
1331 \begin{sourcecode}
1332 \usepackage{upgreek}
1333 \usepackage{chemmacros}
1334 \usepackage{textgreek}
1335 \chemsetup{greek=textgreek}
1336 \end{sourcecode}
1337 For further details on mappings please refer to \chemgreek's manual.
1338
1339 \part{Additional Modules}\label{part:additional-modules}
1340
1341 The modules described in this part are not part of \chemmacros' minimal setup.
1342
1343 \section{The \chemmodule*{isotopes} Module}\label{sec:isotopes-module}
1344
1345 The \chemmodule{isotope} module loads the \pkg{elements}
1346 package~\cite{pkg:elements}. This module defines one user command:
1347 \begin{commands}
1348 \command{isotope}[\sarg\marg{input}]
1349 \meta{input} can either be the \emph{symbol} of an element or the
1350 \emph{name} of an element. Be aware that \emph{the name is language
1351 dependent}, refer to the manual of the \pkg{elements} package for
1352 details. To be on the safe side use the element symbol.
1353
1354 \meta{input} can also be comma separated list:
1355 \cs{isotope}\Marg{\meta{nuc},\meta{symbol}}. If you leave \meta{nuc} out
1356 then \cs{isotope} will display the most common isotope. Otherwise
1357 \meta{nuc} will be used. If \meta{nuc} is an isotope unknown to the
1358 \pkg{elements} package \cs{isotope} will write a warning to the log file.
1359
1360 The starred variant omits the element number.
1361 \end{commands}
1362
1363 \begin{example}[side-by-side]
1364 \isotope{C}
1365 \isotope*{C}
1366 \isotope{14,C}
1367 \isotope*{14,C}
1368 \end{example}
1369
1370 As input for the element symbol you can choose any of the elements known to
1371 the \pkg{elements} package.
1372
1373 There are options which allow you to determine how the isotope is printed:
1374 \begin{options}
1375 \keychoice{format}{super,side}\Module{isotopes}\Initial{super}
1376 Either print the isotope number as superscript or to the right of the
1377 element symbol.
1378 \keyval{side-connect}{input}\Module{isotopes}\Initial{-}
1379 Determine what is printed between the element symbol and the isotope
1380 number if \keyis{format}{side}.
1381 \end{options}
1382
1383 \begin{example}[side-by-side]
1384 \isotope{C}
1385 \chemsetup[isotopes]{format=side}
1386 \isotope{C}
1387 \chemsetup[isotopes]{side-connect=}
1388 \isotope{C}
1389 \end{example}
1390
1391 \section{The \chemmodule*{mechanisms} Module}\label{sec:mechanisms-module}
1392
1393 The module \chemmodule{mechanisms} loads the package
1394 \pkg{amstext}~\cite{pkg:amstext}. It provides one macro:
1395
1396 \begin{commands}
1397 \command{mech}[\oarg{type}]
1398 Allows to specify the most common reaction mechanisms.
1399 \end{commands}
1400 \meta{type} can have one of the following values:
1401 \begin{commands}
1402 \command{mech}
1403 (empty, no opt. argument) nucleophilic substitution \mech
1404 \command{mech}[\Oarg{1}]
1405 unimolecular nucleophilic substitution \mech[1]
1406 \command{mech}[\Oarg{2}]
1407 bimolecular nucleophilic substitution \mech[2]
1408 \command{mech}[\Oarg{se}]
1409 electrophilic substitution \mech[se]
1410 \command{mech}[\Oarg{1e}]
1411 unimolecular electrophilic substitution \mech[1e]
1412 \command{mech}[\Oarg{2e}]
1413 bimolecular electrophilic substitution \mech[2e]
1414 \command{mech}[\Oarg{ar}]
1415 electrophilic aromatic substitution \mech[ar]
1416 \command{mech}[\Oarg{e}]
1417 elimination \mech[e]
1418 \command{mech}[\Oarg{e1}]
1419 unimolecular elimination \mech[e1]
1420 \command{mech}[\Oarg{e2}]
1421 bimolecular elimination \mech[e2]
1422 \command{mech}[\Oarg{cb}]
1423 unimolecular elimination \enquote{conjugated base}, \ie, via carbanion
1424 \mech[cb]
1425 \end{commands}
1426
1427 \section{The \chemmodule*{newman} Module}\label{sec:newman-module}
1428 The \chemmodule{newman} module provides a command for drawing Newman
1429 projections. It loads the \chemmodule{tikz} module.
1430 \begin{commands}
1431 \command{newman}[\oarg{options}\darg{angle}%
1432 \Marg{\meta{1},\meta{2},\meta{3},\meta{4},\meta{5},\meta{6}}]
1433 Create Newman projections. This command uses \TikZ\ internally.
1434 \meta{angle} rotates the back atoms counter clockwise with respect to the
1435 front atoms and is an optional argument. \meta{1} to \meta{6} are the
1436 positions, the first three are the front atoms, the last three the back
1437 atoms.
1438 \end{commands}
1439
1440 \begin{example}
1441 \newman{} \newman(170){}
1442 \newman{1,2,3,4,5,6} \newman{1,2,3} \newman{,,,4,5,6}
1443 \end{example}
1444
1445 Several options allow customization:
1446 \begin{options}
1447 \keyval{angle}{angle}\Module{newman}\Initial{0}
1448 Default angle.
1449 \keyval{scale}{factor}\Module{newman}\Initial{1}
1450 Scale the whole projection by factor \meta{factor}.
1451 \keyval{ring}{tikz}\Module{newman}\Initial
1452 Customize the ring with \TikZ\ keys.
1453 \keyval{atoms}{tikz}\Module{newman}\Initial
1454 Customize the nodes within which the atoms are set with \TikZ\ keys.
1455 \keyval{back-atoms}{tikz}\Module{newman}\Initial
1456 Explicitly customize the nodes of the back atoms with \TikZ\ keys.
1457 \end{options}
1458
1459 \begin{example}
1460 \chemsetup[newman]{angle=45} \newman{}
1461 \newman[scale=.75,ring={draw=blue,fill=blue!20}]{}
1462 \end{example}
1463
1464 \begin{example}
1465 \chemsetup[newman]{atoms={draw=red,fill=red!20,inner sep=2pt,rounded corners}}
1466 \newman{1,2,3,4,5,6}
1467 \end{example}
1468
1469 \begin{example}
1470 \chemsetup[newman]{
1471 atoms = {draw=red,fill=red!20,inner sep=2pt,rounded corners},
1472 back-atoms = {draw=blue,fill=blue!20,inner sep=2pt,rounded corners}
1473 }
1474 \newman{1,2,3,4,5,6} \newman(170){1,2,3,4,5,6}
1475 \end{example}
1476
1477 \section{The \chemmodule*{orbital} Module}\label{sec:orbital-module}
1478 The \chemmodule{orbital} module loads the \chemmodule{tikz} module. It
1479 provides the following command to create orbitals:
1480 \begin{commands}
1481 \command{orbital}[\oarg{options}\marg{type}]
1482 Draw an orbital shape of type \meta{type}. This command uses \TikZ\
1483 internally.
1484 \end{commands}
1485
1486 There are the following types available for \meta{type}:
1487 \begin{center}
1488 \code{s} \quad
1489 \code{p} \quad
1490 \code{sp} \quad
1491 \code{sp2} \quad
1492 \code{sp3}
1493 \end{center}
1494
1495 \begin{example}
1496 \orbital{s} \orbital{p} \orbital{sp} \orbital{sp2} \orbital{sp3}
1497 \end{example}
1498
1499 Depending on the type you have different options to modify the orbitals:
1500 \begin{options}
1501 \keychoice{phase}{+,-}\Module{orbital}\Initial{+}
1502 changes the phase of the orbital (all types)
1503 \keyval{scale}{factor}\Module{orbital}\Initial{1}
1504 changes the size of the orbital (all types)
1505 \keyval{color}{color}\Module{orbital}\Initial{black}
1506 changes the color of the orbital (all types)
1507 \keyval{angle}{angle}\Module{orbital}\Initial{0}
1508 rotates the orbitals with a p contribution counter clockwise (all types
1509 except \code{s})
1510 \keybool{half}\Module{orbital}\Initial{false}
1511 displays only half an orbital (only \code{p})
1512 \end{options}
1513
1514 \begin{example}
1515 \orbital{s} \orbital[phase=-]{s}
1516 \orbital{p} \orbital[phase=-]{p}
1517 \orbital{sp3} \orbital[phase=-]{sp3}
1518
1519 \orbital[angle=0]{p} \orbital[color=red!50]{p}
1520 \orbital[angle=135,scale=1.5]{p} \orbital[half]{p}
1521 \end{example}
1522
1523 Additionally there are two options, with which the \TikZ\ behavior can be
1524 changed.
1525 \begin{options}
1526 \keybool{overlay}\Module{orbital}
1527 The orbital \enquote{doesn't need space}; it is displayed with the \TikZ\
1528 option \code{overlay}.
1529 \keyval{opacity}{num}\Module{orbital}
1530 The orbital becomes transparent; \meta{value} can have values between
1531 \code{1} (fully opaque) to \code{0} (invisible).
1532 \end{options}
1533 \begin{example}
1534 \vspace{7mm}
1535 \chemsetup[orbital]{
1536 overlay,
1537 p/color = black!70
1538 }
1539 \setchemfig{bond offset=0pt}
1540 \chemfig{
1541 ?\orbital{p}
1542 -[,1.3]{\orbital[phase=-]{p}}
1543 -[:30,1.1]\orbital{p}
1544 -[:150,.9]{\orbital[phase=-]{p}}
1545 -[4,1.3]\orbital{p}
1546 -[:-150,1.1]{\orbital[phase=-]{p}}?
1547 }
1548 \vspace{7mm}
1549 \end{example}
1550
1551 \begin{example}
1552 \vspace{7mm}
1553 \setchemfig{bond offset = 0pt}
1554 \chemsetup[orbital]{
1555 overlay ,
1556 opacity = .75 ,
1557 p/scale = 1.6 ,
1558 s/color = blue!50 ,
1559 s/scale = 1.6
1560 }
1561 \chemfig{
1562 \orbital{s}
1563 -[:-20]{\orbital[scale=2]{p}}
1564 {\orbital[half,angle=0]{p}}
1565 {\orbital[angle=170,half]{p}}
1566 {\orbital[angle=-150,half]{p}}
1567 (-[:-150]\orbital{s})-\orbital{s}
1568 }
1569 \vspace{1cm}
1570 \end{example}
1571
1572 \section{The \chemmodule*{polymers} Module}\label{sec:polymers-module}
1573 The\sinceversion{5.5} \chemmodule{polymers} module loads the
1574 \chemmodule{nomenclature} and the \chemmodule{tikz} modules.
1575
1576 \subsection{Nomenclature}
1577
1578 The \chemmodule{polymers} module defines a number of \ac{iupac} macros for
1579 usage inside \cs{iupac} which are used in polymer chemistry.
1580
1581 \subsection{Copolymers}
1582 \begin{commands}
1583 \iupaccs[co]{copolymer}{unspecified copolymer.}
1584 \iupaccs[stat]{statistical}{statistical copolymer.}
1585 \iupaccs[ran]{random}{random copolymer.}
1586 \iupaccs[alt]{alternating}{alternating copolymer.}
1587 \iupaccs[per]{periodic}{periodic copolymer.}
1588 \iupaccs{block}{block copolymer.}
1589 \iupaccs{graft}{graft copolymer.}
1590 \end{commands}
1591
1592 \subsection{Non-linear (Co) Polymers and Polymer Assemblies}
1593 \begin{commands}
1594 \iupaccs{blend}{The blend qualifier.}
1595 \iupaccs{comb}{The comb qualifier.}
1596 \iupaccs[compl]{complex}{The complex qualifier.}
1597 \iupaccs[cyclo]{cyclic}{The cyclic qualifier.}
1598 \iupaccs{branch}{The branch qualifier.}
1599 \iupaccs[net]{network}{The network qualifier.}
1600 \iupaccs[ipn]{ipnetwork}{The interpenetrating network qualifier.}
1601 \iupaccs[sipn]{sipnetwork}{The semi-interpenetrating network qualifier.}
1602 \iupaccs{star}{The star qualifier.}
1603 \end{commands}
1604
1605 \subsection{Polymer Denotations in \pkg*{chemfig}'s Molecules}
1606 The \pkg{chemfig} manual proposes some code defining the macros
1607 \cs*{setpolymerdelim} and \cs*{makebraces} which make it possible to add
1608 delimiters to \pkg{chemfig} molecules. The \chemmodule{polymers} module
1609 implements the following macro based on the same idea:
1610 \begin{commands}
1611 \command{makepolymerdelims}[\oarg{options}\marg{height}\oarg{depth}\marg{opening
1612 node}\marg{closing node}]
1613 The value of \meta{depth} is the same as \meta{height} unless it is
1614 specified explicitly. \meta{opening node} and \meta{closing node} are the
1615 names of \TikZ' nodes where the delimiters are placed.
1616 \end{commands}
1617 \begin{options}
1618 \keychoice{delimiters}{\Marg{\meta{left}\meta{right}}}\Module{polymers}\Initial{[]}
1619 This option demands two tokens as argument, the first being the opening
1620 brace, the second the closing brace. A dot (\code{.}) denotes an empty
1621 delimiter.
1622 \keyval{subscript}{subscript}\Module{polymers}\Initial{\$n\$}
1623 Subscript to the right delimiter.
1624 \keyval{superscript}{superscript}\Module{polymers}
1625 Superscript to the right delimiter.
1626 \end{options}
1627
1628 \begin{example}
1629 \setchemfig{atom sep=2em}
1630 \chemfig{-[@{op,.75}]CH_2-CH(-[6]Cl)-[@{cl,0.25}]}
1631 \makepolymerdelims{5pt}[27pt]{op}{cl}
1632 \chemfig{-[@{op,.75}]CH_2-CH(-[6]Cl)-[@{cl,0.25}]}
1633 \makepolymerdelims[delimiters=()]{5pt}[27pt]{op}{cl}
1634 \end{example}
1635
1636 \section{The \chemmodule*{reactions} Module}\label{sec:reactions-module}
1637 The \chemmodule{reactions} module loads the \chemmodule{formula} module
1638 and the \pkg{mathtools} package~\cite{pkg:mathtools}.
1639
1640 \subsection{Predefined Environments}
1641
1642 You can use these environments for numbered\ldots
1643 \begin{environments}
1644 \environment{reaction}
1645 A single reaction where \chemformula\ code is placed directly in the
1646 environment body. A wrapper around the \env*{equation} environment. The
1647 environment body is parsed with \cs{ch} or \cs{ce} depending on the value
1648 of the \option{formula} option, see
1649 section~\vref{sec:formula-module}.
1650 \environment{reactions}
1651 Several aligned reactions. A wrapper around \pkg{amsmath}'s \env*{align}
1652 environment. The environment body is parsed with \cs{ch} or \cs{ce}
1653 depending on the value of the \option{formula} option, see
1654 section~\vref{sec:formula-module}.
1655 \end{environments}
1656
1657 \ldots and their starred versions for unnumbered reactions.
1658 \begin{environments}
1659 \environment{reaction*}
1660 A wrapper around the \env*{equation*} environment. The environment body
1661 is parsed with \cs{ch} or \cs{ce} depending on the value of the
1662 \option{formula} option, see section~\vref{sec:formula-module}.
1663 \environment{reactions*}
1664 A wrapper around \pkg{amsmath}'s \env*{align*} environment. The
1665 environment body is parsed with \cs{ch} or \cs{ce} depending on the value
1666 of the \option{formula} option, see
1667 section~\vref{sec:formula-module}.
1668 \end{environments}
1669
1670 With those environments you can create (un)numbered reaction equations similar
1671 to mathematical equations.
1672
1673 Theses environments use the \env*{equation}/\env*{equation*} environments or
1674 the \env*{align}/\env*{align*} environments, respectively, to display the
1675 reactions.
1676
1677 \begin{example}
1678 Reaction with counter:
1679 \begin{reaction}
1680 A -> B
1681 \end{reaction}
1682 \end{example}
1683
1684 \begin{example}
1685 Reaction without counter:
1686 \begin{reaction*}
1687 C -> D
1688 \end{reaction*}
1689 \end{example}
1690
1691 \begin{example}
1692 Several aligned reactions with counter:
1693 \begin{reactions}
1694 A &-> B + C \\
1695 D + E &-> F
1696 \end{reactions}
1697 \end{example}
1698
1699 \begin{example}
1700 Several aligned reactions without counter:
1701 \begin{reactions*}
1702 G &-> H + I \\
1703 J + K &-> L
1704 \end{reactions*}
1705 \end{example}
1706
1707 If you want to change the layout of the counter tags, you can use
1708 \begin{commands}
1709 \command*{renewtagform}[\marg{tagname}\oarg{format}\marg{left
1710 delimiter}\marg{right delimiter}]
1711 Provided by the \pkg{mathtools} package.
1712 \end{commands}
1713 or use the following options:
1714 \begin{options}
1715 \keyval{tag-open}{left delimiter}\Module{reactions}\Initial{\cs*{\{}}
1716 \sinceversion{5.6}The left delimiter.
1717 \keyval{tag-close}{right delimiter}\Module{reactions}\Initial{\cs*{\}}}
1718 \sinceversion{5.6}The right delimiter.
1719 \keyval{before-tag}{format}\Module{reactions}\Initial
1720 \sinceversion{5.6}Code inserted before the tags.
1721 \end{options}
1722
1723 \begin{example}
1724 \chemsetup[reactions]{
1725 before-tag = R \textbf ,
1726 tag-open = [ ,
1727 tag-close = ]
1728 }
1729 \begin{reaction}
1730 H2O + CO2 <<=> H2CO3
1731 \end{reaction}
1732 \end{example}
1733
1734 You\sinceversion{6.1} can also make reactions share a counter with math
1735 equations (by using the \code{equation} counter).
1736 \begin{options}
1737 \keybool{own-counter}\Module{reactions}\Initial{true}
1738 If set to false the reaction environments will use the \code{equation}
1739 counter instead of the \code{reaction} counter.
1740 \end{options}
1741
1742 The use of \AmS math's \cs{intertext} is possible:
1743 \begin{example}
1744 \begin{reactions}
1745 A + 2 B &-> 3 C + D "\label{rxn:test}"
1746 \intertext{Some text in between aligned reactions}
1747 3 E + F &<=> G + 1/2 H
1748 \end{reactions}
1749 See reaction~\ref{rxn:test}.
1750 \end{example}
1751
1752 \subsection{Cross-Referencing}
1753 If\sinceversion{5.6} you are using either \pkg{cleveref}~\cite{pkg:cleveref}
1754 or \pkg{fancyref}~\cite{pkg:fancyref} and have set \keyis{own-counter}{true}
1755 the \env{reaction} counter is supported by both packages and already set up by
1756 \chemmacros.
1757
1758 For \pkg{fancyref} \chemmacros' uses the prefix \code{rct} by defining the
1759 following:
1760 \begin{sourcecode}
1761 \newcommand*\fancyrefrctlabelprefix{rct}
1762 \end{sourcecode}
1763 You can of course redefine \cs{fancyrefrctlabelprefix} into whatever suits you
1764 best.
1765
1766 Also \pkg{hyperref}'s \cs*{autoref} is supported.
1767 \begin{options}
1768 \keyval{autoref-name}{name}\Module{reactions}\Initial{\cs*{ChemTranslate}\Marg{reaction}}
1769 \sinceversion{6.1}Change the name used by \pkg{hyperref}'s
1770 \cs*{autoref}.
1771
1772 Alternatively you can just redefine \cs{reactionautorefname}.
1773 \end{options}
1774
1775 \subsection{Own Reactions}
1776 You can create new types of reactions with the command:
1777 \begin{commands}
1778 \command{NewChemReaction}[\marg{name}\oarg{number of arguments}\marg{math name}]
1779 \meta{name} will be the name of the new chem environment. \meta{math name} is
1780 the underlying math environment. Gives an error if \meta{name} already
1781 exists.
1782 \command{RenewChemReaction}[\marg{name}\oarg{number of arguments}\marg{math name}]
1783 \meta{name} is the name of the renewed chem environment. \meta{math name} is
1784 the underlying math environment. Gives an error if \meta{name} does not exist.
1785 \command{DeclareChemReaction}[\marg{name}\oarg{number of arguments}\marg{math name}]
1786 \meta{name} will be the name of the chem environment. \meta{math name} is
1787 the underlying math environment.
1788 \command{ProvideChemReaction}[\marg{name}\oarg{number of arguments}\marg{math name}]
1789 \meta{name} will be the name of the new chem environment. \meta{math name} is
1790 the underlying math environment. The new environment is only defined if
1791 it doesn't exist, yet.
1792 \end{commands}
1793
1794 \begin{sourcecode}
1795 \NewChemReaction{reaction} {equation}
1796 \NewChemReaction{reaction*} {equation*}
1797 \NewChemReaction{reactions} {align}
1798 \NewChemReaction{reactions*}{align*}
1799 \end{sourcecode}
1800
1801 Let's suppose, you'd like to have the alignment behavior of the \env{alignat}
1802 environment for \chemformula\ reactions. You could do the following:
1803
1804 \begin{sourcecode}
1805 \NewChemReaction{reactionsat}[1]{alignat}
1806 \end{sourcecode}
1807
1808 With this the \env{reactionsat} environment is defined.
1809 \begin{example}
1810 \NewChemReaction{reactionsat}[1]{alignat}
1811 \NewChemReaction{reactionsat*}[1]{alignat*}
1812 \begin{reactionsat}{3}
1813 A &-> B &&-> C &&-> D \\
1814 aaaaa &-> bbbbb &&-> ccccc &&-> ddddd
1815 \end{reactionsat}
1816 \begin{reactionsat*}{2}
1817 A &-> B & C &-> D \\
1818 aaaaa &-> bbbbb &\quad{} ccccc &-> ddddd
1819 \end{reactionsat*}
1820 \end{example}
1821
1822 \subsection{List of Reactions}
1823
1824 The \chemmodule{reactions} module also provides a command to display a list of
1825 the reactions created with the \env{reaction} environment.
1826 \begin{commands}
1827 \command{listofreactions}
1828 Print a list of reactions.
1829 \end{commands}
1830 \begin{example}
1831 \listofreactions
1832 \end{example}
1833
1834 The output of this list can be modified by two options:
1835 \begin{options}
1836 \keyval{list-name}{name of the
1837 list}\Module{reactions}\Initial{\cs*{ChemTranslate}\Marg{{list-of-reactions}}}
1838 Let's you set the name of the list manually. The default name is language
1839 dependent, see section~\vref{sec:lang-module}. Alternatively you can
1840 redefine \cs{reactionlistname}.
1841 \keyval{list-entry}{prefix to each
1842 entry}\Module{reactions}\Initial{\cs*{ChemTranslate}\Marg{reaction}}
1843 Let's you set a prefix to each list entry. The default name is language
1844 dependent, see section~\vref{sec:lang-module}.
1845 \keyval{list-heading-cmd}{code}\Module{reactions}\Initial{\cs*{section}\sarg\Marg{\#1}}
1846 The\sinceversion{5.2} macro that is called at the beginning of the list.
1847 Inside of \meta{code} \code{\#1} refers to the actual heading of the list.
1848 The default setting is not entirely true: if a macro \cs*{chapter} is
1849 defined \code{\cs*{chapter}\sarg\Marg{\#1}} is used. \par
1850 This command has no effect if a \KOMAScript\ class or the package
1851 \pkg{tocbasic} is used. The list of reactions then obeys \KOMAScript's
1852 \option*{listof} option.
1853 \end{options}
1854 Instead of using the option \option{list-name} you also could redefine
1855 \cs{reactionlistname}.
1856
1857 The list lists all reactions with a number and disregards reactions without
1858 number. All reaction environments without star have an optional argument
1859 which let's you add a description (or caption) for the entry in the list.
1860 \begin{example}
1861 \begin{reaction}[Autoprotolyse]
1862 2 H2O <<=> H3O+ + OH-
1863 \end{reaction}
1864 \end{example}
1865
1866 If you use the \env{reactions} environment this will not work, though. In
1867 this case you can use
1868 \begin{commands}
1869 \command{AddRxnDesc}[\marg{description}]
1870 Add a description to a reaction.
1871 \end{commands}
1872
1873 \begin{example}
1874 \begin{reactions}
1875 "\chlewis{0.}{Cl}" + CH4 &
1876 -> HCl + "\chlewis{180.}{C}" H3 \AddRxnDesc{first~step~of~chain} \\
1877 "\chlewis{180.}{C}" H3 + Cl2 &
1878 -> CH3Cl + "\chlewis{0.}{Cl}" \AddRxnDesc{second~step~of~chain}
1879 \end{reactions}
1880 \end{example}
1881
1882 \section{The \chemmodule*{reactants} Module}\label{sec:reactants-module}
1883 \sinceversion{6.0}Idea for this module is by \leandriis, who also does the
1884 main development of the module. Many thanks for all her work!
1885
1886 \subsection{Idea and Getting Started}
1887 The \module{reactants} module offers a simplified input syntax for chemical
1888 reactants in the description of reaction procedures. Reactant and solvent
1889 names are declared in the preamble removing the need to repeat the same
1890 \ac{iupac} names multiple times throughout the document. With the help of
1891 module options the output style (order of name number and data) can be altered
1892 globally (or locally) to suit your needs, while the data itself is input using
1893 an easy to use key-value approach and processed by the \pkg{siunitx}
1894 package~\cite{pkg:siunitx}. The \module{reactants} module responds to the
1895 language declared with the \pkg{babel} package and also offers methods to
1896 integrate the acronyms of used reactants or solvents into the list of
1897 acronyms.
1898
1899 The module requires and loads the packages \pkg{chemnum}~\cite{pkg:chemnum}
1900 and \pkg{siunitx}. Depending on the selected options the packages
1901 \pkg{acro}~\cite{pkg:acro},
1902 \pkg{glossaries-extra}~\cite{pkg:glossaries-extra},
1903 \pkg{hyperref}~\cite{pkg:hyperref}, \pkg{longtable}~\cite{pkg:longtable}
1904 and/or \pkg{xltabular}~\cite{pkg:xltabular} might be needed for this module
1905 and will be explicitly mentioned in the corresponding sections of this manual.
1906
1907 \subsection{Basic Commands}
1908
1909 \begin{commands}
1910 \command{DeclareChemReactant}[\marg{ID}\marg{properties}]
1911 This command defines the reactant \meta{ID} with the properties
1912 \meta{properties}. \emph{Should be used in the preamble. Must be used in
1913 the preamble when \pkg{acro} is used as acronym support package.}
1914 \command{DeclareChemReactant}[\Marg{\meta{main ID}.\meta{sub ID}}\marg{properties}]
1915 Analogously to \pkg{chemnum}'s \cs{cmpd} command, both the
1916 \cs{DeclareChemReactant} and \cs{reactant} commands accept a combined
1917 \meta{ID} consisting of a \meta{main ID} and \meta{sub ID} part. The
1918 default separator is a \code{.} here, but this can be changed using
1919 \pkg{chemnum}'s \keyis{main-sub-sep}{token} option.
1920 \end{commands}
1921 Valid \meta{properties} include the following key-value pairs:
1922 \begin{options}
1923 \keyval{name}{name}
1924 Mandatory property: the name of the substance.
1925 \keyval{short}{abbreviation}
1926 Optional property: a short form of the name, used when the
1927 \module{reactants} module is used in combination with the
1928 \option{acronym-support} option, see section~\vref{sec:acronyms-in-reactants}.
1929 \keyval{bookmark}{replacement in \ac{pdf} bookmarks}
1930 Optional property: replaces \meta{name} in a \ac{pdf} bookmark. This
1931 might be advisable when reactants are used in section titles and the
1932 \pkg{hyperref} package is used as well, see
1933 section~\vref{sec:reactants-in-headings}.
1934 \keyval{upper-name}{upper case version of the name}
1935 Optional property: The upper case version of a compound's name, e.g. for
1936 the use in the beginning of a sentence.
1937 \keyval{upper-bookmark}{upper case version of the bookmark text}
1938 Optional property: The upper case version of the \meta{name} in a \ac{pdf} bookmark.
1939 \end{options}
1940
1941 Common declarations will look like this:
1942 \begin{sourcecode}
1943 \DeclareChemReactant{thf}{name={tetrahydrofuran}, short={THF}}
1944 \DeclareChemReactant{H2SO4}{name={\ch{H2SO4}}}
1945 \DeclareChemReactant{dichloropentane}{name={\iupac{2,4-di|chloro|pentane}}}
1946 \end{sourcecode}
1947
1948 \begin{commands}
1949 \command{reactant}[\oarg{data and units}\marg{ID}]
1950 This command is used to insert name, number, and, if present, data of a
1951 predefined reactant with the \meta{ID} in the text. The order of the
1952 information in the output can be controlled through the
1953 \option{reactant-output-style} option, see
1954 section~\vref{sec:output-styles}. The upper case version of this command
1955 \cs{Reactant} can be used in order to start a sentence with an upper case
1956 version of a compound's name. The corresponding text must be defined
1957 through \cs{DeclareChemReactant}'s \option{upper-name} option. Further
1958 variants of \cs{reactant} with different suffixes, such as \sarg,
1959 \parg, \code{l}, \code{s} or \code{plain} will be described later.
1960 \command{solvent}[\oarg{data and units}\marg{ID}]
1961 Analogous to \cs{reactants}. Can be used to insert solvent names and
1962 corresponding data in the text. Format and order depend on the on the
1963 \option{solvent-output-style} option. The upper case version of this
1964 command \cs{Solvent} can be used in order to start a sentence with an
1965 upper case version of a solvent's name. The corresponding text must be
1966 defined through \cs{DeclareChemReactant}'s \option{upper-name} option.
1967 \code{s} and \code{l} suffixed variants exist and are discussed later.
1968 \end{commands}
1969
1970 \meta{data and units} accepts a comma separated list of key-value pairs. Valid keys,
1971 acceptable values as well as their defaults are listed in table~\vref{tab:reactant-data}.
1972
1973 Typical uses will look like this:
1974 \begin{sourcecode}
1975 \reactant{dichloropentane}
1976 \reactant[volume=5]{dichloropentane}
1977 \reactant[volume=0.5, volume-unit=\L]{dichloropentane}
1978 \solvent{thf}
1979 \solvent[volume=200]{thf}
1980 \solvent[volume=1.5, volume-unit=\L]{thf}
1981 \end{sourcecode}
1982
1983 \begin{commands}
1984 \command{printreactants}
1985 Prints a list of number and name of all reactants used throughout the
1986 document. The resulting list is sorted by number and also includes
1987 compounds numbered with \pkg{chemnum}'s \cs{cmpd} command. The starred
1988 variant also includes the \meta{ID} in the list of reactants. Using
1989 \option{printreactants-style} different styles can be selected. (See
1990 section~\vref{sec:list-of-reactants}).
1991 \end{commands}
1992
1993 \subsection{Options}
1994 \begin{options}
1995 \keybool{initiate}\Module{reactants}\Initial{false}
1996 The \pkg{chemnum} package that is internally used for numbering the
1997 reactants offers two ways of initiating a new label: either when \cs{cmpd}
1998 is first used or through \cs{initcmpd}. The \module{reactants} module
1999 also offers these two methods with initiating a new label upon the first
2000 use of a reactant being the default. If you prefer to initiate a
2001 new label through the \cs{DeclareChemReactant} command set this option to
2002 true.
2003
2004 Reactants are automatically numbered in the order of their first
2005 appearance, while \option{initiate} numbers the compounds in the order in
2006 which they were declared in the preamble or in an external document.
2007 \keybool{switch}\Module{reactants}\Initial{false}
2008 While \cs{reactants} will output name and number of a reactant, its
2009 starred variant \cs{reactant}\sarg, will by default result in the name
2010 without the corresponding number. Setting \keyis{switch}{true}, globally
2011 or locally, reverses this behavior and outputs a reactant's number without
2012 its name.
2013 \end{options}
2014 Other options are described at later places when the corresponding behavior is
2015 described.
2016
2017 \subsubsection{Data and Units}
2018
2019 Describing synthetic procedures often requires adding a lot of data with the
2020 corresponding units to each reactant/solvent that is used. In order to allow
2021 for a uniform representation of numbers and units, as well as making the code
2022 more readable, the \cs{reactant} and \cs{solvent} commands offer an optional
2023 argument that can be used to easily input this data:
2024
2025 \begin{commands}
2026 \command{reactant}[\oarg{data and units}\marg{ID}]
2027 \phantom{X}\vspace*{-\baselineskip}
2028 \command{solvent}[\oarg{data and units}\marg{ID}]
2029 \phantom{X}\vspace*{-\baselineskip}
2030 \end{commands}
2031
2032 \begin{table}[bp]
2033 \newcolumntype{K}{>{\collectcell\code}l<{\endcollectcell}}
2034 \newcolumntype{O}{>{\collectcell\option}l<{\endcollectcell}}
2035 \centering
2036 \caption{Overview of available keys as well as the default units and the
2037 option to locally or globally change that default unit.}
2038 \label{tab:reactant-data}
2039 \begin{tabular}{KlO}
2040 \toprule
2041 \tablehead{Key} & \tablehead{default unit} & \tablehead{option} \\
2042 \midrule
2043 mass & \unit{\gram} & mass-unit \\
2044 volume & \unit{\milli\liter} & volume-unit \\
2045 fraction & w/w\% & fraction-unit \\
2046 amount & \unit{\milli\mole} & amount-unit \\
2047 equiv & eq & equiv-unit \\
2048 purity & \% & purity-unit \\
2049 concentration & \unit{\Molar} & concentration-unit \\
2050 solvent & n.a. & \\
2051 \midrule
2052 solution-name & solution in & solution \\
2053 \bottomrule
2054 \end{tabular}
2055 \end{table}
2056
2057 \meta{data and units} accepts a comma separated list of key-value pairs with
2058 the available keys and their default units/values listed in
2059 table~\vref{tab:reactant-data}. Key-value pairs can be input in any order as
2060 they are categorized and rearranged internally according to the order in which
2061 they are listed in table~\vref{tab:reactant-data}. Customization of this order
2062 is thus far somewhat limited. The available customization possibilities are
2063 described in section~\vref{sec:output-styles}. Since numbers and their
2064 corresponding units are processed using \pkg{siunitx}, the usual \cs{sisetup}
2065 command can be used to alter, for example, the output decimal separator
2066 according to your needs. Be aware, though, that you must surround a number
2067 with a set of \code{\{\}} if you use a comma as input decimal
2068 separator. Otherwise the decimal places will be truncated without a warning.
2069
2070 \option{solution} here refers to the text that links concentration and
2071 solvent. This text automatically adapts to the document language set via
2072 \pkg{babel} or \pkg{polyglossia}. Currently, the English fallback, as well as
2073 the German translation are included in the package. If you write in a
2074 different language (or just don't like the predefined text), you can use the
2075 command \cs{DeclareChemTranslation}\marg{key}\marg{language}\marg{translation}
2076 (with \keyis*{\meta{key}}{solution}) as described in
2077 section~\vref{sec:lang-module} in order to supply your own translation.
2078
2079 \begin{example}
2080 % in the preamble:
2081 % \DeclareChemReactant{nBuLi}{name={\iupac{\textit{n}=butyllithium}}}
2082 % \DeclareChemReactant{Br2benzene}{name={\iupac{1,4=di|bromo|benzene}}}
2083 % \DeclareChemReactant{HBr}{name={\ch{HBr\aq}}}
2084
2085 \reactant[volume=5.00, amount=12.5, equiv=1.00, concentration=2.5, solvent=hexane]{nBuLi}\par
2086 \reactant[mass=3.9, amount=15.6, equiv=1.3, purity=95]{Br2benzene}\par
2087 \reactant[volume=2.0, amount=43.8, equiv=3.5, fraction=65]{HBr}
2088 \end{example}
2089
2090 The options that change the units of the properties can be set with
2091 \cs{chemsetup} or in the optional argument of \cs{reactant}. Accepted units
2092 are units defined by the \pkg{siunitx} package or by the \module{units} module.
2093 \begin{options}
2094 \keyval{mass-unit}{unit}\Module{reactants}\Initial{\cs*{gram}}
2095 Change the unit of the \code{mass} property.
2096 \keyval{volume-unit}{unit}\Module{reactants}\Initial{\cs*{milli}\cs*{liter}}
2097 Change the unit of the \code{volume} property.
2098 \keyval{fraction-unit}{unit}\Module{reactants}\Initial{\code{w/w \cs*{percent}}}
2099 Change the unit of the \code{fraction} property.
2100 \keyval{amount-unit}{unit}\Module{reactants}\Initial{\cs*{milli}\cs*{mole}}
2101 Change the unit of the \code{amount} property.
2102 \keyval{equiv-unit}{unit}\Module{reactants}\Initial{\code{eq}}
2103 Change the unit of the \code{equiv} property.
2104 \keyval{concentration-unit}{unit}\Module{reactants}\Initial{\cs*{Molar}}
2105 Change the unit of the \code{concentration} property.
2106 \keyval{purity-unit}{unit}\Module{reactants}\Initial{\cs*{percent}}
2107 Change the unit of the \code{purity} property.
2108 \end{options}
2109
2110 \begin{example}
2111 \reactant[volume=5.5]{thf} \par
2112 \reactant[volume=5, volume-unit=\cubic\centi\metre]{thf}
2113 \end{example}
2114
2115 \subsubsection{Output Styles}\label{sec:output-styles}
2116
2117 The \module{reactants} module categorizes the data into different categories
2118 that are later used to determine the order in which this information is
2119 displayed. This behavior can be controlled using the following predefined
2120 output styles:
2121
2122 \begin{options}
2123 \keychoice{reactant-output-style}{name-main-other,main-name-other,main-other-name}%
2124 \Module{reactants}\\[-\baselineskip]
2125 \Initial{name-main-other}
2126 Select one of the three predefined styles to determine the output style of
2127 the data and their units in the \cs{reactant} command.
2128 \keychoice{solvent-output-style}{main-name,name-main}\Module{reactants}\Initial{main-name}
2129 Select one of the two predefined styles to determine the output style of
2130 the data and their units in the \cs{solvent} command.
2131 \end{options}
2132
2133 \code{name} here refers to the combination of name and number (or if just one
2134 of them is available, to either name or number).
2135
2136 \code{main} here refers to the \code{mass} or \code{volume} of a reactant or
2137 solvent. If needed, \code{equiv} and/or \code{amount} can also be assigned to
2138 the main category.
2139
2140 \code{other} here refers to all the other data that is give to the reactant
2141 command.
2142
2143 The names of the \option{reactant-output-style} and
2144 \option{solvent-output-style} choice options refer to the order in which the
2145 contents of the categories are typeset.
2146
2147 \begin{example}
2148 \chemsetup[reactants]{reactant-output-style=name-main-other}
2149 \reactant[volume=5, amount=4]{dichloropentane}\par
2150 \chemsetup[reactants]{reactant-output-style=main-name-other}
2151 \reactant[volume=5, amount=4]{dichloropentane}\par
2152 \chemsetup[reactants]{reactant-output-style=main-other-name}
2153 \reactant[volume=5, amount=4]{dichloropentane}
2154
2155 \chemsetup[reactants]{solvent-output-style=name-main}
2156 \solvent[volume=5]{thf}\par
2157 \chemsetup[reactants]{solvent-output-style=main-name}
2158 \solvent[volume=5]{thf}
2159 \end{example}
2160
2161 \begin{options}
2162 \keychoice{main}{default,amount,equiv}\Module{reactants}\Initial{default}
2163 By default, only \code{mass} and \code{volume} are assigned to the
2164 \code{main} category. Using the \option{main} option, \code{equiv} or
2165 \code{amount} can be added to the main category.
2166 \end{options}
2167 \chemsetup[reactants]{reactant-output-style=main-name-other}
2168
2169 \begin{example}
2170 \chemsetup[reactants]{main=amount}
2171 \reactant[equiv=2.0, amount=5]{dichloropentane}\par
2172 \chemsetup[reactants]{main=equiv}
2173 \reactant[equiv=2.0, amount=5]{dichloropentane}\par
2174 \chemsetup[reactants]{main=default}
2175 \reactant[equiv=2.0, amount=5]{dichloropentane}
2176 \end{example}
2177
2178 \begin{options}
2179 \keybool{equivalents}\Module{reactants}\Initial{true}
2180 Can be used to prevent \code{equiv} from being output while still keeping
2181 the corresponding information in the input code. If you used the
2182 \keyis{main}{equiv} option, the \keyis{equivalents}{false} option will be
2183 ignored for the corresponding entries.
2184 \end{options}
2185
2186 \subsection{Use in Section Headings}\label{sec:reactants-in-headings}
2187
2188 Using the \cs{reactants} command inside of section headings or captions can
2189 mess up the order in which the molecules are numbered, especially when also
2190 using a table of contents and/or a list of figures/tables. To prevent this,
2191 the \module{reactants} module offers the \parg\ suffixed variant of
2192 \cs{reactants}, comparable to \pkg{chemnum}'s \cs{cmpd}\parg\ command.
2193
2194 \begin{commands}
2195 \command{reactant}[\parg\oarg{data and units}\marg{ID}]
2196 This command is used to insert name, number, and, if present, data of a
2197 predefined reactant with the \meta{ID} in a section heading or caption.
2198 \end{commands}
2199
2200 If you also use the \pkg{hyperref} package in combination with \ac{pdf}
2201 bookmarks, you might want to use the optional \option{bookmark} property of
2202 \cs{DeclareChemReactant} to supply an alternative text to \option{name} to be
2203 displayed inside of the \ac{pdf} bookmarks. To later use such a predefined
2204 solvent or reactant, use one of the following three commands, that are defined
2205 analogously to \pkg{chemnum}`s \cs{cmpdplain}. All three commands also exist
2206 in the upper case variant (\cs{Reactantplain}, \cs{Submainreactantplain} and
2207 \cs{Solventplain}) which can be used to display the upper case version of a
2208 reactant or solvent's name. The upper case version of the name must be declared
2209 previously through \cs{DeclareChemReactant}'s \option{upper-name} and
2210 \option{upper-bookmark} options.
2211
2212 \begin{commands}
2213 \command{reactantplain}[\marg{ID}]
2214 Outputs the value of \option{bookmark} inside of the \ac{pdf} bookmark,
2215 while using the reactant's \option{name} inside of the section headings.
2216 \command{submainreactantplain}[\marg{mainID}\marg{subID}]
2217 Outputs the value of \option{bookmark} inside of the \ac{pdf} bookmark,
2218 while using the reactant's \option{name} inside of the section
2219 headings. Must be used if your \meta{ID} consists of a \meta{mainID}
2220 and a \meta{subID} part.
2221 \command{solventplain}[\marg{ID}]
2222 Outputs the value of \option{bookmark} inside of the \ac{pdf} bookmark,
2223 while using the solvent's \option{name} inside of the section headings.
2224 \end{commands}
2225
2226
2227 \subsection{Acronyms as Reactant/Solvent Names}\label{sec:acronyms-in-reactants}
2228
2229 In order to integrate solvent/reactant acronyms into one combined list of
2230 acronyms, the reactants module offers two different options. While using
2231 either of these two options, the user can also explicitly decide if the
2232 \option{name} or the \option{short} version of the reactant/solvent should be
2233 used in the text. Inspired by the \cs{acs} and \cs{acl} commands from the
2234 \pkg{acro} or the \pkg{glossaries-extra} package, the \module{reactants}
2235 module also offers the following \code{s} and \code{l} suffixed variants:
2236
2237 \begin{commands}
2238 \command{reactants}[\marg{ID}]
2239 Output the \option{short} version of the reactant's name.
2240 \command{reactantl}[\marg{ID}]
2241 Output the \option{name} version of the reactant's name.
2242 \command{solvents}[\marg{ID}]
2243 Output the \option{short} version of the solvent's name.
2244 \command{solventl}[\marg{ID}]
2245 Output the \option{name} version of the solvent's name.
2246 \end{commands}
2247
2248 \begin{options}
2249 \keychoice{acronym-support}{acro,glossaries,none}\Module{reactants}\Initial{none}
2250 Can be used to select, which of the two packages \pkg{acro} or
2251 \pkg{glossaries-extra} is used in the background in order to format and
2252 sort acronyms.
2253 \end{options}
2254
2255 \begin{example}
2256 % in the preamble:
2257 % \DeclareChemReactant{dcm}{name={dichloromethane}, short={DCM}}
2258 \solvent{dcm}\par
2259 \solventl{dcm}\par
2260 \solvents{dcm}
2261 \end{example}
2262
2263 \subsection{List of Reactants}\label{sec:list-of-reactants}
2264 As mentioned before, \cs{printreactants} can be used to print a list of all
2265 used reactants and their numbers. The \module{reactants} module internally
2266 uses either \pkg{longtable} or \pkg{xltabular} to typeset this list:
2267 \begin{options}
2268 \keychoice{printreactants-style}{xltabular,longtable,none}\Module{reactants}\Initial{none}
2269 Can be used to switch between \pkg{longtable} and \pkg{xltabular} which
2270 are responsible for formatting the list of reactants. Be aware that with
2271 \code{longtable}, the column widths are hard coded, thus you could
2272 experience overfull box warnings if you use exceptionally long \meta{ID}s
2273 in combination with the starred variant \cs{printreactants}\sarg, which is
2274 responsible for adding the \meta{ID} in resulting list, as well.
2275 \end{options}
2276
2277 \section{The \chemmodule*{redox} Module}\label{sec:redox-module}
2278
2279 The \chemmodule{redox} module loads the modules \chemmodule{tikz} and
2280 \chemmodule{xfrac}. It also loads the packages
2281 \pkg{mathtools}~\cite{pkg:mathtools} and \pkg{relsize}~\cite{pkg:relsize}.
2282
2283 \subsection{Oxidation Numbers}\label{sec:oxidation-numbers}
2284
2285 Regarding the typesetting of oxidation numbers
2286 \citetitle{iupac:greenbook}~\cite{iupac:greenbook} says the following:
2287 \begin{cnltxquote}[{\cite[][p.\,50]{iupac:greenbook}}]
2288 Oxidation numbers are denoted by positive or negative Roman numerals or by
2289 zero \textelp{}
2290
2291 \textit{Examples}\quad \ox{7,Mn}, \ox[pos=side]{7,manganese}, \ox{-2,O},
2292 \ox{0,Ni}
2293 \end{cnltxquote}
2294
2295 The following command is provided to set oxidation numbers:
2296 \begin{commands}
2297 \command{ox}[\sarg\oarg{options}\Marg{\meta{number},\meta{atom}}]
2298 Places \meta{number} as right superscript to \meta{atom}; \meta{number}
2299 has to be a (rational) number! \meta{atom} is treated as a \chemformula\
2300 formula, like it would be in \cs{chcpd} (this depends on the setting of
2301 the \option{formula} option, see~\vref{sec:formula-module}).
2302 \end{commands}
2303
2304 \begin{example}
2305 \ox{+1,Na}, \ox{2,Ca}, \ox{-2,S}, \ox{-1,F}
2306 \end{example}
2307
2308 There are a number of options that can be used to modify the typeset result:
2309 \begin{options}
2310 \keyval{format}{code}\Module{redox}
2311 \sinceversion{5.11}Allows to apply arbitrary \meta{code} in front of the
2312 typeset oxidation numbers. The last command may expect the oxidation
2313 number as an argument. An example might be \cs*{textcolor}\Marg{red}.
2314 \keybool{parse}\Module{redox}\Initial{true}
2315 When \code{false} an arbitrary entry can be used for \code{<number>}.
2316 \keybool{roman}\Module{redox}\Initial{false}
2317 Switches from Roman to Arabic numbers.
2318 \keychoice{pos}{top,super,side}\Module{redox}\Initial{super}
2319 \code{top} places \meta{number} above \meta{atom}, \code{super} to the
2320 upper right as superscript and \code{side} to the right and inside
2321 brackets. Both \code{super} and \code{side} follow \ac{iupac}
2322 recommendation, \code{top} does not!
2323 \keybool{explicit-sign}\Module{redox}\Initial{false}
2324 Shows the $+$ for positive numbers and the $\pm$ for $0$.
2325 \keybool{explizit-zero-sign}\Module{redox}\Initial{true}
2326 Only\sinceversion{5.4} if both \option{explicit-sign} and
2327 \option{explicit-zero-sign} are set to \code{true} $\pm0$ will be
2328 printed.
2329 \keychoice{decimal-marker}{comma,point}\Module{redox}\Initial{point}
2330 Choice for the decimal marker for formal oxidation numbers like \ox{1.2,X}.
2331 \keychoice{align}{center,right}\Module{redox}\Initial{center}
2332 Center the oxidation number relative to the atom or right-align it.
2333 \keyval{side-connect}{code}\Module{redox}\Initial{\cs*{,}}
2334 Code that is inserted between atom and oxidation number if
2335 \keyis{pos}{side} is used.
2336 \keyval{text-frac}{cs}\Module{redox}\Initial{\cs{chemfrac}\Oarg{text}\Marg{\#1}\Marg{\#2}}
2337 The fraction macro that is used for fractions if \keyis{pos}{side} is
2338 used. \meta{cs} must be a macro that takes two mandatory arguments, the
2339 first for the numerator and the second for the denominator.
2340 \keyval{super-frac}{cs}\Module{redox}\Initial{\cs{chemfrac}\Oarg{superscript}%
2341 \Marg{\#1}\Marg{\#2}}
2342 The fraction macro that is used for fractions if \keyis{pos}{top} or
2343 \keyis{pos}{super} is used. \meta{cs} must be a macro that takes two
2344 mandatory arguments, the first for the numerator and the second for the
2345 denominator.
2346 \end{options}
2347
2348 \begin{example}[side-by-side]
2349 \ox[roman=false]{2,Ca} \ox{2,Ca} \\
2350 \ox[pos=top]{3,Fe}-Oxide \\
2351 \ox[pos=side]{3,Fe}-Oxide \\
2352 \ox[parse=false]{?,Mn} \\
2353 \ox[pos=top,align=right]{2,Ca}
2354 \end{example}
2355
2356 The \keyis{pos}{top} variant also can be set with the shortcut \cs{ox}\sarg:
2357 \begin{example}[side-by-side]
2358 \ox{3,Fe} \ox*{3,Fe}
2359 \end{example}
2360
2361 Using the \option{explicit-sign} option will always show the sign of the
2362 oxidation number:
2363 \begin{example}
2364 \chemsetup[redox]{explicit-sign = true}
2365 \ox{+1,Na}, \ox{2,Ca}, \ox{-2,S}, \ch{"\ox{0,F}" {}2}
2366 \end{example}
2367
2368 \begin{example}
2369 \chemsetup[redox]{pos=top}
2370 Compare \ox{-1,O2^2-} to \ch{"\ox{-1,O}" {}2^2-}
2371 \end{example}
2372
2373 Sometimes one might want to use formal oxidation numbers like \num{.5} or
2374 \chemfrac{1}{3}:
2375 \begin{example}[side-by-side]
2376 \chemsetup[redox]{pos=top}
2377 \ox{.5,Br2}
2378 \ch{"\ox{1/3,I}" {}3+}
2379
2380 \chemsetup[redox]{pos=side}
2381 \ox{1/3,I3+}
2382 \end{example}
2383
2384 The fraction is displayed with the help of the \pkg{xfrac}
2385 package~\cite{bnd:l3packages}. For more details on how \chemmacros\ uses it
2386 read section~\vref{sec:xfrac-module}.
2387
2388 \subsection{Redox Reactions}\label{sec:redox-reactions}
2389
2390 \chemmacros\ provides two commands to visualize the transfer of electrons in
2391 redox reactions. Both commands are using \TikZ.
2392 \begin{commands}
2393 \command{OX}[\Marg{\meta{name},\meta{atom}}]
2394 Label \meta{atom} with the label \meta{name}.
2395 \command{redox}[\Darg{\meta{name1},\meta{name2}}\oarg{tikz}\oarg{num}\marg{text}]
2396 Connect two \meta{atom}s previously labeled with \cs{OX}. Only the first
2397 argument \Darg{\meta{name1},\meta{name2}} is required, the others are all
2398 optional.
2399 \end{commands}
2400
2401 \cs{OX} places \meta{atom} into a node, which is named with \meta{name}. If
2402 you have set two \cs{OX}, they can be connected with a line using \cs{redox}.
2403 To do so the names of the two nodes that are to be connected are written in
2404 the round braces. Since \cs{redox} draws a \code{tikzpicture} with options
2405 \code{remember picture,overlay}, the document needs to be \emph{compiled at
2406 least two times}.
2407
2408 \begin{example}
2409 \vspace{7mm}
2410 \OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b){oxidation}
2411 \end{example}
2412
2413 This line can be customized using \TikZ\ keys in \oarg{tikz}:
2414 \begin{example}
2415 \vspace{7mm}
2416 \OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b)[->,red]{ox}
2417 \end{example}
2418
2419 With the argument \oarg{num} the length of the vertical parts of the line can
2420 be adjusted. The default length is \code{.6em}. This length is multiplied
2421 with \meta{num}. If you use a negative value the line is placed \emph{below}
2422 the text.
2423 \begin{example}
2424 \vspace{7mm}
2425 \OX{a,Na} $\rightarrow$ \OX{b,Na}\pch
2426 \redox(a,b)[->,red]{ox}
2427 \redox(a,b)[<-,blue][-1]{red}
2428 \vspace{7mm}
2429 \end{example}
2430
2431 The default length of the vertical lines can be customized with the option
2432 \begin{options}
2433 \keyval{dist}{dim}\Module{redox}\Initial{.6em}
2434 A \TeX\ dimension.
2435 \end{options}
2436
2437 \begin{example}
2438 \vspace{7mm}
2439 \chemsetup{redox/dist=1em}
2440 \OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b)[->,red]{ox}
2441 \end{example}
2442
2443 \begin{options}
2444 \keyval{sep}{dim}\Module{redox}\Initial{.2em}
2445 The option can be used to change the distance between the atom and the
2446 beginning of the line.
2447 \end{options}
2448
2449 \begin{example}
2450 \vspace{7mm}
2451 \chemsetup{redox/sep=.5em}
2452 \OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b)[->,red]{ox}
2453 \end{example}
2454
2455 \subsection{Examples}
2456 \begin{example}
2457 \vspace{7mm}
2458 \ch{
2459 2 "\OX{o1,Na}" + "\OX{r1,Cl}" {}2
2460 ->
2461 2 "\OX{o2,Na}" {}+ + 2 "\OX{r2,Cl}" {}-
2462 }
2463 \redox(o1,o2){\small OX: $- 2\el$}
2464 \redox(r1,r2)[][-1]{\small RED: $+ 2\el$}
2465 \vspace{7mm}
2466 \end{example}
2467
2468 \begin{example}
2469 \vspace{7mm}
2470 \ch{
2471 2 "\OX{o1,\ox*{0,Na}}" + "\OX{r1,\ox*{0,Cl}}" {}2
2472 ->
2473 2 "\OX{o2,\ox*{+1,Na}}" {}+ + 2 "\OX{r2,\ox*{-1,Cl}}" {}-
2474 }
2475 \redox(o1,o2){\small OX: $- 2\el$}
2476 \redox(r1,r2)[][-1]{\small RED: $+ 2\el$}
2477 \vspace{7mm}
2478 \end{example}
2479
2480 \begin{example}
2481 \vspace{14mm}
2482 \ch{
2483 2 "\OX{o1,\ox*{0,Na}}" + "\OX{r1,\ox*{0,Cl}}" {}2
2484 ->
2485 2 "\OX{o2,\ox*{+1,Na}}" {}+ + 2 "\OX{r2,\ox*{-1,Cl}}" {}-
2486 }
2487 \redox(o1,o2)[draw=red,->][3.33]{\small OX: $- 2\el$}
2488 \redox(r1,r2)[draw=blue,->]{\small RED: $+ 2\el$}
2489 \end{example}
2490
2491 \begin{example}
2492 \vspace{7mm}
2493 \ch{
2494 2 "\OX{o1,\ox*{0,Na}}" + "\OX{r1,\ox*{0,Cl}}" {}2
2495 -> 2 "\OX{o2,\ox*{+1,Na}}" {}+ + 2 "\OX{r2,\ox*{-1,Cl}}" {}-
2496 }
2497 \redox(o1,o2)[green,-stealth]{\small OX}
2498 \redox(r1,r2)[purple,-stealth][-1]{\small RED}
2499 \vspace{7mm}
2500 \end{example}
2501
2502 \section{The \chemmodule*{scheme} Module}\label{sec:scheme-module}
2503
2504 The \chemmodule{scheme} module loads the \pkg{chemnum}
2505 package~\cite{pkg:chemnum} and defines a floating environment
2506 \showenv{scheme}. That is, it \emph{only} defines this float if no
2507 environment \env{scheme} exists at the end of the preamble. The module checks
2508 for different available float defining methods:
2509 \begin{itemize}
2510 \item If the current class is a \KOMAScript\ class \cs*{DeclareNewTOC} will
2511 be used.
2512 \item If the current class is \cls{memoir}, \cls{memoir}'s methods are used.
2513 \item If the package \pkg{tocbasic} has been loaded \cs*{DeclareNewTOC} will
2514 be used.
2515 \item If the package \pkg{newfloat} has been loaded
2516 \cs*{DeclareFloatingEnvironment} will be used.
2517 \item \sinceversion{5.1}If the package \pkg{floatrow} has been loaded its
2518 method will be used.
2519 \item If the package \pkg{float} has been loaded its method will be used.
2520 \item If neither of the above the \enquote{manual} method is used. This
2521 means the environment is defined the same way like \env*{figure} is
2522 defined in the \cls*{article} class or the \cls*{book} class, depending if
2523 \cs*{chapter} is defined or not (the \enquote{traditional} way).
2524 \item \sinceversion{6.1}If no unique choice is possible the \emph{last} of
2525 the detected methods will be used. For example, if you use the
2526 \cls{memoir} class \emph{and} load the \pkg{float} then the method of
2527 \pkg{float} will be used.
2528 \end{itemize}
2529
2530 \begin{options}
2531 \keychoice{float-method}{KOMA,memoir,tocbasic,newfloat,floatrow,float,traditional}\Module{scheme}
2532 \sinceversion{6.1}You can also decide for yourself which method you want
2533 \chemmacros\ to use by setting this option accordingly.
2534 \end{options}
2535
2536 The list name and the caption name both are translated to the language
2537 specified according to the \option{lang} option and the provided translations,
2538 see section~\vref{sec:lang-module} for details. If you want to manually change
2539 them then redefine these macros after begin document:
2540 \begin{commands}
2541 \command{listschemename}
2542 The name of the list of schemes.
2543 \command{schemename}
2544 The name used in captions.
2545 \end{commands}
2546 The list of schemes is printed as expected with
2547 \begin{commands}
2548 \command{listofschemes}
2549 \end{commands}
2550
2551 If\sinceversion{5.6} you are using either \pkg{cleveref}~\cite{pkg:cleveref}
2552 or \pkg{fancyref}~\cite{pkg:fancyref} the \env{scheme} counter is supported by
2553 both packages and already set up by \chemmacros.
2554
2555 For \pkg{fancyref} \chemmacros\ uses the prefix \code{sch} by defining the
2556 following:
2557 \begin{sourcecode}
2558 \newcommand*\fancyrefschlabelprefix{sch}
2559 \end{sourcecode}
2560 You can of course redefine \cs{fancyrefschlabelprefix} into whatever suits you
2561 best.
2562
2563 \section{The \chemmodule*{spectroscopy} Module}\label{sec:spectroscopy-module}
2564
2565 The \chemmodule{spectroscopy} module loads the \chemmodule{formula} module
2566 and the \pkg{siunitx} package~\cite{pkg:siunitx}.
2567
2568 \subsection{The \cs*{NMR} Command}
2569
2570 When you're trying to find out if a compound is the one you think it is often
2571 NMR spectroscopy is used. The experimental data are typeset similar to this:
2572 \begin{center}
2573 \NMR(400)[CDCl3] = \num{1.59}
2574 \end{center}
2575 The \chemmodule{spectroscopy} module provides a command which simplifies the
2576 input.
2577
2578 \begin{commands}
2579 \command{NMR}[\sarg\Marg{\meta{num},\meta{element}}%
2580 \Darg{\meta{num},\meta{unit}}\oarg{solvent}]
2581 Typeset nuclear magnetic resonance data. \meta{num} is a valid
2582 \pkg{siunitx} number input, \meta{unit} is a valid \pkg{siunitx} unit
2583 input. \meta{solvent} is any valid \chemformula\ input as in \cs{chcpd}
2584 (this depends on the setting of the \option{formula} option,
2585 see~\vref{sec:formula-module}).
2586 \end{commands}
2587
2588 \emph{All} Argument are optional! Without arguments we get:
2589 \begin{example}[side-by-side]
2590 \NMR \par
2591 \NMR*
2592 \end{example}
2593
2594 The first argument specifies the kind of NMR:
2595 \begin{example}[side-by-side]
2596 \NMR{13,C}
2597 \end{example}
2598
2599 The second argument sets the frequency (in \unit{\mega\hertz}):
2600 \begin{example}[side-by-side]
2601 \NMR(400)
2602 \end{example}
2603 You can choose another unit:
2604 \begin{example}[side-by-side]
2605 \NMR(4e8,\hertz)
2606 \end{example}
2607 Please note that the setup of \pkg{siunitx} also affects this command:
2608 \begin{example}[side-by-side]
2609 \sisetup{exponent-product=\cdot}
2610 \NMR(4e8,\hertz)
2611 \end{example}
2612
2613 The third argument specifies the solvent:
2614 \begin{example}[side-by-side]
2615 \NMR[CDCl3]
2616 \end{example}
2617
2618 \subsection{Short Cuts}
2619
2620 It is possible to define short cut commands for specific nuclei.
2621 \begin{commands}
2622 \command{NewChemNMR}[\marg{cs}\Marg{\meta{num},\meta{atom}}]
2623 Define a new shortcut macro for typesetting a certain type of magnetic
2624 resonance data. Gives an error if \meta{cs} already exists.
2625 \command{DeclareChemNMR}[\marg{cs}\Marg{\meta{num},\meta{atom}}]
2626 Define a new shortcut macro for typesetting a certain type of magnetic
2627 resonance data. Overwrites an existing macro.
2628 \command{RenewChemNMR}[\marg{cs}\Marg{\meta{num},\meta{atom}}]
2629 Redefine an existing shortcut macro for typesetting a certain type of
2630 magnetic resonance data. Gives an error if \meta{cs} doesn't exist.
2631 \command{ProvideChemNMR}[\marg{cs}\Marg{\meta{num},\meta{atom}}]
2632 Define a new shortcut macro for typesetting a certain type of magnetic
2633 resonance data. \meta{cs} is only defined if it doesn't exist, yet.
2634 \end{commands}
2635
2636 This defines a command with the same arguments as \cs{NMR} \emph{except} for
2637 \Marg{\meta{num},\meta{atom}}:
2638 \begin{example}[side-by-side]
2639 \NewChemNMR\HNMR{1,H}%
2640 \NewChemNMR\CNMR{13,C}%
2641 \CNMR*(100) \par
2642 \HNMR*(400)
2643 \end{example}
2644
2645 \subsection{An Environment to Typeset Experimental Data}
2646
2647 The \chemmodule{spectroscopy} module provides an environment to ease the input
2648 of experimental data.
2649 \begin{environments}
2650 \environment{experimental}
2651 Environment for the output of experimental data. Inside the environment
2652 the following commands are defined.
2653 \end{environments}
2654 \begin{commands}
2655 \command{data}[\marg{type}\oarg{specification}]
2656 Type of data, \eg\ IR, MS\ldots\ The optional argument takes further
2657 specifications which are output in parentheses.
2658 \command{data}[\sarg\marg{type}\oarg{specification}]
2659 Like \cs{data} but changes the \code{=} into a \code{:}, given that
2660 \keyis{use-equal}{true} is used.
2661 \command{NMR}[\Marg{\meta{num},\meta{elem}\oarg{coupling
2662 core}}\Darg{\meta{num},\meta{unit}}\oarg{solvent}]
2663 This command gets an additional argument:
2664 \cs{NMR}\Marg{13,C[\textasciicircum 1H]} \NMR{13,C[^1H]}
2665 \command{J}[\Darg{\meta{bonds};\meta{nuclei}}\oarg{unit}\marg{list of nums}]
2666 Coupling constant, values are input separated by \code{;} (NMR). The
2667 arguments \Darg{\meta{bonds};\meta{nuclei}} and \oarg{unit} are optional
2668 and enable further specifications of the coupling.
2669 \command{\#}[\marg{num}]
2670 Number of nuclei (NMR).
2671 \command{pos}[\marg{num}]
2672 Position of nuclues (NMR).
2673 \command{val}[\marg{num}]
2674 A number, an alias of \pkg{siunitx}' \cs*{num}\marg{num}.
2675 \command{val}[\Marg{\meta{num1}--\meta{num2}}]
2676 An alias of \pkg{siunitx}' \cs*{numrange}\marg{num1}\marg{num2}.
2677 \end{commands}
2678
2679 \begin{example}
2680 \begin{experimental}
2681 \data{type1} Data.
2682 \data{type2}[specifications] More data.
2683 \data*{type3} Even more data.
2684 \end{experimental}
2685 \end{example}
2686
2687 \subsection{Customization}\label{sec:experimental-customization}
2688
2689 The output of the environment and of the NMR commands can be customized be a
2690 number of options.
2691 \begin{options}
2692 \keyval{unit}{unit}\Module{spectroscopy}\Initial{\cs*{mega}\cs*{hertz}}
2693 The used default unit.
2694 \keychoice{nucleus}{\Marg{\meta{num},\meta{atom}}}\Module{spectroscopy}\Initial{\Marg{1,H}}
2695 The used default nucleus.
2696 \keyval{connector}{code}\Module{spectroscopy}\Initial{-}
2697 Places \meta{code} between the nucleus and the method.
2698 \keyval{method}{code}\Module{spectroscopy}\Initial{NMR}
2699 The measuring method.
2700 \keyval{format}{commands}\Module{spectroscopy}\Initial
2701 For example \cs*{bfseries}.
2702 \keyval{nmr-base-format}{commands}\Module{spectroscopy}\Initial
2703 \sinceversion{5.8}Formatting instructions for the NMR base.
2704 \keychoice{pos-number}{side,sub,super}\Module{spectroscopy}\Initial{side}
2705 Position of the number next to the atom.
2706 \keyval{coupling-symbol}{code}\Module{spectroscopy}\Initial{J}
2707 The symbol used for the coupling constant.
2708 \keyval{coupling-unit}{unit}\Module{spectroscopy}\Initial{\cs*{hertz}}
2709 A \pkg{siunitx} unit.
2710 \keychoice{coupling-pos}{side,sub}\Module{spectroscopy}\Initial{side}
2711 Placement of the coupling nuclei next to the symbol $J$ (or rather the
2712 symbol specified with option \option{coupling-symbol}).
2713 \keyval{coupling-nuclei-pre}{code}\Module{spectroscopy}\Initial{(}
2714 Code inserted before the coupling nuclei when \keyis{coupling-pos}{side}.
2715 \keyval{coupling-nuclei-post}{code}\Module{spectroscopy}\Initial{)}
2716 Code inserted after the coupling nuclei when \keyis{coupling-pos}{side}.
2717 \keyval{coupling-bonds-pre}{code}\Module{spectroscopy}\Initial
2718 Code inserted before the coupling bonds.
2719 \keyval{coupling-bonds-post}{code}\Module{spectroscopy}\Initial{\cs*{!}}
2720 Code inserted after the coupling bonds.
2721 \keyval{coupling-pos-cs}{cs}\Module{spectroscopy}\Initial{\cs*{@firstofone}}
2722 Set the macro that prints the number set with the \cs{pos} macro. This
2723 needs to be a command with one mandatory argument.
2724 \keyval{atom-number-cs}{cs}\Module{spectroscopy}\Initial{\cs*{@firstofone}}
2725 Set the macro that prints the number set with the \cs{\#} macro. This
2726 needs to be a command with one mandatory argument.
2727 \keyval{atom-number-space}{dim}\Module{spectroscopy}\Initial{.16667em}
2728 Horizontal\sinceversion{5.3} space inserted between number and atom
2729 (printed by \cs{\#}).
2730 \keybool{parse}\Module{spectroscopy}\Initial{true}
2731 Treat the solvent as \chemformula\ formula (this depends on the setting of
2732 the \option{formula} option, see~\vref{sec:formula-module}) or not.
2733 \keyval{delta}{tokens}\Module{spectroscopy}\Initial
2734 The \meta{tokens} are added after $\delta$.
2735 \keybool{list}\Module{spectroscopy}\Initial{false}
2736 The environment \env{experimental} is formatted as a list
2737 \keyval{list-setup}{setup}\Module{spectroscopy}
2738 Setup of the list. See below for the default settings.
2739 \keybool{use-equal}\Module{spectroscopy}\Initial{false}
2740 Add equal sign after \cs{NMR} and \cs{data}.
2741 \end{options}
2742
2743 The default setup of the list:
2744 \begin{sourcecode}
2745 \topsep\z@skip \partopsep\z@skip
2746 \itemsep\z@ \parsep\z@ \itemindent\z@
2747 \leftmargin\z@
2748 \end{sourcecode}
2749
2750 \begin{example}
2751 \begin{experimental}[format=\bfseries]
2752 \data{type1} Data.
2753 \data{type2}[specifications] More data.
2754 \data*{type3} Even more data.
2755 \end{experimental}
2756 \end{example}
2757
2758 The command \cs{NMR} and all commands defined through \cs{NewChemNMR}
2759 can be used like \cs{data} for the NMR data.
2760
2761 \begin{example}
2762 \begin{experimental}[format=\bfseries,use-equal]
2763 \data{type1} Data.
2764 \data{type2}[specifications] More data.
2765 \NMR Even more data.
2766 \end{experimental}
2767 \end{example}
2768
2769 \subsection{An Example}
2770 The code below is shown with different specifications for \meta{options}.
2771 Of course options can also be chosen with \cs{chemsetup}.
2772
2773 \begin{sourcecode}
2774 \sisetup{separate-uncertainty,per-mode=symbol,detect-all,range-phrase=--}
2775 \begin{experimental}[<options>]
2776 \data*{yield} \qty{17}{\milli\gram} yellow needles (\qty{0.04}{\milli\mole},
2777 \qty{13}{\percent}).
2778 %
2779 \data{mp.} \qty{277}{\celsius} (DSC).
2780 %
2781 \NMR(600)[CDCl3] \val{2.01} (s, \#{24}, \pos{5}), \val{2.31} (s, \#{12},
2782 \pos{1}), \val{6.72--6.74} (m, \#{2}, \pos{11}), \val{6.82} (s, \#{8},
2783 \pos{3}), \val{7.05--7.07} (m, \#{2}, \pos{12}), \val{7.39--7.41} (m, \#{4},
2784 \pos{9}), \val{7.48--7.49} (m, \#{4}, \pos{8}).
2785 %
2786 \NMR{13,C}(150)[CDCl3] \val{21.2} ($+$, \#{4}, \pos{1}), \val{23.4} ($+$,
2787 \#{8}, \pos{5}), \val{126.0} ($+$, \#{4}, \pos{9}), \val{128.2} ($+$, \#{8},
2788 \pos{3}), \val{130.8} ($+$, \#{2}, \pos{12}), \val{133.6} ($+$, \#{2},
2789 \pos{11}), \val{137.0} ($+$, \#{4}, \pos{8}), \val{138.6} (q, \#{4},
2790 \pos{2}), \val{140.6} (q, \#{2}, \pos{10}), \val{140.8} (q, \#{8}, \pos{4}),
2791 \val{141.8} (q, \#{4}, \pos{6}), \val{145.6} (q, \#{2}, \pos{7}).
2792 %
2793 \data{MS}[DCP, EI, \qty{60}{\electronvolt}] \val{703} (2, \ch{M+}), \val{582}
2794 (1), \val{462} (1), \val{249} (13), \val{120} (41), \val{105} (100).
2795 %
2796 \data{MS}[\ch{MeOH + H2O + KI}, ESI, \qty{10}{\electronvolt}] \val{720} (100,
2797 \ch{M+ + OH-}), \val{368} (\ch{M+ + 2 OH-}).
2798 %
2799 \data{IR}[KBr] \val{3443} (w), \val{3061} (w), \val{2957} (m), \val{2918}
2800 (m), \val{2856} (w), \val{2729} (w), \val{1725} (w), \val{1606} (s),
2801 \val{1592} (s), \val{1545} (w), \val{1446} (m), \val{1421} (m), \val{1402}
2802 (m), \val{1357} (w), \val{1278} (w), \val{1238} (s), \val{1214} (s),
2803 \val{1172} (s), \val{1154} (m), \val{1101} (w), \val{1030} (w), \val{979}
2804 (m), \val{874} (m), \val{846} (s), \val{818} (w), \val{798} (m), \val{744}
2805 (w), \val{724} (m), \val{663} (w), \val{586} (w), \val{562} (w), \val{515}
2806 (w).
2807 %
2808 \data*{UV-Vis} \qty{386}{\nano\metre} ($\varepsilon = \val{65984}$),
2809 \qty{406}{\nano\metre} ($\varepsilon = \val{65378}$).
2810 %
2811 \data*{quantum yield} $\Phi = \val{0.74+-0.1}$\,.
2812 \end{experimental}
2813 \end{sourcecode}
2814
2815 \subsection{Nearly Standard}
2816 Output with these options:
2817
2818 \begin{sourcecode}
2819 delta=(ppm),pos-number=sub,use-equal
2820 \end{sourcecode}
2821
2822 \begin{experimental}[delta=(ppm),pos-number=sub,use-equal]
2823 \sisetup{separate-uncertainty,per-mode=symbol,detect-all,range-phrase=--}
2824 \data*{yield} \qty{17}{\milli\gram} yellow needles (\qty{0.04}{\milli\mole},
2825 \qty{13}{\percent}).
2826 %
2827 \data{mp.} \qty{277}{\celsius} (DSC).
2828 %
2829 \NMR(600)[CDCl3] \val{2.01} (s, \#{24}, \pos{5}), \val{2.31} (s, \#{12},
2830 \pos{1}), \val{6.72--6.74} (m, \#{2}, \pos{11}), \val{6.82} (s, \#{8},
2831 \pos{3}), \val{7.05--7.07} (m, \#{2}, \pos{12}), \val{7.39--7.41} (m, \#{4},
2832 \pos{9}), \val{7.48--7.49} (m, \#{4}, \pos{8}).
2833 %
2834 \NMR{13,C}(150)[CDCl3] \val{21.2} ($+$, \#{4}, \pos{1}), \val{23.4} ($+$,
2835 \#{8}, \pos{5}), \val{126.0} ($+$, \#{4}, \pos{9}), \val{128.2} ($+$, \#{8},
2836 \pos{3}), \val{130.8} ($+$, \#{2}, \pos{12}), \val{133.6} ($+$, \#{2},
2837 \pos{11}), \val{137.0} ($+$, \#{4}, \pos{8}), \val{138.6} (q, \#{4},
2838 \pos{2}), \val{140.6} (q, \#{2}, \pos{10}), \val{140.8} (q, \#{8}, \pos{4}),
2839 \val{141.8} (q, \#{4}, \pos{6}), \val{145.6} (q, \#{2}, \pos{7}).
2840 %
2841 \data{MS}[DCP, EI, \qty{60}{\electronvolt}] \val{703} (2, \ch{M+}), \val{582}
2842 (1), \val{462} (1), \val{249} (13), \val{120} (41), \val{105} (100).
2843 %
2844 \data{MS}[\ch{MeOH + H2O + KI}, ESI, \qty{10}{\electronvolt}] \val{720} (100,
2845 \ch{M+ + OH-}), \val{368} (\ch{M+ + 2 OH-}).
2846 %
2847 \data{IR}[KBr] \val{3443} (w), \val{3061} (w), \val{2957} (m), \val{2918}
2848 (m), \val{2856} (w), \val{2729} (w), \val{1725} (w), \val{1606} (s),
2849 \val{1592} (s), \val{1545} (w), \val{1446} (m), \val{1421} (m), \val{1402}
2850 (m), \val{1357} (w), \val{1278} (w), \val{1238} (s), \val{1214} (s),
2851 \val{1172} (s), \val{1154} (m), \val{1101} (w), \val{1030} (w), \val{979}
2852 (m), \val{874} (m), \val{846} (s), \val{818} (w), \val{798} (m), \val{744}
2853 (w), \val{724} (m), \val{663} (w), \val{586} (w), \val{562} (w), \val{515}
2854 (w).
2855 %
2856 \data*{UV-Vis} \qty{386}{\nano\metre} ($\varepsilon = \val{65984}$),
2857 \qty{406}{\nano\metre} ($\varepsilon = \val{65378}$).
2858 %
2859 \data*{quantum yield} $\Phi = \val{0.74+-0.1}$\,.
2860 \end{experimental}
2861
2862 \subsection{Formatted List}
2863 Output with these options:
2864
2865 \begin{sourcecode}
2866 format=\bfseries,delta=(ppm),list=true,use-equal
2867 \end{sourcecode}
2868
2869 \begin{experimental}[format=\bfseries,delta=(ppm),list=true,use-equal]
2870 \sisetup{separate-uncertainty,per-mode=symbol,detect-all,range-phrase=--}
2871 \data*{yield} \qty{17}{\milli\gram} yellow needles (\qty{0.04}{\milli\mole},
2872 \qty{13}{\percent}).
2873 %
2874 \data{mp.} \qty{277}{\celsius} (DSC).
2875 %
2876 \NMR(600)[CDCl3] \val{2.01} (s, \#{24}, \pos{5}), \val{2.31} (s, \#{12},
2877 \pos{1}), \val{6.72--6.74} (m, \#{2}, \pos{11}), \val{6.82} (s, \#{8},
2878 \pos{3}), \val{7.05--7.07} (m, \#{2}, \pos{12}), \val{7.39--7.41} (m, \#{4},
2879 \pos{9}), \val{7.48--7.49} (m, \#{4}, \pos{8}).
2880 %
2881 \NMR{13,C}(150)[CDCl3] \val{21.2} ($+$, \#{4}, \pos{1}), \val{23.4} ($+$,
2882 \#{8}, \pos{5}), \val{126.0} ($+$, \#{4}, \pos{9}), \val{128.2} ($+$, \#{8},
2883 \pos{3}), \val{130.8} ($+$, \#{2}, \pos{12}), \val{133.6} ($+$, \#{2},
2884 \pos{11}), \val{137.0} ($+$, \#{4}, \pos{8}), \val{138.6} (q, \#{4},
2885 \pos{2}), \val{140.6} (q, \#{2}, \pos{10}), \val{140.8} (q, \#{8}, \pos{4}),
2886 \val{141.8} (q, \#{4}, \pos{6}), \val{145.6} (q, \#{2}, \pos{7}).
2887 %
2888 \data{MS}[DCP, EI, \qty{60}{\electronvolt}] \val{703} (2, \ch{M+}), \val{582}
2889 (1), \val{462} (1), \val{249} (13), \val{120} (41), \val{105} (100).
2890 %
2891 \data{MS}[\ch{MeOH + H2O + KI}, ESI, \qty{10}{\electronvolt}] \val{720} (100,
2892 \ch{M+ + OH-}), \val{368} (\ch{M+ + 2 OH-}).
2893 %
2894 \data{IR}[KBr] \val{3443} (w), \val{3061} (w), \val{2957} (m), \val{2918}
2895 (m), \val{2856} (w), \val{2729} (w), \val{1725} (w), \val{1606} (s),
2896 \val{1592} (s), \val{1545} (w), \val{1446} (m), \val{1421} (m), \val{1402}
2897 (m), \val{1357} (w), \val{1278} (w), \val{1238} (s), \val{1214} (s),
2898 \val{1172} (s), \val{1154} (m), \val{1101} (w), \val{1030} (w), \val{979}
2899 (m), \val{874} (m), \val{846} (s), \val{818} (w), \val{798} (m), \val{744}
2900 (w), \val{724} (m), \val{663} (w), \val{586} (w), \val{562} (w), \val{515}
2901 (w).
2902 %
2903 \data*{UV-Vis} \qty{386}{\nano\metre} ($\varepsilon = \val{65984}$),
2904 \qty{406}{\nano\metre} ($\varepsilon = \val{65378}$).
2905 %
2906 \data*{quantum yield} $\Phi = \val{0.74+-0.1}$\,.
2907 \end{experimental}
2908
2909 \subsection{Crazy}
2910 Output for these options:
2911
2912 \begin{sourcecode}
2913 format=\color{red}\itshape,
2914 list=true,
2915 delta=\textcolor{green}{\ch{M+ + H2O}},
2916 pos-number=side,
2917 coupling-unit=\mega\gram\per\square\second,
2918 list-setup=,
2919 use-equal
2920 \end{sourcecode}
2921
2922 \begin{experimental}[
2923 format=\color{red}\itshape,
2924 list=true,
2925 delta=\textcolor{green}{\ch{M+ + H2O}},
2926 pos-number=side,
2927 coupling-unit=\mega\gram\per\square\second,
2928 list-setup=,use-equal]
2929 \sisetup{separate-uncertainty,per-mode=symbol,detect-all,range-phrase=--}
2930 \data*{yield} \qty{17}{\milli\gram} yellow needles (\qty{0.04}{\milli\mole},
2931 \qty{13}{\percent}).
2932 %
2933 \data{mp.} \qty{277}{\celsius} (DSC).
2934 %
2935 \NMR(600)[CDCl3] \val{2.01} (s, \#{24}, \pos{5}), \val{2.31} (s, \#{12},
2936 \pos{1}), \val{6.72--6.74} (m, \#{2}, \pos{11}), \val{6.82} (s, \#{8},
2937 \pos{3}), \val{7.05--7.07} (m, \#{2}, \pos{12}), \val{7.39--7.41} (m, \#{4},
2938 \pos{9}), \val{7.48--7.49} (m, \#{4}, \pos{8}).
2939 %
2940 \NMR{13,C}(150)[CDCl3] \val{21.2} ($+$, \#{4}, \pos{1}), \val{23.4} ($+$,
2941 \#{8}, \pos{5}), \val{126.0} ($+$, \#{4}, \pos{9}), \val{128.2} ($+$, \#{8},
2942 \pos{3}), \val{130.8} ($+$, \#{2}, \pos{12}), \val{133.6} ($+$, \#{2},
2943 \pos{11}), \val{137.0} ($+$, \#{4}, \pos{8}), \val{138.6} (q, \#{4},
2944 \pos{2}), \val{140.6} (q, \#{2}, \pos{10}), \val{140.8} (q, \#{8}, \pos{4}),
2945 \val{141.8} (q, \#{4}, \pos{6}), \val{145.6} (q, \#{2}, \pos{7}).
2946 %
2947 \data{MS}[DCP, EI, \qty{60}{\electronvolt}] \val{703} (2, \ch{M+}), \val{582}
2948 (1), \val{462} (1), \val{249} (13), \val{120} (41), \val{105} (100).
2949 %
2950 \data{MS}[\ch{MeOH + H2O + KI}, ESI, \qty{10}{\electronvolt}] \val{720} (100,
2951 \ch{M+ + OH-}), \val{368} (\ch{M+ + 2 OH-}).
2952 %
2953 \data{IR}[KBr] \val{3443} (w), \val{3061} (w), \val{2957} (m), \val{2918}
2954 (m), \val{2856} (w), \val{2729} (w), \val{1725} (w), \val{1606} (s),
2955 \val{1592} (s), \val{1545} (w), \val{1446} (m), \val{1421} (m), \val{1402}
2956 (m), \val{1357} (w), \val{1278} (w), \val{1238} (s), \val{1214} (s),
2957 \val{1172} (s), \val{1154} (m), \val{1101} (w), \val{1030} (w), \val{979}
2958 (m), \val{874} (m), \val{846} (s), \val{818} (w), \val{798} (m), \val{744}
2959 (w), \val{724} (m), \val{663} (w), \val{586} (w), \val{562} (w), \val{515}
2960 (w).
2961 %
2962 \data*{UV-Vis} \qty{386}{\nano\metre} ($\varepsilon = \val{65984}$),
2963 \qty{406}{\nano\metre} ($\varepsilon = \val{65378}$).
2964 %
2965 \data*{quantum yield} $\Phi = \val{0.74+-0.1}$\,.
2966 \end{experimental}
2967
2968 \section{The \chemmodule*{thermodynamics} Module}\label{sec:thermodynamics-module}
2969
2970 The \chemmodule{thermodynamics} module loads the \pkg{siunitx}
2971 package~\cite{pkg:siunitx}.
2972
2973 \subsection{The \cs*{state} Macro}
2974
2975 \begin{commands}
2976 \command{state}[\oarg{options}\marg{symbol}]
2977 Typeset a state variable.
2978 \end{commands}
2979
2980 This macro can be used to write the thermodynamic state variables.
2981 \begin{example}
2982 \state{A}, \state_f{G} ,
2983 \state{E}_{\ch{Na}},
2984 \state{H}^{\qty{1000}{\celsius}}
2985 \end{example}
2986
2987 These options are available:
2988 \begin{options}
2989 \keyval{pre}{text}\Module{thermodynamics}\Initial{\cs{changestate}}
2990 Code inserted before the variable. Inserted in text mode.
2991 \keyval{post}{text}\Module{thermodynamics}\Initial
2992 Code inserted after the variable. Inserted in text mode.
2993 \keyval{superscript-left}{text}\Module{thermodynamics}\Initial
2994 The left superscript. Inserted in text mode.
2995 \keyval{superscript-right}{text}\Module{thermodynamics}\Initial{\cs{standardstate}}
2996 The right superscript. Inserted in text mode.
2997 \keyval{superscript}{text}\Module{thermodynamics}
2998 An alias of \option{superscript-right}.
2999 \keyval{subscript-left}{text}\Module{thermodynamics}\Initial
3000 The left subscript. Inserted in text mode.
3001 \keyval{subscript-right}{text}\Module{thermodynamics}\Initial
3002 The right subscript. Inserted in text mode.
3003 \keyval{subscript}{text}\Module{thermodynamics}
3004 An alias of \option{subscript-left}.
3005 \end{options}
3006
3007 Since version~6.1\sinceversion{6.1} you can input the sub- and superscripts in
3008 a more intuitive way instead of using the options -- the latter are still
3009 available, though:
3010 \begin{example}
3011 \state_a^b{X}_c^d
3012 \end{example}
3013
3014 \subsection{Thermodynamic Variables}
3015
3016 The \chemmodule{thermodynamics} module provides a few commands for specific
3017 thermodynamic variables:
3018 \begin{commands}
3019 \command{enthalpy}[\sarg\oarg{options}\darg{subscript}\marg{value}]
3020 Typeset the amount of enthalpy.
3021 \command{entropy}[\sarg\oarg{options}\darg{subscript}\marg{value}]
3022 Typeset the amount of entropy.
3023 \command{gibbs}[\sarg\oarg{options}\darg{subscript}\marg{value}]
3024 Typeset the amount of Gibbs enthalpy.
3025 \end{commands}
3026
3027 Their usage is pretty much self-explaining:
3028 \begin{example}[side-by-side]
3029 \enthalpy{123} \par
3030 \entropy{123} \par
3031 \gibbs{123}
3032 \end{example}
3033 The argument \darg{subscript} adds a subscript for specification, \sarg\ hides
3034 number and unit:
3035 \begin{example}[side-by-side]
3036 \enthalpy(r){123} \par
3037 \enthalpy*{123} \par
3038 \end{example}
3039
3040 \begin{options}
3041 \keyval{pre}{text}\Module{thermodynamics}\Initial{\cs{changestate}}
3042 Code inserted before the variable. Inserted in text mode.
3043 \keyval{post}{text}\Module{thermodynamics}\Initial
3044 Code inserted after the variable. Inserted in text mode.
3045 \keyval{superscript-left}{text}\Module{thermodynamics}\Initial
3046 The left superscript. Inserted in text mode.
3047 \keyval{superscript-right}{text}\Module{thermodynamics}\Initial{\cs{standardstate}}
3048 The right superscript. Inserted in text mode.
3049 \keyval{superscript}{text}\Module{thermodynamics}
3050 An alias of \option{superscript-right}.
3051 \keyval{subscript-left}{text}\Module{thermodynamics}\Initial
3052 The left subscript. Inserted in text mode.
3053 \keyval{subscript-right}{text}\Module{thermodynamics}\Initial
3054 The right subscript. Inserted in text mode.
3055 \keyval{subscript}{text}\Module{thermodynamics}
3056 An alias of \option{subscript-left}.
3057 \keychoice{subscript-pos}{left,right}\Module{thermodynamics}\Initial{left}
3058 Determines whether the subscript given in \darg{subscript} is placed to the
3059 left or the right of the variable.
3060 \keyval{symbol}{symbol}\Module{thermodynamics}\Initial
3061 The symbol of the variable. Inserted in math mode.
3062 \keyval{unit}{unit}\Module{thermodynamics}\Initial
3063 A valid \pkg{siunitx} unit.
3064 \end{options}
3065
3066 The default values depend on the command.
3067 \begin{example}[side-by-side]
3068 \enthalpy[unit=\kilo\joule]{-285} \par
3069 \gibbs[pre=]{0} \par
3070 \entropy[pre=$\Delta$,superscript=]{56.7}
3071 \end{example}
3072 The unit is set corresponding to the rules of \pkg{siunitx} and depends on
3073 its settings:
3074 \begin{example}[side-by-side]
3075 \enthalpy{-1234.56e3} \par
3076 \sisetup{
3077 per-mode=symbol,
3078 exponent-product=\cdot,
3079 output-decimal-marker={,},
3080 group-four-digits=true
3081 }
3082 \enthalpy{-1234.56e3}
3083 \end{example}
3084
3085 \subsection{Create New Variables or Redefine Existing Ones}
3086
3087 \begin{commands}
3088 \command{NewChemState}[\marg{cs}\marg{options}]
3089 Define new state commands like \cs{enthalpy}. Gives an error is \meta{cs}
3090 already exists.
3091 \command{RenewChemState}[\marg{cs}\marg{options}]
3092 Redefine existing state commands.
3093 \command{DeclareChemState}[\marg{cs}\marg{options}]
3094 Like \cs{NewChemState} but gives now error if \meta{cs} already exists.
3095 \command{ProvideChemState}[\marg{cs}\marg{options}]
3096 Define new state commands like \cs{enthalpy}. Defines \meta{cs} only if
3097 it is not defined, yet.
3098 \end{commands}
3099 The argument \meta{options} is a comma separated list of key/value options:
3100 \begin{options}
3101 \keyval{pre}{text}\Module{thermodynamics}\Initial{\cs{changestate}}
3102 Code inserted before the variable. Inserted in text mode.
3103 \keyval{post}{text}\Module{thermodynamics}\Initial
3104 Code inserted after the variable. Inserted in text mode.
3105 \keyval{superscript-left}{text}\Module{thermodynamics}\Initial
3106 The left superscript. Inserted in text mode.
3107 \keyval{superscript-right}{text}\Module{thermodynamics}\Initial{\cs{standardstate}}
3108 The right superscript.
3109 \keyval{superscript}{text}\Module{thermodynamics}
3110 An alias of \option{superscript-right}.
3111 \keyval{subscript-left}{text}\Module{thermodynamics}\Initial
3112 The left subscript. Inserted in text mode.
3113 \keyval{subscript-right}{text}\Module{thermodynamics}\Initial
3114 The right subscript. Inserted in text mode.
3115 \keyval{subscript}{text}\Module{thermodynamics}
3116 An alias of \option{subscript-left}.
3117 \keychoice{subscript-pos}{left,right}\Module{thermodynamics}\Initial{left}
3118 Determines whether the subscript given in \darg{subscript} is placed to the
3119 left or the right of the variable.
3120 \keyval{symbol}{symbol}\Module{thermodynamics}\Initial
3121 The symbol of the variable.
3122 \keyval{unit}{unit}\Module{thermodynamics}\Initial
3123 A valid \pkg{siunitx} unit.
3124 \end{options}
3125
3126 \begin{example}
3127 \NewChemState\Helmholtz{ symbol=A , unit=\kilo\joule\per\mole }
3128 \NewChemState\ElPot{ symbol=E , subscript-pos=right , superscript= , unit=\volt }
3129 \Helmholtz{123.4} \par
3130 \ElPot{-1.1} \par
3131 \ElPot[superscript=0]($\ch{Sn}|\ch{Sn^2+}||\ch{Pb^2+}|\ch{Pb}$){0.01} \par
3132 \RenewChemState\enthalpy{ symbol=h , unit=\joule} \par
3133 \enthalpy(f){12.5}
3134 \end{example}
3135
3136 The existing commands have been defined like this:
3137 \begin{sourcecode}
3138 \NewChemState \enthalpy{ symbol = H, unit = \kilo\joule\per\mole }
3139 \NewChemState \entropy { symbol = S, unit = \joule\per\kelvin\per\mole, pre = }
3140 \NewChemState \gibbs { symbol = G, unit = \kilo\joule\per\mole }
3141 \end{sourcecode}
3142
3143 So -- for following thermodynamic conventions -- one could define a molar and
3144 an absolute variable:
3145 \begin{example}
3146 \RenewChemState\enthalpy{symbol=h,superscript=,unit=\kilo\joule\per\mole}% molar
3147 \NewChemState\Enthalpy{symbol=H,superscript=,unit=\kilo\joule}% absolute
3148 \enthalpy{-12.3} \Enthalpy{-12.3}
3149 \end{example}
3150
3151 \section{The \chemmodule*{units} Module}\label{sec:units-module}
3152
3153 The \chemmodule{units} module loads the \pkg{siunitx}
3154 package~\cite{pkg:siunitx}.
3155
3156 In chemistry some non-SI units are very common. \pkg{siunitx} provides the
3157 command
3158 \begin{commands}
3159 \command*{DeclareSIUnit}[\marg{cs}\marg{unit}]
3160 Define \meta{cs} to be a valid unit command inside \pkg{siunitx}' macros
3161 \cs*{qty} and \cs*{unit} which represents \meta{unit}.
3162 \end{commands}
3163 to add arbitrary units. \chemmacros\ uses that command to provide some
3164 units. Like all \pkg{siunitx} units they're only valid inside
3165 \cs*{qty}\marg{num}\marg{unit} and \cs*{unit}\marg{unit}.
3166 \begin{commands}
3167 \command{atmosphere} \unit{\atmosphere}
3168 \command{atm} \unit{\atm}
3169 \command{calory} \unit{\calory}
3170 \command{cal} \unit{\cal}
3171 \command{cmc} \unit{\cmc} \par
3172 The units \cs{cmc}, \cs{molar}, and \cs{Molar} are defined by the
3173 package \pkg{chemstyle} as well. \chemmacros\ only defines them, if
3174 \pkg{chemstyle} is not loaded.
3175 \command{molar} \unit{\molar}
3176 \command{moLar} \unit{\moLar}
3177 \command{Molar} \unit{\Molar}
3178 \command{MolMass} \unit{\MolMass}
3179 \command{normal} \unit{\normal}
3180 \command{torr} \unit{\torr}\par
3181 %%%
3182 \sinceversion{6.0}Since some units still frequently used in chemistry were
3183 removed from version 3 of \pkg{siunitx} \chemmacros\ also defines these in
3184 the same way, older versions of \pkg{siunitx} used to do. These units are:
3185 \command{angstrom} \unit{\angstrom}
3186 \command{atomicmassunit} \unit{\atomicmassunit}
3187 \command{bar} \unit{\bar}
3188 \command{elementarycharge} \unit{\elementarycharge}
3189 \command{mmHg} \unit{\mmHg}
3190 \end{commands}
3191
3192
3193 \part{Core Modules}\label{part:core-modules}
3194 The modules described in this part are always loaded and mainly concern module
3195 writers.
3196
3197 \section{The \chemmodule*{base} Module}\label{sec:base-module}
3198
3199 The \chemmodule{base} module is the core module of \chemmacros. It defines
3200 some tools which can (and should) be used in other modules. This means this
3201 section is only interesting for you if you plan to write a module yourself
3202 (see section~\vref{sec:own-modules} for details).
3203
3204 This module requires the packages \pkg{bm}~\cite{pkg:bm},
3205 \pkg{amstext}~\cite{pkg:amstext}, and \pkg{etoolbox}~\cite{pkg:etoolbox}.
3206
3207 This module also provides \cs{chemsetup} and the option \option{modules}.
3208
3209 It also provides a number of (expl3) macros which may be used in other
3210 modules. In the macro descriptions below \TF\ denotes that a \code{T}, an
3211 \code{F} and a \code{TF} variant exist. In case of an expandable conditional
3212 (\expandablesymbol) also the predicate variant is available.
3213 \begin{commands}
3214 \expandable\explcommand{chemmacros_if_loaded:nn}[\TF\
3215 \Marg{package|class} \marg{name} \marg{true} \marg{false}]
3216 Checks if package (or class) \meta{name} has been loaded. Also works after
3217 begin document.
3218 \expandable\explcommand{chemmacros_if_package_loaded:n}[\TF\ \marg{name}
3219 \marg{true} \marg{false}]
3220 Checks if package \meta{name} has been loaded. Also works after begin
3221 document.
3222 \expandable\explcommand{chemmacros_if_class_loaded:n}[\TF\ \marg{name}
3223 \marg{true} \marg{false}]
3224 Checks if class \meta{name} has been loaded. Also works after begin
3225 document.
3226 \explcommand{chemmacros_nobreak:}
3227 Inserts a penalty of \num{10000}.
3228 \explcommand{chemmacros_allow_break:}
3229 Inserts a penalty of \num{0}.
3230 \explcommand{chemmacros_skip_nobreak:N}[ \meta{skip/length variable}]
3231 Inserts a horizontal skip where a linebreak is disallowed.
3232 \expandable\explcommand{chemmacros_if_is_int:n}[\TF\ \marg{input} \marg{true}
3233 \marg{false}]
3234 Checks if \meta{input} is an integer or something else.
3235 \explcommand{chemmacros_if_bold:}[\TF\ \marg{true} \marg{false}]
3236 Checks if the current font weight is one of \chemboldchecks{or}.
3237 \explcommand{chemmacros_bold:n}[ \marg{text}]
3238 Checks if the current font weight is bold and if yes places \meta{text} in
3239 \cs*{textbf} if in text mode or in \cs*{bm} if in math mode. If no,
3240 \meta{text} simply is placed in the input stream as is.
3241 \explcommand{chemmacros_text:n}[ \marg{text}]
3242 Ensures that \meta{text} is placed in text mode.
3243 \explcommand{chemmacros_math:n}[ \marg{text}]
3244 Ensures that \meta{text} is placed in math mode.
3245 \explcommand{chemmacros_new_macroset:nnn}[ \marg{name} \marg{arg spec}
3246 \marg{internal command call}]
3247 \changedversion{5.3b}A command to define a set of macros
3248 \cs*{NewChem\meta{name}}, \cs*{RenewChem\meta{name}},
3249 \cs*{DeclareChem\meta{name}} and \cs*{ProvideChem\meta{name}} where the
3250 first letter of \meta{name} is converted to uppercase, other letters are
3251 kept unchanged. \meta{arg spec} is any valid argument specification for
3252 \pkg{xparse}'s \\
3253 \cs{DeclareDocumentCommand}~\cite{bnd:l3packages}. \meta{internal command
3254 call} should be a macro which makes definitions \emph{without} error
3255 checks, \ie, define new macros or redefine existing ones like \cs*{def}
3256 does. This macro just should get the arguments passed on to. Have a look
3257 at the example below.
3258 \explcommand{chemmacros_new_environment_macroset:nnn}[ \marg{name} \marg{arg spec}
3259 \marg{internal command call}]
3260 Like \explcs{chemmacros_new_macroset:nnn} but for environments.
3261 \command{NewChemMacroset}[\sarg\marg{name}\marg{arg spec}\marg{internal
3262 command call}]
3263 A non-expl3 version of \explcs{chemmacros_new_macroset:nnn} for \LaTeXe\
3264 programmers. The starred version calls
3265 \explcs{chemmacros_new_environment_macroset:nnn}.
3266 \explcommand{chemmacros_add_cleveref_support:nnnnn}[ \marg{counter}
3267 \marg{singular} \marg{plural} \marg{uppercase singular} \marg{uppercase
3268 plural}]
3269 A\sinceversion{5.6} command to add suiting names for a counter for the
3270 \pkg{cleveref} package's \cs*{cref} commands. This command acts at the
3271 end of the preamble and only if a user hasn't provided definitions with
3272 \cs*{crefname} already.
3273 \command{ChemCleverefSupport}[\marg{counter}\marg{singular}\oarg{uppercase
3274 singular}\marg{plural}\oarg{uppercase plural}]
3275 \sinceversion{5.6}\LaTeXe-version of
3276 \explcs{chemmacros_add_cleveref_support:nnnnn}.
3277 \explcommand{chemmacros_add_fancyref_support:nnn}[ \marg{prefix} \marg{name}
3278 \marg{uppercase name}]
3279 A\sinceversion{5.6} command to add suiting names for a counter for the
3280 \pkg{fancyref} package's \cs*{fref} commands. This command acts at the
3281 end of the preamble and doesn't override definitions made by the users.
3282 \command{ChemFancyrefSupport}[\marg{prefix}\marg{name}\oarg{uppercase name}]
3283 \sinceversion{5.6}\LaTeXe-version of
3284 \explcs{chemmacros_add_fancyref_support:nnnnn}.
3285 \end{commands}
3286 This is how the macros \cs{NewChemParticle}, \cs{RenewChemParticle},
3287 \cs{DeclareChemParticle} and \cs{ProvideChemParticle} were defined:
3288 \begin{sourcecode}
3289 \NewChemMacroset {Particle} {mm}
3290 { \chemmacros_define_particle:Nn #1 {#2} }
3291 \end{sourcecode}
3292
3293 The following macros strictly speaking are not provided by the
3294 \chemmodule{base} module but this place fits best for their description.
3295 \begin{commands}
3296 \expandable\explcommand{chemmacros_module_if_exist:n}[\TF\ \marg{module}
3297 \marg{true} \marg{false}]
3298 Checks if a file with the correct name for a module \meta{module} can be
3299 found.
3300 \expandable\explcommand{chemmacros_module_if_loaded:n}[\TF\ \marg{module}
3301 \marg{true} \marg{false}]
3302 Checks if the module \meta{module} has already been loaded or not.
3303 \explcommand{chemmacros_module_load:n}[ \marg{module}]
3304 Loads module \meta{module} if it hasn't been loaded, yet. The module must
3305 exist as a separate file as described in section~\ref{sec:own-modules}.
3306 \explcommand{chemmacros_module_before:nn}[ \marg{module} \marg{code}]
3307 Saves\sinceversion{5.1} \meta{code} and inserts it right before
3308 \meta{module} is loaded. If \meta{module} is never loaded then
3309 \meta{code} is never inserted. If \meta{module} already is loaded when
3310 the command is used then \meta{code} also is never inserted.
3311 \explcommand{chemmacros_module_after:nn}[ \marg{module} \marg{code}]
3312 Saves\sinceversion{5.1} \meta{code} and inserts it right after
3313 \meta{module} is loaded. If \meta{module} is never loaded then
3314 \meta{code} is never inserted. If \meta{module} already is loaded when
3315 the command is used then \meta{code} is inserted immediately.
3316 \end{commands}
3317
3318 \section{The \chemmodule*{errorcheck} Module}\label{sec:errorcheck-module}
3319 The\sinceversion{5.2} \chemmodule{errorcheck} module provides some rudimentary
3320 support for giving users more meaningful messages when they use a command or
3321 environment provided by a module that they haven't loaded.
3322
3323 \section{The \chemmodule*{lang} and \chemmodule*{translations} Modules}\label{sec:lang-module}
3324
3325 The \chemmodule{lang} module provides language support for \chemmacros. It
3326 loads the package \pkg{translations}~\cite{pkg:translations}.
3327
3328 \subsection{Information For Users}\label{sec:information-users}
3329
3330 This module defines the following option:
3331 \begin{options}
3332 \keychoice{language}{auto,\meta{language}}\Initial{auto}
3333 If set to \code{auto} \chemmacros\ will detect the language used by
3334 \pkg{babel}~\cite{pkg:babel} or \pkg{polyglossia}~\cite{pkg:polyglossia}
3335 automatically, the fallback translation is English and will be used if no
3336 translation for the actual language is available. Any language known to
3337 the \pkg{translations} package is a valid value for \meta{language}.
3338 \end{options}
3339
3340 The language chosen via \option{language} is used for translation of certain
3341 strings in different places all over \chemmacros. They are mentioned in the
3342 places when the corresponding function of \chemmacros\ is explained.
3343
3344 Translation is done with the help of the \pkg{translations} package, available
3345 translation keys are listed in section~\vref{sec:avail-transl-keys}.
3346
3347 \subsection{Available Translation Keys}\label{sec:avail-transl-keys}
3348
3349 Table~\vref{tab:translation-keys} lists all predefined translations of the
3350 available keys. \emph{Some of the translations have changed in
3351 version~5.6\changedversion{5.6}.} All available translations are provided
3352 by the \chemmodule{translations} module.
3353 A translation key is a unique string\footnote{That is, a string
3354 using the definition for strings used for expl3, i.e., converted to a series
3355 of category code~12 characters..} of characters. Each key is used to
3356 identify a replacement text which depends on the current language or the
3357 language set through the \option{language} option. For each key at least the
3358 English fallback translation is provided, for most also the German translation
3359 is provided. For a few keys also other translations are provided. If you
3360 find that a translation for your language is missing you can provide it in the
3361 preamble:
3362 \begin{commands}
3363 \command{DeclareChemTranslation}[\marg{key}\marg{language}\marg{translation}]
3364 \sinceversion{5.6}A command which makes an abstraction from the
3365 \pkg{translations} package. It should be used in documents for adding
3366 missing translations that are needed. This command can only be used in
3367 the preamble.
3368 \command{DeclareChemTranslations}[\marg{key}\Marg{\meta{language} =
3369 \meta{translation}}]
3370 \sinceversion{5.6}A command rather meant for module writers but can be
3371 used by document authors as well, of course. It gets a csv list of
3372 key\slash value pairs of translations. This command can only be used in
3373 the preamble.
3374 \command{AddChemTranslation}[\marg{language}\marg{key}\marg{translation}]
3375 \sinceversion{6.2}Basically the same as \cs{DeclareChemTranslation} but
3376 with focus on the language instead of the key and thus has a different
3377 argument order. This command can only be used in the preamble.
3378 \command{AddChemTranslations}[\marg{language}\Marg{\meta{key} = \meta{translation}}]
3379 \sinceversion{6.2}Basically the same as \cs{DeclareChemTranslations} but
3380 with focus on the language instead of the key. It lets you define the
3381 translations of several keys for one language in one go. This command can
3382 only be used in the preamble.
3383 \end{commands}
3384 If you send me an email (see section~\vref{sec:sugg-bug-reports}) with the
3385 translations for your language I'll gladly add them to the next release of
3386 \chemmacros!
3387
3388 \emph{Please do not use \pkg{translations}' \cs{DeclareTranslation} for
3389 declaring translations.}
3390
3391 \ForAllChemTranslationsDo{
3392 \appto\chemtranslationtable{\texttt{#1} & #2 & \texttt{\detokenize{#3}} \\}
3393 }
3394
3395 \begin{longtable}{lll}
3396 \caption{Translation keys predefined by \chemmacros\ (except
3397 \code{phase-aqi}, \code{phase-cd} and \code{phase-lc} which were defined
3398 in this document).}
3399 \label{tab:translation-keys} \\
3400 \toprule
3401 \bfseries key & \bfseries language & \bfseries translation \\
3402 \midrule
3403 \endfirsthead
3404 \toprule
3405 \bfseries key & \bfseries language & \bfseries translation \\
3406 \midrule
3407 \endhead
3408 \bottomrule
3409 \endlastfoot
3410 \midrule
3411 & & \hfill\emph{continues} \\
3412 \endfoot
3413 \chemtranslationtable
3414 \end{longtable}
3415
3416 \subsection{Information For Module Writers}
3417
3418 In addition to the commands from section~\vref{sec:avail-transl-keys} the
3419 following macros are available:
3420 \begin{commands}
3421 \expandable\explcommand{chemmacros_translate:n}[ \marg{translation key}]
3422 Translates the given key to the language which is detected automatically
3423 or given by the user. Should be used in \chemmacros' macros instead of
3424 \pkg{translations}' \cs*{GetTranslation}.
3425 \explcommand{l_chemmacros_language_tl}
3426 A token list variable that holds the language which is used by
3427 \explcs{chemmacros_translate:n} for translation, \emph{after begin
3428 document}.
3429 \expandable\command{ChemTranslate}[\marg{translation key}]
3430 A version of \explcs{chemmacros_translate:n} for those who prefer
3431 traditional \LaTeXe\ programming over expl3.
3432 \explcommand{chemmacros_declare_translation:nnn}[ \marg{language} \marg{key}
3433 \marg{translation}]
3434 The expl3 version of \cs{DeclareChemTranslation}.
3435 \explcommand{chemmacros_declare_translations:nn}[ \marg{key} \Marg{\meta{language}
3436 = \meta{translation}}]
3437 The expl3 version of \cs{DeclareChemTranslations}.
3438 \end{commands}
3439
3440 \section{The \chemmodule*{tikz} Module}\label{sec:tikz-module}
3441
3442 The \chemmodule{tikz} module loads the \pkg{tikz} package~\cite{pkg:pgf} and
3443 the \TikZ\ library \code{calc}.
3444
3445 \subsection{For Users}
3446 The \chemmodule{tikz} module defines a few arrow tips:
3447 \begin{tikzcode}
3448 \arrowtip{el}
3449 An arrow tip: \verbcode+\tikz\draw[-el](0,0)--(1,0);+
3450 \tikz\draw[-el](0,0)--(1,0);
3451 \arrowtip{left el}
3452 An arrow tip: \verbcode+\tikz\draw[-left el](0,0)--(1,0);+
3453 \tikz\draw[-left el](0,0)--(1,0);
3454 \arrowtip{right el}
3455 An arrow tip: \verbcode+\tikz\draw[-right el](0,0)--(1,0);+
3456 \tikz\draw[-right el](0,0)--(1,0);
3457 \end{tikzcode}
3458
3459 The\sinceversion{5.3} \chemmodule{tikz} module also loads the libraries
3460 \code{calc} and \code{decorations.pathmorphing}. It uses those libraries for
3461 defining a new decoration \tikzdecoration{wave}.
3462 \begin{example}[side-by-side]
3463 \begin{tikzpicture}
3464 \draw[decorate,decoration=wave] (0,0) -- (2,0) ;
3465 \end{tikzpicture}
3466 \end{example}
3467
3468 \subsection{For Module Writers}
3469 The \chemmodule{tikz} module provides some macros for common \TikZ\
3470 functions. This allows to use expl3's powerful function variants for
3471 expansion control.
3472
3473 \begin{commands}
3474 \explcommand{c_chemmacros_other_colon_tl}
3475 A constant tokenlist which contains a colon with category code~12 (other).
3476 This is useful since \TikZ\ sometimes expects an other colon and in an
3477 expl3 programming environment \code{:} has category code~11 (letter).
3478 \explcommand{chemmacros_tikz_picture:nn}[ \marg{options} \marg{code}]
3479 Defined as \verbcode+\tikzpicture[{#1}] #2 \endtikzpicture+.
3480 \explcommand{chemmacros_tikz:nn}[ \marg{options} \marg{code}]
3481 Defined as \verbcode+\tikz[{#1}]{#2}+.
3482 \explcommand{chemmacros_tikz_draw:n}[ \marg{options}]
3483 Defined as \verbcode+\draw[{#1}]+.
3484 \explcommand{chemmacros_tikz_node:n}[ \marg{options}]
3485 Defined as \verbcode+\node[{#1}]+.
3486 \explcommand{chemmacros_tikz_shade:n}[ \marg{options}]
3487 Defined as \verbcode+\shade[{#1}]+.
3488 \explcommand{chemmacros_tikz_shadedraw:n}[ \marg{options}]
3489 Defined as \verbcode+\shadedraw[{#1}]+.
3490 \explcommand{chemmacros_tikz_node_in_draw:n}[ \marg{options}]
3491 Defined as \verbcode+node[{#1}]+.
3492 \end{commands}
3493
3494 \section{The \chemmodule*{xfrac} Module}\label{sec:xfrac-module}
3495
3496 The \chemmodule{xfrac} module loads the package
3497 \pkg{xfrac}~\cite{bnd:l3packages}. For the following explanations it will be
3498 helpful if you know about said package and how it works first. This module is
3499 a support module that defines the macro
3500 \begin{commands}
3501 \command{chemfrac}[\oarg{type}\marg{numerator}\marg{denominator}]
3502 \meta{type} can either be \code{text} or \code{superscript}.
3503 \end{commands}
3504 This macro calls a certain instance of the \pkg{xfrac} \code{text} template,
3505 depending on the option \meta{type} and the current font family. If used
3506 \cs{chemfrac} looks if an instance
3507 \begin{center}
3508 \code{chemmacros-frac-\cs*{f@family}-\meta{type}}
3509 \end{center}
3510 exists. If yes this instance is used, if no the instance
3511 \code{chemmacros-frac-default-\meta{type}} is used. The \code{default}
3512 instances are the same as the ones for \code{cmr}.
3513
3514 \begin{table}
3515 \centering
3516 \newcommand*\showfrac[1]{%
3517 \code{#1} &
3518 \fontfamily{#1}\selectfont
3519 \chemfrac[text]{2}{3} &
3520 \fontfamily{#1}\selectfont
3521 \chemfrac[superscript]{2}{3}%
3522 }
3523 \caption{Predefined \chemmodule{xfrac} \code{text} instances.}
3524 \label{tab:xfrac}
3525 \begin{tabular}{llcc}
3526 \toprule
3527 \bfseries font family & \bfseries text & \bfseries superscript \\
3528 \midrule
3529 \showfrac{cmr} \\
3530 \showfrac{lmr} \\
3531 \showfrac{LinuxLibertineT-TLF} \\
3532 \showfrac{LinuxLibertineT-TOsF} \\
3533 \bottomrule
3534 \end{tabular}
3535 \end{table}
3536
3537 The \chemmodule{xfrac} module defines instances some font families, they are
3538 listed and demonstrated in table~\vref{tab:xfrac}. The \code{superscript}
3539 type fractions \emph{look} larger than the \code{text} types. The reason is
3540 that the \code{superscript} types are typically used with a smaller font size.
3541 Let's take a look at an example where both instances are used:
3542 \begin{example}[side-by-side]
3543 \chemsetup[redox]{pos=top}
3544 \code{superscript}:
3545 \ch{"\ox{1/3,I}" {}3+}
3546
3547 \chemsetup[redox]{pos=side}
3548 \code{text}: \ox{1/3,I3+}
3549
3550 \huge
3551 \chemsetup[redox]{pos=top}
3552 \code{superscript}:
3553 \ch{"\ox{1/3,I}" {}3+}
3554
3555 \chemsetup[redox]{pos=side}
3556 \code{text}: \ox{1/3,I3+}
3557 \end{example}
3558
3559 If you define instances for other families please feel free to submit them to
3560 me (see section~\vref{sec:submitting-module}) so they can be added to the
3561 \chemmodule{xfrac} module.
3562
3563 \appendix
3564 \part{Appendix}
3565 \section{Own Modules Called Styles}\label{sec:own-modules}
3566 \subsection{How To}
3567
3568 If you have additional functionality which you think might be useful as a
3569 \chemmacros\ module then you can easily write one yourself. The module must
3570 be a file in a path where \TeX\ can find it following a certain naming
3571 scheme. The file for a module \chemmodule*{foo} \emph{must be named}
3572 \code{chemmacros.style.foo.code.tex}.
3573
3574 \begin{commands}
3575 \command{ChemStyle}[\sarg\marg{name}\oarg{version description}]
3576 Register module \meta{name} where the optional argument is passed to the
3577 optional argument of \cs*{ProvidesFile}.
3578 \end{commands}
3579
3580 The first line in the file then should look similar to this:
3581 \begin{sourcecode}
3582 \ChemStyle{foo}[2022-02-07 description of foo]
3583 \end{sourcecode}
3584 This registers the style \chemmodule*{foo} which means \chemmacros\ will
3585 accept this file as a valid style.
3586
3587 Such a style can then be loaded to your document via
3588 \begin{commands}
3589 \command{usechemstyle}[\marg{csv list of style names}]
3590 which should be used in the preamble of your document.
3591 \end{commands}
3592
3593 Since \chemmacros\ is written using expl3 \cs{ChemModule} starts an expl3
3594 programming environment. If you don't want that but rather want to write your
3595 module using traditional \LaTeXe\ methods then use the starred variant:
3596 \begin{sourcecode}
3597 \ChemStyle*{foo}[2022-02-07 description of foo]
3598 \end{sourcecode}
3599 In both variants \code{@} has category code~11 (letter).
3600
3601 If you decide to write your module \chemmodule*{foo} using expl3 and add
3602 options you want to be able to set using
3603 \cs{chemsetup}\Oarg{foo}\marg{options} please make sure you define (and set)
3604 them with the following macros:
3605 \begin{commands}
3606 \explcommand{chemmacros_define_keys:nn}[ \marg{module} \marg{key definitions}]
3607 Define l3keys options for the module \meta{module}. This is a wrapper for
3608 \explcs*{keys_define:nn} \Marg{chemmacros/\meta{module}} \marg{key
3609 definitions}.
3610 \explcommand{chemmacros_set_keys:nn}[ \marg{module} \marg{input}]
3611 Sets l3keys options for the module \meta{module}. This is a wrapper for
3612 \explcs*{keys_set:nn} \Marg{chemmacros/\meta{module}} \marg{input}.
3613 \end{commands}
3614 Also (\emph{especially if you consider submitting the module, see
3615 section~\vref{sec:submitting-module}}) please follow the expl3 naming
3616 conventions for variables and functions, \ie, use \code{chemmacros} as expl3
3617 module name:
3618 \begin{sourcecode}
3619 \tl_new:N \l__chemmacros_my_internal_variable_tl
3620 \tl_new:N \l_chemmacros_my_public_variable_tl
3621 \cs_new:Npn \__chemmacros_my_internal_function:n #1 { ... }
3622 \cs_new_protected:Npn \chemmacros_my_public_function:n #1 { ... }
3623 \NewDocumentCommand \publicfunction {m}
3624 { \chemmacros_my_public_function:n {#1} }
3625 \end{sourcecode}
3626 You will find more details on the naming conventions in \code{interface3.pdf}
3627 which most likely is available on your system:
3628 \begin{lbash}
3629 texdoc interface3
3630 \end{lbash}
3631 If you haven't read section~\vref{sec:base-module} about the \chemmodule{base}
3632 module, yet, please have a look. There some macros for module writers are
3633 described. Also other modules define macros for module writers which may be
3634 useful.
3635
3636 \subsection{Submitting a Module}\label{sec:submitting-module}
3637
3638 If you have written a module and feel it might be useful for other users
3639 please feel free to contact me and submit the module. I will surely take at
3640 look at both functionality and code and if I feel that it adds value to
3641 \chemmacros\ I will add it to the package. Requirement for this is that the
3642 module is licensed with the \LPPL\ (v1.3 or later) and that I take over
3643 maintenance (according to the \enquote{maintainer} status of the \lppl).
3644
3645 Please do \emph{not} submit your module via pull request but send me the files
3646 directly. In the best case you also have a short piece of documentation.
3647
3648 \section{Support, Suggestions and Bug Reports}\label{sec:sugg-bug-reports}
3649
3650 \subsection{Support}
3651 If you need support or help with anything regarding \chemmacros\ please use
3652 the usual support forums
3653 \begin{itemize}
3654 \item \url{http://www.golatex.de/} or
3655 \item \url{http://texwelt.de/wissen/} if you speak German,
3656 \item \url{http://www.latex-community.org/forum/} or
3657 \item \url{http://tex.stackexchange.com/} if you speak English
3658 \end{itemize}
3659 You can also open an issue on
3660 \url{https://github.com/cgnieder/chemmacros/issues/} possibly adding the label
3661 \emph{support} or write an email to
3662 \href{mailto:[email protected]}{[email protected]}.
3663
3664 \subsection{Suggestions}
3665 If you have any suggestions on how \chemmacros\ could be improved then please
3666 go to \url{https://github.com/cgnieder/chemmacros/issues/} and open a new
3667 issue possibly adding the label \emph{suggestion}.
3668
3669 \subsection{Bug reports}
3670 If you find any bugs, \ie, errors (something not working as described,
3671 conflicts with other packages, \ldots) then please go to
3672 \url{https://github.com/cgnieder/chemmacros/issues/} and open a new issue
3673 describing the error including a \emph{minimal working example} and possibly
3674 adding the label \emph{bug}.
3675
3676 \printbibliography
3677
3678 \end{document}