%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % ------------------------------------------------------------------------------------- % % - myChemistry - mychemistry_en.tex -------------------------------------------------- % % - Create reaction schemes with LaTeX and ChemFig ------------------------------------ % % ------------------------------------------------------------------------------------- % % - Clemens Niederberger -------------------------------------------------------------- % % - 2011/04/27 ------------------------------------------------------------------------ % % ------------------------------------------------------------------------------------- % % - http://www.niederberger-berlin.net/2011/02/latex-mychemistry/ --------------------- % % - kontakt@niederberger-berlin.net --------------------------------------------------- % % ------------------------------------------------------------------------------------- % % - 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 mychemistry.sty, mychemistry_de.tex, - % % - mychemistry_en.tex, examples.tex - % % ------------------------------------------------------------------------------------- % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \documentclass[DIV10,titlepage,toc=index]{scrartcl} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % - Pakete ---------------------------------------------------------------------------- % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{etoolbox} \usepackage{scrhack} % verbessert KOMAs Zusammenspiel mit floats \usepackage{emerald} % Schriftarten \usepackage[utf8]{inputenx} % Zeichenkodierung: Eingabe \usepackage[T1]{fontenc} % Text-Ausgabe-Codierung \usepackage{textcomp,mathcomp} \usepackage[makeindex]{splitidx} % Index; Kompilieren: makeindex -sl index.ist *.idx \usepackage[english]{babel} % Sprache \usepackage{xspace,paralist} % xspace und Listen \usepackage{siunitx,booktabs} \DeclareSIUnit{\emlength}{em} \DeclareSIUnit{\pt}{pt} \sisetup{separate-uncertainty = true, exponent-product = \cdot, per-mode = symbol} \usepackage{listings,fancyvrb} % wortwörtliche Anzeige \newcommand{\vitem}[1][]{\SaveVerb[aftersave={\item[\textnormal{\UseVerb[#1]{vsave}}]}]{vsave}} \usepackage[perpage,multiple]{footmisc} % Fußnoten \usepackage[ngerman]{varioref} % flexibles Referenzieren \labelformat{section}{section #1} \labelformat{subsection}{section #1} \labelformat{subsubsection}{section #1} \labelformat{table}{table #1} \usepackage[dvipsnames]{xcolor} % Farbe \colorlet{code}{RawSienna} \xdefinecolor{MyDarkRed}{rgb}{0.4392,0.0627,0.0627} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % - Anzeige des Inhaltsverzeichnisses ------------------------------------------------- % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{titletoc} \titlecontents{section} [6.5pc] % SECTION-ANZEIGE {\renewcommand\familydefault{ppl}\addvspace{2pc}\bfseries \color{MyDarkRed}\titlerule[2pt]\filright\normalcolor\nobreak} % davor {\contentslabel [\textsc{Section}\ \thecontentslabel]{6.5pc}} % nummerierter Eintrag {\hspace{-6.5pc}\scshape\thecontentslabel} % unnummerierter Eintrag {\hfill\contentspage} [\addvspace{3pt}\renewcommand\familydefault{ppl}] % danach %% \newcommand{\xquad}{\hspace{1em plus.4em minus.4em}} \titlecontents*{subsubsection}[6pc] % SUBSUBSECTION-ANZEIGE {\footnotesize\itshape} {} {} {,~\thecontentspage} [\xquad\textbullet\xquad] {} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % - Hyperlinks ------------------------------------------------------------------------ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{hyperref} \hypersetup{colorlinks=true, % Setup der Hyperlinks und des pdf linkcolor=MyDarkRed!20!red, urlcolor=blue!70, plainpages=false, bookmarksopen=true, bookmarksopenlevel=2, bookmarksnumbered=true, pdfstartview=FitH, pdfauthor={Clemens Niederberger}, pdftitle={myChemistry - english documentation}, pdfsubject={Create reaction schemes with LaTeX and ChemFig}, pdfkeywords={myChemistry}, pdfcreator={LaTeX} } \usepackage[english,color=MyDarkRed]{mychemistry} % myChemistry \renewcommand\thebeispiel{\arabic{beispiel}} % chemexec angepasst \labelformat{beispiel}{example #1} \labelformat{rxnfloat}{scheme #1} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % - Listings anpassen ----------------------------------------------------------------- % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \fvset{numbers=left,numbersep=3pt,xleftmargin=20pt,gobble=0,numberblanklines=true} \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=0, % das erste Leerzeichen abschneiden xleftmargin=20pt, % Einrückung links breaklines=true, % Zeilenumbruch moredelim=[is][\color{red!25!purple}]{!!}{!!},% Hervorhebung commentstyle={\color[named]{Gray}}, emph={begin,end}, % Umgebungen hervorheben emphstyle=\color{red}, keywordstyle=\color{code}, keywordstyle=[20]\color{blue}, morekeywords=[20]{rxn,rxnfloat,rxnscheme,tikzpicture}, texcsstyle=[30]\color{code}, moretexcs=[30]{anywhere,arrow,branch,chemabove,chemand,chembelow,chemfig,chemmove,chemname,chemrel,chemsign,ce,color,compound,declarecompound,draw,dummy,elmove,floatplacement,floatstyle,Hpl,Hyd,lewis,listof,makeinvisible,makevisible,marrow,mCsetup,merge,mesomeric,node,nu,om,op,ox,pgfpositionnodelater,reactant,restylefloat,setarrowlabel,setarrowlength,setarrowline,setatomsep,setatomsize,setbondlength,setbondshape,setcrambond,setmergelength,setrcndist,setrxnalign,setschemealign,setschemename,si,SI,textcolor,transition,vflipnext}, fancyvrb=true } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % - Kopf- und Fußzeile ---------------------------------------------------------------- % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{scrpage2} \pagestyle{scrheadings} \setheadwidth{textwithmarginpar} \automark{section} \ihead{\mC v\mCversion} \ohead{Manual} \ifoot{\small\color{gray}-~page~\thepage~-} \cfoot{} \ofoot{} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % - Komascript ------------------------------------------------------------------------ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \setkomafont{disposition}{\rmfamily\bfseries} % Gewicht fett und Schriftart roman %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % - neue Befehle ---------------------------------------------------------------------- % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % - Hyperlinks in Listings ------------------------------------------------------------ % % - auf Basis von Code usenet: comp.text.tex ------------------------------------------ % \makeatletter \AtBeginEnvironment{VerbatimOut}{\let\lsthk@OutputBox\lsthk@OutputBox@H@@k\let\lstbasicfont\footnotesize} \AtBeginEnvironment{Verbatim}{\let\lsthk@OutputBox\lsthk@OutputBox@H@@k\let\lstbasicfont\footnotesize} \AtBeginEnvironment{SideBySideExample}{\let\lsthk@OutputBox\lsthk@OutputBox@H@@k\let\lstbasicfont\footnotesize} \AtBeginDocument{\preto\FV@VerbatimBegin{\let\lsthk@OutputBox\lsthk@OutputBox@H@@k\let\lstbasicfont\footnotesize}} \AtBeginDocument{\preto\FV@VerbatimBegin{\let\lsthk@OutputBox\lsthk@OutputBox@H@@k\let\lstbasicfont\footnotesize}} \providerobustcmd*\ifrefundefined [1]{% \begingroup% \csname @safe@activestrue\endcsname% \expandafter\endgroup\csname @\ifcsname r@#1\endcsname second\else first\fi oftwo\endcsname }% \ifrefundefined \def\lsthk@OutputBox@H@@k{% \begingroup% \let\lst@UM\@empty% \edef\@tempc{ssec:\detokenize\expandafter{\the\lst@token }}%\edef \ifrefundefined{\@tempc}% \endgroup% \sethyperlistings% }% \lsthk@OutputBox@fcltxH@@k \def\sethyperlistings {\global\let \hyperlistingsreference =\@tempc \endgroup \aftergroup \dohyperlistings }% after \hbox \def\dohyperlistings {\def\lst@alloverstyle ##1{\hyperlistings ##1}} \def\hyperlistings{% \setbox\@tempboxa\hbox% \bgroup% \rlap{\hypersetup {linkcolor=.}\relax\fboxrule\z@% \hyperref[\hyperlistingsreference]{\boxframe{\wd\@tempboxa}{\ht\@tempboxa}{\dp\@tempboxa}}}% \unhbox\@tempboxa% \egroup% }% \hyperlistings \let\lsthk@OutputBox\lsthk@OutputBox@H@@k % - Beispiele ------------------------------------------------------------------------- % % - auf Basis der Beispiele in der fancyvrb-Dokumentation ----------------------------- % \newcommand{\BeginExample}{% \VerbatimEnvironment \begin{VerbatimOut}[gobble=1]{\jobname.tmp}} \newcommand{\BelowExample}[1]{% \VerbatimInput[numbersep=3pt,fontsize=\footnotesize, numbers=left,xleftmargin=5mm,xrightmargin=0pt]{\jobname.tmp} #1} % - Code, Ergebnis rechts ------------------------------------------------------------- % \newcommand{\SideBySide@Example}[1]{% \setlength{\parindent}{0pt}% \begin{minipage}[c]{.48\textwidth} \VerbatimInput[numbersep=3pt,fontsize=\footnotesize, numbers=left,xleftmargin=5mm,xrightmargin=0pt]{\jobname.tmp} \end{minipage}% \hspace*{2mm} \begin{minipage}[c]{.48\textwidth} #1 \end{minipage} } \def\SideBySideExample{% \catcode`\^^M=\active \@ifnextchar[{\catcode`\^^M=5\beispiel\vspace*{1mm}\SideBySideExample@}% {\catcode`\^^M=5\beispiel\vspace*{1mm}\SideBySideExample@@}} \def\SideBySideExample@[#1]{#1\SideBySideExample@@} \def\SideBySideExample@@{\BeginExample} \def\endSideBySideExample{% \end{VerbatimOut}% \SideBySide@Example{\input{\jobname.tmp}}\vspace*{1mm}\endbeispiel} % - Code, Ergebnis danach ------------------------------------------------------------- % \newcommand{\@Example}[1]{% \setlength{\parindent}{0pt}% \begin{minipage}{\textwidth} \VerbatimInput[numbersep=3pt,fontsize=\footnotesize, numbers=left,xleftmargin=5mm,xrightmargin=0pt]{\jobname.tmp} \end{minipage}% \smallskip \begin{minipage}{\textwidth} #1 \end{minipage} } \def\Example{% \catcode`\^^M=\active \@ifnextchar[{\catcode`\^^M=5\beispiel\vspace*{1mm}\Example@}% {\catcode`\^^M=5\beispiel\vspace*{1mm}\Example@@}} \def\Example@[#1]{#1\Example@@} \def\Example@@{\BeginExample} \def\endExample{% \end{VerbatimOut}% \@Example{\input{\jobname.tmp}}\vspace*{1mm}\endbeispiel} \makeatother % - weitere Makros -------------------------------------------------------------------- % \newcommand{\mC}{{\color{MyDarkRed}\ECFJD my\-Che\-mis\-try}\xspace} % Paketname \newcommand{\CF}{{\ECFAugie ChemFig}\xspace} % ChemFig in der originalen Schrift \newcommand{\eg}{\mbox{e.\,g.}\xspace} \newcommand{\TikZ}{\mbox{Ti{\bfseries\itshape k}Z}\xspace} \newcommand\NEU[1][0pt]{\leavevmode\llap{\footnotesize\ECFTeenSpirit\color{red}New\kern\dimexpr20pt+#1\relax}} \newlength{\tmplength} % - für Beispiele --------------------------------------------------------------------- % \newcommand{\abovearrow}{\tikz\node[draw,minimum width=3em,minimum height=1.5em,blue]{\footnotesize above};} \newcommand{\belowarrow}{\tikz\node[draw,minimum width=3em,minimum height=1.5em,red]{\footnotesize below};} \newcommand{\substance}{\tikz\node[draw,minimum width=5em,minimum height=3em]{};} \begin{document} \begin{titlepage} % inspired by the titlepage of chemfig's documentation \begin{tikzpicture}[remember picture,overlay] \shade [color=MyDarkRed,right color=white](current page.south west) rectangle ([yshift=3cm,xshift=-3cm]current page.center); \shade[top color=black,bottom color=MyDarkRed]([yshift=7cm]current page.east)rectangle([yshift=2.5cm]current page.west); \node[text width=\textwidth,opacity=.15,yshift=-5.3cm] at (current page.center) {% \begin{verbatim} \begin{rxn}[,.7] \setatomsep{1.5em}\footnotesize \reactant[,a]{ \chemfig{C(-[4]*6(=-=-=-))(-[2]*6(=-=-=-))(-[6,,,2]HO)-C(-[2]CH_3) (-[6]OH)-CH_3} } \arrow[a.20]{}{} \reactant[20]{ \chemfig{C(-[4]*6(=-=-=-))(-[2]*6(=-=-=-))(-[@{e1}6,,,2]H_2@{e2} \chembelow{O}{\oplus})-C(-[2]CH_3)(-[6]OH)-CH_3}\elmove{e1} {10:4mm}{e2}{-10:4mm} } \arrow[,,1.42]{$-\ce{H2O}$}{} \reactant{ \chemfig{\chembelow{C}{\oplus}(-[4]*6(=-=-=-))(-[2] *6(=-=-=-))-C(-[2]CH_3)(-[6]OH)-CH_3} } \arrow[a.-20,-|>]{}{} \reactant[-20]{ \chemfig{C(-[4]*6(=-=-=-))(-[2]*6(=-=-=-))(-[6,,,2]HO)-C(-[2]CH_3) (-[@{e3}6]@{e4}\chembelow{O}{\oplus}H_2)-CH_3}\elmove{e3} {170:4mm}{e4}{-170:4mm} } \arrow[,,1.42]{$-\ce{H2O}$}{} \reactant{ \chemfig{C(-[4]*6(=-=-=-))(-[2]*6(=-=-=-))(-[6,,,2]HO)- \chembelow{C}{\oplus}(-[2]CH_3)-CH_3} } \end{rxn} \end{verbatim}% }; \end{tikzpicture} \begin{center} \scalebox{4}{\mC}\par \Large v\mCversion\par\bigskip \footnotesize\mCdate{en}\par \normalsize Clemens Niederberger\par\vskip1.5cm \color{white}\huge Creating reaction schemes with \LaTeX\ and \CF% \end{center} \vskip3cm \begin{rxn}[,.7] \setatomsep{1.5em}\footnotesize \reactant[,a]{ \chemfig{C(-[4]*6(=-=-=-))(-[2]*6(=-=-=-))(-[6,,,2]HO)-C(-[2]CH_3)(-[6]OH)-CH_3} } \arrow[a.20]{}{} \reactant[20]{ \chemfig{C(-[4]*6(=-=-=-))(-[2]*6(=-=-=-))(-[@{e1}6,,,2]H_2@{e2}\chembelow{O}{\oplus})-C(-[2]CH_3)(-[6]OH)-CH_3}\elmove{e1}{10:4mm}{e2}{-10:4mm} } \arrow[,,1.42]{$-\ce{H2O}$}{} \reactant{ \chemfig{\chembelow{C}{\oplus}(-[4]*6(=-=-=-))(-[2]*6(=-=-=-))-C(-[2]CH_3)(-[6]OH)-CH_3} }{} \arrow[a.-20,-|>]{}{} \reactant[-20]{ \chemfig{C(-[4]*6(=-=-=-))(-[2]*6(=-=-=-))(-[6,,,2]HO)-C(-[2]CH_3)(-[@{e3}6]@{e4}\chembelow{O}{\oplus}H_2)-CH_3}\elmove{e3}{170:4mm}{e4}{-170:4mm} } \arrow[,,1.42]{$-\ce{H2O}$}{} \reactant{ \chemfig{C(-[4]*6(=-=-=-))(-[2]*6(=-=-=-))(-[6,,,2]HO)-\chembelow{C}{\oplus}(-[2]CH_3)-CH_3} } \end{rxn} \end{titlepage} \tableofcontents \section{About} \subsection{Changes} The most recent changes are marked with {\ECFTeenSpirit\color{red}New}. \subsubsection{Version 1.2} Since v1.2 there are some new features. The main part plays behind the scenes: the wrong arrow- and branch-alignments have been corrected. \textbf{Due to these changes \mC now needs Version 2.10 of \TikZ (or pgf, actually}, see \ref{ssec:voraussetzungen}). There are some new "frontend" features as well. For one thing there are some new package options (see \ref{ssec:paketoptionen}). Additionally the arrows have got two new keys (see \ref{ssec:arrow}). The environments have gained a few features, with which they can be customized, too (see \ref{sssec:rxn_optionen}, \ref{sssec:rxnscheme_optionen} and \ref{ssec:setrcndist}). Last but not least since v1.2 \mC underlies LPPL version 1.3 or later. \subsubsection{Version 1.3} The commands \lstinline+\branch+, \lstinline+\mesomeric+, \lstinline+\reactant+ and \lstinline+\transition+ now cannot only accept alignment as optional argument but \TikZ keys as well. Also the second mandatory Argument \lstinline++ now is an optional one. So the first argument still is alignment, the second is the anchor name and in the third you can use arbitrary \TikZ keys. \begin{lstlisting} \command[,,]{} \end{lstlisting} Version 1.2 explicitly needed a given alignment, if one wanted to use \TikZ keys, even with default alignment. Since v\mCversion\ this isn't required any more. \begin{lstlisting} % up to version 1.2: \reactant{\ce{Br2}}{}\arrow{$h\nu$}{}\reactant!![right,draw,inner sep=5pt]!!{\ce{2 \lewis{0.,Br}}}{} % since version 1.3: \reactant{\ce{Br2}}\arrow{$h\nu$}{}\reactant!![,,draw,inner sep=5pt]!!{\ce{2 \lewis{0.,Br}}} \end{lstlisting} The commands to customize \mC have been renamed and the command\linebreak\lstinline+\mCsetup+ has been added. Now you can customize \mC using only one command. See \ref{ssec:setarrowlength}, \ref{ssec:setatomsize}, \ref{ssec:setbondlength}, \ref{ssec:setbondshape} and \ref{ssec:mCsetup}. There is the new command \lstinline+\chemand+, which produces a $+$, see \ref{ssec:chemand}. And you might find this one nice: every \mC command in a listing in this do\-cu\-mentation is a hyperlink referring to the corresponding entry in the command reference. \subsubsection{Version 1.4} The command \lstinline+\merge+ has been rewritten. Now the arrow can be labeled. The main purpose of the command \lstinline+\dummy+ now is obsolete. The command still exists, though. Both environments \lstinline+rxn+ and \lstinline+rxnscheme+ have changed regarding the usage of their options, see \ref{sssec:rxn_optionen} and \ref{sssec:rxnscheme_optionen}. The keys of the \lstinline+\arrow+ command now are options, so the syntax of the command now is consistent with the syntax of the other commands. Then there are three new arrow types, see \ref{ssec:arrow}. Also new is the appearance of the arrows and the possibility of customizing the line thickness of the arrows, see \ref{ssec:setarrowline}. There is another new command \lstinline+\anywhere+ (\ref{ssec:anywhere}), with which text or formul\ae\ can be placed off the chain. \subsubsection{Version \mCversion} \NEU% Much happened in the background. This also provides some new features in the foreground. Most importantly is a new handling of the positioning of objects. All objects (reactants, arrows, branches \ldots) now cannot only be positioned with key words like \lstinline+right below+ but by using an actual angle. There are the new arrow types \lstinline+<=>>+ and \lstinline+<<=>+ which indicate an imbalanced equilibrium. The default placement identifier of \lstinline+rxnscheme+ has been changed from \lstinline+H+ to \lstinline+htp+. The example section has been moved from this manual to the file \texttt{examples.tex} or \texttt{examples.pdf}, resp. The commands \lstinline+\arrow+, \lstinline+\reactant+, \lstinline+\mesomeric+, \lstinline+\transition+, \lstinline+\anywhere+, \lstinline+\dummy+, \lstinline+\branch+ and \lstinline+\chemand+ are only defined inside the \lstinline+rxn+ and \lstinline+rxnscheme+ environments. \subsection{Licence} \mC v\mCversion\ underlies the The \LaTeX\ project public license\\(\url{http://www.latex-project.org/lppl.txt}). \subsection{Requirements}\label{ssec:voraussetzungen}\index{requirements|(} In order to function properly \mC needs some packages to be available. \begin{description} \item[\CF]\index{requirements!ChemFig@\CF} without it why would you use \mC? \item[ifthen]\index{requirements!ifthen} for internal queries; \item[calc]\index{requirements!calc} for internal calculations; \item[xkeyval]\index{requirements!xkeyval} package options and command keys are created with this package; \item[float]\index{requirements!float} the \lstinline=rxnscheme= environment is defined with this package; \item[pgf/\TikZ]\index{requirements!pgf}\index{requirements!TikZ@\TikZ} pgf actually isn't just one package but a whole bundle. They are the basis layer for \TikZ. \mC needs at least the version from 09/08/2010\footnote{\url{http://sourceforge.net/projects/pgf/files/}}. More precisely: the command \lstinline=\pgfpositionnodelater= must exist. Even more precisely: only the \lstinline+\arrow+ key \lstinline+both+ (see \ref{ssec:arrow}) needs \lstinline=\pgfpositionnodelater=. If you don't use this option, \mC should work nicely with pgf v2.00. Older versions have not been tested. \end{description} \index{requirements|)} \subsection{The Idea} Since \CF was published August 2010, there is a flexible solution for creating organic structures. With \CF and `mhchem' one is able to create nearly all structural and molecular formulars that a chemist needs. There is one thing, though, in which `ochem' still beats \CF: creating reaction mechanisms. This is where \mC comes in. \mC loads the packages \begin{itemize} \item \CF\footnote{by Christian Tellechea, \url{http://www.ctan.org/tex-archive/macros/generic/chemfig/}}\index{ChemFig@\CF}, \item `mhchem'\footnote{by Martin Hensel, \url{http://www.ctan.org/tex-archive/macros/latex/contrib/mhchem/}}\index{mhchem} in version 3, when ist exists, \item `chemexec'\footnote{by me, \url{http://www.ctan.org/tex-archive/macros/latex/contrib/chemexec/}}\index{chemexec}, when it exists, and \item `chemcompounds'\footnote{by Stephan Schenk, \url{http://www.ctan.org/tex-archive/macros/latex/contrib/chemcompounds/}}\index{chemcompounds}, when ist exists. \end{itemize} How these packages work, you can read in their documentations. Commands provided by these packages are for example \begin{itemize} \item \lstinline=\ce{}= (mhchem)\index{mhchem} \item \lstinline=\ox{}{}=, \lstinline=\om[]=, \lstinline=\op[]=, \lstinline=\Hyd=, \lstinline=\Hpl= (chemexec)\index{chemexec} \item \lstinline=\chemfig[][]{}=, \lstinline=\chemrel[]{}=, \lstinline=\chemsign[]{}=, \lstinline=\lewis{}= (\CF)\index{ChemFig@\CF} \item \lstinline=\declarecompound[]{}=, \lstinline=\compound{}= (chemcompounds)\index{chemcompounds}. \end{itemize} Some of these commands are used in the examples of this documentation \textit{without being mentioned explicitly}. Above all, \mC provides commands for creating reaction mechanisms. \section{Usage} \subsection{Background} \mC provides two environments within which the mechanisms are created. Both environments basically are \lstinline+tikzpicture+ environments. One might ask oneself: why? You can do loads of stuff with \CF already. And \TikZ provides all the possibilities one could ask for. But since I'm a lazy guy I wrote several macros providing \TikZ commands, I often used. They got so many and got more and more possibilities to adjust, that I bundled them into this package. Of course you can still use \TikZ and stay more flexible with it, if you like. \subsection{Basic Principle} Within the \lstinline+tikzpicture+ reactants and arrows are placed as nodes on a \lstinline+chain+\footnote{Provided by the tikzlibrary `chains'}. \begin{SideBySideExample} \begin{tikzpicture}[start chain] \node [on chain] {A}; \node [on chain] {B}; \node [on chain] {C}; \end{tikzpicture} \end{SideBySideExample} This way there are several possibilities to place the nodes relative to the others. \begin{SideBySideExample} \begin{tikzpicture}[start chain=going right,node distance=5mm] \node [draw,on chain] {Hello}; \node [draw,on chain] {World}; \node [draw,continue chain=going below,on chain] {,}; \node [draw,on chain] {this}; \node [draw,on chain] {is}; \end{tikzpicture} \end{SideBySideExample} Above all \mC uses the possibility of creating branches to the chain. \begin{SideBySideExample} \begin{tikzpicture}[start chain=going right,node distance=5mm] \node [draw,on chain] {A}; \node [draw,on chain] {B}; { [start branch] \node [on chain=going below] {1}; \node [on chain=going below] {2}; } { [start branch] \node [on chain=going above] {$\alpha$}; \node [on chain=going above] {$\beta$}; } \node [draw,on chain] {C}; \end{tikzpicture} \end{SideBySideExample} You don't have to understand that mechanism in detail, but you should remember the placement commands in the last example, because \mC uses them in the same way. In some of the examples in this documentation the nodes are boxed with a coloured frame (see \ref{ssec:makevisible}). This is done so one can see, which size they have and which impact changes of the alignment have on them. \subsection{How does it work?} \subsubsection{Basic Commands} There are three basic commands:\index{reactant}\index{rxn}\index{arrow} \begin{lstlisting} \begin{rxn}[,] \reactant[,,]{} \arrow[,,,,both,]{}{} \end{rxn} \end{lstlisting} Schemes are created within the \lstinline+rxn+ environment. There you place reactants and arrows. \begin{SideBySideExample} \begin{rxn} \reactant{ \chemfig{-[::30]-[::-60]OH} } \arrow{Ox.}{} \reactant{ \chemfig{-[::30]=_[::-60]O} } \end{rxn} \end{SideBySideExample} When you don't use options reactants and arrows always are put to the right of the last object. With the option \lstinline++ you can change this behaviour. \begin{SideBySideExample} % positioning using key words \begin{rxn} \reactant{ \chemfig{-[::30]-[::-60]OH} } \arrow[below]{Ox.}{} \reactant[below]{ \chemfig{-[::30]=_[::-60]O} } \end{rxn} % positioning using an angle \begin{rxn} \reactant{ \chemfig{-[::30]-[::-60]OH} } \arrow[180]{}{Ox.} \reactant[180]{ \chemfig{-[::30]=_[::-60]O} } \end{rxn} \end{SideBySideExample} \begin{table} \centering \begin{tabular}{>{\tt}lSS} \toprule {\normalfont key word} & {pos. angle} & {neg. angle} \\ \midrule right & 0 & \pm 360 \\ right above & 45 & -315 \\ above & 90 & -270 \\ above left & 135 & -225 \\ left & 180 & -180 \\ below left & 225 & -135 \\ below & 270 & -90 \\ below right & 315 & -45 \\ \bottomrule \end{tabular} \caption{key words for positioning}\label{tab:keywords} \end{table} You can see in the last example, that positioning can be realized through key words (see \ref{tab:keywords}) like \lstinline+below+ or by using the angle relative to the horizontal line. Every angle from the interval $[\ang{-360};\ang{360}]$. \ang{0} corresponds to \lstinline+right+, which is the default value. \emph{Positive angles} mean a turn \emph{counter clockwise}, negative ones a turn clockwise, like you're used to in mathematics. \begin{SideBySideExample} \begin{rxn} \reactant{ \chemfig{-[::30]-[::-60]OH} } \arrow[20]{Ox.}{} \reactant[20]{ \chemfig{-[::30]=_[::-60]O} } \end{rxn} \begin{rxn} \reactant{ \chemfig{-[::30]-[::-60]OH} } \arrow[-20]{Ox.}{} \reactant[-20]{ \chemfig{-[::30]=_[::-60]O} } \end{rxn} \end{SideBySideExample} \subsubsection{Positioning} Reactants and arrows cannot only be positioned through key words and angles. They can refer to another reactant or arrow. \begin{Example} \begin{rxn} \reactant[,start]{ \chemfig{R-[::30](-[::60]R|^1) (-[::-120]R|^2)-[::-60]OH} } \arrow[40]{\tiny$\text{R}^1=\text{H}$} {\tiny$\text{R}^2=\text{H}$} \reactant[40]{ \chemfig{R-[::30]=_[::-60]O} } \arrow[start.0]{\tiny$\text{R}^1=\text{alkyl}$} {\tiny$\text{R}^2=\text{H}$} \reactant{ \chemfig{R-[::30](-[::60]R)=_[::-60]O} } \arrow[start.-40,-|>]{\tiny$\text{R}^1=\text{alkyl}$} {\tiny$\text{R}^2=\text{Alkyl}$} \end{rxn} \end{Example} In the last example the first reactant got the \lstinline++ \lstinline+start+. The arrows in lines 5 and 7 now could refer to it. A \emph{previously given name} can act as an anchor for later reactants or arrows, if the positioning is written like \begin{lstlisting} . \end{lstlisting} Arrows can be given names, too. The anchor point of an arrow always is in the middle of the arrow line and has \emph{no} size. \begin{SideBySideExample} \begin{rxn} \reactant{\chemfig{[:60]-(-[::60])=[::-60](-[::-60])-}} \arrow[,,,arrow]{}{} \reactant[arrow.90]{\ce{H2O}} \end{rxn} \end{SideBySideExample} Using this kind of positioning does \emph{not} break the chain. \begin{lstlisting} \begin{rxn} \reactant[,a]{A} \arrow{}{} \reactant{B} \arrow[a.-90]{}{} \reactant[-90]{C} \arrow[a.180]{}{} \reactant[180]{D} \end{rxn} \end{lstlisting} All seven objects of this example are logically speaking part of the same chain. The next obect is placed to the right of the last one, if no positioning is used. \begin{rxn} \tikzset{nummer/.style={circle,fill=gray!30,draw=gray,minimum size=3.5mm}} \reactant[,a]{A}\arrow[,,,pa]{}{}\reactant[,b]{B} \arrow[a.-90,,,pb]{}{}\reactant[-90,c]{C} \arrow[a.180,,,pc]{}{}\reactant[180,d]{D} \anywhere{a.45,,nummer}{1} \anywhere{pa.90,,nummer}{2} \anywhere{b.45,,nummer}{3} \anywhere{pb.0,,nummer}{4} \anywhere{c.45,,nummer}{5} \anywhere{pc.90,,nummer}{6} \anywhere{d.45,,nummer}{7} \end{rxn} \subsubsection{Branches} To break a chain you use the command\index{branch} \begin{lstlisting} \branch[,,]{} \end{lstlisting} The positioning of a branch is slightly different from earlier objects, although the syntax is similar. A branch has two additional ways of positioning. Every positioning that refers to an anchor cause that the branch is not a part of the chain but is a real branch. \begin{lstlisting} % on the chain % on the chain . % not on the chain on chain=going % on the chain =of % not on the chain \end{lstlisting} As \lstinline++ you again use the values from \ref{tab:keywords}. \begin{Example} \begin{rxn} \reactant{ \chemfig{-[::30]-[::-60]OH} } \arrow{}{} \reactant[,carbonyl]{ \chemfig{-[::30]=_[::-60]O} } \branch[carbonyl.-90]{ \arrow[-90,<=>]{\ce{NH2R}}{} \reactant[-90]{ \chemfig{-[::30]=_[::-60]N(-[6]H)-[::60]R} } } \arrow{}{} \reactant{ \chemfig{-[::30](-[::60]OH)=_[::-60]O} } \end{rxn} \end{Example} Please note that in the last example the arrow and the reactant placed after branch continue the original chain. \begin{lstlisting} \begin{rxn} \reactant[,a]{A} \arrow{}{} \reactant{B} \branch[a.-90]{ \arrow[-90]{}{} \reactant[-90]{C} } \arrow[a.180]{}{} \reactant[180]{D} \end{rxn} \end{lstlisting} The chain is broken by the branch which starts a new chain itself. \begin{rxn} \tikzset{nummer/.style={circle,fill=gray!30,draw=gray,minimum size=3.5mm}} \reactant[,a]{A}\arrow[,,,pa]{}{}\reactant[,b]{B} \branch[a.-90]{ \arrow[-90,,,pb]{}{}\reactant[-90,c]{C} \anywhere{pb.0,,nummer}{a} \anywhere{c.45,,nummer}{b} } \arrow[a.180,,,pc]{}{}\reactant[180,d]{D} \anywhere{a.45,,nummer}{1} \anywhere{pa.90,,nummer}{2} \anywhere{b.45,,nummer}{3} \anywhere{pc.90,,nummer}{4} \anywhere{d.45,,nummer}{5} \end{rxn} Using \lstinline+\branch+ allows to create schemes with several branches: \begin{Example} \begin{rxn} \reactant{ \chemfig{-[::30]-[::-60]OH} } \arrow{}{} \reactant[,carbonyl]{ \chemfig{-[::30]=_[::-60]O} } \arrow[-90]{}{} \reactant[-90]{ \chemfig{-[::30](-[::60]OH)=_[::-60]O} } \branch[right=of carbonyl]{ \arrow[,<=>,1.12]{\ce{NH2R}}{} \reactant{ \chemfig{-[::30]=_[::-60]N(-[6]H)-[::60]R} } } \branch[below right=of carbonyl]{ \arrow[-45,<=>,1.12]{ \chemfig{[,.75]-[::30]-[::-60]OH} }{} \reactant[-45]{ \chemfig{-[::30](-[::60]O-[::-60]-[::-60])-[::-60]OH} } } \arrow[carbonyl.90]{ \chemfig{[,.75]-[::30]=_[::-60]O}/\Hpl }{} \reactant[90]{ \chemfig{-[::30](-[::60]OH)-[::-60]-[::60]=[::60]O} } \arrow{$-\ce{H2O}$}{} \reactant{ \chemfig{-[::30]=[::-60]-[::60]=[::60]O} } \end{rxn} \end{Example} \subsubsection{Numbered Schemes} There is another environment to create schemes.\index{rxnscheme} \begin{lstlisting} \begin{rxnscheme}[