diff options
author | Karl Berry <karl@freefriends.org> | 2011-10-28 23:42:16 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-10-28 23:42:16 +0000 |
commit | cbacacfcd4827d9cad12656a2b37666975770269 (patch) | |
tree | b2cb781421f6e5a5eef3bf58c205c574bd7033bc /Master/texmf-dist | |
parent | 626107c053e66c6ddd3d791fcffe417013a387a9 (diff) |
chemmacros (28oct11)
git-svn-id: svn://tug.org/texlive/trunk@24428 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/chemmacros/README | 9 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/chemmacros/chemmacros_doc_de.pdf | bin | 368424 -> 505945 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/chemmacros/chemmacros_doc_de.tex | 1649 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/chemmacros/chemmacros_doc_en.pdf | bin | 361555 -> 486138 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/chemmacros/chemmacros_doc_en.tex | 1640 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/chemmacros/chemmacros-version1.cfg | 334 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty | 2936 |
7 files changed, 4398 insertions, 2170 deletions
diff --git a/Master/texmf-dist/doc/latex/chemmacros/README b/Master/texmf-dist/doc/latex/chemmacros/README index be2ff6515e2..b017ced447a 100644 --- a/Master/texmf-dist/doc/latex/chemmacros/README +++ b/Master/texmf-dist/doc/latex/chemmacros/README @@ -1,8 +1,8 @@ -------------------------------------------------------------------------- -the chemmacros package v1.1 +the chemmacros package v2.0 a collection of macros to make typesetting chemistry documents more convenient -2011/06/22 +2011/10/28 -------------------------------------------------------------------------- Clemens Niederberger Web: http://www.mychemistry.eu/ @@ -22,8 +22,9 @@ This work has the LPPL maintenance status `maintained'. The Current Maintainer of this work is Clemens Niederberger. -This work consists of the files chemmacros.sty, chemmacros_doc_de.tex -and chemmacros_doc_en.tex +This work consists of the files chemmacros.sty, chemmacros-version1.cfg, +chemmacros_doc_de.tex, chemmacros_doc_de.tex, README and the derived +files chemmacros_doc_de.pdf and chemmacros_doc_en.pdf -------------------------------------------------------------------------- chemmacros is a collection of macros and commands which are intended to make typesetting chemistry documents with LaTeX2e faster and more diff --git a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_doc_de.pdf b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_doc_de.pdf Binary files differindex cf2e1154d98..4478c854c43 100644 --- a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_doc_de.pdf +++ b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_doc_de.pdf diff --git a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_doc_de.tex b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_doc_de.tex index 171b8faec45..dac3f33b06e 100644 --- a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_doc_de.tex +++ b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_doc_de.tex @@ -1,98 +1,184 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% ------------------------------------------------------------------------------------- % -% - chemmacros - chemmacros_doc_de.tex ------------------------------------------------ % -% - a collection of macros to make typesetting chemistry documents more convenient ---- % -% ------------------------------------------------------------------------------------- % -% - Clemens Niederberger -------------------------------------------------------------- % -% - 2011/06/22 ------------------------------------------------------------------------ % -% ------------------------------------------------------------------------------------- % -% - http://www.mychemistry.eu/ -------------------------------------------------------- % -% - contact@mychemistry.eu ------------------------------------------------------------ % -% ------------------------------------------------------------------------------------- % -% - If you have any ideas, questions, suggestions or bugs to report, please feel free - % -% - to contact me. -------------------------------------------------------------------- % -% ------------------------------------------------------------------------------------- % -% - Copyright 2011 Clemens Niederberger - % -% - - % -% - This work may be distributed and/or modified under the - % -% - conditions of the LaTeX Project Public License, either version 1.3 - % -% - of this license or (at your option) any later version. - % -% - The latest version of this license is in - % -% - http://www.latex-project.org/lppl.txt - % -% - and version 1.3 or later is part of all distributions of LaTeX - % -% - version 2005/12/01 or later. - % -% - - % -% - This work has the LPPL maintenance status `maintained'. - % -% - - % -% - The Current Maintainer of this work is Clemens Niederberger. - % -% - - % -% - This work consists of the files chemmacros.sty, chemmacros_doc_de.tex, - % -% - chemmacros_doc_de.tex, README - % -% ------------------------------------------------------------------------------------- % -\documentclass[parskip=full]{scrartcl} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% --------------------------------------------------------------------------- % +% - chemmacros - chemmacros_doc_de.tex - % +% - macros and commands for chemists - % +% --------------------------------------------------------------------------- % +% - Clemens Niederberger - % +% - 2011/10/28 - % +% --------------------------------------------------------------------------- % +% - http://www.mychemistry.eu/ - % +% - contact@mychemistry.eu - % +% --------------------------------------------------------------------------- % +% - If you have any ideas, questions, suggestions or bugs to report, please - % +% - feel free to contact me. - % +% --------------------------------------------------------------------------- % +% - Copyright 2011 Clemens Niederberger - % +% - - % +% - This work may be distributed and/or modified under the - % +% - conditions of the LaTeX Project Public License, either version 1.3 - % +% - of this license or (at your option) any later version. - % +% - The latest version of this license is in - % +% - http://www.latex-project.org/lppl.txt - % +% - and version 1.3 or later is part of all distributions of LaTeX - % +% - version 2005/12/01 or later. - % +% - - % +% - This work has the LPPL maintenance status `maintained'. - % +% - - % +% - The Current Maintainer of this work is Clemens Niederberger. - % +% - - % +% - This work consists of the files chemmacros.sty, chemmacros-version1.cfg,- % +% - chemmacros_doc_de.tex, chemmacros_doc_de.tex, README and the derived - % +% - files chemmacros_doc_de.pdf and chemmacros_doc_en.pdf - % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\documentclass[nohyper,titlepage,a4paper,nofonts,notoc]{tufte-handout} + +\newcommand*\CMname{\textsf{chemmacros}\xspace} +\newcommand*\CMversion{2.0\xspace} +\newcommand*\CMdate{2011/10/28\xspace} + +% changing some tufte-handout settings +\titleformat{\section}[hang]{\normalfont\Large\bfseries}{\thesection}{1em}{}[] +\titleformat{\subsection}[hang]{\normalfont\large\bfseries}{\thesubsection}{1em}{}[] +\makeatletter +\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex plus -1ex minus -.2ex}{1.5ex plus .2ex}{\normalsize\bf}} +\makeatother +\def\thesubsubsection{\thesection.\thesubsection.\arabic{subsubsection}} +\titleformat{\subsubsection}[hang]{\normalfont\large\bfseries}{\thesubsection}{1em}{}[] +\titlespacing*{\subsubsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus.2ex} +\setcounter{secnumdepth}{2} + +% need these because of the lots of marginnotes +\usepackage{etex,morefloats} +\reserveinserts{150} + \usepackage[ngerman]{babel} \usepackage[utf8]{inputenx} \usepackage[dvipsnames]{xcolor} \colorlet{code}{RawSienna} -\usepackage{listings,url,chemfig,chemstyle,bpchem,booktabs} -\usepackage[perpage,hang]{footmisc} - \renewcommand*\thefootnote{\arabic{footnote})} +\usepackage[normalem]{ulem} +\usepackage{url,chemfig,chemstyle,bpchem,array,longtable,multirow,booktabs,framed} \usepackage[version=3,arrows=pgf]{mhchem} -\usepackage[xspace,circled,german]{chemmacros} -\usetikzlibrary{calc} +\usepackage[german]{chemmacros} + +\usepackage{showexpl} \lstset{literate={ä}{{\"a}}1 {ö}{{\"o}}1 {ü}{{\"u}}1 {Ä}{{\"A}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1 {ß}{{\ss}}1} \lstset{ - language=[LaTeX]TeX, - basicstyle={\ttfamily}, % Grundstil - extendedchars=true, - numbers=left, % Zeilennummern - numberstyle=\tiny, % Größe des Zeilennummern - numberblanklines=true, % Leerzeilen nummerieren - gobble=1, % das erste Leerzeichen abschneiden - xleftmargin=20pt, % Einrückung links - breaklines=true, % Zeilenumbruch - moredelim=[is][\color{red!25!purple}]{!!}{!!},% Hervorhebung - moredelim=[is][\color{black}]{++}{++}, % Hervorhebung der Keywords rückgängig - commentstyle={\color[named]{Gray}}, - emph={begin,end}, % Umgebungen hervorheben - emphstyle=\color{red}, - keywordstyle=\color{code}, - keywordstyle=[20]\color{blue}, - morekeywords=[20]{reaction,reactions,reactionsat}, - texcsstyle=[30]\color{code}, - moretexcs=[30]{abinitio,aq,atm,atmosphere,cal,calory,ce,cee,celsius,cf,chemabove,chembelow,chemfig,cip,cis,cmc,CNMR,color,cstsetup,DeclareSIUnit,delm,delp,Dfi,draw,E,el,El,ElPot,ensuremath,enthalpy,Enthalpy,Entropy,gas,Gibbs,gram,Helmholtz,HNMR,HtO,Hpl,Hyd,insitu,IUPAC,joule,kelvin,kilo,latin,lewis,Lfi,liter,liquid,mch,mech,meta,mhName,milli,mmHg,molar,moLar,Molar,mole,MolMass,newman,newreaction,NMR,node,normal,ntr,nu,Nu,ortho,ox,OX,para,pch,per,pH,pKa,pKb,phorb,pOH,porb,prt,pxorb,pyorb,pzorb,R,Rcip,Rconf,redox,renewstate,renewtagform,setorbheight,Scip,Sconf,scrm,scrp,setatomsep,setbondoffset,setmhName,setnewstate,setorbheight,setstatesubscript,setredoxdist,si,SI,sisetup,solid,standardstate,State,text,tikz,torr,trans,transitionstatesymbol,usetikzlibrary,volt,water,xspace,Z} + language = [LaTeX]TeX, + basicstyle = {\ttfamily}, + extendedchars = true, + numbers = left, + numberstyle = \tiny, + numberblanklines = true, + gobble = 1, + xleftmargin = 20pt, + breaklines = true, + commentstyle = {\color[named]{Gray}}, } \usepackage{hyperref} - \hypersetup{colorlinks=true, - plainpages=false, - bookmarksopen=true, - bookmarksopenlevel=2, - bookmarksnumbered=true, - pdfauthor={Clemens Niederberger}, - pdftitle={chemmacros - Manual}, - pdfsubject={Hilfsmakros für den Chemiker}, - pdfkeywords={chemmacros}, - pdfcreator={LaTeX} - } +\hypersetup{ + colorlinks = true, + plainpages = false, + bookmarksopen = true, + bookmarksopenlevel = 1, + bookmarksnumbered = true, + pdfauthor = {Clemens Niederberger}, + pdftitle = {chemmacros - Manual}, + pdfsubject = {Hilfsmakros für den Chemiker}, + pdfkeywords = {chemmacros}, + pdfcreator = {LaTeX} +} -\newcommand*\paket[1]{`#1'\footnote{\url{http://www.ctan.org/pkg/#1}}} -\reversemarginpar -\newcommand*\NEU[1][]{\marginpar{\raggedleft\color{red}NEU \ifx\relax#1\relax\else\normalcolor v.#1\fi}} -\makeatletter -\let\CMname\CM@name% -\makeatother +\ExplSyntaxOn +\NewDocumentCommand \paket { o m } + { + \textsf { #2 } + \cs_if_exist:cF { paket @ #2 } + { + \cs_new_nopar:cpn { paket @ #2 } { } + \IfNoValueTF { #1 } + { \sidenote { CTAN: ~ \href { http://www.ctan.org/pkg/#2/ } { #2 } } } + { \sidenote[][ #1 ] { CTAN: \href { http://www.ctan.org/pkg/#2/ } { #2 } } } + } + } + +\newcommand*\code[1]{{\normalfont\upshape\ttfamily#1}} +\newcommand*\ma[1]{% + {\normalcolor\ttfamily\char`\{#1\char`\}}} +\newcommand*\oa[1]{% + {\normalcolor\ttfamily\char`[#1\char`]}} +\newcommand*\da[1]{% + {\normalcolor\ttfamily\char`(#1\char`)}} + +\NewDocumentCommand \cmd { m } + { + \group_begin: + \code { \char`\\ \color{code} #1 } + \group_end: + } + +\NewDocumentCommand \Key { o o d() m m } + { + \IfNoValueTF { #3 } + { + \IfNoValueTF { #2 } + { \label{key:#4} } + { \label{key:#2_#4} } + } + { \label{key:#3_#4} } + \marginnote + { + \framed + \code { \textcolor { blue } { #4 } ~ = ~ #5 } + \IfNoValueF { #1 } { \tl_if_blank:nF { #1 } { \newline Default: ~ \code { #1 } } } + \IfNoValueTF { #2 } + { \newline \textcolor { red } { kein ~ Modul } } + { \newline Modul: ~ \code { #2 } } + \endframed + } + } + +\NewDocumentCommand \changed { m } + { + \group_begin: + \colorlet { shadecolor } { red!20 } + \marginnote + { + \shaded + Der ~ Befehl ~ \cmd { #1 } ~ hat ~ seit ~ v2.0 ~ eine ~ + andere ~ Syntax. ~ Die ~ Paketoption ~ \code { version=1 } \tl_use:N \c_space_tl + stellt ~ die ~ ursprüngliche ~ Syntax ~ wieder ~ her. + \endshaded + } + \group_end: + } + +\NewDocumentCommand \formercmd { m } + { + \marginnote + { + \cmd { #1 } ~ wird ~ nicht ~ mehr ~ bereitgestellt. ~ Verwenden ~ Sie ~ die ~ Paketoption ~ + \code { version = 1 } , ~ um ~ ihn ~ wieder ~ zu ~ reaktivieren. + } + } +\ExplSyntaxOff + \newcommand*\zB{\mbox{z.\,B.}\xspace} \newcommand*\bzw{\mbox{bzw.}\xspace} +\renewcommand*\dh{\mbox{dh.}\xspace} \newcommand*\usw{\mbox{usw.}\xspace} +\newcommand*\va{\mbox{v.\,a.}\xspace} +\newcommand*\vgl{\mbox{vgl.}\xspace} \newcommand*\TikZ{\mbox{Ti\textbf{\textit{k}}Z}\xspace} + \begin{document} \begin{titlepage} + \begin{fullwidth} \centering - \Huge\makeatletter\CM@name\ v\CM@version\makeatother + \Huge chemmacros v\CMversion \vskip.5cm - \Large\makeatletter\CM@date\makeatother + \Large\CMdate \vskip.5cm \large Clemens \textsc{Niederberger} \vskip.25cm @@ -100,657 +186,632 @@ \href{mailto:contact@mychemistry.eu}{contact@mychemistry.eu} \vskip2cm \begin{abstract} - `\CMname' ist eine Sammlung von Hilfs-Makros für Chemiker. Sie sind dazu gedacht, das Schreiben von Chemie-Dokumenten mit \LaTeXe\ schneller und bequemer zu machen. Das betrifft unter anderem Nomanklatur, Oxidationszahlen, thermodynamische Daten, Newman-Projektionen, \usw + \CMname ist eine Sammlung von Hilfs-Makros und Befehlen für Chemiker. Sie sind dazu gedacht, das Schreiben von Chemie-Dokumenten mit \LaTeXe\ schneller und bequemer zu machen. Das betrifft unter anderem Nomenklatur, Oxidationszahlen, thermodynamische Daten, Newman-Projektionen, \usw \end{abstract} + \end{fullwidth} \end{titlepage} \tableofcontents -\section{Lizenz, Voraussetzungen} -`\CMname' v\makeatletter\CM@version\makeatother\ steht unter der \LaTeX\ Project Public License Version 1.3 oder später.\newline(\url{http://www.latex-project.org/lppl.txt}) - -`\CMname' ruft intern die Pakete \paket{amsmath}, \paket{ifthen}, \paket{siunitx}, \paket{xparse} und `tikz' (\TikZ = \paket{pgf}) sowie die TikZlibrary \lstinline=calc= auf. Sind sie nicht vorhanden, wird eine Fehlermeldung ausgegeben. +\section{Was ist neu?} +Mit dem Update auf v\CMversion hat sich im Hintergrund einiges geändert. Die Anpassung der Befehle wird nun komplett über ein Schlüssel/Wert-System vorgenommen. Dadurch gibt es jetzt deutlich mehr Mög\-lich\-kei\-ten der Personalisierung von Befehlen. Das bedeutet auch, dass sich bei einigen Befehlen die Syntax\changed{Befehl} verändert hat. -`siunitx' benötigt \LaTeX3-Unterstützung, die durch die Bundles \paket{expl3} und \paket{xpackages} bereitgestellt wird. `xparse' ist Teil des `xpackages'-Bundles. In der Folge benötigt auch `\CMname' \LaTeX3-Unterstützung. +Um dennoch zu gewährleisten, dass Dokumente, die mit v1.* gesetzt wurden, weiterhin kompilieren, gibt es die Paket-Option \code{version=1}, die die alten Definitionen wiederherstellt. Bei Befehlen, die das betrifft wird wie rechts im Rand beispielhaft gezeigt auf die Änderung hingewiesen. Manche Befehle gibt es nun nicht mehr\formercmd{Befehl}, doch auch sie werden durch die Paketoption \code{version=1} wiederhergestellt. Auf sie wird ebenfalls am Rand und im Text hingewiesen. -Manche Befehle haben unterschiedliche Definitionen, je nachdem ob andere Pakete vom Benutzer \emph{vorher} geladen wurden oder nicht. Manche Befehle werden auch nur definiert, wenn ein bestimmtes Paket geladen ist. Das betrifft die Pakete \paket{bpchem}, \paket{chemstyle} und \paket{mhchem}. An entsprechender Stelle in der Dokumentation wird auf die Unterschiede konkret hingewiesen. - -Für die Paketoption \lstinline=bpchem= (Abschnitt \ref{sec:optionen}) wird das Paket `bpchem' benötigt. +\section{Lizenz, Voraussetzungen} +\CMname v\CMversion steht unter der \LaTeX\ Project Public License Version 1.3 oder später. (\url{http://www.latex-project.org/lppl.txt}) -Für die Paketoption \lstinline=xspace= (Abschnitt \ref{sec:optionen}) wird das Paket \paket{xspace} benötigt. +\CMname ruft intern die Pakete \textsf{expl3}, \paket{xparse}, \paket{l3keys2e} und \paket{xfrac} auf, die durch die Bundles \paket{l3kernel} und \paket{l3packages} bereitgestellt werden. \paket{expl3} ist Teil des \paket{l3kernel}-Bundles und \paket{xparse}, \paket{l3keys2e} und \paket{xfrac} sind Teil des \paket{l3packages}-Bundles. -Wenn der Benutzer das Paket `mhchem' lädt, so werden außerdem die Pakete \paket{mathtools} und \paket{environ} benötigt. +Weiterhin lädt \CMname die Pakete \paket{siunitx}, \paket{mhchem}, \paket{mathtools} und \paket{environ} sowie \TikZ (\paket{pgf}) und die TikZlibraries \code{calc} und \code{arrows}. -\textbf{Bitte beachten Sie, dass sich mit der Version 1.1 die Paketoptionen verändert haben.} +Für die Paketoption \code{bpchem} (Abschnitt \ref{sec:optionen}) wird zusätzlich \paket{bpchem} benötigt und für die Option \code{xspace} das Paket \paket{xspace}. \section{Paket-Optionen}\label{sec:optionen} -\NEU[1.1]`\CMname' hat vier Paketoptionen: +\CMname hat mehrere Paketoptionen.\marginnote{Dieses Dokument verwendet \CMname mit folgenden Optionen: \cmd{usepackage\oa{xspace,german} \ma{chemmacros}}}\marginnote[\baselineskip]{\code{bpchem = false} \NMR;\\\code{bpchem = true} {\chemsetup[option]{bpchem}\NMR};}\marginnote[\baselineskip]{\code{circled = none} {\chemsetup[option]{circled=none}\mch\ \pch\ \fmch\ \fpch}\\\code{circled = formal, circletype = chem} {\chemsetup[option]{circled}\mch\ \pch\ \fmch\ \fpch}\\\code{circled = all, circletype = chem} {\chemsetup[option]{circled=all,circletype=chem}\mch\ \pch\ \fmch\ \fpch}\\\code{circled = formal, circletype = math} {\chemsetup[option]{circled,circletype=math}\mch\ \pch\ \fmch\ \fpch}\\\code{circled = all, circletype = math} {\chemsetup[option]{circled=all,circletype=math}\mch\ \pch\ \fmch\ \fpch}} Sie alle können nach dem Schlüssel/Wert-Prinzip auf die Art \cmd{usepackage\oa{option1 = <value1>, option2 = <value2>}\ma{chemmacros}} angegeben werden. Manche können auch ohne Wert aufgerufen werden (\cmd{usepackage\oa{option1, option2}\ma{chemmacros}}). Sie entsprechen dann dem \uline{unterstrichenen} Wert. \begin{description} - \item[\texttt{bpchem}] Durch diese Option wird zum einen das Paket `bpchem' geladen und zum anderen das Aussehen des \lstinline=\NMR=-Befehls dem der `bpchem'-Befehle \lstinline=\HNMR= und \lstinline=\CNMR= angepasst. Ohne Option: \NMR; Mit Option: \HNMR; - \item[\texttt{circled}] Manche Chemiker -- darunter ich -- bevorzugen umkreiste Ladungssymbole, um sie von dem Additions- und Subtraktionssymbol klar abzugrenzen. Per Default werden sie bei `\CMname' allerdings \emph{nicht} umkreist angezeigt ($+$ und $-$). Mit der Option \lstinline+circled+ verwenden alle Befehle von `\CMname' die Symbole \emph{mit} Kreis ($\oplus$ und $\ominus$). - \item[\texttt{german}] Die Option ändert den Befehl \lstinline=\pKa= von \mbox{\textsl{p}$K_\mathrm{A}$} in \mbox{\textsl{p}$K_\mathrm{S}$} und die Befehle \lstinline=\solid= und \lstinline=\liquid= von \solid[s] und \liquid[l] in \solid\ \bzw \liquid. - \item[\texttt{xspace}] Mit der Option bekommen folgende Befehle ein \lstinline=\xspace= angehängt: \lstinline=\Hpl= \lstinline=\HtO= \lstinline=\water= \lstinline=\Hyd= \lstinline=\HtO= \lstinline=\pH= \lstinline=\pOH= \lstinline=\pKa= \lstinline=\pKb= \lstinline=\cis= \lstinline=\trans= \lstinline=\insitu= \lstinline=\abinitio= \lstinline=\mech= \lstinline=\NMR= \Hpl \HtO \water \Hyd \HtO \pH \pOH \pKa \pKb \cis \trans \insitu \abinitio \mech \NMR\\ - Bitte beachten Sie, dass die beiden Befehle \lstinline=\cis= und \lstinline=\trans= auch durch das `bpchem'-Paket definiert werden. Falls Sie das Paket laden, werden sie durch `\CMname' umdefiniert. Bei `bpchem' haben sie \textit{immer} ein angehängtes \lstinline=\xspace=, mit `\CMname' nur mit Option \lstinline=xspace=. Abgesehen davon sind sie identisch. + \item[\code{bpchem = \uline{true}/false>}] Durch diese Option wird zum einen das Paket \paket{bpchem} geladen und zum anderen das Aussehen des \cmd{NMR}-Befehls dem der \paket{bpchem}-Befehle \cmd{HNMR} und \cmd{CNMR} angepasst. (Default: \code{false})\label{key:option_bpchem} + % + \item[\code{circled = \uline{formal}/all/none}] \CMname verwendet zwei verschiedene Formen von Ladungen\footnote{Dank an Christoph Schäfer, der mich auf die unpräzise Behandlung der Ladungen in v1.1 hinwies!}, die den Gebrauch von realen ($+/-$ ) und formalen (\fplus/\fminus) Ladungen wiederspiegeln sollen. Mit der Option \code{formal} unterscheidet \CMname zwischen ihnen, mit der Option \code{none} werden sie alle ohne Umkreisung dargestellt, mit \code{all}, werden alle umkreist. (Default: \code{formal})\label{key:option_circled} + % + \item[\code{circletype = \uline{chem}/math}] Diese Option schaltet zwischen zwei Darstellungsformen der umkreisten Ladungen hin und her: \cmd{fplus} \fplus\ und \code{\$\cmd{oplus}\$} $\oplus$. (Default: \code{chem})\label{key:option_circletype} + % + \item[\code{EZ = \uline{chemmacros}/cool}] Der Befehl \cmd{E} wird sowohl durch das Paket \paket{cool} als auch \CMname definiert. Mit der Option \code{EZ = cool} wird er durch \CMname nicht definiert und stattdessen ein anderer Name verwendet, siehe Seite \pageref{EZ}. (Default: \code{chemmacros})\label{key:option_EZ} + % + \item[\code{german = \uline{true}/false}]\marginnote{\code{german = false} {\chemsetup[option]{german=false}\pKa, \sld, \lqd}\\\code{german = true} \pKa, \sld, \lqd} Die Option ändert die Befehle \cmd{pKa}, \cmd{sld} und \cmd{lqd} (Default: \code{false})\label{key:option_german} + % + \item[\code{version = 1/2}] Die Option lädt die alte Definition einiger Befehle, damit Dokumente, die mit v1.* gesetzt wurden, nicht überarbeitet werden müssen. Im Rand wird bei den entsprechenden Befehlen mit neuer Syntax darauf hingewiesen. (Default: \code{2})\label{key:option_version} + % + \item[\code{xspace = \uline{true}/false}] Mit der Option bekommen die meisten Befehle ein \cmd{xspace} angehängt. (Default: \code{true})\label{key:option_xspace} \end{description} -\section{Teilchen, Ionen und ein Symbol}\label{sec:teilchen} -Eine Reihe einfacher Makros, um häufig gebrauchte Teilchen sowie ein Symbol darzustellen. Beachten Sie, dass die Darstellung von den verwendeten Paketoptionen abhängt, siehe Abschnitt \ref{sec:optionen}. +\section{Setup} +Eine ganze Reihe von Befehlen haben Schlüssel/Wert-Paare erhalten, mit denen sie angepasst werden können. In der Regel können diese als Argument der Befehle direkt verwendet werden. Genauso können sie aber in der Regel durch den Befehl \cmd{chemsetup} gesetzt werden. +\begin{framed} + \cmd{chemsetup\oa{<module>}\ma{<key> = <value>}} oder \\ + \cmd{chemsetup\ma{<module>/<key> = <value>}} +\end{framed} +Die Schlüssel\Key[<default>][<module>]{<key>}{<value>} gehören jeweils einem Modul an, das bestimmt, für welche Befehle sie gelten. Wenn ein Schlüssel vorgestellt wird, können Sie im Rand die Eigenschaften sehen. Sie haben zwei Mög\-lich\-kei\-ten, die Schlüssel mit dem \cmd{chemsetup}-Befehl aufzurufen, wie im Kasten zu sehen. + +Die Paketoptionen sind ebenso als Schlüssel mit \cmd{chemsetup} setzbar. Sie gehören dem Modul \code{option} an. +\begin{LTXexample}[pos=b] + \chemsetup[option]{circled=none}\mch\ \pch\ \fmch\ \fpch\ \el\ \prt \\ + \chemsetup[option]{circled=formal}\mch\ \pch\ \fmch\ \fpch\ \el\ \prt \\ + \chemsetup[option]{circletype=math}\mch\ \pch\ \fmch\ \fpch\ \el\ \prt \\ + \chemsetup{option/circletype=chem,option/circled=all}\mch\ \pch\ \fmch\ \fpch\ \el\ \prt \\ + \chemsetup{option/circletype=math}\mch\ \pch\ \fmch\ \fpch\ \el\ \prt +\end{LTXexample} +Schlüssel, die \emph{keinem} Modul angehören, können \emph{nicht} mit \cmd{chemsetup} gesetzt werden. + +\section{Teilchen, Ionen und Symbole}\label{sec:teilchen} +Eine Reihe einfacher Makros, um häufig gebrauchte Teilchen sowie ein Symbol darzustellen. Beachten Sie, dass die Darstellung von den verwendeten Paketoptionen abhängt, siehe Abschnitt \ref{sec:optionen}.\marginnote{Diese Befehle sind sowohl im Text- wie im Mathematikmodus einsetzbar.} \begin{itemize} - \item\lstinline=\Hpl= \Hpl (Proton) - \item\lstinline=\Hyd= \Hyd (Hydroxid) - \item\NEU[1.1]\lstinline=\HtO= \HtO (Oxonium) (\textbf{H} \textbf{t}hree \textbf{O}) - \item\NEU[1.1]\lstinline=\water= \water - \item\lstinline=\el= \el (Elektron) - \item\lstinline=\prt= \prt (Proton) - \item\lstinline=\ntr= \ntr (Neutron) - \item\NEU[1.1]\lstinline=\Nu= \Nu (Nucleophil) - \item\NEU[1.1]\lstinline=\El= \El (Elektrophil) - \item\lstinline=\transitionstatesymbol= \transitionstatesymbol\ Über\-gangs\-zu\-stands\-symbol (verwendet `\TikZ') + \item\cmd{Hpl} \Hpl (Proton) + \item\cmd{Hyd} \Hyd (Hydroxid) + \item\cmd{HtO} \HtO (Oxonium) (\textbf{H} \textbf{t}hree \textbf{O}) + \item\cmd{water} \water + \item\cmd{el} \el (Elektron) + \item\cmd{prt} \prt (Proton) + \item\cmd{ntr} \ntr (Neutron) + \item\cmd{Nu} \Nu (Nucleophil) + \item\cmd{El} \El (Elektrophil) + \item\cmd{fplus} \fplus + \item\cmd{fminus} \fminus + \item\cmd{transitionstatesymbol} \transitionstatesymbol\ Über\-gangs\-zu\-stands\-symbol (verwendet \TikZ) + \item\cmd{standardstate} \standardstate. Dieses Symbol wird durch \CMname bereitgestellt, falls das Paket \paket{chemstyle} nicht geladen wird, bei dem die Idee ausgeliehen wurde\footnote{Dank an den Paketautoren \href{http://www.texdev.net/}{Joseph Wright}.}. \end{itemize} -Diese Befehle sind sowohl im Text- wie im Mathematikmodus einsetzbar. Je nachdem, ob `mhchem' geladen wurde oder nicht, werden Atome in den \lstinline=\cf{}=-Befehl von `mhchem' oder in eine \lstinline=\mbox{}= geschrieben. - -\NEU[1.1]Daneben gibt es noch einen weiteren Befehl, mit dem Radikale mit Ladungen und Index geschrieben werden können. -\begin{itemize} - \item\lstinline=\R[<sign>]{<subscript>}= \zB \lstinline=\R[+]{tert} \R[-]{sek} \R{prim}= \R[+]{tert} \R[-]{sek} \R{prim} -\end{itemize} - -\section{Stereo-Deskriptoren, Nomenklatur, lateinische Ausdrücke}\label{sec:stereo} +Daneben gibt es noch einen weiteren Befehl, mit dem Radikale mit Ladungen und Index geschrieben werden können. +\begin{framed} + \cmd{R\oa{<sign>}\ma{<subscript>}} +\end{framed} +\begin{LTXexample} + \R[+]{tert} \R[-]{sek} \R{prim} +\end{LTXexample} + +\section{Stereo-Deskriptoren, Nomenklatur, lateinische Aus\-drücke}\label{sec:stereo} \subsection{Stereo-Deskriptoren und Nomenklatur} Die folgenden Makros sollen das Schreiben von IUPAC-Namen etwas erleichtern: \begin{itemize} \item Cahn-Ingold-Prelog: - \begin{itemize} - \item\lstinline=\Rcip= \Rcip - \item\lstinline=\Scip= \Scip - \item\lstinline=\cip{<conf>}= z.\,B.: \lstinline=\cip{R,S}= \cip{R,S} - \end{itemize} + \begin{framed} + \cmd{Rcip} \Rcip \\ + \cmd{Scip} \Scip \\ + \cmd{cip\ma{<conf>}} \zB: \cmd{cip\ma{R,S}} \cip{R,S} + \end{framed} \item Fischer: - \begin{itemize} - \item\lstinline=\Dfi= \Dfi - \item\lstinline=\Lfi= \Lfi - \end{itemize} - \item cis/trans und zusammen/entgegen: - \begin{itemize} - \item\lstinline=\Z= \Z - \item\lstinline=\E= \E - \item\lstinline=\cis= \cis (Dieser Befehl wird auch von `bpchem' definiert. `\CMname'\linebreak schreibt in diesem Fall die Definition leicht um, siehe Abschnitt \ref{sec:optionen}.) - \item\lstinline=\trans= \trans (Dieser Befehl wird auch von `bpchem' definiert. `\CMname' schreibt in diesem Fall die Definition leicht um, siehe Abschnitt \ref{sec:optionen}.) - \end{itemize} + \begin{framed} + \cmd{Dfi} \Dfi \\ + \cmd{Lfi} \Lfi + \end{framed} + \item cis/trans und zusammen/entgegen:\marginnote{Bitte beachten Sie, dass die beiden Befehle \cmd{cis} und \cmd{trans} auch durch das \paket{bpchem}-Paket definiert werden. Falls Sie das Paket laden, werden sie durch \CMname umdefiniert. Bei \paket{bpchem} haben sie \textit{immer} ein angehängtes \cmd{xspace}, mit \CMname nur mit Option \code{xspace}. Abgesehen davon sind sie identisch.} + \begin{framed} + \cmd{Z} \Z\label{EZ} \\ + \cmd{E} \E\ (\cmd{E} wird \zB auch durch das Paket \paket{cool} definiert. Mit der Paketoption \code{EZ = cool} werden statt \cmd{E} und \cmd{Z} die Befehle \cmd{Ent} und \cmd{Zus} definiert.) \\ + \cmd{cis} \cis \\ + \cmd{trans} \trans + \end{framed} \item ortho/meta/para: - \begin{itemize} - \item\lstinline=\ortho= \ortho - \item\lstinline=\meta= \meta - \item\lstinline=\para= \para - \end{itemize} + \begin{framed} + \cmd{ortho} \ortho \\ + \cmd{meta} \meta \\ + \cmd{para} \para + \end{framed} \end{itemize} -Anzeigen der absoluten Konfiguration (verwendet `\TikZ'): -\begin{itemize} - \item\lstinline=\Rconf[<letter>]= \lstinline=\Rconf=: \Rconf \quad\lstinline=\Rconf[]=: \Rconf[] - \item\lstinline=\Sconf[<letter>]= \lstinline=\Sconf=: \Sconf \quad\lstinline=\Sconf[]=: \Sconf[] -\end{itemize} - -Beispiele: -\begin{lstlisting} - \Dfi-Weinsäure = \cip{2S,3S}-Weinsäure -\end{lstlisting} -\Dfi-Weinsäure = \cip{2S,3S}-Weinsäure -\begin{lstlisting} - \Dfi-($-$)-Threose = \cip{2S,3R}-($-$)-2,3,4-Trihydroxybutanal -\end{lstlisting} -\Dfi-($-$)-Threose = \cip{2S,3R}-($-$)-2,3,4-Trihydroxybutanal -\begin{lstlisting} - \cis-2-Buten = \Z-2-Butene, \cip{2E,4Z}-Hexadiene -\end{lstlisting} -\cis-2-Buten = \Z-2-Butene, \cip{2E,4Z}-Hexadiene -\begin{lstlisting} - \meta-Xylol = 1,3-Dimethylbenzene -\end{lstlisting} -\meta-Xylol = 1,3-Dimethylbenzene -\begin{lstlisting} +Anzeigen der absoluten Konfiguration (verwendet \TikZ): +\begin{framed} + \cmd{Rconf\oa{<letter>}} \cmd{Rconf}: \Rconf \quad\cmd{Rconf\oa{}}: \Rconf[] \\ + \cmd{Sconf\oa{<letter>}} \cmd{Sconf}: \Sconf \quad\cmd{Sconf\oa{}}: \Sconf[] +\end{framed} + +Beispiele:\marginnote{Das Aussehen hängt natürlich von gewählten Font ab:\par\cip{2S,3R} \E \Z \Dfi \Lfi\par\fontfamily{ptm}\selectfont\cip{2S,3R} \E \Z \Dfi \Lfi\par\fontfamily{ppl}\selectfont\cip{2S,3R} \E \Z \Dfi \Lfi} +\begin{LTXexample}[pos=b] + \Dfi-Weins\"aure = \cip{2S,3S}-Weins\"aure \\ + \Dfi-($-$)-Threose = \cip{2S,3R}-($-$)-2,3,4-Trihydroxybutanal \\ + \cis-2-Buten = \Z-2-Butene, \cip{2E,4Z}-Hexadiene \\ + \meta-Xylol = 1,3-Dimethylbenzene \\ % mit `bpchem's Befehl \IUPAC: - \IUPAC{\Dfi\-Wein\|säure} = \IUPAC{\cip{2S,3S}\-Wein\|säure}, \IUPAC{\Dfi\-($-$)\-Threose} = \IUPAC{\cip{2S,3R}\-($-$)\-2,3,4\-Tri\|hydroxy\|butanal} -\end{lstlisting} -\IUPAC{\Dfi\-Wein\|säure} = \IUPAC{\cip{2S,3S}\-Wein\|säure}, \IUPAC{\Dfi\-($-$)\-Threose} = \IUPAC{\cip{2S,3R}\-($-$)\-2,3,4\-Tri\|hydroxy\|butanal} - -Im letzten Beispiel wurde der Befehl \lstinline=\IUPAC= des Pakets `bpchem' eingesetzt. - -Das Aussehen hängt natürlich von gewählten Font ab: -\begin{lstlisting} - \cip{2S,3R} \E \Z \Dfi \Lfi \par - \fontfamily{ptm}\selectfont - \cip{2S,3R} \E \Z \Dfi \Lfi \par - \fontfamily{ppl}\selectfont - \cip{2S,3R} \E \Z \Dfi \Lfi -\end{lstlisting} -\cip{2S,3R} \E \Z \Dfi \Lfi - -\fontfamily{ptm}\selectfont -\cip{2S,3R} \E \Z \Dfi \Lfi - -\fontfamily{ppl}\selectfont -\cip{2S,3R} \E \Z \Dfi \Lfi -\fontfamily{cmr}\selectfont + \IUPAC{\Dfi\-Wein\|s\"aure} = \IUPAC{\cip{2S,3S}\-Wein\|s\"aure}, \IUPAC{\Dfi\-($-$)\-Threose} = \IUPAC{\cip{2S,3R}\-($-$)\-2,3,4\-Tri\|hydroxy\|butanal} +\end{LTXexample} \subsection{Lateinische Ausdrücke} -\NEU[1.1]Zuletzt gibt es noch zwei Befehle für gebräuchliche lateinische Ausdrücke. -\begin{itemize} - \item\lstinline=\insitu= \insitu - \item\lstinline=\abinitio= \abinitio -\end{itemize} -Falls ebenfalls das Paket `chemstyle' geladen wurde\footnote{`chemstyle' definiert weitere ähnliche Befehle wie \etal, \invacuo.}, wird für die Definition der `chem\-style'-Befehl \lstinline=\latin= verwendet. Das bedeutet, dass das Schriftbild dann durch die `chem\-style'-Einstellung \verb=abbremph= beeinflusst wird: -\begin{lstlisting} +Zuletzt gibt es noch zwei Befehle für gebräuchliche lateinische Ausdrücke. +\begin{framed} + \cmd{insitu} \insitu \\ + \cmd{abinitio} \abinitio +\end{framed} +Falls ebenfalls das Paket \paket{chemstyle} geladen wurde\footnote{\paket{chemstyle} definiert weitere ähnliche Befehle wie \etal, \invacuo.}, wird für die Definition der \paket{chemstyle}-Befehl \cmd{latin} verwendet. Das bedeutet, dass das Schriftbild dann durch die \paket{chemstyle}-Einstellung \code{abbremph} beeinflusst wird: +\begin{LTXexample} \insitu, \abinitio\\ \cstsetup{abbremph=false} \insitu, \abinitio -\end{lstlisting} -{\insitu, \abinitio\\ -\cstsetup{abbremph=false} -\insitu, \abinitio} - -Falls `chemstyle' nicht geladen wurde, werden sie \textit{kursiv} gesetzt. +\end{LTXexample} +Falls \paket{chemstyle} nicht geladen wurde, werden sie \textit{kursiv} gesetzt. -\section{Einheiten für `siunitx'}\label{sec:einheiten} -\NEU[1.1]Manche nicht-SI-Einheiten sind in der Chemie sehr gebräuchlich. `siunitx' bietet den Befehl \lstinline=\DeclareSIUnit{<command>}{<unit>}=, mit dem man beliebige Einheiten definieren kann. `\CMname' stellt einige damit definierte Einheiten zur Verfügung. Wie alle `siunitx'-Einheiten sind sie nur innerhalb von \lstinline=\SI{<num>}{<unit>}= und \lstinline=\si{<unit>}= definiert. +\section{Einheiten für \textsf{siunitx}}\label{sec:einheiten} +Manche nicht-SI-Einheiten sind in der Chemie sehr gebräuchlich. \paket{siunitx} bietet den Befehl \cmd{DeclareSIUnit\ma{<command>}\ma{<unit>}}, mit dem man beliebige Einheiten definieren kann. \CMname stellt einige damit definierte Einheiten zur Verfügung. Wie alle \paket{siunitx}-Einheiten sind sie nur innerhalb von \cmd{SI\ma{<num>}\ma{<unit>}} und \cmd{si\ma{<unit>}} definiert. \begin{itemize} - \item\lstinline=\atmosphere= \si{\atmosphere} - \item\lstinline=\atm= \si{\atm} - \item\lstinline=\calory= \si{\calory} - \item\lstinline=\cal= \si{\cal} - \item\lstinline=\cmc= \si{\cmc} {}\footnote[1]{Diese Einheiten werden auch durch `chemstyle' definiert. Sie werden durch `\CMname' nur definiert, wenn `chemstyle' nicht geladen wird.} - \item\lstinline=\molar= \si{\molar} {}\footnotemark[1] - \item\lstinline=\moLar= \si{\moLar} - \item\lstinline=\Molar= \si{\Molar} {}\footnotemark[1] - \item\lstinline=\MolMass= \si{\MolMass} - \item\lstinline=\normal= \si{\normal} - \item\lstinline=\torr= \si{\torr} + \item\cmd{atmosphere} \si{\atmosphere} + \item\cmd{atm} \si{\atm} + \item\cmd{calory} \si{\calory} + \item\cmd{cal} \si{\cal} + \item\cmd{cmc} \si{\cmc}\marginnote{Die Einheiten \cmd{cmc}, \cmd{molar} und \cmd{Molar} werden auch durch \paket{chemstyle} definiert. Sie werden durch \CMname nur definiert, wenn \paket{chemstyle} nicht geladen wird.} + \item\cmd{molar} \si{\molar} + \item\cmd{moLar} \si{\moLar} + \item\cmd{Molar} \si{\Molar} + \item\cmd{MolMass} \si{\MolMass} + \item\cmd{normal} \si{\normal} + \item\cmd{torr} \si{\torr} \end{itemize} -Übrigens: \lstinline=\mmHg= \si{\mmHg} ist durch `siunitx' und `chemstyle' bereits definiert. +\marginnote[-3\baselineskip]{Übrigens: \cmd{mmHg} \si{\mmHg} ist durch \paket{siunitx} und \paket{chemstyle} bereits definiert.} \section{Säure/Base}\label{sec:saeure_base} -\NEU[1.1]Einfache Darstellung von \pH, \pKa \ldots +Einfache Darstellung von \pH, \pKa \ldots\marginnote{Diese Befehle sind sowohl im Text- wie im Mathematikmodus und im \cmd{ce}-Befehl von \paket{mhchem} einsetzbar. Der Befehl \cmd{pKa} hängt von der Paketoption \code{german} ab, siehe Abschnitt \ref{sec:optionen}.} +\begin{framed} + \cmd{pH} \pH \\ + \cmd{pOH} \pOH \\ + \cmd{pKa\oa{<num>}} \cmd{pKa} \pKa, \cmd{pKa\oa{1}} \pKa[1] \\ + \cmd{pKb\oa{<num>}} \cmd{pKb} \pKb, \cmd{pKb\oa{1}} \pKb[1] \\ + \cmd{p\ma{<anything>}} \zB \cmd{p\ma{K\_w}} \p{K_w} +\end{framed} +\begin{LTXexample} + \pKa \pKa[1] \pKb \pKb[1]\\ + \chemsetup[option]{german=false} + \pKa \pKa[1] \pKb \pKb[1] +\end{LTXexample} + +\section{Oxidationszahlen, formale und echte Ladungen}\label{sec:ladungen} +\CMname unterscheidet zwischen realen ($+$/$-$) und formalen (\fplus/\fminus) Ladungssymbolen, siehe auch Abschnitt \ref{sec:optionen}. Alle Befehle für formale Symbole beginnen mit einem \code{f}. +\subsection{Ladungen}\label{ssec:ionen} +Einfaches Darstellen von (echten) Ladungen: +\begin{framed} + \cmd{pch\oa{<number>}} positive Ladung (\textbf{p}lus + \textbf{ch}arge) \\ + \cmd{mch\oa{<number>}} negative Ladung (\textbf{m}inus + \textbf{ch}arge) +\end{framed} +\begin{LTXexample} + \pch, Na\pch, Ca\pch[2]\\ + \mch, F\mch, S\mch[2] +\end{LTXexample} + +Entsprechendes Darstellen von formalen Ladungen: +\begin{framed} + \cmd{fpch\oa{<number>}} positive Ladung\\ + \cmd{fmch\oa{<number>}} negative Ladung +\end{framed} +\begin{LTXexample} + \fpch\ \fmch\ \fpch[3] \fmch[3] +\end{LTXexample} + +Es gibt einen Schlüssel, der das Verhalten der Ladungen beeinflusst\Key[false][charges]{append}{\uline{true}/false}. \begin{itemize} - \item\lstinline=\pH= \pH - \item\lstinline=\pOH= \pOH - \item\lstinline=\pKa[<num>]= \lstinline=\pKa= \pKa, \lstinline=\pKa[1]= \pKa[1] - \item\lstinline=\pKb[<num>]= \lstinline=\pKb= \pKb, \lstinline=\pKb[1]= \pKb[1] -\end{itemize} -Diese Befehle sind sowohl im Text- wie im Mathematikmodus und im \lstinline=\ce=-Befehl von `mhchem' einsetzbar. Der Befehl \lstinline=\pKa= hängt von der Paketoption \lstinline=german= ab, siehe Abschnitt \ref{sec:optionen}. - -\section{Oxidationszahlen und (echte) Ladungen}\label{sec:ladungen} -\subsection{Ionenladungen}\label{ssec:ionen} -Einfaches Darstellen von Ladungen: -\begin{itemize} - \item\lstinline=\pch[<number>]= positive Ladung (\textbf{p}lus + \textbf{ch}arge):\lstinline=\pch= \pch, \lstinline=Na\pch= Na\pch, \lstinline=Ca\pch[2]= Ca\pch[2] - \item\lstinline=\mch[<number>]= negative Ladung (\textbf{m}inus + \textbf{ch}arge): \lstinline=\mch= \mch, \lstinline=F\mch= F\mch, \lstinline=S\mch[2]= S\mch[2] + \item\code{append = \uline{true}/false} hängt bei \code{true} die Ladung mit einer leeren Gruppe an. \end{itemize} +Der Schlüssel hat folgende Auswirkung: +\begin{LTXexample} + \chemsetup[charges]{append=false} + \ce{H\pch\aq} \ce{H\aq\pch} + + \chemsetup[charges]{append=true} + \ce{H\pch\aq} \ce{H\aq\pch} +\end{LTXexample} +Auch wenn das Verhalten meistens unerwünscht sein mag, gibt es Fälle, in denen es sinnvoll sein kann, etwa in Kombination mit dem im nächsten Abschnitt besprochenen \cmd{ox}-Befehl: +\begin{LTXexample} + \chemsetup[charges]{append=false} + \ce{\ox{1,H}\pch\aq} + + \chemsetup[charges]{append=true} + \ce{\ox{1,H}\pch\aq} +\end{LTXexample} \subsection{Oxidationszahlen}\label{ssec:oxidationszahlen} -Setzen von Oxidationszahlen: +Setzen von Oxidationszahlen:\changed{ox} +\begin{framed} + \cmd{ox\oa{<keyval>}\ma{<number>,<atom>}} setzt \code{<number>} über \code{<atom>}\\ + {\small\code{<number>} muss eine (rationale) Zahl sein!} +\end{framed} +\begin{LTXexample} + \ox{+1,Na}, \ox{2,Ca}, \ox{-2,S}, \ox{-1,F} +\end{LTXexample} + +\newpage +Es gibt eine Reihe von Schlüssel/Wert-Paaren, die eingesetzt werden können, um den \cmd{ox}-Befehl zu modifizieren.\Key[true][ox]{parse}{\uline{true}/false}\Key[true][ox]{roman}{\uline{true}/false}\Key[top][ox]{pos}{top/super/side}\Key[false][ox]{explicit-sign}{\uline{true}/false}\Key[point][ox]{decimal-marker}{comma/point} \begin{itemize} - \item\lstinline=\ox{<number>,<atom>}= setzt \lstinline=<number>= über \lstinline=<atom>=; \lstinline=\ox{+1,Na}=, \lstinline=\ox{+I,Na}=, \lstinline=\ox{-2,S}=, \lstinline=\ox{-II,S}= \ox{+1,Na}, \ox{+I,Na}, \ox{-2,S}, \ox{-II,S} + \item\code{parse = \uline{true}/false} ermöglicht bei \code{false} eine beliebige Eingabe für \code{<number>}. + \item\code{roman = \uline{true}/false} wechselt die Darstellung von römischen zu arabischen Ziffern. + \item\code{pos = top/super/side} schreibt bei \code{top} \code{<number>} über \code{<atom>}, bei \code{super} rechts oben an \code{<atom>} und bei \code{side} rechts neben \code{<atom>} in Klammern. + \item\code{explicit-sign = \uline{true}/false} gibt auch bei Eingabe ohne Vorzeichen ein $+$ aus. + \item\code{decimal-marker = comma/point} Auswahl des Dezimalzeichens für formale Oxidationszahlen wie \ox{1.2,X}. \end{itemize} -Wenn das Paket `mhchem' geladen wurde, wird \lstinline=<atom>= innerhalb des \lstinline=\cf=-Befehls gesetzt: \lstinline=\ox{+II,Ca}\ox{-I,F2}= \ox{+II,Ca}\ox{-I,F2}. Ohne `mhchem' funktioniert das so nicht {\makeatletter\def\oxNoMhchem#1#2{\ensuremath{\overset{\text{\tiny\CM@ox@sign#1}}{\text{#2}}}}\makeatother(\oxNoMhchem{+II}{Ca}\oxNoMhchem{-I}{F2}) und die konventionelle Methode muss verwendet werden: \lstinline=\ox{+II,Ca}\ox{-I,F$_2$}= \oxNoMhchem{+II}{Ca}\oxNoMhchem{-I}{F$_2$}}. - -\subsection{Partialladungen und ähnliches}\label{ssec:partialladungen} +\begin{LTXexample} + \ox[roman=false]{2,Ca} \ox{2,Ca} \\ + \ox[pos=super]{3,Fe}-Oxid \\ + \ox[pos=side]{3,Fe}-Oxid \\ + \ox[parse=false]{\textcolor{red}{?},Mn} +\end{LTXexample} +Für die \code{pos=super}-Variante existiert noch der Shortcut \cmd{ox*}: +\begin{LTXexample} + \ox{3,Fe} \ox*{3,Fe} +\end{LTXexample} +Durch die Verwendung des \code{explicit-sign}-Schlüssels wird das Vorzeichen der Oxidationszahl immer angezeigt: +\begin{LTXexample} + \chemsetup[ox]{explicit-sign = true} + \ox{+1,Na}, \ox{2,Ca}, \ox{-2,S}, \ox{0,F2} +\end{LTXexample} +Im letzten Beispiel haben Sie gesehen, dass \code{<atom>} intern \paket{mhchem}s \cmd{ce}-Befehl gesetzt wird. Allerdings liefert es nicht immer die besten Ergebnisse, diese Tatsache auszunutzen. +\begin{LTXexample}[pos=b] + Vergleichen Sie \ox{-1,O2^{2-}} mit \ce{\ox{-1,O}{}_2 \mch[2]} oder \ce{\ox{-1,O}{}_2^{2-}}. +\end{LTXexample} +Manchmal benötigt man vielleicht formal gebrochene Oxidationszahlen wie \num{.5} oder $\frac{1}{3}$. Das ist möglich: +\begin{LTXexample}[pos=b] + \ox{.5,Br2+} \ox{1/3,I3+} \ce{\ox{.5,Br}{}_2^+} \ce{\ox{1/3,I}{}_3^+} +\end{LTXexample} + +\subsection{Partialladungen und Ähnliches}\label{ssec:partialladungen} Vielleicht selten gebraucht, nichtsdestoweniger nützlich: -\begin{itemize} - \item\lstinline=\delp= \delp (\textbf{del}ta + \textbf{p}lus) - \item\lstinline=\delm= \delm (\textbf{del}ta + \textbf{m}inus) -\end{itemize} -Diese Makros können zum Beispiel mit dem \lstinline=\ox=-Befehl eingesetzt werden oder zusammen mit dem Paket \paket{chemfig}: -\begin{lstlisting} - \ox{\delp,H}\ox{\delm,Cl}\par +\begin{framed} + \cmd{delp} \delp\ (\textbf{del}ta + \textbf{p}lus) \\ + \cmd{delm} \delm\ (\textbf{del}ta + \textbf{m}inus) \\ + \cmd{fdelp} \fdelp \\ + \cmd{fdelm} \fdelm +\end{framed} +Diese Makros können zum Beispiel mit dem \cmd{ox}-Befehl eingesetzt werden oder zusammen mit dem Paket \paket{chemfig}: +\begin{LTXexample}[pos=b] + \chemsetup{ + option/circled = all, + ox/parse = false + } + \ox{\delp,H}\ox{\delm,Cl} \hspace*{1cm} \chemfig{\chemabove[3pt]{\lewis{246,Br}}{\delm}-\chemabove[3pt]{H}{\delp}} -\end{lstlisting} -\ox{\delp,H}\ox{\delm,Cl}\par -\chemfig{\chemabove[3pt]{\lewis{246,Br}}{\delm}-\chemabove[3pt]{H}{\delp}} - -Auch die beiden folgenden Makros sind v.a. beim Einsatz mit `chemfig' nützlich. -\begin{itemize} - \item\lstinline=\scrp= \scrp (\textbf{scr}iptstyle + \textbf{p}lus) - \item\lstinline=\scrm= \scrm (\textbf{scr}iptstyle + \textbf{m}inus) -\end{itemize} -Zum Beispiel: -\begin{lstlisting} - {\setatomsep{1.8em}\chemfig{CH_3-\chemabove{C}{\scrp}(-[6]C|H_3)-\vphantom{H_3}CH_3}} -\end{lstlisting} -{\setatomsep{1.8em}\chemfig{CH_3-\chemabove{C}{\scrp}(-[6]C|H_3)-\vphantom{H_3}CH_3}} +\end{LTXexample} + +Auch die folgenden Makros sind \va beim Einsatz mit \paket{chemfig} nützlich. +\begin{framed} + \cmd{scrp} \scrp (\textbf{scr}iptstyle + \textbf{p}lus) \\ + \cmd{scrm} \scrm (\textbf{scr}iptstyle + \textbf{m}inus) \\ + \cmd{fscrp} \fscrp \\ + \cmd{fscrm} \fscrm +\end{framed} +\begin{LTXexample}[pos=b,rframe=] + \setatomsep{1.8em}\chemfig{CH_3-\chemabove{C}{\scrp}(-[6]C|H_3)-\vphantom{H_3}CH_3} + + \chemfig{\fmch{}|O-\chemabove{N}{\fscrp}(-[1]O|\fmch)-[7]O|\fmch} +\end{LTXexample} +\newpage \section{Reaktionsmechanismen}\label{sec:mechanismen} -\NEU[1.1]Der Befehl -\begin{lstlisting} - \mech[<type>] -\end{lstlisting} -erlaubt die Angabe der verbreitetsten Reaktionsmechanismen. \lstinline=<type>= kann einer der folgenden Werte annehmen: +Der Befehl\marginnote{Dieser Befehl ist auch in Mathematikumgebungen und im \cmd{ce}-Befehl von \paket{mhchem} einsetzbar.} +\begin{framed} + \cmd{mech\oa{<type>}} +\end{framed} +erlaubt die Angabe der verbreitetsten Reaktionsmechanismen. \code{<type>} kann verschiedene Werte annehmen: \begin{itemize} - \item\lstinline+<type>=+ (leer, kein opt. Argument) nukleophile Substitution \lstinline=\mech= \mech - \item\lstinline+<type>=1+ unimolekulare nukleophile Substitution \lstinline=\mech[1]= \mech[1] - \item\lstinline+<type>=2+ bimolekulare nukleophile Substitution \lstinline=\mech[2]= \mech[2] - \item\lstinline+<type>=se+ elektrophile Substitution \lstinline=\mech[se]= \mech[se] - \item\lstinline+<type>=1e+ unimolekulare elektrophile Substitution \lstinline=\mech[1e]= \mech[1e] - \item\lstinline+<type>=2e+ bimolekulare elektrophile Substitution \lstinline=\mech[2e]= \mech[2e] - \item\lstinline+<type>=ar+ elektrophile Substitution am Aromaten \lstinline=\mech[ar]= \mech[ar] - \item\lstinline+<type>=e+ Eliminierung \lstinline=\mech[e]= \mech[e] - \item\lstinline+<type>=1+ unimolekulare Eliminierung \lstinline=\mech[e1]= \mech[e1] - \item\lstinline+<type>=2+ bimolekulare Eliminierung \lstinline=\mech[e2]= \mech[e2] - \item\lstinline+<type>=cb+ unimolekulare Eliminierung "`conjugated base"', also über Carbanion als Zwischenstufe \lstinline=\mech[cb]= \mech[cb] + \item\cmd{mech} (leer, kein opt. Argument) nukleophile Substitution \mech + \item\cmd{mech\oa{1}} unimolekulare nukleophile Substitution \mech[1] + \item\cmd{mech\oa{2}} bimolekulare nukleophile Substitution \mech[2] + \item\cmd{mech\oa{se}} elektrophile Substitution \mech[se] + \item\cmd{mech\oa{1e}} unimolekulare elektrophile Substitution \mech[1e] + \item\cmd{mech\oa{2e}} bimolekulare elektrophile Substitution \mech[2e] + \item\cmd{mech\oa{ar}} elektrophile Substitution am Aromaten \mech[ar] + \item\cmd{mech\oa{e}} Eliminierung \mech[e] + \item\cmd{mech\oa{e1}} unimolekulare Eliminierung \mech[e1] + \item\cmd{mech\oa{e2}} bimolekulare Eliminierung \mech[e2] + \item\cmd{mech\oa{cb}} unimolekulare Eliminierung "`conjugated base"', also über Carbanion als Zwischenstufe \mech[cb] \end{itemize} -Dieser Befehl ist auch in Mathematikumgebungen und im \lstinline=\ce=-Befehl von `mhchem' einsetzbar. -\begin{lstlisting} - $\mech[cb]$ \ce{\mech[2]} \ce{\mech[ar]} -\end{lstlisting} -$\mech[cb]$ \ce{\mech[2]} \ce{\mech[ar]} \section{Redoxreaktionen}\label{sec:redoxreaktionen} -`\CMname' stellt zwei Befehle zur Verfügung\footnote{Dank an \href{http://www.mathannotated.com/}{Peter Cao}, der das Feature vorschlug.}, mit denen die Elek\-tro\-nen\-ü\-ber\-tra\-gungen bei Redoxreaktionen angezeigt werden können. Die Befehle verwenden `\TikZ'. -\begin{lstlisting} - \OX{<name>,<atom>} - \redox(<name1>,<name2>)[<tikz>][<dim>]{<text>} -\end{lstlisting} -Mit \lstinline=\OX= wird ein \lstinline=<atom>= in eine Node geschrieben, die den Namen \lstinline=<name>= bekommt. Hat man zwei \lstinline=\OX= gesetzt, können Sie durch \lstinline=\redox= mit einen Linie verbunden werden. Dazu werden die Namen der zu verbindenen Nodes in die Runden Klammern geschrieben. Da \lstinline=\redox= ein Tikzpicture mit den Optionen \lstinline=remember picture,overlay= zeichnet, muss das Dokument \emph{mindestens zweimal kompiliert} werden. -\begin{lstlisting} +\CMname stellt zwei Befehle zur Verfügung\footnote{Dank an \href{http://www.mathannotated.com/}{Peter Cao}, der das Feature vorschlug.}, mit denen die Elek\-tro\-nen\-ü\-ber\-tra\-gungen bei Redoxreaktionen angezeigt werden können. Die Befehle verwenden \TikZ. +\begin{framed} + \cmd{OX\ma{<name>,<atom>}}\\ + \cmd{redox\da{<name1>,<name2>}\oa{<tikz>}\oa{<num>}\ma{<text>}} +\end{framed} +Mit \cmd{OX} wird ein \code{<atom>} in eine Node geschrieben, die den Namen \code{<name>} bekommt. Hat man zwei \cmd{OX} gesetzt, können Sie durch \cmd{redox} mit einer Linie verbunden werden. Dazu werden die Namen der zu verbindenen Nodes in die Runden Klammern geschrieben. Da \cmd{redox} ein \TikZ{}picture mit den Optionen \code{remember picture,overlay} zeichnet, muss das Dokument \emph{mindestens zweimal kompiliert} werden. +\begin{LTXexample}[rframe=] \OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b){oxidation} -\end{lstlisting} -\OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b){oxidation} - -Die Linie kann via \lstinline=<tikz>= mit `\TikZ'-Keys angepasst werden: -\begin{lstlisting} +\end{LTXexample} +Die Linie kann mit dem Argument \oa{<tikz>} mit \TikZ-Keys angepasst werden: +\begin{LTXexample}[rframe=] \OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b)[->,red]{ox} -\end{lstlisting} -\OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b)[->,red]{ox} - -\NEU[1.1]Mit \lstinline=<dim>= kann die Länge der vertikalen Linie festgelegt werden. Diese ist per Default \lstinline=.6em= lang. Diese Default-Länge wird mit \lstinline=<dim>= multipliziert. Gibt man hier einen negativen Wert an, wird die Linie \emph{unterhalb} des Textes geschrieben. -\begin{lstlisting} +\end{LTXexample} +Mit dem Argument \oa{<num>} kann die Länge der vertikalen Linie festgelegt werden. Diese ist per Default \code{.6em} lang. Diese Default-Länge wird mit \code{<num>} multipliziert. Gibt man hier einen negativen Wert an, wird die Linie \emph{unterhalb} des Textes geschrieben. +\begin{LTXexample}[rframe=] \OX{a,Na} $\rightarrow$ \OX{b,Na}\pch \redox(a,b)[->,red]{ox} \redox(a,b)[<-,blue][-1]{red} -\end{lstlisting} -\OX{a,Na} $\rightarrow$ \OX{b,Na}\pch -\redox(a,b)[->,red]{ox} -\redox(a,b)[<-,blue][-1]{red} -\vskip2mm - -Die Default-Länge der vertikalen Linien kann mit \lstinline=\setredoxdist{<length>}= angepasst werden: -\begin{lstlisting} - \OX{a,A} $\rightarrow$ \OX{b,B} - \redox(a,b){} - \bigskip - \setredoxdist{1em} - \OX{a,A} $\rightarrow$ \OX{b,B} - \redox(a,b){} -\end{lstlisting} -{\OX{a,A} $\rightarrow$ \OX{b,B} -\redox(a,b){} -\bigskip -\setredoxdist{1em} -\OX{a,A} $\rightarrow$ \OX{b,B} -\redox(a,b){}} - -Mit einem leeren Argument wird die Voreinstellung wieder hergestellt. - -Die Befehle funktionieren auch mit dem `mhchem'-Befehl \lstinline=\ce= und in Verbindung mit dem \lstinline=\ox=-Befehl (Abschnitt \ref{ssec:oxidationszahlen}). -\begin{lstlisting} +\end{LTXexample} +Die Default-Länge kann mit der Schlüssel\Key[.6em][redox]{dist}{<dim>} \code{dist} geändert werden. +\begin{LTXexample}[rframe=] + \chemsetup{redox/dist=1em} + \OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b)[->,red]{ox} +\end{LTXexample} +Zusätzlich kann mit dem Key\Key[.2em][redox]{sep}{<dim>} \code{sep} der Abstand zwischen Linienbeginn und Atom geändert werden. +\begin{LTXexample}[rframe=] + \chemsetup{redox/sep=.5em} + \OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b)[->,red]{ox} +\end{LTXexample} + +Beispiele: +\begin{LTXexample}[rframe=] \ce{ 2 \OX{o1,Na} + \OX{r1,Cl2} -> 2 \OX{o2,Na}\pch + 2 \OX{r2,Cl}\mch } \redox(o1,o2){\small OX: $- 2\el$} \redox(r1,r2)[][-1]{\small RED: $+ 2\el$} -\end{lstlisting} -\ce{ 2 \OX{o1,Na} + \OX{r1,Cl2} -> 2 \OX{o2,Na}\pch + 2 \OX{r2,Cl}\mch } -\redox(o1,o2){\small OX: $- 2\el$} -\redox(r1,r2)[][-1]{\small RED: $+ 2\el$} -\vskip1cm - -\begin{lstlisting} - \ce{ 2 \OX{o1,\ox{0,Na}} + \OX{r1,\ox{0,Cl2}} -> 2 \OX{o2,\ox{+I,Na}}\pch + 2 \OX{r2,\ox{-I,Cl}}\mch } +\end{LTXexample} +\begin{LTXexample}[rframe=] + \chemsetup[charges]{append} + \ce{ 2 \OX{o1,\ox{0,Na}} + \OX{r1,\ox{0,Cl2}} -> 2 \OX{o2,\ox{+1,Na}}\pch + 2 \OX{r2,\ox{-1,Cl}}\mch } \redox(o1,o2){\small OX: $- 2\el$} \redox(r1,r2)[][-1]{\small RED: $+ 2\el$} -\end{lstlisting} -\ce{ 2 \OX{o1,\ox{0,Na}} + \OX{r1,\ox{0,Cl2}} -> 2 \OX{o2,\ox{+I,Na}}\pch + 2 \OX{r2,\ox{-I,Cl}}\mch } -\redox(o1,o2){\small OX: $- 2\el$} -\redox(r1,r2)[][-1]{\small RED: $+ 2\el$} -\vskip1cm - -\begin{lstlisting} - \ce{ 2 \OX{o1,\ox{0,Na}} + \OX{r1,\ox{0,Cl2}} -> 2 \OX{o2,\ox{+I,Na}}\pch + 2 \OX{r2,\ox{-I,Cl}}\mch } +\end{LTXexample} +\begin{LTXexample}[rframe=] + \chemsetup[charges]{append} + \ce{ 2 \OX{o1,\ox{0,Na}} + \OX{r1,\ox{0,Cl2}} -> 2 \OX{o2,\ox{+1,Na}}\pch + 2 \OX{r2,\ox{-1,Cl}}\mch } \redox(o1,o2)[draw=red,->][3.33]{\small OX: $- 2\el$} \redox(r1,r2)[draw=blue,->]{\small RED: $+ 2\el$} -\end{lstlisting} -\vskip1cm -\ce{ 2 \OX{o1,\ox{0,Na}} + \OX{r1,\ox{0,Cl2}} -> 2 \OX{o2,\ox{+I,Na}}\pch + 2 \OX{r2,\ox{-I,Cl}}\mch } -\redox(o1,o2)[draw=red,->][3.33]{\small OX: $- 2\el$} -\redox(r1,r2)[draw=blue,->]{\small RED: $+ 2\el$} - -\begin{lstlisting} - \ce{ 2 \OX{o1,\ox{0,Na}} + \OX{r1,\ox{0,Cl2}} -> 2 \OX{o2,\ox{+I,Na}}\pch + 2 \OX{r2,\ox{-I,Cl}}\mch } + \end{LTXexample} +\begin{LTXexample}[rframe=] + \chemsetup[charges]{append} + \ce{ 2 \OX{o1,\ox{0,Na}} + \OX{r1,\ox{0,Cl2}} -> 2 \OX{o2,\ox{+1,Na}}\pch + 2 \OX{r2,\ox{-1,Cl}}\mch } \redox(o1,o2)[green,-stealth]{\small OX: $- 2\el$} \redox(r1,r2)[purple,-stealth][-1]{\small RED: $+ 2\el$} -\end{lstlisting} -\ce{ 2 \OX{o1,\ox{0,Na}} + \OX{r1,\ox{0,Cl2}} -> 2 \OX{o2,\ox{+I,Na}}\pch + 2 \OX{r2,\ox{-I,Cl}}\mch } -\redox(o1,o2)[red,-stealth]{\small OX: $- 2\el$} -\redox(r1,r2)[blue,-stealth][-1]{\small RED: $+ 2\el$} -\vskip1cm +\end{LTXexample} + +In v1.1 gab es noch den Befehl \cmd{setredoxdist\ma{<dim>}}\formercmd{setredoxdist\ma{<dim>}}. Mit Laden der Paketoption \code{version=1} wird er bereitgestellt. +\newpage \section{(Standard) Zustand, Thermodynamik}\label{sec:standardstate} \subsection{Thermodynamische Größen}\label{ssec:siunitx} -Die folgenden Befehle verwenden `siunitx': +Die folgenden Befehle verwenden \paket{siunitx}:\changed{Enthalpy}\changed{Entropy}\changed{Gibbs} +\begin{framed} + \cmd{Enthalpy\oa{<keyval>}\da{<subscript>}\ma{<value>}} \\ + \cmd{Entropy\oa{<keyval>}\da{<subscript>}\ma{<value>}} \\ + \cmd{Gibbs\oa{<keyval>}\da{<subscript>}\ma{<value>}} +\end{framed} +Ihr Einsatz ist eigentlich selbsterklärend: +\begin{LTXexample} + \Enthalpy{123} \\ + \Entropy{123} \\ + \Gibbs{123} +\end{LTXexample} +Das Argument \da{<subscript>} fügt ein Subskript zur Spezifikation hinzu: \cmd{Enthalpy\da{r}\ma{123}} \Enthalpy(r){123}. + +Mit mehreren Schlüsseln kann das Erscheinungsbild angepasst werden.\Key[\cmd{standardstate}](thermo){exponent}{<anything>}\Key(thermo){delta}{<anything>/false}\Key(thermo){subscript}{left/right}\Key(thermo){unit}{<unit>} \begin{itemize} - \item\lstinline=\Enthalpy[<sub>,<sup>,<unit>,<subscript pos>]{<value>}= - \item\lstinline=\Entropy[<sub>,<sup>,<unit>,<subscript pos>]{<value>}= - \item\lstinline=\Gibbs[<sub>,<sup>,<unit>,<subscript pos>]{<value>}= + \item\code{exponent = <anything>} + \item\code{delta = <anything>/false} + \item\code{subscript = left/right} + \item\code{unit = <unit>} \end{itemize} -Ihr Einsatz ist eigentlich selbsterklärend:\\ -mit \lstinline=\Enthalpy{123}= wird \Enthalpy{123} gesetzt.\\ -Möchte man genauer spezifizieren, wofür die Enthalpie gelten soll (Reaktion, Bildung, \ldots), kann man das über das erste optionale Argument (\lstinline=<sub>=) machen:\\ -\lstinline=\Enthalpy[r]{123}= \Enthalpy[r]{123}\\ -\lstinline=\Enthalpy[Subl.,,,right]{123}= \Enthalpy[Subl.,,,right]{123} - -\NEU[1.1]Im letzten Beispiel haben Sie auch gleich den Einsatz des vierten optionalen Arguments (\lstinline=<subscript pos>=) gesehen: es bestimmt, ob das Subskript links oder rechts von Symbol eingesetzt wird und kann die Werte \lstinline=left= (oder leer) oder \lstinline=right= annehmen. - -Das Standardzustandssymbol kann durch das zweite optionale Argument (\lstinline=<sup>=) ersetzt werden\ldots\\ -\lstinline=\Enthalpy[,\transitionstatesymbol]{123}= \Enthalpy[,\transitionstatesymbol]{123}\\ -\ldots und ist sonst abhängig davon, ob das Paket `chemstyle' geladen wurde, siehe Abschnitt \ref{standardstate}. - -Mit dem dritten optionalen Argument (\lstinline=<unit>=) schließlich kann die Einheit geändert werden:\\ -\lstinline=\Enthalpy[,,\kilo\calory\per\mole]{123}= \Enthalpy[,,\kilo\calory\per\mole]{123}\\ -Die Einheit wird jeweils entsprechend der Regeln von `siunitx' gesetzt und hängt von den dort gewählten Optionen ab. -\begin{lstlisting} - \Enthalpy{-1234.56e3}\par +Die Default-Einstellungen sind je nach Befehl unterschiedlich. +\begin{LTXexample} + \Enthalpy[unit=\kilo\joule]{-285} \\ + \Gibbs[delta=false]{0} \\ + \Entropy[delta=\Delta,exponent=]{56.7} +\end{LTXexample} +Die Einheit wird jeweils entsprechend der Regeln von \paket{siunitx} gesetzt und hängt von den dort gewählten Optionen ab. +\begin{LTXexample}[pos=b] + \Enthalpy{-1234.56e3} \\ \sisetup{per-mode=symbol,exponent-product=\cdot,output-decimal-marker={,},group-four-digits=true} \Enthalpy{-1234.56e3} -\end{lstlisting} -{\Enthalpy{-1234.56e3}\par -\sisetup{per-mode=symbol,exponent-product=\cdot,output-decimal-marker={,},group-four-digits=true} -\Enthalpy{-1234.56e3}} - -Ganz entsprechendes gilt für -\begin{lstlisting} - \Entropy{12.3}, \Gibbs{-12.3}. -\end{lstlisting} -\Entropy{12.3}, \Gibbs{-12.3}. +\end{LTXexample} +\newpage \subsubsection{Neue Größen definieren} -Mit dem Befehl -\begin{lstlisting} - \setnewstate[<standard sup>,<Delta symbol>,<subscript pos>]{<name>}{<symbol>}{<unit>} -\end{lstlisting} -können Sie auch neue entsprechende Befehle festlegen: -\begin{lstlisting} +Mit dem Befehl\changed{setnewstate} +\begin{framed} + \cmd{setnewstate\oa{<keyval>}\ma{<name>}\ma{<symbol>}\ma{<unit>}} +\end{framed} +können Sie auch neue entsprechende Befehle festlegen:\Key[\cmd{standardstate}](newstate){exponent}{<anything>}\Key[\cmd{Delta}](newstate){delta}{<anything>/false}\Key[true](newstate){subscript-left}{true/false}\Key(newstate){subscript}{<anything>} +\begin{LTXexample} \setnewstate{Helmholtz}{A}{\kilo\joule\per\mole} - \setnewstate[ ,,right]{ElPot}{E}{\volt} - \Helmholtz{123.4} \ElPot{-1.1} \ElPot[\ce{Sn}|\ce{Sn \pch[2]}||\ce{Pb \pch[2]}|\ce{Pb},0]{0.01} -\end{lstlisting} -{\setnewstate{Helmholtz}{A}{\kilo\joule\per\mole}\setnewstate[ ,,right]{ElPot}{E}{\volt}\Helmholtz{123.4} \ElPot{-1.1} \ElPot[\ce{Sn}|\ce{Sn \pch[2]}||\ce{Pb \pch[2]}|\ce{Pb},0]{0.01} - -Wie Sie sehen, hat \lstinline=\ElPot= durch die Definition sein Subskript nun per Default rechts. Natürlich lässt es sich durch Angabe der Option \lstinline=\ElPot[r,,,left]{0.12}= immer noch nach links setzen: \ElPot[r,,,left]{0.12} (auch wenn das in diesem Fall vielleicht wenig sinnvoll ist).} - -Tatsächlich wurden -\begin{lstlisting} - \Enthalpy, \Entropy, \Gibbs -\end{lstlisting} -über -\begin{lstlisting} - \setnewstate{Enthalpy}{H}{\kilo\joule\per\mole} - \setnewstate[, ]{Entropy}{S}{\joule\per\kelvin\per\mole} - \setnewstate{Gibbs}{G}{\kilo\joule\per\mole} -\end{lstlisting} -definiert. + \setnewstate[subscript-left=false,exponent=]{ElPot}{E}{\volt} + \Helmholtz{123.4} \\ + \ElPot{-1.1} \\ + \ElPot[exponent=0]($\ce{Sn}|\ce{Sn \pch[2]}||\ce{Pb \pch[2]}|\ce{Pb}$){0.01} +\end{LTXexample} + +Der Befehl hat einige Schlüssel, mit denen die Default-Einstellungen des neuen Befehls festgelegt werden können. +\begin{itemize} + \item\code{exponent = <anything>} + \item\code{delta = <anything>/false} + \item\code{subscript-left = true/false} + \item\code{subscript = <anything>} +\end{itemize} \subsubsection{Größen umdefinieren} -\NEU[1.1]Mit -\begin{lstlisting} - \renewstate[<standard sup>,<Delta symbol>,<subscript pos>]{<name>}{<symbol>}{<unit>} -\end{lstlisting} +Mit\changed{renewstate} +\begin{framed} + \cmd{renewstate\oa{<keyval>}\ma{<name>}\ma{<symbol>}\ma{<unit>}} +\end{framed} können Sie die vordefinierten Befehle überschreiben: -\begin{lstlisting} +\begin{LTXexample} \renewstate{Enthalpy}{h}{\joule} - \Enthalpy[f]{12.5} -\end{lstlisting} -{\renewstate{Enthalpy}{h}{\joule}\Enthalpy[f]{12.5}} - -Um thermodynamischen Konventionen zu folgen, könnte man also eine molare und eine absolute Größe definieren: -\begin{lstlisting} - \setnewstate[ ]{enthalpy}{h}{\kilo\joule\per\mole}% molar - \renewstate[ ]{Enthalpy}{H}{\kilo\joule}% absolut + \Enthalpy(f){12.5} +\end{LTXexample} +Der Befehl verhält sich absolut analog zu \cmd{setnewstate}, \dh er hat die gleichen Schlüssel. + +Um thermodynamischen Konventionen zu folgen, könnte man nun eine molare und eine absolute Größe definieren: +\begin{LTXexample} + \setnewstate[exponent=]{enthalpy}{h}{\kilo\joule\per\mole}% molar + \renewstate[exponent=]{Enthalpy}{H}{\kilo\joule}% absolut \enthalpy{-12.3} \Enthalpy{-12.3} -\end{lstlisting} -{\setnewstate[ ]{enthalpy}{h}{\kilo\joule\per\mole}% molar -\renewstate[ ]{Enthalpy}{H}{\kilo\joule}% absolut -\enthalpy{-12.3} \Enthalpy{-12.3} -} +\end{LTXexample} \subsection{State}\label{ssec:state} -Die in Abschnitt \ref{ssec:siunitx} vorgestellten Befehle verwenden intern alle den Befehl -\begin{lstlisting} - \State[<sup>,<Delta symbol>,<subscript pos>]{<symbol>}{<subscript>} -\end{lstlisting} -Mit diesem Befehl können die thermodynamischen Größen auch ohne Zahl und Einheit angegeben werden. Beachten Sie, dass \lstinline={<subscript>}= ein \emph{optionales} Argument ist. +Die in Abschnitt \ref{ssec:siunitx} vorgestellten Befehle verwenden intern alle den Befehl\marginnote{Beachten Sie, dass \ma{<subscript>} ein \emph{optionales} Argument ist.}\changed{State} +\begin{framed} + \cmd{State\oa{<keyval>}\ma{<symbol>}\ma{<subscript>}} +\end{framed} +Mit diesem Befehl können die thermodynamischen Größen auch ohne Zahl und Einheit angegeben werden. + +Beispiele:\Key[\cmd{standardstate}][state](state){exponent}{<anything>}\Key[true][state](state){subscript-left}{true/false}\Key[\cmd{Delta}][state](state){delta}{<anything>/false} +\begin{LTXexample} + \State{A}, \State{G}{f}, \State[subscript-left=false]{E}{\ce{Na}}, \State[exponent=\SI{1000}{\celsius}]{H} +\end{LTXexample} + +Wieder gibt es eine Reihe Schlüssel, mit denen das Erscheinungsbild angepasst werden kann: +\begin{itemize} + \item\code{exponent = <anything>} + \item\code{subscript-left = true/false} + \item\code{delta = <anything>/false} +\end{itemize} -Beispiele: -\begin{lstlisting} - \State{A}, \State{G}{f}, \State[ ,,right]{E}{\ce{Na}}, \State[\SI{1000}{\celsius}]{H} -\end{lstlisting} -\State{A}, \State{G}{f}, \State[ ,,right]{E}{\ce{Na}}, \State[\SI{1000}{\celsius}]{H} - -Zugegeben: nicht in jedem Fall ist ist das einfacher oder bequemer als die direkte Eingabe wie zum Beispiel \lstinline=$\Delta E_\ce{Na}$= $\Delta E_\ce{Na}$. Die Beispiele sollen lediglich verdeutlichen, wie der Befehl funktioniert und eingesetzt werden \emph{kann}. Im ersten Fall spart man sicher Zeit gegenüber \lstinline=$\Delta_\mathrm{f}G^\standardstate$= $\Delta_\mathrm{f}G^\standardstate$. - -\label{standardstate}Das Standardzustandssymbol \standardstate\ wird nur angezeigt, wenn das Paket `chemstyle' geladen wurde und mit dem Befehl \lstinline=\standardstate= zur Verfügung steht. Sonst wird das Symbol \lstinline=\circ= $\circ$ verwendet. \lstinline=\State{A}{b}=: Wenn `chemstyle' geladen wurde \State{A}{b}, sonst \State[\circ]{A}{b}. - -\NEU[1.1]Mit dem Befehl -\begin{lstlisting} - \setstatesubscript{<subscript pos>} -\end{lstlisting} -kann man die Voreinstellung der Subskript-Position festlegen. Wie Sie sicher schon festgestellt haben, ist sie per Default \lstinline=left=. -\begin{lstlisting} - \State{A}{b}\\ - \setstatesubscript{right} - \State{A}{b} -\end{lstlisting} -{\State{A}{b}\\ - \setstatesubscript{right} - \State{A}{b}} - -Diese Einstellung hat \emph{keinen Einfluss} auf die Funktionsweise von \lstinline=\setnewstate= und \lstinline=\renewstate=. +In v1.1 gab es noch den Befehl \cmd{setstatesubscript\ma{<subscript pos>}}\formercmd{setstatesubscript\ma{<subscript pos>}}. Mit Laden der Paketoption \code{version=1} wird er bereitgestellt. +\newpage \section{Spektroskopie}\label{sec:spektroskopie} -\NEU[1.1]Wenn Substanzen darauf untersucht werden, ob sie sind, was sie sein wollen, kommt man in der Regel um die NMR-Spektroskopie nicht herum. Dabei werden die Messergebnisse oft in der Form \NMR(400)[CDCl3] = \num{1.59} (q, 1\ce{H}, \textit{J} = \SI{11.6}{\hertz}, \ce{H}-4)\ldots\ angegeben. `\CMname' stellt einen Befehl zur Verfügung, der diese Angaben vereinfachen soll (verwendet `siunitx'). -\begin{lstlisting} - \NMR{<num>,<elem>}(<num>,<unit>)[<solvent>] - \NMR*{<num>,<elem>}(<num>,<unit>)[<solvent>] -\end{lstlisting} -\emph{Alle} Argumente dieses Befehls sind optional. In der einfachsten Eingabe liefert der Befehl: -\begin{itemize} - \item\lstinline=\NMR= {\NMR} (entspricht weitestgehend dem `bpchem'-Befehl \lstinline=\HNMR=) - \item\lstinline=\NMR*= {\NMR*} (Ausgabe ohne \verb=: $\delta$=) -\end{itemize} +Wenn Substanzen darauf untersucht werden, ob sie sind, was sie sein wollen, kommt man in der Regel um die NMR-Spektroskopie nicht herum. Dabei werden die Messergebnisse oft in der Form \NMR(400)[CDCl3] = \num{1.59} (q, 1\ce{H}, \textit{J} = \SI{11.6}{\hertz}, \ce{H}-4)\ldots\ angegeben. \CMname stellt einen Befehl zur Verfügung, der diese Angaben vereinfachen soll (verwendet \paket{siunitx}). +\begin{framed} + \cmd{NMR\ma{<num>,<elem>}\da{<num>,<unit>}\oa{<solvent>}} \\ + \cmd{NMR*\ma{<num>,<elem>}\da{<num>,<unit>}\oa{<solvent>}} +\end{framed} +\emph{Alle} Argumente dieses Befehls sind optional.\marginnote[\baselineskip]{Wenn Sie wollen, dass das Erscheinungsbild mit dem von \paket{bpchem} übereinstimmt (\vgl \paket{bpchem}-Befehl \cmd{HNMR} \HNMR und \CMname-Befehl \cmd{NMR} \NMR), dann verwenden Sie die Paketoption \code{bpchem} (siehe Abschnitt \ref{sec:optionen}).}\marginnote[\baselineskip]{Alle Argumente können beliebig kombiniert werden, der Befehl kann außerdem auch im Mathematikmodus verwendet werden.} +\begin{LTXexample} + \NMR \\ + \NMR* +\end{LTXexample} Mit dem ersten Argument lässt die die Art der NMR ändern: -\begin{itemize} - \item\lstinline=\NMR{13,C}= \NMR{13,C} - \item\lstinline=\NMR*{13,C}= \NMR*{13,C} -\end{itemize} +\begin{LTXexample} + \NMR{13,C} +\end{LTXexample} Mit dem zweiten Argument kann die bei der Messung verwendete Frequenz (in \si{\mega\hertz}) angegeben werden: -\begin{itemize} - \item\lstinline=\NMR(400)= \NMR(400) - \item\lstinline=\NMR*(400)= \NMR*(400) -\end{itemize} +\begin{LTXexample} + \NMR(400) +\end{LTXexample} Die verwendete Einheit kann durch explizite Angabe geändert werden: -\begin{itemize} - \item\lstinline=\NMR(4e8,\hertz)= \NMR(4e8,\hertz) - \item\lstinline=\NMR*(4e8,\hertz)= \NMR*(4e8,\hertz) -\end{itemize} -Das Setup von `siunitx' wirkt sich ebenfalls auf diesen Befehl aus: -\begin{itemize} - \item\lstinline+\sisetup{exponent-product=\cdot}\NMR(4e8,\hertz)+ {\sisetup{exponent-product=\cdot}\NMR(4e8,\hertz)} - \item\lstinline+\sisetup{exponent-product=\cdot}\NMR*(4e8,\hertz)+ {\sisetup{exponent-product=\cdot}\NMR*(4e8,\hertz)} -\end{itemize} +\begin{LTXexample} + \NMR(4e8,\hertz) +\end{LTXexample} +Das Setup von \paket{siunitx} wirkt sich ebenfalls auf diesen Befehl aus: +\begin{LTXexample} + \sisetup{exponent-product=\cdot}\NMR(4e8,\hertz) +\end{LTXexample} Mit dem dritten Argument schließlich kann der verwendete Standard spezifiziert werden: -\begin{itemize} - \item\lstinline=\NMR[CDCl3]= \NMR[CDCl3] - \item\lstinline=\NMR*[CDCl3]= \NMR*[CDCl3] -\end{itemize} -Das Lösungsmittel wird abhängig davon, ob Sie `mhchem' verwenden, in den \lstinline=\ce=-Befehl gesetzt. Wenn Sie `mhchem' nicht verwenden, wird der Index nicht automatisch erkannt und Sie müssen die Mathematik-Variante verwenden: -\begin{itemize} - \item\lstinline=\NMR[CDCl$_3$]= \NMR[CDCl$_3$] - \item\lstinline=\NMR*[CDCl$_3$]= \NMR*[CDCl$_3$] -\end{itemize} +\begin{LTXexample} + \NMR[CDCl3] +\end{LTXexample} -Alle Argumente können beliebig kombiniert werden, der Befehl kann außerdem auch im Mathematikmodus verwendet werden. - -Wenn Sie wollen, dass das Erscheinungsbild mit dem von `bpchem' übereinstimmt (vgl. `bpchem'-Befehl \lstinline=\HNMR= \HNMR und `\CMname'-Befehl \lstinline=\NMR= \NMR), dann verwenden Sie die Paketoption \lstinline=bpchem= (siehe Abschnitt \ref{sec:optionen}). +Mit den Schlüsseln \code{unit}\Key[\cmd{mega}\cmd{hertz}][nmr]{unit}{<unit>} und \code{nucleus}\Key[\ma{1,H}][nmr]{nucleus}{\ma{<num>,<elem>}} können Default-Einheit und Default-Kern geändert werden. Beispiele: -\begin{lstlisting} - \NMR{13,C}(100) \\ - \NMR*{13,C}(100) \\ - \NMR*{19,F}[CFCl3] \\ - \NMR*{19,F}(285)[CFCl3] \\ +\begin{LTXexample} + {\chemsetup[nmr]{nucleus={13,C}}\NMR(100) \NMR*(100) } \\ + \NMR*{19,F}[CFCl3] \NMR*{19,F}(285)[CFCl3] \\ \NMR(400)[CDCl3] = \num{1.59} (q, 1H, \textit{J} = \SI{11.6}{\hertz}, H-4) -\end{lstlisting} -\NMR{13,C}(100) \\ -\NMR*{13,C}(100) \\ -\NMR*{19,F}[CFCl3] \\ -\NMR*{19,F}(285)[CFCl3] \\ -\NMR(400)[CDCl3] = \num{1.59} (q, 1H, \textit{J} = \SI{11.6}{\hertz}, H-4) +\end{LTXexample} + +\section{Befehle für \textsf{mhchem}}\label{sec:mhchem} +Ab v2.0 lädt \CMname \paket{mhchem} automatisch. -\section{Befehle für `mhchem'}\label{sec:mhchem} -Einige Makros sind für den Gebrauch mit `mhchem' gedacht und stehen zur Verfügung, wenn das Paket geladen wird. Bevor sie beschrieben werden einige Worte zur Verwendung von Befehlen innerhalb der \lstinline=\ce=- und \lstinline=\cee=-Befehle. Wohl aufgrund der Art und Weise, wie die Befehle ausgelesen werden, kann es immer wieder zu Schwierigkeiten kommen, vor allem, wenn Befehle mit Argumenten dort eingesetzt werden. +Bevor nun die Befehle beschrieben werden einige Worte zur Verwendung von Befehlen innerhalb der \cmd{ce}- und \cmd{cee}-Befehle. Wohl aufgrund der Art und Weise, wie die Befehle ausgelesen werden, kann es immer wieder zu Schwierigkeiten kommen, vor allem, wenn Befehle mit Argumenten dort eingesetzt werden. Häufig müssen zum Beispiel Leerstellen gelassen werden: -\begin{lstlisting} +\begin{LTXexample} \ce{Na\pch}\\ % kein Problem \ce{Ca\pch[2]}\\ % falsche Darstellung \ce{Ca \pch[2]}\\ % richtige Darstellung \ce{Ca$\pch[2]$} % richtige Darstellung -\end{lstlisting} -\ce{Na\pch}\\ -\ce{Ca\pch[2]}\\ -\ce{Ca \pch[2]}\\ -\ce{Ca$\pch[2]$} +\end{LTXexample} In der Regel ist es auch nötig, Argumente mit geschweiften Klammern enden zu lassen: -\begin{lstlisting} +\begin{LTXexample} \ce{\mch OMe}\\ % falsche Darstellung \ce{\mch{} OMe}\\ % richtige Darstellung \ce{$\mch$OMe} % richtige Darstellung -\end{lstlisting} -\ce{\mch OMe}\\ -\ce{\mch{} OMe}\\ -\ce{$\mch$OMe} +\end{LTXexample} -Das betrifft \emph{nicht} nur `\CMname'-Befehle! -\begin{lstlisting} +Das betrifft \emph{nicht} nur \CMname-Befehle! +\begin{LTXexample}[pos=b] \ce{A \quad B} \ce{Na2\textbf{O}}\\ % falsche Darstellung \ce{A \quad{} B} \ce{Na2 \textbf{O}}\\ % richtige Darstellung \ce{A $\quad$ B} \ce{Na2 \textbf{O}} % richtige Darstellung -\end{lstlisting} -\ce{A \quad B} \ce{Na2\textbf{O}}\\ -\ce{A \quad{} B} \ce{Na2 \textbf{O}}\\ -\ce{A $\quad$ B} \ce{Na2 \textbf{O}} +\end{LTXexample} -Wie Sie sehen können, können Sie in den meisten Fällen anstelle der Leerstellen oder geschweiften Klammern die entsprechenden Befehle zwischen \lstinline=$ $= schreiben. +Wie Sie sehen können, können Sie in den meisten Fällen anstelle der Leerstellen oder geschweiften Klammern die entsprechenden Befehle zwischen \code{\$ \$} schreiben. +\newpage \subsection{Reaktionsumgebungen}\label{ssec:mhchem_reaktionen} -\subsubsection{Durch `\CMname' definiert} +\subsubsection{Durch \CMname definiert} Es stehen die Umgebungen\ldots -\begin{lstlisting} - \begin{reaction} - <mhchem code> - \end{reaction} - \begin{reactions} - <mhchem code> - \end{reactions} -\end{lstlisting} +\begin{framed} +\cmd{begin\ma{reaction}}\\ + \code{<mhchem code>}\\ +\cmd{end\ma{reaction}}\\ +\cmd{begin\ma{reactions}}\\ + \code{<mhchem code>}\\ +\cmd{end\ma{reactions}} +\end{framed} \ldots sowie die Varianten\ldots -\begin{lstlisting} - \begin{reaction*} - <mhchem code> - \end{reaction*} - \begin{reactions*} - <mhchem code> - \end{reactions*} -\end{lstlisting} +\begin{framed} +\cmd{begin\ma{reaction*}}\\ + \code{<mhchem code>}\\ +\cmd{end\ma{reaction*}}\\ +\cmd{begin\ma{reactions*}}\\ + \code{<mhchem code>}\\ +\cmd{end\ma{reactions*}} +\end{framed} \ldots zur Verfügung. Mit ihnen lassen sich (un)nummerierte Reaktionsgleichungen ähnlich mathematischer Formeln erstellen. -Die Umgebung \verb=reaction=/\verb=reaction*= verwendet die Mathematik-Um\-ge\-bung \lstinline=equation=/\lstinline=equation*= und die Umgebung \verb=reactions=/\verb=reactions*= die Mathematik-Umgebung \lstinline=align=/\lstinline=align*=, um die Reaktionen zu setzen. +Die Umgebung \code{reaction}/\code{reaction*} verwendet die Mathematik-Um\-ge\-bung \code{equation}/\code{equation*} und die Umgebung \code{reactions}/ \code{reactions*} die Mathematik-Umgebung \code{align}/\code{align*}, um die Reaktionen zu setzen. -Reaktion mit Zähler: -\begin{lstlisting} +\begin{LTXexample}[pos=b] + Reaktion mit Z\"ahler: \begin{reaction} A -> B \end{reaction} -\end{lstlisting} -\begin{reaction} - A -> B -\end{reaction} -Reaktion ohne Zähler: -\begin{lstlisting} +\end{LTXexample} + +\begin{LTXexample}[pos=b] + Reaktion ohne Z\"ahler: \begin{reaction*} C -> D \end{reaction*} -\end{lstlisting} -\begin{reaction*} - C -> D -\end{reaction*} -mehrere ausgerichtete Reaktionen mit Zähler: -\begin{lstlisting} +\end{LTXexample} + +\begin{LTXexample}[pos=b] + mehrere ausgerichtete Reaktionen mit Z\"ahler: \begin{reactions} A &-> B + C \\ D + E &-> F \end{reactions} -\end{lstlisting} -\begin{reactions} - A &-> B + C \\ - D + E &-> F -\end{reactions} -mehrere ausgerichtete Reaktionen ohne Zähler: -\begin{lstlisting} +\end{LTXexample} + +\begin{LTXexample}[pos=b] + mehrere ausgerichtete Reaktionen ohne Z\"ahler: \begin{reactions*} G &-> H + I \\ J + K &-> L \end{reactions*} -\end{lstlisting} -\begin{reactions*} - G &-> H + I \\ - J + K &-> L -\end{reactions*} - -Wenn Sie das Aussehen des Zählers ändern wollen, so können Sie \lstinline=\renewtagform{<tagname>}[<format>]{<right delim>}{<left delim>}=\footnote{Durch das Paket `mathtools' zur Verfügung gestellt} verwenden. -\begin{lstlisting} - \renewtagform{CMreaction}[R \textbf]{[}{]} +\end{LTXexample} + +Wenn Sie das Aussehen des Zählers ändern wollen, so können Sie \cmd{renewtagform\ma{<tagname>}\oa{<format>}\ma{<right delim>}\ma{<left delim>}}\footnote{Durch das Paket \paket{mathtools} zur Verfügung gestellt} verwenden. +\begin{LTXexample}[pos=b] + \renewtagform{reaction}[R \textbf]{[}{]} \begin{reaction} H2O + CO2 <<=> H2CO3 \end{reaction} -\end{lstlisting} -{\renewtagform{CMreaction}[R \textbf]{[}{]} -\begin{reaction} - H2O + CO2 <<=> H2CO3 -\end{reaction} -} +\end{LTXexample} +Beachten Sie, dass sich der Name der tagform mit v2.0 geändert hat. In v1.* hieß er \code{CMreaction}. Die Option \code{version=1} stellt den alten Namen wieder her. \subsubsection{Eigene Reaktionen} -\NEU[1.1]Sie können auch neue Umgebungen selbst festlegen: -\begin{lstlisting} - \newreaction{<name>}{<math name>} -\end{lstlisting} -Mit \lstinline=<name>= legen Sie den Namen der neuen Umgebung fest. Bei \lstinline=<math name>= wählen Sie die zu verwendende Mathematik-Umgebung aus. +Sie können auch neue Umgebungen selbst festlegen:\changed{newreaction} +\begin{framed} + \cmd{newreaction\oa{<keyval>}\ma{<name>}\ma{<math name>}} +\end{framed} +Mit \code{<name>} legen Sie den Namen der neuen Umgebung fest. Bei \code{<math name>} wählen Sie die zu verwendende Mathematik-Umgebung aus. -Der Befehl hat zwei Varianten. Zum einen \lstinline=\newreaction*=. Damit wird auch die entsprechende Sternvariante definiert, vorausgesetzt, die gesternte Mathematik-Umgebung existiert. Wenn nicht, wird es einen Fehler geben. +Der Befehl hat zwei Schlüssel. Zum einen \code{star}\Key[false]{star}{true/false}. Damit wird zusätzlich die entsprechende Sternvariante definiert, vorausgesetzt, die gesternte Mathematik-Umgebung existiert. Wenn nicht, wird es einen Fehler geben. -Zum anderen \lstinline=\newreaction+=. Damit wird eine Umgebung mit Argument zu erstellt. Auch hier gilt: die entsprechende Mathematikumgebung muss bereits ein Argument haben. +Zum anderen \code{arg}\Key[false]{arg}{true/false}. Damit wird eine Umgebung mit obligatorischem Argument erstellt. Auch hier gilt: die entsprechende Mathematikumgebung muss ein Argument haben. -Auch die Kombination \lstinline=\newreaction*+= kann verwendet werden. - -Die beiden bestehenden Umgebungen sind über\ldots -\begin{lstlisting} - \newreaction*{++reaction++}{equation} - \newreaction*{++reactions++}{align} -\end{lstlisting} +Die bestehenden Umgebungen sind über\\ +\cmd{newreaction\oa{star}\ma{reaction}\ma{equation}} und\\ +\cmd{reaction\oa{star}\ma{reactions}{align}}\\ \ldots definiert. -Nehmen wir einmal an, Sie möchten die Ausrichtungsmöglichkeiten der \lstinline=alignat=-Um\-ge\-bung auch für `mhchem'-Reaktionen nutzen. Sie könnten folgendes tun: -\begin{lstlisting} - \newreaction*+{++reactionsat++}{alignat} -\end{lstlisting} -Damit steht nun die Umgebung \verb=reactionsat= zur Verfügung. -\begin{lstlisting} +Nehmen wir einmal an, Sie möchten die Ausrichtungsmöglichkeiten der \code{alignat}-Um\-ge\-bung auch für \paket{mhchem}-Reaktionen nutzen. Sie könnten folgendes tun:\\ +\cmd{newreaction\oa{star,arg}\ma{reactionsat}\ma{alignat}} + +Damit steht nun die Umgebung \code{reactionsat} zur Verfügung. +\begin{LTXexample}[pos=b] + \newreaction[star,arg]{reactionsat}{alignat} \begin{reactionsat}{3} A &-> B &&-> C &&-> D \\ aaaaa &-> bbbbb &&-> ccccc &&-> ddddd @@ -759,206 +820,238 @@ Damit steht nun die Umgebung \verb=reactionsat= zur Verfügung. A &-> B & C &-> D \\ aaaaa &-> bbbbb &\quad{} ccccc &-> ddddd \end{reactionsat*} -\end{lstlisting} -\newreaction*+{reactionsat}{alignat} -\begin{reactionsat}{3} - A &-> B &&-> C &&-> D \\ - aaaaa &-> bbbbb &&-> ccccc &&-> ddddd -\end{reactionsat} -\begin{reactionsat*}{2} - A &-> B & C &-> D \\ - aaaaa &-> bbbbb &\quad{} ccccc &-> ddddd -\end{reactionsat*} +\end{LTXexample} \subsection{Phasen}\label{ssec:mhchem_phasen} -\NEU[1.1]Folgende Befehle sind für Phasenangaben gedacht. Auch wenn diese Befehle für den Einsatz mit `mhchem' gedacht waren, können sie genauso gut ohne verwendet werden und stehen auch zur Verfügung, wenn `mhchem' nicht geladen wurde. -\begin{lstlisting} - \solid[<anything>] % fest - \liquid[<anything>] % flüssig - \gas % gasförmig - \aq % gelöst in Wasser -\end{lstlisting} -Mir war es immer zu umständlich, die Phasenangaben auschreiben zu müssen: -\begin{lstlisting} - \ce{C_{(f)} + 2 H2O_{(fl)} -> CO2_{(g)} + 2 H2_{(g)}} -\end{lstlisting} -Dasselbe Ergebnis erhalten Sie daher nun mit -\begin{lstlisting} - \ce{C\solid{} + 2 H2O\liquid{} -> CO2\gas{} + 2 H2\gas} -\end{lstlisting} -\ce{C\solid{} + 2 H2O\liquid{} -> CO2\gas{} + 2 H2\gas} - -Der Vollständigkeit halber: \lstinline=NaCl\aq= gibt NaCl\aq. - -Wenn Sie lieber die englischen Bezeichnungen wollen, müssen Sie entweder auf die Paketoption \lstinline=german= (siehe Abschnitt \ref{sec:optionen}) verzichten, oder die Buchstaben als Argumente angeben: -\begin{lstlisting} - \ce{C \solid[s] + 2 H2O \liquid[l] -> CO2\gas{} + 2 H2\gas} -\end{lstlisting} -\ce{C \solid[s] + 2 H2O \liquid[l] -> CO2\gas{} + 2 H2\gas{}} - -Natürlich ist es egal, welchen Befehl mit Argument Sie verwenden, da beide lediglich ein Subskript mit Klammern erzeugen. \lstinline=\solid[s]= ist identisch mit \lstinline=\liquid[s]=. +Folgende Befehle sind für Phasenangaben gedacht. Auch wenn diese Befehle für den Einsatz mit \paket{mhchem} gedacht waren, können sie genauso gut ohne verwendet werden. +\begin{itemize} + \item\cmd{sld\oa{<anything>}} \sld + \item\cmd{lqd\oa{<anything>}} \lqd + \item\cmd{gas} \gas + \item\cmd{aq} \aq +\end{itemize} +Bitte beachten Sie, dass die Befehle \cmd{solid}\formercmd{solid} und \cmd{liquid}\formercmd{liquid} jetzt \cmd{sld} \bzw \cmd{lqd} heißen. + +\begin{LTXexample}[pos=b] + \ce{C\sld{} + 2 H2O\lqd{} -> CO2\gas{} + 2 H2\gas}\\ + Der Vollst\"andigkeit halber: NaCl\aq. +\end{LTXexample} + +Wenn Sie lieber die englischen Bezeichnungen wollen, müssen Sie entweder auf die Paketoption \code{german} (siehe Abschnitt \ref{sec:optionen}) verzichten, die Sprache (temporär) mit \cmd{chemsetup\oa{option}\ma{german=false}} umstellen oder die Buchstaben als Argumente angeben: +\begin{LTXexample}[pos=b] + {\chemsetup[option]{german=false} + \ce{C\sld{} + 2 H2O\lqd{} -> CO2\gas{} + 2 H2\gas} }\\ + \ce{C \sld[s] + 2 H2O \lqd[l] -> CO2\gas{} + 2 H2\gas} +\end{LTXexample} + +Natürlich ist es egal, welchen Befehl mit Argument Sie verwenden, da beide lediglich ein Subskript mit Klammern erzeugen. \cmd{sld\oa{s}} ist identisch mit \cmd{lqd\oa{s}}. Auch andere Einsätze sind denkbar: -\begin{lstlisting} - C\solid[Graphit] -\end{lstlisting} -C\solid[Graphit] +\begin{LTXexample} + C\sld[Graphit] +\end{LTXexample} \subsection{Beschriftungen}\label{ssec:mhchem_beschriftung} -\NEU[1.1]Ein Punkt, der bei `mhchem' bislang ein wenig umständlich war: Beschriften von Molekülen. Dafür stellt `\CMname' nun einen Befehl zur Verfügung: -\begin{lstlisting} - \mhName[<width>][<textattr>]{<mhchem code>}{<name>} -\end{lstlisting} +\CMname stellt außerdem einen Befehl zur Verfügung, mit dem Moleküle beschriftet werden können.\changed{mhName} +\begin{framed} + \cmd{mhName\oa{<keyval>}\ma{<formula>}\ma{<text>}} +\end{framed} Zum Beispiel: -\begin{lstlisting} - \ce{4 C2H5Cl + Pb / Na -> \mhName{Pb(C2H5)4}{früheres Antiklopfmittel} + NaCl} -\end{lstlisting} -\ce{4 C2H5Cl + Pb / Na -> \mhName{Pb(C2H5)4}{früheres Antiklopfmittel} + NaCl} - -Wie Sie sehen, wird der Text per Default zentriert und \lstinline=\tiny= unter das Molekül gesetzt, das Molekül nimmt dabei seinen normalen Raum ein. Sie können mit dem ersten optionalen Argument die Breite aber beliebig wählen. -\begin{lstlisting} - \ce{4 C2H5Cl + Pb / Na -> \mhName[3cm]{Pb(C2H5)4}{früheres Antiklopfmittel} + NaCl} -\end{lstlisting} -\ce{4 C2H5Cl + Pb / Na -> \mhName[3cm]{Pb(C2H5)4}{früheres Antiklopfmittel} + NaCl} - -Die Textattribute sind in der Voreinstellung mit \lstinline=\centering\tiny= festgelegt. Sie wer- den durch Eingabe anderer Attribute direkt zum Text nicht oder nur bedingt über\-schrie\-ben: -\begin{lstlisting} - \ce{4 C2H5Cl + Pb / Na -> \mhName[3cm]{Pb(C2H5)4}{\small früheres Antiklopfmittel} + NaCl}\\ - \ce{4 C2H5Cl + Pb / Na -> \mhName[3cm]{Pb(C2H5)4}{\raggedright\color{red}\bfseries früheres Antiklopfmittel} + NaCl} -\end{lstlisting} -\ce{4 C2H5Cl + Pb / Na -> \mhName[3cm]{Pb(C2H5)4}{\small früheres Antiklopfmittel} + NaCl}\\ -\ce{4 C2H5Cl + Pb / Na -> \mhName[3cm]{Pb(C2H5)4}{\raggedright\color{red}\bfseries früheres Antiklopfmittel} + NaCl} - -Durch das zweite optionale Argument lassen sie sich komplett überschreiben: -\begin{lstlisting} - \ce{4 C2H5Cl + Pb / Na -> \mhName[3cm][\small]{Pb(C2H5)4}{früheres Antiklopfmittel} + NaCl}\\ - \ce{4 C2H5Cl + Pb / Na -> \mhName[3cm][\raggedright\color{red}\bfseries]{Pb(C2H5)4}{früheres Antiklopfmittel} + NaCl} -\end{lstlisting} -\ce{4 C2H5Cl + Pb / Na -> \mhName[3cm][\small]{Pb(C2H5)4}{früheres Antiklopfmittel} + NaCl}\\ -\ce{4 C2H5Cl + Pb / Na -> \mhName[3cm][\raggedright\color{red}\bfseries]{Pb(C2H5)4}{früheres Antiklopfmittel} + NaCl} - -Um die Voreinstellung global zu ändern, gibt es den Befehl -\begin{lstlisting} - \setmhName{<textattr>} -\end{lstlisting} -Damit können Sie die Voreinstellung nach Ihren Vorlieben festlegen: -\begin{lstlisting} - \setmhName{\centering\footnotesize\color{blue}} - \ce{4 C2H5Cl + Pb / Na -> \mhName{Pb(C2H5)4}{früheres Antiklopfmittel} + NaCl} -\end{lstlisting} -{\setmhName{\centering\footnotesize\color{blue}} -\ce{4 C2H5Cl + Pb / Na -> \mhName{Pb(C2H5)4}{früheres Antiklopfmittel} + NaCl}} +\begin{LTXexample}[pos=b] + \ce{4 C2H5Cl + Pb / Na -> \mhName{Pb(C2H5)4}{fr\"uheres Antiklopfmittel} + NaCl} +\end{LTXexample} + +Mit einigen Schlüsseln kann \cmd{mhName} angepasst werden.\Key[\cmd{centering}][mhName]{align}{<alignment>}\Key[][mhName]{fontattr}{<commands>}\Key[\cmd{tiny}][mhName]{fontsize}{<fontsize>}\Key[][mhName]{width}{<dim>} +\begin{itemize} + \item\code{align} + \item\code{fontattr} + \item\code{fontsize} + \item\code{width} +\end{itemize} +\begin{LTXexample}[pos=b] + \ce{4 C2H5Cl + Pb / Na -> \mhName[fontsize=\footnotesize]{Pb(C2H5)4}{fr\"uheres Antiklopfmittel} + NaCl}\\ + \chemsetup[mhName]{align=\raggedright,fontsize=\small,fontattr=\bfseries\color{red},width=3cm} + \ce{4 C2H5Cl + Pb / Na -> \mhName{Pb(C2H5)4}{fr\"uheres Antiklopfmittel} + NaCl} +\end{LTXexample} + +In v1.1 gab es noch den Befehl \cmd{setmhName\ma{<textattr>}}\formercmd{setmhName\ma{<textattr>}}. Mit Laden der Paketoption \code{version=1} wird er bereitgestellt. +\newpage \section{Newman-Projektionen}\label{sec:newman} -Mit dem Befehl -\begin{lstlisting} - \newman[<angle>,<scale>,<tikz>]{<1>,<2>,<3>,<4>,<5>,<6>} -\end{lstlisting} -lassen sich Newman-Projektionen erstellen (verwendet `\TikZ'). Beispiele: -\begin{lstlisting} - \newman{}\par% Standard: gestaffelt - \newman[175]{}\par% gedreht um 175 Grad => ekliptisch - \newman{1,2,3,4,5,6} \newman{1,2,3} \newman{,,,4,5,6}\par% mit Atomen - \newman[,.75,draw=blue,fill=blue!20]{}% verkleinert und mit TikZ angepasst -\end{lstlisting} -\newman{}\par -\newman[175]{}\par -\newman{1,2,3,4,5,6} \newman{1,2,3} \newman{,,,4,5,6}\par -\newman[,.75,draw=blue,fill=blue!20]{} - -Mit einer weiteren Option können die Nodes der Atome gestaltet werden: -\begin{lstlisting} - \newman[][<tikz nodes>]{<1>,<2>,<3>,<4>,<5>,<6>} - % Beispiel: - \newman[][draw=red,fill=red!20,inner sep=2pt,rounded corners]{1,2,3,4,5,6} -\end{lstlisting} -\newman[][draw=red,fill=red!20,inner sep=2pt,rounded corners]{1,2,3,4,5,6} - -Wenn Sie die "`vorderen"' und "`hinteren"' Nodes verschieden gestalten wollen, können Sie noch eine dritte Option verwenden: -\begin{lstlisting} - \newman[][<tikz front nodes>][<tikz back nodes>]{<1>,<2>,<3>,<4>,<5>,<6>} -\end{lstlisting} -Beispiele: -\begin{lstlisting} - \newman[][draw=red,fill=red!20,inner sep=2pt,rounded corners][draw=blue,fill=blue!20,inner sep=2pt,rounded corners]{1,2,3,4,5,6} -\end{lstlisting} -\newman[][draw=red,fill=red!20,inner sep=2pt,rounded corners][draw=blue,fill=blue!20,inner sep=2pt,rounded corners]{1,2,3,4,5,6} -\begin{lstlisting} - \newman[170][draw=red,fill=red!20,inner sep=2pt,rounded corners][draw=blue,fill=blue!20,inner sep=2pt,rounded corners]{1,2,3,4,5,6} -\end{lstlisting} -\newman[170][draw=red,fill=red!20,inner sep=2pt,rounded corners][draw=blue,fill=blue!20,inner sep=2pt,rounded corners]{1,2,3,4,5,6} - -\section{p-Orbitale}\label{sec:orbitale} -`\CMname' stellt auch Befehle zur Verfügung, mit denen p-Orbitale visualisiert werden können. -\begin{lstlisting} - \porb[<size factor>,<color>,<angle>] - \phorb[<size factor>,<color>,<angle>] - \setorbheight{<length>} -\end{lstlisting} -Damit wird ein liegendes oder um \lstinline=<angle>= gedrehtes p-Orbital dargestellt: \lstinline=\porb \qquad \porb[,,30]= \quad\porb \qquad\porb[,,30] - -\lstinline=\phorb= stellt nur ein halbes Orbital dar: \lstinline=\phorb[,red,90]= \phorb[,red,90] - -Die Größe der dargestellten Orbitale hängt von einer internen Länge ab, die mit \lstinline=\setorbheight{<length>}= eingestellt werden kann und die per Default den Wert \lstinline=1em= hat. -\begin{lstlisting} - \porb\par - \setorbheight{2em}\porb -\end{lstlisting} -{\porb\par\setorbheight{2em}\porb} - -Die Größe kann für ein einzelnes Orbital auch mit dem optionalen Argument \lstinline=<size factor>= festgelegt werden. -\begin{lstlisting} - \porb\par - \porb[2]\par - \porb[.5] -\end{lstlisting} -{\porb\par\porb[2]\par\porb[.5]} - -Mit den folgenden drei Befehlen stehen die in $x$-, $y$- und $z$-Richtung gedrehten Orbitale zusätzlich als Makro zur Verfügung: -\begin{lstlisting} - \pzorb \qquad \pyorb \qquad \pxorb -\end{lstlisting} -\pzorb \qquad \pyorb \qquad \pxorb - -Da die Orbitale als Tikzpicture mit Option \lstinline=overlay= gezeichnet werden, werden sie alle an dieselbe Stelle gesetzt, wenn man sie nicht verschiebt: -\begin{lstlisting} - \hspace{2cm}\pxorb\pyorb\pzorb - \tikz[overlay]{ - \draw[->](0,0)--(1,0)node[right]{$y$}; - \draw[dashed](0,0)--(-1,0); - \draw[->](0,0)--(0,1)node[above]{$z$}; - \draw[dashed](0,0)--(0,-1); - \draw[->](0,0)--(-.707,-.707)node[below left]{$x$}; - \draw[dashed](0,0)--(.707,.707); +\CMname stellt das Makro\changed{newman} +\begin{framed} + \cmd{newman\oa{<keyval>}\da{<angle>}\ma{<1>,<2>,<3>,<4>,<5>,<6>}} +\end{framed} +zur Verfügung, mit dem sich Newman-Projektionen erstellen lassen (verwendet `\TikZ'). Mit \code{<angle>} lassen sich die hinteren Atome gegen die vorderen (gegen den Uhrzeigersinn) drehen. +\begin{LTXexample}[pos=b] + \newman{} \newman(170){} + \newman{1,2,3,4,5,6} \newman{1,2,3} \newman{,,,4,5,6} +\end{LTXexample} + +Mehrere Schlüssel erlauben das Anpassen des Layouts:\Key[0][newman]{angle}{<angle>}\Key[1][newman]{scale}{<factor>}\Key[][newman]{ring}{<tikz>}\Key[][newman]{atoms}{<tikz>}\Key[][newman]{back-atoms}{<tikz>} +\begin{itemize} + \item\code{angle = <angle>} Einstellen des Default-Drehwinkels + \item\code{scale = <factor>} Skalieren der Projektion + \item\code{ring = <tikz>} Anpassen des Rings mit \TikZ-Keys + \item\code{atoms = <tikz>} Anpassen der Nodes, in die die Atome gesetzt werden + \item\code{back-atoms = <tikz>} Eigene Anpassungen für die hinteren Atome +\end{itemize} +\begin{LTXexample}[pos=b] + \chemsetup[newman]{angle=45} \newman{} + \newman[scale=.75,ring={draw=blue,fill=blue!20}]{} +\end{LTXexample} +\begin{LTXexample} + \chemsetup[newman]{atoms={draw=red,fill=red!20,inner sep=2pt,rounded corners}} + \newman{1,2,3,4,5,6} +\end{LTXexample} +\begin{LTXexample}[pos=b] + \chemsetup[newman]{ + atoms = {draw=red,fill=red!20,inner sep=2pt,rounded corners}, + back-atoms = {draw=blue,fill=blue!20,inner sep=2pt,rounded corners} } -\end{lstlisting} -\hspace{2cm}\pxorb\pyorb\pzorb\tikz[overlay]{\draw[->](0,0)--(1,0)node[right]{$y$};\draw[->](0,0)--(0,1)node[above]{$z$};\draw[->](0,0)--(-.707,-.707)node[below left]{$x$};\draw[dashed](0,0)--(-1,0);\draw[dashed](0,0)--(0,-1);\draw[dashed](0,0)--(.707,.707);} -\vspace{2cm} - -Die Orbitale lassen sich \zB auch zusammen mit `chemfig' einsetzen: -\begin{lstlisting} - \setorbheight{2em}\setbondoffset{0pt} - \chemfig{?\pzorb-[,1.3]\pzorb-[:30,1.1]\pzorb-[:150,.9]\pzorb-[4,1.3]\pzorb-[:-150,1.1]\pzorb?}\qquad - \chemfig{?\pzorb-[,1.3]{\porb[,,-90]}-[:30,1.1]\pzorb-[:150,.9]{\porb[,,-90]}-[4,1.3]\pzorb-[:-150,1.1]{\porb[,,-90]}?} -\end{lstlisting} -\vspace{1cm} -{\setorbheight{2em}\setbondoffset{0pt} -\chemfig{?\pzorb-[,1.3]\pzorb-[:30,1.1]\pzorb-[:150,.9]\pzorb-[4,1.3]\pzorb-[:-150,1.1]\pzorb?}\qquad -\chemfig{?\pzorb-[,1.3]{\porb[,,-90]}-[:30,1.1]\pzorb-[:150,.9]{\porb[,,-90]}-[4,1.3]\pzorb-[:-150,1.1]{\porb[,,-90]}?}} - -\section{Liste der Befehle}\label{sec:befehlsreferenz} -\begin{tabular}{>{\raggedright}p{.35\textwidth}|>{\raggedright}p{.55\textwidth}}\toprule - \lstinline=\el=, \lstinline=\prt=, \lstinline=\ntr=, \lstinline=\HtO=, \lstinline=\water=, \lstinline=\Hpl=, \lstinline=\Hyd=, \lstinline=\Nu=, \lstinline=\El=, \lstinline=\transitionstatesymbol=, \lstinline=\R= & Abschnitt \ref{sec:teilchen}: Teilchen, Ionen und ein Symbol\tabularnewline\midrule - \lstinline=\cip=, \lstinline=\Rcip=, \lstinline=\Scip=, \lstinline=\Dfi=, \lstinline=\Lfi=, \lstinline=\E=, \lstinline=\Z=, \lstinline=\cis=, \lstinline=\trans=, \lstinline=\Rconf=, \lstinline=\Sconf=, \lstinline=\ortho=, \lstinline=\meta=, \lstinline=\para=, \lstinline=\insitu=, \lstinline=\abinitio= & Abschnitt \ref{sec:stereo}: Stereo-Deskriptoren, Nomenklatur, lateinische Ausdrücke\tabularnewline\midrule - \lstinline=\pH=, \lstinline=\pOH=, \lstinline=\pKa=, \lstinline=\pKb= & Abschnitt \ref{sec:saeure_base}: Säure/Base \tabularnewline\midrule - \lstinline=\delm=, \lstinline=\delp=, \lstinline=\mch=, \lstinline=\pch=, \lstinline=\ox=, \lstinline=\scrm=, \lstinline=\scrp= & Abschnitt \ref{sec:ladungen}: Oxidationszahlen und (echte) Ladungen\tabularnewline\midrule - \lstinline=\mech= & Abschnitt \ref{sec:mechanismen}: Reaktionsmechanismen \tabularnewline\midrule - \lstinline=\redox=, \lstinline=\OX= & Abschnitt \ref{sec:redoxreaktionen}: Redoxreaktionen \tabularnewline\midrule - \lstinline=\Enthalpy=, \lstinline=\Entropy=, \lstinline=\Gibbs=, \lstinline=\setnewstate=, \lstinline=\renewstate=, \lstinline=\State=, \lstinline=\setstatesubscript= & Abschnitt \ref{sec:standardstate}: (Standard) Zustand, Thermodynamik \tabularnewline\midrule - \lstinline=\NMR= & Abschnitt \ref{sec:spektroskopie}: Spektroskopie \tabularnewline\midrule - \lstinline=\begin{reaction}=, \lstinline=\begin{reaction*}=, \lstinline=\begin{reactions}=, \lstinline=\begin{reactions*}=, \lstinline=\newreaction=, \lstinline=\solid=, \lstinline=\liquid=, \lstinline=\gas=, \lstinline=\mhName=, \lstinline=\setmhName= & Abschnitt \ref{sec:mhchem}: Befehle für `mhchem'\tabularnewline\midrule - \lstinline=\newman= & Abschnitt \ref{sec:newman}: Newman-Projektionen \tabularnewline\midrule - \lstinline=\phorb=, \lstinline=\porb=, \lstinline=\pxorb=, \lstinline=\pyorb=, \lstinline=\pzorb=, \lstinline=\setorbheight= & Abschnitt \ref{sec:orbitale}: p-Orbitale\tabularnewline\bottomrule -\end{tabular} + \newman{1,2,3,4,5,6} \newman(170){1,2,3,4,5,6} +\end{LTXexample} + +\section{s-, p- und Hybrid-Orbitale}\label{sec:orbitale} +In v1.1 gab es noch die Befehle \cmd{porb\oa{<options>}}\formercmd{porb\oa{<options>}}, \cmd{phorb\oa{<options>}}\formercmd{phorb\oa{<options>}}, \cmd{pxorb}\formercmd{pxorb}, \cmd{pyorb}\formercmd{pyorb} und \cmd{pzorb}\formercmd{pzorb}. Mit Laden der Paketoption \code{version=1} werden sie bereitgestellt. +\CMname stellt folgenden Befehl bereit, mit dem Orbitale dargestellt werden können: +\begin{framed} + \cmd{orbital\oa{<keyval>}\ma{<type}} +\end{framed} +Als \code{<type>} haben Sie folgende Auswahlmöglichkeiten: +\begin{itemize} + \item\code{s} + \item\code{p} + \item\code{sp} + \item\code{sp2} + \item\code{sp3} +\end{itemize} +\begin{LTXexample}[pos=b] + \orbital{s} \orbital{p} \orbital{sp} \orbital{sp2} \orbital{sp3} +\end{LTXexample} + +\newpage +Je nach Typ gibt es verschiedene Keys zur Modifikation:\Key[+][orbital/<type>](orbital){phase}{\uline{+}/-}\Key[1][orbital/<type>](orbital){scale}{<factor>}\Key[black][orbital/<type>](orbital){color}{<color>}\Key[90][orbital/<type>](orbital){angle}{<angle>}\Key[false][orbital/<type>](orbital){half}{\uline{true}/false} +\begin{itemize} + \item\code{phase = \uline{+}/-} ändert die Phase des Orbitals (alle Typen) + \item\code{scale = <factor>} ändert die Größe des Orbitals (alle Typen) + \item\code{color = <color>} ändert die Farbe des Orbitals (alle Typen) + \item\code{angle = <angle>} dreht die Orbitale mit p-Anteil gegen den Uhrzeigersinn (alle Typen außer \code{s}) + \item\code{half = \uline{true}/false} stellt lediglich ein halbes Orbital dar (nur \code{p}) +\end{itemize} +\begin{LTXexample}[pos=b] + \orbital{s} \orbital[phase=-]{s} + \orbital{p} \orbital[phase=-]{p} + \orbital{sp3} \orbital[phase=-]{sp3} + + \orbital[angle=0]{p} \orbital[color=red!50]{p} \orbital[angle=135,scale=1.5]{p} \orbital[half]{p} +\end{LTXexample} + +Zusätzlich gibt es zwei Keys, mit denen sich das \TikZ-Verhalten beeinflussen lässt.\Key[false][orbital]{overlay}{\uline{true}/false}\Key[1][orbital]{opacity}{<num>} +\begin{itemize} + \item\code{overlay = \uline{true}/false} das Orbital "`nimmt keinen Raum ein"'; es wird mit der \TikZ-Option \code{overlay} dargestellt. + \item\code{opacity = <num>} das Orbital wird durchscheinend; \code{<value>} kann Werte von \code{1} (deckend) bis \code{0} (unsichtbar) haben. +\end{itemize} +\begin{LTXexample}[pos=b] + \vspace{1cm}\hspace{1cm} + \chemsetup[orbital]{ + overlay, + p/color = black!70 + } + \setbondoffset{0pt} + \chemfig{?\orbital{p}-[,1.3]{\orbital[phase=-]{p}}-[:30,1.1]\orbital{p}-[:150,.9]{\orbital[phase=-]{p}}-[4,1.3]\orbital{p}-[:-150,1.1]{\orbital[phase=-]{p}}?} + \vspace{1cm} +\end{LTXexample} +\begin{LTXexample}[pos=b] + \vspace{2cm}\hspace{2cm} + \setbondoffset{0pt} + \chemsetup[orbital]{ + overlay , + opacity = .75 , + p/scale = 1.6 , + s/color = blue!50 , + s/scale = 1.6 + } + \chemfig{\orbital{s}-[:-20]{\orbital[scale=2]{p}}{\orbital[half,angle=0]{p}}{\orbital[angle=170,half]{p}}{\orbital[angle=-150,half]{p}}(-[:-150]\orbital{s})-\orbital{s}} + \vspace{2cm} +\end{LTXexample} + +\section{Schlüssel-Übersicht} +In der folgenden Tabelle sind alle in \CMname vorkommenden Schlüssel aufgelistet. Alle Schlüssel, die einem Modul angehören, können auch mit \cmd{chemsetup\oa{<modul>}\ma{<keyval>}} \bzw\linebreak\cmd{chemsetup\ma{<modul>/<keyval>}} gesetzt werden. + +Manche Schlüssel können auch ohne Wert eingesetzt werden. Sie entsprechen dann dem \uline{unterstrichenen} Wert. +\begin{fullwidth} +\begin{longtable}{>{\ttfamily\hspace{5mm}}l>{\ttfamily}l>{\ttfamily}l>{\ttfamily}ll} + \toprule + \normalfont\bfseries Schlüssel & \normalfont\bfseries Modul & \normalfont\bfseries Werte & \normalfont\bfseries Default & \\ + \midrule + \endhead + \bottomrule + \endfoot + \multicolumn{5}{l}{Paket-Optionen:} \\ + bpchem & option & \uline{true}/false & false & Seite \pageref{key:option_bpchem} \\ + circled & option & \uline{formal}/all/none & formal & Seite \pageref{key:option_circled} \\ + circletype & option & \uline{chem}/math & chem & Seite \pageref{key:option_circletype} \\ + EZ & option & \uline{chemmacros}/cool & chemmacros & Seite \pageref{key:option_EZ} \\ + german & option & \uline{true}/false & false & Seite \pageref{key:option_german} \\ + version & option & 1/2 & 2 & Seite \pageref{key:option_version} \\ + xspace & option & \uline{true}/false & true & Seite \pageref{key:option_xspace} \\ + \multicolumn{5}{l}{\cmd{pch}, \cmd{mch}, \cmd{fpch}, \cmd{fmch}:} \\ + append & charges & \uline{true}/false & false & Seite \pageref{key:charges_append} \\ + \multicolumn{5}{l}{\cmd{ox}:} \\ + parse & ox & \uline{true}/false & true & Seite \pageref{key:ox_parse} \\ + roman & ox & \uline{true}/false & true & Seite \pageref{key:ox_roman} \\ + pos & ox & top/super/side & top & Seite \pageref{key:ox_pos} \\ + explicit-sign & ox & \uline{true}/false & false & Seite \pageref{key:ox_explicit-sign} \\ + decimal-marker & ox & comma/point & point & Seite \pageref{key:ox_decimal-marker} \\ + \multicolumn{5}{l}{\cmd{OX}, \cmd{redox}:} \\ + dist & redox & <dim> & .6em & Seite \pageref{key:redox_dist} \\ + sep & redox & <dim> & .2em & Seite \pageref{key:redox_sep} \\ + \multicolumn{5}{l}{\cmd{Enthalpy}, \cmd{Entropy}, \cmd{Gibbs}:} \\ + exponent & & <anything> & \cmd{standardstate} & Seite \pageref{key:thermo_exponent} \\ + delta & & <anything>/false & & Seite \pageref{key:thermo_delta} \\ + subscript & & left/right & & Seite \pageref{key:thermo_subscript} \\ + unit & & <unit> & & Seite \pageref{key:thermo_unit} \\ + \multicolumn{5}{l}{\cmd{setnewstate}, \cmd{renewstate}:} \\ + exponent & & <anything> & \cmd{standardstate} & Seite \pageref{key:newstate_exponent} \\ + delta & & <anything>/false & & Seite \pageref{key:newstate_delta} \\ + subscript & & <anything> & & Seite \pageref{key:newstate_subscript} \\ + subscript-left & & true/false & & Seite \pageref{key:newstate_subscript-left} \\ + \multicolumn{5}{l}{\cmd{State}:} \\ + exponent & & <anything> & \cmd{standardstate} & Seite \pageref{key:state_exponent} \\ + delta & & <anything>/false & & Seite \pageref{key:state_delta} \\ + subscript-left & & true/false & & Seite \pageref{key:state_subscript-left} \\ + \multicolumn{5}{l}{\cmd{NMR}:} \\ + unit & nmr & <unit> & \cmd{mega}\cmd{hertz} & Seite \pageref{key:nmr_unit} \\ + nucleus & nmr & \{<num>,<atom symbol>\} & \{1,H\} & Seite \pageref{key:nmr_nucleus} \\ + \multicolumn{5}{l}{\cmd{newreaction}:} \\ + star & & \uline{true}/false & false & Seite \pageref{key:star} \\ + arg & & \uline{true}/false & false & Seite \pageref{key:arg} \\ + \multicolumn{5}{l}{\cmd{mhName}:} \\ + align & mhName & <alignment> & \cmd{centering} & Seite \pageref{key:mhName_align} \\ + fontattr & mhName & <commands> & & Seite \pageref{key:mhName_fontattr} \\ + fontsize & mhName & <fontsize> & \cmd{tiny} & Seite \pageref{key:mhName_fontsize} \\ + width & mhName & <dim> & & Seite \pageref{key:mhName_width} \\ + \multicolumn{5}{l}{\cmd{newman}:} \\ + angle & newman & <angle> & 0 & Seite \pageref{key:newman_angle} \\ + scale & newman & <factor> & 1 & Seite \pageref{key:newman_scale} \\ + ring & newman & <tikz> & & Seite \pageref{key:newman_ring} \\ + atoms & newman & <tikz> & & Seite \pageref{key:newman_atoms} \\ + back-atoms & newman & <tikz> & & Seite \pageref{key:newman_back-atoms} \\ + \multicolumn{5}{l}{\cmd{orbital} \ttfamily <type> = s/p/sp/sp2/sp3:} \\ + phase & orbital/<type> & \uline{+}/- & + & Seite \pageref{key:orbital_phase} \\ + scale & orbital/<type> & <factor> & 1 & Seite \pageref{key:orbital_scale} \\ + color & orbital/<type> & <color> & black & Seite \pageref{key:orbital_color} \\ + angle & orbital/<type> & <angle> & 90 & Seite \pageref{key:orbital_angle} \\ + half & orbital/p & \uline{true}/false & false & Seite \pageref{key:orbital_half} \\ + overlay & orbital & \uline{true}/false & false & Seite \pageref{key:orbital_overlay} \\ + opacity & ornital & <num> & 1 & Seite \pageref{key:orbital_opacity} +\end{longtable} +\end{fullwidth} + +\section{Vorschläge und Bugreports} +Feedback über \CMname ist jederzeit hochwillkommen! Wenn Sie Vorschläge für Makros, fehlende Funktionen \usw haben, zögern Sie nicht, Sich mit mir in Verbindung zu setzen. Wenn Ihnen Fehler auf\/fallen, sei es fachlicher Natur, falsche Dokumentation oder dergleichen, wäre ich über eine kurze E-Mail an \href{mailto:contact@mychemistry.eu}{contact@mychemistry.eu} sehr dankbar. Sollten Ihnen Bugs auf\/fallen, senden Sie mir am besten ein Minimales Beispiel, mit dem sich der Fehler nachvollziehen lässt. + +Vielen Dank an alle, die mir bereits Feedback zukommen ließen! \end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_doc_en.pdf b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_doc_en.pdf Binary files differindex 96108e08893..70762cd2e28 100644 --- a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_doc_en.pdf +++ b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_doc_en.pdf diff --git a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_doc_en.tex b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_doc_en.tex index 6dc5d64d8b6..1d719c2f66a 100644 --- a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_doc_en.tex +++ b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_doc_en.tex @@ -1,96 +1,181 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% ------------------------------------------------------------------------------------- % -% - chemmacros - chemmacros_doc_en.tex ------------------------------------------------ % -% - a collection of macros to make typesetting chemistry documents more convenient ---- % -% ------------------------------------------------------------------------------------- % -% - Clemens Niederberger -------------------------------------------------------------- % -% - 2011/06/22 ------------------------------------------------------------------------ % -% ------------------------------------------------------------------------------------- % -% - http://www.mychemistry.eu/ -------------------------------------------------------- % -% - contact@mychemistry.eu ------------------------------------------------------------ % -% ------------------------------------------------------------------------------------- % -% - If you have any ideas, questions, suggestions or bugs to report, please feel free - % -% - to contact me. -------------------------------------------------------------------- % -% ------------------------------------------------------------------------------------- % -% - Copyright 2011 Clemens Niederberger - % -% - - % -% - This work may be distributed and/or modified under the - % -% - conditions of the LaTeX Project Public License, either version 1.3 - % -% - of this license or (at your option) any later version. - % -% - The latest version of this license is in - % -% - http://www.latex-project.org/lppl.txt - % -% - and version 1.3 or later is part of all distributions of LaTeX - % -% - version 2005/12/01 or later. - % -% - - % -% - This work has the LPPL maintenance status `maintained'. - % -% - - % -% - The Current Maintainer of this work is Clemens Niederberger. - % -% - - % -% - This work consists of the files chemmacros.sty, chemmacros_doc_de.tex, - % -% - chemmacros_doc_de.tex, README - % -% ------------------------------------------------------------------------------------- % -\documentclass[parskip=full]{scrartcl} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% --------------------------------------------------------------------------- % +% - chemmacros - chemmacros_doc_en.tex - % +% - macros and commands for chemists - % +% --------------------------------------------------------------------------- % +% - Clemens Niederberger - % +% - 2011/10/28 - % +% --------------------------------------------------------------------------- % +% - http://www.mychemistry.eu/ - % +% - contact@mychemistry.eu - % +% --------------------------------------------------------------------------- % +% - If you have any ideas, questions, suggestions or bugs to report, please - % +% - feel free to contact me. - % +% --------------------------------------------------------------------------- % +% - Copyright 2011 Clemens Niederberger - % +% - - % +% - This work may be distributed and/or modified under the - % +% - conditions of the LaTeX Project Public License, either version 1.3 - % +% - of this license or (at your option) any later version. - % +% - The latest version of this license is in - % +% - http://www.latex-project.org/lppl.txt - % +% - and version 1.3 or later is part of all distributions of LaTeX - % +% - version 2005/12/01 or later. - % +% - - % +% - This work has the LPPL maintenance status `maintained'. - % +% - - % +% - The Current Maintainer of this work is Clemens Niederberger. - % +% - - % +% - This work consists of the files chemmacros.sty, chemmacros-version1.cfg,- % +% - chemmacros_doc_de.tex, chemmacros_doc_de.tex, README and the derived - % +% - files chemmacros_doc_de.pdf and chemmacros_doc_en.pdf - % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\documentclass[nohyper,titlepage,a4paper,nofonts,notoc]{tufte-handout} + +\newcommand*\CMname{\textsf{chemmacros}\xspace} +\newcommand*\CMversion{2.0\xspace} +\newcommand*\CMdate{2011/10/28\xspace} + +% changing some tufte-handout settings +\titleformat{\section}[hang]{\normalfont\Large\bfseries}{\thesection}{1em}{}[] +\titleformat{\subsection}[hang]{\normalfont\large\bfseries}{\thesubsection}{1em}{}[] +\makeatletter +\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex plus -1ex minus -.2ex}{1.5ex plus .2ex}{\normalsize\bf}} +\makeatother +\def\thesubsubsection{\thesection.\thesubsection.\arabic{subsubsection}} +\titleformat{\subsubsection}[hang]{\normalfont\large\bfseries}{\thesubsection}{1em}{}[] +\titlespacing*{\subsubsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus.2ex} +\setcounter{secnumdepth}{2} + +% need these because of the lots of marginnotes +\usepackage{etex,morefloats} +\reserveinserts{150} + \usepackage[english]{babel} \usepackage[utf8]{inputenx} \usepackage[dvipsnames]{xcolor} \colorlet{code}{RawSienna} -\usepackage{listings,url,chemfig,chemstyle,bpchem,booktabs} -\usepackage[perpage,hang]{footmisc} - \renewcommand*\thefootnote{\arabic{footnote})} +\usepackage[normalem]{ulem} +\usepackage{url,chemfig,chemstyle,bpchem,array,longtable,multirow,booktabs,framed} \usepackage[version=3,arrows=pgf]{mhchem} \usepackage[xspace,circled]{chemmacros} -\usetikzlibrary{calc} + +\usepackage{showexpl} \lstset{literate={ä}{{\"a}}1 {ö}{{\"o}}1 {ü}{{\"u}}1 {Ä}{{\"A}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1 {ß}{{\ss}}1} \lstset{ - language=[LaTeX]TeX, - basicstyle={\ttfamily}, % Grundstil - extendedchars=true, - numbers=left, % Zeilennummern - numberstyle=\tiny, % Größe des Zeilennummern - numberblanklines=true, % Leerzeilen nummerieren - gobble=1, % das erste Leerzeichen abschneiden - xleftmargin=20pt, % Einrückung links - breaklines=true, % Zeilenumbruch - moredelim=[is][\color{red!25!purple}]{!!}{!!},% Hervorhebung - moredelim=[is][\color{black}]{++}{++}, % Hervorhebung der Keywords rückgängig - commentstyle={\color[named]{Gray}}, - emph={begin,end}, % Umgebungen hervorheben - emphstyle=\color{red}, - keywordstyle=\color{code}, - keywordstyle=[20]\color{blue}, - morekeywords=[20]{reaction,reactions,reactionsat}, - texcsstyle=[30]\color{code}, - moretexcs=[30]{abinitio,aq,atm,atmosphere,cal,calory,ce,cee,celsius,cf,chemabove,chembelow,chemfig,cip,cis,cmc,CNMR,color,cstsetup,DeclareSIUnit,delm,delp,Dfi,draw,E,el,El,ElPot,ensuremath,enthalpy,Enthalpy,Entropy,gas,Gibbs,gram,Helmholtz,HNMR,HtO,Hpl,Hyd,insitu,IUPAC,joule,kelvin,kilo,latin,lewis,Lfi,liter,liquid,mch,mech,meta,mhName,milli,mmHg,molar,moLar,Molar,mole,MolMass,newman,newreaction,NMR,node,normal,ntr,nu,Nu,ortho,ox,OX,para,pch,per,pH,pKa,pKb,phorb,pOH,porb,prt,pxorb,pyorb,pzorb,R,Rcip,Rconf,redox,renewstate,renewtagform,setorbheight,Scip,Sconf,scrm,scrp,setatomsep,setbondoffset,setmhName,setnewstate,setorbheight,setstatesubscript,setredoxdist,si,SI,sisetup,solid,standardstate,State,text,tikz,torr,trans,transitionstatesymbol,usetikzlibrary,volt,water,xspace,Z} + language = [LaTeX]TeX, + basicstyle = {\ttfamily}, + extendedchars = true, + numbers = left, + numberstyle = \tiny, + numberblanklines = true, + gobble = 1, + xleftmargin = 20pt, + breaklines = true, + commentstyle = {\color[named]{Gray}}, } \usepackage{hyperref} - \hypersetup{colorlinks=true, - plainpages=false, - bookmarksopen=true, - bookmarksopenlevel=2, - bookmarksnumbered=true, - pdfauthor={Clemens Niederberger}, - pdftitle={chemmacros - Manual}, - pdfsubject={Hilfsmakros für den Chemiker}, - pdfkeywords={chemmacros}, - pdfcreator={LaTeX} - } +\hypersetup{ + colorlinks = true, + plainpages = false, + bookmarksopen = true, + bookmarksopenlevel = 2, + bookmarksnumbered = true, + pdfauthor = {Clemens Niederberger}, + pdftitle = {chemmacros - Manual}, + pdfsubject = {macros for the chemist}, + pdfkeywords = {chemmacros}, + pdfcreator = {LaTeX} +} -\newcommand*\paket[1]{`#1'\footnote{\url{http://www.ctan.org/pkg/#1}}} -\reversemarginpar -\newcommand*\NEU[1][]{\marginpar{\raggedleft\color{red}NEW \ifx\relax#1\relax\else\normalcolor v.#1\fi}} -\makeatletter -\let\CMname\CM@name% -\makeatother +\ExplSyntaxOn +\NewDocumentCommand \paket { o m } + { + \textsf { #2 } + \cs_if_exist:cF { paket @ #2 } + { + \cs_new_nopar:cpn { paket @ #2 } { } + \IfNoValueTF { #1 } + { \sidenote { CTAN: ~ \href { http://www.ctan.org/pkg/#2/ } { #2 } } } + { \sidenote[][ #1 ] { CTAN: \href { http://www.ctan.org/pkg/#2/ } { #2 } } } + } + } + +\newcommand*\code[1]{{\normalfont\upshape\ttfamily#1}} +\newcommand*\ma[1]{% + {\normalcolor\ttfamily\char`\{#1\char`\}}} +\newcommand*\oa[1]{% + {\normalcolor\ttfamily\char`[#1\char`]}} +\newcommand*\da[1]{% + {\normalcolor\ttfamily\char`(#1\char`)}} + +\NewDocumentCommand \cmd { m } + { + \group_begin: + \code { \char`\\ \color{code} #1 } + \group_end: + } + +\NewDocumentCommand \Key { o o d() m m } + { + \IfNoValueTF { #3 } + { + \IfNoValueTF { #2 } + { \label{key:#4} } + { \label{key:#2_#4} } + } + { \label{key:#3_#4} } + \marginnote + { + \framed + \code { \textcolor { blue } { #4 } ~ = ~ #5 } + \IfNoValueF { #1 } { \tl_if_blank:nF { #1 } { \newline default: ~ \code { #1 } } } + \IfNoValueTF { #2 } + { \newline \textcolor { red } { no ~ module } } + { \newline module: ~ \code { #2 } } + \endframed + } + } + +\NewDocumentCommand \changed { m } + { + \group_begin: + \colorlet { shadecolor } { red!20 } + \marginnote + { + \shaded + The ~ command ~ \cmd { #1 } ~ has ~ a ~ new ~ syntax ~ with ~ v2.0 . \tl_use:N \c_space_tl + The ~ package ~ option ~ \code { version=1 } \tl_use:N \c_space_tl + restores ~ the ~ former ~ syntax. + \endshaded + } + \group_end: + } + +\NewDocumentCommand \formercmd { m } + { + \marginnote + { + \cmd { #1 } ~ is ~ not ~ provided ~ any ~ more. ~ Use ~ package ~ option ~ + \code { version = 1 } ~ to ~ reactivate ~ it. + } + } +\ExplSyntaxOff + +\newcommand*\eg{\mbox{e.\,g.}\xspace} \newcommand*\ie{\mbox{i.\,e.}\xspace} +\newcommand*\etc{\mbox{etc.}\xspace} \newcommand*\TikZ{\mbox{Ti\textbf{\textit{k}}Z}\xspace} + \begin{document} \begin{titlepage} + \begin{fullwidth} \centering - \Huge\CMname\ v\makeatletter\CM@version\makeatother + \Huge chemmacros v\CMversion \vskip.5cm - \Large\makeatletter\CM@date\makeatother + \Large\CMdate \vskip.5cm \large Clemens \textsc{Niederberger} \vskip.25cm @@ -98,870 +183,867 @@ \href{mailto:contact@mychemistry.eu}{contact@mychemistry.eu} \vskip2cm \begin{abstract} - `\CMname' is a collection of macros and commands which are intended to make typesetting chemistry documents with \LaTeXe\ faster and more convenient. Coverage includes some nomenclature commands, oxidation numbers, thermodynamic data, newman projections, \etc + \CMname is a collection of macros and commands which are intended to make typesetting chemistry documents with \LaTeXe\ faster and more convenient. Coverage includes some nomenclature commands, oxidation numbers, thermodynamic data, newman projections, \etc \end{abstract} + \end{fullwidth} \end{titlepage} \tableofcontents -\section{Licence, Requirements} -`\CMname' v\makeatletter\CM@version\makeatother\ underlies the The \LaTeX\ project public license\\(\url{http://www.latex-project.org/lppl.txt}). - -`\CMname' internally loads the packages \paket{amsmath}, \paket{ifthen}, \paket{siunitx}, \paket{xparse} and `tikz' (\TikZ = \paket{pgf}) as well as the tikzlibrary \lstinline=calc=. If they're missing it will cause an error. - -`siunitx' needs \LaTeX3 support as provided in the \paket{expl3} and \paket{xpackages} bundles. `xparse' is part of the `xpackages' bundle. This means, that `\CMname' also needs \LaTeX3 support. - -The definition of some commands depends on which packages else have been loaded. Some commands are only defined if a certain package has been loaded. This concerns the packages \paket{bpchem}, \paket{chemstyle} and \paket{mhchem}.It is mentioned explicitly in the documentation, if a command has a definition depending on one of these packages. +\section{What's New?} +With the update to v\CMversion lot's has changed behind the scenes. The settings now are done completely with a key/value system. This way there are now much more possibilities to customize commands. This also means that the syntax of a number of commands has changed\changed{command}. In order to provide compatibility with documents set with v1.*, there is now the package option \code{version=1}, which restores the old definitions. If a command has been changed, you can see this through a note in the margin. Some commands now are deprecated\formercmd{command} and are not longer provided unless the option \code{version=1} is used. -The package option \lstinline=bpchem= (section \ref{sec:optionen}) needs the package `bpchem' to be available. +\section{Licence, Requirements} +\CMname v\CMversion underlies the The \LaTeX\ project public license version 1.3 or later. (\url{http://www.latex-project.org/lppl.txt}) -The package option \lstinline=xspace= (section \ref{sec:optionen}) needs the package \paket{xspace} to be available. +\CMname uses the packages \textsf{expl3}, \paket{xparse}, \paket{l3keys2e} and \paket{xfrac}, which are part of the bundles \paket{l3kernel} and \paket{l3packages}. \paket{expl3} is part of \paket{l3kernel}, and \paket{xparse}, \paket{l3keys2e} and \paket{xfrac} are part of \paket{l3packages}. -If the user loads `mhchem', the packages \paket{mathtools} and \paket{environ} are needed. +\CMname also uses the packages \paket{siunitx}, \paket{mhchem}, \paket{mathtools} and \paket{environ} as well as \TikZ (\paket{pgf}) and the \TikZ libraries \code{calc} and \code{arrows}. -\textbf{Please take notice, that the package options have changed with version 1.1.} +Package option \code{bpchem} (section \ref{sec:optionen}) needs the package \paket{bpchem} and package option \code{xspace} needs the package \paket{xspace}. -\newpage \section{Package Options}\label{sec:optionen} -\NEU[1.1]`\CMname' has four package options: +\CMname has several package options.\marginnote{This document is set with default behaviour.}\marginnote[\baselineskip]{\code{bpchem = false} \NMR;\\\code{bpchem = true} {\chemsetup[option]{bpchem}\NMR};}\marginnote[\baselineskip]{\code{circled = none} {\chemsetup[option]{circled=none}\mch\ \pch\ \fmch\ \fpch}\\\code{circled = formal, circletype = chem} {\chemsetup[option]{circled}\mch\ \pch\ \fmch\ \fpch}\\\code{circled = all, circletype = chem} {\chemsetup[option]{circled=all,circletype=chem}\mch\ \pch\ \fmch\ \fpch}\\\code{circled = formal, circletype = math} {\chemsetup[option]{circled,circletype=math}\mch\ \pch\ \fmch\ \fpch}\\\code{circled = all, circletype = math} {\chemsetup[option]{circled=all,circletype=math}\mch\ \pch\ \fmch\ \fpch}} They all are used as key/value pairs like \cmd{usepackage\oa{option1 = <value1>, option2 = <value2>}\ma{chemmacros}}. Some also can be used without value (\cmd{usepackage\oa{option1, option2}\ma{chemmacros}}), which means that the \uline{underlined} value is used. \begin{description} - \item[\texttt{bpchem}] With this option first the package `bpchem' is loaded and second the appearance of the \lstinline=\NMR= command is changed to match the `bpchem' commands \lstinline=\HNMR= and \lstinline=\CNMR=. Without option: \NMR; with option: \HNMR; - \item[\texttt{circled}] Some chemists -- like me -- prefer circled charge symbols to have a clear distinction between charge and math symbols. In `\CMname's default behaviour they're \emph{not} circled ($+$ und $-$). With the option \lstinline+circled+ all commands of `\CMname' use the circled ones ($\oplus$ und $\ominus$). - \item[\texttt{german}] This option changes \lstinline=\pKa= from \mbox{\textsl{p}$K_\mathrm{A}$} into \mbox{\textsl{p}$K_\mathrm{S}$}. Also the phase identifiers \lstinline=\solid= and \lstinline=\liquid= are changed from \solid\ and \liquid\ into \solid[f] and \liquid[f\/l]. - \item[\texttt{xspace}] With this option, the following commands get a \lstinline=\xspace=: \lstinline=\Hpl= \lstinline=\HtO= \lstinline=\water= \lstinline=\Hyd= \lstinline=\HtO= \lstinline=\pH= \lstinline=\pOH= \lstinline=\pKa= \lstinline=\pKb= \lstinline=\cis= \lstinline=\trans= \lstinline=\insitu= \lstinline=\abinitio= \lstinline=\mech= \lstinline=\NMR= \Hpl \HtO \water \Hyd \HtO \pH \pOH \pKa \pKb \cis \trans \insitu \abinitio \mech \NMR\\ - The two commands \lstinline=\cis= and \lstinline=\trans= are also defined by the `bpchem' package. If you load that package, they are redefined by `\CMname'. In the definition of `bpchem' they \textit{always} have a \lstinline=\xspace=, with `\CMname' only with option \lstinline=xspace=. Apart from that they're identical. + \item[\code{bpchem = \uline{true}/false>}] This option loads the package \paket{bpchem} and adjusts the layout of the \cmd{NMR} command to the \paket{bpchem} commands \cmd{HNMR} and \cmd{CNMR}. (default: \code{false})\label{key:option_bpchem} + % + \item[\code{circled = \uline{formal}/all/none}] \CMname uses two different kinds of charges\footnote{Thanks to Christoph Sch\"afer, who pointed out to me, that v1.1 handled the charges too undifferentiated!}, which indicate the usage of real ($+/-$ ) and formal (\fplus/\fminus) charges. The option \code{formal} distinguishes between them, option \code{none} displays them all without circle, option \code{all} circles all (default: \code{formal}).\label{key:option_circled} + % + \item[\code{circletype = \uline{chem}/math}] This option switches between two kinds of circled charge symbols: \cmd{fplus} \fplus\ and \code{\$\cmd{oplus}\$} $\oplus$. (Default: \code{chem})\label{key:option_circletype} + % + \item[\code{EZ = \uline{chemmacros}/cool}] The command \cmd{E} is defined by the package \paket{cool} as well as by \CMname. With this option you can choose, which definition is used, see page \pageref{EZ}. (default: \code{chemmacros})\label{key:option_EZ} + % + \item[\code{german = \uline{true}/false}]\marginnote{\code{german = false} {\chemsetup[option]{german=false}\pKa, \sld, \lqd}\\\code{german = true} \pKa, \sld, \lqd} This option changes the commands \cmd{pKa}, \cmd{sld} and \cmd{lqd} (default: \code{false})\label{key:option_german} + % + \item[\code{version = 1/2}] This option restores the old definitions of some commands, so documents set with v1.* will still compile correctly. You'll find notes in the margin for every changed command. (default: \code{2})\label{key:option_version} + % + \item[\code{xspace = \uline{true}/false}] With this option most commands are defined with a \cmd{xspace}. (default: \code{true})\label{key:option_xspace} \end{description} -\section{Particles, Ions and a Symbol}\label{sec:teilchen} -Some simple macros for displaying often needed particles and a symbol. Please note, that they're displayed differently depending on the package options used, see section \ref{sec:optionen}. -\begin{itemize} - \item\lstinline=\Hpl= \Hpl (proton) - \item\lstinline=\Hyd= \Hyd (hydroxide) - \item\NEU[1.1]\lstinline=\HtO= \HtO (oxonium) (\textbf{H} \textbf{t}hree \textbf{O}) - \item\NEU[1.1]\lstinline=\water= \water - \item\lstinline=\el= \el (electron) - \item\lstinline=\prt= \prt (proton) - \item\lstinline=\ntr= \ntr (neutron) - \item\NEU[1.1]\lstinline=\Nu= \Nu (nucleophile) - \item\NEU[1.1]\lstinline=\El= \El (electrophile) - \item\lstinline=\transitionstatesymbol= \transitionstatesymbol\ transition state symbol (uses `\TikZ') -\end{itemize} -These commands are working both in text mode and math mode. Depending on wether `mhchem' has been loaded, atoms are defined with the \lstinline=\cf{}= command or with \lstinline=\mbox{}=. - -\NEU[1.1]There is another command which allows to typeset radicals with charges and subscripts. +\section{Setup} +Various of \CMname's commands have key/value pairs with which they are customized. Most times they can be used as (optional) argument of the copmmands themselves. They also can most times be used with the \cmd{chemsetup} command. +\begin{framed} + \cmd{chemsetup\oa{<module>}\ma{<key> = <value>}} or \\ + \cmd{chemsetup\ma{<module>/<key> = <value>}} +\end{framed} +The keys\Key[<default>][<module>]{<key>}{<value>} each belong to a module, which defines for which commands they are intended for. If a key is presented, you'll see a box in the margin that gives you information to that key. You have two ways to use keys with the \cmd{chemsetup}, as you can see in the box above. + +The package options can also be seen as keys belonging to the module \code{option}. This means they can also be used with the \cmd{chemsetup} command (except for the option \code{version=1/2}). +\begin{LTXexample}[pos=b] + \chemsetup[option]{circled=none}\mch\ \pch\ \fmch\ \fpch\ \el\ \prt \\ + \chemsetup[option]{circled=formal}\mch\ \pch\ \fmch\ \fpch\ \el\ \prt \\ + \chemsetup[option]{circletype=math}\mch\ \pch\ \fmch\ \fpch\ \el\ \prt \\ + \chemsetup{option/circletype=chem,option/circled=all}\mch\ \pch\ \fmch\ \fpch\ \el\ \prt \\ + \chemsetup{option/circletype=math}\mch\ \pch\ \fmch\ \fpch\ \el\ \prt +\end{LTXexample} +Keys \emph{not} belonging to a module \emph{cannot} be used with \cmd{chemsetup}! + +\section{Particles, Ions and Symbols}\label{sec:teilchen} +Some simple macros for displaying often needed particles and a symbol. Please note, that they're displayed differently depending on the package options used, see section \ref{sec:optionen}.\marginnote{These commands can be used in text as well as in math mode.} \begin{itemize} - \item\lstinline=\R[<sign>]{<subscript>}= \eg \lstinline=\R[+]{tert} \R[-]{sek} \R{prim}= \R[+]{tert} \R[-]{sek} \R{prim} + \item\cmd{Hpl} \Hpl (proton) + \item\cmd{Hyd} \Hyd (hydroxide) + \item\cmd{HtO} \HtO (oxonium ion) (\textbf{H} \textbf{t}hree \textbf{O}) + \item\cmd{water} \water + \item\cmd{el} \el (electron) + \item\cmd{prt} \prt (proton) + \item\cmd{ntr} \ntr (neutron) + \item\cmd{Nu} \Nu (nucleophile) + \item\cmd{El} \El (electrophile) + \item\cmd{fplus} \fplus + \item\cmd{fminus} \fminus + \item\cmd{transitionstatesymbol} \transitionstatesymbol\ (uses \TikZ) + \item\cmd{standardstate} \standardstate. This symbol is only provided by \CMname, if the package \paket{chemstyle} is not loaded; the idea is borrowed from there\footnote{thanks to the package author \href{http://www.texdev.net/}{Joseph Wright}.}. \end{itemize} +There is another command which allows to typeset radicals with charges and subscripts. +\begin{framed} + \cmd{R\oa{<sign>}\ma{<subscript>}} +\end{framed} +\begin{LTXexample} + \R[+]{tert} \R[-]{sek} \R{prim} +\end{LTXexample} \section{Stereo Descriptors, Nomenclature, Latin Phrases}\label{sec:stereo} \subsection{Stereo Descriptors and Nomenclature} The following macros are intended to make the writing of IUPAC names more convenient: \begin{itemize} \item Cahn-Ingold-Prelog: - \begin{itemize} - \item\lstinline=\Rcip= \Rcip - \item\lstinline=\Scip= \Scip - \item\lstinline=\cip{<conf>}= e.\,g.: \lstinline=\cip{R,S}= \cip{R,S} - \end{itemize} + \begin{framed} + \cmd{Rcip} \Rcip \\ + \cmd{Scip} \Scip \\ + \cmd{cip\ma{<conf>}} \eg: \cmd{cip\ma{R,S}} \cip{R,S} + \end{framed} \item Fischer: - \begin{itemize} - \item\lstinline=\Dfi= \Dfi - \item\lstinline=\Lfi= \Lfi - \end{itemize} - \item cis/trans \&\ zusammen/entgegen: - \begin{itemize} - \item\lstinline=\Z= \Z - \item\lstinline=\E= \E - \item\lstinline=\cis= \cis (This command is also defined by the package `bpchem'. `\CMname' redefines it, see section \ref{sec:optionen}.) - \item\lstinline=\trans= \trans (This command is also defined by the package `bpchem'. `\CMname' redefines it, see section \ref{sec:optionen}.) - \end{itemize} + \begin{framed} + \cmd{Dfi} \Dfi \\ + \cmd{Lfi} \Lfi + \end{framed} + \item cis/trans and zusammen/entgegen:\marginnote{Please notice, that the commands \cmd{cis} and \cmd{trans} are defined by the \paket{bpchem} package as well. If you load that package, they are redefined by \CMname. With \paket{bpchem} they \textit{always} get a \cmd{xspace}, with \CMname only , when option \code{xspace} is used.} + \begin{framed} + \cmd{Z} \Z\label{EZ} \\ + \cmd{E} \E\ (\cmd{E} is also defined by the package \paket{cool}. By using the package option \code{EZ = cool} instead of \cmd{E} and \cmd{Z} \CMname defines \cmd{Ent} and \cmd{Zus}.) \\ + \cmd{cis} \cis \\ + \cmd{trans} \trans + \end{framed} \item ortho/meta/para: - \begin{itemize} - \item\lstinline=\ortho= \ortho - \item\lstinline=\meta= \meta - \item\lstinline=\para= \para - \end{itemize} -\end{itemize} -absolute configuration (uses `\TikZ'): -\begin{itemize} - \item\lstinline=\Rconf[<letter>]= \lstinline=\Rconf=: \Rconf \quad\lstinline=\Rconf[]=: \Rconf[] - \item\lstinline=\Sconf[<letter>]= \lstinline=\Sconf=: \Sconf \quad\lstinline=\Sconf[]=: \Sconf[] + \begin{framed} + \cmd{ortho} \ortho \\ + \cmd{meta} \meta \\ + \cmd{para} \para + \end{framed} \end{itemize} +absolute configuration (uses \TikZ): +\begin{framed} + \cmd{Rconf\oa{<letter>}} \cmd{Rconf}: \Rconf \quad\cmd{Rconf\oa{}}: \Rconf[] \\ + \cmd{Sconf\oa{<letter>}} \cmd{Sconf}: \Sconf \quad\cmd{Sconf\oa{}}: \Sconf[] +\end{framed} + +Examples:\marginnote{Of course the appearance depends on the font you chose:\par\cip{2S,3R} \E \Z \Dfi \Lfi\par\fontfamily{ptm}\selectfont\cip{2S,3R} \E \Z \Dfi \Lfi\par\fontfamily{ppl}\selectfont\cip{2S,3R} \E \Z \Dfi \Lfi} +\begin{LTXexample}[pos=b] + \Dfi-Weins\"aure = \cip{2S,3S}-Weins\"aure \\ + \Dfi-($-$)-Threose = \cip{2S,3R}-($-$)-2,3,4-Trihydroxybutanal \\ + \cis-2-Buten = \Z-2-Butene, \cip{2E,4Z}-Hexadiene \\ + \meta-Xylol = 1,3-Dimethylbenzene \\ + % with bpchem's command \IUPAC: + \IUPAC{\Dfi\-Wein\|s\"aure} = \IUPAC{\cip{2S,3S}\-Wein\|s\"aure}, \IUPAC{\Dfi\-($-$)\-Threose} = \IUPAC{\cip{2S,3R}\-($-$)\-2,3,4\-Tri\|hydroxy\|butanal} +\end{LTXexample} -Examples: -\begin{lstlisting} - \Dfi-Tartaric Acid = \cip{2S,3S}-Tartaric Acid -\end{lstlisting} -\Dfi-Tartaric Acid = \cip{2S,3S}-Tartaric Acid -\begin{lstlisting} - \Dfi-($-$)-Threose = \cip{2S,3R}-($-$)-2,3,4-Trihydroxybutanal -\end{lstlisting} -\Dfi-($-$)-Threose = \cip{2S,3R}-($-$)-2,3,4-Trihydroxybutanal -\begin{lstlisting} - \cis-2-Buten = \Z-2-Butene, \cip{2E,4Z}-Hexadiene -\end{lstlisting} -\cis-2-Buten = \Z-2-Butene, \cip{2E,4Z}-Hexadiene -\begin{lstlisting} - \meta-Xylol = 1,3-Dimethylbenzene -\end{lstlisting} -\meta-Xylol = 1,3-Dimethylbenzene -\begin{lstlisting} - % with `bpchem' command \IUPAC: - \IUPAC{\Dfi-Tar\|taric Acid} = \IUPAC{\cip{2S,3S}-Tar\|taric Acid}, \IUPAC{\Dfi-($-$)-Threose} = \IUPAC{\cip{2S,3R}-($-$)-2,3,4\-Tri\|hydroxy\|butanal} -\end{lstlisting} -\IUPAC{\Dfi-Tar\|taric Acid} = \IUPAC{\cip{2S,3S}-Tar\|taric Acid}, \IUPAC{\Dfi-($-$)-Threose} = \IUPAC{\cip{2S,3R}-($-$)-2,3,4\-Tri\|hydroxy\|butanal} - -The last example uses the \lstinline=\IUPAC= command, which is provided by the `bpchem' package. - -Of course the appearance depends on the font you chose: -\begin{lstlisting} - \cip{2S,3R} \E \Z \Dfi \Lfi \par - \fontfamily{ptm}\selectfont - \cip{2S,3R} \E \Z \Dfi \Lfi \par - \fontfamily{ppl}\selectfont - \cip{2S,3R} \E \Z \Dfi \Lfi -\end{lstlisting} -\cip{2S,3R} \E \Z \Dfi \Lfi - -\fontfamily{ptm}\selectfont -\cip{2S,3R} \E \Z \Dfi \Lfi - -\fontfamily{ppl}\selectfont -\cip{2S,3R} \E \Z \Dfi \Lfi -\fontfamily{cmr}\selectfont - +\newpage \subsection{Latin Phrases} -\NEU[1.1]At last there are two commands for common latin phrases. -\begin{itemize} - \item\lstinline=\insitu= \insitu - \item\lstinline=\abinitio= \abinitio -\end{itemize} -If the package `chemstyle' has been loaded, too\footnote{`chemstyle' defines other similar commands like \etal, \invacuo.}, they are defined using `chemstyle's \lstinline=\latin= command. This means that then the appearance depends on `chemstyle's option \lstinline=abbremph=: -\begin{lstlisting} +At last there are two commands for common latin phrases. +\begin{framed} + \cmd{insitu} \insitu \\ + \cmd{abinitio} \abinitio +\end{framed} +If the package \paket{chemstyle} has been loaded, too\footnote{\paket{chemstyle} defines other similar commands like \etal, \invacuo.}, they are defined using \paket{chemstyle}'s \cmd{latin} command. This means that then the appearance depends on \paket{chemstyle}'s option \code{abbremph}: +\begin{LTXexample} \insitu, \abinitio\\ \cstsetup{abbremph=false} \insitu, \abinitio -\end{lstlisting} -{\insitu, \abinitio\\ -\cstsetup{abbremph=false} -\insitu, \abinitio} +\end{LTXexample} +If \paket{chemstyle} hasn't been loaded, they're always in \textit{italics}. -If `chemstyle' hasn't been loaded, they're always in \textit{italics}. - -\section{Units with `siunitx'}\label{sec:einheiten} -\NEU[1.1]In chemistry some non-SI units are very common. `siunitx' provides the command \lstinline=\DeclareSIUnit{<command>}{<unit>}= to add arbitrary units. `\CMname' uses that command to provide some units. Like all `siunitx' units they're only valid inside \lstinline=\SI{<num>}{<unit>}= and \lstinline=\si{<unit>}=. +\section{Units with \textsf{siunitx}}\label{sec:einheiten} +In chemistry some non-SI units are very common. \paket{siunitx} provides the command \cmd{DeclareSIUnit\ma{<command>}\ma{<unit>}} to add arbitrary units. \CMname uses that command to provide some units. Like all \paket{siunitx} units they're only valid inside \cmd{SI\ma{<num>}\ma{<unit>}} and \cmd{si\ma{<unit>}}. \begin{itemize} - \item\lstinline=\atmosphere= \si{\atmosphere} - \item\lstinline=\atm= \si{\atm} - \item\lstinline=\calory= \si{\calory} - \item\lstinline=\cal= \si{\cal} - \item\lstinline=\cmc= \si{\cmc} {}\footnote[1]{These units are also defined by `chemstyle'. They are only defined by `\CMname', if `chemstyle' is not loaded.} - \item\lstinline=\molar= \si{\molar} {}\footnotemark[1] - \item\lstinline=\moLar= \si{\moLar} - \item\lstinline=\Molar= \si{\Molar} {}\footnotemark[1] - \item\lstinline=\MolMass= \si{\MolMass} - \item\lstinline=\normal= \si{\normal} - \item\lstinline=\torr= \si{\torr} + \item\cmd{atmosphere} \si{\atmosphere} + \item\cmd{atm} \si{\atm} + \item\cmd{calory} \si{\calory} + \item\cmd{cal} \si{\cal} + \item\cmd{cmc} \si{\cmc}\marginnote{The units \cmd{cmc}, \cmd{molar}, and \cmd{Molar} are defined by the package \paket{chemstyle} as well. \CMname only defines them, if \paket{chemstyle} is not loaded.} + \item\cmd{molar} \si{\molar} + \item\cmd{moLar} \si{\moLar} + \item\cmd{Molar} \si{\Molar} + \item\cmd{MolMass} \si{\MolMass} + \item\cmd{normal} \si{\normal} + \item\cmd{torr} \si{\torr} \end{itemize} -By the way: \lstinline=\mmHg= \si{\mmHg} is already defined by `siunitx'. +\marginnote[-3\baselineskip]{By the way: \cmd{mmHg} \si{\mmHg} already is defined by \paket{siunitx} and \paket{chemstyle}.} \section{Acid/Base}\label{sec:saeure_base} -\NEU[1.1]Easy representation of \pH, \pKa \ldots -\begin{itemize} - \item\lstinline=\pH= \pH - \item\lstinline=\pOH= \pOH - \item\lstinline=\pKa[<num>]= \lstinline=\pKa= \pKa, \lstinline=\pKa[1]= \pKa[1] - \item\lstinline=\pKb[<num>]= \lstinline=\pKb= \pKb, \lstinline=\pKb[1]= \pKb[1] -\end{itemize} -These commands can be used both in text and in math mode as well as inside the \lstinline=\ce=\linebreak command of the `mhchem' package. The command \lstinline=\pKa= depends on the package option \lstinline=german=, see section \ref{sec:optionen}. - -\section{Oxidation Numbers and (real) Charges}\label{sec:ladungen} +Easy representation of \pH, \pKa \ldots\marginnote{These commands can be used both in text and in math mode as well as inside the \cmd{ce} command of the \paket{mhchem} package. The command \cmd{pKa} depends on the package option \code{german}, see section \ref{sec:optionen}.} +\begin{framed} + \cmd{pH} \pH \\ + \cmd{pOH} \pOH \\ + \cmd{pKa\oa{<num>}} \cmd{pKa} \pKa, \cmd{pKa\oa{1}} \pKa[1] \\ + \cmd{pKb\oa{<num>}} \cmd{pKb} \pKb, \cmd{pKb\oa{1}} \pKb[1] \\ + \cmd{p\ma{<anything>}} \eg \cmd{p\ma{K\_w}} \p{K_w} +\end{framed} +\begin{LTXexample} + \pKa \pKa[1] \pKb \pKb[1]\\ + \chemsetup[option]{german=true} + \pKa \pKa[1] \pKb \pKb[1] +\end{LTXexample} + +\section{Oxidation Numbers, real and formal Charges}\label{sec:ladungen} +\CMname distinguishes between real ($+$/$-$) and formal (\fplus/\fminus) charge symbols, also see section \ref{sec:optionen}. All commands using formal charge symbols start with a \code{f}. \subsection{Ion Charges}\label{ssec:ionen} -Simple displaying of charges: +Simple displaying of (real) charges: +\begin{framed} + \cmd{pch\oa{<number>}} positive charge (\textbf{p}lus + \textbf{ch}arge) \\ + \cmd{mch\oa{<number>}} negative charge (\textbf{m}inus + \textbf{ch}arge) +\end{framed} +\begin{LTXexample} + \pch, Na\pch, Ca\pch[2]\\ + \mch, F\mch, S\mch[2] +\end{LTXexample} + +The same for formal charges: +\begin{framed} + \cmd{fpch\oa{<number>}} positive charge\\ + \cmd{fmch\oa{<number>}} negative charge +\end{framed} +\begin{LTXexample} + \fpch\ \fmch\ \fpch[3] \fmch[3] +\end{LTXexample} + +There is a key which influences the behaviour of the charges\Key[false][charges]{append}{\uline{true}/false}. \begin{itemize} - \item\lstinline=\pch[<number>]= positive charge (\textbf{p}lus + \textbf{ch}arge): \lstinline=\pch= \pch, \lstinline=Na\pch= Na\pch, \lstinline=Ca\pch[2]= Ca\pch[2] - \item\lstinline=\mch[<number>]= negative charge (\textbf{m}inus + \textbf{ch}arge): \lstinline=\mch= \mch, \lstinline=F\mch= F\mch, \lstinline=S\mch[2]= S\mch[2] + \item\code{append = \uline{true}/false} if set \code{true}, the charge is appended together with an empty group. \end{itemize} +This is, how the key influences the behaviour: +\begin{LTXexample} + \chemsetup[charges]{append=false} + \ce{H\pch\aq} \ce{H\aq\pch} + + \chemsetup[charges]{append=true} + \ce{H\pch\aq} \ce{H\aq\pch} +\end{LTXexample} +In most cases this behaviour will be unwanted. However, in some cases it might be useful, for example together with the \cmd{ox} (see next section): +\begin{LTXexample} + \chemsetup[charges]{append=false} + \ce{\ox{1,H}\pch\aq} + + \chemsetup[charges]{append=true} + \ce{\ox{1,H}\pch\aq} +\end{LTXexample} \subsection{Oxidation Numbers}\label{ssec:oxidationszahlen} -Typesetting oxidation numbers: +Typesetting oxidation numbers:\changed{ox} +\begin{framed} + \cmd{ox\oa{<keyval>}\ma{<number>,<atom>}} places \code{<number>} above \code{<atom>}\\ + \code{<number>} has to be a (rational) number! +\end{framed} +\begin{LTXexample} + \ox{+1,Na}, \ox{2,Ca}, \ox{-2,S}, \ox{-1,F} +\end{LTXexample} + +There are a number of keys, that can be used to modify the \cmd{ox} command.\Key[true][ox]{parse}{\uline{true}/false}\Key[true][ox]{roman}{\uline{true}/false} \begin{itemize} - \item\lstinline=\ox{<number>,<atom>}= places \lstinline=<number>= above \lstinline=<atom>=; \lstinline=\ox{+1,Na}=, \lstinline=\ox{+I,Na}=, \lstinline=\ox{-2,S}=, \lstinline=\ox{-II,S}= \ox{+1,Na}, \ox{+I,Na}, \ox{-2,S}, \ox{-II,S} + \item\code{parse = \uline{true}/false} when \code{false} an arbitrary entry can be used for \code{<number>}. + \item\code{roman = \uline{true}/false} switches from roman to arabic numbers. + \item\code{pos = top/super/side}; \code{top} places \code{<number>} above \code{<atom>}, \code{super} to the upper right and \code{side} to the right and inside brackets. + \item\code{explicit-sign = \uline{true}/false} shows the $+$ for positiv numbers and the $\pm$ for $0$. + \item\code{decimal-marker = comma/point} choice for the decimal marker for formal oxidation numbers like \ox{1.2,X}. \end{itemize} -If the package `mhchem' has been loaded \lstinline=<atom>= is set inside the \lstinline=\ce= command: \lstinline=\ox{+II,Ca}\ox{-I,F2}= \ox{+II,Ca}\ox{-I,F2}. Without `mhchem' this isn't working this way {\makeatletter\def\oxNoMhchem#1#2{\ensuremath{\overset{\text{\tiny\CM@ox@sign#1}}{\text{#2}}}}\makeatother(\oxNoMhchem{+II}{Ca}\oxNoMhchem{-I}{F2}) and you need to use the math way: \lstinline=\ox{+II,Ca}\ox{-I,F$_2$}= \oxNoMhchem{+II}{Ca}\oxNoMhchem{-I}{F$_2$}}. +\Key[top][ox]{pos}{top/super/side}\Key[false][ox]{explicit-sign}{\uline{true}/false}\Key[point][ox]{decimal-marker}{comma/point} +\begin{LTXexample} + \ox[roman=false]{2,Ca} \ox{2,Ca} \\ + \ox[pos=super]{3,Fe}-Oxide \\ + \ox[pos=side]{3,Fe}-Oxide \\ + \ox[parse=false]{?,Mn} +\end{LTXexample} +The \code{pos=super} variant also can be set with the shortcut \cmd{ox*}: +\begin{LTXexample} + \ox{3,Fe} \ox*{3,Fe} +\end{LTXexample} +Using the \code{explicit-sign} key will always show the sign of the oxidation number: +\begin{LTXexample} + \chemsetup[ox]{explicit-sign = true} + \ox{+1,Na}, \ox{2,Ca}, \ox{-2,S}, \ox{0,F2} +\end{LTXexample} +As you could see in the last example, \code{<atom>} is placed within \paket{mhchem}'s \cmd{ce} command. However, using this fact does not necessarily give good results. +\begin{LTXexample}[pos=b] + Compare \ox{-1,O2^{2-}} to \ce{\ox{-1,O}{}_2 \mch[2]} or \ce{\ox{-1,O}{}_2^{2-}}. +\end{LTXexample} +Sometimes one might want to use formal oxidation numbers like \num{.5} or $\frac{1}{3}$. This is possible: +\begin{LTXexample} + \ox{.5,Br2\pch} \ox{1/3,I3+} +\end{LTXexample} \subsection{Partial Charges and similar Stuff}\label{ssec:partialladungen} The next ones probably are seldomly needed but nevertheless useful: -\begin{itemize} - \item\lstinline=\delp= \delp (\textbf{del}ta + \textbf{p}lus) - \item\lstinline=\delm= \delm (\textbf{del}ta + \textbf{m}inus) -\end{itemize} -These macros for example can be used with the \lstinline=\ox= command or with the \paket{chemfig} package: -\begin{lstlisting} - \ox{\delp,H}\ox{\delm,Cl}\par +\begin{framed} + \cmd{delp} \delp\ (\textbf{del}ta + \textbf{p}lus) \\ + \cmd{delm} \delm\ (\textbf{del}ta + \textbf{m}inus) \\ + \cmd{fdelp} \fdelp \\ + \cmd{fdelm} \fdelm +\end{framed} +These macros for example can be used with the \cmd{ox} command or with the \paket{chemfig} package: +\begin{LTXexample}[pos=b] + \chemsetup{ + option/circled = all, + ox/parse = false + } + \ox{\delp,H}\ox{\delm,Cl} \hspace*{1cm} \chemfig{\chemabove[3pt]{\lewis{246,Br}}{\delm}-\chemabove[3pt]{H}{\delp}} -\end{lstlisting} -\ox{\delp,H}\ox{\delm,Cl}\par -\chemfig{\chemabove[3pt]{\lewis{246,Br}}{\delm}-\chemabove[3pt]{H}{\delp}} - -The following macros are useful together with `chemfig', too. -\begin{itemize} - \item\lstinline=\scrp= \scrp (\textbf{scr}iptstyle + \textbf{p}lus) - \item\lstinline=\scrm= \scrm (\textbf{scr}iptstyle + \textbf{m}inus) -\end{itemize} -For example: -\begin{lstlisting} - {\setatomsep{1.8em}\chemfig{CH_3-\chemabove{C}{\scrp}(-[6]C|H_3)-\vphantom{H_3}CH_3}} -\end{lstlisting} -{\setatomsep{1.8em}\chemfig{CH_3-\chemabove{C}{\scrp}(-[6]C|H_3)-\vphantom{H_3}CH_3}} +\end{LTXexample} + +The following macros are useful together with \paket{chemfig}, too. +\begin{framed} + \cmd{scrp} \scrp (\textbf{scr}iptstyle + \textbf{p}lus) \\ + \cmd{scrm} \scrm (\textbf{scr}iptstyle + \textbf{m}inus) \\ + \cmd{fscrp} \fscrp \\ + \cmd{fscrm} \fscrm +\end{framed} +\begin{LTXexample}[pos=b,rframe=] + \setatomsep{1.8em}\chemfig{CH_3-\chemabove{C}{\scrp}(-[6]C|H_3)-\vphantom{H_3}CH_3} + + \chemfig{\fmch{}|O-\chemabove{N}{\fscrp}(-[1]O|\fmch)-[7]O|\fmch} +\end{LTXexample} -\newpage \section{Reaction Mechanisms}\label{sec:mechanismen} -\NEU[1.1]With the command -\begin{lstlisting} - \mech[<type>] -\end{lstlisting} -one can specify the most common reaction mechanisms. \lstinline=<type>= can have one of the following values: +With the command\marginnote{This command can also be used in math mode and inside the \cmd{ce} command of the \paket{mhchem} package.} +\begin{framed} + \cmd{mech\oa{<type>}} +\end{framed} +one can specify the most common reaction mechanisms. \code{<type>} can have one of the following values: \begin{itemize} - \item\lstinline+<type>=+ (empty, no opt. argument) nucleophilic substitution \lstinline=\mech= \mech - \item\lstinline+<type>=1+ unimolecular nucleophilic substitution \lstinline=\mech[1]= \mech[1] - \item\lstinline+<type>=2+ bimolecular nucleophilic substitution \lstinline=\mech[2]= \mech[2] - \item\lstinline+<type>=se+ electrophilic substitution \lstinline=\mech[se]= \mech[se] - \item\lstinline+<type>=1e+ unimolecular electrophilic substitution \lstinline=\mech[1e]= \mech[1e] - \item\lstinline+<type>=2e+ bimolecular electrophilic substitution \lstinline=\mech[2e]= \mech[2e] - \item\lstinline+<type>=ar+ electrophilic aromatic substitution \lstinline=\mech[ar]= \mech[ar] - \item\lstinline+<type>=+ elimination \lstinline=\mech[e]= \mech[e] (probably never to be used) - \item\lstinline+<type>=e1+ unimolecular elimination \lstinline=\mech[e1]= \mech[e1] - \item\lstinline+<type>=e2+ bimolecular elimination \lstinline=\mech[e2]= \mech[e2] - \item\lstinline+<type>=cb+ unimolecular elimination "conjugated base", \ie via carbanion \lstinline=\mech[cb]= \mech[cb] + \item\cmd{mech} (empty, no opt. argument) nucleophilic substitution \mech + \item\cmd{mech\oa{1}} unimolecular nucleophilic substitution \mech[1] + \item\cmd{mech\oa{2}} bimolecular nucleophilic substitution \mech[2] + \item\cmd{mech\oa{se}} electrophilic substitution \mech[se] + \item\cmd{mech\oa{1e}} unimolecular electrophilic substitution \mech[1e] + \item\cmd{mech\oa{2e}} bimolecular electrophilic substitution \mech[2e] + \item\cmd{mech\oa{ar}} electrophilic aromatic substitution \mech[ar] + \item\cmd{mech\oa{e}} elimination \mech[e] + \item\cmd{mech\oa{e1}} unimolecular elimination \mech[e1] + \item\cmd{mech\oa{e2}} bimolecular elimination \mech[e2] + \item\cmd{mech\oa{cb}} unimolecular elimination "conjugated base", \ie via carbanion \mech[cb] \end{itemize} -This command can also be used in math mode and inside the \lstinline=\ce= command of the `mhchem' package. -\begin{lstlisting} - $\mech[cb]$ \ce{\mech[2]} \ce{\mech[ar]} -\end{lstlisting} -$\mech[cb]$ \ce{\mech[2]} \ce{\mech[ar]} \section{Redox Reactions}\label{sec:redoxreaktionen} -`\CMname' provides two commands\footnote{Thanks to \href{http://www.mathannotated.com/}{Peter Cao} who suggested this feature.} to visualize the transfer of electrons in redox reactions. Both commands are using `\TikZ'. -\begin{lstlisting} - \OX{<name>,<atom>} - \redox(<name1>,<name2>)[<tikz>][<dim>]{<text>} -\end{lstlisting} -\lstinline=\OX= places \lstinline=<atom>= into a node, which is named with \lstinline=<name>=. If you have set two \lstinline=\OX=, they can be connected with a line using \lstinline=\redox=. To do so the names of the two nodes that are to be connected are written in the round braces. Since \lstinline=\redox= draws a tikzpicture with options \lstinline=remember picture,overlay=, the document needs to be \emph{compiled at least two times}. -\begin{lstlisting} +\CMname provides two commands\footnote{Thanks to \href{http://www.mathannotated.com/}{Peter Cao} who suggested this feature.}, to visualize the transfer of electrons in redox reactions. Both commands are using \TikZ. +\begin{framed} + \cmd{OX\ma{<name>,<atom>}}\\ + \cmd{redox\da{<name1>,<name2>}\oa{<tikz>}\oa{<num>}\ma{<text>}} +\end{framed} +\cmd{OX} places \code{<atom>} into a node, which is named with \code{<name>}. If you have set two \cmd{OX}, they can be connected with a line using \cmd{redox}. To do so the names of the two nodes that are to be connected are written in the round braces. Since \cmd{redox} draws a tikzpicture with options \code{remember picture,overlay}, the document needs to be \emph{compiled at least two times}. +\begin{LTXexample}[rframe=] \OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b){oxidation} -\end{lstlisting} -\OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b){oxidation} - -This line can be customized using `\TikZ' keys in \lstinline=<tikz>=: -\begin{lstlisting} +\end{LTXexample} +This line can be customized using \TikZ keys in \oa{<tikz>}: +\begin{LTXexample}[rframe=] \OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b)[->,red]{ox} -\end{lstlisting} -\OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b)[->,red]{ox} - -\NEU[1.1]\lstinline=<dim>= can be used to adjust the length of the \emph{vertical parts} of the line. The default length is \lstinline=.6em=. This length is multiplied with \lstinline=<dim>=. If you use a negative value the line is placed \emph{below} the text. -\begin{lstlisting} +\end{LTXexample} +With the argument \oa{<num>} the length of the vertical parts of the line can be adjusted. The default length is \code{.6em}. This length is multiplied with \code{<num>}. If you use a negative value the line is placed \emph{below} the text. +\begin{LTXexample}[rframe=] \OX{a,Na} $\rightarrow$ \OX{b,Na}\pch \redox(a,b)[->,red]{ox} \redox(a,b)[<-,blue][-1]{red} -\end{lstlisting} -\OX{a,Na} $\rightarrow$ \OX{b,Na}\pch -\redox(a,b)[->,red]{ox} -\redox(a,b)[<-,blue][-1]{red} -\vskip3mm - -The default length of the vertical lines can be customized with \lstinline=\setredoxdist{<length>}=: -\begin{lstlisting} - \OX{a,A} $\rightarrow$ \OX{b,B} - \redox(a,b){} - \bigskip - \setredoxdist{1em} - \OX{a,A} $\rightarrow$ \OX{b,B} - \redox(a,b){} -\end{lstlisting} -{\OX{a,A} $\rightarrow$ \OX{b,B} -\redox(a,b){} -\bigskip -\setredoxdist{1em} -\OX{a,A} $\rightarrow$ \OX{b,B} -\redox(a,b){}} - -An empty argument resets the length to the default value. - -Both commands also can be used with the `mhchem' command \lstinline=\ce= and with the \lstinline=\ox= command (section \ref{ssec:oxidationszahlen}). -\begin{lstlisting} +\end{LTXexample} +The default length of the vertical lines can be customized with the key\Key[.6em][redox]{dist}{<dim>} \code{dist}: +\begin{LTXexample}[rframe=] + \chemsetup{redox/dist=1em} + \OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b)[->,red]{ox} +\end{LTXexample} +Additionally the key\Key[.2em][redox]{sep}{<dim>} \code{sep} can be used to change the distance between the atom and the beginning of the line. +\begin{LTXexample}[rframe=] + \chemsetup{redox/sep=.5em} + \OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b)[->,red]{ox} +\end{LTXexample} + +Examples: +\begin{LTXexample}[rframe=] \ce{ 2 \OX{o1,Na} + \OX{r1,Cl2} -> 2 \OX{o2,Na}\pch + 2 \OX{r2,Cl}\mch } \redox(o1,o2){\small OX: $- 2\el$} \redox(r1,r2)[][-1]{\small RED: $+ 2\el$} -\end{lstlisting} -\ce{ 2 \OX{o1,Na} + \OX{r1,Cl2} -> 2 \OX{o2,Na}\pch + 2 \OX{r2,Cl}\mch } -\redox(o1,o2){\small OX: $- 2\el$} -\redox(r1,r2)[][-1]{\small RED: $+ 2\el$} -\vskip1cm - -\begin{lstlisting} - \ce{ 2 \OX{o1,\ox{0,Na}} + \OX{r1,\ox{0,Cl2}} -> 2 \OX{o2,\ox{+I,Na}}\pch + 2 \OX{r2,\ox{-I,Cl}}\mch } +\end{LTXexample} +\begin{LTXexample}[rframe=] + \chemsetup[charges]{append} + \ce{ 2 \OX{o1,\ox{0,Na}} + \OX{r1,\ox{0,Cl2}} -> 2 \OX{o2,\ox{+1,Na}}\pch + 2 \OX{r2,\ox{-1,Cl}}\mch } \redox(o1,o2){\small OX: $- 2\el$} \redox(r1,r2)[][-1]{\small RED: $+ 2\el$} -\end{lstlisting} -\ce{ 2 \OX{o1,\ox{0,Na}} + \OX{r1,\ox{0,Cl2}} -> 2 \OX{o2,\ox{+I,Na}}\pch + 2 \OX{r2,\ox{-I,Cl}}\mch } -\redox(o1,o2){\small OX: $- 2\el$} -\redox(r1,r2)[][-1]{\small RED: $+ 2\el$} -\vskip1cm - -\begin{lstlisting} - \ce{ 2 \OX{o1,\ox{0,Na}} + \OX{r1,\ox{0,Cl2}} -> 2 \OX{o2,\ox{+I,Na}}\pch + 2 \OX{r2,\ox{-I,Cl}}\mch } +\end{LTXexample} +\begin{LTXexample}[rframe=] + \chemsetup[charges]{append} + \ce{ 2 \OX{o1,\ox{0,Na}} + \OX{r1,\ox{0,Cl2}} -> 2 \OX{o2,\ox{+1,Na}}\pch + 2 \OX{r2,\ox{-1,Cl}}\mch } \redox(o1,o2)[draw=red,->][3.33]{\small OX: $- 2\el$} \redox(r1,r2)[draw=blue,->]{\small RED: $+ 2\el$} -\end{lstlisting} -\vskip1cm -\ce{ 2 \OX{o1,\ox{0,Na}} + \OX{r1,\ox{0,Cl2}} -> 2 \OX{o2,\ox{+I,Na}}\pch + 2 \OX{r2,\ox{-I,Cl}}\mch } -\redox(o1,o2)[draw=red,->][3.33]{\small OX: $- 2\el$} -\redox(r1,r2)[draw=blue,->]{\small RED: $+ 2\el$} - -\begin{lstlisting} - \ce{ 2 \OX{o1,\ox{0,Na}} + \OX{r1,\ox{0,Cl2}} -> 2 \OX{o2,\ox{+I,Na}}\pch + 2 \OX{r2,\ox{-I,Cl}}\mch } + \end{LTXexample} +\begin{LTXexample}[rframe=] + \chemsetup[charges]{append} + \ce{ 2 \OX{o1,\ox{0,Na}} + \OX{r1,\ox{0,Cl2}} -> 2 \OX{o2,\ox{+1,Na}}\pch + 2 \OX{r2,\ox{-1,Cl}}\mch } \redox(o1,o2)[green,-stealth]{\small OX: $- 2\el$} \redox(r1,r2)[purple,-stealth][-1]{\small RED: $+ 2\el$} -\end{lstlisting} -\ce{ 2 \OX{o1,\ox{0,Na}} + \OX{r1,\ox{0,Cl2}} -> 2 \OX{o2,\ox{+I,Na}}\pch + 2 \OX{r2,\ox{-I,Cl}}\mch } -\redox(o1,o2)[red,-stealth]{\small OX: $- 2\el$} -\redox(r1,r2)[blue,-stealth][-1]{\small RED: $+ 2\el$} -\vskip1cm - +\end{LTXexample} + +In v1.1 there was the command \cmd{setredoxdist\ma{<dim>}}\formercmd{setredoxdist\ma{<dim>}}. By using the package option \code{version=1} it is provided again. + +\newpage \section{(Standard) State, Thermodynamics}\label{sec:standardstate} \subsection{Thermodynamic Variables}\label{ssec:siunitx} -The following commands use `siunitx': +The following commands use \paket{siunitx}:\changed{Enthalpy}\changed{Entropy}\changed{Gibbs} +\begin{framed} + \cmd{Enthalpy\oa{<keyval>}\da{<subscript>}\ma{<value>}} \\ + \cmd{Entropy\oa{<keyval>}\da{<subscript>}\ma{<value>}} \\ + \cmd{Gibbs\oa{<keyval>}\da{<subscript>}\ma{<value>}} +\end{framed} +Their usage is pretty much self-explaining: +\begin{LTXexample} + \Enthalpy{123} \\ + \Entropy{123} \\ + \Gibbs{123} +\end{LTXexample} +The argument \da{<subscript>} adds a subscript for specification: \cmd{Enthalpy\da{r}\ma{123}} \Enthalpy(r){123}. + +There are several keys to customize the commands.\Key[\cmd{standardstate}](thermo){exponent}{<anything>}\Key(thermo){delta}{<anything>/false}\Key(thermo){subscript}{left/right}\Key(thermo){unit}{<unit>} \begin{itemize} - \item\lstinline=\Enthalpy[<sub>,<sup>,<unit>,<subscript pos>]{<value>}= - \item\lstinline=\Entropy[<sub>,<sup>,<unit>,<subscript pos>]{<value>}= - \item\lstinline=\Gibbs[<sub>,<sup>,<unit>,<subscript pos>]{<value>}= + \item\code{exponent = <anything>} + \item\code{delta = <anything>/false} + \item\code{subscript = left/right} + \item\code{unit = <unit>} \end{itemize} -Their usage is pretty much self-explaining:\\ -\lstinline=\Enthalpy{-123.4}= gives \Enthalpy{-123.4}.\\ -If you want to specify what kind of enthalpy (reaction, formation, \ldots) is meant, you can use the first optional argument \lstinline=<sub>=:\\ -\lstinline=\Enthalpy[r]{-123.4}= \Enthalpy[r]{-123.4}\\ -\lstinline=\Enthalpy[vapor.,,,right]{123}= \Enthalpy[vapor.,,,right]{123} - -\NEU[1.1]In the last example you could see the usage of the fourth optional argument (\lstinline=<subscript pos>=). It is used to specify whether the subscript is placed to the right or to the left of the main symbol. It can have the values \lstinline=left= (or empty) or \lstinline=right=. - -The standard state symbol can be replaced by the second optional argument \lstinline=<sup>=\ldots\\ -\lstinline=\Enthalpy[,\transitionstatesymbol]{-123.4}= \Enthalpy[,\transitionstatesymbol]{-123.4}\\ -\ldots and else depends if the package `chemstyle' has been loaded, see section \ref{standardstatesymbol}. - -The third optional argument \lstinline=<unit>= can be used to change the unit:\\ -\lstinline=\Enthalpy[,,\kilo\calory\per\mole]{-123.4}= \Enthalpy[,,\kilo\calory\per\mole]{-123.4}\\ -The unit is set corresponding to the rules of `siunitx' and depends on its settings: -\begin{lstlisting} - \Enthalpy{-1234.56e3}\par +The default values depend on the command. +\begin{LTXexample} + \Enthalpy[unit=\kilo\joule]{-285} \\ + \Gibbs[delta=false]{0} \\ + \Entropy[delta=\Delta,exponent=]{56.7} +\end{LTXexample} +The unit is set corresponding to the rules of \paket{siunitx} and depends on its settings: +\begin{LTXexample}[pos=b] + \Enthalpy{-1234.56e3} \\ \sisetup{per-mode=symbol,exponent-product=\cdot,output-decimal-marker={,},group-four-digits=true} \Enthalpy{-1234.56e3} -\end{lstlisting} -{\Enthalpy{-1234.56e3}\par -\sisetup{per-mode=symbol,exponent-product=\cdot,output-decimal-marker={,},group-four-digits=true} -\Enthalpy{-1234.56e3}} - -The other two commands work exactly the same way. -\begin{lstlisting} - \Entropy{12.3}, \Gibbs{-12.3}. -\end{lstlisting} -\Entropy{12.3}, \Gibbs{-12.3}. +\end{LTXexample} \subsubsection{Create New Variables} -You can use the command -\begin{lstlisting} - \setnewstate[<standard sup>,<Delta symbol>,<subscript pos>]{<name>}{<symbol>}{<unit>} -\end{lstlisting} +You can use the command\changed{setnewstate} +\begin{framed} + \cmd{setnewstate\oa{<keyval>}\ma{<name>}\ma{<symbol>}\ma{<unit>}} +\end{framed} to create new corresponding commands: -\begin{lstlisting} +\begin{LTXexample} \setnewstate{Helmholtz}{A}{\kilo\joule\per\mole} - \setnewstate[ ,,right]{ElPot}{E}{\volt} - \Helmholtz{123.4} \ElPot{-1.1} \ElPot[\ce{Sn}|\ce{Sn \pch[2]}||\ce{Pb \pch[2]}|\ce{Pb},0]{0.01} -\end{lstlisting} -{\setnewstate{Helmholtz}{A}{\kilo\joule\per\mole}\setnewstate[ ,,right]{ElPot}{E}{\volt}\Helmholtz{123.4} \ElPot{-1.1} \ElPot[\ce{Sn}|\ce{Sn \pch[2]}||\ce{Pb \pch[2]}|\ce{Pb},0]{0.01} - -As you can see, \lstinline=\ElPot= has its subscript by definition on the right as default behaviour. Of course you can still place it on the left by using the option \lstinline=\ElPot[r,,,left]{0.12}= \ElPot[r,,,left]{0.12} (even if this example might not make much sense).} - -Indeed, the commands -\begin{lstlisting} - \Enthalpy, \Entropy, \Gibbs -\end{lstlisting} -are defined as follows: -\begin{lstlisting} - \setnewstate{Enthalpy}{H}{\kilo\joule\per\mole} - \setnewstate[, ]{Entropy}{S}{\joule\per\kelvin\per\mole} - \setnewstate{Gibbs}{G}{\kilo\joule\per\mole} -\end{lstlisting} + \setnewstate[subscript-left=false,exponent=]{ElPot}{E}{\volt} + \Helmholtz{123.4} \\ + \ElPot{-1.1} \\ + \ElPot[exponent=0]($\ce{Sn}|\ce{Sn \pch[2]}||\ce{Pb \pch[2]}|\ce{Pb}$){0.01} +\end{LTXexample} + +The command has some keys with which the default behaviour of the new command can be set.\Key[\cmd{standardstate}](newstate){exponent}{<anything>}\Key[\cmd{Delta}](newstate){delta}{<anything>/false}\Key[true](newstate){subscript-left}{true/false}\Key(newstate){subscript}{<anything>} +\begin{itemize} + \item\code{exponent = <anything>} + \item\code{delta = <anything>/false} + \item\code{subscript-left = true/false} + \item\code{subscript = <anything>} +\end{itemize} \subsubsection{Redefine Variables} -\NEU[1.1]With -\begin{lstlisting} - \renewstate[<standard sup>,<Delta symbol>,<subscript pos>]{<name>}{<symbol>}{<unit>} -\end{lstlisting} +With\changed{renewstate} +\begin{framed} + \cmd{renewstate\oa{<keyval>}\ma{<name>}\ma{<symbol>}\ma{<unit>}} +\end{framed} you can redefine the already existing commands: -\begin{lstlisting} +\begin{LTXexample} \renewstate{Enthalpy}{h}{\joule} - \Enthalpy[f]{12.5} -\end{lstlisting} -{\renewstate{Enthalpy}{h}{\joule}\Enthalpy[f]{12.5}} + \Enthalpy(f){12.5} +\end{LTXexample} +The command is analogous to \cmd{setnewstate}, \ie it has the same keys. So -- for following thermodynamic conventions -- one could define a molar and an absolute variable: -\begin{lstlisting} - \setnewstate[ ]{enthalpy}{h}{\kilo\joule\per\mole}% molar - \renewstate[ ]{Enthalpy}{H}{\kilo\joule}% absolute +\begin{LTXexample} + \setnewstate[exponent=]{enthalpy}{h}{\kilo\joule\per\mole}% molar + \renewstate[exponent=]{Enthalpy}{H}{\kilo\joule}% absolut \enthalpy{-12.3} \Enthalpy{-12.3} -\end{lstlisting} -{\setnewstate[ ]{enthalpy}{h}{\kilo\joule\per\mole}% molar -\renewstate[ ]{Enthalpy}{H}{\kilo\joule}% absolute -\enthalpy{-12.3} \Enthalpy{-12.3} -} +\end{LTXexample} \subsection{State}\label{ssec:state} -The commands presented in section \ref{ssec:siunitx} internally all use the command -\begin{lstlisting} - \State[<superscript>,<Delta symbol>,<subscript pos>]{<symbol>}{<subscript>} -\end{lstlisting} -It can be used to write the thermodynamic variables without value and unit. Please note that \lstinline={<subscript>}= is an \emph{optional} argument. +The commands presented in section \ref{ssec:siunitx} internally all use the command\marginnote{Please note that \ma{<subscript>} is an \emph{optional} argument.}\changed{State} +\begin{framed} + \cmd{State\oa{<keyval>}\ma{<symbol>}\ma{<subscript>}} +\end{framed} +It can be used to write the thermodynamic variables without value and unit. Examples: -\begin{lstlisting} - \State{A}, \State{G}{f}, \State[ ,,right]{E}{\ce{Na}}, \State[\SI{1000}{\celsius}]{H} -\end{lstlisting} -\State{A}, \State{G}{f}, \State[ ,,right]{E}{\ce{Na}}, \State[\SI{1000}{\celsius}]{H} - -I admit: not in every case it is easier or more convenient to use this command instead of the direct typing, for example \lstinline=$\Delta E_\ce{Na}$= $\Delta E_\ce{Na}$. The examples only are intended to show how the command works and what it \emph{can} be used for. The first example surely is typed faster than \lstinline=$\Delta_\mathrm{f}G^\standardstate$= $\Delta_\mathrm{f}G^\standardstate$. - -\label{standardstatesymbol}The standard state symbol \standardstate\ is only used, if the package `chemstyle' is loaded, which provides it with the command \lstinline=\standardstate=. Else the symbol \lstinline=\circ= $\circ$ is used. \lstinline=\State{A}{b}=: with `chemstyle' \State{A}{b}, without \State[\circ]{A}{b}. - -\NEU[1.1]With the command -\begin{lstlisting} - \setstatesubscript{<subscript pos>} -\end{lstlisting} -one can change the predefined value of the subscript postition. You probably have noticed, that its default value is \lstinline=left=. -\begin{lstlisting} - \State{A}{b}\\ - \setstatesubscript{right} - \State{A}{b} -\end{lstlisting} -{\State{A}{b}\\ - \setstatesubscript{right} - \State{A}{b}} - -This command does \emph{not} change the behaviour of \lstinline=\setnewstate= and \lstinline=\renewstate=. +\begin{LTXexample} + \State{A}, \State{G}{f}, \State[subscript-left=false]{E}{\ce{Na}}, \State[exponent=\SI{1000}{\celsius}]{H} +\end{LTXexample} -\section{Spectroscopy}\label{sec:spektroskopie} -\NEU[1.1]If substances are examined wether they are what they're supposed to, one often needs NMR spectroscopy. Measured results then are written in a way like: \NMR(400)[CDCl3] = \num{1.59}\ldots\ `\CMname' provides a command which simplifies writing this down (uses `siunitx'). -\begin{lstlisting} - \NMR{<num>,<elem>}(<num>,<unit>)[<solvent>] - \NMR*{<num>,<elem>}(<num>,<unit>)[<solvent>] -\end{lstlisting} -\emph{All} arguments are optional! Without arguments we get: +Again there are some keys to customize the command:\Key[\cmd{standardstate}][state](state){exponent}{<anything>}\Key[true][state](state){subscript-left}{true/false}\Key[\cmd{Delta}][state](state){delta}{<anything>/false} \begin{itemize} - \item\lstinline=\NMR= {\NMR} (very much like the `bpchem' command \lstinline=\HNMR=) - \item\lstinline=\NMR*= {\NMR*} (without \verb=: $\delta$=) + \item\code{exponent = <anything>} + \item\code{subscript-left = true/false} + \item\code{delta = <anything>/false} \end{itemize} + +In v1.1 there was the command \cmd{setstatesubscript\ma{<subscript pos>}}\formercmd{setstatesubscript\ma{<subscript pos>}}. By using the package option \code{version=1} it is provided again. + +\section{Spectroscopy}\label{sec:spektroskopie} +\marginnote[\baselineskip]{If you want the command to look like the corresponding \paket{bpchem} commands (\paket{bpchem} command \cmd{HNMR} \HNMR and \CMname command \cmd{NMR} \NMR), then you use the package option \code{bpchem} (see section \ref{sec:optionen}).}If substances are examined wether they are what they're supposed to, one often needs NMR spectroscopy. Measured results then are written in a way like: \NMR(400)[CDCl3] = \num{1.59}\ldots\ \CMname provides a command which simplifies writing this down (uses \paket{siunitx}). +\begin{framed} + \cmd{NMR\ma{<num>,<elem>}\da{<num>,<unit>}\oa{<solvent>}} \\ + \cmd{NMR*\ma{<num>,<elem>}\da{<num>,<unit>}\oa{<solvent>}} +\end{framed} +\emph{All} arguments are optional! Without arguments we get:\marginnote[\baselineskip]{All arguments can be combined freely, the command can also be used in math mode.} +\begin{LTXexample} + \NMR \\ + \NMR* +\end{LTXexample} With the first argument you can specify the kind of NMR: -\begin{itemize} - \item\lstinline=\NMR{13,C}= \NMR{13,C} - \item\lstinline=\NMR*{13,C}= \NMR*{13,C} -\end{itemize} +\begin{LTXexample} + \NMR{13,C} +\end{LTXexample} With the second argument the frequency (in \si{\mega\hertz}) can be specified: -\begin{itemize} - \item\lstinline=\NMR(400)= \NMR(400) - \item\lstinline=\NMR*(400)= \NMR*(400) -\end{itemize} +\begin{LTXexample} + \NMR(400) +\end{LTXexample} You also can change the unit: -\begin{itemize} - \item\lstinline=\NMR(4e8,\hertz)= \NMR(4e8,\hertz) - \item\lstinline=\NMR*(4e8,\hertz)= \NMR*(4e8,\hertz) -\end{itemize} -Please note that the setup of `siunitx' also has an impact on this command: -\begin{itemize} - \item\lstinline+\sisetup{exponent-product=\cdot}\NMR(4e8,\hertz)+ {\sisetup{exponent-product=\cdot}\NMR(4e8,\hertz)} - \item\lstinline+\sisetup{exponent-product=\cdot}\NMR*(4e8,\hertz)+ {\sisetup{exponent-product=\cdot}\NMR*(4e8,\hertz)} -\end{itemize} +\begin{LTXexample} + \NMR(4e8,\hertz) +\end{LTXexample} +Please note that the setup of \paket{siunitx} also has an impact on this command: +\begin{LTXexample} + \sisetup{exponent-product=\cdot}\NMR(4e8,\hertz) +\end{LTXexample} And finally with the third argument the solvent can be specified: -\begin{itemize} - \item\lstinline=\NMR[CDCl3]= \NMR[CDCl3] - \item\lstinline=\NMR*[CDCl3]= \NMR*[CDCl3] -\end{itemize} -Depending on wether you use `mhchem' or not, the solvent is written inside the \lstinline=\ce= command. If you don't use `mhchem', the subscript isn't recognized automatically and you need the use the math mode: -\begin{itemize} - \item\lstinline=\NMR[CDCl$_3$]= \NMR[CDCl$_3$] - \item\lstinline=\NMR*[CDCl$_3$]= \NMR*[CDCl$_3$] -\end{itemize} - -All arguments can be combined freely, the command can also be used inside math mode. +\begin{LTXexample} + \NMR[CDCl3] +\end{LTXexample} -If you want the appearance to match the ones of `bpchem' (compare `bpchem' command \lstinline=\HNMR= \HNMR to `\CMname' command \lstinline=\NMR= \NMR), you can use the package option \lstinline=bpchem= (see section \ref{sec:optionen}). +With the keys \code{unit}\Key[\cmd{mega}\cmd{hertz}][nmr]{unit}{<unit>} and \code{nucleus}\Key[\ma{1,H}][nmr]{nucleus}{\ma{<num>,<elem>}} the default unit and the default nucleus can be changed. Examples: -\begin{lstlisting} - \NMR{13,C}(100) \\ - \NMR*{13,C}(100) \\ - \NMR*{19,F}[CFCl3] \\ - \NMR*{19,F}(285)[CFCl3] \\ +\begin{LTXexample} + {\chemsetup[nmr]{nucleus={13,C}}\NMR(100) \NMR*(100) } \\ + \NMR*{19,F}[CFCl3] \NMR*{19,F}(285)[CFCl3] \\ \NMR(400)[CDCl3] = \num{1.59} (q, 1H, \textit{J} = \SI{11.6}{\hertz}, H-4) -\end{lstlisting} -\NMR{13,C}(100) \\ -\NMR*{13,C}(100) \\ -\NMR*{19,F}[CFCl3] \\ -\NMR*{19,F}(285)[CFCl3] \\ -\NMR(400)[CDCl3] = \num{1.59} (q, 1H, \textit{J} = \SI{11.6}{\hertz}, H-4) +\end{LTXexample} -\section{Commands for `mhchem'}\label{sec:mhchem} -There are some commands which are meant for the use with `mhchem'. They are defined if `mhchem' is loaded. Before they're described some words on using commands inside the \lstinline=\ce= and \lstinline=\cee= commands. Probably due to the way these commands are processed there can be difficulties especially when using commands with arguments. +\section{Commands for \textsf{mhchem}}\label{sec:mhchem} +From v2.0 \CMname loads the package \paket{mhchem}. + +Before the commands are described some words on using commands inside the \cmd{ce} and \cmd{cee} commands. Probably due to the way these commands are processed there can be difficulties especially when using commands with arguments. Often you have to leave blank spaces: -\begin{lstlisting} +\begin{LTXexample} \ce{Na\pch}\\ % no problem \ce{Ca\pch[2]}\\ % displayed wrong \ce{Ca \pch[2]}\\ % displayed right \ce{Ca$\pch[2]$} % displayed right -\end{lstlisting} -\ce{Na\pch}\\ -\ce{Ca\pch[2]}\\ -\ce{Ca \pch[2]}\\ -\ce{Ca$\pch[2]$} +\end{LTXexample} You also need to put curly braces at the end of commands: -\begin{lstlisting} +\begin{LTXexample} \ce{\mch OMe}\\ % displayed wrong \ce{\mch{} OMe}\\ % displayed right \ce{$\mch$OMe} % displayed right -\end{lstlisting} -\ce{\mch OMe}\\ -\ce{\mch{} OMe}\\ -\ce{$\mch$OMe} +\end{LTXexample} -This is \emph{not} only true for `\CMname' commands! -\begin{lstlisting} +This is \emph{not} only true for \CMname commands! +\begin{LTXexample}[pos=b] \ce{A \quad B} \ce{Na2\textbf{O}}\\ % displayed wrong \ce{A \quad{} B} \ce{Na2 \textbf{O}}\\ % displayed right \ce{A $\quad$ B} \ce{Na2 \textbf{O}} % displayed right -\end{lstlisting} -\ce{A \quad B} \ce{Na2\textbf{O}}\\ -\ce{A \quad{} B} \ce{Na2 \textbf{O}}\\ -\ce{A $\quad$ B} \ce{Na2 \textbf{O}} +\end{LTXexample} -As you can see in most cases instead of using blank spaces or curly braces you can also put the according command between \lstinline=$ $=. +As you can see in most cases instead of using blank spaces or curly braces you can also put the according command between \code{\$ \$}. \subsection{Reaction Environments}\label{ssec:mhchem_reaktionen} -\subsubsection{Defined by `\CMname'} +\subsubsection{Defined by \CMname} You can use these environments for numbered\ldots -\begin{lstlisting} - \begin{reaction} - <mhchem code> - \end{reaction} - \begin{reactions} - <mhchem code> - \end{reactions} -\end{lstlisting} +\begin{framed} +\cmd{begin\ma{reaction}}\\ + \code{<mhchem code>}\\ +\cmd{end\ma{reaction}}\\ +\cmd{begin\ma{reactions}}\\ + \code{<mhchem code>}\\ +\cmd{end\ma{reactions}} +\end{framed} \ldots and their starred versions for unnumbered reactions. -\begin{lstlisting} - \begin{reaction*} - <mhchem code> - \end{reaction*} - \begin{reactions*} - <mhchem code> - \end{reactions*} -\end{lstlisting} +\begin{framed} +\cmd{begin\ma{reaction*}}\\ + \code{<mhchem code>}\\ +\cmd{end\ma{reaction*}}\\ +\cmd{begin\ma{reactions*}}\\ + \code{<mhchem code>}\\ +\cmd{end\ma{reactions*}} +\end{framed} With them you can create (un)numbered reaction equations similar to mathematical equations. -The environments \verb=reaction=/\verb=reaction*= use the \lstinline=equation=/\lstinline=equation*= environments and the environments \verb=reactions=/\verb=reactions*= use the \lstinline=align=/\lstinline=align*= environments to display the reactions. +The environments \code{reaction}/\code{reaction*} use the \code{equation}/\code{equation*} environments and the environments \code{reactions}/ \code{reactions*} use the \code{align}/\code{align*} environments to display the reactions. -Reaction with counter: -\begin{lstlisting} +\begin{LTXexample}[pos=b] + Reaction with counter: \begin{reaction} A -> B \end{reaction} -\end{lstlisting} -\begin{reaction} - A -> B -\end{reaction} -Reaction without counter: -\begin{lstlisting} +\end{LTXexample} + +\begin{LTXexample}[pos=b] + Reaction without counter: \begin{reaction*} C -> D \end{reaction*} -\end{lstlisting} -\begin{reaction*} - C -> D -\end{reaction*} -Several aligned reactions with counter: -\begin{lstlisting} +\end{LTXexample} + +\begin{LTXexample}[pos=b] + Several aligned reactions with counter: \begin{reactions} A &-> B + C \\ D + E &-> F \end{reactions} -\end{lstlisting} -\begin{reactions} - A &-> B + C \\ - D + E &-> F -\end{reactions} -Several aligned reactions without counter: -\begin{lstlisting} +\end{LTXexample} + +\begin{LTXexample}[pos=b] + Several aligned reactions without counter: \begin{reactions*} G &-> H + I \\ J + K &-> L \end{reactions*} -\end{lstlisting} -\begin{reactions*} - G &-> H + I \\ - J + K &-> L -\end{reactions*} - -If you want to change the layout of the counter tags, you can use \lstinline=\renewtagform{<tagname>}[<format>]{<right delim>}{<left delim>}=\footnote{Provided by the `mathtools' package.}. -\begin{lstlisting} - \renewtagform{CMreaction}[R \textbf]{[}{]} +\end{LTXexample} + +If you want to change the layout of the counter tags, you can use \cmd{renewtagform\ma{<tagname>}\oa{<format>}\ma{<right delim>}\ma{<left delim>}}\footnote{Provided by the \paket{mathtools} package}. +\begin{LTXexample}[pos=b] + \renewtagform{reaction}[R \textbf]{[}{]} \begin{reaction} H2O + CO2 <<=> H2CO3 \end{reaction} -\end{lstlisting} -{\renewtagform{CMreaction}[R \textbf]{[}{]} -\begin{reaction} - H2O + CO2 <<=> H2CO3 -\end{reaction} -} +\end{LTXexample} +Note, that the name of the tagform has changed with v2.0. It was called \code{CMreaction} in v1.*. Option \code{version=1} restores this name. \subsubsection{Own Reactions} -\NEU[1.1]You can create new types of reactions with the command: -\begin{lstlisting} - \newreaction{<name>}{<math name>} -\end{lstlisting} -\lstinline=<name>= will be the name of the new environment. \lstinline=<math name>= is the used math environment. - -The command has variants. The first one is \lstinline=\newreaction*=, which will also define a starred version of the new environment, if the starred math environment exists. If it doesn't exist, this will cause an error. - -The second one is \lstinline=\newreaction+=, which is used to define an environment with a mandatory argument. Of course this only works, if the used math environment has a mandatory argument. - -You can also use the combined version \lstinline=\newreaction*+=. - -The predefined environments are defined via -\begin{lstlisting} - \newreaction*{++reaction++}{equation} - \newreaction*{++reactions++}{align} -\end{lstlisting} - -Let's suppose, you'd like to have the alignment behaviour of the \lstinline=alignat= environment for `mhchem' reactions. You could do the following: -\begin{lstlisting} - \newreaction*+{++reactionsat++}{alignat} -\end{lstlisting} -With this the \verb=reactionsat= environment is defined. -\begin{lstlisting} +You can create new types of reactions with the command:\changed{newreaction} +\begin{framed} + \cmd{newreaction\oa{<keyval>}\ma{<name>}\ma{<math name>}} +\end{framed} +\code{<name>} will be the name of the new environment. \code{<math name>} is the used math environment. + +The command has two keys. There is \code{star}\Key[false]{star}{true/false}, which will also define a starred version of the new environment, if the starred math environment exists. If it doesn't exist, this will cause an error. + +Then there is \code{arg}\Key[false]{arg}{true/false}, which is used to define an environment with a mandatory argument. Of course this only works, if the used math environment has a mandatory argument. + +The predefined environments are defined via\\ +\cmd{newreaction\oa{star}\ma{reaction}\ma{equation}} and\\ +\cmd{reaction\oa{star}\ma{reactions}{align}}. + +Let's suppose, you'd like to have the alignment behaviour of the \code{alignat} environment for \paket{mhchem} reactions. You could do the following:\\ +\cmd{newreaction\oa{star,arg}\ma{reactionsat}\ma{alignat}} + +With this the \code{reactionsat} environment is defined. +\begin{LTXexample}[pos=b] + \newreaction[star,arg]{reactionsat}{alignat} \begin{reactionsat}{3} A &-> B &&-> C &&-> D \\ aaaaa &-> bbbbb &&-> ccccc &&-> ddddd \end{reactionsat} \begin{reactionsat*}{2} A &-> B & C &-> D \\ - aaaaa &-> bbbbb &$\quad$ ccccc &-> ddddd + aaaaa &-> bbbbb &\quad{} ccccc &-> ddddd \end{reactionsat*} -\end{lstlisting} -\newreaction*+{reactionsat}{alignat} -\begin{reactionsat}{3} - A &-> B &&-> C &&-> D \\ - aaaaa &-> bbbbb &&-> ccccc &&-> ddddd -\end{reactionsat} -\begin{reactionsat*}{2} - A &-> B & C &-> D \\ - aaaaa &-> bbbbb &$\quad$ ccccc &-> ddddd -\end{reactionsat*} +\end{LTXexample} \subsection{Phases}\label{ssec:mhchem_phasen} -\NEU[1.1]These commands are intended to indicate the phase of a compound. Although these commands were intended for the use with `mhchem' they can be used without it as well and are also defined if `mhchem' isn't loaded. -\begin{lstlisting} - \solid[<anything>] - \liquid[<anything>] - \gas - \aq % dissolved in water -\end{lstlisting} -I always found it tedious to type out phase indicators: -\begin{lstlisting} - \ce{C_{(s)} + 2 H2O_{(l)} -> CO2_{(g)} + 2 H2_{(g)}} -\end{lstlisting} -The same result now can be achieved with: -\begin{lstlisting} - \ce{C\solid{} + 2 H2O\liquid{} -> CO2\gas{} + 2 H2\gas} -\end{lstlisting} -\ce{C\solid{} + 2 H2O\liquid{} -> CO2\gas{} + 2 H2\gas} - -To make it complete: \lstinline=NaCl\aq= gives NaCl\aq. - -With the package option \lstinline=german= (see section \ref{sec:optionen}) you get:\\ -\ce{C \solid[f] + 2 H2O \liquid[f\/l] -> CO2 \gas{} + 2 H2 \gas} - -You can get the same result without the package option by using the arguments: -\begin{lstlisting} - \ce{C \solid[f] + 2 H2O \liquid[fl] -> CO2\gas{} + 2 H2\gas} -\end{lstlisting} -\ce{C \solid[f] + 2 H2O \liquid[fl] -> CO2\gas{} + 2 H2\gas} - -If you looked closely, you have probably noticed that the german \lstinline=\liquid= isn't identical to \lstinline=\liquid[fl]= but to \lstinline=\liquid[f\/l]=. This makes the subscript more readable. - -Of course it doesn't matter which command with optional argument you use. Both of them just write a subscript with braces. \lstinline=\solid[f]= is identical to \lstinline=\liquid[f]=. +These commands are intended to indicate the phase of a compound. Although these commands were intended for the use with \paket{mhchem} they can be used without it as well. +\begin{itemize} + \item\cmd{sld\oa{<anything>}} \sld\formercmd{solid} + \item\cmd{lqd\oa{<anything>}} \lqd\formercmd{liquid} + \item\cmd{gas} \gas + \item\cmd{aq} \aq +\end{itemize} +Please notice, that the commands \cmd{solid} and \cmd{liquid} are now called \cmd{sld} and \cmd{lqd}, respectively. + +\begin{LTXexample}[pos=b] + \ce{C\sld{} + 2 H2O\lqd{} -> CO2\gas{} + 2 H2\gas}\\ + To make it complete: NaCl\aq. +\end{LTXexample} + +With the package option \code{german} (see section \ref{sec:optionen}) or by using the optional arguments you get the german versions: +\begin{LTXexample}[pos=b] + {\chemsetup[option]{german=true} + \ce{C\sld{} + 2 H2O\lqd{} -> CO2\gas{} + 2 H2\gas} }\\ + \ce{C \sld[f] + 2 H2O \lqd[fl] -> CO2\gas{} + 2 H2\gas} +\end{LTXexample} + +If you looked closely, you have probably noticed that the german \cmd{lqd} isn't identical to \cmd{lqd\oa{fl}} but to \cmd{lqd\oa{f\textbackslash /l}}. This makes the subscript more readable. + +Of course it doesn't matter which command with optional argument you use. Both of them just write a subscript with braces. \cmd{sld\oa{f}} is identical to \cmd{lqd\oa{f}}. One can think of other uses, too: -\begin{lstlisting} - C\solid[graphite] -\end{lstlisting} -C\solid[graphite] +\begin{LTXexample} + C\sld[graphite] +\end{LTXexample} \subsection{Text Under Compounds}\label{ssec:mhchem_beschriftung} -\NEU[1.1]It has always been a bit laborious to write something under a molecule with `mhchem'. `\CMname' provides a command for that: -\begin{lstlisting} - \mhName[<width>][<textattr>]{<mhchem code>}{<name>} -\end{lstlisting} +\CMname provides a command, with which you can place text below of compounds.\changed{mhName}\Key[\cmd{centering}][mhName]{align}{<alignment>}\Key[][mhName]{fontattr}{<commands>}\Key[\cmd{tiny}][mhName]{fontsize}{<fontsize>}\Key[][mhName]{width}{<dim>} +\begin{framed} + \cmd{mhName\oa{<keyval>}\ma{<formula>}\ma{<text>}} +\end{framed} For example: -\begin{lstlisting} +\begin{LTXexample}[pos=b] \ce{4 C2H5Cl + Pb / Na -> \mhName{Pb(C2H5)4}{former antiknock additive} + NaCl} -\end{lstlisting} -\ce{4 C2H5Cl + Pb / Na -> \mhName{Pb(C2H5)4}{former antiknock additive} + NaCl} - -As you can see the text is set centered and \lstinline=\tiny=, while the molecule uses it's normal space. With the first optional argument you can choose the width, that the molecule uses: -\begin{lstlisting} - \ce{4 C2H5Cl + Pb / Na -> \mhName[3cm]{Pb(C2H5)4}{former antiknock additive} + NaCl} -\end{lstlisting} -\ce{4 C2H5Cl + Pb / Na -> \mhName[3cm]{Pb(C2H5)4}{former antiknock additive} + NaCl} - -The text attributes have \lstinline=\centering\tiny= as default. Using other attributes can overwrite them in certain circumstances: -\begin{lstlisting} - \ce{4 C2H5Cl + Pb / Na -> \mhName[3cm]{Pb(C2H5)4}{\small former antiknock additive} + NaCl}\\ - \ce{4 C2H5Cl + Pb / Na -> \mhName[3cm]{Pb(C2H5)4}{\raggedright\color{red}\bfseries former antiknock additive} + NaCl} -\end{lstlisting} -\ce{4 C2H5Cl + Pb / Na -> \mhName[3cm]{Pb(C2H5)4}{\small former antiknock additive} + NaCl}\\ -\ce{4 C2H5Cl + Pb / Na -> \mhName[3cm]{Pb(C2H5)4}{\raggedright\color{red}\bfseries former antiknock additive} + NaCl} - -Using the second optional argument will overwrite them in any case: -\begin{lstlisting} - \ce{4 C2H5Cl + Pb / Na -> \mhName[3cm][\small]{Pb(C2H5)4}{former antiknock additive} + NaCl}\\ - \ce{4 C2H5Cl + Pb / Na -> \mhName[3cm][\raggedright\color{red}\bfseries]{Pb(C2H5)4}{former antiknock additive} + NaCl} -\end{lstlisting} -\ce{4 C2H5Cl + Pb / Na -> \mhName[3cm][\small]{Pb(C2H5)4}{former antiknock additive} + NaCl}\\ -\ce{4 C2H5Cl + Pb / Na -> \mhName[3cm][\raggedright\color{red}\bfseries]{Pb(C2H5)4}{former antiknock additive} + NaCl} - -You can change the default values globally by using -\begin{lstlisting} - \setmhName{<textattr>} -\end{lstlisting} -With this command you can change the predefined settings as you like: -\begin{lstlisting} - \setmhName{\centering\footnotesize\color{blue}} +\end{LTXexample} + +There are several keys to customize \cmd{mhName}. +\begin{itemize} + \item\code{align} + \item\code{fontattr} + \item\code{fontsize} + \item\code{width} +\end{itemize} +\begin{LTXexample}[pos=b] + \ce{4 C2H5Cl + Pb / Na -> \mhName[fontsize=\footnotesize]{Pb(C2H5)4}{former antiknock additive} + NaCl}\\ + \chemsetup[mhName]{align=\raggedright,fontsize=\small,fontattr=\bfseries\color{red},width=3cm} \ce{4 C2H5Cl + Pb / Na -> \mhName{Pb(C2H5)4}{former antiknock additive} + NaCl} -\end{lstlisting} -{\setmhName{\centering\footnotesize\color{blue}} -\ce{4 C2H5Cl + Pb / Na -> \mhName{Pb(C2H5)4}{former antiknock additive} + NaCl}} +\end{LTXexample} + +In v1.1 there was the command \cmd{setmhName\ma{<textattr>}}\formercmd{setmhName\ma{<textattr>}}. By using the package option \code{version=1} it is provided again. \section{Newman Projections}\label{sec:newman} -The command -\begin{lstlisting} - \newman[<angle>,<scale>,<tikz>]{<1>,<2>,<3>,<4>,<5>,<6>} -\end{lstlisting} -allows you to create newman projections (uses `\TikZ'). Examples: -\begin{lstlisting} - \newman{}\par% default: staggered - \newman[175]{}\par% rotated by 175 degrees => eclipsed - \newman{1,2,3,4,5,6} \newman{1,2,3} \newman{,,,4,5,6}\par% with atoms - \newman[,.75,draw=blue,fill=blue!20]{}% scaled and customized with TikZ -\end{lstlisting} -\newman{}\par -\newman[175]{}\par -\newman{1,2,3,4,5,6} \newman{1,2,3} \newman{,,,4,5,6}\par -\newman[,.75,draw=blue,fill=blue!20]{} - -Another option allows you to customize the nodes within which the atoms are placed: -\begin{lstlisting} - \newman[][<tikz nodes>]{<1>,<2>,<3>,<4>,<5>,<6>} - % example: - \newman[][draw=red,fill=red!20,inner sep=2pt,rounded corners]{1,2,3,4,5,6} -\end{lstlisting} -\newman[][draw=red,fill=red!20,inner sep=2pt,rounded corners]{1,2,3,4,5,6} - -If you want to display the "front" atoms differently from the "back" atoms, you can use a third option: -\begin{lstlisting} - \newman[][<tikz front nodes>][<tikz back nodes>]{<1>,<2>,<3>,<4>,<5>,<6>} -\end{lstlisting} -Examples: -\begin{lstlisting} - \newman[][draw=red,fill=red!20,inner sep=2pt,rounded corners][draw=blue,fill=blue!20,inner sep=2pt,rounded corners]{1,2,3,4,5,6} -\end{lstlisting} -\newman[][draw=red,fill=red!20,inner sep=2pt,rounded corners][draw=blue,fill=blue!20,inner sep=2pt,rounded corners]{1,2,3,4,5,6} -\begin{lstlisting} - \newman[170][draw=red,fill=red!20,inner sep=2pt,rounded corners][draw=blue,fill=blue!20,inner sep=2pt,rounded corners]{1,2,3,4,5,6} -\end{lstlisting} -\newman[170][draw=red,fill=red!20,inner sep=2pt,rounded corners][draw=blue,fill=blue!20,inner sep=2pt,rounded corners]{1,2,3,4,5,6} - -\section{p-Orbitals}\label{sec:orbitale} -`\CMname' provides commands to visualize p-orbitals. -\begin{lstlisting} - \porb[<size factor>,<color>,<angle>] - \phorb[<size factor>,<color>,<angle>] - \setorbheight{<length>} -\end{lstlisting} -This displays a horizontal orbital or one rotated by \lstinline=<angle>=: \lstinline=\porb \qquad \porb[,,30]= \quad\porb \qquad\porb[,,30] - -\lstinline=\phorb= only displays one half orbital: \lstinline=\phorb[,red,90]= \phorb[,red,90] - -The size of the orbitals depends on an internal length that can be set with \lstinline=\setorbheight{<length>}=. It's default value is \lstinline=1em=. -\begin{lstlisting} - \porb\par - \setorbheight{2em}\porb -\end{lstlisting} -{\porb\par\setorbheight{2em}\porb} - -The size of an orbital can also be changed directly using the optional argument \lstinline=<size factor>=. -\begin{lstlisting} - \porb\par - \porb[2]\par - \porb[.5] -\end{lstlisting} -{\porb\par\porb[2]\par\porb[.5]} - -There are shortcuts for the $x$-, $y$- and $z$-orbitals: -\begin{lstlisting} - \pzorb \qquad \pyorb \qquad \pxorb -\end{lstlisting} -\pzorb \qquad \pyorb \qquad \pxorb - -Since the orbitals are drawn in a tikzpicture with the option \lstinline=overlay=, they are set all at the same spot, if you don't shift them: -\begin{lstlisting} - \hspace{2cm}\pxorb\pyorb\pzorb - \tikz[overlay]{ - \draw[->](0,0)--(1,0)node[right]{$y$}; - \draw[dashed](0,0)--(-1,0); - \draw[->](0,0)--(0,1)node[above]{$z$}; - \draw[dashed](0,0)--(0,-1); - \draw[->](0,0)--(-.707,-.707)node[below left]{$x$}; - \draw[dashed](0,0)--(.707,.707); +\CMname provides the command\changed{newman} +\begin{framed} + \cmd{newman\oa{<keyval>}\da{<angle>}\ma{<1>,<2>,<3>,<4>,<5>,<6>}} +\end{framed} +that allows you to create newman projections (uses \TikZ). With \code{<angle>} the back atoms are rotated counter clockwise with respect to the front atoms.\Key[0][newman]{angle}{<angle>}\Key[1][newman]{scale}{<factor>}\Key[][newman]{ring}{<tikz>}\Key[][newman]{atoms}{<tikz>}\Key[][newman]{back-atoms}{<tikz>} +\begin{LTXexample}[pos=b] + \newman{} \newman(170){} + \newman{1,2,3,4,5,6} \newman{1,2,3} \newman{,,,4,5,6} +\end{LTXexample} + +Several keys allow customization: +\begin{itemize} + \item\code{angle = <angle>} default angle + \item\code{scale = <factor>} scale the whole projection + \item\code{ring = <tikz>} customize the ring with \TikZ keys + \item\code{atoms = <tikz>} customize the nodes within which the atoms are set + \item\code{back-atoms = <tikz>} explicitly customize the back atoms +\end{itemize} +\begin{LTXexample}[pos=b] + \chemsetup[newman]{angle=45} \newman{} + \newman[scale=.75,ring={draw=blue,fill=blue!20}]{} +\end{LTXexample} +\begin{LTXexample} + \chemsetup[newman]{atoms={draw=red,fill=red!20,inner sep=2pt,rounded corners}} + \newman{1,2,3,4,5,6} +\end{LTXexample} +\begin{LTXexample}[pos=b] + \chemsetup[newman]{ + atoms = {draw=red,fill=red!20,inner sep=2pt,rounded corners}, + back-atoms = {draw=blue,fill=blue!20,inner sep=2pt,rounded corners} + } + \newman{1,2,3,4,5,6} \newman(170){1,2,3,4,5,6} +\end{LTXexample} + +\section{s, p, and Hybrid Orbitals}\label{sec:orbitale} +In v1.1 there have been the commands \cmd{porb\oa{<options>}}\formercmd{porb\oa{<options>}}, \cmd{phorb\oa{<options>}}\formercmd{phorb\oa{<options>}}, \cmd{pxorb}\formercmd{pxorb}, \cmd{pyorb}\formercmd{pyorb} und \cmd{pzorb}\formercmd{pzorb}. By using the package option \code{version=1} they are provided again + +\CMname provides the following command to create orbitals: +\begin{framed} + \cmd{orbital\oa{<keyval>}\ma{<type}} +\end{framed} +There are the following types available for \code{<type>}: +\begin{itemize} + \item\code{s} + \item\code{p} + \item\code{sp} + \item\code{sp2} + \item\code{sp3} +\end{itemize} +\begin{LTXexample}[pos=b] + \orbital{s} \orbital{p} \orbital{sp} \orbital{sp2} \orbital{sp3} +\end{LTXexample} + +Depending on the type you have different keys to modify the orbitals:\Key[+][orbital/<type>](orbital){phase}{\uline{+}/-}\Key[1][orbital/<type>](orbital){scale}{<factor>}\Key[black][orbital/<type>](orbital){color}{<color>}\Key[90][orbital/<type>](orbital){angle}{<angle>}\Key[false][orbital/<type>](orbital){half}{\uline{true}/false} +\begin{itemize} + \item\code{phase = \uline{+}/-} changes the phase of the orbital (all types) + \item\code{scale = <factor>} changes the size of the orbital (all types) + \item\code{color = <color>} changes the color of the orbital (all types) + \item\code{angle = <angle>} rotates the orbitals with a p contribution counter clockwise (all types except \code{s}) + \item\code{half = \uline{true}/false} displays only half an orbital (only \code{p}) +\end{itemize} +\begin{LTXexample}[pos=b] + \orbital{s} \orbital[phase=-]{s} + \orbital{p} \orbital[phase=-]{p} + \orbital{sp3} \orbital[phase=-]{sp3} + + \orbital[angle=0]{p} \orbital[color=red!50]{p} \orbital[angle=135,scale=1.5]{p} \orbital[half]{p} +\end{LTXexample} + +Additionally there are two keys, with which the \TikZ behaviour can be changed.\Key[false][orbital]{overlay}{\uline{true}/false}\Key[1][orbital]{opacity}{<num>} +\begin{itemize} + \item\code{overlay = \uline{true}/false} the orbital ``doesn't need space''; it is displayed with the \TikZ option \code{overlay}. + \item\code{opacity = <num>} the orbital becomes transparent; \code{<value>} can have values between \code{1} (fully opaque) to \code{0} (invisible). +\end{itemize} +\begin{LTXexample}[pos=b] + \vspace{1cm}\hspace{1cm} + \chemsetup[orbital]{ + overlay, + p/color = black!70 + } + \setbondoffset{0pt} + \chemfig{?\orbital{p}-[,1.3]{\orbital[phase=-]{p}}-[:30,1.1]\orbital{p}-[:150,.9]{\orbital[phase=-]{p}}-[4,1.3]\orbital{p}-[:-150,1.1]{\orbital[phase=-]{p}}?} + \vspace{1cm} +\end{LTXexample} +\begin{LTXexample}[pos=b] + \vspace{2cm}\hspace{2cm} + \setbondoffset{0pt} + \chemsetup[orbital]{ + overlay , + opacity = .75 , + p/scale = 1.6 , + s/color = blue!50 , + s/scale = 1.6 } -\end{lstlisting} -\hspace{2cm}\pxorb\pyorb\pzorb\tikz[overlay]{\draw[->](0,0)--(1,0)node[right]{$y$};\draw[->](0,0)--(0,1)node[above]{$z$};\draw[->](0,0)--(-.707,-.707)node[below left]{$x$};\draw[dashed](0,0)--(-1,0);\draw[dashed](0,0)--(0,-1);\draw[dashed](0,0)--(.707,.707);} -\vspace{2cm} - -The orbitals also can be used together with `chemfig': -\begin{lstlisting} - \setorbheight{2em}\setbondoffset{0pt} - \chemfig{?\pzorb-[,1.3]\pzorb-[:30,1.1]\pzorb-[:150,.9]\pzorb-[4,1.3]\pzorb-[:-150,1.1]\pzorb?}\qquad - \chemfig{?\pzorb-[,1.3]{\porb[,,-90]}-[:30,1.1]\pzorb-[:150,.9]{\porb[,,-90]}-[4,1.3]\pzorb-[:-150,1.1]{\porb[,,-90]}?} -\end{lstlisting} -\vspace{1cm} -{\setorbheight{2em}\setbondoffset{0pt} -\chemfig{?\pzorb-[,1.3]\pzorb-[:30,1.1]\pzorb-[:150,.9]\pzorb-[4,1.3]\pzorb-[:-150,1.1]\pzorb?}\qquad -\chemfig{?\pzorb-[,1.3]{\porb[,,-90]}-[:30,1.1]\pzorb-[:150,.9]{\porb[,,-90]}-[4,1.3]\pzorb-[:-150,1.1]{\porb[,,-90]}?}} - -\section{List of Commands}\label{sec:befehlsreferenz} -\begin{tabular}{>{\raggedright}p{.35\textwidth}|>{\raggedright}p{.55\textwidth}}\toprule - \lstinline=\el=, \lstinline=\prt=, \lstinline=\ntr=, \lstinline=\HtO=, \lstinline=\water=, \lstinline=\Hpl=, \lstinline=\Hyd=, \lstinline=\Nu=, \lstinline=\El=, \lstinline=\transitionstatesymbol=, \lstinline=\R= & section \ref{sec:teilchen}: Particles, Ions and a Symbol\tabularnewline\midrule - \lstinline=\cip=, \lstinline=\Rcip=, \lstinline=\Scip=, \lstinline=\Dfi=, \lstinline=\Lfi=, \lstinline=\E=, \lstinline=\Z=, \lstinline=\cis=, \lstinline=\trans=, \lstinline=\Rconf=, \lstinline=\Sconf=, \lstinline=\ortho=, \lstinline=\meta=, \lstinline=\para=, \lstinline=\insitu=, \lstinline=\abinitio= & section \ref{sec:stereo}: Stereo Descriptors, Nomenclature, Latin Phrases\tabularnewline\midrule - \lstinline=\pH=, \lstinline=\pOH=, \lstinline=\pKa=, \lstinline=\pKb= & section \ref{sec:saeure_base}: Acid/Base \tabularnewline\midrule - \lstinline=\delm=, \lstinline=\delp=, \lstinline=\mch=, \lstinline=\pch=, \lstinline=\ox=, \lstinline=\scrm=, \lstinline=\scrp= & section \ref{sec:ladungen}: Oxidation Numbers and (real) Charges\tabularnewline\midrule - \lstinline=\mech= & section \ref{sec:mechanismen}: Reaction Mechanisms \tabularnewline\midrule - \lstinline=\redox=, \lstinline=\OX= & section \ref{sec:redoxreaktionen}: Redox Reactions \tabularnewline\midrule - \lstinline=\Enthalpy=, \lstinline=\Entropy=, \lstinline=\Gibbs=, \lstinline=\setnewstate=, \lstinline=\renewstate=, \lstinline=\State=, \lstinline=\setstatesubscript= & section \ref{sec:standardstate}: (Standard) State, Thermodynamics \tabularnewline\midrule - \lstinline=\NMR= & section \ref{sec:spektroskopie}: Spectroscopy \tabularnewline\midrule - \lstinline=\begin{reaction}=, \lstinline=\begin{reaction*}=, \lstinline=\begin{reactions}=, \lstinline=\begin{reactions*}=, \lstinline=\newreaction=, \lstinline=\solid=, \lstinline=\liquid=, \lstinline=\gas=, \lstinline=\mhName=, \lstinline=\setmhName= & section \ref{sec:mhchem}: Commands for `mhchem'\tabularnewline\midrule - \lstinline=\newman= & section \ref{sec:newman}: Newman Projections \tabularnewline\midrule - \lstinline=\phorb=, \lstinline=\porb=, \lstinline=\pxorb=, \lstinline=\pyorb=, \lstinline=\pzorb=, \lstinline=\setorbheight= & section \ref{sec:orbitale}: p-Orbitals\tabularnewline\bottomrule -\end{tabular} + \chemfig{\orbital{s}-[:-20]{\orbital[scale=2]{p}}{\orbital[half,angle=0]{p}}{\orbital[angle=170,half]{p}}{\orbital[angle=-150,half]{p}}(-[:-150]\orbital{s})-\orbital{s}} + \vspace{2cm} +\end{LTXexample} + +\section{Key Overview} +In the table below all keys provided by \CMname for customization are listed. All keys that belong to a module; can be set with \cmd{chemsetup\oa{<module>}\ma{<keyval>}} or \linebreak\cmd{chemsetup\ma{<module>/<keyval>}}. + +Some keys can be set without value. Then the \uline{underlined} value is used. +\begin{fullwidth} +\begin{longtable}{>{\ttfamily\hspace{5mm}}l>{\ttfamily}l>{\ttfamily}l>{\ttfamily}ll} + \toprule + \normalfont\bfseries key & \normalfont\bfseries module & \normalfont\bfseries values & \normalfont\bfseries default & \\ + \midrule + \endhead + \bottomrule + \endfoot + \multicolumn{5}{l}{Paket-Optionen:} \\ + bpchem & option & \uline{true}/false & false & page \pageref{key:option_bpchem} \\ + circled & option & \uline{formal}/all/none & formal & page \pageref{key:option_circled} \\ + circletype & option & \uline{chem}/math & chem & page \pageref{key:option_circletype} \\ + EZ & option & \uline{chemmacros}/cool & chemmacros & page \pageref{key:option_EZ} \\ + german & option & \uline{true}/false & false & page \pageref{key:option_german} \\ + version & option & 1/2 & 2 & page \pageref{key:option_version} \\ + xspace & option & \uline{true}/false & true & page \pageref{key:option_xspace} \\ + \multicolumn{5}{l}{\cmd{pch}, \cmd{mch}, \cmd{fpch}, \cmd{fmch}:} \\ + append & charges & \uline{true}/false & false & Seite \pageref{key:charges_append} \\ + \multicolumn{5}{l}{\cmd{ox}:} \\ + parse & ox & \uline{true}/false & true & page \pageref{key:ox_parse} \\ + roman & ox & \uline{true}/false & true & page \pageref{key:ox_roman} \\ + pos & ox & top/super/side & top & page \pageref{key:ox_pos} \\ + explicit-sign & ox & \uline{true}/false & false & page \pageref{key:ox_explicit-sign} \\ + decimal-marker & ox & comma/point & point & page \pageref{key:ox_decimal-marker} \\ + \multicolumn{5}{l}{\cmd{OX}, \cmd{redox}:} \\ + dist & redox & <dim> & .6em & page \pageref{key:redox_dist} \\ + sep & redox & <dim> & .2em & page \pageref{key:redox_sep} \\ + \multicolumn{5}{l}{\cmd{Enthalpy}, \cmd{Entropy}, \cmd{Gibbs}:} \\ + exponent & & <anything> & \cmd{standardstate} & page \pageref{key:thermo_exponent} \\ + delta & & <anything>/false & & page \pageref{key:thermo_delta} \\ + subscript & & left/right & & page \pageref{key:thermo_subscript} \\ + unit & & <unit> & & page \pageref{key:thermo_unit} \\ + \multicolumn{5}{l}{\cmd{setnewstate}, \cmd{renewstate}:} \\ + exponent & & <anything> & \cmd{standardstate} & page \pageref{key:newstate_exponent} \\ + delta & & <anything>/false & & page \pageref{key:newstate_delta} \\ + subscript & & <anything> & & page \pageref{key:newstate_subscript} \\ + subscript-left & & true/false & & page \pageref{key:newstate_subscript-left} \\ + \multicolumn{5}{l}{\cmd{State}:} \\ + exponent & & <anything> & \cmd{standardstate} & page \pageref{key:state_exponent} \\ + delta & & <anything>/false & & page \pageref{key:state_delta} \\ + subscript-left & & true/false & & page \pageref{key:state_subscript-left} \\ + \multicolumn{5}{l}{\cmd{NMR}:} \\ + unit & nmr & <unit> & \cmd{mega}\cmd{hertz} & page \pageref{key:nmr_unit} \\ + nucleus & nmr & \{<num>,<atom symbol>\} & \{1,H\} & page \pageref{key:nmr_nucleus} \\ + \multicolumn{5}{l}{\cmd{newreaction}:} \\ + star & & \uline{true}/false & false & page \pageref{key:star} \\ + arg & & \uline{true}/false & false & page \pageref{key:arg} \\ + \multicolumn{5}{l}{\cmd{mhName}:} \\ + align & mhName & <alignment> & \cmd{centering} & page \pageref{key:mhName_align} \\ + fontattr & mhName & <commands> & & page \pageref{key:mhName_fontattr} \\ + fontsize & mhName & <fontsize> & \cmd{tiny} & page \pageref{key:mhName_fontsize} \\ + width & mhName & <dim> & & page \pageref{key:mhName_width} \\ + \multicolumn{5}{l}{\cmd{newman}:} \\ + angle & newman & <angle> & 0 & page \pageref{key:newman_angle} \\ + scale & newman & <factor> & 1 & page \pageref{key:newman_scale} \\ + ring & newman & <tikz> & & page \pageref{key:newman_ring} \\ + atoms & newman & <tikz> & & page \pageref{key:newman_atoms} \\ + back-atoms & newman & <tikz> & & page \pageref{key:newman_back-atoms} \\ + \multicolumn{5}{l}{\cmd{orbital} \ttfamily <type> = s/p/sp/sp2/sp3:} \\ + phase & orbital/<type> & \uline{+}/- & + & page \pageref{key:orbital_phase} \\ + scale & orbital/<type> & <factor> & 1 & page \pageref{key:orbital_scale} \\ + color & orbital/<type> & <color> & black & page \pageref{key:orbital_color} \\ + angle & orbital/<type> & <angle> & 90 & page \pageref{key:orbital_angle} \\ + half & orbital/p & \uline{true}/false & false & page \pageref{key:orbital_half} \\ + overlay & orbital & \uline{true}/false & false & page \pageref{key:orbital_overlay} \\ + opacity & ornital & <num> & 1 & page \pageref{key:orbital_opacity} +\end{longtable} +\end{fullwidth} + +\section{Suggestions and Bug Reports} +Feedback on \CMname is highly appreciated and welcome! If you have suggestions for macros, missing features \etc, please don't hesitate to cantact me. If you recognize any errors, be it chemical ones, wrong documentation and the like, I'd be grateful about a short email to \href{mailto:contact@mychemistry.eu}{contact@mychemistry.eu}. If you find any bugs, it would be best, if you'd send me a minimal example, with which I can reproduce the bug. + +Many thanks to all the people, who already provided me with feedback! \end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros-version1.cfg b/Master/texmf-dist/tex/latex/chemmacros/chemmacros-version1.cfg new file mode 100644 index 00000000000..7aa9dbcfb5b --- /dev/null +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros-version1.cfg @@ -0,0 +1,334 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% --------------------------------------------------------------------------- % +% - chemmacros - chemmacros-version1.cfg - % +% - macros and commands for chemists - % +% --------------------------------------------------------------------------- % +% - Clemens Niederberger - % +% - 2011/10/28 - % +% --------------------------------------------------------------------------- % +% - http://www.mychemistry.eu/ - % +% - contact@mychemistry.eu - % +% --------------------------------------------------------------------------- % +% - If you have any ideas, questions, suggestions or bugs to report, please - % +% - feel free to contact me. - % +% --------------------------------------------------------------------------- % +% - Copyright 2011 Clemens Niederberger - % +% - - % +% - This work may be distributed and/or modified under the - % +% - conditions of the LaTeX Project Public License, either version 1.3 - % +% - of this license or (at your option) any later version. - % +% - The latest version of this license is in - % +% - http://www.latex-project.org/lppl.txt - % +% - and version 1.3 or later is part of all distributions of LaTeX - % +% - version 2005/12/01 or later. - % +% - - % +% - This work has the LPPL maintenance status `maintained'. - % +% - - % +% - The Current Maintainer of this work is Clemens Niederberger. - % +% - - % +% - This work consists of the files chemmacros.sty, chemmacros-version1.cfg,- % +% - chemmacros_doc_de.tex, chemmacros_doc_de.tex, README and the derived - % +% - files chemmacros_doc_de.pdf and chemmacros_doc_en.pdf - % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% old definitions of some commands, deprecated commands +\RequirePackage { ifthen } +% first copy old tools: +% --------------------------------------------------------------------------- % +\ExplSyntaxOff +% Test if #2 is part of #1 +% (the macro is a copy of chemfig's \CF@if@instr by Christian Tellechea) +\newcommand*\CM@ifinstr[2]{% + \def\CM@ifinstr@i##1#2##2\@nil{\ifx\@empty##2\@empty\expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi}% + \CM@ifinstr@i#1#2\@nil% +} + +% split at comma, save part before in #3, save part after in \CM@RemainStr +% (the macro is a copy of chemfig's \CF@analyze@movearg by Christian Tellechea) +\def\CM@split#1,#2\@nil#3{% + \def#3{#1}\def\CM@RemainStr{#2}% +} +% --------------------------------------------------------------------------- % +% Optional Argument Analysis +\newcounter{CM@tmp@cnt} +\setcounter{CM@tmp@cnt}{0} +\newcounter{CM@splitting@cnt} +% empty \CM@arg@<num> +\newcommand*\CM@ClearArgs[1]{% + \whiledo{\value{CM@tmp@cnt}<#1}{% + \stepcounter{CM@tmp@cnt}% + \expandafter\let\csname CM@arg@\roman{CM@tmp@cnt}\endcsname\@empty% + }% + \setcounter{CM@tmp@cnt}{0}% +} +% split a list separated by commas into \CM@arg@<num>, number of arguments chosen by #2 +\newcommand*\CM@splitting[2]{% + \CM@ClearArgs{#2}% + \setcounter{CM@splitting@cnt}{#2-1}% + \def\CM@RemainStr{#1}% + \whiledo{\value{CM@tmp@cnt}<\value{CM@splitting@cnt}}{% + \expandafter\CM@ifinstr\expandafter{\CM@RemainStr}{,}{% + \stepcounter{CM@tmp@cnt}% + \expandafter\CM@split\CM@RemainStr\@nil\CM@tmp@name% + \expandafter\let\csname CM@arg@\roman{CM@tmp@cnt}\endcsname\CM@tmp@name% + }{% + \stepcounter{CM@tmp@cnt}% + \expandafter\let\csname CM@arg@\roman{CM@tmp@cnt}\endcsname\CM@RemainStr% + \let\CM@RemainStr\@empty% + \setcounter{CM@tmp@cnt}{\value{CM@splitting@cnt}}% + }% + }% + \stepcounter{CM@tmp@cnt}% + \expandafter\let\csname CM@arg@\roman{CM@tmp@cnt}\endcsname\CM@RemainStr% + \setcounter{CM@tmp@cnt}{0}% +} +% --------------------------------------------------------------------------- % +% check commands for equality +\newcommand*\CM@compareCs[2]{% + \expandafter\let\expandafter\CM@cs@one\csname#1\endcsname% + \expandafter\let\expandafter\CM@cs@two\csname#2\endcsname% + \ifx\CM@cs@one\CM@cs@two\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi +} +% check strings for equality ---------------------------------------------------------- % +\newcommand*\CM@compareStr[2]{% + \edef\CM@cs@one{#1}% + \edef\CM@cs@two{#2}% + \ifx\CM@cs@one\CM@cs@two\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi +} + +% --------------------------------------------------------------------------- % +% \setnewstate, \renewstate \State +% copy of definitions in v1.1 +% \setstatesubscript{right/left} +\newcommand*\CM@State@subscript{left} +\newcommand*\setstatesubscript[1]{% + \renewcommand*\CM@State@subscript{\ifx\relax#1\relax left\else#1\fi} +} +% \State[<exp>,<Delta>,<subscript pos>]{<Symbol>}{<Index>} +% {<Index>} is an optional argument! +\NewDocumentCommand\State{omG{}}{% + \IfNoValueTF{#1}{\CM@splitting{}{3}}{\CM@splitting{#1}{3}}% + \ensuremath{% + \CM@compareCs{CM@arg@iii}{@empty}{% + \CM@compareStr{\CM@State@subscript}{right}{\let\CM@State@sub@left\@empty\def\CM@State@sub@right{_\mathrm{#3}}}{\let\CM@State@sub@right\@empty\def\CM@State@sub@left{_\mathrm{#3}}}% + }{ + \CM@compareStr{\CM@arg@iii}{right}{\let\CM@State@sub@left\@empty\def\CM@State@sub@right{_\mathrm{#3}}}{% + \CM@compareStr{\CM@arg@iii}{left}{\let\CM@State@sub@right\@empty\def\CM@State@sub@left{_\mathrm{#3}}}{% + \PackageWarning{chemmacros}{\string\State: <subscript pos> can only have the values 'left' or 'right'}{}% + } + }% + }% + \CM@compareCs{CM@arg@ii}{@empty}{\Delta}{\CM@arg@ii}\CM@State@sub@left#2\CM@State@sub@right% + \CM@compareCs{CM@arg@i}{@empty}{^{\standardstate}}{^{\CM@arg@i}}}% +} + +% \setnewstate[<exp>,<Delta>,<subscript pos>]{<command>}{<letter>}{<unit>} +% \renewstate[<exp>,<Delta>,<subscript pos>]{<command>}{<letter>}{<unit>} +\newcommand*\CM@setnewstate[4][]{% + \CM@splitting{#1}{3}% [<exp>,<Delta>,<subscript pos>] + \CM@compareCs{CM@arg@i}{@empty}{\expandafter\let\csname CM@#2@supscript\endcsname\standardstate}{\expandafter\let\csname CM@#2@supscript\endcsname\CM@arg@i}% + \CM@compareCs{CM@arg@ii}{@empty}{\expandafter\let\csname CM@#2@delta\endcsname\Delta}{\expandafter\let\csname CM@#2@delta\endcsname\CM@arg@ii} + \CM@compareCs{CM@arg@iii}{@empty}{\@namedef{CM@#2@right}{left}}{\expandafter\let\csname CM@#2@right\endcsname\CM@arg@iii}% + \@namedef{#2}{\@ifnextchar[{\@nameuse{CM@#2@ii}}{\@nameuse{CM@#2@i}}}% + \@namedef{CM@#2@i}##1{\ensuremath{\State[\@nameuse{CM@#2@supscript},\@nameuse{CM@#2@delta},\@nameuse{CM@#2@right}]{#3}{}=\SI{##1}{#4}}}% + \@namedef{CM@#2@ii}[##1]##2{% + \CM@splitting{##1}{4}% [<index>,<exp>,<unit>,<subscript pos>] + \let\CM@State@index\CM@arg@i + \CM@compareCs{CM@arg@ii}{@empty}{\def\CM@State@supscript{\@nameuse{CM@#2@supscript}}}{\let\CM@State@supscript\CM@arg@ii}% + \CM@compareCs{CM@arg@iii}{@empty}{\def\CM@State@unit{#4}}{\let\CM@State@unit\CM@arg@iii}% + \CM@compareCs{CM@arg@iv}{@empty}{\def\CM@State@right{\@nameuse{CM@#2@right}}}{\let\CM@State@right\CM@arg@iv}% + \ensuremath{\State[\CM@State@supscript,\@nameuse{CM@#2@delta},\CM@State@right]{#3}{\CM@State@index} = \SI{##2}{\CM@State@unit}}% + }% +} +\newcommand*\setnewstate[4][]{% + \@ifundefined{#2}{\CM@setnewstate[#1]{#2}{#3}{#4}}{\PackageError{chemmacros}{\string\setnewstate: state #2 is already defined}{}}% +} +\newcommand*\renewstate[4][]{% + \@ifundefined{#2}{\PackageError{chemmacros}{\string\renewstate: state #2 is not defined}{}}{\CM@setnewstate[#1]{#2}{#3}{#4}}% +} +\setnewstate{Enthalpy}{H}{\kilo\joule\per\mole}% +\setnewstate[, ]{Entropy}{S}{\joule\per\kelvin\per\mole}% +\setnewstate{Gibbs}{G}{\kilo\joule\per\mole}% + +\ExplSyntaxOn + +% --------------------------------------------------------------------------- % +% \newreaction +\NewDocumentCommand \newreaction { s t+ m m } + { + \cs_if_exist:cTF { #3 } + { + \msg_error:nnx { chemmacros } { already-defined } { #3 } + } + { + \IfBooleanTF { #1 } + { \bool_set_true:N \l_chemmacros_reactions_star_bool } + { \bool_set_false:N \l_chemmacros_reactions_star_bool } + \IfBooleanTF { #2 } + { \bool_set_true:N \l_chemmacros_reactions_args_bool } + { \bool_set_false:N \l_chemmacros_reactions_args_bool } + \bool_if:NTF \l_chemmacros_reactions_args_bool + { + \NewEnviron { #3 } [ 1 ] + { + \chemmacros_begin_reaction: + \begin { #4 } { ##1 } + \chemmacros_cee:f { \BODY } + \end{ #4 } + \chemmacros_end_reaction: + } + \bool_if:NT \l_chemmacros_reactions_star_bool + { + \NewEnviron { #3* } [ 1 ] + { + \begin { #4* } { ##1 } + \chemmacros_cee:f { \BODY } + \end { #4* } + } + } + } + { + \NewEnviron { #3 } + { + \chemmacros_begin_reaction: + \begin { #4 } + \chemmacros_cee:f { \BODY } + \end { #4 } + \chemmacros_end_reaction: + } + \bool_if:NT \l_chemmacros_reactions_star_bool + { + \NewEnviron { #3* } + { + \begin { #4* } + \chemmacros_cee:f { \BODY } + \end { #4* } + } + } + } + } + } + +\newreaction* { reaction } { equation } +\newreaction* { reactions } { align } + +% --------------------------------------------------------------------------- % +% \mhName +% copy of definition in v1.1 +% placing text below atom/molecule + \newcommand*\CM@mhName@textattr@default{\centering\tiny} +% \setmhName{<commands>} + \newcommand*\setmhName[1]{ + \ifx\@empty#1\@empty + \renewcommand*\CM@mhName@textattr@default{\centering\tiny} + \else + \renewcommand*\CM@mhName@textattr@default{#1} + \fi + } +% \mhName[<width>][<textattr>]{<formula>}{<text>} + \newlength{\CM@mhName@boxlength} + \NewDocumentCommand\mhName{oomm}{ + \IfNoValueTF{#1}{ + \settowidth{\CM@mhName@boxlength}{#3} + }{ + \ifx\@empty#1\@empty + \settowidth{\CM@mhName@boxlength}{#3} + \else + \setlength{\CM@mhName@boxlength}{#1} + \fi + }% + \IfNoValueTF{#2}{ + \let\CM@mhName@textattr\CM@mhName@textattr@default + }{ + \def\CM@mhName@textattr{#2} + } + \def\CM@mhName@formula{#3} + \ensuremath{\underset{\parbox{\CM@mhName@boxlength} + {\CM@mhName@textattr#4}}{\expandafter\ce\expandafter{\CM@mhName@formula}}} + } + +\ExplSyntaxOff +% --------------------------------------------------------------------------- % +% \newman +% copy of definition in v1.1 +\NewDocumentCommand\newman{ooom}{% + \IfNoValueTF{#1}{% + \def\CM@newman@angle{0}% + \def\CM@newman@scale{1}% + \def\CM@newman@tikz@ring{}% + }{% + \CM@splitting{#1}{3}% + \CM@compareCs{CM@arg@i}{@empty}{\def\CM@newman@angle{0}}{\let\CM@newman@angle\CM@arg@i}% + \CM@compareCs{CM@arg@ii}{@empty}{\def\CM@newman@scale{1}}{\let\CM@newman@scale\CM@arg@ii}% + \expandafter\def\expandafter\CM@newman@tikz@ring\expandafter{\CM@arg@iii}% + } + \IfNoValueTF{#2}{% + \let\CM@newman@tikz@one\@empty% + }{% + \def\CM@newman@tikz@one{#2}% + } + \IfNoValueTF{#3}{% + \let\CM@newman@tikz@two\CM@newman@tikz@one% + }{% + \def\CM@newman@tikz@two{#3}% + } + \CM@splitting{#4}{6}% + \edef\CM@newman@tikz{scale=\CM@newman@scale,CMatomFront/.style={inner sep=0,outer sep=0,\CM@newman@tikz@one},CMatomBack/.style={inner sep=0,outer sep=0,\CM@newman@tikz@two}} + \expandafter\tikz\expandafter[\CM@newman@tikz]{% + \expandafter\draw\expandafter[\CM@newman@tikz@ring] (0,0) circle (.5);% + \foreach\i in{30+\CM@newman@angle,150+\CM@newman@angle,270+\CM@newman@angle}{% + \expandafter\draw\expandafter[\CM@newman@tikz@ring] (\i:0.5) --++(\i:.5);% + }% + \node[CMatomBack,anchor=-150+\CM@newman@angle] at (30+\CM@newman@angle:1.05) {\CM@arg@v};% + \node[CMatomBack,anchor=-30+\CM@newman@angle] at (150+\CM@newman@angle:1.05) {\CM@arg@vi};% + \node[CMatomBack,anchor=90+\CM@newman@angle] at (270+\CM@newman@angle:1.05) {\CM@arg@iv};% + \foreach\i in{90,210,330}{% + \expandafter\draw\expandafter[\CM@newman@tikz@ring] (0,0) --++(\i:1);% + }% + \node[CMatomFront,anchor=-90] at (90:1.05) {\CM@arg@i};% + \node[CMatomFront,anchor=30] at (210:1.05) {\CM@arg@ii};% + \node[CMatomFront,anchor=150] at (330:1.05) {\CM@arg@iii};% + }% +} + +% --------------------------------------------------------------------------- % +% - p-orbitals -------------------------------------------------------------- % +% copy of definition in v1.1 +\newcommand*\CM@porb[1][]{% + \CM@splitting{#1}{3}% + \CM@compareCs{CM@arg@i}{@empty}{\let\CM@orbital@height\CM@orb@height}{\def\CM@orbital@height{\CM@arg@i*\CM@orb@height}}% + \CM@compareCs{CM@arg@ii}{@empty}{\def\CM@orb@color{black}}{\let\CM@orb@color\CM@arg@ii}% + \CM@compareStr{\CM@orb@color}{white}{\def\CM@orb@color@draw{black}}{\let\CM@orb@color@draw\CM@orb@color}% + \CM@compareCs{CM@arg@iii}{@empty}{\def\CM@orb@ang{0}}{\let\CM@orb@ang\CM@arg@iii}% + \tikzpicture[overlay,rotate={\CM@orb@ang-90},opacity=.5,inner sep=0pt,outer sep=0pt,text height=0pt,text depth=0pt]% + \pgfsetfillopacity{.5}% + \CM@compareStr{\CM@orb@half}{false}{% + \draw[draw=black] (0,0) .. controls ++(-.9*\CM@orbital@height,-1.5*\CM@orbital@height) and ++(.9*\CM@orbital@height,-1.5*\CM@orbital@height) .. (0,0);% + }{}% + \draw[draw=\CM@orb@color@draw,fill=\CM@orb@color] (0,0) .. controls ++(-.9*\CM@orbital@height,1.5*\CM@orbital@height) and ++(.9*\CM@orbital@height,1.5*\CM@orbital@height) .. (0,0);% + \endtikzpicture% +} +% full orbital: +% \porb[<size factor>,<color>,<angle>] +\newcommand*\porb{\def\CM@orb@half{false}\CM@porb}% +% half of an orbital: +% \phorb[<size factor>,<color>,<angle>] +\newcommand*\phorb{\def\CM@orb@half{true}\CM@porb}% + +% predefined orbitals: +\newcommand*\pzorb{\porb[,,90]}% +\newcommand*\pyorb{\porb[,,0]}% +\newcommand*\pxorb{\porb[,,-135]}% + +% change orbital settings: +\newcommand*\CM@orb@height{1em}% +\newcommand*\setorbheight[1]{% + \ifx\@empty#1\@empty + \renewcommand*\CM@orb@height{1em}% + \else + \renewcommand*\CM@orb@height{#1}% + \fi +} + +\ExplSyntaxOn + +\tex_endinput:D
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty index dcf361df406..659757ef0cd 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty @@ -1,633 +1,2351 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% ------------------------------------------------------------------------------------- % -% - chemmacros - chemmacros.sty ------------------------------------------------------- % -% - a collection of macros to make typesetting chemistry documents more convenient ---- % -% ------------------------------------------------------------------------------------- % -% - Clemens Niederberger -------------------------------------------------------------- % -% - 2011/06/22 ------------------------------------------------------------------------ % -% ------------------------------------------------------------------------------------- % -% - http://www.mychemistry.eu/ -------------------------------------------------------- % -% - contact@mychemistry.eu ------------------------------------------------------------ % -% ------------------------------------------------------------------------------------- % -% - If you have any ideas, questions, suggestions or bugs to report, please feel free - % -% - to contact me. -------------------------------------------------------------------- % -% ------------------------------------------------------------------------------------- % -% - Copyright 2011 Clemens Niederberger - % -% - - % -% - This work may be distributed and/or modified under the - % -% - conditions of the LaTeX Project Public License, either version 1.3 - % -% - of this license or (at your option) any later version. - % -% - The latest version of this license is in - % -% - http://www.latex-project.org/lppl.txt - % -% - and version 1.3 or later is part of all distributions of LaTeX - % -% - version 2005/12/01 or later. - % -% - - % -% - This work has the LPPL maintenance status `maintained'. - % -% - - % -% - The Current Maintainer of this work is Clemens Niederberger. - % -% - - % -% - This work consists of the files chemmacros.sty, chemmacros_doc_de.tex, - % -% - chemmacros_doc_de.tex, README - % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\newcommand*\CM@version{1.1}% -\newcommand*\CM@date{2011/06/22}% -\newcommand*\CM@name{chemmacros}% -\NeedsTeXFormat{LaTeX2e}[2009/09/24]% -\ProvidesPackage{chemmacros}[2011/06/22 v1.1 chemistry macros]% -\RequirePackage{amsmath,tikz,xparse,ifthen,siunitx}% -\usetikzlibrary{calc}% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% - ifs ------------------------------------------------------------------------------- % -\newif\if@CM@circled\@CM@circledfalse% -\newif\if@CM@german\@CM@germanfalse% -\newif\if@CM@xspace\@CM@xspacefalse% -\newif\if@CM@mhchemloaded\@CM@mhchemloadedfalse% -\newif\if@CM@chemstyleloaded\@CM@chemstyleloadedfalse% -\newif\if@CM@bpchemloaded\@CM@bpchemloadedfalse% -\newif\if@CM@bpchem\@CM@bpchemfalse% -\newif\if@CM@mychemistryloaded\@CM@mychemistryloadedfalse% - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% - package options ------------------------------------------------------------------- % -% circled: -\DeclareOption{circled}{% - \@CM@circledtrue% -} - -% xspace: -\newcommand*\CM@xspace{} -\DeclareOption{xspace}{% - \@CM@xspacetrue% -} - -% german: -\DeclareOption{german}{% - \@CM@germantrue% -} - -% bpchem: -\DeclareOption{bpchem}{ - \@CM@bpchemtrue -} - -% unknown options: -\DeclareOption*{% - \PackageWarning{chemmacros}{Unknown option `\CurrentOption'}% -} -\ProcessOptions\relax - -\if@CM@bpchem - \RequirePackage{bpchem} -\fi - -\if@CM@xspace - \RequirePackage{xspace}% - \let\CM@xspace\xspace% -\fi - -\AtBeginDocument{% - \@ifpackageloaded{mhchem}{\@CM@mhchemloadedtrue}{\@CM@mhchemloadedfalse} - \@ifpackageloaded{chemstyle}{\@CM@chemstyleloadedtrue}{\@CM@chemstyleloadedfalse} - \@ifpackageloaded{bpchem}{\@CM@bpchemloadedtrue}{\@CM@bpchemloadedfalse} - \@ifpackageloaded{mychemistry}{\@CM@mychemistryloadedtrue}{\@CM@mychemistryloadedfalse} - - \if@CM@mhchemloaded - \newcommand*\CM@atom[1]{\cf{#1}}% - \else - \newcommand*\CM@atom[1]{\mbox{#1}}% - \fi - - \if@CM@circled - \let\CM@plus\oplus - \let\CM@minus\ominus - \else - \newcommand*\CM@plus{+}% - \newcommand*\CM@minus{-}% - \fi -} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% - tools ----------------------------------------------------------------------------- % -% Test if #2 is part of #1 -% (the macro is a copy of chemfig's \CF@if@instr by Christian Tellechea) -\newcommand*\CM@ifinstr[2]{% - \def\CM@ifinstr@i##1#2##2\@nil{\ifx\@empty##2\@empty\expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi}% - \CM@ifinstr@i#1#2\@nil% -} - -% split at comma, save part before in #3, save part after in \CM@RemainStr -% (the macro is a copy of chemfig's \CF@analyze@movearg by Christian Tellechea) -\def\CM@split#1,#2\@nil#3{% - \def#3{#1}\def\CM@RemainStr{#2}% -} - -% Optional Argument Analysis ---------------------------------------------------------- % -\newcounter{CM@tmp@cnt} -\setcounter{CM@tmp@cnt}{0} -\newcounter{CM@splitting@cnt} -% empty \CM@arg@<num> -\newcommand*\CM@ClearArgs[1]{% - \whiledo{\value{CM@tmp@cnt}<#1}{% - \stepcounter{CM@tmp@cnt}% - \expandafter\let\csname CM@arg@\roman{CM@tmp@cnt}\endcsname\@empty% - }% - \setcounter{CM@tmp@cnt}{0}% -} -% split a list separated by commas into \CM@arg@<num>, number of arguments chosen by #2 -\newcommand*\CM@splitting[2]{% - \CM@ClearArgs{#2}% - \setcounter{CM@splitting@cnt}{#2-1}% - \def\CM@RemainStr{#1}% - \whiledo{\value{CM@tmp@cnt}<\value{CM@splitting@cnt}}{% - \expandafter\CM@ifinstr\expandafter{\CM@RemainStr}{,}{% - \stepcounter{CM@tmp@cnt}% - \expandafter\CM@split\CM@RemainStr\@nil\CM@tmp@name% - \expandafter\let\csname CM@arg@\roman{CM@tmp@cnt}\endcsname\CM@tmp@name% - }{% - \stepcounter{CM@tmp@cnt}% - \expandafter\let\csname CM@arg@\roman{CM@tmp@cnt}\endcsname\CM@RemainStr% - \let\CM@RemainStr\@empty% - \setcounter{CM@tmp@cnt}{\value{CM@splitting@cnt}}% - }% - }% - \stepcounter{CM@tmp@cnt}% - \expandafter\let\csname CM@arg@\roman{CM@tmp@cnt}\endcsname\CM@RemainStr% - \setcounter{CM@tmp@cnt}{0}% -} - -% check commands for equality --------------------------------------------------------- % -\newcommand*\CM@compareCs[2]{% - \expandafter\let\expandafter\CM@cs@one\csname#1\endcsname% - \expandafter\let\expandafter\CM@cs@two\csname#2\endcsname% - \ifx\CM@cs@one\CM@cs@two\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi -} - -% check strings for equality ---------------------------------------------------------- % -\newcommand*\CM@compareStr[2]{% - \edef\CM@cs@one{#1}% - \edef\CM@cs@two{#2}% - \ifx\CM@cs@one\CM@cs@two\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi -} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% - particles, charges ---------------------------------------------------------------- % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% --------------------------------------------------------------------------- % +% - chemmacros - chemmacros.sty - % +% - macros and commands for chemists - % +% --------------------------------------------------------------------------- % +% - Clemens Niederberger - % +% - 2011/10/28 - % +% --------------------------------------------------------------------------- % +% - http://www.mychemistry.eu/ - % +% - contact@mychemistry.eu - % +% --------------------------------------------------------------------------- % +% - If you have any ideas, questions, suggestions or bugs to report, please - % +% - feel free to contact me. - % +% --------------------------------------------------------------------------- % +% - Copyright 2011 Clemens Niederberger - % +% - - % +% - This work may be distributed and/or modified under the - % +% - conditions of the LaTeX Project Public License, either version 1.3 - % +% - of this license or (at your option) any later version. - % +% - The latest version of this license is in - % +% - http://www.latex-project.org/lppl.txt - % +% - and version 1.3 or later is part of all distributions of LaTeX - % +% - version 2005/12/01 or later. - % +% - - % +% - This work has the LPPL maintenance status `maintained'. - % +% - - % +% - The Current Maintainer of this work is Clemens Niederberger. - % +% - - % +% - This work consists of the files chemmacros.sty, chemmacros-version1.cfg - % +% - chemmacros_doc_de.tex, chemmacros_doc_de.tex, README and the derived - % +% - files chemmacros_doc_de.pdf and chemmacros_doc_en.pdf - % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\RequirePackage{ expl3 , xparse , l3keys2e , xfrac , siunitx , tikz , mathtools , cancel , environ } +\usetikzlibrary{calc,arrows} +\AtBeginDocument + { + \@ifpackageloaded{mhchem}{} { \RequirePackage[ version=3 ]{ mhchem } } + } +\ProvidesExplPackage {chemmacros} {2011/10/27} {2.0} {macros and commands for chemists} + +\bool_new:N \l_chemmacros_version_one_bool +\bool_set_false:N \l_chemmacros_version_one_bool + +\bool_new:N \l_chemmacros_german_bool +\bool_set_false:N \l_chemmacros_german_bool + +\bool_new:N \l_chemmacros_xspace_bool +\bool_set_true:N \l_chemmacros_xspace_bool + +\bool_new:N \l_chemmacros_bpchem_bool +\bool_set_false:N \l_chemmacros_bpchem_bool + +\bool_new:N \l_chemmacros_circled_bool +\bool_set_true:N \l_chemmacros_circled_bool + +\bool_new:N \l_chemmacros_circled_formal_bool +\bool_set_true:N \l_chemmacros_circled_formal_bool + +\bool_new:N \l_chemmacros_circled_chem_bool +\bool_set_true:N \l_chemmacros_circled_chem_bool + +\bool_new:N \l_chemmacros_EZ_cool_bool +\bool_set_false:N \l_chemmacros_EZ_cool_bool + +\bool_new:N \l_chemmacros_chemstyle_bool +\bool_new:N \l_chemmacros_hyperref_bool +\bool_new:N \l_chemmacros_varioref_bool + +\AtBeginDocument + { + \@ifpackageloaded { chemstyle } + { \bool_set_true:N \l_chemmacros_chemstyle_bool } + { \bool_set_false:N \l_chemmacros_chemstyle_bool } + \@ifpackageloaded { varioref } + { \bool_set_true:N \l_chemmacros_varioref_bool } + { \bool_set_false:N \l_chemmacros_varioref_bool } + \@ifpackageloaded { hyperref } + { \bool_set_true:N \l_chemmacros_hyperref_bool } + { \bool_set_false:N \l_chemmacros_hyperref_bool } + } + +% --------------------------------------------------------------------------- % +% package options +% german => change pKA => pKS etc +% xspace => add an \xspace after a whole bunch of macros +% bpchem => use \IUPAC inside for \NMR command +% circled => circle charges +% EZ => cool or chemmacros version of \E +% version=1 => compatibility for documents set with v1.* + +\keys_define:nn { chemmacros / option } + { + bpchem .bool_set:N = \l_chemmacros_bpchem_bool , + bpchem .default:n = true , + circletype .choice: , + circletype / math .code:n = + { \bool_set_false:N \l_chemmacros_circled_chem_bool } , + circletype / chem .code:n = + { \bool_set_true:N \l_chemmacros_circled_chem_bool } , + circletype .default:n = chem , + circled .choice: , + circled / none .code:n = + { + \bool_set_false:N \l_chemmacros_circled_bool + \bool_set_false:N \l_chemmacros_circled_formal_bool + } , + circled / formal .code:n = + { + \bool_set_true:N \l_chemmacros_circled_bool + \bool_set_true:N \l_chemmacros_circled_formal_bool + } , + circled / all .code:n = + { + \bool_set_true:N \l_chemmacros_circled_bool + \bool_set_false:N \l_chemmacros_circled_formal_bool + } , + circled .default:n = formal , + EZ .choice: , + EZ / cool .code:n = + { \bool_set_true:N \l_chemmacros_EZ_cool_bool } , + EZ / chemmacros .code:n = + { \bool_set_false:N \l_chemmacros_EZ_cool_bool } , + EZ .default:n = chemmacros , + german .bool_set:N = \l_chemmacros_german_bool , + german .default:n = true , + xspace .bool_set:N = \l_chemmacros_xspace_bool , + xspace .default:n = true , + version .choice: , + version / 1 .code:n = + { \bool_set_true:N \l_chemmacros_version_one_bool } , + version / 2 .code:n = + { \bool_set_false:N \l_chemmacros_version_one_bool } + } + +\ProcessKeysOptions { chemmacros / option } + +\AtBeginDocument + { + \bool_if:NT \l_chemmacros_bpchem_bool + { \RequirePackage { bpchem } } + \bool_if:NT \l_chemmacros_xspace_bool + { \RequirePackage { xspace } } + } + +\cs_new_nopar:Npn \chemmacros_xspace: + { + \bool_if:NT \l_chemmacros_xspace_bool + { \xspace } + } + +% --------------------------------------------------------------------------- % +% warning / error messages +\msg_set:nnnn { chemmacros } { already-defined } + { + The~command~#1~has~also~been~defined~by~another~package. + } + { + The~command~#1~has~also~been~defined~by~another~package.~ + chemmacros~provides~an~alternative~definition.~ + See~the~documentation~for~more~information. + } + +\msg_set:nnn { chemmacros } { circled=chemfig } + { + You~used~the~option~"circled~=~chemfig"~but~did~not~load~the~package~ + chemfig.~Option~"circled~=~formal"~will~be~used~instead. + } + +\msg_set:nnn { chemmacros } { ox } + { + \token_to_str:N \ox \c_space_tl : ~ #1 ~ \msg_line_context: . + } + +\msg_set:nnn { chemmacros } { OX } + { + \token_to_str:N \OX \c_space_tl : ~ #1 ~ \msg_line_context: . + } + +\msg_set:nnn { chemmacros } { redox } + { + \token_to_str:N \redox \c_space_tl : ~ #1 ~ \msg_line_context: . + } + +\msg_set:nnn { chemmacros } { already-defined } + { + The~command/environment ~ #1 ~ \msg_line_context: \c_space_tl + is~already~defined. + } + +\msg_set:nnnn { chemmacros } { outside-MOdiagram } + { You~can't~use~#1~outside~the~MOdiagram~environment. } + { + The~command~#1~can~only~be~used~inside~the~MOdiagram~ + environment~\msg_line_context: . + } + +\msg_set:nnn { chemmacros } { setnewstate } + { + The~state~\tl_to_str:n { \ #1 } \c_space_tl already~exists.~You~need~to~ + use~\token_to_str:N \renewstate \c_space_tl to~alter~it. + } + +\msg_set:nnn { chemmacros } { renewstate } + { + The~state~\tl_to_str:n { \ #1 } \c_space_tl isn't~set~up~yet.~You~need~to~ + use~\token_to_str:N \setnewstate \c_space_tl to~create~it. + } + +% --------------------------------------------------------------------------- % +% TikZ drawings +\cs_new_nopar:Npn \chemmacros_tikz_picture:nn #1#2 + { \tikzpicture[#1] #2 \endtikzpicture } +\cs_generate_variant:Nn \chemmacros_tikz_picture:nn { fn,xn } + +\cs_new_nopar:Npn \chemmacros_tikz_draw:n #1 + { \draw[#1] } +\cs_generate_variant:Nn \chemmacros_tikz_draw:n { f,x } + +\cs_new_nopar:Npn \chemmacros_tikz_node:n #1 + { \node[#1] } +\cs_generate_variant:Nn \chemmacros_tikz_node:n { f,x } + +\cs_new_nopar:Npn \chemmacros_tikz_shade:n #1 + { \shade[#1] } +\cs_generate_variant:Nn \chemmacros_tikz_shade:n { f,x } + +\cs_new_nopar:Npn \chemmacros_tikz_shadedraw:n #1 + { \shadedraw[#1] } +\cs_generate_variant:Nn \chemmacros_tikz_shadedraw:n { f,x } + +\cs_new_nopar:Npn \chemmacros_tikz_node_in_draw:n #1 + { node[#1] } +\cs_generate_variant:Nn \chemmacros_tikz_node_in_draw:n { f,x } + +% --------------------------------------------------------------------------- % +% circled charge signs +\cs_new_nopar:Npn \chemmacros_fplus_aux: + { + \raise.1ex\hbox{\scalebox{.65}{\textcircled{\lower.1ex\hbox{$+$}}}} + } +\cs_new_nopar:Npn \chemmacros_fplus: + { + \mode_if_math:TF + { \text { \chemmacros_fplus_aux: } } + { \chemmacros_fplus_aux: } + } + +\cs_new_nopar:Npn \chemmacros_fminus_aux: + { + \raise.1ex\hbox{\scalebox{.65}{\textcircled{\lower.1ex\hbox{$-$}}}} + } +\cs_new_nopar:Npn \chemmacros_fminus: + { + \mode_if_math:TF + { \text { \chemmacros_fminus_aux: } } + { \chemmacros_fminus_aux: } + } + +% use directly: +\cs_new_eq:NN \fplus \chemmacros_fplus: +\cs_new_eq:NN \fminus \chemmacros_fminus: + +% change output depending on circled-option +\cs_new_nopar:Npn \chemmacros_plus: + { + \bool_if:nTF { \l_chemmacros_circled_bool && !\l_chemmacros_circled_formal_bool } + { + \bool_if:NTF \l_chemmacros_circled_chem_bool + { \chemmacros_fplus: } + { \oplus } + } + { + } + } + +\cs_new_nopar:Npn \chemmacros_minus: + { + \bool_if:nTF { \l_chemmacros_circled_bool && !\l_chemmacros_circled_formal_bool } + { + \bool_if:NTF \l_chemmacros_circled_chem_bool + { \chemmacros_fminus: } + { \ominus } + } + { - } + } + +\cs_new_nopar:Npn \chemmacros_formal_plus: + { + \bool_set_false:N \l_chemmacros_circled_formal_bool + \chemmacros_plus: + } + +\cs_new_nopar:Npn \chemmacros_formal_minus: + { + \bool_set_false:N \l_chemmacros_circled_formal_bool + \chemmacros_minus: + } + +% --------------------------------------------------------------------------- % +% transition state symbol +\AtBeginDocument + { + \cs_new_nopar:Npn \chemmacros_transitionstatesymbol: + { + \mode_if_math:TF + { \text { \chemmacros_transitionstatesymbol_aux: } } + { \chemmacros_transitionstatesymbol_aux: } + } + + \cs_new_nopar:Npn \chemmacros_transitionstatesymbol_aux: + { + \tikz[inner~sep=0,outer~sep=0,minimum~size=0,space-space,line~width=.3pt] + { + \draw (0,0) -- + node[pos=.36] + (chemmacros_transitionstate_x) {} + node[pos=.64] + (chemmacros_transitionstate_y){} + (0,.8em) ; + \draw (chemmacros_transitionstate_x) ++(-.4em,0) -- ++(.8em,0) ; + \draw (chemmacros_transitionstate_y) ++(-.4em,0) -- ++(.8em,0) ; + } + } + + \@ifpackageloaded{mychemistry} + { + \cs_set_eq:NN + \transitionstatesymbol + \chemmacros_transitionstatesymbol: + } + { + \cs_new_eq:NN + \transitionstatesymbol + \chemmacros_transitionstatesymbol: + } + } + +\cs_new_nopar:Npn \chemmacros_atom:n #1 + { \ce { #1 } } +\cs_generate_variant:Nn \chemmacros_atom:n { o,f,x } + +% --------------------------------------------------------------------------- % +% particles, charges % electron -\newcommand*\el{\ensuremath{e^\CM@minus}\CM@xspace} +\bool_new:N \l_chemmacros_charge_append_bool +\bool_set_false:N \l_chemmacros_charge_append_bool + +\cs_new_nopar:Npn \el + { \chemmacros_atom:n { e } \mch \chemmacros_xspace: } % proton -\newcommand*\prt{\ensuremath{p^\CM@plus}\CM@xspace} -% charges -\newcommand*\mch[1][]{\ensuremath{{}^{#1\CM@minus}}} -\newcommand*\pch[1][]{\ensuremath{{}^{#1\CM@plus}}} -\newcommand*\delm{\mbox{\tiny$\delta\CM@minus$}\CM@xspace} -\newcommand*\delp{\mbox{\tiny$\delta\CM@plus$}\CM@xspace} -\newcommand*\scrm{\ensuremath{\scriptstyle\CM@minus}} -\newcommand*\scrp{\ensuremath{\scriptstyle\CM@plus}} +\cs_new_nopar:Npn \prt + { \chemmacros_atom:n { p } \pch \chemmacros_xspace: } % neutron -\newcommand*\ntr{\ensuremath{n^0}\CM@xspace} +\cs_new_nopar:Npn \ntr + { \chemmacros_atom:n { n^0 } \chemmacros_xspace: } + +% charges +\cs_new_nopar:Npn \chemmacros_charge:n #1 + { + \bool_if:NTF \l_chemmacros_charge_append_bool + { + \mode_if_math:TF + { {}^ { #1 } } + { $ {}^ { #1 } $ } + } + { + \mode_if_math:TF + { ^ { #1 } } + { $ ^ { #1 } $ } + } + } + +\keys_define:nn { chemmacros / charges } + { + append .bool_set:N = \l_chemmacros_charge_append_bool , + append .default:n = true + } + +\NewDocumentCommand \mch { o } + { + \IfNoValueTF { #1 } + { \chemmacros_charge:n { \chemmacros_minus: } } + { \chemmacros_charge:n { #1 \chemmacros_minus: } } + } -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% - stereo descriptors and sim. ------------------------------------------------------- % +\NewDocumentCommand \pch { o } + { + \IfNoValueTF { #1 } + { \chemmacros_charge:n { \chemmacros_plus: } } + { \chemmacros_charge:n { #1 \chemmacros_plus: } } + } + +\NewDocumentCommand \fmch { o } + { + \IfNoValueTF { #1 } + { \chemmacros_charge:n { \chemmacros_formal_minus: } } + { \chemmacros_charge:n { #1 \chemmacros_formal_minus: } } + } + +\NewDocumentCommand \fpch { o } + { + \IfNoValueTF { #1 } + { \chemmacros_charge:n { \chemmacros_formal_plus: } } + { \chemmacros_charge:n { #1 \chemmacros_formal_plus: } } + } + +\cs_new_nopar:Npn \delm + { \mbox { \tiny \( \delta \chemmacros_minus: \) } \chemmacros_xspace: } +\cs_new_nopar:Npn \delp + { \mbox { \tiny \( \delta \chemmacros_plus: \) } \chemmacros_xspace: } +\cs_new_nopar:Npn \fdelm + { \mbox { \tiny \( \delta \chemmacros_formal_minus: \) } \chemmacros_xspace: } +\cs_new_nopar:Npn \fdelp + { \mbox { \tiny \( \delta \chemmacros_formal_plus: \) } \chemmacros_xspace: } +\cs_new_nopar:Npn \scrm + { \ensuremath { \scriptstyle \chemmacros_minus: } } +\cs_new_nopar:Npn \scrp + { \ensuremath { \scriptstyle \chemmacros_plus: } } +\cs_new_nopar:Npn \fscrm + { \ensuremath { \scriptstyle \chemmacros_formal_minus: } } +\cs_new_nopar:Npn \fscrp + { \ensuremath { \scriptstyle \chemmacros_formal_plus: } } + +% --------------------------------------------------------------------------- % +% ions, molecules +% proton, hydroxide, hydronium/oxonium, water, nucleophile, electrophile +\cs_new_nopar:Npn \Hpl + { \chemmacros_atom:n { H } \pch \chemmacros_xspace: } +\cs_new_nopar:Npn \Hyd + { \chemmacros_atom:n { OH } \mch \chemmacros_xspace: } +\cs_new_nopar:Npn \HtO + { \chemmacros_atom:n { H3O } \pch \chemmacros_xspace: } +\cs_new_nopar:Npn \water + { \chemmacros_atom:n { H2O } \chemmacros_xspace: } +\cs_new_nopar:Npn \Nu + { \chemmacros_atom:n { Nu } \mch \chemmacros_xspace: } +\cs_new_nopar:Npn \El + { \chemmacros_atom:n { E } \pch \chemmacros_xspace: } + +% --------------------------------------------------------------------------- % +% stereo descriptors and sim. % Cahn-Ingold-Prelog -\newcommand*\Rcip{\textit{(R)}} -\newcommand*\Scip{\textit{(S)}} -\newcommand*\cip[1]{\textit{(#1)}} -\newcommand*\Sconf[1][S]{\tikz[baseline=(a.base),text height=1.5ex,text depth=.25ex]{\draw node(a) {#1};\draw[->,thick,rotate=90] ($(a.center)+(20:.8em)$) arc (20:340:.8em);}} -\newcommand*\Rconf[1][R]{\tikz[baseline=(a.base),text height=1.5ex,text depth=.25ex]{\draw node(a) {#1};\draw[<-,thick,rotate=90] ($(a.center)+(20:.8em)$) arc (20:340:.8em);}} +\cs_new_nopar:Npn \Rcip { \textit { (R) } } +\cs_new_nopar:Npn \Scip { \textit { (S) } } +\cs_new_nopar:Npn \cip #1 { \textit { (#1) } } +\ExplSyntaxOff +\NewDocumentCommand\Sconf { O { S } }% + {% + \tikz[baseline=(a.base),text height=1.5ex,text depth=.25ex] + { + \node(a) {#1} ; + \draw[->,thick,rotate=90] ($(a.center)+(20:.8em)$) arc (20:340:.8em); + }% + } + +\NewDocumentCommand \Rconf { O { R } }% + {% + \tikz[baseline=(a.base),text height=1.5ex,text depth=.25ex] + { + \node(a) {#1} ; + \draw[<-,thick,rotate=90] ($(a.center)+(20:.8em)$) arc (20:340:.8em) ; + }% + }% +\ExplSyntaxOn % E(ntgegen)/Z(usammen) -\newcommand*\E{\textit{(E)}} -\newcommand*\Z{\textit{(Z)}} -\AtBeginDocument{\if@CM@bpchemloaded - \renewcommand*\cis{\textit{cis}\CM@xspace} - \renewcommand*\trans{\textit{trans}\CM@xspace} - \else - \newcommand*\cis{\textit{cis}\CM@xspace} - \newcommand*\trans{\textit{trans}\CM@xspace} -\fi} -\newcommand*\tert{\textit{tert}\CM@xspace} +\AtBeginDocument + { + \bool_if:NTF \l_chemmacros_EZ_cool_bool + { + \cs_new_nopar:Npn \Ent { \textit { (E) } } + \cs_new_nopar:Npn \Zus { \textit { (Z) } } + } + { + \cs_if_free:NTF \E + { \cs_new_nopar:Npn \E { \textit { (E) } } } + { \cs_set_nopar:Npn \E { \textit { (E) } } } + \cs_new_nopar:Npn \Z { \textit { (Z) } } + } + } + +\AtBeginDocument + { + \cs_if_free:NTF \cis + { + \cs_new_nopar:Npn \cis { \textit { cis } \chemmacros_xspace: } + } + { + \cs_set_nopar:Npn \cis { \textit { cis } \chemmacros_xspace: } + } + \cs_if_free:NTF \trans + { + \cs_new_nopar:Npn \trans { \textit { trans } \chemmacros_xspace: } + } + { + \cs_set_nopar:Npn \trans { \textit { trans } \chemmacros_xspace: } + } + } + +\cs_new_nopar:Npn \tert { \textit { tert } \chemmacros_xspace: } % Fischer -\newcommand*\Dfi{\textsc{d}} -\newcommand*\Lfi{\textsc{l}} +\cs_new_nopar:Npn \Dfi { \textsc { d } } +\cs_new_nopar:Npn \Lfi { \textsc { l } } % ortho/meta/para -\newcommand*\ortho{\textsl{o}} -\newcommand*\meta{\textsl{m}} -\newcommand*\para{\textsl{p}} +\cs_new_nopar:Npn \ortho { \textsl { o } } +\cs_new_nopar:Npn \meta { \textsl { m } } +\cs_new_nopar:Npn \para { \textsl { p } } % latin phrases -\AtBeginDocument{\if@CM@chemstyleloaded - \newcommand*\insitu{\latin{in situ}\CM@xspace} - \newcommand*\abinitio{\latin{ab initio}\CM@xspace} -\else - \newcommand*\insitu{\textit{in situ}\CM@xspace} - \newcommand*\abinitio{\textit{ab initio}\CM@xspace} -\fi} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% - ions, molecules ------------------------------------------------------------------- % -% Proton, Hydroxide, Hydronium/Oxonium, water, nucleophile, electrophile -\newcommand*\Hpl{\CM@atom{H\pch}\CM@xspace} -\newcommand*\Hyd{\CM@atom{OH\mch}\CM@xspace} -\newcommand*\HtO{\CM@atom{H$_3$O\pch}\CM@xspace} -\newcommand*\water{\CM@atom{H$_2$O}\CM@xspace} -\newcommand*\Nu{\CM@atom{Nu\mch}\CM@xspace} -\newcommand*\El{\CM@atom{E\pch}\CM@xspace} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% - acid/base ------------------------------------------------------------------------- % -\newcommand*\pH{\mbox{\textsl{p}H}\CM@xspace} -\newcommand*\pOH{\mbox{\textsl{p}OH}\CM@xspace} -\newcommand*\pKa[1][]{\mbox{\textsl{p}$K_\mathrm{\if@CM@german S\else A\fi#1}$}\CM@xspace} -\newcommand*\pKb[1][]{\mbox{\textsl{p}$K_\mathrm{B#1}$}\CM@xspace} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% - substituents ---------------------------------------------------------------------- % +\AtBeginDocument + { + \bool_if:NTF \l_chemmacros_chemstyle_bool + { + \cs_new_nopar:Npn \insitu { \latin{in~situ} \chemmacros_xspace: } + \cs_new_nopar:Npn \abinitio { \latin{ab~initio} \chemmacros_xspace: } + } + { + \cs_new_nopar:Npn \insitu { \textit{in~situ} \chemmacros_xspace: } + \cs_new_nopar:Npn \abinitio { \textit{ab~initio} \chemmacros_xspace: } + } + } + +% --------------------------------------------------------------------------- % +% acid/base +\cs_new_nopar:Npn \pH + { \mbox { \textsl { p } H } \chemmacros_xspace: } +\cs_new_nopar:Npn \pOH + { \mbox { \textsl { p } OH } \chemmacros_xspace: } +\NewDocumentCommand \p { m } + { \mbox { \textsl { p } \ensuremath { #1 } } \chemmacros_xspace: } + +\char_set_catcode_math_subscript:N \@ +\NewDocumentCommand \pKa { o } + { + \mbox + { + \textsl { p } + \( + K @ \mathrm + { + \bool_if:NTF \l_chemmacros_german_bool + { S } + { A } + \IfNoValueF{ #1 } { #1 } + } + \) + } + \chemmacros_xspace: + } + +\NewDocumentCommand \pKb { o } + { + \mbox + { + \textsl { p } + \( + K @ \mathrm + { + B + \IfNoValueF{ #1 } { #1 } + } + \) + } + \chemmacros_xspace: + } +\char_set_catcode_letter:N \@ + +% --------------------------------------------------------------------------- % +% substituents % \R[<sign>]{<subscript>} -\newcommand*\R[2][]{\CM@atom{R$_{\mathrm{#2}}^{\ifx#1+\CM@plus\else\ifx#1-\CM@minus\fi\fi}$}} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% - units ----------------------------------------------------------------------------- % -\DeclareSIUnit{\atm}{atm} -\DeclareSIUnit{\atmosphere}{atm} -\DeclareSIUnit{\calory}{cal} -\DeclareSIUnit{\cal}{cal} -\AtBeginDocument{\if@CM@chemstyleloaded\else - \DeclareSIUnit{\cmc}{\cubic\centi\metre} - \DeclareSIUnit{\molar}{\mole\per\cubic\deci\metre} - \DeclareSIUnit{\Molar}{\textsc{m}} -\fi} -\DeclareSIUnit{\moLar}{\mole\per\liter} -\DeclareSIUnit{\MolMass}{\gram\per\mole} -\DeclareSIUnit{\normal}{\textsc{n}} -\DeclareSIUnit{\torr}{torr} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% - reaction mechanisms --------------------------------------------------------------- % + +\char_set_catcode_math_subscript:N \@ +\NewDocumentCommand \R { o g } + { + \chemmacros_atom:n + { + R + $ + \IfNoValueF { #2 } { @ { \mathrm { #2 } } } + ^ { + \IfNoValueF { #1 } + { + \tl_if_eq:nnTF { #1 } { + } + { \chemmacros_plus: } + { + \tl_if_eq:nnT { #1 } { - } + { \chemmacros_minus: } + } + } + } + $ + } + } +\char_set_catcode_letter:N \@ + +% --------------------------------------------------------------------------- % +% units +\DeclareSIUnit { \atm } { atm } +\DeclareSIUnit { \atmosphere } { atm } +\DeclareSIUnit { \calory } { cal } +\DeclareSIUnit { \cal } { cal } +\AtBeginDocument + { + \bool_if:NF \l_chemmacros_chemstyle_bool + { + \DeclareSIUnit { \cmc } { \cubic\centi\metre } + \DeclareSIUnit { \molar } { \mole\per\cubic\deci\metre } + \DeclareSIUnit { \Molar } { \textsc{m} } + } + } +\DeclareSIUnit { \moLar } { \mole\per\liter } +\DeclareSIUnit { \MolMass } { \gram\per\mole } +\DeclareSIUnit { \normal } { \textsc{n} } +\DeclareSIUnit { \torr } { torr } + +% --------------------------------------------------------------------------- % +% reaction mechanisms % \mech[<type>] % <type> - substitutions: {}, 1, 2, se, 1e, 2e, ar % - eliminations: e, e1, e2, cb -\newcommand*\CM@Substitution[1][]{% - \CM@compareStr{#1}{se}{\def\CM@subst@mol{_\mathrm{E}}\let\CM@subst@ar\@empty}{% - \CM@compareStr{#1}{1e}{\def\CM@subst@mol{_\mathrm{E}1}\let\CM@subst@ar\@empty}{% - \CM@compareStr{#1}{2e}{\def\CM@subst@mol{_\mathrm{E}2}\let\CM@subst@ar\@empty}{% - \CM@compareStr{#1}{ar}{\def\CM@subst@mol{_\mathrm{E}}\def\CM@subst@ar{Ar-}}{% - \def\CM@subst@mol{_\mathrm{N}#1}\let\CM@subst@ar\@empty}}}}% - \CM@atom{\mbox{\CM@subst@ar S}$\CM@subst@mol$}\CM@xspace% -} -\newcommand*\CM@Elimination[1][]{% - \CM@compareStr{#1}{cb}{\def\CM@elim@mol{1_\mathrm{cb}}}{\def\CM@elim@mol{#1}}% - \CM@atom{E$\CM@elim@mol$}\CM@xspace% -} -\newcommand*\mech[1][]{% - \CM@compareStr{#1}{se}{\def\CM@mech@type{S}\def\CM@mech@mol{_\mathrm{E}}\let\CM@mech@ar\@empty}{% - \CM@compareStr{#1}{1e}{\def\CM@mech@type{S}\def\CM@mech@mol{_\mathrm{E}1}\let\CM@mech@ar\@empty}{% - \CM@compareStr{#1}{2e}{\def\CM@mech@type{S}\def\CM@mech@mol{_\mathrm{E}2}\let\CM@mech@ar\@empty}{% - \CM@compareStr{#1}{ar}{\def\CM@mech@type{S}\def\CM@mech@mol{_\mathrm{E}}\def\CM@mech@ar{Ar-}}{% - \CM@compareStr{#1}{e}{\def\CM@mech@type{E}\def\CM@mech@mol{}\let\CM@mech@ar\@empty}{% - \CM@compareStr{#1}{e1}{\def\CM@mech@type{E}\def\CM@mech@mol{1}\let\CM@mech@ar\@empty}{% - \CM@compareStr{#1}{e2}{\def\CM@mech@type{E}\def\CM@mech@mol{2}\let\CM@mech@ar\@empty}{% - \CM@compareStr{#1}{cb}{\def\CM@mech@type{E}\def\CM@mech@mol{1_\mathrm{cb}}\let\CM@mech@ar\@empty}{% - \def\CM@mech@type{S}\def\CM@mech@mol{_\mathrm{N}#1}\let\CM@mech@ar\@empty}}}}}}}}% - \CM@atom{\mbox{\CM@mech@ar\CM@mech@type}$\CM@mech@mol$}\CM@xspace% -} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% - oxidation numbers ----------------------------------------------------------------- % +\tl_new:N \l_chemmacros_mech_type_tl +\tl_new:N \l_chemmacros_mech_mol_tl +\tl_new:N \l_chemmacros_mech_ar_tl + +\cs_new_nopar:Npn \chemmacros_set_mech:nnn #1#2#3 + { + \tl_set:Nn \l_chemmacros_mech_type_tl { #1 } + \tl_set:Nn \l_chemmacros_mech_mol_tl { #2 } + \tl_set:Nn \l_chemmacros_mech_ar_tl { #3 } + } + +\char_set_catcode_math_subscript:N \@ +\keys_define:nn { chemmacros / mech } + { + type .choice: , + type / .code:n = + { \chemmacros_set_mech:nnn { S } { $ @ \text {N} $ } {} } , + type / 1 .code:n = + { \chemmacros_set_mech:nnn { S } { $ @ \text {N} $ 1 } {} } , + type / 2 .code:n = + { \chemmacros_set_mech:nnn { S } { $ @ \text {N} $ 2 } {} } , + type / se .code:n = + { \chemmacros_set_mech:nnn { S } { $ @ \text {E} $ } {} } , + type / 1e .code:n = + { \chemmacros_set_mech:nnn { S } { $ @ \text {E} $ 1 } {} } , + type / 2e .code:n = + { \chemmacros_set_mech:nnn { S } { $ @ \text {E} $ 2 } {} } , + type / ar .code:n = + { \chemmacros_set_mech:nnn { S } { $ @ \text {E} $ } { Ar - } } , + type / e .code:n = + { \chemmacros_set_mech:nnn { E } {} {} } , + type / e1 .code:n = + { \chemmacros_set_mech:nnn { E } { 1 } {} } , + type / e2 .code:n = + { \chemmacros_set_mech:nnn { E } { 2 } {} } , + type / cb .code:n = + { \chemmacros_set_mech:nnn { E } { 1 $ @ \text {cb} $ } {} } , + type .default:n = + } + +\NewDocumentCommand \mech { o } + { + \IfNoValueTF { #1 } + { \keys_set:nn { chemmacros / mech } { type } } + { \keys_set:nn { chemmacros / mech } { type = #1 } } + \mbox + { + \tl_use:N \l_chemmacros_mech_ar_tl + \tl_use:N \l_chemmacros_mech_type_tl + \tl_use:N \l_chemmacros_mech_mol_tl + } + \chemmacros_xspace: + } +\char_set_catcode_letter:N \@ + +% --------------------------------------------------------------------------- % +% oxidation numbers % \ox{<number>,<atom>} -\newcommand*\CM@ox@sign[1]{% - \ifx -#1{$-$}% TODO: bad method here, do you see what happens if #1 is more than 1 token??? Use \@car to avoid the bug! - \else \ifx +#1{$+$}% TODO: bad method here, do you see what happens if #1 is more than 1 token??? Use \@car to avoid the bug! - \else #1% - \fi\fi% -} -% I don't quite understand the problem: that macro is used ONLY in \ox (lines 286-291) where no other input than arabic or (more often) roman numbers with a sign make any sense at all (chemically speaking*). In these cases everything happens as it is supposed to: the signs are changed into the math ones but the letters/numbers stay as they are. I must confess I didn't test senseless cases... -%* And I would like to think that users who use a macro for oxidation numbers know what oxidation numbers are -\DeclareRobustCommand\ox[1]{% needs to be robust in order to be used in mhchem's \ce macro - \CM@splitting{#1}{2}% - \CM@compareCs{CM@arg@i}{@empty}{\PackageError{chemmacros}{\string\ox: oxidation number missing}{}}{}% - \CM@compareCs{CM@arg@ii}{@empty}{\PackageError{chemmacros}{\string\ox: atom missing}{}}{}% - \ensuremath{\overset{\mbox{\tiny\expandafter\CM@ox@sign\CM@arg@i}}{\expandafter\CM@atom\expandafter{\CM@arg@ii}}}% -} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% - oxidation arrows ------------------------------------------------------------------ % +\bool_new:N \l_chemmacros_ox_sign_bool +\bool_new:N \l_chemmacros_ox_integer_bool + +\bool_new:N \l_chemmacros_ox_explicit_sign_bool +\bool_set_false:N \l_chemmacros_ox_explicit_sign_bool + +\bool_new:N \l_chemmacros_ox_format_roman_bool +\bool_set_true:N \l_chemmacros_ox_format_roman_bool + +\bool_new:N \l_chemmacros_ox_decimal_marker_comma_bool +\bool_set_false:N \l_chemmacros_ox_decimal_marker_comma_bool + +\bool_new:N \l_chemmacros_ox_parse_bool +\bool_set_true:N \l_chemmacros_ox_parse_bool + +\int_new:N \l_chemmacros_ox_number_int +\fp_new:N \l_chemmacros_ox_number_fp + +\bool_new:N \l_chemmacros_ox_side_bool +\bool_set_false:N \l_chemmacros_ox_side_bool +\bool_new:N \l_chemmacros_ox_super_bool +\bool_set_false:N \l_chemmacros_ox_super_bool +\bool_new:N \l_chemmacros_ox_top_bool +\bool_set_true:N \l_chemmacros_ox_top_bool + +\cs_new_nopar:Npn \chemmacros_ox_process_number:n #1 + { + \bool_if:NTF \l_chemmacros_ox_parse_bool + { + \tl_if_in:nnTF { #1 } { / } + { \chemmacros_ox_fraction:n #1 } + { + \chemmacros_ox_sign:n { #1 } + \chemmacros_ox_value:n { #1 } + } + } + { #1 } + } + +\DeclareInstance { xfrac } { chemmacros-ox-frac } { text } + { + scale-factor = 1.5 , + denominator-bot-sep = -.5ex , + numerator-top-sep = -.3ex , + slash-left-kern = -.05em , + slash-right-kern = -.05em , + slash-symbol-font = ptm + } + +\cs_new_nopar:Npn \chemmacros_ox_fraction:n #1/#2 + { + \bool_set_false:N \l_chemmacros_ox_format_roman_bool + \chemmacros_ox_sign:n { #1 } + \bool_if:NTF \l_chemmacros_ox_side_bool + { \sfrac { \chemmacros_ox_value:n { #1 } } { #2 } } + { \sfrac [ chemmacros-ox-frac ] { \chemmacros_ox_value:n { #1 } } { #2 } } + } + +\cs_new_nopar:Npn \chemmacros_ox_sign:n #1 + { + \fp_compare:nNnT { #1 } > { 0 } + { \bool_if:NT \l_chemmacros_ox_explicit_sign_bool { $+$ } } + \fp_compare:nNnT { #1 } = { 0 } + { \bool_if:NT \l_chemmacros_ox_explicit_sign_bool { $\pm$ } } + \fp_compare:nNnT { #1 } < { 0 } + { $-$ } + } + +\cs_new_nopar:Npn \chemmacros_ox_value:n #1 + { + \fp_set:Nn \l_chemmacros_ox_number_fp { #1 } + \fp_abs:N \l_chemmacros_ox_number_fp + \chemmacros_ox_is_integer:N \l_chemmacros_ox_number_fp + \bool_if:NTF \l_chemmacros_ox_format_roman_bool + { + \chemmacros_fp_to_Roman:N \l_chemmacros_ox_number_fp + } + { + \bool_if:NTF \l_chemmacros_ox_integer_bool + { \chemmacros_fp_to_arabic:N \l_chemmacros_ox_number_fp } + { \chemmacros_fp_show:N \l_chemmacros_ox_number_fp } + } + } + +\cs_new_nopar:Npn \chemmacros_ox_is_integer:n #1 + { + \fp_set:Nn \l_tmpa_tl { #1 } + \fp_add:Nn \l_tmpa_tl { 1 } + \fp_round_places:Nn \l_tmpa_tl { 0 } + \fp_sub:Nn \l_tmpa_tl { 1 } + \fp_compare:nNnTF { \l_tmpa_tl } = { #1 } + { \bool_set_true:N \l_chemmacros_ox_integer_bool } + { + \bool_set_false:N \l_chemmacros_ox_integer_bool + \bool_set_false:N \l_chemmacros_ox_format_roman_bool + } + } +\cs_generate_variant:Nn \chemmacros_ox_is_integer:n { N } + +\cs_new_nopar:Npn \chemmacros_fp_to_Roman:n #1 + { + \group_begin: + \fp_set:Nn \l_tmpa_tl { #1 } + \fp_round_places:Nn \l_tmpa_tl { 0 } + \int_set:Nn \l_tmpa_int { \fp_to_tl:N \l_tmpa_tl } + \int_compare:nTF { \l_tmpa_int = 0 } + { 0 } + { \int_to_Roman:n { \int_use:N \l_tmpa_int } } + \group_end: + } +\cs_generate_variant:Nn \chemmacros_fp_to_Roman:n { N } + +\cs_new_nopar:Npn \chemmacros_fp_to_arabic:n #1 + { + \group_begin: + \fp_set:Nn \l_tmpa_tl { #1 } + \fp_to_tl:N \l_tmpa_tl + \group_end: + } +\cs_generate_variant:Nn \chemmacros_fp_to_arabic:n { N } + +\cs_new_nopar:Npn \chemmacros_fp_show:n #1 + { + \group_begin: + \fp_set:Nn \l_tmpa_tl { #1 } + \bool_if:NTF \l_chemmacros_ox_decimal_marker_comma_bool + { + \tl_set:Nx \l_tmpb_tl { \fp_to_tl:N \l_tmpa_tl } + \tl_replace_once:Nnn \l_tmpb_tl { . } { {,} } + \tl_use:N \l_tmpb_tl + } + { \fp_to_tl:N \l_tmpa_tl } + \group_end: + } +\cs_generate_variant:Nn \chemmacros_fp_show:n { N } + +\cs_new_nopar:Npn \chemmacros_ox:nn #1#2 + { + \tl_if_blank:nT { #1 } + { + \msg_error:nnx { chemmacros } { ox } { oxidation~number~missing } + } + \tl_if_blank:nT { #2 } + { + \msg_error:nnx { chemmacros } { ox } { atom~missing } + } + \ensuremath + { + \bool_if:NT \l_chemmacros_ox_super_bool + { + \chemmacros_atom:n + { #2 ^ { \text { \tiny \chemmacros_ox_process_number:n { #1 } } } } + } + \bool_if:NT \l_chemmacros_ox_side_bool + { + \chemmacros_atom:n { #2 ( \text { \chemmacros_ox_process_number:n { #1 } } ) } + } + \bool_if:NT \l_chemmacros_ox_top_bool + { + \overset + { \mbox { \tiny \chemmacros_ox_process_number:n { #1 } } } + { \chemmacros_atom:n { #2 } } + } + } + } + +\cs_new_nopar:Npn \chemmacros_ox_pos_top: + { + \bool_set_true:N \l_chemmacros_ox_top_bool + \bool_set_false:N \l_chemmacros_ox_super_bool + \bool_set_false:N \l_chemmacros_ox_side_bool + } + +\cs_new_nopar:Npn \chemmacros_ox_pos_super: + { + \bool_set_false:N \l_chemmacros_ox_top_bool + \bool_set_true:N \l_chemmacros_ox_super_bool + \bool_set_false:N \l_chemmacros_ox_side_bool + } + +\cs_new_nopar:Npn \chemmacros_ox_pos_side: + { + \bool_set_false:N \l_chemmacros_ox_top_bool + \bool_set_false:N \l_chemmacros_ox_super_bool + \bool_set_true:N \l_chemmacros_ox_side_bool + } + +\keys_define:nn { chemmacros / ox } + { + pos .choice: , + pos / top .code:n = \chemmacros_ox_pos_top: , + pos / super .code:n = \chemmacros_ox_pos_super: , + pos / side .code:n = \chemmacros_ox_pos_side: , + roman .bool_set:N = \l_chemmacros_ox_format_roman_bool , + roman .default:n = true , + parse .bool_set:N = \l_chemmacros_ox_parse_bool , + parse .default:n = true , + explicit-sign .bool_set:N = \l_chemmacros_ox_explicit_sign_bool , + explicit-sign .default:n = true , + decimal-marker .choice: , + decimal-marker / comma .code:n = + { \bool_set_true:N \l_chemmacros_ox_decimal_marker_comma_bool } , + decimal-marker / point .code:n = + { \bool_set_false:N \l_chemmacros_ox_decimal_marker_comma_bool } + } + +% \ox[<keyval>]{<num>,<atom>} +% \ox*[<keyval>]{<num>,<atom>} => always number on the side +\NewDocumentCommand \ox { s o > { \SplitArgument { 1 } { , } } m } + { + \group_begin: + \IfBooleanT { #1 } { \chemmacros_ox_pos_super: } + \bool_if:NTF \l_chemmacros_version_one_bool + { \keys_set:nn { chemmacros / ox } { parse = false } } + { \IfNoValueF { #2 } { \keys_set:nn { chemmacros / ox } { #2 } } } + \chemmacros_ox:nn #3 + \group_end: + } + +% --------------------------------------------------------------------------- % +% - oxidation arrows +\tl_new:N \l_chemmacros_redox_begin_tl +\tl_new:N \l_chemmacros_redox_end_tl + +\tl_new:N \l_chemmacros_redox_tikz_tl + +\fp_new:N \l_chemmacros_redox_shift_fp +\tl_new:N \l_chemmacros_redox_shift_tl + +\tl_new:N \l_chemmacros_redox_anchor_tl + +\tl_new:N \l_chemmacros_redox_side_tl + +\dim_new:N \l_chemmacros_redox_sep_dim +\dim_new:N \l_chemmacros_redox_sep_default_dim +\dim_set:Nn \l_chemmacros_redox_sep_default_dim { .2em } + +\dim_new:N \l_chemmacros_redox_dist_dim +\dim_set:Nn \l_chemmacros_redox_dist_dim {.6em} + % place and name nodes: % \OX{<name>,<atom>} -\DeclareRobustCommand*\OX[1]{% needs to be robust in order to be used in mhchem's \ce macro - \CM@splitting{#1}{2}% - \CM@compareCs{CM@arg@i}{@empty}{\PackageError{chemmacros}{\string\OX: node name missing}{}}{}% - \CM@compareCs{CM@arg@i}{@empty}{\PackageError{chemmacros}{\string\OX: atom missing}{}}{}% - \tikz[baseline=(\CM@arg@i.base),remember picture]{\node[inner sep=0](\CM@arg@i){\expandafter\CM@atom\expandafter{\CM@arg@ii}};}% -} - -% connect nodes with "redox"-line -% \redox(<name1>,<name2>)[<tikz>][<dim>]{<text>} -\newcommand*\CM@redox@dist{.6em} -\newcommand*\setredoxdist[1]{\ifx\@empty#1\@empty\renewcommand*\CM@redox@dist{.6em}\else\renewcommand*\CM@redox@dist{#1}\fi} -\NewDocumentCommand\redox{d()oom}{% - \IfNoValueTF{#1}{% - \PackageError{chemmacros}{\string\redox: You need to specify coordinates}{} - }{% - \CM@splitting{#1}{2}% - \let\CM@redox@begin\CM@arg@i% - \let\CM@redox@end\CM@arg@ii% - } - \IfNoValueTF{#2}{\def\CM@redox@tikz{}}{\def\CM@redox@tikz{#2}} - \IfNoValueTF{#3}{% - \def\CM@redox@shift{1}% - \def\CM@redox@anchor{above}% - \def\CM@redox@side{north}% - \def\CM@redox@sep{.2em}% - }{% - \pgfmathparse{#3<0}% TODO : You should learn to test if an integer is less than 0: \ifnum#1<\z@ -% #3 is not necessarily an integer. It is more likely real; if you know a way to test if '-.5' is less than 0 that's easier than \pgfmathparse, please let me know. - \ifnum\pgfmathresult=1 % - \def\CM@redox@anchor{below}\def\CM@redox@side{south}\def\CM@redox@sep{-.2em}% - \else% - \def\CM@redox@anchor{above}\def\CM@redox@side{north}\def\CM@redox@sep{.2em}% - \fi% - \def\CM@redox@shift{#3}% - } - \tikz[remember picture,overlay]{\expandafter\draw\expandafter[\CM@redox@tikz] ($(\CM@redox@begin.\CM@redox@side)+(0,\CM@redox@sep)$) -- ++(0,\CM@redox@shift*\CM@redox@dist) -| node[pos=.25,\CM@redox@anchor]{#4} ($(\CM@redox@end.\CM@redox@side)+(0,\CM@redox@sep)$);}% -} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% - spectroscopy ---------------------------------------------------------------------- % -% \NMR(<num>,<elem>)[<num>,<unit>]{<solvent>} ALL arguments are optional -% \NMR* same but without ": $\delta$" at end -\AtBeginDocument{ - \NewDocumentCommand\NMR{sG{1,H}d()o}{% - \IfBooleanTF{#1}{\let\CM@nmr@delta\@empty}{\ifmmode\def\CM@nmr@delta{\mbox{: }\delta}\else\def\CM@nmr@delta{: $\delta$}\fi}% - \CM@splitting{#2}{2}% - \let\CM@nmr@istp\CM@arg@i - \let\CM@nmr@elem\CM@arg@ii - \IfNoValueTF{#3}{% - \let\CM@nmr@spec\@empty - \let\CM@nmr@freq\@empty - }{% - \let\CM@nmr@spec\relax - \CM@splitting{#3}{2}% - \CM@compareCs{CM@arg@ii}{@empty}{\def\CM@nmr@unit{\mega\hertz}}{\def\CM@nmr@unit{\CM@arg@ii}}% - \def\CM@nmr@freq{\expandafter\SI\expandafter{\CM@arg@i}{\CM@nmr@unit}}% - }% - \IfNoValueTF{#4}{% - \let\CM@nmr@lm\@empty - \let\CM@nmr@comma\@empty - }{% - \let\CM@nmr@spec\relax - \def\CM@nmr@lm{\CM@atom{#4}}% - \CM@compareCs{CM@nmr@freq}{@empty}{\let\CM@nmr@comma\@empty}{\def\CM@nmr@comma{,\ifmmode\medspace\else\hspace{\smallskipamount}\fi}}% - }% - \CM@compareCs{CM@nmr@spec}{@empty}{}{% - \def\CM@nmr@spec{\hspace{\smallskipamount}(\CM@nmr@freq\CM@nmr@comma\CM@nmr@lm)}% - }% - \if@CM@bpchem - \ifmmode - \expandafter\text\expandafter{\IUPAC{\^{\CM@nmr@istp}\CM@nmr@elem-NMR}\CM@nmr@spec}\CM@nmr@delta - \else - \IUPAC{\^{\CM@nmr@istp}\CM@nmr@elem-NMR}\CM@nmr@spec\CM@nmr@delta\CM@xspace - \fi - \else - \ifmmode - ^{\CM@nmr@istp}\expandafter\CM@atom\expandafter{\CM@nmr@elem}\mbox{-}\text{NMR}\CM@nmr@spec\CM@nmr@delta - \else - $^{\CM@nmr@istp}$\expandafter\CM@atom\expandafter{\CM@nmr@elem}-NMR\CM@nmr@spec\CM@nmr@delta\CM@xspace - \fi - \fi - } -} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% - for use with mhchem --------------------------------------------------------------- % -\AtBeginDocument{\if@CM@mhchemloaded +\NewDocumentCommand \OX { > { \SplitArgument { 1 } { , } } m } + { \chemmacros_redox_partner:nn #1 } + +\cs_new_nopar:Npn \chemmacros_redox_partner:nn #1#2 + { + \tl_if_blank:nT { #1 } + { + \msg_error:nnx { chemmacros } { OX } { node~name~missing } + } + \tl_if_blank:nT { #2 } + { + \msg_error:nnx { chemmacros } { OX } { atom~missing } + } + \tikz[baseline=(#1.base),remember~picture] + { + \node [inner~sep=0] (#1) { \chemmacros_atom:n {#2} } ; + } + } + +\cs_new_nopar:Npn \chemmacros_redox_coordinates:nn #1#2 + { + \tl_set:Nn \l_chemmacros_redox_begin_tl { #1 } + \tl_set:Nn \l_chemmacros_redox_end_tl { #2 } + } + +\NewDocumentCommand \redox { > { \SplitArgument { 1 } { , } } d() o o m } + { + \IfNoValueT { #1 } + { + \msg_error:nnx { chemmacros } { redox } { You~need~to~specify~coordinates } + } + \tl_clear:N \l_chemmacros_redox_begin_tl + \tl_clear:N \l_chemmacros_redox_end_tl + \tl_clear:N \l_chemmacros_redox_tikz_tl + \chemmacros_redox_coordinates:nn #1 + \IfNoValueF { #2 } + { \tl_set:Nn \l_chemmacros_redox_tikz_tl { #2 } } + \IfNoValueTF { #3 } + { + \fp_set:Nn \l_chemmacros_redox_shift_fp { 1 } + \tl_set:Nn \l_chemmacros_redox_anchor_tl { above } + \tl_set:Nn \l_chemmacros_redox_side_tl { north } + \dim_set_eq:NN \l_chemmacros_redox_sep_dim \l_chemmacros_redox_sep_default_dim + } + { + \fp_compare:nNnTF { #3 } < { 0 } + { + \tl_set:Nn \l_chemmacros_redox_anchor_tl { below } + \tl_set:Nn \l_chemmacros_redox_side_tl { south } + \exp_args:NNo \dim_set:Nn \l_chemmacros_redox_sep_dim { - \l_chemmacros_redox_sep_default_dim } + } + { + \tl_set:Nn \l_chemmacros_redox_anchor_tl { above } + \tl_set:Nn \l_chemmacros_redox_side_tl { north } + \dim_set_eq:NN \l_chemmacros_redox_sep_dim \l_chemmacros_redox_sep_default_dim + } + \fp_set:Nn \l_chemmacros_redox_shift_fp { #3 } + } + \tl_set:Nn \l_chemmacros_redox_shift_tl + { \fp_to_tl:N \l_chemmacros_redox_shift_fp } + \tikz[remember~picture,overlay] + { + \chemmacros_tikz_draw:f { \tl_use:N \l_chemmacros_redox_tikz_tl } + ($(\l_chemmacros_redox_begin_tl . \l_chemmacros_redox_side_tl)+(0,\l_chemmacros_redox_sep_dim)$) + -- + ++(0,\l_chemmacros_redox_shift_tl * \l_chemmacros_redox_dist_dim) -| + node [pos=.25,\l_chemmacros_redox_anchor_tl] { #4 } + ($(\l_chemmacros_redox_end_tl . \l_chemmacros_redox_side_tl)+(0,\l_chemmacros_redox_sep_dim)$) ; + } + } + +% redox-keys +\keys_define:nn { chemmacros / redox } + { + dist .dim_set:N = \l_chemmacros_redox_dist_dim , + dist .default:n = { .6em } , + sep .dim_set:N = \l_chemmacros_redox_sep_default_dim , + sep .default:n = { .2em } + } + +\bool_if:NT \l_chemmacros_version_one_bool + { + \NewDocumentCommand \setredoxdist { m } + { + \tl_if_blank:nTF { #1 } + { \dim_set:Nn \l_chemmacros_redox_dist_dim { .6em } } + { \dim_set:Nn \l_chemmacros_redox_dist_dim { #1 } } + } + } + +% --------------------------------------------------------------------------- % +% spectroscopy +\tl_new:N \l_chemmacros_nmr_isotope_tl +\tl_new:N \l_chemmacros_nmr_isotope_default_tl +\tl_set:Nn \l_chemmacros_nmr_isotope_default_tl { 1 } + +\tl_new:N \l_chemmacros_nmr_element_tl +\tl_new:N \l_chemmacros_nmr_element_default_tl +\tl_set:Nn \l_chemmacros_nmr_element_default_tl { H } + +\bool_new:N \l_chemmacros_nmr_frequency_bool +\bool_new:N \l_chemmacros_nmr_solvent_bool +\bool_new:N \l_chemmacros_nmr_delimiters_bool +\bool_new:N \l_chemmacros_nmr_comma_bool + +\tl_new:N \l_chemmacros_nmr_unit_tl +\tl_set:Nn \l_chemmacros_nmr_unit_tl { \mega\hertz } + +\cs_new_nopar:Npn \chemmacros_nmr_nucleus:n #1,#2 \q_stop + { + \tl_set:Nn \l_chemmacros_nmr_isotope_tl { #1 } + \tl_set:Nn \l_chemmacros_nmr_element_tl { #2 } + } + +\cs_new:Npn \chemmacros_nmr_default_nucleus:n #1,#2 \q_stop + { + \tl_set:Nn \l_chemmacros_nmr_isotope_default_tl { #1 } + \tl_set:Nn \l_chemmacros_nmr_element_default_tl { #2 } + } + +\cs_new_nopar:Npn \chemmacros_nmr_base:nn #1#2 + { + \bool_if:NTF \l_chemmacros_bpchem_bool + { \IUPAC { \^ { #1 } #2 - NMR } } + { $ ^ { #1 } $ #2 - NMR } + } + +\cs_new_nopar:Npn \chemmacros_nmr_frequency:n #1 + { + \tl_if_in:nnTF { #1 } { , } + { \chemmacros_nmr_frequency_aux_i:n #1 \q_stop } + { \chemmacros_nmr_frequency_aux_ii:n { #1 } } + } +\cs_new_nopar:Npn \chemmacros_nmr_frequency_aux_i:n #1,#2 \q_stop + { \SI { #1 } { #2 } } +\cs_new_nopar:Npn \chemmacros_nmr_frequency_aux_ii:n #1 + { \SI { #1 } { \tl_use:N \l_chemmacros_nmr_unit_tl } } + +\keys_define:nn { chemmacros / nmr } + { + unit .tl_set:N = \l_chemmacros_nmr_unit_tl , + unit .default:n = \mega\hertz , + nucleus .code:n = { \chemmacros_nmr_default_nucleus:n #1 \q_stop } , + nucleus .default:n = { 1,H } + } + +\AtBeginDocument + { + % \NMR{<num>,<elem>}(<num>,<unit>)[<solvent>] ALL arguments are optional + % \NMR* same but without ": $\delta$" at end + \NewDocumentCommand \NMR { s g d() o } + { + \group_begin: + \bool_set_false:N \l_chemmacros_nmr_frequency_bool + \bool_set_false:N \l_chemmacros_nmr_solvent_bool + \IfNoValueF { #3 } + { \bool_set_true:N \l_chemmacros_nmr_frequency_bool } + \IfNoValueF { #4 } + { \bool_set_true:N \l_chemmacros_nmr_solvent_bool } + \bool_if:nT + { + \l_chemmacros_nmr_frequency_bool + || + \l_chemmacros_nmr_solvent_bool + } + { \bool_set_true:N \l_chemmacros_nmr_delimiters_bool } + \bool_if:nT + { + \l_chemmacros_nmr_frequency_bool + && + \l_chemmacros_nmr_solvent_bool + } + { \bool_set_true:N \l_chemmacros_nmr_comma_bool } + \IfNoValueTF { #2 } + { + \chemmacros_nmr_nucleus:n + \l_chemmacros_nmr_isotope_default_tl , + \l_chemmacros_nmr_element_default_tl \q_stop + } + { \chemmacros_nmr_nucleus:n #2 \q_stop } + \mode_if_math:TF + { + \text + { + \chemmacros_nmr_base:nn + { \tl_use:N \l_chemmacros_nmr_isotope_tl } + { \tl_use:N \l_chemmacros_nmr_element_tl } + \bool_if:NT \l_chemmacros_nmr_delimiters_bool + { ~ ( } + \bool_if:NT \l_chemmacros_nmr_frequency_bool + { \chemmacros_nmr_frequency:n { #3 } } + \bool_if:NT \l_chemmacros_nmr_comma_bool + { , ~ } + \bool_if:NT \l_chemmacros_nmr_solvent_bool + { \chemmacros_atom:n { #4 } } + \bool_if:NT \l_chemmacros_nmr_delimiters_bool + { ) } + \IfBooleanF { #1 } { : ~ } + } + \IfBooleanF { #1 } { \delta } + } + { + \chemmacros_nmr_base:nn + { \tl_use:N \l_chemmacros_nmr_isotope_tl } + { \tl_use:N \l_chemmacros_nmr_element_tl } + \bool_if:NT \l_chemmacros_nmr_delimiters_bool + { ~ ( } + \bool_if:NT \l_chemmacros_nmr_frequency_bool + { \chemmacros_nmr_frequency:n { #3 } } + \bool_if:NT \l_chemmacros_nmr_comma_bool + { , ~ } + \bool_if:NT \l_chemmacros_nmr_solvent_bool + { \chemmacros_atom:n { #4 } } + \bool_if:NT \l_chemmacros_nmr_delimiters_bool + { ) } + \IfBooleanF { #1 } + { : ~ $ \delta $ } + \bool_if:NF \l_chemmacros_nmr_comma_bool + { \IfBooleanF { #1 } { \chemmacros_xspace: } } + } + \group_end: + } + } + +% --------------------------------------------------------------------------- % % placing text below atom/molecule - \newcommand*\CM@mhName@textattr@default{\centering\tiny}% -% \setmhName{<commands>} - \newcommand*\setmhName[1]{% - \ifx\@empty#1\@empty - \renewcommand*\CM@mhName@textattr@default{\centering\tiny}% - \else - \renewcommand*\CM@mhName@textattr@default{#1}% - \fi - } -% \mhName[<width>][<textattr>]{<formula>}{<text>} - \newlength{\CM@mhName@boxlength}% - \NewDocumentCommand\mhName{oomm}{% - \IfNoValueTF{#1}{% - \settowidth{\CM@mhName@boxlength}{#3}% - }{% - \ifx\@empty#1\@empty - \settowidth{\CM@mhName@boxlength}{#3}% - \else - \setlength{\CM@mhName@boxlength}{#1}% - \fi - }% - \IfNoValueTF{#2}{% - \let\CM@mhName@textattr\CM@mhName@textattr@default - }{% - \def\CM@mhName@textattr{#2} - } - \def\CM@mhName@formula{#3} - \ensuremath{\underset{\parbox{\CM@mhName@boxlength}{\CM@mhName@textattr#4}}{\expandafter\ce\expandafter{\CM@mhName@formula}}}% +\cs_new_nopar:Npn \dim_to_width:nn #1#2 + { \settowidth { #1 } { #2 } } +\cs_generate_variant:Nn \dim_to_width:nn { Nn } + +\bool_new:N \l_chemmacros_mhname_width_bool +\bool_set_false:N \l_chemmacros_mhname_width_bool +\dim_new:N \l_chemmacros_mhname_width_dim + +\tl_new:N \l_chemmacros_mhname_align_tl +\tl_set:Nn \l_chemmacros_mhname_align_tl { \centering } + +\tl_new:N \l_chemmacros_mhname_fontattr_tl +\tl_new:N \l_chemmacros_mhname_fontsize_tl +\tl_set:Nn \l_chemmacros_mhname_fontsize_tl { \tiny } + +\keys_define:nn { chemmacros / mhName } + { + align .tl_set:N = \l_chemmacros_mhname_align_tl , + fontattr .tl_set:N = \l_chemmacros_mhname_fontattr_tl , + fontsize .tl_set:N = \l_chemmacros_mhname_fontsize_tl , + width .code:n = + { + \tl_if_eq:nnTF { #1 } { auto } + { \bool_set_false:N \l_chemmacros_mhname_width_bool } + { + \bool_set_true:N \l_chemmacros_mhname_width_bool + \dim_set:Nn \l_chemmacros_mhname_width_dim { #1 } + } + } + } + +% \mhName[<keyval>]{<formula>}{<text>} +\bool_if:NF \l_chemmacros_version_one_bool + { + \NewDocumentCommand \mhName { o m m } + { + \group_begin: + \IfNoValueF { #1 } { \keys_set:nn { chemmacros / mhName } { #1 } } + \ensuremath + { + \underset + { + \bool_if:NF \l_chemmacros_mhname_width_bool + { \dim_to_width:Nn \l_chemmacros_mhname_width_dim { #2 } } + \parbox + { \dim_use:N \l_chemmacros_mhname_width_dim } + { + \tl_use:N \l_chemmacros_mhname_align_tl + \tl_use:N \l_chemmacros_mhname_fontattr_tl + \tl_use:N \l_chemmacros_mhname_fontsize_tl + #3 + } + } + { \chemmacros_atom:n { #2 } } + } + \group_end: + } } + +% --------------------------------------------------------------------------- % +% - phases +\char_set_catcode_math_subscript:N \@ +\cs_new_nopar:Npn \sld + { + \peek_meaning:NTF [ + { \chemmacros_sld_aux_i: } + { \chemmacros_sld_aux_ii: } + } + +\cs_new_nopar:Npn \chemmacros_sld_aux_i: [#1] + { \ensuremath { @ \mathrm { ( #1 ) } } } + +\cs_new_nopar:Npn \chemmacros_sld_aux_ii: + { + \ensuremath { @ \mathrm { + ( + \bool_if:NTF \l_chemmacros_german_bool + { f } + { s } + ) + } } + } + +\cs_new_nopar:Npn \lqd + { + \peek_meaning:NTF [ + { \chemmacros_lqd_aux_i: } + { \chemmacros_lqd_aux_ii: } + } + +\cs_new_nopar:Npn \chemmacros_lqd_aux_i: [#1] + { \ensuremath { @ \mathrm { ( #1 ) } } } + +\cs_new_nopar:Npn \chemmacros_lqd_aux_ii: + { + \ensuremath { @ \mathrm { + ( + \bool_if:NTF \l_chemmacros_german_bool + { f\/l } + { l } + ) + } } + } + +\bool_if:NT \l_chemmacros_version_one_bool + { + \cs_new_eq:NN \solid \sld + \cs_new_eq:NN \liquid \lqd + } + +\cs_new_nopar:Npn \gas + { \ensuremath { @ \mathrm { (g) } } } + +\cs_new_nopar:Npn \aq + { \ensuremath { @ \mathrm { (aq) } } } +\char_set_catcode_letter:N \@ + +% --------------------------------------------------------------------------- % +\bool_if:NTF \l_chemmacros_version_one_bool + { \newtagform { CMreaction } { \{ } { \} } } + { \newtagform { reaction } { \{ } { \} } } +\newcounter { chemmacros_save_reaction } +\newcounter { reaction } +\cs_new_nopar:Npn \chemmacros_begin_reaction: + { + \bool_if:NT \l_chemmacros_hyperref_bool % create individual names for hyperref + { \cs_set_nopar:Npn \theHequation { R . \theHsection . \arabic { reaction } } } + \bool_if:NT \l_chemmacros_varioref_bool % enable labelformat reaction + { \cs_set_eq:NN \p@equation \p@reaction } + \setcounter { chemmacros_save_reaction } { \value { equation } } + \setcounter { equation } { \value { reaction } } + \bool_if:NTF \l_chemmacros_version_one_bool + { \usetagform { CMreaction } } + { \usetagform { reaction } } + } +\cs_new_nopar:Npn \chemmacros_end_reaction: + { + \setcounter { reaction } { \value { equation } } + \setcounter { equation } { \value { chemmacros_save_reaction } } + } + +% --------------------------------------------------------------------------- % % reaction environments for mhchem - \RequirePackage{mathtools,environ} - \newtagform{CMreaction}{\{}{\}} - \newcounter{save@reaction}% - \newcounter{reaction}% - \newcommand*\CM@AtBeginReaction{\setcounter{save@reaction}{\value{equation}}\setcounter{equation}{\value{reaction}}\usetagform{CMreaction}}% - \newcommand*\CM@AtEndReaction{\setcounter{reaction}{\value{equation}}\setcounter{equation}{\value{save@reaction}}\usetagform{default}}% -% \newreaction*+{<name>}{<type>} -% * and + are optional - \NewDocumentCommand\newreaction{st+mm}{% - \@ifundefined{#3}{% - \IfBooleanTF{#2}{% - \NewEnviron{#3}[1]{\CM@AtBeginReaction\begin{#4}{##1}\expandafter\cee\expandafter{\BODY}\end{#4}\CM@AtEndReaction} - \IfBooleanTF{#1}{% - \NewEnviron{#3*}[1]{\begin{#4*}{##1}\expandafter\cee\expandafter{\BODY}\end{#4*}}% - }{}% - }{% - \NewEnviron{#3}{\CM@AtBeginReaction\begin{#4}\expandafter\cee\expandafter{\BODY}\end{#4}\CM@AtEndReaction} - \IfBooleanTF{#1}{% - \NewEnviron{#3*}{\begin{#4*}\expandafter\cee\expandafter{\BODY}\end{#4*}}% - }{}% - }% - }{\PackageError{chemmacros}{The environment/command #3 is already defined}{}}% +\bool_new:N \l_chemmacros_reactions_star_bool +\bool_new:N \l_chemmacros_reactions_args_bool +\int_new:N \l_chemmacros_reactions_args_int + +\keys_define:nn { chemmacros / reaction } + { + star .bool_set:N = \l_chemmacros_reactions_star_bool , + star .default:n = true , + arg .bool_set:N = \l_chemmacros_reactions_args_bool , + arg .default:n = true } + +% \newreaction[<keyval>]{<name>}{<type>} +\bool_if:NF \l_chemmacros_version_one_bool + { + \NewDocumentCommand \newreaction { o m m } + { + \cs_if_exist:cTF { #2 } + { + \msg_error:nnx { chemmacros } { already-defined } { #2 } + } + { + \IfNoValueTF { #1 } + { + \bool_set_false:N \l_chemmacros_reactions_star_bool + \bool_set_false:N \l_chemmacros_reactions_args_bool + } + { \keys_set:nn { chemmacros / reaction } { #1 } } + \bool_if:NTF \l_chemmacros_reactions_args_bool + { + \NewEnviron { #2 } [ 1 ] + { + \chemmacros_begin_reaction: + \begin { #3 } { ##1 } + \chemmacros_cee:f { \BODY } + \end{ #3 } + \chemmacros_end_reaction: + } + \bool_if:NT \l_chemmacros_reactions_star_bool + { + \NewEnviron { #2* } [ 1 ] + { + \begin { #3* } { ##1 } + \chemmacros_cee:f { \BODY } + \end { #3* } + } + } + } + { + \NewEnviron { #2 } + { + \chemmacros_begin_reaction: + \begin { #3 } + \chemmacros_cee:f { \BODY } + \end { #3 } + \chemmacros_end_reaction: + } + \bool_if:NT \l_chemmacros_reactions_star_bool + { + \NewEnviron { #2* } + { + \begin { #3* } + \chemmacros_cee:f { \BODY } + \end { #3* } + } + } + } + } + } + } + +\cs_new:Npn \chemmacros_cee:n #1 + { \cee { #1 } } +\cs_generate_variant:Nn \chemmacros_cee:n { f } + % predefined: - \newreaction*{reaction}{equation}% - \newreaction*{reactions}{align}% -\fi} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% - phases ---------------------------------------------------------------------------- % -\newcommand*\solid[1][]{\ensuremath{_\mathrm{(\ifx\@empty#1\@empty\if@CM@german f\else s\fi\else#1\fi)}}} -\newcommand*\gas{\ensuremath{_\mathrm{(g)}}} -\newcommand*\liquid[1][]{\ensuremath{_\mathrm{(\ifx\@empty#1\@empty\if@CM@german f\/l\else l\fi\else#1\fi)}}} -\newcommand*\aq{\ensuremath{_\mathrm{(aq)}}} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% - transition state symbol ----------------------------------------------------------- % -\AtBeginDocument{% -\newcommand*\CM@transition@state@symbol{\tikz[inner sep=0,outer sep=0,minimum size=0]{% - \draw(0,0)--node[pos=.3333](@TSx){}node[pos=.6667](@TSy){}(0,.6em);% - \draw(@TSx)++(-.3em,0)--++(.6em,0);% - \draw(@TSy)++(-.3em,0)--++(.6em,0);}% -} -% make sure symbol scales correctly: -\if@CM@mychemistryloaded - \renewcommand*\transitionstatesymbol{\ifmmode\text{\CM@transition@state@symbol}\else\CM@transition@state@symbol\fi} -\else - \newcommand*\transitionstatesymbol{\ifmmode\text{\CM@transition@state@symbol}\else\CM@transition@state@symbol\fi} -\fi} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% - thermodynamics et.al. ------------------------------------------------------------- % -\AtBeginDocument{\if@CM@chemstyleloaded\else\newcommand*\standardstate{\circ}\fi - -% \setstatesubscript{right/left} -\newcommand*\CM@State@subscript{left} -\newcommand*\setstatesubscript[1]{% - \renewcommand*\CM@State@subscript{\ifx\relax#1\relax left\else#1\fi} -} - -% \State[<exp>,<Delta>,<subscript pos>]{<Symbol>}{<Index>} -% {<Index>} is an optional argument! -\NewDocumentCommand\State{omG{}}{% - \IfNoValueTF{#1}{\CM@splitting{}{3}}{\CM@splitting{#1}{3}}% - \ensuremath{% - \CM@compareCs{CM@arg@iii}{@empty}{% - \CM@compareStr{\CM@State@subscript}{right}{\let\CM@State@sub@left\@empty\def\CM@State@sub@right{_\mathrm{#3}}}{\let\CM@State@sub@right\@empty\def\CM@State@sub@left{_\mathrm{#3}}}% - }{ - \CM@compareStr{\CM@arg@iii}{right}{\let\CM@State@sub@left\@empty\def\CM@State@sub@right{_\mathrm{#3}}}{% - \CM@compareStr{\CM@arg@iii}{left}{\let\CM@State@sub@right\@empty\def\CM@State@sub@left{_\mathrm{#3}}}{% - \PackageWarning{chemmacros}{\string\State: <subscript pos> can only have the values 'left' or 'right'}{}% +\bool_if:NF \l_chemmacros_version_one_bool + { + \newreaction [ star ] { reaction } { equation } + \newreaction [ star ] { reactions } { align } + } + +\NewDocumentCommand \chcancel { m } + { \cancel { \chemmacros_atom:f { #1 } } } + +% --------------------------------------------------------------------------- % +% thermodynamics et.al. +% \standardstate as defined by the chemstyle package. Thanks to Joseph Wright +% \AtBeginDocument +% { + \cs_if_exist:NF \standardstate + { + \cs_new_nopar:Npn \standardstate + { + \ensuremath { \chemmacros_standardstate: } + } + \cs_new_nopar:Npn \chemmacros_standardstate: + { + \mathpalette \chemmacros_standardstate_aux: \circ + } + \cs_new_nopar:Npn \chemmacros_standardstate_aux: #1#2 + { + \ooalign + { + \tex_hfil:D + $#1-$ + \tex_hfil:D + \tex_cr:D + \tex_hfil:D + $#1#2$ + \tex_hfil:D + \tex_cr:D + } + } + } +% } + +% --------------------------------------------------------------------------- % +% \State +\tl_new:N \l_chemmacros_State_delta_tl +\tl_set:Nn \l_chemmacros_State_delta_tl { \Delta } +\bool_new:N \l_chemmacros_State_delta_bool +\bool_set_true:N \l_chemmacros_State_delta_bool +\bool_new:N \l_chemmacros_State_subscript_left_bool +\bool_set_true:N \l_chemmacros_State_subscript_left_bool +\bool_new:N \l_chemmacros_State_exponent_bool +\bool_set_true:N \l_chemmacros_State_exponent_bool +\tl_new:N \l_chemmacros_State_exponent_tl +\tl_set:Nn \l_chemmacros_State_exponent_tl { \standardstate } + +\keys_define:nn { chemmacros / state } + { + delta .code:n = + { + \exp_args:Nf \tl_if_eq:nnTF { #1 } { false } + { \bool_set_false:N \l_chemmacros_State_delta_bool } + { + \bool_set_true:N \l_chemmacros_State_delta_bool + \tl_set:Nn \l_chemmacros_State_delta_tl { #1 } + } + } , + subscript-left .bool_set:N = \l_chemmacros_State_subscript_left_bool , + subscript-left .default:n = true , + exponent .code:n = + { + \exp_args:Nf \tl_if_eq:nnTF { #1 } { false } + { \bool_set_false:N \l_chemmacros_State_exponent_bool } + { + \bool_set_true:N \l_chemmacros_State_exponent_bool + \tl_set:Nn \l_chemmacros_State_exponent_tl { #1 } + } + } , + exponent .default:n = \standardstate + } + +% old syntax (v1.1): +% \State[<exp>,<Delta>,<subscript pos>]{<Symbol>}{<subscript>} +% old syntax (v2.0): +% \State[<keyval>]{<Symbol>}{<subscript>} +% {<subscript>} is an optional argument! +\char_set_catcode_math_subscript:N \@ +\cs_new_nopar:Npn \chemmacros_state:nnn #1#2#3 + { + \group_begin: + \IfNoValueF { #1 } + { \keys_set:nn { chemmacros / state } { #1 } } + \ensuremath + { + \bool_if:NT \l_chemmacros_State_delta_bool + { \tl_use:N \l_chemmacros_State_delta_tl } + \bool_if:NT \l_chemmacros_State_subscript_left_bool + { @ { \text { #3 } } } + #2 + \bool_if:NF \l_chemmacros_State_subscript_left_bool + { @ { \text { #3 } } } + \bool_if:NT \l_chemmacros_State_exponent_bool + { ^ { \tl_use:N \l_chemmacros_State_exponent_tl } } } - }% - }% - \CM@compareCs{CM@arg@ii}{@empty}{\Delta}{\CM@arg@ii}\CM@State@sub@left#2\CM@State@sub@right% - \CM@compareCs{CM@arg@i}{@empty}{^{\standardstate}}{^{\CM@arg@i}}}% -} - -% \setnewstate[<exp>,<Delta>,<subscript pos>]{<command>}{<letter>}{<unit>} -% \renewstate[<exp>,<Delta>,<subscript pos>]{<command>}{<letter>}{<unit>} -\newcommand*\CM@setnewstate[4][]{% - \CM@splitting{#1}{3}% [<exp>,<Delta>,<subscript pos>] - \CM@compareCs{CM@arg@i}{@empty}{\expandafter\let\csname CM@#2@supscript\endcsname\standardstate}{\expandafter\let\csname CM@#2@supscript\endcsname\CM@arg@i}% - \CM@compareCs{CM@arg@ii}{@empty}{\expandafter\let\csname CM@#2@delta\endcsname\Delta}{\expandafter\let\csname CM@#2@delta\endcsname\CM@arg@ii} - \CM@compareCs{CM@arg@iii}{@empty}{\@namedef{CM@#2@right}{left}}{\expandafter\let\csname CM@#2@right\endcsname\CM@arg@iii}% - \@namedef{#2}{\@ifnextchar[{\@nameuse{CM@#2@ii}}{\@nameuse{CM@#2@i}}}% - \@namedef{CM@#2@i}##1{\ensuremath{\State[\@nameuse{CM@#2@supscript},\@nameuse{CM@#2@delta},\@nameuse{CM@#2@right}]{#3}{}=\SI{##1}{#4}}}% - \@namedef{CM@#2@ii}[##1]##2{% - \CM@splitting{##1}{4}% [<index>,<exp>,<unit>,<subscript pos>] - \let\CM@State@index\CM@arg@i - \CM@compareCs{CM@arg@ii}{@empty}{\def\CM@State@supscript{\@nameuse{CM@#2@supscript}}}{\let\CM@State@supscript\CM@arg@ii}% - \CM@compareCs{CM@arg@iii}{@empty}{\def\CM@State@unit{#4}}{\let\CM@State@unit\CM@arg@iii}% - \CM@compareCs{CM@arg@iv}{@empty}{\def\CM@State@right{\@nameuse{CM@#2@right}}}{\let\CM@State@right\CM@arg@iv}% - \ensuremath{\State[\CM@State@supscript,\@nameuse{CM@#2@delta},\CM@State@right]{#3}{\CM@State@index} = \SI{##2}{\CM@State@unit}}% - }% -} -\newcommand*\setnewstate[4][]{% - \@ifundefined{#2}{\CM@setnewstate[#1]{#2}{#3}{#4}}{\PackageError{chemmacros}{\string\setnewstate: state #2 is already defined}{}}% -} -\newcommand*\renewstate[4][]{% - \@ifundefined{#2}{\PackageError{chemmacros}{\string\renewstate: state #2 is not defined}{}}{\CM@setnewstate[#1]{#2}{#3}{#4}}% -} -\setnewstate{Enthalpy}{H}{\kilo\joule\per\mole}% -\setnewstate[, ]{Entropy}{S}{\joule\per\kelvin\per\mole}% -\setnewstate{Gibbs}{G}{\kilo\joule\per\mole}% -} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% - p-orbitals ------------------------------------------------------------------------ % -\newcommand*\CM@porb[1][]{% - \CM@splitting{#1}{3}% - \CM@compareCs{CM@arg@i}{@empty}{\let\CM@orbital@height\CM@orb@height}{\def\CM@orbital@height{\CM@arg@i*\CM@orb@height}}% - \CM@compareCs{CM@arg@ii}{@empty}{\def\CM@orb@color{black}}{\let\CM@orb@color\CM@arg@ii}% - \CM@compareStr{\CM@orb@color}{white}{\def\CM@orb@color@draw{black}}{\let\CM@orb@color@draw\CM@orb@color}% - \CM@compareCs{CM@arg@iii}{@empty}{\def\CM@orb@ang{0}}{\let\CM@orb@ang\CM@arg@iii}% - \tikzpicture[overlay,rotate={\CM@orb@ang-90},opacity=.5,inner sep=0pt,outer sep=0pt,text height=0pt,text depth=0pt]% - \pgfsetfillopacity{.5}% - \CM@compareStr{\CM@orb@half}{false}{% - \draw[draw=black] (0,0) .. controls ++(-.9*\CM@orbital@height,-1.5*\CM@orbital@height) and ++(.9*\CM@orbital@height,-1.5*\CM@orbital@height) .. (0,0);% - }{}% - \draw[draw=\CM@orb@color@draw,fill=\CM@orb@color] (0,0) .. controls ++(-.9*\CM@orbital@height,1.5*\CM@orbital@height) and ++(.9*\CM@orbital@height,1.5*\CM@orbital@height) .. (0,0);% - \endtikzpicture% -} -% full orbital: -% \porb[<size factor>,<color>,<angle>] -\newcommand*\porb{\def\CM@orb@half{false}\CM@porb}% -% half of an orbital: -% \phorb[<size factor>,<color>,<angle>] -\newcommand*\phorb{\def\CM@orb@half{true}\CM@porb}% - -% predefined orbitals: -\newcommand*\pzorb{\porb[,,90]}% -\newcommand*\pyorb{\porb[,,0]}% -\newcommand*\pxorb{\porb[,,-135]}% - -% change orbital settings: -\newcommand*\CM@orb@height{1em}% -\newcommand*\setorbheight[1]{% - \ifx\@empty#1\@empty - \renewcommand*\CM@orb@height{1em}% - \else - \renewcommand*\CM@orb@height{#1}% - \fi -} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% - Newman projections ---------------------------------------------------------------- % + \group_end: + } +\cs_generate_variant:Nn \chemmacros_state:nnn { fnn,xnn } + +\bool_if:NF \l_chemmacros_version_one_bool + { + \NewDocumentCommand \State { s o m G{} } + { + \group_begin: + \IfBooleanT { #1 } + { + \keys_set:nn { chemmacros / state } + { subscript-left = false , exponent = } + } + \chemmacros_state:nnn { #2 } { #3 } { #4 } + \group_end: + } + } +\char_set_catcode_letter:N \@ + +% --------------------------------------------------------------------------- % +\tl_new:N \l_chemmacros_thermod_subscript_left_tl +\tl_new:N \l_chemmacros_thermod_subscript_left_default_tl +\tl_new:N \l_chemmacros_thermod_subscript_tl +\tl_new:N \l_chemmacros_thermod_subscript_default_tl + +\tl_new:N \l_chemmacros_thermod_unit_tl + +\tl_new:N \l_chemmacros_thermod_exponent_tl +\tl_new:N \l_chemmacros_thermod_exponent_default_tl +\tl_set:Nn \l_chemmacros_thermod_exponent_default_tl { \standardstate } + +\tl_new:N \l_chemmacros_thermod_delta_tl +\tl_new:N \l_chemmacros_thermod_delta_default_tl +\tl_set:Nn \l_chemmacros_thermod_delta_default_tl { \Delta } + +\bool_new:N \l_chemmacros_renewstate_bool + +\keys_define:nn { chemmacros } + { + State / subscript .choice: , + State / subscript / left .code:n = + { \tl_set:Nn \l_chemmacros_thermod_subscript_left_tl { true } } , + State / subscript / right .code:n = + { \tl_set:Nn \l_chemmacros_thermod_subscript_left_tl { false } } , + State / exponent .tl_set:N = + \l_chemmacros_thermod_exponent_tl , + State / delta .tl_set:N = + \l_chemmacros_thermod_delta_tl , + State / unit .tl_set:N = + \l_chemmacros_thermod_unit_tl , + setnewstate / subscript-left .tl_set:N = + \l_chemmacros_thermod_subscript_left_default_tl , + setnewstate / subscript .tl_set:N = + \l_chemmacros_thermod_subscript_default_tl , + setnewstate / exponent .tl_set:N = + \l_chemmacros_thermod_exponent_default_tl , + setnewstate / delta .tl_set:N = + \l_chemmacros_thermod_delta_default_tl + } + +% \setnewstate[<keyval>]{<name>}{<symbol>}{<unit>} +\bool_if:NF \l_chemmacros_version_one_bool + { + \cs_new:Npn \setnewstate + { + \bool_set_false:N \l_chemmacros_renewstate_bool + \chemmacros_setnewstate_reset: + \peek_meaning:NTF [ + { \setnewstate_aux_i:n } + { \setnewstate_aux_ii:nnn } + } +% \renewstate[<keyval>]{<name>}{<symbol>}{<unit>} + \cs_new:Npn \renewstate + { + \bool_set_true:N \l_chemmacros_renewstate_bool + \chemmacros_setnewstate_reset: + \peek_meaning:NTF [ + { \setnewstate_aux_i:n } + { \setnewstate_aux_ii:nnn } + } + } + +\cs_new_nopar:Npn \chemmacros_setnewstate_reset: + { + \tl_set:Nn \l_chemmacros_thermod_subscript_left_default_tl { true } + \tl_clear:N \l_chemmacros_thermod_subscript_default_tl + \tl_set:Nn \l_chemmacros_thermod_exponent_default_tl { \standardstate } + \tl_set:Nn \l_chemmacros_thermod_delta_default_tl { \Delta } + } + +\cs_new:Npn \setnewstate_aux_i:n [#1] + { + \keys_set:nn { chemmacros / setnewstate } { #1 } + \setnewstate_aux_ii:nnn + } + +\cs_new:Npn \setnewstate_aux_ii:nnn #1#2#3 + { + \bool_if:NTF \l_chemmacros_renewstate_bool + { + \cs_if_exist:cF { #1 } + { \msg_error:nnx { chemmacros } { renewstate } { #1 } } + \cs_undefine:c {chemmacros_ #1 _reset: } + \cs_undefine:c { l_chemmacros_ #1 _subscript_tl } + \cs_undefine:c { l_chemmacros_ #1 _exponent_tl } + \cs_undefine:c { l_chemmacros_ #1 _delta_tl } + \cs_undefine:c { l_chemmacros_ #1 _left_tl } + \cs_undefine:c { l_chemmacros_ #1 _unit_tl } + \cs_undefine:c { #1 } + \cs_undefine:c { #1 _aux_i:n } + \cs_undefine:c { #1 _aux_ii:n } + \cs_undefine:c { #1 _aux_iii:n } + } + { + \cs_if_exist:cT { #1 } + { \msg_error:nnx { chemmacros } { setnewstate } { #1 } } + } + \group_begin: + \exp_args:Nnf \tl_const:cn + { l_chemmacros_ #1 _subscript_tl } + { \tl_use:N \l_chemmacros_thermod_subscript_default_tl } + \exp_args:Nnf \tl_const:cn + { l_chemmacros_ #1 _exponent_tl } + { \tl_use:N \l_chemmacros_thermod_exponent_default_tl } + \exp_args:Nnf \tl_const:cn + { l_chemmacros_ #1 _delta_tl } + { \tl_use:N \l_chemmacros_thermod_delta_default_tl } + \exp_args:Nnf \tl_const:cn + { l_chemmacros_ #1 _left_tl } + { \tl_use:N \l_chemmacros_thermod_subscript_left_default_tl } + \tl_const:cn + { l_chemmacros_ #1 _unit_tl } + { #3 } + \cs_new_nopar:cpn {chemmacros_ #1 _reset: } + { + \tl_set_eq:Nc + \l_chemmacros_thermod_subscript_tl + { l_chemmacros_ #1 _subscript_tl } + \tl_set_eq:Nc + \l_chemmacros_thermod_exponent_tl + { l_chemmacros_ #1 _exponent_tl } + \tl_set_eq:Nc + \l_chemmacros_thermod_delta_tl + { l_chemmacros_ #1 _delta_tl } + \tl_set_eq:Nc + \l_chemmacros_thermod_subscript_left_tl + { l_chemmacros_ #1 _left_tl } + \tl_set_eq:Nc + \l_chemmacros_thermod_unit_tl + { l_chemmacros_ #1 _unit_tl } + } + \cs_new_nopar:cpn { #1 } + { + \use:c {chemmacros_ #1 _reset: } + \peek_meaning:NTF [ + { \tl_use:c { #1 _aux_i:n } } + { + \peek_meaning:NTF ( + { \tl_use:c { #1 _aux_ii:n } } + { \tl_use:c { #1 _aux_iii:n } } + } + } + \cs_new_nopar:cpn { #1 _aux_i:n } [##1] + { + \keys_set:nn { chemmacros / State } { ##1 } + \peek_meaning:NTF ( + { \tl_use:c { #1 _aux_ii:n } } + { \tl_use:c { #1 _aux_iii:n } } + } + \cs_new_nopar:cpn { #1 _aux_ii:n } (##1) + { + \tl_set:Nn \l_chemmacros_thermod_subscript_tl { ##1 } + \tl_use:c { #1 _aux_iii:n } + } + \cs_new_nopar:cpn { #1 _aux_iii:n } ##1 + { + \ensuremath + { + \exp_args:Nf \tl_if_eq:nnTF + { \tl_use:N \l_chemmacros_thermod_subscript_left_tl } { true } + { + \chemmacros_state:fnn + { + subscript-left = true , + exponent = + { \tl_use:N \l_chemmacros_thermod_exponent_tl } , + delta = + { \tl_use:N \l_chemmacros_thermod_delta_tl } + } + { #2 } + } + { + \chemmacros_state:fnn + { + subscript-left = false , + exponent = + { \tl_use:N \l_chemmacros_thermod_exponent_tl } , + delta = + { \tl_use:N \l_chemmacros_thermod_delta_tl } + } + { #2 } + } + { \tl_use:N \l_chemmacros_thermod_subscript_tl } + = + \exp_args:Nno \SI { ##1 } { \l_chemmacros_thermod_unit_tl } + } + } + \group_end: + } + +% predefined: +\bool_if:NF \l_chemmacros_version_one_bool + { + \setnewstate {Enthalpy} {H} {\kilo\joule\per\mole} + \setnewstate[delta=false,subscript-left=false] {Entropy} {S} {\joule\per\kelvin\per\mole} + \setnewstate {Gibbs} {G} {\kilo\joule\per\mole} + } + +% --------------------------------------------------------------------------- % +% Newman projections +\fp_new:N \l_chemmacros_newman_rel_angle_fp +\fp_zero:N \l_chemmacros_newman_rel_angle_fp +\fp_new:N \l_chemmacros_newman_tmp_angle_fp +\fp_new:N \l_chemmacros_newman_abs_angle_fp +\fp_zero:N \l_chemmacros_newman_abs_angle_fp + +\fp_new:N \l_chemmacros_newman_scale_fp +\fp_set:Nn \l_chemmacros_newman_scale_fp { 1 } + +\tl_new:N \l_chemmacros_newman_tikz_ring_tl +\tl_clear:N \l_chemmacros_newman_tikz_ring_tl + +\tl_new:N \l_chemmacros_newman_tikz_front_tl +\tl_clear:N \l_chemmacros_newman_tikz_front_tl + +\tl_new:N \l_chemmacros_newman_tikz_back_tl +\tl_clear:N \l_chemmacros_newman_tikz_back_tl + +\bool_new:N \l_chemmacros_newman_tikz_back_bool + +\fp_new:N \l_chemmacros_newman_x_fp +\fp_new:N \l_chemmacros_newman_y_fp + +\keys_define:nn { chemmacros / newman } + { + ring .tl_set:N = \l_chemmacros_newman_tikz_ring_tl , + atoms .tl_set:N = \l_chemmacros_newman_tikz_front_tl , + back-atoms .code:n = + { + \bool_set_true:N \l_chemmacros_newman_tikz_back_bool + \tl_set:Nn \l_chemmacros_newman_tikz_back_tl { #1 } + } , + scale .fp_set:N = \l_chemmacros_newman_scale_fp , + scale .default:n = 1 , + angle .fp_set:N = \l_chemmacros_newman_abs_angle_fp , + angle .default:n = 0 + } + +% old usage (v1.1): % \newman[<angle>,<scale>,<tikz ring>][<tikz (front) nodes>][<tikz back nodes>]{<1>,<2>,<3>,<4>,<5>,<6>} -\NewDocumentCommand\newman{ooom}{% - \IfNoValueTF{#1}{% - \def\CM@newman@angle{0}% - \def\CM@newman@scale{1}% - \def\CM@newman@tikz@ring{}% - }{% - \CM@splitting{#1}{3}% - \CM@compareCs{CM@arg@i}{@empty}{\def\CM@newman@angle{0}}{\let\CM@newman@angle\CM@arg@i}% - \CM@compareCs{CM@arg@ii}{@empty}{\def\CM@newman@scale{1}}{\let\CM@newman@scale\CM@arg@ii}% - \expandafter\def\expandafter\CM@newman@tikz@ring\expandafter{\CM@arg@iii}% - } - \IfNoValueTF{#2}{% - \let\CM@newman@tikz@one\@empty% - }{% - \def\CM@newman@tikz@one{#2}% - } - \IfNoValueTF{#3}{% - \let\CM@newman@tikz@two\CM@newman@tikz@one% - }{% - \def\CM@newman@tikz@two{#3}% - } - \CM@splitting{#4}{6}% - \edef\CM@newman@tikz{scale=\CM@newman@scale,CMatomFront/.style={inner sep=0,outer sep=0,\CM@newman@tikz@one},CMatomBack/.style={inner sep=0,outer sep=0,\CM@newman@tikz@two}} - \expandafter\tikz\expandafter[\CM@newman@tikz]{% - \expandafter\draw\expandafter[\CM@newman@tikz@ring] (0,0) circle (.5);% - \foreach\i in{30+\CM@newman@angle,150+\CM@newman@angle,270+\CM@newman@angle}{% - \expandafter\draw\expandafter[\CM@newman@tikz@ring] (\i:0.5) --++(\i:.5);% - }% - \node[CMatomBack,anchor=-150+\CM@newman@angle] at (30+\CM@newman@angle:1.05) {\CM@arg@v};% - \node[CMatomBack,anchor=-30+\CM@newman@angle] at (150+\CM@newman@angle:1.05) {\CM@arg@vi};% - \node[CMatomBack,anchor=90+\CM@newman@angle] at (270+\CM@newman@angle:1.05) {\CM@arg@iv};% - \foreach\i in{90,210,330}{% - \expandafter\draw\expandafter[\CM@newman@tikz@ring] (0,0) --++(\i:1);% - }% - \node[CMatomFront,anchor=-90] at (90:1.05) {\CM@arg@i};% - \node[CMatomFront,anchor=30] at (210:1.05) {\CM@arg@ii};% - \node[CMatomFront,anchor=150] at (330:1.05) {\CM@arg@iii};% - }% -} -\endinput -% - Version history: ------------------------------------------------------------------ % -% 2011/05/15 version 1.0 CTAN release % -% 2011/06/22 version 1.1 "LaTeXified" whole package for safer usage % -% less user work required (like loading package after another) % -% more particle macros % -% latin phrases % -% extra units % -% acid/base commands % -% \mech % -% \NMR % -% \mhName, \setmhName, \newreaction, phases % -% \renewstate, \setstatesubscript % -% improved orbitals % -% simpler package options, option german, bpchem % -% bug fixes %
\ No newline at end of file +% new usage (v1.2): +% \newman[<keyval>](<angle>){<1>,<2>,<3>,<4>,<5>,<6>} +\bool_if:NF \l_chemmacros_version_one_bool + { + \NewDocumentCommand \newman { o d() > { \SplitArgument { 5 } { , } } m } + { + \group_begin: + \IfNoValueF { #1 } { \keys_set:nn { chemmacros / newman } { #1 } } + \IfNoValueTF { #2 } + { \fp_set_eq:NN \l_chemmacros_newman_rel_angle_fp \l_chemmacros_newman_abs_angle_fp } + { \fp_set:Nn \l_chemmacros_newman_rel_angle_fp { #2 } } + \chemmacros_newman_atoms:nnnnnn #3 + \group_end: + } + } + +% place atoms: +\cs_new:Npn \chemmacros_newman_atoms:nnnnnn #1#2#3#4#5#6 + { + \chemmacros_tikz_picture:xn + { + scale = \fp_to_tl:N \l_chemmacros_newman_scale_fp , + chemmacros_newman_atom_front / .style = + { + inner~sep=0, + outer~sep=0, + \tl_use:N \l_chemmacros_newman_tikz_front_tl + }, + chemmacros_newman_atom_back / .style = + { + inner~sep=0, + outer~sep=0, + \bool_if:NTF \l_chemmacros_newman_tikz_back_bool + { \tl_use:N \l_chemmacros_newman_tikz_back_tl } + { \tl_use:N \l_chemmacros_newman_tikz_front_tl } + } + } + { + \chemmacros_tikz_draw:f + { \tl_use:N \l_chemmacros_newman_tikz_ring_tl } + (0,0) circle (\fp_to_dim:N \l_chemmacros_newman_scale_fp * 15) ; + \chemmacros_newman_back_node:nf + { 30 } + { \IfNoValueF { #5 } { #5 } } + \chemmacros_newman_back_node:nf + { 150 } + { \IfNoValueF { #6 } { #6 } } + \chemmacros_newman_back_node:nf + { 270 } + { \IfNoValueF { #4 } { #4 } } + \chemmacros_newman_front_node:nf + { 90 } + { \IfNoValueF { #1 } { #1 } } + \chemmacros_newman_front_node:nf + { 210 } + { \IfNoValueF { #2 } { #2 } } + \chemmacros_newman_front_node:nf + { 330 } + { \IfNoValueF { #3 } { #3 } } + } + } + +% provide cartesian coordiantes from polar coordinates +% #1: angle pi #2: radius +\cs_new_nopar:Npn \chemmacros_newman_coordinates:nn #1#2 + { + \fp_set:Nn \l_chemmacros_newman_tmp_angle_fp { #1 } + \fp_div:Nn \l_chemmacros_newman_tmp_angle_fp { 180 } + \fp_mul:Nn \l_chemmacros_newman_tmp_angle_fp { \fp_use:N \c_pi_fp } + \fp_zero:N \l_chemmacros_newman_x_fp + \fp_zero:N \l_chemmacros_newman_y_fp + \fp_cos:Nn \l_chemmacros_newman_x_fp { \fp_use:N \l_chemmacros_newman_tmp_angle_fp } + \fp_sin:Nn \l_chemmacros_newman_y_fp { \fp_use:N \l_chemmacros_newman_tmp_angle_fp } + \fp_mul:Nn \l_chemmacros_newman_x_fp { \fp_use:N #2 } + \fp_mul:Nn \l_chemmacros_newman_y_fp { \fp_use:N #2 } + } +\cs_generate_variant:Nn \chemmacros_newman_coordinates:nn { on } + +% place back nodes +\cs_new:Npn \chemmacros_newman_back_node:nn #1#2 + { + \group_begin: + \fp_add:Nn \l_chemmacros_newman_rel_angle_fp { #1 } + \chemmacros_newman_coordinates:on + { \fp_to_int:N \l_chemmacros_newman_rel_angle_fp } + { \l_chemmacros_newman_scale_fp } + \chemmacros_tikz_draw:f + { \tl_use:N \l_chemmacros_newman_tikz_ring_tl } + ( 15 * \fp_to_dim:N \l_chemmacros_newman_x_fp , 15 * \fp_to_dim:N \l_chemmacros_newman_y_fp ) + -- + ( 30 * \fp_to_dim:N \l_chemmacros_newman_x_fp , 30 * \fp_to_dim:N \l_chemmacros_newman_y_fp ) ; + \chemmacros_newman_coordinates:on + { \fp_to_int:N \l_chemmacros_newman_rel_angle_fp } + { \l_chemmacros_newman_scale_fp } + \chemmacros_tikz_node:f + { + chemmacros_newman_atom_back, + anchor = -180 + \fp_to_int:N \l_chemmacros_newman_rel_angle_fp + } + at ( 31 * \fp_to_dim:N \l_chemmacros_newman_x_fp , 31 * \fp_to_dim:N \l_chemmacros_newman_y_fp ) + { #2 } ; + \group_end: + } +\cs_generate_variant:Nn \chemmacros_newman_back_node:nn { nf } + +% place front nodes: +\cs_new:Npn \chemmacros_newman_front_node:nn #1#2 + { + \chemmacros_newman_coordinates:nn { #1 } { \l_chemmacros_newman_scale_fp } + \chemmacros_tikz_draw:f + { \tl_use:N \l_chemmacros_newman_tikz_ring_tl } + (0,0) -- ++ ( 30 * \fp_to_dim:N \l_chemmacros_newman_x_fp , 30 * \fp_to_dim:N \l_chemmacros_newman_y_fp ) ; + \chemmacros_newman_coordinates:nn { #1 } { \l_chemmacros_newman_scale_fp } + \chemmacros_tikz_node:f + { chemmacros_newman_atom_front, anchor = -180 + #1 } + at ( 31 * \fp_to_dim:N \l_chemmacros_newman_x_fp , 31 * \fp_to_dim:N \l_chemmacros_newman_y_fp ) + { #2 } ; + } +\cs_generate_variant:Nn \chemmacros_newman_front_node:nn { nf } + +% --------------------------------------------------------------------------- % +% \orbital[<keyval>]{<type>} +% variables: +\bool_new:N \l_chemmacros_orbital_type_s_bool +\bool_new:N \l_chemmacros_orbital_type_p_bool +\bool_new:N \l_chemmacros_orbital_type_sp_bool +\bool_new:N \l_chemmacros_orbital_type_sptwo_bool +\bool_new:N \l_chemmacros_orbital_type_spthree_bool + +\tl_new:N \l_chemmacros_orbital_s_color_tl +\tl_set:Nn \l_chemmacros_orbital_s_color_tl { black } +\tl_new:N \l_chemmacros_orbital_s_phase_color_tl + +\tl_new:N \l_chemmacros_orbital_p_color_tl +\tl_set:Nn \l_chemmacros_orbital_p_color_tl { black } +\tl_new:N \l_chemmacros_orbital_p_pphase_color_tl +\tl_new:N \l_chemmacros_orbital_p_mphase_color_tl + +\tl_new:N \l_chemmacros_orbital_sp_color_tl +\tl_set:Nn \l_chemmacros_orbital_sp_color_tl { black } +\tl_new:N \l_chemmacros_orbital_sp_pphase_color_tl +\tl_new:N \l_chemmacros_orbital_sp_mphase_color_tl + +\tl_new:N \l_chemmacros_orbital_sptwo_color_tl +\tl_set:Nn \l_chemmacros_orbital_sptwo_color_tl { black } +\tl_new:N \l_chemmacros_orbital_sptwo_pphase_color_tl +\tl_new:N \l_chemmacros_orbital_sptwo_mphase_color_tl + +\tl_new:N \l_chemmacros_orbital_spthree_color_tl +\tl_set:Nn \l_chemmacros_orbital_spthree_color_tl { black } +\tl_new:N \l_chemmacros_orbital_spthree_pphase_color_tl +\tl_new:N \l_chemmacros_orbital_spthree_mphase_color_tl + +\bool_new:N \l_chemmacros_orbital_s_phase_bool +\bool_set_true:N \l_chemmacros_orbital_s_phase_bool + +\bool_new:N \l_chemmacros_orbital_p_phase_bool +\bool_set_true:N \l_chemmacros_orbital_p_phase_bool + +\bool_new:N \l_chemmacros_orbital_sp_phase_bool +\bool_set_true:N \l_chemmacros_orbital_sp_phase_bool + +\bool_new:N \l_chemmacros_orbital_sptwo_phase_bool +\bool_set_true:N \l_chemmacros_orbital_sptwo_phase_bool + +\bool_new:N \l_chemmacros_orbital_spthree_phase_bool +\bool_set_true:N \l_chemmacros_orbital_spthree_phase_bool + +\tl_new:N \l_chemmacros_orbital_s_scale_tl +\tl_set:Nn \l_chemmacros_orbital_s_scale_tl { 1 } + +\tl_new:N \l_chemmacros_orbital_p_scale_tl +\tl_set:Nn \l_chemmacros_orbital_p_scale_tl { 1 } + +\tl_new:N \l_chemmacros_orbital_sp_scale_tl +\tl_set:Nn \l_chemmacros_orbital_sp_scale_tl { 1 } + +\tl_new:N \l_chemmacros_orbital_sptwo_scale_tl +\tl_set:Nn \l_chemmacros_orbital_sptwo_scale_tl { 1 } + +\tl_new:N \l_chemmacros_orbital_spthree_scale_tl +\tl_set:Nn \l_chemmacros_orbital_spthree_scale_tl { 1 } + +\fp_new:N \l_chemmacros_orbital_angle_fp +\fp_set:Nn \l_chemmacros_orbital_angle_fp { 90 } + +\bool_new:N \l_chemmacros_orbital_p_half_bool +\bool_set_false:N \l_chemmacros_orbital_p_half_bool + +\bool_new:N \l_chemmacros_orbital_overlay_bool +\bool_set_false:N \l_chemmacros_orbital_overlay_bool + +\bool_new:N \l_chemmacros_orbital_opacity_bool +\bool_set_false:N \l_chemmacros_opacity_overlay_bool + +\fp_new:N \l_chemmacros_orbital_opacity_fp +\fp_set:Nn \l_chemmacros_orbital_opacity_fp { 0.5 } + +\cs_new_nopar:Npn \chemmacros_orbital_options: + { + \chemmacros_orbital_overlay: , \chemmacros_orbital_opacity: , + inner~sep=0 , outer~sep=0 , line~width=.2pt , + rotate = { \fp_use:N \l_chemmacros_orbital_angle_fp - 90 } , + baseline , + minimum~size = 0 + } + +\cs_new_nopar:Npn \chemmacros_orbital_overlay: + { + \bool_if:NT \l_chemmacros_orbital_overlay_bool { overlay } + } + +\cs_new_nopar:Npn \chemmacros_orbital_opacity: + { + \bool_if:NT \l_chemmacros_orbital_opacity_bool + { opacity = { \fp_use:N \l_chemmacros_orbital_opacity_fp } } + } + +% --------------------------------------------------------------------------- % +% s-orbitals +\cs_new_nopar:Npn \chemmacros_orbital_type_s: + { + \bool_set_true:N \l_chemmacros_orbital_type_s_bool + \bool_set_false:N \l_chemmacros_orbital_type_p_bool + \bool_set_false:N \l_chemmacros_orbital_type_sp_bool + \bool_set_false:N \l_chemmacros_orbital_type_sptwo_bool + \bool_set_false:N \l_chemmacros_orbital_type_spthree_bool + } + +\keys_define:nn { chemmacros / orbital / s } + { + phase .choice: , + phase / + .code:n = { \bool_set_true:N \l_chemmacros_orbital_s_phase_bool } , + phase / - .code:n = { \bool_set_false:N \l_chemmacros_orbital_s_phase_bool } , + phase .default:n = + , + scale .tl_set:N = \l_chemmacros_orbital_s_scale_tl , + color .tl_set:N = \l_chemmacros_orbital_s_color_tl + } + +\cs_new_nopar:Npn \chemmacros_orbital_s_draw:n #1 + { + \IfNoValueF { #1 } { \keys_set:nn { chemmacros / orbital / s } { #1 } } + \bool_if:NTF \l_chemmacros_orbital_s_phase_bool + { + \tl_if_in:NnTF \l_chemmacros_orbital_s_color_tl { ! } + { + \tl_set:Nn \l_chemmacros_orbital_s_phase_color_tl + { \tl_use:N \l_chemmacros_orbital_s_color_tl } + } + { + \tl_set:Nn \l_chemmacros_orbital_s_phase_color_tl + { \tl_use:N \l_chemmacros_orbital_s_color_tl ! 90 } + } + } + { + \tl_set:Nn \l_chemmacros_orbital_s_phase_color_tl + { black ! 5 } + } + \chemmacros_tikz_picture:xn{ \chemmacros_orbital_options: } + { + \chemmacros_tikz_shade:f { ball~color = \l_chemmacros_orbital_s_phase_color_tl } + (0,0) circle (\l_chemmacros_orbital_s_scale_tl * .6em) ; + } + } + +% --------------------------------------------------------------------------- % +% p-orbitals +\cs_new_nopar:Npn \chemmacros_orbital_type_p: + { + \bool_set_false:N \l_chemmacros_orbital_type_s_bool + \bool_set_true:N \l_chemmacros_orbital_type_p_bool + \bool_set_false:N \l_chemmacros_orbital_type_sp_bool + \bool_set_false:N \l_chemmacros_orbital_type_sptwo_bool + \bool_set_false:N \l_chemmacros_orbital_type_spthree_bool + } + +\keys_define:nn { chemmacros / orbital / p } + { + phase .choice: , + phase / + .code:n = { \bool_set_true:N \l_chemmacros_orbital_p_phase_bool } , + phase / - .code:n = { \bool_set_false:N \l_chemmacros_orbital_p_phase_bool } , + scale .tl_set:N = \l_chemmacros_orbital_p_scale_tl , + angle .fp_set:N = \l_chemmacros_orbital_angle_fp , + color .tl_set:N = \l_chemmacros_orbital_p_color_tl , + half .bool_set:N = \l_chemmacros_orbital_p_half_bool , + half .default:n = true + } + +\cs_new_nopar:Npn \chemmacros_orbital_p_draw:n #1 + { + \IfNoValueF { #1 } { \keys_set:nn { chemmacros / orbital / p } { #1 } } + \bool_if:NTF \l_chemmacros_orbital_p_phase_bool + { + \tl_if_in:NnTF \l_chemmacros_orbital_p_color_tl { ! } + { + \tl_set:Nn \l_chemmacros_orbital_p_pphase_color_tl + { \tl_use:N \l_chemmacros_orbital_p_color_tl } + } + { + \tl_set:Nn \l_chemmacros_orbital_p_pphase_color_tl + { \tl_use:N \l_chemmacros_orbital_p_color_tl ! 90 } + } + \tl_set:Nn \l_chemmacros_orbital_p_mphase_color_tl + { black ! 5 } + + } + { + \tl_if_in:NnTF \l_chemmacros_orbital_p_color_tl { ! } + { + \tl_set:Nn \l_chemmacros_orbital_p_mphase_color_tl + { \tl_use:N \l_chemmacros_orbital_p_color_tl } + } + { + \tl_set:Nn \l_chemmacros_orbital_p_mphase_color_tl + { \tl_use:N \l_chemmacros_orbital_p_color_tl ! 90 } + } + \tl_set:Nn \l_chemmacros_orbital_p_pphase_color_tl + { black ! 5 } + } + \chemmacros_tikz_picture:xn { \chemmacros_orbital_options: } + { + \chemmacros_tikz_shadedraw:f { draw = \l_chemmacros_orbital_p_pphase_color_tl , ball~color = \l_chemmacros_orbital_p_pphase_color_tl } + (0,0) .. controls + ++(- \l_chemmacros_orbital_p_scale_tl * 2em,\l_chemmacros_orbital_p_scale_tl * 2em) and + ++(\l_chemmacros_orbital_p_scale_tl * 2em,\l_chemmacros_orbital_p_scale_tl * 2em) + .. (0,0); + \bool_if:NF \l_chemmacros_orbital_p_half_bool + { + \chemmacros_tikz_shadedraw:f { draw = \l_chemmacros_orbital_p_mphase_color_tl , ball~color = \l_chemmacros_orbital_p_mphase_color_tl } + (0,0) .. controls + ++(- \l_chemmacros_orbital_p_scale_tl * 2em,- \l_chemmacros_orbital_p_scale_tl * 2em) and + ++(\l_chemmacros_orbital_p_scale_tl * 2em,- \l_chemmacros_orbital_p_scale_tl * 2em) + .. (0,0); + } + } + } + +% --------------------------------------------------------------------------- % +% sp-orbitals +\cs_new_nopar:Npn \chemmacros_orbital_type_sp: + { + \bool_set_false:N \l_chemmacros_orbital_type_s_bool + \bool_set_false:N \l_chemmacros_orbital_type_p_bool + \bool_set_true:N \l_chemmacros_orbital_type_sp_bool + \bool_set_false:N \l_chemmacros_orbital_type_sptwo_bool + \bool_set_false:N \l_chemmacros_orbital_type_spthree_bool + } + +\keys_define:nn { chemmacros / orbital / sp } + { + phase .choice: , + phase / + .code:n = { \bool_set_true:N \l_chemmacros_orbital_sp_phase_bool } , + phase / - .code:n = { \bool_set_false:N \l_chemmacros_orbital_sp_phase_bool } , + scale .tl_set:N = \l_chemmacros_orbital_sp_scale_tl , + angle .fp_set:N = \l_chemmacros_orbital_angle_fp , + color .tl_set:N = \l_chemmacros_orbital_sp_color_tl + } + +\cs_new_nopar:Npn \chemmacros_orbital_sp_draw:n #1 + { + \IfNoValueF { #1 } { \keys_set:nn { chemmacros / orbital / sp } { #1 } } + \bool_if:NTF \l_chemmacros_orbital_sp_phase_bool + { + \tl_if_in:NnTF \l_chemmacros_orbital_sp_color_tl { ! } + { + \tl_set:Nn \l_chemmacros_orbital_sp_pphase_color_tl + { \tl_use:N \l_chemmacros_orbital_sp_color_tl } + } + { + \tl_set:Nn \l_chemmacros_orbital_sp_pphase_color_tl + { \tl_use:N \l_chemmacros_orbital_sp_color_tl ! 90 } + } + \tl_set:Nn \l_chemmacros_orbital_sp_mphase_color_tl + { black ! 5 } + + } + { + \tl_if_in:NnTF \l_chemmacros_orbital_sp_color_tl { ! } + { + \tl_set:Nn \l_chemmacros_orbital_sp_mphase_color_tl + { \tl_use:N \l_chemmacros_orbital_sp_color_tl } + } + { + \tl_set:Nn \l_chemmacros_orbital_sp_mphase_color_tl + { \tl_use:N \l_chemmacros_orbital_sp_color_tl ! 90 } + } + \tl_set:Nn \l_chemmacros_orbital_sp_pphase_color_tl + { black ! 5 } + } + \chemmacros_tikz_picture:xn { \chemmacros_orbital_options: } + { + \chemmacros_tikz_shadedraw:f { draw = \l_chemmacros_orbital_sp_pphase_color_tl , ball~color = \l_chemmacros_orbital_sp_pphase_color_tl } + (0,0) .. controls + ++(- \l_chemmacros_orbital_sp_scale_tl * 2em,\l_chemmacros_orbital_sp_scale_tl * 2em) and + ++(\l_chemmacros_orbital_sp_scale_tl * 2em,\l_chemmacros_orbital_sp_scale_tl * 2em) + .. (0,0); + \chemmacros_tikz_shadedraw:f { draw = \l_chemmacros_orbital_sp_mphase_color_tl , ball~color = \l_chemmacros_orbital_sp_mphase_color_tl } + (0,0) .. controls + ++(- \l_chemmacros_orbital_sp_scale_tl * .6em,- \l_chemmacros_orbital_sp_scale_tl * .6em) and + ++(\l_chemmacros_orbital_sp_scale_tl * .6em,- \l_chemmacros_orbital_sp_scale_tl * .6em) + .. (0,0); + } + } + +% --------------------------------------------------------------------------- % +% sp2-orbitals +\cs_new_nopar:Npn \chemmacros_orbital_type_sptwo: + { + \bool_set_false:N \l_chemmacros_orbital_type_s_bool + \bool_set_false:N \l_chemmacros_orbital_type_p_bool + \bool_set_false:N \l_chemmacros_orbital_type_sp_bool + \bool_set_true:N \l_chemmacros_orbital_type_sptwo_bool + \bool_set_false:N \l_chemmacros_orbital_type_spthree_bool + } + +\keys_define:nn { chemmacros / orbital / sp2 } + { + phase .choice: , + phase / + .code:n = { \bool_set_true:N \l_chemmacros_orbital_sptwo_phase_bool } , + phase / - .code:n = { \bool_set_false:N \l_chemmacros_orbital_sptwo_phase_bool } , + scale .tl_set:N = \l_chemmacros_orbital_sptwo_scale_tl , + angle .fp_set:N = \l_chemmacros_orbital_angle_fp , + color .tl_set:N = \l_chemmacros_orbital_sptwo_color_tl + } + +\cs_new_nopar:Npn \chemmacros_orbital_sptwo_draw:n #1 + { + \IfNoValueF { #1 } { \keys_set:nn { chemmacros / orbital / sp2 } { #1 } } + \bool_if:NTF \l_chemmacros_orbital_sptwo_phase_bool + { + \tl_if_in:NnTF \l_chemmacros_orbital_sptwo_color_tl { ! } + { + \tl_set:Nn \l_chemmacros_orbital_sptwo_pphase_color_tl + { \tl_use:N \l_chemmacros_orbital_sptwo_color_tl } + } + { + \tl_set:Nn \l_chemmacros_orbital_sptwo_pphase_color_tl + { \tl_use:N \l_chemmacros_orbital_sptwo_color_tl ! 90 } + } + \tl_set:Nn \l_chemmacros_orbital_sptwo_mphase_color_tl + { black ! 5 } + + } + { + \tl_if_in:NnTF \l_chemmacros_orbital_sptwo_color_tl { ! } + { + \tl_set:Nn \l_chemmacros_orbital_sptwo_mphase_color_tl + { \tl_use:N \l_chemmacros_orbital_sptwo_color_tl } + } + { + \tl_set:Nn \l_chemmacros_orbital_sptwo_mphase_color_tl + { \tl_use:N \l_chemmacros_orbital_sptwo_color_tl ! 90 } + } + \tl_set:Nn \l_chemmacros_orbital_sptwo_pphase_color_tl + { black ! 5 } + } + \chemmacros_tikz_picture:xn { \chemmacros_orbital_options: } + { + \chemmacros_tikz_shadedraw:f { draw = \l_chemmacros_orbital_sptwo_pphase_color_tl , ball~color = \l_chemmacros_orbital_sptwo_pphase_color_tl } + (0,0) .. controls + ++(- \l_chemmacros_orbital_sptwo_scale_tl * 2em,\l_chemmacros_orbital_sptwo_scale_tl * 2em) and + ++(\l_chemmacros_orbital_sptwo_scale_tl * 2em,\l_chemmacros_orbital_sptwo_scale_tl * 2em) + .. (0,0); + \chemmacros_tikz_shadedraw:f { draw = \l_chemmacros_orbital_sptwo_mphase_color_tl , ball~color = \l_chemmacros_orbital_sptwo_mphase_color_tl } + (0,0) .. controls + ++(- \l_chemmacros_orbital_sptwo_scale_tl * .8em,- \l_chemmacros_orbital_sptwo_scale_tl * .8em) and + ++(\l_chemmacros_orbital_sptwo_scale_tl * .8em,- \l_chemmacros_orbital_sptwo_scale_tl * .8em) + .. (0,0); + } + } + +% --------------------------------------------------------------------------- % +% sp3-orbitals +\cs_new_nopar:Npn \chemmacros_orbital_type_spthree: + { + \bool_set_false:N \l_chemmacros_orbital_type_s_bool + \bool_set_false:N \l_chemmacros_orbital_type_p_bool + \bool_set_false:N \l_chemmacros_orbital_type_sp_bool + \bool_set_false:N \l_chemmacros_orbital_type_sptwo_bool + \bool_set_true:N \l_chemmacros_orbital_type_spthree_bool + } + +\keys_define:nn { chemmacros / orbital / sp3 } + { + phase .choice: , + phase / + .code:n = { \bool_set_true:N \l_chemmacros_orbital_spthree_phase_bool } , + phase / - .code:n = { \bool_set_false:N \l_chemmacros_orbital_spthree_phase_bool } , + scale .tl_set:N = \l_chemmacros_orbital_spthree_scale_tl , + angle .fp_set:N = \l_chemmacros_orbital_angle_fp , + color .tl_set:N = \l_chemmacros_orbital_spthree_color_tl + } + +\cs_new_nopar:Npn \chemmacros_orbital_spthree_draw:n #1 + { + \IfNoValueF { #1 } { \keys_set:nn { chemmacros / orbital / sp3 } { #1 } } + \bool_if:NTF \l_chemmacros_orbital_spthree_phase_bool + { + \tl_if_in:NnTF \l_chemmacros_orbital_spthree_color_tl { ! } + { + \tl_set:Nn \l_chemmacros_orbital_spthree_pphase_color_tl + { \tl_use:N \l_chemmacros_orbital_spthree_color_tl } + } + { + \tl_set:Nn \l_chemmacros_orbital_spthree_pphase_color_tl + { \tl_use:N \l_chemmacros_orbital_spthree_color_tl ! 90 } + } + \tl_set:Nn \l_chemmacros_orbital_spthree_mphase_color_tl + { black ! 5 } + + } + { + \tl_if_in:NnTF \l_chemmacros_orbital_spthree_color_tl { ! } + { + \tl_set:Nn \l_chemmacros_orbital_spthree_mphase_color_tl + { \tl_use:N \l_chemmacros_orbital_spthree_color_tl } + } + { + \tl_set:Nn \l_chemmacros_orbital_spthree_mphase_color_tl + { \tl_use:N \l_chemmacros_orbital_spthree_color_tl ! 90 } + } + \tl_set:Nn \l_chemmacros_orbital_spthree_pphase_color_tl + { black ! 5 } + } + \chemmacros_tikz_picture:xn { \chemmacros_orbital_options: } + { + \chemmacros_tikz_shadedraw:f { draw = \l_chemmacros_orbital_spthree_pphase_color_tl , ball~color = \l_chemmacros_orbital_spthree_pphase_color_tl } + (0,0) .. controls + ++(- \l_chemmacros_orbital_spthree_scale_tl * 2em,\l_chemmacros_orbital_spthree_scale_tl * 2em) and + ++(\l_chemmacros_orbital_spthree_scale_tl * 2em,\l_chemmacros_orbital_spthree_scale_tl * 2em) + .. (0,0); + \chemmacros_tikz_shadedraw:f { draw = \l_chemmacros_orbital_spthree_mphase_color_tl , ball~color = \l_chemmacros_orbital_spthree_mphase_color_tl } + (0,0) .. controls + ++(- \l_chemmacros_orbital_spthree_scale_tl * 1em,- \l_chemmacros_orbital_spthree_scale_tl * 1em) and + ++(\l_chemmacros_orbital_spthree_scale_tl * 1em,- \l_chemmacros_orbital_spthree_scale_tl * 1em) + .. (0,0); + } + } + +% --------------------------------------------------------------------------- % +% main command +\keys_define:nn { chemmacros / orbital } + { + overlay .bool_set:N = \l_chemmacros_orbital_overlay_bool , + overlay .default:n = true , + opacity .code:n = + { + \fp_compare:nTF { #1 = 1 } + { \bool_set_false:N \l_chemmacros_orbital_opacity_bool } + { \bool_set_true:N \l_chemmacros_orbital_opacity_bool } + \fp_set:Nn \l_chemmacros_orbital_opacity_fp { #1 } + } + } + +\keys_define:nn { chemmacros / orbital / type } + { + s .code:n = { \chemmacros_orbital_type_s: } , + p .code:n = { \chemmacros_orbital_type_p: } , + sp .code:n = { \chemmacros_orbital_type_sp: } , + sp2 .code:n = { \chemmacros_orbital_type_sptwo: } , + sp3 .code:n = { \chemmacros_orbital_type_spthree: } + } + +\NewDocumentCommand \orbital { o m } + { + \group_begin: + \keys_set:nn { chemmacros / orbital / type } { #2 } + \bool_if:NT \l_chemmacros_orbital_type_s_bool + { \chemmacros_orbital_s_draw:n { #1 } } + \bool_if:NT \l_chemmacros_orbital_type_p_bool + { \chemmacros_orbital_p_draw:n { #1 } } + \bool_if:NT \l_chemmacros_orbital_type_sp_bool + { \chemmacros_orbital_sp_draw:n { #1 } } + \bool_if:NT \l_chemmacros_orbital_type_sptwo_bool + { \chemmacros_orbital_sptwo_draw:n { #1 } } + \bool_if:NT \l_chemmacros_orbital_type_spthree_bool + { \chemmacros_orbital_spthree_draw:n { #1 } } + \group_end: + } + +% --------------------------------------------------------------------------- % +% setup +\NewDocumentCommand \chemsetup { o m } + { + \IfNoValueTF { #1 } + { \keys_set:nn { chemmacros } { #2 } } + { \keys_set:nn { chemmacros / #1 } { #2 } } +% \tex_unskip:D + } + +% --------------------------------------------------------------------------- % +% load old definitions: +\bool_if:NT \l_chemmacros_version_one_bool + { + \input { chemmacros-version1 . cfg } + } + +\tex_endinput:D + +% --------------------------------------------------------------------------- % +Version history +2011/05/15 version 1.0 - CTAN release +2011/06/22 version 1.1 - "LaTeXified" whole package for safer usage + - less user work required (like loading package after + another) + - more particle macros + - latin phrases + - extra units + - acid/base commands + - \mech + - \NMR + - \mhName, \setmhName, \newreaction, phases + - \renewstate, \setstatesubscript + - improved orbitals + - simpler package options, option german, bpchem + - bug fixes +2011/10/28 version 2.0 - rewritten in expl3 + - customization via \chemsetup + - new commands \p, \fplus, \fminus, \fpch, \fmch, \fscrp, + \fsrcm, \fdelp, \fdelm, \orbital, \chemsetup + - various commands have a new syntax + - removed: \setmhName, \setredoxdist, \setstatesubscript, + \porb, \phorb, \pxorb, \pyorb, \pzorb, \setorbheight, + \solid, \liquid + - reaction environments work with hyperref and varioref +% --------------------------------------------------------------------------- %
\ No newline at end of file |