%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % ------------------------------------------------------------------------------------- % % - myChemistry - mychemistry.sty ----------------------------------------------------- % % - Creating reaction schemes with LaTeX and ChemFig ---------------------------------- % % ------------------------------------------------------------------------------------- % % - Clemens Niederberger -------------------------------------------------------------- % % - 2011/04/23 ------------------------------------------------------------------------ % % ------------------------------------------------------------------------------------- % % - 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 and - % % - mychemistry_en.tex - % % ------------------------------------------------------------------------------------- % % - 2011/02/24 version 1.0 - % % - first release to CTAN - % % ------------------------------------------------------------------------------------- % % - 2011/03/01 version 1.1 - % % - package option `english' added - % % - package key `placement' added - % % - rxnscheme key `placement' added - % % - package key `shade=boolean' changed into package option `shade' - % % - package option `nochemexec' added, will prevent mC from loading chemexec - % % - 2011/03/20 version 1.2 - % % - license changed into LPPL 1.3 or later - % % - package option `nocompounds' added, will prevent mC from loading chemcompounds - % % - package option `chemstyle' added, will load chemstyle - % % - package option `nomhchem' added, will prevent mC from loading mhchem - % % - if chemexec isn't loaded either - % % - package option `nopackages' added, will prevent mC from loading any - % % - chemistry package except chemfig - % % - some small issues resolved - % % - bug in arrow type <=> resolved - % % - arrow argument placement rewritten; two new keys for arrow: `aboveshift' - % % - and `belowshift' (causing new problems with alignment, though) - % % - wrong arrow alignment (due to last change) mainly resolved (NEEDS pgf v2.10!) - % % - => solved wrong branch alignment as well - % % - `inner sep' set to 0, arrow, transition & mesomeric adjusted - % % - bug in arrow type -|> resolved - % % - commands \makevisible / \makeinvisible added - % % - arrow key `both' added - % % - rxn has now keys instead of an option - % % - commands \setrcndist, \setrxnalign, \setschemealign added - % % - rxn-, rxnscheme-key align added - % % - 2011/03/26 version 1.2.1 - % % - rewritten commands, so they accept second argument without first: - % % - \reactand, \mesomeric, \transition, \branch, \makevisible, \makeinvisible - % % - 2011/03/28 version 1.2.2 - % % - bugfix with transition - % % - atomsize, arrowlength, bondlength and bondshape renamed into set - % % - and code slightly rewritten - % % - \mCsetup added - % % - 2011/04/01 version 1.2.3 - % % - bug in \branch resolved - % % - \chemand added - % % - 2011/04/02 version 1.2.4 - % % - bugs in \makevisible, \makeinvisible resolved - % % - input bondwidth.tex if ChemFig v0.4 - % % - 2011/04/04 version 1.3 - % % - commands \reactand, \mesomeric, \branch, \transition, \chemand (\makeinvisible - % % - \makeinvisible) rewritten: more flexible with opt. arguments - % % - 2011/04/15 version 1.4 - % % - minor bugfixes - % % - \merge-command rewritten: it now accepts an arrow label and the length is - % % - adjustable - % % - \dummy mostly obsolete - % % - bugfix with aligning rxn & rxnscheme - % % - synonym to \reactand=\reactant added - % % - rxn & rxnscheme rewritten - % % - commands \reactant, \mesomeric, \branch & \transition modified: argument is set - % % - with \scantokens{\relax#1}, so the chemfig catcode regime is working properly - % % - before () (else possible problem with triple bond ~) - % % - syntax of \arrow changed so it fits to the syntax of all the other commands - % % - command \anywhere added - % % - own arrow tips defined - % % - command \setarrowline added - % % - new arrow type -+> added - % % - 2011/04/23 version 1.5 - % % - major parts of the code rewritten -- - % % - the whole positioning part now is different and way more flexible: - % % - arbitrary angles can be used for positioning, referencing an object is - % % - easier, arrows can be modified using , command \anywhere now has - % % - similar syntax - % % - arrow types <=>> and <<=> added - % % - arrow type -+> modified: more flexible - % % - bugfixes in error-handling - % % ------------------------------------------------------------------------------------- % % - TODO: - % % - work on how chemistry-packages are automatically loaded; - % % - add ui for easy handling this issue? (via \mCsetup ?) - % % - add arrow types <=+>, <+=>, <=+>>, <+=>>, <<=+>, <<+=> ? - % % ------------------------------------------------------------------------------------- % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Paket Info % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\mC@version{1.5} \def\mC@date@de{23. April 2011} \def\mC@date@en{April 23rd 2011} \def\mC@date{2011/04/23} \def\mC@name{myChemistry} \ProvidesPackage{mychemistry}[\mC@date\space v\mC@version] \typeout{} \typeout{\mC@name\space v\mC@version} \typeout{\mC@date\space Clemens Niederberger} \typeout{} \RequirePackage{ifthen,calc,float,xkeyval} % myChemistry Informationen ----------------------------------------------------------- % \def\mCversion{\mC@version} \def\mCdate#1{\csname mC@date@#1\endcsname} % additional für ChemFig v0.4 --------------------------------------------------------- % \def\mC@CFversion@test{0.4}% \IfFileExists{bondwidth.tex}{% \ifx\CF@ver\mC@CFversion@test\input{bondwidth}\fi }{}% \def\mC@CFversion@test{0.4a} \IfFileExists{bondwidth.tex}{% \ifx\CF@ver\mC@CFversion@test\input{bondwidth}\fi }{}% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Optionen, z.T. auch an chemexec weitergeben %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\mC@exec@color{black} \def\mC@exec@shade{false} \newif\if@usecolor\@usecolorfalse % wenn key color, dann Farbe und Option shade=true an chemexec weitergeben \define@key[MC]{mychemistry.sty}% {color}{ \@usecolortrue \def\mC@exec@color{#1} \def\mC@exec@shade{true} } % sonst nicht: \DeclareOptionX[MC]{nocolor}{ \@usecolortrue \def\mC@exec@color{black} \def\mC@exec@shade{false} } % shade separat (de-)aktivieren \DeclareOptionX[MC]{shade}{% \def\mC@exec@shade{true} } % chemexec abschalten \def\mC@exec@true{true} \DeclareOptionX[MC]{nochemexec}{% \def\mC@exec@true{false} } % mhchem abschalten \def\mC@mhchem@true{true} \DeclareOptionX[MC]{nomhchem}{% \def\mC@mhchem@true{false} } % chemcompounds abschalten \def\mC@compound@true{true} \DeclareOptionX[MC]{nocompounds}{% \def\mC@compound@true{false} } % chemstyle einschalten \def\mC@chemstyle@true{false} \DeclareOptionX[MC]{chemstyle}{% \def\mC@chemstyle@true{true} } % nur `chemfig' laden \DeclareOptionX[MC]{nopackages}{% \def\mC@exec@true{false} \def\mC@mhchem@true{false} \def\mC@compound@true{false} \def\mC@chemstyle@true{false} } % englische Version von chemexec, englische Variante von myChemistry \def\mC@exec@english{} \def\mC@rs@name{Reaktionsschema} \DeclareOptionX[MC]{english}{ \def\mC@exec@english{,english} \def\mC@rs@name{Reaction scheme} } \def\mC@rs@placement{hpt} \def\mC@rs@currentplacement{\mC@rs@placement} \define@key[MC]{mychemistry.sty}{placement}{ \def\mC@rs@placement{#1} } \ProcessOptionsX[MC] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % chemstyle laden, falls verfügbar und Option aktiv \IfFileExists{chemstyle.sty}{% \ifthenelse{\equal{\mC@chemstyle@true}{true}}{ \@ifpackageloaded{chemstyle}{}{ \RequirePackage[varioref=false,floats=float]{chemstyle} \PackageInfo{mychemistry}{You loaded `chemstyle' with options `varioref=false' and `floats=float'. Please be aware, that you might need to restyle the float `table'. Take a look at the `chemstyle' documentation for further information.} } }{} }{} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % chemcompounds laden, falls verfügbar \IfFileExists{chemcompounds.sty}{% \ifthenelse{\equal{\mC@compound@true}{true}}{ \@ifpackageloaded{chemcompounds}{}{ \RequirePackage{chemcompounds} } }{} }{ \PackageWarning{mychemistry}{`chemcompounds' is not installed. You should use the `nocompounds' option.} } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % chemfig laden, falls verfügbar \IfFileExists{chemfig.sty}{% \@ifpackageloaded{chemfig}{}{ \RequirePackage{chemfig} } \usetikzlibrary{arrows,positioning,decorations.pathmorphing,shapes,calc,matrix,chains,scopes} }{% sonst Fehlermeldung \PackageError{mychemistry}{The ChemFig package is not installed! myChemistry can't work without it}{See the myChemistry package documentation for explanation} } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % chemexec laden, falls verfügbar, falls nicht, dann wenigstens mhchem laden \IfFileExists{chemexec.sty}{% mit den Default-Optionen color=black, shade=false,exercise,exersize=large \ifthenelse{\equal{\mC@exec@true}{true}}{ \ifthenelse{\equal{\mC@mhchem@true}{true}}{}{ \PackageWarning{mychemistry}{You used the option `nomhchem' but not `nochemexec'. Please be aware that `mhchem' is loaded by `chemexec' anyway.} } \@ifpackageloaded{chemexec}{}{ \RequirePackage[color=\mC@exec@color,shade=\mC@exec@shade,exercise,exersize=large\mC@exec@english]{chemexec} } }{} }{ \PackageWarning{mychemistry}{`chemexec' ist not installed. You should use the `nochemexec' option.} \IfFileExists{mhchem.sty}{ \ifthenelse{\equal{\mC@mhchem@true}{true}}{ \@ifpackageloaded{mhchem}{}{ \RequirePackage[version=3]{mhchem} } }{} }{ \PackageWarning{mychemistry}{`mhchem' ist not installed. You should use the `nomhchem' option.} } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Tools ------------------------------------------------------------------------------- % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\mC@true{true} \def\mC@false{false} % Optional Argument Analysis ---------------------------------------------------------- % % Prüfen ob #2 in #1 enthalten ist \def\mC@if@instr#1#2{% \def\mC@if@instr@i##1#2##2\@nil{\ifx\@empty##2\@empty\expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi}% \mC@if@instr@i#1\@@nil#2\@nil } % Am ersten , splitten, #1 in #3 speichern, #2 in \mC@remainargs \def\mC@splitfirst#1,#2\@nil#3{% \def#3{#1}\def\mC@remainargs{#2}% } % ein durch , in 3 Teile getrenntes Argument splitten \def\mC@splitarg#1{ \mC@if@instr{#1}{,}{\expandafter\mC@splitfirst#1\@nil\mC@firstarg}{\def\mC@firstarg{#1}} \expandafter\mC@if@instr\expandafter{\mC@remainargs}{,}{\expandafter\mC@splitfirst\mC@remainargs\@nil\mC@secondarg}{\expandafter\def\expandafter\mC@secondarg\expandafter{\mC@remainargs}} \ifx\mC@remainargs\mC@secondarg\let\mC@thirdarg\@empty\else\expandafter\def\expandafter\mC@thirdarg\expandafter{\mC@remainargs}\fi } % Direction Analysis ------------------------------------------------------------------ % % Richtungen: \def\mC@r{right} \def\mC@ar{above right} \def\mC@a{above} \def\mC@al{above left} \def\mC@l{left} \def\mC@br{below right} \def\mC@b{below} \def\mC@bl{below left} \def\mC@vert@i{90} \def\mC@vert@ii{-90} \def\mC@vert@iii{270} % Richtung in Bezug auf node oder nicht? \def\mC@split@angle#1.#2\@nil#3{\def#3{#1}\def\mC@direction{#2}} \def\mC@wowo@node#1{\mC@if@instr{#1}{.}{\expandafter\mC@split@angle#1\@nil\mC@referred@node}{\def\mC@direction{#1}}} % Winkel bestimmen: \def\mC@analyze@angle#1{ \let\mC@angle\@empty \let\mC@referred@node\@empty \mC@wowo@node{#1} \ifx\mC@direction\mC@r\def\mC@angle{0}\fi \ifx\mC@direction\mC@ar\def\mC@angle{45}\fi \ifx\mC@direction\mC@a\def\mC@angle{90}\fi \ifx\mC@direction\mC@al\def\mC@angle{135}\fi \ifx\mC@direction\mC@l\def\mC@angle{180}\fi \ifx\mC@direction\mC@bl\def\mC@angle{225}\fi \ifx\mC@direction\mC@b\def\mC@angle{270}\fi \ifx\mC@direction\mC@br\def\mC@angle{315}\fi \ifx\mC@angle\@empty\pgfmathparse{\mC@direction <0 ? int(\mC@direction+360) : int(\mC@direction) }\edef\mC@angle{\pgfmathresult}\fi } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % PFEILE ------------------------------------------------------------------------------ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \arrow[,,,,both,]{}{} % Pfeiltypen: \def\mC@arrow@type@def{->} \def\mC@arrow@type@eqv{<->} \def\mC@arrow@type@back{<-} \def\mC@arrow@type@eq{<=>} \def\mC@arrow@type@eqq{<=>>} \def\mC@arrow@type@eeq{<<=>} \def\mC@arrow@type@not{-|>} \def\mC@arrow@type@pm{-+>} % Voreinstellungen -------------------------------------------------------------------- % % Pfeillänge -------------------------------------------------------------------------- % % \newlength{\mC@arrow@length} \def\mC@arrow@length@def{4em} \let\mC@arrow@length\mC@arrow@length@def \def\mC@arrow@factor{1} \def\setarrowlength#1{% \ifx\@empty#1\@empty% \let\mC@arrow@length\mC@arrow@length@def% \else% \def\mC@arrow@length{#1}% \fi% } % Label-Abstand ----------------------------------------------------------------------- % \def\mC@arrow@label@dist@def{.2em} \def\mC@arrow@label@dist{\mC@arrow@label@dist@def} \def\setarrowlabel#1{% \ifx\@empty#1\@empty% \def\mC@arrow@label@dist{\mC@arrow@label@dist@def}% \else% \def\mC@arrow@label@dist{#1}% \fi% } % Pfeildicke -------------------------------------------------------------------------- % \def\mC@arrow@linethickness@default{semithick} \def\mC@arrow@linethickness{\mC@arrow@linethickness@default} \def\setarrowline#1{% \ifx\@empty#1\@empty% \def\mC@arrow@linethickness{\mC@arrow@linethickness@default}% \else% \def\mC@arrow@linethickness{#1}% \fi% } % ------------------------------------------------------------------------------------- % % Winkel untersuchen, um Label richtig anzubringen ------------------------------------ % \def\mC@evaluate@angle#1{ \newcount\mC@alpha \mC@alpha=#1 \pgfmathparse{cos(\mC@alpha) > 0} \ifnum\pgfmathresult=1 \def\mC@beta{#1} \def\mC@arrow@label@anchor@up{south} \def\mC@arrow@label@anchor@down{north} \ifnum\mC@alpha<180 \def\mC@arrow@label@anchor@add{east} \def\mC@arrow@label@anchor@sub{south} \else \def\mC@arrow@label@anchor@add{south} \def\mC@arrow@label@anchor@sub{west} \fi \else \pgfmathparse{cos(\mC@alpha) == 0} \ifnum\pgfmathresult=1 \def\mC@beta{0} \ifnum\mC@alpha=90 \def\mC@arrow@label@anchor@up{east} \def\mC@arrow@label@anchor@down{west} \def\mC@arrow@label@anchor@add{east} \def\mC@arrow@label@anchor@sub{east} \else \def\mC@arrow@label@anchor@up{west} \def\mC@arrow@label@anchor@down{east} \def\mC@arrow@label@anchor@add{west} \def\mC@arrow@label@anchor@sub{west} \fi \else \def\mC@arrow@label@anchor@up{north} \def\mC@arrow@label@anchor@down{south} \ifnum\mC@alpha=180 \def\mC@beta{180-#1} \def\mC@arrow@label@anchor@add{north} \def\mC@arrow@label@anchor@sub{north} \fi \ifnum\mC@alpha>180 \def\mC@beta{180+#1} \def\mC@arrow@label@anchor@add{west} \def\mC@arrow@label@anchor@sub{north} \fi \ifnum\mC@alpha<180 \def\mC@beta{180+#1} \def\mC@arrow@label@anchor@add{north} \def\mC@arrow@label@anchor@sub{east} \fi \fi \fi } % ------------------------------------------------------------------------------------- % % Maße der Nodes der Pfeilargumente bestimmen, größere später an Pfeil weitergeben \def\mC@arrow@both{both} \newlength{\mC@height@A} \newlength{\mC@height@B} \newlength{\mC@arrow@label@height} \newlength{\mC@width@A} \newlength{\mC@width@B} \newlength{\mC@arrow@label@width} \def\mC@savenode{% \global\let\mC@minx=\pgfpositionnodelaterminx% \global\let\mC@maxx=\pgfpositionnodelatermaxx% \global\let\mC@miny=\pgfpositionnodelaterminy% \global\let\mC@maxy=\pgfpositionnodelatermaxy% }% % der nächste Befehl benötigt pgf v2.10! \def\mC@largernode#1#2{ \@ifundefined{pgfpositionnodelater}{ \PackageError{mychemistry}{The command \string\pgfpositionnodelater\space is undefined. Make sure, you have installed the latest version of pgf}{See the myChemistry package documentation for explanation} }{} {\pgfpositionnodelater{\mC@savenode} \node{#1}; \setlength{\mC@width@A}{\mC@maxx}% \addtolength{\mC@width@A}{-\mC@minx} \setlength{\mC@height@A}{\mC@maxy}% \addtolength{\mC@height@A}{-\mC@miny} \node{#2}; \setlength{\mC@width@B}{\mC@maxx}% \addtolength{\mC@width@B}{-\mC@minx} \setlength{\mC@height@B}{\mC@maxy}% \addtolength{\mC@height@B}{-\mC@miny} \pgfmathsetlength{\mC@arrow@label@width}{max(\mC@width@A,\mC@width@B)} \pgfmathsetlength{\mC@arrow@label@height}{max(\mC@height@A,\mC@height@B)} \global\mC@arrow@label@width=\mC@arrow@label@width \global\mC@arrow@label@height=\mC@arrow@label@height } } % ------------------------------------------------------------------------------------- % % Pfeil zeichnen: \def\arrow{\@ifnextchar[{\mC@arrow@ii}{\mC@arrow@i}} \def\mC@arrow@i#1#2{ \node[on chain=going {at=(\tikzchainprevious.0)},minimum size=0,inner sep=3pt,outer sep=0,anchor=180,shift=(0:.5*\mC@rxn@node@distance)] (@mC@arrow@start){}; \node[on chain=going {at=(\tikzchainprevious.0),shift=($(0:.5*\mC@arrow@factor*\mC@arrow@length)$)}, minimum size=0,inner sep=3pt,outer sep=0] (@mC@arrow@end){}; \draw[-mCtip,\mC@arrow@linethickness] let \n1={0}, \n2={180} in (@mC@arrow@start.\n1) --node[pos=.5,inner sep=0](mC@arrow@center){} ++($(0:\mC@arrow@factor*\mC@arrow@length)$); \expandafter\node\expandafter[\mC@arrow@uplabel@visible,rotate=0,anchor=south,inner sep=0] at ($(mC@arrow@center)!\mC@arrow@label@dist!90:(@mC@arrow@end)$){#1}; \expandafter\node\expandafter[\mC@arrow@downlabel@visible,rotate=0,anchor=north,inner sep=0] at ($(mC@arrow@center)!\mC@arrow@label@dist!-90:(@mC@arrow@end)$){#2}; } \def\mC@arrow@ii[#1]#2#3{ \let\mC@arrow@plusminus\@empty \let\mC@arrow@type\@empty \let\mC@remainargs\@empty\mC@splitarg{#1} \ifx\@empty\mC@firstarg% erste Option: Richtung \def\mC@angle{0} \def\mC@beta{0} \def\mC@arrow@label@anchor@up{south} \def\mC@arrow@label@anchor@down{north} \def\mC@arrow@label@anchor@add{south} \def\mC@arrow@label@anchor@sub{south} \def\mC@anchor{180} \let\mC@referred@node\@empty \else \expandafter\mC@analyze@angle\expandafter{\mC@firstarg} \def\mC@anchor{180+\mC@angle} \mC@evaluate@angle{\mC@angle} \fi \ifx\mC@referred@node\@empty\def\mC@referred@node{\tikzchainprevious}\fi \ifx\@empty\mC@secondarg\else% zweite Option: Typ \def\mC@arrow@type{true} \let\mC@arrow@type@actual\mC@secondarg \fi \let\mC@remainargs\@empty% \expandafter\mC@splitarg\expandafter{\mC@thirdarg}% \ifx\@empty\mC@firstarg% dritte Option: Längenfaktor \def\mC@arrow@factor{1}% \else% \edef\mC@arrow@factor{\mC@firstarg}% \fi% \ifx\@empty\mC@secondarg% vierte Option: Name \def\mC@arrow@name{mC@arrow@center}% \else% \edef\mC@arrow@name{\mC@secondarg}% \fi% \let\mC@remainargs\@empty% \expandafter\mC@splitarg\expandafter{\mC@thirdarg}% \ifx\mC@arrow@both\mC@firstarg% fünfte Option: both \mC@largernode{#2}{#3}% \else% \setlength{\mC@arrow@label@width}{0pt}% \setlength{\mC@arrow@label@height}{0pt}% \fi% \ifx\@empty\mC@secondarg% sechste Option: tikz \let\mC@arrow@tikz\@empty% \else% \edef\mC@arrow@tikz{\mC@secondarg,\mC@thirdarg}% \fi% \node[on chain=going {at=(\mC@referred@node.\mC@angle)},minimum size=0,inner sep=3pt,outer sep=0,anchor=\mC@anchor,shift=(\mC@angle:.5*\mC@rxn@node@distance)] (@mC@arrow@start){}; \node[on chain=going {at=(\tikzchainprevious.\mC@angle),shift=($(\mC@angle:.5*\mC@arrow@factor*\mC@arrow@length)$)}, minimum size=0,inner sep=3pt,outer sep=0] (@mC@arrow@end){}; \ifx\mC@arrow@type\mC@true \let\mC@arrow@type@valid\mC@false% \ifx\mC@arrow@type@actual\mC@arrow@type@eq% <=> \let\mC@arrow@type@valid\mC@true% \expandafter\draw\expandafter[\mC@arrow@tikz,-mChtip,\mC@arrow@linethickness] let \n1={20+\mC@angle}, \n2={160+\mC@angle} in (@mC@arrow@start.\n1) --node[pos=.5,inner sep=0](mC@arrow@center@up){} ++($(\mC@angle:\mC@arrow@factor*\mC@arrow@length)$); \expandafter\draw\expandafter[\mC@arrow@tikz,mChtip-,\mC@arrow@linethickness] let \n1={-20+\mC@angle}, \n2={200+\mC@angle} in (@mC@arrow@start.\n1) --node[pos=.5,inner sep=0](mC@arrow@center@down){} ++($(\mC@angle:\mC@arrow@factor*\mC@arrow@length)$); \draw[draw=none] let \n1={\mC@angle}, \n2={180+\mC@angle} in (@mC@arrow@start.\n1) --node[pos=.5,inner sep=0](\mC@arrow@name){} ++($(\mC@angle:\mC@arrow@factor*\mC@arrow@length)$); \expandafter\node\expandafter[\mC@arrow@uplabel@visible,rotate=\mC@beta,anchor=\mC@arrow@label@anchor@up,minimum width=\mC@arrow@label@width, minimum height=\mC@arrow@label@height,inner sep=0] at ($(mC@arrow@center@up)!\mC@arrow@label@dist!90:(@mC@arrow@end)$){#2}; \expandafter\node[\expandafter\mC@arrow@downlabel@visible,rotate=\mC@beta,anchor=\mC@arrow@label@anchor@down,minimum width=\mC@arrow@label@width, minimum height=\mC@arrow@label@height,inner sep=0] at ($(mC@arrow@center@down)!\mC@arrow@label@dist!-90:(@mC@arrow@end)$){#3}; \fi \ifx\mC@arrow@type@actual\mC@arrow@type@eqq% <=>> \let\mC@arrow@type@valid\mC@true% \expandafter\draw\expandafter[\mC@arrow@tikz,-mChtip,\mC@arrow@linethickness] let \n1={20+\mC@angle}, \n2={160+\mC@angle} in (@mC@arrow@start.\n1) --node[pos=.5,inner sep=0](mC@arrow@center@up){} ++($(\mC@angle:\mC@arrow@factor*\mC@arrow@length)$); \expandafter\draw\expandafter[\mC@arrow@tikz,mChtip-,\mC@arrow@linethickness] let \n1={-20+\mC@angle} in ($(@mC@arrow@start.\n1)+(\mC@angle:.25*\mC@arrow@factor*\mC@arrow@length)$) --node[pos=.5,inner sep=0](mC@arrow@center@down){} ++($(\mC@angle:.5*\mC@arrow@factor*\mC@arrow@length)$); \draw[draw=none] let \n1={\mC@angle}, \n2={180+\mC@angle} in (@mC@arrow@start.\n1) --node[pos=.5,inner sep=0](\mC@arrow@name){} ++($(\mC@angle:\mC@arrow@factor*\mC@arrow@length)$); \expandafter\node\expandafter[\mC@arrow@uplabel@visible,rotate=\mC@beta,anchor=\mC@arrow@label@anchor@up,minimum width=\mC@arrow@label@width, minimum height=\mC@arrow@label@height,inner sep=0] at ($(mC@arrow@center@up)!\mC@arrow@label@dist!90:(@mC@arrow@end)$){#2}; \expandafter\node\expandafter[\mC@arrow@downlabel@visible,rotate=\mC@beta,anchor=\mC@arrow@label@anchor@down,minimum width=\mC@arrow@label@width, minimum height=\mC@arrow@label@height,inner sep=0] at ($(mC@arrow@center@down)!\mC@arrow@label@dist!-90:(@mC@arrow@end)$){#3}; \fi \ifx\mC@arrow@type@actual\mC@arrow@type@eeq% <<=> \let\mC@arrow@type@valid\mC@true% \expandafter\draw\expandafter[\mC@arrow@tikz,-mChtip,\mC@arrow@linethickness] let \n1={20+\mC@angle}, \n2={160+\mC@angle} in ($(@mC@arrow@start.\n1)+(\mC@angle:.25*\mC@arrow@factor*\mC@arrow@length)$) --node[pos=.5,inner sep=0](mC@arrow@center@up){} ++($(\mC@angle:.5*\mC@arrow@factor*\mC@arrow@length)$); \expandafter\draw\expandafter[\mC@arrow@tikz,mChtip-,\mC@arrow@linethickness] let \n1={-20+\mC@angle}, \n2={200+\mC@angle} in (@mC@arrow@start.\n1) --node[pos=.5,inner sep=0](mC@arrow@center@down){} ++($(\mC@angle:\mC@arrow@factor*\mC@arrow@length)$); \draw[draw=none] let \n1={\mC@angle}, \n2={180+\mC@angle} in (@mC@arrow@start.\n1) --node[pos=.5,inner sep=0](\mC@arrow@name){} ++($(\mC@angle:\mC@arrow@factor*\mC@arrow@length)$); \expandafter\node\expandafter[\mC@arrow@uplabel@visible,rotate=\mC@beta,anchor=\mC@arrow@label@anchor@up,minimum width=\mC@arrow@label@width, minimum height=\mC@arrow@label@height,inner sep=0] at ($(mC@arrow@center@up)!\mC@arrow@label@dist!90:(@mC@arrow@end)$){#2}; \expandafter\node\expandafter[\mC@arrow@downlabel@visible,rotate=\mC@beta,anchor=\mC@arrow@label@anchor@down,minimum width=\mC@arrow@label@width, minimum height=\mC@arrow@label@height,inner sep=0] at ($(mC@arrow@center@down)!\mC@arrow@label@dist!-90:(@mC@arrow@end)$){#3}; \fi \ifx\mC@arrow@type@actual\mC@arrow@type@def% -> \let\mC@arrow@type@valid\mC@true% \expandafter\draw\expandafter[\mC@arrow@tikz,-mCtip,\mC@arrow@linethickness,\mC@arrow@tikz] let \n1={\mC@angle}, \n2={180+\mC@angle} in (@mC@arrow@start.\n1) --node[pos=.5,inner sep=0](\mC@arrow@name){} ++($(\mC@angle:\mC@arrow@factor*\mC@arrow@length)$); \expandafter\node\expandafter[\mC@arrow@uplabel@visible,rotate=\mC@beta,anchor=\mC@arrow@label@anchor@up,minimum width=\mC@arrow@label@width, minimum height=\mC@arrow@label@height] at ($(\mC@arrow@name)!\mC@arrow@label@dist!90:(@mC@arrow@end)$){#2}; \expandafter\node\expandafter[\mC@arrow@downlabel@visible,rotate=\mC@beta,anchor=\mC@arrow@label@anchor@down,minimum width=\mC@arrow@label@width, minimum height=\mC@arrow@label@height] at ($(\mC@arrow@name)!\mC@arrow@label@dist!-90:(@mC@arrow@end)$){#3}; \fi \ifx\mC@arrow@type@actual\mC@arrow@type@eqv% <-> \let\mC@arrow@type@valid\mC@true% \expandafter\draw\expandafter[\mC@arrow@tikz,mCtip-mCtip,\mC@arrow@linethickness] let \n1={\mC@angle}, \n2={180+\mC@angle} in (@mC@arrow@start.\n1) --node[pos=.5,inner sep=0](\mC@arrow@name){} ++($(\mC@angle:\mC@arrow@factor*\mC@arrow@length)$); \expandafter\node\expandafter[\mC@arrow@uplabel@visible,rotate=\mC@beta,anchor=\mC@arrow@label@anchor@up,minimum width=\mC@arrow@label@width, minimum height=\mC@arrow@label@height,inner sep=0] at ($(\mC@arrow@name)!\mC@arrow@label@dist!90:(@mC@arrow@end)$){#2}; \expandafter\node\expandafter[\mC@arrow@downlabel@visible,rotate=\mC@beta,anchor=\mC@arrow@label@anchor@down,minimum width=\mC@arrow@label@width, minimum height=\mC@arrow@label@height,inner sep=0] at ($(\mC@arrow@name)!\mC@arrow@label@dist!-90:(@mC@arrow@end)$){#3}; \fi \ifx\mC@arrow@type@actual\mC@arrow@type@back% <- \let\mC@arrow@type@valid\mC@true% \expandafter\draw\expandafter[\mC@arrow@tikz,mCtip-,\mC@arrow@linethickness] let \n1={\mC@angle}, \n2={180+\mC@angle} in (@mC@arrow@start.\n1) --node[pos=.5,inner sep=0](\mC@arrow@name){} ++($(\mC@angle:\mC@arrow@factor*\mC@arrow@length)$); \expandafter\node\expandafter[\mC@arrow@uplabel@visible,rotate=\mC@beta,anchor=\mC@arrow@label@anchor@up,minimum width=\mC@arrow@label@width, minimum height=\mC@arrow@label@height,inner sep=0] at ($(\mC@arrow@name)!\mC@arrow@label@dist!90:(@mC@arrow@end)$){#2}; \expandafter\node\expandafter[\mC@arrow@downlabel@visible,rotate=\mC@beta,anchor=\mC@arrow@label@anchor@down,minimum width=\mC@arrow@label@width, minimum height=\mC@arrow@label@height,inner sep=0] at ($(\mC@arrow@name)!\mC@arrow@label@dist!-90:(@mC@arrow@end)$){#3}; \fi \ifx\mC@arrow@type@actual\mC@arrow@type@not% -|> \let\mC@arrow@type@valid\mC@true% \expandafter\draw\expandafter[\mC@arrow@tikz,-mCtip,\mC@arrow@linethickness] let \n1={\mC@angle}, \n2={180+\mC@angle} in (@mC@arrow@start.\n1) --node[pos=.5,inner sep=0](\mC@arrow@name){} ++($(\mC@angle:\mC@arrow@factor*\mC@arrow@length)$); \expandafter\node\expandafter[\mC@arrow@uplabel@visible,rotate=\mC@beta,anchor=\mC@arrow@label@anchor@up,minimum width=\mC@arrow@label@width, minimum height=\mC@arrow@label@height,inner sep=0] at ($(\mC@arrow@name)!.8em!90:(@mC@arrow@end)$){#2}; \expandafter\node\expandafter[\mC@arrow@downlabel@visible,rotate=\mC@beta,anchor=\mC@arrow@label@anchor@down,minimum width=\mC@arrow@label@width, minimum height=\mC@arrow@label@height,inner sep=0] at ($(\mC@arrow@name)!.8em!-90:(@mC@arrow@end)$){#3}; \draw ($(mC@arrow@center)!.6em!-110:(@mC@arrow@end)+(\mC@angle:.1em)$)--($(mC@arrow@center)!.6em!70:(@mC@arrow@end)+(\mC@angle:.1em)$); \draw ($(mC@arrow@center)!.6em!-110:(@mC@arrow@end)+(180+\mC@angle:.1em)$)--($(mC@arrow@center)!.6em!70:(@mC@arrow@end)+(180+\mC@angle:.1em)$); \fi \ifx\mC@arrow@type@actual\mC@arrow@type@pm% -+> \let\mC@arrow@type@valid\mC@true% \def\mC@arrow@plusminus{true} \draw[-mCtip,\mC@arrow@linethickness] let \n1={\mC@angle}, \n2={180+\mC@angle} in (@mC@arrow@start.\n1) --node[pos=.5,inner sep=0](\mC@arrow@name){} ++($(\mC@angle:\mC@arrow@factor*\mC@arrow@length)$); \fi \ifx\mC@arrow@type@valid\mC@false% \PackageError{myChemistry}{Unknown arrow type \mC@arrow@type@actual}{} \fi \else% default: -> \expandafter\draw\expandafter[\mC@arrow@tikz,-mCtip,\mC@arrow@linethickness] let \n1={\mC@angle}, \n2={180+\mC@angle} in (@mC@arrow@start.\n1) --node[pos=.5,inner sep=0](\mC@arrow@name){} ++($(\mC@angle:\mC@arrow@factor*\mC@arrow@length)$); \expandafter\node\expandafter[\mC@arrow@uplabel@visible,rotate=\mC@beta,anchor=\mC@arrow@label@anchor@up,minimum width=\mC@arrow@label@width, minimum height=\mC@arrow@label@height,inner sep=0] at ($(\mC@arrow@name)!\mC@arrow@label@dist!90:(@mC@arrow@end)$){#2}; \expandafter\node\expandafter[\mC@arrow@downlabel@visible,rotate=\mC@beta,anchor=\mC@arrow@label@anchor@down,minimum width=\mC@arrow@label@width, minimum height=\mC@arrow@label@height,inner sep=0] at ($(\mC@arrow@name)!\mC@arrow@label@dist!-90:(@mC@arrow@end)$){#3}; \fi \ifx\@empty\mC@arrow@plusminus\else \ifx\@empty#2\@empty\else \draw (\mC@arrow@name.base) edge[bend left] ++(${0.6667}*(146.3+\mC@angle:.5*\mC@arrow@factor*\mC@arrow@length)$); \node[anchor=\mC@arrow@label@anchor@add,inner sep=\mC@arrow@label@dist,minimum width=\mC@arrow@label@width, minimum height=\mC@arrow@label@height] at ($(\mC@arrow@name.base)+{0.6667}*(146.3+\mC@angle:.5*\mC@arrow@factor*\mC@arrow@length)$) {#2}; \fi \ifx\@empty#3\@empty\else \draw (\mC@arrow@name.base) edge[bend right,-mCtip] ++(${0.6667}*(33.7+\mC@angle:.5*\mC@arrow@factor*\mC@arrow@length)$); \node[anchor=\mC@arrow@label@anchor@sub,inner sep=\mC@arrow@label@dist,minimum width=\mC@arrow@label@width, minimum height=\mC@arrow@label@height] at ($(\mC@arrow@name.base)+{0.6667}*(33.7+\mC@angle:.5*\mC@arrow@factor*\mC@arrow@length)$) {#3}; \fi \fi \def\mC@arrow@factor{1} } % eigene Pfeilspitze ------------------------------------------------------------------ % \pgfarrowsdeclare{mCtip}{mCtip}% { \arrowsize=0.2pt \advance\arrowsize by .5\pgflinewidth \pgfarrowsleftextend{-4\arrowsize-.5\pgflinewidth} \pgfarrowsrightextend{.5\pgflinewidth} } { \pgfsetdash{}{0pt} % do not dash \pgfsetroundjoin% fix join \pgfsetroundcap% fix cap \pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{-3pt}{1pt}} \pgfpathlineto{\pgfpoint{-1.5pt}{0pt}} \pgfpathlineto{\pgfpoint{-3pt}{-1pt}} \pgfpathlineto{\pgfpoint{0pt}{0pt}} \pgfusepathqfillstroke } \pgfarrowsdeclare{mChtip}{mChtip}% { \arrowsize=0.2pt \advance\arrowsize by .5\pgflinewidth \pgfarrowsleftextend{-4\arrowsize-.5\pgflinewidth} \pgfarrowsrightextend{.5\pgflinewidth} } { \pgfsetdash{}{0pt}% do not dash \pgfsetroundjoin% fix join \pgfsetroundcap% fix cap \pgfpathmoveto{\pgfpoint{0pt}{0pt}} \pgfpathlineto{\pgfpoint{-3pt}{1pt}} \pgfpathlineto{\pgfpoint{-1.5pt}{0pt}} \pgfpathlineto{\pgfpoint{0pt}{0pt}} \pgfusepathqfillstroke } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % MERGE ------------------------------------------------------------------------------- % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \merge[