% arara: pdflatex % arara: pdflatex % arara: makeindex: { sort: on, style: mychemistry_en.ist } % arara: pdflatex % -------------------------------------------------------------------------- % the MYCHEMISTRY package % % create reaction schemes with LaTeX and chemfig % % -------------------------------------------------------------------------- % Clemens Niederberger % Web: https://www.bitbucket.org/cgnieder/mychemistry % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % -------------------------------------------------------------------------- % Copyright 2011--2012 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 modiagram.sty, modiagram_en.tex, % README and the derived file modiagram_en.pdf. % -------------------------------------------------------------------------- % \errorcontextlines=999 \documentclass[toc=index,DIV10]{cnpkgdoc} \docsetup{ pkg = [draft]mychemistry, subtitle = Create Reaction Schemes with \LaTeXe\ and Chemfig , code-box = { skipbelow = .5\baselineskip plus .5ex minus .5ex , skipabove = .5\baselineskip plus .5ex minus .5ex , roundcorner = 3pt , innerleftmargin = 1.5em , innerrightmargin = 1.5em } } \usepackage{chemnum} \usepackage{fnpct} \usepackage{booktabs} \usepackage{siunitx} \chemsetup[chemformula]{format=\libertineLF} \addcmds{ @addtoreset, anywhere, arrow, branch, celsius, ch, chemabove, chemand, chembelow, chemfig, chemname, cmpd, colorlet, command, draw, elmove, floatstyle, fpch, fplus, fscrm, fscrp, Hpl, iupac, lewis, Lewis, listof, makeinvisible, makevisible, marrow, mch, mCsetup, mech, mesomeric, N, node, para, pch, phantom, reactant, restylefloat, setarrowlabel, setarrowlength, setarrowline, setatomsep, setatomsize, setbondlength, setbondshape, setcrambond, setmergelength, setrcndist, setrxnalign, setschemealign, setschemename, SI, text, therxnscheme, tikzset, trans, transition } \usepackage{makeidx} \usepackage{filecontents} \begin{filecontents*}{\jobname.ist} heading_prefix "{\\bfseries " heading_suffix "\\hfil}\\nopagebreak\n" headings_flag 1 delim_0 "\\dotfill " delim_1 "\\dotfill " delim_2 "\\dotfill " delim_r "\\nohyperpage{\\textendash}" suffix_2p "\\nohyperpage{\\,f.}" suffix_3p "\\nohyperpage{\\,ff.}" \end{filecontents*} \makeindex \begin{document} \section{Licence and Requirements}\label{ssec:voraussetzungen} Permission is granted to copy, distribute and/or modify this software under the terms of the LaTeX Project Public License, version 1.3 or later (\url{http://www.latex-project.org/lppl.txt}). This package has the status ``maintained.'' \mychemistry needs and loads the packages \paket{etoolbox}, \paket{float}, \paket{xkeyval}, \paket{chemmacros} and \paket{chemfig}. It also loads the TikZ-libraries \code{arrows}, \code{positioning}, \code{decorations.pathmorphing}, \code{shapes}, \code{calc}, \code{matrix}, \code{chains}, \code{scopes} and \code{intersections}. \mychemistry also loads \paket*{translations}\footnote{Part of the \paket*{exsheets} package} for proper language support. \section{Changes} With v1.99 (=v2.0beta) package dependencies have changed so that \mychemistry loads noticably less packages than before. Most important for you: it does \emph{not} load \paket{mhchem} any more. This documentation uses \paket{chemmacros} instead which is loaded by \mychemistry. There are now considerably less package options as most of them are not needed any more. \mychemistry now provides proper language support, \eg, when used together with \paket{babel}. New is the command \cmd{setelmove}. The command \cmd{makevisible} now only has an effect if the new option \key{draft} is used. \section{Background} \mychemistry provides two environments within which the mechanisms are created. Both environments basically are \code{tikzpicture} environments. When this package first was written \paket{chemfig} lacked the possibility of creating reaction schemes itself. This was the motivation for me to get started on \mychemistry which then rapidly grew and until now has its users. The background has changed in August 2011, though. Then \paket{chemfig} v1.0 was published and now provides simple but powerful macros to create reactions schemes. They don't seem to to be used very often but I am advertising as much as I can. Anyway, since then \mychemistry can be considered obsolete and is not actively developed any more. The current release 1.99 (= 2.0beta) was due to an incompatibilty with \paket{pdfpages} and a complete robustification of various parts of the code. \emph{Other than bug fixes this package will very likely \emph{not} be updated any more}! \section{Package options}\label{sec:paketoptionen} \mychemistry has a few package options. \begin{beschreibung} \option{strict} With this option all warning messages are turned into error messages. \option{draft} This option is an alias to \key{strict}. Additionally it enables the \cmd{makevisible} command. \option{final} This option is the opposite to \key{draft}, \ie, most error messages will be issued as warnings. It also disables the \cmd{makevisible} command. \option{placement}{} Changes the default floating behaviour of \env{rxnscheme}, see section~\ref{ssec:rxnscheme}. \end{beschreibung} \section{Usage} \subsection{Basic Principle} Within the \code{tikzpicture} reactants and arrows are placed as nodes on a \code{chain}\footnote{Provided by the tikzlibrary `chains'}. \begin{beispiel} \begin{tikzpicture}[start chain] \node [on chain] {A}; \node [on chain] {B}; \node [on chain] {C}; \end{tikzpicture} \end{beispiel} This way there are several possibilities to place the nodes relative to the others. \begin{beispiel} \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{beispiel} Above all \mychemistry uses the possibility of creating branches to the chain. \begin{beispiel} \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{beispiel} You don't have to understand that mechanism in detail but you should remember the placement commands in the last example, because \mychemistry uses them in the same way. In some of the examples in this documentation the nodes are boxed with a coloured frame (see section~\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 two basic commands: \begin{beschreibung} \Befehl{reactant}[,,]{} \Befehl{arrow}[,,,,both,]{}\ma{} \end{beschreibung} Schemes are created within the \env{rxn}{} environment. There you place reactants and arrows. \begin{beispiel} \begin{rxn} \reactant{ \chemfig{-[::30]-[::-60]OH} } \arrow{Ox.}{} \reactant{ \chemfig{-[::30]=_[::-60]O} } \end{rxn} \end{beispiel} When you don't use options reactants and arrows always are put to the right of the last object. With the option \code{} you can change this behaviour. \begin{beispiel} % 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{beispiel} \begin{table} \centering \begin{tabular}{>{\ttfamily}l*{2}{>{$}r<{$}}} \toprule {\normalfont key word} & \text{pos. angle} & \text{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 table~\ref{tab:keywords}) like \code{below} or by using the angle relative to the horizontal line. Every angle from the interval $[\ang{-360};\ang{360}]$. \ang{0} corresponds to \code{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{beispiel} \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{beispiel} \subsubsection{Positioning} Reactants and arrows cannot only be positioned through key words and angles. They can refer to another reactant or arrow. \begin{beispiel} \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{beispiel} In the last example the first reactant got the \code{} \code{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 \code{.}. 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{beispiel} \begin{rxn} \reactant{\chemfig{[:60]-(-[::60])=[::-60](-[::-60])-}} \arrow[,,,arrow]{}{} \reactant[arrow.90]{\ch{H2O}} \end{rxn} \end{beispiel} Using this kind of positioning does \emph{not} break the chain. \begin{beispiel}[code only] \begin{rxn} \reactant[,a]{A} \arrow{}{} \reactant{B} \arrow[a.-90]{}{} \reactant[-90]{C} \arrow[a.180]{}{} \reactant[180]{D} \end{rxn} \end{beispiel} All seven objects of this example are logically speaking part of the same chain. The next object 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 \begin{beschreibung} \Befehl{branch}[,,]{} \end{beschreibung} 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{description} \item[\code{}] on the chain \item[\code{}] on the chain \item[\code{.}] not on the chain \item[\code{on chain=going }]on the chain \item[\code{=of }] not on the chain \end{description} As \code{} you again use the values from table~\ref{tab:keywords}. \begin{beispiel} \begin{rxn} \reactant{ \chemfig{-[::30]-[::-60]OH} } \arrow{}{} \reactant[,carbonyl]{ \chemfig{-[::30]=_[::-60]O} } \branch[carbonyl.-90]{ \arrow[-90,<=>]{\ch{NH2R}}{} \reactant[-90]{ \chemfig{-[::30]=_[::-60]N(-[6]H)-[::60]R} } } \arrow{}{} \reactant{ \chemfig{-[::30](-[::60]OH)=_[::-60]O} } \end{rxn} \end{beispiel} Please note that in the last example the arrow and the reactant placed after branch continue the original chain. \begin{beispiel}[code only] \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{beispiel} 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,overlay}} \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 \cmd{branch} allows to create schemes with several branches: \begin{beispiel} \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]{\ch{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{$-\ch{H2O}$}{} \reactant{ \chemfig{-[::30]=[::-60]-[::60]=[::60]O} } \end{rxn} \end{beispiel} \subsubsection{Numbered Schemes} There is another environment to create schemes. \begin{beschreibung} \Umg{rxnscheme}[