diff options
author | Karl Berry <karl@freefriends.org> | 2012-07-30 22:38:24 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-07-30 22:38:24 +0000 |
commit | 2ad9f930b70a9958600f293faca4906b6730185a (patch) | |
tree | 53a7942f2ef66d48f3aa5fe0a950da36b57a4411 /Master/texmf-dist/tex/latex/mychemistry | |
parent | bcf694a0835cc008732c04f517813ab94f02963e (diff) |
mychemistry (30jul12)
git-svn-id: svn://tug.org/texlive/trunk@27251 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/mychemistry')
-rw-r--r-- | Master/texmf-dist/tex/latex/mychemistry/mychemistry.sty | 2468 |
1 files changed, 1435 insertions, 1033 deletions
diff --git a/Master/texmf-dist/tex/latex/mychemistry/mychemistry.sty b/Master/texmf-dist/tex/latex/mychemistry/mychemistry.sty index 38325495786..4314ff99de9 100644 --- a/Master/texmf-dist/tex/latex/mychemistry/mychemistry.sty +++ b/Master/texmf-dist/tex/latex/mychemistry/mychemistry.sty @@ -1,1130 +1,1532 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% ------------------------------------------------------------------------------------- % -% - myChemistry - mychemistry.sty ----------------------------------------------------- % -% - 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 - % -% ------------------------------------------------------------------------------------- % -% - 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<name> - % -% - 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 <tikz>, command \anywhere now has - % -% - similar syntax - % -% - arrow types <=>> and <<=> added - % -% - arrow type -+> modified: more flexible - % -% - bugfixes in error-handling - % -% - 2011/04/27 version 1.5.1 - % -% - removed bondwidth.tex - % -% - \arrow, \reactant, \mesomeric, \transition, \anywhere, \dummy, \branch, - % -% - and \chemand only defined inside scheme environments - % -% ------------------------------------------------------------------------------------- % -% - 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.1} -\def\mC@date@de{27. April 2011} -\def\mC@date@en{April 27th 2011} -\def\mC@date{2011/04/27} -\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} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% 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.} - } -} +% -------------------------------------------------------------------------- +% 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 mychemistrysty, mychemistry_en.tex, +% README and the derived file mychemistry_en.pdf. +% -------------------------------------------------------------------------- +\ProvidesPackage{mychemistry}[2012/07/27 v1.99 create reaction schemes with LaTeX and chemfig] +\RequirePackage{etoolbox,float,xkeyval,chemfig,chemmacros} +\usetikzlibrary{ + arrows, + positioning, + decorations.pathmorphing, + shapes, + calc, + matrix, + chains, + scopes, + intersections} + +% -------------------------------------------------------------------------- +% Tools +\newif\ifmCh@strict +\newif\ifmCh@draft +\def\mCh@if@strict{% + \ifmCh@strict\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} + +\def\mCh@error#1#2{% + \mCh@if@strict + {\PackageError{mychemistry}{#1}{#2}} + {\PackageWarning{mychemistry}{#1}{#2}}} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Tools ------------------------------------------------------------------------------- % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\def\mC@true{true} -\def\mC@false{false} -% Optional Argument Analysis ---------------------------------------------------------- % -% Prüfen ob #2 in #1 enthalten ist -% (das Makro ist eine Kopie von \CF@if@instr in chemfig.tex von Christian Tellechea) -\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 +\def\mCh@strict@error#1#2{% + \begingroup + \mCh@stricttrue + \mCh@error{#1}{#2}% + \endgroup} + +\def\mCh@def#1{% + \ifdef{#1}{% + \mCh@strict@error{already defined}{mychemistry tries to define \string#1 but + it seems it is already defined. Please contact the author.}% + \@gobble + }{\def#1}} + +% "variablen" definieren +\mCh@def\mCh@strip@bs{\expandafter\@gobble\string} +\mCh@def\mCh@ifis@variable#1#2#3{% + \ifcsdef{mCh@variable@\mCh@strip@bs#1} + {#2} + {\mCh@error{variable \string#1 undefined}{}#3}} +\mCh@def\mCh@new@variable#1{% + \ifcsdef{mCh@variable@\mCh@strip@bs#1} + {\mCh@error{variable \string#1 already defined. I'm doing nothing!}{}} + {\csdef{mCh@variable@\mCh@strip@bs#1}{}\csdef{mCh@\mCh@strip@bs#1}{}}} +\mCh@def\mCh@set@variable#1#2{% + \mCh@ifis@variable{#1}{\csdef{mCh@\mCh@strip@bs#1}{#2}}{\@gobble}} +\mCh@def\mCh@xset@variable#1#2{% + \mCh@ifis@variable{#1}{\csedef{mCh@\mCh@strip@bs#1}{#2}}{\@gobble}} +\mCh@def\mCh@clear@variable#1{% + \mCh@ifis@variable{#1}{\csdef{mCh@\mCh@strip@bs#1}{}}{}} +\mCh@def\mCh@let@variable#1#2{% + \mCh@ifis@variable{#1}{\mCh@ifis@variable{#2} + {\csletcs{mCh@\mCh@strip@bs#1}{mCh@\mCh@strip@bs#2}}{}}{}} +\mCh@def\mCh@empty@variable#1{% + \mCh@ifis@variable{#1}{\cslet{mCh@\mCh@strip@bs#1}\@empty}{}} +\mCh@def\mCh@ifeq@variable#1#2#3#4{% + \mCh@ifis@variable{#1}{\mCh@ifis@variable{#2} + {\ifcsequal{mCh@\mCh@strip@bs#1}{mCh@\mCh@strip@bs#2}{#3}{#4}}{}}{}} +\mCh@def\mCh@ifempty@variable#1#2#3{% + \ifcsequal{mCh@\mCh@strip@bs#1}{@empty}{#2}{#3}} + +\mCh@new@variable\true +\mCh@new@variable\false + +\mCh@set@variable\true{true} +\mCh@set@variable\false{false} + +% Optional Argument Analysis +% is #2 part of #1? (inspired by \CF@if@instr by Christian Tellechea) +\mCh@def\mCh@if@instr#1#2{% + \def\mCh@if@instr@i##1#2##2\@nil{% + \ifstrempty{##2}{\@secondoftwo}{\@firstoftwo}}% + \mCh@if@instr@i#1\@@nil#2\@nil } -% Am ersten , splitten, #1 in #3 speichern, #2 in \mC@remainargs + +\mCh@new@variable\firstarg +\mCh@new@variable\secondarg +\mCh@new@variable\thirdarg + +% Am ersten , splitten, #1 in #3 speichern, #2 in \mCh@remainargs % (das Makro ist eine Kopie von \CF@analyze@movearg in chemfig.tex von Christian Tellechea) -\def\mC@splitfirst#1,#2\@nil#3{% - \def#3{#1}\def\mC@remainargs{#2}% +\mCh@def\mCh@splitfirst#1,#2\@nil#3{% + \def#3{#1}\def\mCh@remainargs{#2}% } + % ein durch , in 3 Teile getrenntes Argument splitten % (das Makro ist eine Abwandlung von \CF@analyze@movearg in chemfig.tex von Christian Tellechea) -\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 +\mCh@def\mCh@splitarg#1{% + \mCh@if@instr{#1}{,} + {\expandafter\mCh@splitfirst#1\@nil\mCh@firstarg} + {\mCh@set@variable\firstarg{#1}}% + \expandafter\mCh@if@instr\expandafter{\mCh@remainargs}{,} + {\expandafter\mCh@splitfirst\mCh@remainargs\@nil\mCh@secondarg}{\expandafter\mCh@set@variable\expandafter\secondarg\expandafter{\mCh@remainargs}}% + \ifx\mCh@remainargs\mCh@secondarg + \mCh@empty@variable\thirdarg + \else + \expandafter\mCh@set@variable\expandafter\thirdarg\expandafter{\mCh@remainargs}% + \fi } -% Direction Analysis ------------------------------------------------------------------ % + +% -------------------------------------------------------------------------- +% options +\define@key[MC]{mychemistry.sty}{strict}{\mCh@stricttrue} +\DeclareOptionX[MC]{strict}{\mCh@stricttrue} + +\define@key[MC]{mychemistry.sty}{draft}{\mCh@stricttrue\mCh@drafttrue} +\DeclareOptionX[MC]{draft}{\mCh@stricttrue\mCh@drafttrue} + +\define@key[MC]{mychemistry.sty}{final}{\mCh@strictfalse\mCh@draftfalse} +\DeclareOptionX[MC]{final}{\mCh@strictfalse\mCh@draftfalse} + +\mCh@new@variable\rs@placement +\mCh@new@variable\rs@currentplacement + +\mCh@set@variable\rs@placement{hpt} +\mCh@let@variable\rs@currentplacement\rs@placement + +\define@key[MC]{mychemistry.sty}{placement}{% + \mCh@set@variable\rs@placement{#1}} + +\ProcessOptionsX[MC] + +% -------------------------------------------------------------------------- +% language settings +\mCh@new@variable\rs@name +\mCh@set@variable\rs@name{Reaction scheme} + +\IfFileExists{translator.sty}{% + \RequirePackage{translator} + \usedictionary{translator-basic-dictionary} + \languagealias{ngerman}{German} + \languagealias{german}{German} + \languagealias{austrian}{German} + \languagealias{naustrian}{German} + \languagealias{french}{French} + \languagealias{canadien}{French} + \languagealias{italian}{Italian} + \languagealias{spanish}{Spanish} + \providetranslation[to=English]{reaction-scheme-(caption-title)}{Reaction scheme} + \providetranslation[to=BritishEnglish]{reaction-scheme-(caption-title)}{Reaction scheme} + \providetranslation[to=AmericanEnglish]{reaction-scheme-(caption-title)}{Reaction scheme} + \providetranslation[to=French]{reaction-scheme-(caption-title)}{Sch\'{e}ma r\'{e}actionnel} + \providetranslation[to=German]{reaction-scheme-(caption-title)}{Reaktionsschema} + \providetranslation[to=Italian]{reaction-scheme-(caption-title)}{Reazione Scheme} + \providetranslation[to=Spanish]{reaction-scheme-(caption-title)}{Esquema de Reacci\'{o}n} + \mCh@set@variable\rs@name{\translate{reaction-scheme-(caption-title)}} +}{} + +% -------------------------------------------------------------------------- +% 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} +\mCh@new@variable\r +\mCh@new@variable\ar +\mCh@new@variable\a +\mCh@new@variable\al +\mCh@new@variable\l +\mCh@new@variable\br +\mCh@new@variable\b +\mCh@new@variable\bl + +\mCh@set@variable\r{right} +\mCh@set@variable\ar{above right} +\mCh@set@variable\a{above} +\mCh@set@variable\al{above left} +\mCh@set@variable\l{left} +\mCh@set@variable\br{below right} +\mCh@set@variable\b{below} +\mCh@set@variable\bl{below left} + +\mCh@new@variable\vert@i +\mCh@new@variable\vert@ii +\mCh@new@variable\vert@iii + +\mCh@set@variable\vert@i{90} +\mCh@set@variable\vert@ii{-90} +\mCh@set@variable\vert@iii{270} + % Richtung in Bezug auf node oder nicht? -% (nur eine Kopie/Variante von \mC@splitfirst, das wiederum eine Kopie von \CF@analyze@movearg in chemfig.tex von Christian Tellechea ist) -\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}}} +\mCh@new@variable\direction + +\mCh@def\mCh@split@angle#1.#2\@nil#3{% + \def#3{#1}\mCh@set@variable\direction{#2}} +\mCh@def\mCh@wowo@node#1{% + \mCh@if@instr{#1}{.} + {\expandafter\mCh@split@angle#1\@nil\mCh@referred@node} + {\mCh@set@variable\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 +\mCh@new@variable\angle +\mCh@new@variable\referred@node + +\mCh@def\mCh@analyze@angle#1{% + \mCh@empty@variable\angle + \mCh@empty@variable\referred@node + \mCh@wowo@node{#1}% + \mCh@ifeq@variable\direction\r {\mCh@set@variable\angle{0}}{}% + \mCh@ifeq@variable\direction\ar {\mCh@set@variable\angle{45}}{}% + \mCh@ifeq@variable\direction\a {\mCh@set@variable\angle{90}}{}% + \mCh@ifeq@variable\direction\al {\mCh@set@variable\angle{135}}{}% + \mCh@ifeq@variable\direction\l {\mCh@set@variable\angle{180}}{}% + \mCh@ifeq@variable\direction\bl {\mCh@set@variable\angle{225}}{}% + \mCh@ifeq@variable\direction\b {\mCh@set@variable\angle{270}}{}% + \mCh@ifeq@variable\direction\br {\mCh@set@variable\angle{315}}{}% + \mCh@ifempty@variable\angle{% + \pgfmathparse{\mCh@direction <0 ? int(\mCh@direction+360) : int(\mCh@direction) }% + \mCh@xset@variable\angle{\pgfmathresult}% + }{}% } -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% PFEILE ------------------------------------------------------------------------------ % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% -------------------------------------------------------------------------- +% PFEILE % \arrow[<pos>,<type>,<length factor>,<name>,both,<tikz>]{<above>}{<below>} % 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} +\mCh@new@variable\arrow@type@def +\mCh@new@variable\arrow@type@eqv +\mCh@new@variable\arrow@type@back +\mCh@new@variable\arrow@type@eq +\mCh@new@variable\arrow@type@eqq +\mCh@new@variable\arrow@type@eeq +\mCh@new@variable\arrow@type@not +\mCh@new@variable\arrow@type@pm + +\mCh@set@variable\arrow@type@def{->} +\mCh@set@variable\arrow@type@eqv{<->} +\mCh@set@variable\arrow@type@back{<-} +\mCh@set@variable\arrow@type@eq{<=>} +\mCh@set@variable\arrow@type@eqq{<=>>} +\mCh@set@variable\arrow@type@eeq{<<=>} +\mCh@set@variable\arrow@type@not{-|>} +\mCh@set@variable\arrow@type@pm{-+>} + +% Voreinstellungen +% Pfeillänge +\mCh@new@variable\arrow@length@def +\mCh@new@variable\arrow@length +\mCh@new@variable\arrow@factor + +\mCh@set@variable\arrow@length@def{4em} +\let\mCh@arrow@length\mCh@arrow@length@def +\mCh@set@variable\arrow@factor{1} + +\newrobustcmd\setarrowlength[1]{% + \ifblank{#1} + {\mCh@let@variable\arrow@length\arrow@length@def} + {\mCh@set@variable\arrow@length{#1}}} + +% Label-Abstand +\mCh@new@variable\arrow@label@dist@def +\mCh@new@variable\arrow@label@dist + +\mCh@set@variable\arrow@label@dist@def{.2em} +\mCh@let@variable\arrow@label@dist\arrow@label@dist@def + +\newrobustcmd\setarrowlabel[1]{% + \ifblank{#1} + {\mCh@let@variable\arrow@label@dist\arrow@label@dist@def} + {\mCh@set@variable\arrow@label@dist{#1}}} + +% Pfeildicke +\mCh@new@variable\arrow@linethickness@default +\mCh@new@variable\arrow@linethickness + +\mCh@set@variable\arrow@linethickness@default{semithick} +\mCh@let@variable\arrow@linethickness\arrow@linethickness@default + +\newrobustcmd\setarrowline[1]{% + \ifblank{#1} + {\mCh@let@variable\arrow@linethickness\arrow@linethickness@default} + {\mCh@set@variable\arrow@linethickness{#1}}} + +% Winkel untersuchen, um Label richtig anzubringen +\mCh@new@variable\beta +\mCh@new@variable\arrow@label@anchor@up +\mCh@new@variable\arrow@label@anchor@down +\mCh@new@variable\arrow@label@anchor@add +\mCh@new@variable\arrow@label@anchor@sub +\newcount\mCh@alpha + +\mCh@def\mCh@evaluate@angle#1{ + \mCh@alpha=#1 + \pgfmathparse{cos(\mCh@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} + \mCh@set@variable\beta{#1}% + \mCh@set@variable\arrow@label@anchor@up{south}% + \mCh@set@variable\arrow@label@anchor@down{north}% + \ifnum\mCh@alpha<180 + \mCh@set@variable\arrow@label@anchor@add{east}% + \mCh@set@variable\arrow@label@anchor@sub{south}% \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} + \mCh@set@variable\arrow@label@anchor@add{south}% + \mCh@set@variable\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} + \pgfmathparse{cos(\mCh@alpha) == 0}% + \ifnum\pgfmathresult=1 + \mCh@set@variable\beta{0}% + \ifnum\mCh@alpha=90 + \mCh@set@variable\arrow@label@anchor@up{east}% + \mCh@set@variable\arrow@label@anchor@down{west}% + \mCh@set@variable\arrow@label@anchor@add{east}% + \mCh@set@variable\arrow@label@anchor@sub{east}% + \else + \mCh@set@variable\arrow@label@anchor@up{west}% + \mCh@set@variable\arrow@label@anchor@down{east}% + \mCh@set@variable\arrow@label@anchor@add{west}% + \mCh@set@variable\arrow@label@anchor@sub{west}% + \fi + \else + \mCh@set@variable\arrow@label@anchor@up{north}% + \mCh@set@variable\arrow@label@anchor@down{south}% + \ifnum\mCh@alpha=180 + \mCh@set@variable\beta{180-#1}% + \mCh@set@variable\arrow@label@anchor@add{north}% + \mCh@set@variable\arrow@label@anchor@sub{north}% + \fi + \ifnum\mCh@alpha>180 + \mCh@set@variable\beta{180+#1}% + \mCh@set@variable\arrow@label@anchor@add{west}% + \mCh@set@variable\arrow@label@anchor@sub{north}% + \fi + \ifnum\mCh@alpha<180 + \mCh@set@variable\beta{180+#1}% + \mCh@set@variable\arrow@label@anchor@add{north}% + \mCh@set@variable\arrow@label@anchor@sub{east}% + \fi \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% -}% +\mCh@new@variable\arrow@both +\mCh@set@variable\arrow@both{both} + +\newlength{\mCh@height@A} +\newlength{\mCh@height@B} +\newlength{\mCh@arrow@label@height} +\newlength{\mCh@width@A} +\newlength{\mCh@width@B} +\newlength{\mCh@arrow@label@width} + +\mCh@def\mCh@savenode{% + \global\let\mCh@minx=\pgfpositionnodelaterminx + \global\let\mCh@maxx=\pgfpositionnodelatermaxx + \global\let\mCh@miny=\pgfpositionnodelaterminy + \global\let\mCh@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 - } +\mCh@def\mCh@largernode#1#2{% + \ifdef\pgfpositionnodelater{% + \pgfpositionnodelater{\mCh@savenode}% + \node{#1}; + \deflength{\mCh@width@A}{\mCh@maxx-\mCh@minx}% + \deflength{\mCh@height@A}{\mCh@maxy-\mCh@miny}% + \node{#2}; + \deflength{\mCh@width@B}{\mCh@maxx-\mCh@minx}% + \deflength{\mCh@height@B}{\mCh@maxy-\mCh@miny}% + \pgfmathsetlength{\mCh@arrow@label@width}{max(\mCh@width@A,\mCh@width@B)}% + \pgfmathsetlength{\mCh@arrow@label@height}{max(\mCh@height@A,\mCh@height@B)}% + \global\mCh@arrow@label@width=\mCh@arrow@label@width + \global\mCh@arrow@label@height=\mCh@arrow@label@height + }{% + \mCh@error{% + The command \string\pgfpositionnodelater\space is undefined. Make sure, + you have installed the latest version of pgf}{}% + }% } -% ------------------------------------------------------------------------------------- % + % Pfeil zeichnen: -\def\mC@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}; +\newrobustcmd\mCh@arrow[3][]{% + \ifstrempty{#1} + {\mCh@arrow@i}{\mCh@arrow@ii[#1]} + {#2}{#3}} + +\mCh@def\mCh@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*\mCh@rxn@node@distance)] (@mCh@arrow@start){}; + \node[on chain=going {at=(\tikzchainprevious.0), + shift=($(0:.5*\mCh@arrow@factor*\mCh@arrow@length)$)}, + minimum size=0, + inner sep=3pt, + outer sep=0] (@mCh@arrow@end){}; + \draw[-mCtip,\mCh@arrow@linethickness] + let \n1={0}, \n2={180} + in (@mCh@arrow@start.\n1) --node[pos=.5,inner sep=0](mCh@arrow@center){} + ++($(0:\mCh@arrow@factor*\mCh@arrow@length)$); + \expandafter\node\expandafter[\mCh@arrow@uplabel@visible, + rotate=0, + anchor=south, + inner sep=0] + at ($(mCh@arrow@center)!\mCh@arrow@label@dist!90:(@mCh@arrow@end)$){#1}; + \expandafter\node\expandafter[\mCh@arrow@downlabel@visible, + rotate=0, + anchor=north, + inner sep=0] + at ($(mCh@arrow@center)!\mCh@arrow@label@dist!-90:(@mCh@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} + +\mCh@new@variable\arrow@plusminus +\mCh@new@variable\anchor +\mCh@new@variable\arrow@tikz +\mCh@new@variable\arrow@type@valid +\mCh@new@variable\arrow@type +\mCh@new@variable\arrow@type@actual +\mCh@new@variable\arrow@name + +\mCh@def\mCh@arrow@ii[#1]#2#3{% + \mCh@empty@variable\arrow@plusminus + \mCh@empty@variable\arrow@type + \let\mCh@remainargs\@empty + \mCh@splitarg{#1}% + \mCh@ifempty@variable\firstarg{% erste Option: Richtung + \mCh@set@variable\angle{0}% + \mCh@set@variable\beta{0}% + \mCh@set@variable\arrow@label@anchor@up{south}% + \mCh@set@variable\arrow@label@anchor@down{north}% + \mCh@set@variable\arrow@label@anchor@add{south}% + \mCh@set@variable\arrow@label@anchor@sub{south}% + \mCh@set@variable\anchor{180}% + \mCh@empty@variable\referred@node + }{% + \expandafter\mCh@analyze@angle\expandafter{\mCh@firstarg}% + \mCh@set@variable\anchor{180+\mCh@angle}% + \mCh@evaluate@angle{\mCh@angle}% + } + \mCh@ifempty@variable\referred@node{% + \mCh@set@variable\referred@node{\tikzchainprevious}% + }{}% + \mCh@ifempty@variable\secondarg{}{% zweite Option: Typ + \mCh@set@variable\arrow@type{true} + \mCh@let@variable\arrow@type@actual\secondarg + }% + \let\mCh@remainargs\@empty% + \expandafter\mCh@splitarg\expandafter{\mCh@thirdarg}% + \mCh@ifempty@variable\firstarg{% dritte Option: Längenfaktor + \mCh@set@variable\arrow@factor{1}% + }{% + \mCh@xset@variable\arrow@factor{\mCh@firstarg}% + }% + \mCh@ifempty@variable\secondarg{% vierte Option: Name + \mCh@set@variable\arrow@name{mCh@arrow@center}% + }{% + \mCh@xset@variable\arrow@name{\mCh@secondarg}% + }% + \let\mCh@remainargs\@empty% + \expandafter\mCh@splitarg\expandafter{\mCh@thirdarg}% + \mCh@ifeq@variable\arrow@both\firstarg% fünfte Option: both + {{\mCh@largernode{#2}{#3}}}% + {% + \deflength{\mCh@arrow@label@width}{0pt}% + \deflength{\mCh@arrow@label@height}{0pt}% + }% + \mCh@ifempty@variable\secondarg{% sechste Option: tikz + \mCh@empty@variable\arrow@tikz + }{% + \mCh@xset@variable\arrow@tikz{\mCh@secondarg,\mCh@thirdarg}% + }% + \node[on chain=going {at=(\mCh@referred@node.\mCh@angle)}, + minimum size=0, + inner sep=3pt, + outer sep=0, + anchor=\mCh@anchor, + shift=(\mCh@angle:.5*\mCh@rxn@node@distance)] (@mCh@arrow@start){}; + \node[on chain=going {at=(\tikzchainprevious.\mCh@angle), + shift=($(\mCh@angle:.5*\mCh@arrow@factor*\mCh@arrow@length)$)}, + minimum size=0, + inner sep=3pt, + outer sep=0] (@mCh@arrow@end){}; + \mCh@ifeq@variable\arrow@type\true{% + \mCh@let@variable\arrow@type@valid\false + \mCh@ifeq@variable\arrow@type@actual\arrow@type@eq{% <=> + \mCh@let@variable\arrow@type@valid\true + \expandafter\draw\expandafter[\mCh@arrow@tikz, + -mChtip, + \mCh@arrow@linethickness] + let \n1={20+\mCh@angle}, \n2={160+\mCh@angle} + in (@mCh@arrow@start.\n1) --node[pos=.5,inner sep=0](mCh@arrow@center@up){} + ++($(\mCh@angle:\mCh@arrow@factor*\mCh@arrow@length)$); + \expandafter\draw\expandafter[\mCh@arrow@tikz, + mChtip-, + \mCh@arrow@linethickness] + let \n1={-20+\mCh@angle}, \n2={200+\mCh@angle} + in (@mCh@arrow@start.\n1) --node[pos=.5,inner sep=0](mCh@arrow@center@down){} + ++($(\mCh@angle:\mCh@arrow@factor*\mCh@arrow@length)$); + \draw[draw=none] + let \n1={\mCh@angle}, \n2={180+\mCh@angle} + in (@mCh@arrow@start.\n1) --node[pos=.5,inner sep=0](\mCh@arrow@name){} + ++($(\mCh@angle:\mCh@arrow@factor*\mCh@arrow@length)$); + \expandafter\node\expandafter[\mCh@arrow@uplabel@visible, + rotate=\mCh@beta, + anchor=\mCh@arrow@label@anchor@up, + minimum width=\mCh@arrow@label@width, + minimum height=\mCh@arrow@label@height, + inner sep=0] + at ($(mCh@arrow@center@up)!\mCh@arrow@label@dist!90:(@mCh@arrow@end)$){#2}; + \expandafter\node[\expandafter\mCh@arrow@downlabel@visible, + rotate=\mCh@beta, + anchor=\mCh@arrow@label@anchor@down, + minimum width=\mCh@arrow@label@width, + minimum height=\mCh@arrow@label@height, + inner sep=0] + at ($(mCh@arrow@center@down)!\mCh@arrow@label@dist!-90:(@mCh@arrow@end)$){#3}; + }{}% + \mCh@ifeq@variable\arrow@type@actual\arrow@type@eqq{% <=>> + \mCh@let@variable\arrow@type@valid\true + \expandafter\draw\expandafter[\mCh@arrow@tikz, + -mChtip, + \mCh@arrow@linethickness] + let \n1={20+\mCh@angle}, \n2={160+\mCh@angle} + in (@mCh@arrow@start.\n1) --node[pos=.5,inner sep=0](mCh@arrow@center@up){} + ++($(\mCh@angle:\mCh@arrow@factor*\mCh@arrow@length)$); + \expandafter\draw\expandafter[\mCh@arrow@tikz, + mChtip-, + \mCh@arrow@linethickness] + let \n1={-20+\mCh@angle} + in ($(@mCh@arrow@start.\n1)+(\mCh@angle:.25*\mCh@arrow@factor*\mCh@arrow@length)$) + --node[pos=.5,inner sep=0](mCh@arrow@center@down){} + ++($(\mCh@angle:.5*\mCh@arrow@factor*\mCh@arrow@length)$); + \draw[draw=none] let \n1={\mCh@angle}, \n2={180+\mCh@angle} + in (@mCh@arrow@start.\n1) --node[pos=.5,inner sep=0](\mCh@arrow@name){} + ++($(\mCh@angle:\mCh@arrow@factor*\mCh@arrow@length)$); + \expandafter\node\expandafter[\mCh@arrow@uplabel@visible, + rotate=\mCh@beta, + anchor=\mCh@arrow@label@anchor@up, + minimum width=\mCh@arrow@label@width, + minimum height=\mCh@arrow@label@height, + inner sep=0] + at ($(mCh@arrow@center@up)!\mCh@arrow@label@dist!90:(@mCh@arrow@end)$){#2}; + \expandafter\node\expandafter[\mCh@arrow@downlabel@visible, + rotate=\mCh@beta, + anchor=\mCh@arrow@label@anchor@down, + minimum width=\mCh@arrow@label@width, + minimum height=\mCh@arrow@label@height, + inner sep=0] + at ($(mCh@arrow@center@down)!\mCh@arrow@label@dist!-90:(@mCh@arrow@end)$){#3}; + }{}% + \mCh@ifeq@variable\arrow@type@actual\arrow@type@eeq{% <<=> + \mCh@let@variable\arrow@type@valid\true + \expandafter\draw\expandafter[\mCh@arrow@tikz, + -mChtip, + \mCh@arrow@linethickness] + let \n1={20+\mCh@angle}, \n2={160+\mCh@angle} + in ($(@mCh@arrow@start.\n1)+(\mCh@angle:.25*\mCh@arrow@factor*\mCh@arrow@length)$) + --node[pos=.5,inner sep=0](mCh@arrow@center@up){} + ++($(\mCh@angle:.5*\mCh@arrow@factor*\mCh@arrow@length)$); + \expandafter\draw\expandafter[\mCh@arrow@tikz, + mChtip-, + \mCh@arrow@linethickness] + let \n1={-20+\mCh@angle}, \n2={200+\mCh@angle} + in (@mCh@arrow@start.\n1) --node[pos=.5,inner sep=0](mCh@arrow@center@down){} + ++($(\mCh@angle:\mCh@arrow@factor*\mCh@arrow@length)$); + \draw[draw=none] + let \n1={\mCh@angle}, \n2={180+\mCh@angle} + in (@mCh@arrow@start.\n1) --node[pos=.5,inner sep=0](\mCh@arrow@name){} + ++($(\mCh@angle:\mCh@arrow@factor*\mCh@arrow@length)$); + \expandafter\node\expandafter[\mCh@arrow@uplabel@visible, + rotate=\mCh@beta, + anchor=\mCh@arrow@label@anchor@up, + minimum width=\mCh@arrow@label@width, + minimum height=\mCh@arrow@label@height, + inner sep=0] + at ($(mCh@arrow@center@up)!\mCh@arrow@label@dist!90:(@mCh@arrow@end)$){#2}; + \expandafter\node\expandafter[\mCh@arrow@downlabel@visible, + rotate=\mCh@beta, + anchor=\mCh@arrow@label@anchor@down, + minimum width=\mCh@arrow@label@width, + minimum height=\mCh@arrow@label@height, + inner sep=0] + at ($(mCh@arrow@center@down)!\mCh@arrow@label@dist!-90:(@mCh@arrow@end)$){#3}; + }{}% + \mCh@ifeq@variable\arrow@type@actual\arrow@type@def{% -> + \mCh@let@variable\arrow@type@valid\true + \expandafter\draw\expandafter[\mCh@arrow@tikz, + -mCtip, + \mCh@arrow@linethickness, + \mCh@arrow@tikz] + let \n1={\mCh@angle}, \n2={180+\mCh@angle} + in (@mCh@arrow@start.\n1) --node[pos=.5,inner sep=0](\mCh@arrow@name){} + ++($(\mCh@angle:\mCh@arrow@factor*\mCh@arrow@length)$); + \expandafter\node\expandafter[\mCh@arrow@uplabel@visible, + rotate=\mCh@beta, + anchor=\mCh@arrow@label@anchor@up, + minimum width=\mCh@arrow@label@width, + minimum height=\mCh@arrow@label@height] + at ($(\mCh@arrow@name)!\mCh@arrow@label@dist!90:(@mCh@arrow@end)$){#2}; + \expandafter\node\expandafter[\mCh@arrow@downlabel@visible, + rotate=\mCh@beta, + anchor=\mCh@arrow@label@anchor@down, + minimum width=\mCh@arrow@label@width, + minimum height=\mCh@arrow@label@height] + at ($(\mCh@arrow@name)!\mCh@arrow@label@dist!-90:(@mCh@arrow@end)$){#3}; + }{}% + \mCh@ifeq@variable\arrow@type@actual\arrow@type@eqv{% <-> + \mCh@let@variable\arrow@type@valid\true + \expandafter\draw\expandafter[\mCh@arrow@tikz, + mCtip-mCtip, + \mCh@arrow@linethickness] + let \n1={\mCh@angle}, \n2={180+\mCh@angle} + in (@mCh@arrow@start.\n1) --node[pos=.5,inner sep=0](\mCh@arrow@name){} + ++($(\mCh@angle:\mCh@arrow@factor*\mCh@arrow@length)$); + \expandafter\node\expandafter[\mCh@arrow@uplabel@visible, + rotate=\mCh@beta, + anchor=\mCh@arrow@label@anchor@up, + minimum width=\mCh@arrow@label@width, + minimum height=\mCh@arrow@label@height,inner sep=0] + at ($(\mCh@arrow@name)!\mCh@arrow@label@dist!90:(@mCh@arrow@end)$){#2}; + \expandafter\node\expandafter[\mCh@arrow@downlabel@visible, + rotate=\mCh@beta, + anchor=\mCh@arrow@label@anchor@down, + minimum width=\mCh@arrow@label@width, + minimum height=\mCh@arrow@label@height,inner sep=0] + at ($(\mCh@arrow@name)!\mCh@arrow@label@dist!-90:(@mCh@arrow@end)$){#3}; + }{}% + \mCh@ifeq@variable\arrow@type@actual\arrow@type@back{% <- + \mCh@let@variable\arrow@type@valid\true + \expandafter\draw\expandafter[\mCh@arrow@tikz, + mCtip-, + \mCh@arrow@linethickness] + let \n1={\mCh@angle}, \n2={180+\mCh@angle} + in (@mCh@arrow@start.\n1) --node[pos=.5,inner sep=0](\mCh@arrow@name){} + ++($(\mCh@angle:\mCh@arrow@factor*\mCh@arrow@length)$); + \expandafter\node\expandafter[\mCh@arrow@uplabel@visible, + rotate=\mCh@beta, + anchor=\mCh@arrow@label@anchor@up, + minimum width=\mCh@arrow@label@width, + minimum height=\mCh@arrow@label@height, + inner sep=0] at ($(\mCh@arrow@name)!\mCh@arrow@label@dist!90:(@mCh@arrow@end)$){#2}; + \expandafter\node\expandafter[\mCh@arrow@downlabel@visible, + rotate=\mCh@beta, + anchor=\mCh@arrow@label@anchor@down, + minimum width=\mCh@arrow@label@width, + minimum height=\mCh@arrow@label@height, + inner sep=0] + at ($(\mCh@arrow@name)!\mCh@arrow@label@dist!-90:(@mCh@arrow@end)$){#3}; + }{}% + \mCh@ifeq@variable\arrow@type@actual\arrow@type@not{% -|> + \mCh@let@variable\arrow@type@valid\true + \expandafter\draw\expandafter[\mCh@arrow@tikz, + -mCtip, + \mCh@arrow@linethickness] + let \n1={\mCh@angle}, \n2={180+\mCh@angle} + in (@mCh@arrow@start.\n1) --node[pos=.5,inner sep=0](\mCh@arrow@name){} + ++($(\mCh@angle:\mCh@arrow@factor*\mCh@arrow@length)$); + \expandafter\node\expandafter[\mCh@arrow@uplabel@visible, + rotate=\mCh@beta, + anchor=\mCh@arrow@label@anchor@up, + minimum width=\mCh@arrow@label@width, + minimum height=\mCh@arrow@label@height, + inner sep=0] at ($(\mCh@arrow@name)!.8em!90:(@mCh@arrow@end)$){#2}; + \expandafter\node\expandafter[\mCh@arrow@downlabel@visible, + rotate=\mCh@beta, + anchor=\mCh@arrow@label@anchor@down, + minimum width=\mCh@arrow@label@width, + minimum height=\mCh@arrow@label@height,inner sep=0] + at ($(\mCh@arrow@name)!.8em!-90:(@mCh@arrow@end)$){#3}; + \draw ($(mCh@arrow@center)!.6em!-110:(@mCh@arrow@end)+(\mCh@angle:.1em)$) + --($(mCh@arrow@center)!.6em!70:(@mCh@arrow@end)+(\mCh@angle:.1em)$); + \draw ($(mCh@arrow@center)!.6em!-110:(@mCh@arrow@end)+(180+\mCh@angle:.1em)$) + --($(mCh@arrow@center)!.6em!70:(@mCh@arrow@end)+(180+\mCh@angle:.1em)$); + }{}% + \mCh@ifeq@variable\arrow@type@actual\arrow@type@pm{% -+> + \mCh@let@variable\arrow@type@valid\true + \mCh@let@variable\arrow@plusminus\true + \draw[-mCtip,\mCh@arrow@linethickness] + let \n1={\mCh@angle}, \n2={180+\mCh@angle} + in (@mCh@arrow@start.\n1) --node[pos=.5,inner sep=0](\mCh@arrow@name){} + ++($(\mCh@angle:\mCh@arrow@factor*\mCh@arrow@length)$); + }{}% + \mCh@ifeq@variable\arrow@type@valid\false + {\mCh@error{Unknown arrow type `\mCh@arrow@type@actual'}{}}{}% + }{% default: -> + \expandafter\draw\expandafter[\mCh@arrow@tikz, + -mCtip, + \mCh@arrow@linethickness] + let \n1={\mCh@angle}, \n2={180+\mCh@angle} + in (@mCh@arrow@start.\n1) --node[pos=.5,inner sep=0](\mCh@arrow@name){} + ++($(\mCh@angle:\mCh@arrow@factor*\mCh@arrow@length)$); + \expandafter\node\expandafter[\mCh@arrow@uplabel@visible, + rotate=\mCh@beta, + anchor=\mCh@arrow@label@anchor@up, + minimum width=\mCh@arrow@label@width, + minimum height=\mCh@arrow@label@height,inner sep=0] + at ($(\mCh@arrow@name)!\mCh@arrow@label@dist!90:(@mCh@arrow@end)$){#2}; + \expandafter\node\expandafter[\mCh@arrow@downlabel@visible, + rotate=\mCh@beta, + anchor=\mCh@arrow@label@anchor@down, + minimum width=\mCh@arrow@label@width, + minimum height=\mCh@arrow@label@height,inner sep=0] + at ($(\mCh@arrow@name)!\mCh@arrow@label@dist!-90:(@mCh@arrow@end)$){#3}; + }% + \mCh@ifempty@variable\arrow@plusminus{}{% + \ifstrempty{#2}{}{% + \draw (\mCh@arrow@name.base) edge[bend left] + ++(${0.6667}*(146.3+\mCh@angle:.5*\mCh@arrow@factor*\mCh@arrow@length)$); + \node[anchor=\mCh@arrow@label@anchor@add, + inner sep=\mCh@arrow@label@dist, + minimum width=\mCh@arrow@label@width, + minimum height=\mCh@arrow@label@height] + at ($(\mCh@arrow@name.base)+{0.6667}*(146.3+\mCh@angle:.5*\mCh@arrow@factor*\mCh@arrow@length)$) {#2}; + }% + \ifstrempty{#3}{}{% + \draw (\mCh@arrow@name.base) edge[bend right,-mCtip] + ++(${0.6667}*(33.7+\mCh@angle:.5*\mCh@arrow@factor*\mCh@arrow@length)$); + \node[anchor=\mCh@arrow@label@anchor@sub, + inner sep=\mCh@arrow@label@dist, + minimum width=\mCh@arrow@label@width, + minimum height=\mCh@arrow@label@height] + at ($(\mCh@arrow@name.base)+{0.6667}*(33.7+\mCh@angle:.5*\mCh@arrow@factor*\mCh@arrow@length)$) {#3}; + }% + }% + \mCh@set@variable\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{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 -} +\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 % \merge[<label>,<pos>,<length>]{<target>}{<start a>}{<start b>} -\def\mC@merge@length@default{3em} -\def\mC@merge@length@value{\mC@merge@length@default} -% Basisbefehle ------------------------------------------------------------------------ % -\def\mC@merge@right{ - \draw[mCtip-,\mC@arrow@linethickness] ($(\mC@merge@to.west)+(-\mC@rxn@node@distance,0)$) --node[midway,above,yshift=.1em]{\mC@merge@arg} ++(-\mC@merge@length,0) node(crossing) {}; - \draw[\mC@arrow@linethickness] ($(\mC@merge@from@one.east)+(\mC@rxn@node@distance,0)$) -| (crossing.base); - \draw[\mC@arrow@linethickness] ($(\mC@merge@from@two.east)+(\mC@rxn@node@distance,0)$) -| (crossing.base); +\mCh@new@variable\merge@length +\mCh@new@variable\merge@length@default +\mCh@new@variable\merge@length@value +\mCh@new@variable\merge@arg +\mCh@new@variable\merge@to +\mCh@new@variable\merge@from@one +\mCh@new@variable\merge@from@two + +\mCh@set@variable\merge@length@default{3em} +\mCh@let@variable\merge@length@value\merge@length@default + +% Basisbefehle +\mCh@def\mCh@merge@right{% + \draw[mCtip-,\mCh@arrow@linethickness] + ($(\mCh@merge@to.west)+(-\mCh@rxn@node@distance,0)$) + --node[midway,above,yshift=.1em]{\mCh@merge@arg} + ++(-\mCh@merge@length,0) node(crossing) {}; + \draw[\mCh@arrow@linethickness] + ($(\mCh@merge@from@one.east)+(\mCh@rxn@node@distance,0)$) -| (crossing.base); + \draw[\mCh@arrow@linethickness] + ($(\mCh@merge@from@two.east)+(\mCh@rxn@node@distance,0)$) -| (crossing.base); } -\def\mC@merge@above{ - \draw[mCtip-,\mC@arrow@linethickness] ($(\mC@merge@to.south)+(0,-\mC@rxn@node@distance)$) --node[midway,right,xshift=.1em]{\mC@merge@arg} ++(0,-\mC@merge@length) node(crossing) {}; - \draw[\mC@arrow@linethickness] (crossing.base) -| ($(\mC@merge@from@one.north)+(0,\mC@rxn@node@distance)$); - \draw[\mC@arrow@linethickness] (crossing.base) -| ($(\mC@merge@from@two.north)+(0,\mC@rxn@node@distance)$); + +\mCh@def\mCh@merge@above{% + \draw[mCtip-,\mCh@arrow@linethickness] + ($(\mCh@merge@to.south)+(0,-\mCh@rxn@node@distance)$) + --node[midway,right,xshift=.1em]{\mCh@merge@arg} + ++(0,-\mCh@merge@length) node(crossing) {}; + \draw[\mCh@arrow@linethickness] + (crossing.base) -| ($(\mCh@merge@from@one.north)+(0,\mCh@rxn@node@distance)$); + \draw[\mCh@arrow@linethickness] + (crossing.base) -| ($(\mCh@merge@from@two.north)+(0,\mCh@rxn@node@distance)$); } -\def\mC@merge@left{ - \draw[mCtip-,\mC@arrow@linethickness] ($(\mC@merge@to.east)+(\mC@rxn@node@distance,0)$) --node[midway,above,yshift=.1em]{\mC@merge@arg} ++(\mC@merge@length,0) node(crossing) {}; - \draw[\mC@arrow@linethickness] ($(\mC@merge@from@one.west)+(-\mC@rxn@node@distance,0)$) -| (crossing.base); - \draw[\mC@arrow@linethickness] ($(\mC@merge@from@two.west)+(-\mC@rxn@node@distance,0)$) -| (crossing.base); + +\mCh@def\mCh@merge@left{% + \draw[mCtip-,\mCh@arrow@linethickness] + ($(\mCh@merge@to.east)+(\mCh@rxn@node@distance,0)$) + --node[midway,above,yshift=.1em]{\mCh@merge@arg} + ++(\mCh@merge@length,0) node(crossing) {}; + \draw[\mCh@arrow@linethickness] + ($(\mCh@merge@from@one.west)+(-\mCh@rxn@node@distance,0)$) -| (crossing.base); + \draw[\mCh@arrow@linethickness] + ($(\mCh@merge@from@two.west)+(-\mCh@rxn@node@distance,0)$) -| (crossing.base); } -\def\mC@merge@below{ - \draw[mCtip-,\mC@arrow@linethickness] ($(\mC@merge@to.north)+(0,\mC@rxn@node@distance)$) --node[midway,right,xshift=.1em]{\mC@merge@arg} ++(0,\mC@merge@length) node(crossing) {}; - \draw[\mC@arrow@linethickness] (crossing.base) -| ($(\mC@merge@from@one.south)+(0,-\mC@rxn@node@distance)$); - \draw[\mC@arrow@linethickness] (crossing.base) -| ($(\mC@merge@from@two.south)+(0,-\mC@rxn@node@distance)$); + +\mCh@def\mCh@merge@below{% + \draw[mCtip-,\mCh@arrow@linethickness] + ($(\mCh@merge@to.north)+(0,\mCh@rxn@node@distance)$) + --node[midway,right,xshift=.1em]{\mCh@merge@arg} + ++(0,\mCh@merge@length) node(crossing) {}; + \draw[\mCh@arrow@linethickness] + (crossing.base) -| ($(\mCh@merge@from@one.south)+(0,-\mCh@rxn@node@distance)$); + \draw[\mCh@arrow@linethickness] + (crossing.base) -| ($(\mCh@merge@from@two.south)+(0,-\mCh@rxn@node@distance)$); } + % eigentlicher Befehl ----------------------------------------------------------------- % -\def\mC@merge{\@ifnextchar[{\mC@merge@ii}{\mC@merge@i}} -\def\mC@merge@i#1#2#3{ - \def\mC@merge@length{\mC@merge@length@value} - \let\mC@merge@arg\@empty - \def\mC@merge@to{#1} - \def\mC@merge@from@one{#2} - \def\mC@merge@from@two{#3} - \mC@merge@below -} -\def\mC@merge@ii[#1]#2#3#4{ - \let\mC@remainargs\@empty\mC@splitarg{#1} - \ifx\mC@firstarg\@empty - \let\mC@merge@arg\@empty - \else - \let\mC@merge@arg\mC@firstarg - \fi - \ifx\mC@thirdarg\@empty - \def\mC@merge@length{\mC@merge@length@value} - \else - \def\mC@merge@length{\mC@thirdarg} - \fi - \def\mC@merge@to{#2} - \def\mC@merge@from@one{#3} - \def\mC@merge@from@two{#4} - \ifx\mC@secondarg\@empty - \mC@merge@below - \else - \expandafter\csname mC@merge@\mC@secondarg\endcsname - \fi -} -\def\merge{\mC@merge} +\newrobustcmd\mCh@merge[4][]{% + \ifblank{#1} + {\mCh@merge@i}{\mCh@merge@ii[#1]} + {#2}{#3}{#4}} -\def\setmergelength#1{ - \ifx\@empty#1\@empty - \def\mC@merge@length@value{\mC@merge@length@default} - \else - \def\mC@merge@length@value{#1} - \fi +\mCh@def\mCh@merge@i#1#2#3{% + \mCh@let@variable\merge@length\merge@length@value + \mCh@empty@variable\merge@arg + \mCh@set@variable\merge@to{#1}% + \mCh@set@variable\merge@from@one{#2}% + \mCh@set@variable\merge@from@two{#3}% + \mCh@merge@below } -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% REAKTIONSSCHEMA --------------------------------------------------------------------- % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\newlength{\mC@rxn@node@distance@default} -\setlength{\mC@rxn@node@distance@default}{1em} -\newlength{\mC@rxn@node@distance} -\setlength{\mC@rxn@node@distance}{\mC@rxn@node@distance@default} -\def\setrcndist#1{% - \ifx\@empty#1\@empty% - \setlength{\mC@rxn@node@distance}{\mC@rxn@node@distance@default}% - \else% - \setlength{\mC@rxn@node@distance}{#1}% - \fi% +\mCh@def\mCh@merge@ii[#1]#2#3#4{% + \let\mCh@remainargs\@empty + \mCh@splitarg{#1}% + \mCh@ifempty@variable\firstarg + {\mCh@empty@variable\merge@arg} + {\mCh@let@variable\merge@arg\firstarg}% + \mCh@ifempty@variable\thirdarg + {\mCh@let@variable\merge@length\merge@length@value} + {\mCh@set@variable\merge@length{\mCh@thirdarg}}% + \mCh@set@variable\merge@to{#2}% + \mCh@set@variable\merge@from@one{#3}% + \mCh@set@variable\merge@from@two{#4}% + \mCh@ifempty@variable\secondarg + {\mCh@merge@below} + {\csuse{mCh@merge@\mCh@secondarg}}% } -% ------------------------------------------------------------------------------------- % -% Schema ------------------------------------------------------------------------------ % -% ------------------------------------------------------------------------------------- % + +\newrobustcmd\setmergelength[1]{% + \ifblank{#1} + {\mCh@let@variable\merge@length@value\merge@length@default} + {\mCh@set@variable\merge@length@value{#1}}} + +% -------------------------------------------------------------------------- +% REAKTIONSSCHEMA +\newlength\mCh@rxn@node@distance@default +\newlength\mCh@rxn@node@distance + +\deflength\mCh@rxn@node@distance@default{1em} +\deflength\mCh@rxn@node@distance{\mCh@rxn@node@distance@default} + +\newrobustcmd\setrcndist[1]{% + \ifblank{#1} + {\deflength\mCh@rxn@node@distance{\mCh@rxn@node@distance@default}} + {\deflength\mCh@rxn@node@distance{#1}}} + +% Schema % \begin{rxnscheme}[<label>,<placement>,<align>,<scale factor>,<name>]{<caption>} -\def\mC@rs@scale{1.0} % Default-Skalierung -\def\mC@rs@currentscale{\mC@rs@scale} % -\def\setschemename#1{\def\mC@rs@name{#1}} % -\def\mC@rs@caption{} % Beschriftung -\def\mC@rs@label{} % Label -\def\mC@rs@currentlabel{\mC@rs@label} % -\def\mC@rs@align{center} % -\def\mC@rs@right{right} % -\def\mC@rs@center{center} % -\def\mC@rs@left{left} % -\def\setschemealign#1{% % - \ifx\@empty#1\@empty% % - \def\mC@rs@align{center}% % - \else% % - \def\mC@rs@align{#1}% % - \fi% % -} % +\mCh@new@variable\rs@scale +\mCh@new@variable\rs@currentscale + +\mCh@set@variable\rs@scale{1.0} +\mCh@set@variable\rs@currentscale{\mCh@rs@scale} + +\newrobustcmd\setschemename[1]{% + \mCh@set@variable\rs@name{#1}} + +\mCh@new@variable\rs@caption +\mCh@new@variable\rs@label +\mCh@new@variable\rs@currentlabel +\mCh@new@variable\rs@align +\mCh@new@variable\rs@right +\mCh@new@variable\rs@center +\mCh@new@variable\rs@left + +\mCh@let@variable\rs@currentlabel\rs@label +\mCh@set@variable\rs@align{center} +\mCh@set@variable\rs@right{right} +\mCh@set@variable\rs@center{center} +\mCh@set@variable\rs@left{left} + +\newrobustcmd\setschemealign[1]{% + \ifblank{#1} + {\mCh@set@variable\rs@align{center}} + {\mCh@set@variable\rs@align{#1}}} + % Gleitumgebung \floatstyle{ruled} -\newfloat{rxnfloat}{\mC@rs@currentplacement}{rxnscheme} -\floatname{rxnfloat}{\mC@rs@name} % Name ändern +\newfloat{rxnfloat}{\mCh@rs@currentplacement}{rxnscheme} +\floatname{rxnfloat}{\mCh@rs@name}% Name ändern + % eigentliche Umgebung: -\def\mC@rxnscheme{\@ifnextchar[{\mC@rxnscheme@ii}{\let\mC@rs@currentlabel\@empty\mC@rxnscheme@i}} -\def\mC@rxnscheme@ii[#1]{% [<label>,<placement>,<align>,<scale>,<name>] - \let\mC@remainargs\@empty\mC@splitarg{#1}% - \ifx\@empty\mC@firstarg% erste Option - \let\mC@rs@currentlabel\@empty% - \else% - \let\mC@rs@currentlabel\mC@firstarg% - \fi% - \ifx\@empty\mC@secondarg% zweite Option - \let\mC@rs@currentplacement\mC@rs@placement% - \else% - \let\mC@rs@currentplacement\mC@secondarg% - \fi% - \let\mC@remainargs\@empty% - \expandafter\mC@splitarg\expandafter{\mC@thirdarg}% - \ifx\@empty\mC@firstarg% dritte Option - \def\mC@rs@align{center}% - \else% - \let\mC@rs@align\mC@firstarg% - \fi% - \ifx\@empty\mC@secondarg% vierte Option - \def\mC@rs@currentscale{1}% - \else% - \let\mC@rs@currentscale\mC@secondarg% - \fi% - \ifx\@empty\mC@thirdarg\else% fünfte Option - \let\mC@rs@name\mC@thirdarg% - \fi% - \mC@rxnscheme@i% +\newrobustcmd\mCh@rxnscheme[2][]{% + \ifblank{#1} + {\mCh@rxnscheme@i} + {\mCh@empty@variable\rs@currentlabel\mCh@rxnscheme@ii[#1]}% + {#2}} + +\mCh@def\mCh@rxnscheme@ii[#1]#2{% [<label>,<placement>,<align>,<scale>,<name>] + \let\mCh@remainargs\@empty + \mCh@splitarg{#1}% + \mCh@ifempty@variable\firstarg% erste Option + {\mCh@empty@variable\rs@currentlabel} + {\mCh@let@variable\rs@currentlabel\firstarg}% + \mCh@ifempty@variable\secondarg% zweite Option + {\mCh@let@variable\rs@currentplacement\rs@placement} + {\mCh@let@variable\rs@currentplacement\secondarg}% + \let\mCh@remainargs\@empty + \expandafter\mCh@splitarg\expandafter{\mCh@thirdarg}% + \mCh@ifempty@variable\firstarg% dritte Option + {\mCh@set@variable\rs@align{center}} + {\mCh@let@variable\rs@align\firstarg}% + \mCh@ifempty@variable\secondarg% vierte Option + {\mCh@set@variable\rs@currentscale{1}} + {\mCh@let@variable\rs@currentscale\secondarg}% + \mCh@ifempty@variable\thirdarg{}% fünfte Option + {\mCh@let@variable\rs@name\thirdarg}% + \mCh@rxnscheme@i{#2}% } -\def\mC@rxnscheme@i#1{% - \let\arrow\mC@arrow% - \let\reactant\mC@reactant% - \let\mesomeric\mC@mesomeric% - \let\transition\mC@transition% - \let\anywhere\mC@anywhere% - \let\dummy\mC@dummy% - \let\branch\mC@branch% - \let\chemand\mC@chemand% - \def\mC@rs@caption{#1}% - \rxnfloat% - \ifx\mC@rs@align\mC@rs@center \centering \fi% - \ifx\mC@rs@align\mC@rs@left \raggedright \fi% - \ifx\mC@rs@align\mC@rs@right \raggedleft \fi% - \mC@atomsize\mC@bondlength\mC@bondshape% - \tikzpicture[every picture/.style={scale=\mC@rs@currentscale},start chain,node distance=\mC@rxn@node@distance,inner sep=0pt,outer sep=0pt]% - \mC@dummy@ii% + +\mCh@def\mCh@scheme@enable{% + \let\arrow\mCh@arrow + \let\reactant\mCh@reactant + \let\mesomeric\mCh@mesomeric + \let\transition\mCh@transition + \let\anywhere\mCh@anywhere + \let\dummy\mCh@dummy + \let\branch\mCh@branch + \let\chemand\mCh@chemand + \let\merge\mCh@merge +% \let\elmove\mCh@elmove } -\def\rxnscheme{\mC@rxnscheme} -\def\endrxnscheme{% - \endtikzpicture% - \caption{\mC@rs@caption}% - \ifx\@empty\mC@rs@currentlabel\else% - \label{\mC@rs@currentlabel}% - \fi - \endrxnfloat% - \let\arrow\relax% - \let\reactant\relax% - \let\mesomeric\relax% - \let\transition\relax% - \let\anywhere\relax% - \let\dummy\relax% - \let\branch\relax% - \let\chemand\relax% + +\mCh@def\mCh@scheme@disable{% + \let\arrow\relax + \let\reactant\relax + \let\mesomeric\relax + \let\transition\relax + \let\anywhere\relax + \let\dummy\relax + \let\branch\relax + \let\chemand\relax + \let\merge\relax +% \let\elmove\relax } -% ------------------------------------------------------------------------------------- % -% einfache Reaktion ------------------------------------------------------------------- % -% ------------------------------------------------------------------------------------- % -% \begin{rxn}[<align>,<scalefactor>] -\def\mC@reaction@scale{1.0} -\def\mC@reaction@align{center} -\def\setrxnalign#1{ - \ifx\@empty#1\@empty - \def\mC@reaction@align{center} - \else - \def\mC@reaction@align{#1} - \fi +\mCh@def\mCh@rxnscheme@i#1{% + \mCh@scheme@enable + \mCh@set@variable\rs@caption{#1}% + \rxnfloat + \mCh@ifeq@variable\rs@align\rs@center{\centering}{}% + \mCh@ifeq@variable\rs@align\rs@left{\raggedright}{}% + \mCh@ifeq@variable\rs@align\rs@right{\raggedleft}{}% + \mCh@atomsize\mCh@bondlength\mCh@bondshape + \tikzpicture[ + every picture/.style={scale=\mCh@rs@currentscale}, + start chain, + node distance=\mCh@rxn@node@distance, + inner sep=0pt, + outer sep=0pt] + \mCh@dummy } -\def\mC@reaction@right{right} -\def\mC@reaction@center{center} -\def\mC@reaction@left{left} - -\def\mC@rxn{\@ifnextchar[{\mC@rxn@ii}{\mC@rxn@i}} -\def\mC@rxn@ii[#1]{% - \let\mC@remainargs\@empty\mC@splitarg{#1}% - \ifx\@empty\mC@firstarg% - \let\mC@reaction@align\mC@reaction@center% - \else% - \let\mC@reaction@align\mC@firstarg% - \fi% - \ifx\@empty\mC@secondarg% - \def\mC@reaction@scale{1}% - \else% - \let\mC@reaction@scale\mC@secondarg% - \fi% - \mC@rxn@i + +\newenvironment{rxnscheme}{\mCh@rxnscheme}{% + \endtikzpicture + \caption{\mCh@rs@caption}% + \mCh@ifempty@variable\rs@currentlabel{} + {\label{\mCh@rs@currentlabel}}% + \endrxnfloat + \mCh@scheme@disable +} + +% ---------------------------------------------------------------------------- +% einfache Reaktion +% \begin{rxn}[<align>,<scalefactor>] +\mCh@new@variable\reaction@scale +\mCh@new@variable\reaction@align + +\mCh@set@variable\reaction@scale{1.0} +\mCh@set@variable\reaction@align{center} + +\newrobustcmd\setrxnalign[1]{% + \ifblank{#1} + {\mCh@set@variable\reaction@align{center}} + {\mCh@set@variable\reaction@align{#1}}} + +\mCh@new@variable\reaction@right +\mCh@new@variable\reaction@center +\mCh@new@variable\reaction@left + +\mCh@set@variable\reaction@right{right} +\mCh@set@variable\reaction@center{center} +\mCh@set@variable\reaction@left{left} + +\newrobustcmd\mCh@rxn[1][]{% + \ifblank{#1} + {\mCh@rxn@i}{\mCh@rxn@ii[#1]}} + +\mCh@def\mCh@rxn@ii[#1]{% + \let\mCh@remainargs\@empty + \mCh@splitarg{#1}% + \mCh@ifempty@variable\firstarg + {\mCh@let@variable\reaction@align\reaction@center} + {\mCh@let@variable\reaction@align\firstarg}% + \mCh@ifempty@variable\secondarg + {\mCh@set@variable\reaction@scale{1}} + {\mCh@let@variable\reaction@scale\secondarg}% + \mCh@rxn@i } -\def\mC@rxn@i{% - \let\arrow\mC@arrow% - \let\reactant\mC@reactant% - \let\mesomeric\mC@mesomeric% - \let\transition\mC@transition% - \let\anywhere\mC@anywhere% - \let\dummy\mC@dummy% - \let\branch\mC@branch% - \let\chemand\mC@chemand% + +\mCh@def\mCh@rxn@i{% + \mCh@scheme@enable \hspace*{0pt}% - \ifx\mC@reaction@align\mC@reaction@center% - \center% - \fi% - \ifx\mC@reaction@align\mC@reaction@left% - \flushleft% - \fi% - \ifx\mC@reaction@align\mC@reaction@right% - \flushright% - \fi% - \mC@bondlength\mC@bondshape\mC@atomsize% - \begin{tikzpicture}[every picture/.style={scale=\mC@reaction@scale},start chain,node distance=\mC@rxn@node@distance,inner sep=0pt,outer sep=0pt]% - \mC@dummy@ii% + \mCh@ifeq@variable\reaction@align\reaction@center{\center}{}% + \mCh@ifeq@variable\reaction@align\reaction@left{\flushleft}{}% + \mCh@ifeq@variable\reaction@align\reaction@right{\flushright}{}% + \mCh@bondlength\mCh@bondshape\mCh@atomsize + \begin{tikzpicture}[ + every picture/.style={scale=\mCh@reaction@scale}, + start chain, + node distance=\mCh@rxn@node@distance, + inner sep=0pt, + outer sep=0pt] + \mCh@dummy } -\def\rxn{\mC@rxn} -\def\endrxn{% + +\newenvironment{rxn}{\mCh@rxn}{% \end{tikzpicture}% - \ifx\mC@reaction@align\mC@reaction@center% - \endcenter% - \fi% - \ifx\mC@reaction@align\mC@reaction@left% - \endflushleft% - \fi% - \ifx\mC@reaction@align\mC@reaction@right% - \endflushright% - \fi - \let\arrow\relax% - \let\arrow\relax% - \let\reactant\relax% - \let\mesomeric\relax% - \let\transition\relax% - \let\anywhere\relax% - \let\dummy\relax% - \let\branch\relax% - \let\chemand\relax% + \mCh@ifeq@variable\reaction@align\reaction@center{\endcenter}{}% + \mCh@ifeq@variable\reaction@align\reaction@left{\endflushleft}{}% + \mCh@ifeq@variable\reaction@align\reaction@right{\endflushright}{}% + \mCh@scheme@disable } -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% REAKTANDEN -------------------------------------------------------------------------- % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Standardreaktand -------------------------------------------------------------------- % +% -------------------------------------------------------------------------- +% REAKTANDEN +% Standardreaktand % \reactant[<pos>,<name>,<tikz>]{<something>} -\def\mC@reactant{\@ifnextchar[{\mC@reactant@ii}{\mC@reactant@i}} -\def\mC@reactant@i#1{ - \expandafter\node\expandafter[\mC@reactant@visible,on chain=going {at=(\tikzchainprevious.0)},anchor=180,shift=(0:\mC@rxn@node@distance)]{\scantokens{\relax#1}}; +\newrobustcmd\mCh@reactant[2][]{% + \ifblank{#1} + {\mCh@reactant@i}{\mCh@reactant@ii[#1]} + {#2}} + +\mCh@def\mCh@reactant@i#1{% + \expandafter\node\expandafter[% + \mCh@reactant@visible, + on chain=going {at=(\tikzchainprevious.0)}, + anchor=180, + shift=(0:\mCh@rxn@node@distance)]{\scantokens{\relax#1}}; } -\def\mC@reactant@ii[#1]#2{ - \let\mC@remainargs\@empty\mC@splitarg{#1} - \ifx\@empty\mC@firstarg% erste Option: <pos>, zweite Option: <name>, dritte Option: <tikz> - \def\mC@angle{0} - \def\mC@anchor{180} - \let\mC@referred@node\@empty - \else - \expandafter\mC@analyze@angle\expandafter{\mC@firstarg} - \def\mC@anchor{180+\mC@angle} - \fi - \ifx\mC@referred@node\@empty\def\mC@referred@node{\tikzchainprevious}\fi - \expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@thirdarg\expandafter,\mC@reactant@visible,on chain=going {at=(\mC@referred@node.\mC@angle)},anchor=\mC@anchor,shift=(\mC@angle:\mC@rxn@node@distance)](\mC@secondarg){\scantokens{\relax#2}}; + +\mCh@def\mCh@reactant@ii[#1]#2{% + \let\mCh@remainargs\@empty\mCh@splitarg{#1}% + \mCh@ifempty@variable\firstarg{% erste Option: <pos>, zweite Option: <name>, dritte Option: <tikz> + \mCh@set@variable\angle{0}% + \mCh@set@variable\anchor{180}% + \mCh@empty@variable\referred@node + }{% + \expandafter\mCh@analyze@angle\expandafter{\mCh@firstarg}% + \mCh@set@variable\anchor{180+\mCh@angle}% + }% + \mCh@ifempty@variable\referred@node + {\mCh@set@variable\referred@node{\tikzchainprevious}}{}% + \expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[% + \expandafter\mCh@thirdarg\expandafter,% + \mCh@reactant@visible, + on chain=going {at=(\mCh@referred@node.\mCh@angle)}, + anchor=\mCh@anchor,shift=(\mCh@angle:\mCh@rxn@node@distance)] + (\mCh@secondarg){\scantokens{\relax#2}}; } -% Mesomerie --------------------------------------------------------------------------- % +% Mesomerie % \mesomeric[<pos>,<name>,<tikz>]{<something>} -\def\mC@mesomeric{\@ifnextchar[{\mC@mesomeric@ii}{\mC@mesomeric@i}} -\def\mC@mesomeric@i#1{ - \node[on chain=going {at=(\tikzchainprevious.0),shift=($(0:\mC@rxn@node@distance)$)},anchor=180,shift=(0:\mC@rxn@node@distance),inner sep=1pt,left delimiter={[},right delimiter={]}]{\tikzpicture[start branch]\scantokens{\relax#1}\endtikzpicture}; +\newrobustcmd\mCh@mesomeric[2][]{% + \ifblank{#1} + {\mCh@mesomeric@i}{\mCh@mesomeric@ii[#1]} + {#2}} + +\mCh@def\mCh@mesomeric@i#1{% + \node[on chain=going {at=(\tikzchainprevious.0), + shift=($(0:\mCh@rxn@node@distance)$)}, + anchor=180,shift=(0:\mCh@rxn@node@distance), + inner sep=1pt, + left delimiter={[}, + right delimiter={]}] + {\tikzpicture[start branch]\scantokens{\relax#1}\endtikzpicture}; } -\def\mC@mesomeric@ii[#1]#2{ - \let\mC@remainargs\@empty\mC@splitarg{#1} - \ifx\@empty\mC@firstarg% erste Option: <pos>, zweite Option: <name>, dritte Option: <tikz> - \def\mC@angle{0} - \def\mC@anchor{180} - \let\mC@referred@node\@empty - \else - \expandafter\mC@analyze@angle\expandafter{\mC@firstarg} - \def\mC@anchor{180+\mC@angle} - \fi - \ifx\mC@referred@node\@empty\def\mC@referred@node{\tikzchainprevious}\fi - \expandafter\node\expandafter[\mC@thirdarg,on chain=going {at=(\mC@referred@node.\mC@angle)},anchor=\mC@anchor,shift=(\mC@angle:\mC@rxn@node@distance),inner sep=1pt,left delimiter={[},right delimiter={]}](\mC@secondarg){\tikzpicture[start branch]\scantokens{\relax#2}\endtikzpicture}; + +\mCh@def\mCh@mesomeric@ii[#1]#2{% + \let\mCh@remainargs\@empty + \mCh@splitarg{#1}% + \mCh@ifempty@variable\firstarg{% erste Option: <pos>, zweite Option: <name>, dritte Option: <tikz> + \mCh@set@variable\angle{0}% + \mCh@set@variable\anchor{180}% + \mCh@empty@variable\referred@node + }{% + \expandafter\mCh@analyze@angle\expandafter{\mCh@firstarg}% + \mCh@set@variable\anchor{180+\mCh@angle}% + }% + \mCh@ifempty@variable\referred@node + {\mCh@set@variable\referred@node{\tikzchainprevious}}{}% + \expandafter\node\expandafter[\mCh@thirdarg, + on chain=going {at=(\mCh@referred@node.\mCh@angle)}, + anchor=\mCh@anchor, + shift=(\mCh@angle:\mCh@rxn@node@distance), + inner sep=1pt, + left delimiter={[}, + right delimiter={]}] + (\mCh@secondarg){\tikzpicture[start branch]\scantokens{\relax#2}\endtikzpicture}; } -% Mesomerie-Pfeil --------------------------------------------------------------------- % +% Mesomerie-Pfeil % \marrow[<pos>] -\def\marrow{\@ifnextchar[{\mC@marrow@ii}{\mC@marrow@i}} -\def\mC@marrow@ii[#1]{\arrow[#1,<->,.5]{}{}} -\def\mC@marrow@i{\arrow[,<->,.5]{}{}} +\newrobustcmd\marrow[1][]{\arrow[#1,<->,.5]{}{}} -% Anywhere ---------------------------------------------------------------------------- % +% Anywhere % \anywhere{<pos>,<name>,<tikz>}{<something>} -\def\mC@anywhere#1#2{ - \let\mC@remainargs\@empty\mC@splitarg{#1}% erste Option: <pos>, zweite Option: <name>, dritte Option: <tikz> - \ifx\mC@firstarg\@empty - \PackageError{mychemistry}{\string\anywhere: positioning missing}{See the myChemistry package documentation for explanation} - \else - \expandafter\mC@if@instr\expandafter{\mC@firstarg}{=}{ - \edef\mC@anywhere@positioning{\mC@firstarg} - }{ - \expandafter\mC@analyze@angle\expandafter{\mC@firstarg} - \def\mC@anchor{180+\mC@angle} - \ifx\mC@referred@node\@empty - \PackageError{mychemistry}{You can't use `angle' to position \string\anywhere. You need to use `name.angle'}{See the myChemistry package documentation for explanation} - \else - \def\mC@anywhere@positioning{at=(\mC@referred@node.\mC@angle),anchor=\mC@anchor} - \fi - } - \fi - \expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@thirdarg\expandafter,\mC@anywhere@positioning](\mC@secondarg){#2}; +\mCh@new@variable\anywhere@positioning + +\newrobustcmd\mCh@anywhere[2]{% + \let\mCh@remainargs\@empty + \mCh@splitarg{#1}% erste Option: <pos>, zweite Option: <name>, dritte Option: <tikz> + \mCh@ifempty@variable\firstarg{% + \mCh@error{\string\anywhere: positioning missing}{}% + }{% + \expandafter\mCh@if@instr\expandafter{\mCh@firstarg}{=}{% + \mCh@xset@variable\anywhere@positioning{\mCh@firstarg}% + }{% + \expandafter\mCh@analyze@angle\expandafter{\mCh@firstarg}% + \mCh@set@variable\anchor{180+\mCh@angle}% + \mCh@ifempty@variable\referred@node{% + \mCh@error{You can't use `angle' to position \string\anywhere. + You need to use `name.angle'}% + }{% + \mCh@set@variable\anywhere@positioning{% + at=(\mCh@referred@node.\mCh@angle),anchor=\mCh@anchor}% + }% + }% + }% + \expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[% + \expandafter\mCh@thirdarg\expandafter,% + \mCh@anywhere@positioning](\mCh@secondarg){#2}; } -% Dummy ------------------------------------------------------------------------------- % +% Dummy % \dummy[<name>] -\def\mC@dummy{\@ifnextchar[{\mC@dummy@i}{\mC@dummy@ii}} -\def\mC@dummy@i[#1]{\draw node[on chain,xshift=-\mC@rxn@node@distance](#1){};} -\def\mC@dummy@ii{\draw node[on chain,xshift=-\mC@rxn@node@distance]{};} +\newrobustcmd\mCh@dummy[1][]{% + \ifblank{#1} + {\draw node[on chain,xshift=-\mCh@rxn@node@distance]{};} + {\draw node[on chain,xshift=-\mCh@rxn@node@distance](#1){};}} -% Uebergangszustand ------------------------------------------------------------------- % +% Uebergangszustand % \transition[<pos>,<name>,<tikz>]{<something>} -\def\mC@transition{\@ifnextchar[{\mC@transition@ii}{\mC@transition@i}} -\def\mC@transition@i#1{ - \expandafter\node\expandafter[\mC@reactant@visible,on chain=going {at=(\tikzchainprevious.0)},anchor=180,shift=(0:\mC@rxn@node@distance),anchor=180,inner sep=3pt,left delimiter={[},right delimiter={]}](mC@transition@name){\scantokens{\relax#1}}; - \node at ($(mC@transition@name.north east)+(.7em,0)$) {$\ddagger$}; +\mCh@new@variable\transition@name + +\newrobustcmd\mCh@transition[2][]{% + \ifblank{#1} + {\mCh@transition@i}{\mCh@transition@ii[#1]} + {#2}} + +\mCh@def\mCh@transition@i#1{% + \expandafter\node\expandafter[\mCh@reactant@visible, + on chain=going {at=(\tikzchainprevious.0)}, + anchor=180, + shift=(0:\mCh@rxn@node@distance), + anchor=180, + inner sep=3pt, + left delimiter={[}, + right delimiter={]}] + (mCh@transition@name){\scantokens{\relax#1}}; + \node at ($(mCh@transition@name.north east)+(.7em,0)$) {$\transitionstatesymbol$}; } -\def\mC@transition@ii[#1]#2{ - \let\mC@remainargs\@empty\mC@splitarg{#1} - \ifx\@empty\mC@firstarg% erste Option: <pos> - \def\mC@angle{0} - \def\mC@anchor{180} - \let\mC@referred@node\@empty - \else - \expandafter\mC@analyze@angle\expandafter{\mC@firstarg} - \def\mC@anchor{180+\mC@angle} - \fi - \ifx\@empty\mC@secondarg% zweite Option: <name>, dritte Option: <tikz> - \def\mC@transition@name{mC@transition@name} - \else - \let\mC@transition@name\mC@secondarg - \fi - \ifx\mC@referred@node\@empty\def\mC@referred@node{\tikzchainprevious}\fi - \expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\mC@reactant@visible\expandafter,\mC@thirdarg,on chain=going {at=(\mC@referred@node.\mC@angle)},anchor=\mC@anchor,shift=(\mC@angle:\mC@rxn@node@distance),inner sep=3pt,left delimiter={[},right delimiter={]}](\mC@transition@name){\scantokens{\relax#2}}; - \node at ($(\mC@transition@name.north east)+(.7em,0)$) {$\ddagger$}; + +\mCh@def\mCh@transition@ii[#1]#2{% + \let\mCh@remainargs\@empty + \mCh@splitarg{#1}% + \mCh@ifempty@variable\firstarg{% erste Option: <pos> + \mCh@set@variable\angle{0}% + \mCh@set@variable\anchor{180}% + \mCh@empty@variable\referred@node + }{% + \expandafter\mCh@analyze@angle\expandafter{\mCh@firstarg}% + \mCh@set@variable\anchor{180+\mCh@angle}% + }% + \mCh@ifempty@variable\secondarg% zweite Option: <name>, dritte Option: <tikz> + {\mCh@set@variable\transition@name{mCh@transition@name}} + {\mCh@let@variable\transition@name\secondarg}% + \mCh@ifempty@variable\referred@node + {\mCh@set@variable\referred@node{\tikzchainprevious}}{}% + \expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[% + \mCh@reactant@visible\expandafter,% + \mCh@thirdarg, + on chain=going {at=(\mCh@referred@node.\mCh@angle)}, + anchor=\mCh@anchor, + shift=(\mCh@angle:\mCh@rxn@node@distance), + inner sep=3pt, + left delimiter={[}, + right delimiter={]}] + (\mCh@transition@name){\scantokens{\relax#2}}; + \node at ($(\mCh@transition@name.north east)+(.7em,0)$) {$\transitionstatesymbol$}; } -% Abzweigung -------------------------------------------------------------------------- % +% Abzweigung % \branch[<pos>,<name>,<tikz>]{<formulae>} % <pos>: default: on chain=going "right" (0°) % on chain=going <somewhere> % <somewhere>=of <name> % <angle> (sitzt auf der Kette) % <name>.<angle> (sitzt nicht auf der Kette) -\def\mC@branch{\@ifnextchar[{\mC@branch@ii}{\mC@branch@i}} -\def\mC@branch@i#1{ - \expandafter\def\expandafter\mC@branch@positioning\expandafter{\mC@branch@visible,on chain=going {at=(\tikzchainprevious.0)},anchor=180,shift=(0:\mC@rxn@node@distance)} - \let\mC@secondarg\@empty\let\mC@thirdarg\@empty - \mC@branch@iii{#1}} -\def\mC@branch@ii[#1]#2{ - \let\mC@remainargs\@empty\mC@splitarg{#1}% erste Option: <pos>, zweite Option: <name>, dritte Option: <tikz> - \ifx\mC@firstarg\@empty - \expandafter\def\expandafter\mC@branch@positioning\expandafter{\mC@branch@visible,on chain=going {at=(\tikzchainprevious.0)},anchor=180,shift=(0:\mC@rxn@node@distance)} - \else - \expandafter\mC@if@instr\expandafter{\mC@firstarg}{=}{ - \edef\mC@branch@positioning{\mC@branch@visible,\mC@firstarg} - }{ - \expandafter\mC@analyze@angle\expandafter{\mC@firstarg} - \def\mC@anchor{180+\mC@angle} - \ifx\mC@referred@node\@empty - \expandafter\def\expandafter\mC@branch@positioning\expandafter{\mC@branch@visible,on chain=going {at=(\tikzchainprevious.\mC@angle)},anchor=\mC@anchor,shift=(\mC@angle:\mC@rxn@node@distance)} - \else - \expandafter\def\expandafter\mC@branch@positioning\expandafter{\mC@branch@visible,at=(\mC@referred@node.\mC@angle),anchor=\mC@anchor,shift=(\mC@angle:\mC@rxn@node@distance)} - \fi - } - \fi - \mC@branch@iii{#2}} -\def\mC@branch@iii#1{ - \expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@branch@positioning\expandafter,\mC@thirdarg](\mC@secondarg){\tikzpicture[start branch]\scantokens{\relax#1}\endtikzpicture};}% scantokens nötig, da sonst eine Dreifachbindung ~ vor () mit falschem catcode interpretiert wird - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Sonstiges --------------------------------------------------------------------------- % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Elektronenverschiebungspfeile ------------------------------------------------------- % -\def\mC@elmove{\@ifnextchar[{\mC@elmove@i}{\mC@elmove@ii}} -\def\mC@elmove@i[#1]#2#3#4#5{\chemmove{\draw[#1](#2).. controls +(#3) and +(#5)..(#4);}} -\def\mC@elmove@ii#1#2#3#4{\chemmove{\draw[->,red,shorten <=3pt,shorten >=1pt](#1).. controls +(#2) and +(#4)..(#3);}} -\let\elmove\mC@elmove - -% Plus -------------------------------------------------------------------------------- % -\def\mC@chemand{\@ifnextchar[{\mC@chemand@ii}{\mC@chemand@i}} -\def\mC@chemand@i{\reactant{\chemsign[0pt]{+}}} -\def\mC@chemand@ii[#1]{\reactant[#1]{\chemsign[0pt]{+}}} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Setup myChemistry ------------------------------------------------------------------- % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Bindungslänge ----------------------------------------------------------------------- % -\def\mC@bondlength@default{1.8em} -\def\mC@bondlength{\setatomsep{\mC@bondlength@default}} -\def\setbondlength#1{ - \ifx\@empty#1\@empty - \def\mC@bondlength{\setatomsep{\mC@bondlength@default}} - \else - \def\mC@bondlength{\setatomsep{#1}} - \fi -} +\mCh@new@variable\branch@positioning -% Keilbindungen ----------------------------------------------------------------------- % -\def\mC@bondshape@one{3pt} -\def\mC@bondshape@two{.5pt} -\def\mC@bondshape@three{1pt} -\def\setbondshape#1#2#3{ - \ifx\@empty#1\@empty - \renewcommand{\mC@bondshape@one}{3pt} - \else - \renewcommand{\mC@bondshape@one}{#1} - \fi - \ifx\@empty#2\@empty - \renewcommand{\mC@bondshape@two}{.5pt} - \else - \renewcommand{\mC@bondshape@two}{#2} - \fi - \ifx\@empty#3\@empty - \renewcommand{\mC@bondshape@three}{1pt} - \else - \renewcommand{\mC@bondshape@three}{#3} - \fi -} -\def\mC@bondshape{\setcrambond{\mC@bondshape@one}{\mC@bondshape@two}{\mC@bondshape@three}} - -% Atomgröße --------------------------------------------------------------------------- % -\def\mC@atomsize@default{\small} -\def\mC@atomsize{\mC@atomsize@default} -\def\setatomsize#1{ - \ifx\@empty#1\@empty - \renewcommand{\mC@atomsize}{\mC@atomsize@default} - \else - \renewcommand{\mC@atomsize}{#1} - \fi +\newrobustcmd\mCh@branch[2][]{% + \ifblank{#1} + {\mCh@branch@i}{\mCh@branch@ii[#1]} + {#2}} + +\mCh@def\mCh@branch@i#1{% + \expandafter\mCh@set@variable\expandafter\branch@positioning\expandafter{\mCh@branch@visible, + on chain=going {at=(\tikzchainprevious.0)}, + anchor=180, + shift=(0:\mCh@rxn@node@distance)}% + \mCh@empty@variable\secondarg + \mCh@empty@variable\thirdarg + \mCh@branch@iii{#1}} + +\mCh@def\mCh@branch@ii[#1]#2{% + \let\mCh@remainargs\@empty + \mCh@splitarg{#1}% erste Option: <pos>, zweite Option: <name>, dritte Option: <tikz> + \mCh@ifempty@variable\firstarg{% + \expandafter\mCh@set@variable\expandafter\branch@positioning\expandafter{\mCh@branch@visible, + on chain=going {at=(\tikzchainprevious.0)}, + anchor=180, + shift=(0:\mCh@rxn@node@distance)}% + }{% + \expandafter\mCh@if@instr\expandafter{\mCh@firstarg}{=}{% + \mCh@xset@variable\branch@positioning{\mCh@branch@visible,\mCh@firstarg}% + }{% + \expandafter\mCh@analyze@angle\expandafter{\mCh@firstarg}% + \mCh@set@variable\anchor{180+\mCh@angle}% + \mCh@ifempty@variable\referred@node{% + \expandafter\mCh@set@variable\expandafter\branch@positioning\expandafter{\mCh@branch@visible, + on chain=going {at=(\tikzchainprevious.\mCh@angle)}, + anchor=\mCh@anchor, + shift=(\mCh@angle:\mCh@rxn@node@distance)}% + }{% + \expandafter\mCh@set@variable\expandafter\branch@positioning\expandafter{\mCh@branch@visible, + at=(\mCh@referred@node.\mCh@angle), + anchor=\mCh@anchor, + shift=(\mCh@angle:\mCh@rxn@node@distance)}% + }% + }% + }% + \mCh@branch@iii{#2}} + +\mCh@def\mCh@branch@iii#1{% + \expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[% + \expandafter\mCh@branch@positioning\expandafter,% + \mCh@thirdarg] + (\mCh@secondarg){\tikzpicture[start branch]\scantokens{\relax#1}\endtikzpicture};}% + % scantokens nötig, da sonst eine Dreifachbindung ~ vor () mit falschem + % catcode interpretiert wird + +% -------------------------------------------------------------------------- +% Sonstiges +% Elektronenverschiebungspfeile +\mCh@new@variable\elmove@default@tikz +\mCh@new@variable\elmove@tikz + +\mCh@set@variable\elmove@default@tikz{->,red,shorten <=3pt,shorten >=1pt} +\mCh@let@variable\elmove@tikz\elmove@default@tikz + +\newrobustcmd\elmove[5][\mCh@elmove@tikz]{% + \chemmove{\expandafter\draw\expandafter[#1](#2).. controls +(#3) and +(#5)..(#4);}} + +\newrobustcmd\setelmove[1]{% + \ifblank{#1} + {\mCh@let@variable\elmove@tikz\elmove@default@tikz} + {\mCh@set@variable\elmove@tikz{#1}}} + +% Plus +\newrobustcmd\mCh@chemand[1][]{% + \ifblank{#1} + {\reactant{\chemsign[0pt]{+}}} + {\reactant[#1]{\chemsign[0pt]{+}}}} + +% -------------------------------------------------------------------------- +% Setup myChemistry +% Bindungslänge +\mCh@new@variable\bondlength@default +\mCh@new@variable\bondlength + +\mCh@set@variable\bondlength@default{1.8em} +\mCh@set@variable\bondlength{\setatomsep{\mCh@bondlength@default}} + +\newrobustcmd\setbondlength[1]{% + \ifblank{#1} + {\mCh@set@variable\bondlength{\setatomsep{\mCh@bondlength@default}}} + {\mCh@set@variable\bondlength{\setatomsep{#1}}}} + +% Keilbindungen +\mCh@new@variable\bondshape@one +\mCh@new@variable\bondshape@two +\mCh@new@variable\bondshape@three + +\mCh@set@variable\bondshape@one{3pt} +\mCh@set@variable\bondshape@two{.5pt} +\mCh@set@variable\bondshape@three{1pt} + +\newrobustcmd\setbondshape[3]{% + \ifblank{#1} + {\mCh@set@variable\bondshape@one{3pt}} + {\mCh@set@variable\bondshape@one{#1}}% + \ifblank{#2} + {\mCh@set@variable\bondshape@two{.5pt}} + {\mCh@set@variable\bondshape@two{#2}}% + \ifblank{#3} + {\mCh@set@variable\bondshape@three{1pt}} + {\mCh@set@variable\bondshape@three{#3}}% } -% allg. Setup ------------------------------------------------------------------------- % -\def\mCsetup#1{\setkeys{setup}{#1}} -\define@key{setup}{arrowlabel}[\mC@arrow@label@dist@def]{% +\mCh@new@variable\bondshape +\mCh@set@variable\bondshape{% + \setcrambond{\mCh@bondshape@one}{\mCh@bondshape@two}{\mCh@bondshape@three}} + +% Atomgröße +\mCh@new@variable\atomsize@default +\mCh@new@variable\atomsize + +\mCh@set@variable\atomsize@default{\small} +\mCh@let@variable\atomsize\atomsize@default + +\newrobustcmd\setatomsize[1]{% + \ifblank{#1} + {\mCh@let@variable\atomsize\atomsize@default} + {\mCh@set@variable\atomsize{#1}}} + +% allg. Setup +\newrobustcmd\mCsetup[1]{\setkeys{mCh@setup}{#1}} + +\define@key{mCh@setup}{arrowlabel}[\mCh@arrow@label@dist@def]{% \setarrowlabel{#1}} -\define@key{setup}{arrowlength}[\mC@arrow@length@def]{% +\define@key{mCh@setup}{arrowlength}[\mCh@arrow@length@def]{% \setarrowlength{#1}} -\define@key{setup}{arrowline}[\mC@arrow@linethickness@default]{% +\define@key{mCh@setup}{arrowline}[\mCh@arrow@linethickness@default]{% \setarrowline{#1}} -\define@key{setup}{atomsize}[\mC@atomsize@default]{% +\define@key{mCh@setup}{atomsize}[\mCh@atomsize@default]{% \setatomsize{#1}} -\define@key{setup}{bondlength}[\mC@bondlength@default]{% +\define@key{mCh@setup}{bondlength}[\mCh@bondlength@default]{% \setbondlength{#1}} -% \define@key{setup}{bondshape}[{\mC@bondshape@one,\mC@bondshape@two\mC@bondshape@three}]{% -% \let\mC@remainargs\@empty\mC@splitarg{#1}% -% \setbondshape{\mC@firstarg}{\mC@secondarg}{\mC@thirdarg}} -\define@key{setup}{rcndist}[\mC@rxn@node@distance@default]{% +\define@key{mCh@setup}{rcndist}[\mCh@rxn@node@distance@default]{% \setrcndist{#1}} -\define@key{setup}{rxnalign}[center]{% +\define@key{mCh@setup}{rxnalign}[center]{% \setrxnalign{#1}} -\define@key{setup}{schemealign}[center]{% +\define@key{mCh@setup}{schemealign}[center]{% \setschemealign{#1}} -\define@key{setup}{align}[center]{% +\define@key{mCh@setup}{align}[center]{% \setrxnalign{#1} \setschemealign{#1}} -\define@key{setup}{mergelength}[\mC@merge@length@default]{ +\define@key{mCh@setup}{mergelength}[\mCh@merge@length@default]{% \setmergelength{#1}} -\define@key{setup}{reset}[]{% - \setarrowlabel{} - \setarrowlength{} - \setarrowline{} - \setmergelength{} - \setatomsize{} - \setbondlength{} - \setbondshape{}{}{} - \setrcndist{} - \setrxnalign{} - \setschemealign{} - } +\define@key{mCh@setup}{elmove}[\mCh@elmove@default@tikz]{% + \setelmove{#1}} +\define@key{mCh@setup}{reset}[]{% + \setarrowlabel{}% + \setarrowlength{}% + \setarrowline{}% + \setmergelength{}% + \setatomsize{}% + \setbondlength{}% + \setbondshape{}{}{}% + \setrcndist{}% + \setrxnalign{}% + \setschemealign{}% + \setelmove{}% +} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% NODES SICHTBAR/UNSICHTBAR MACHEN ---------------------------------------------------- % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\let\mC@reactant@visible\@empty -\let\mC@arrow@uplabel@visible\@empty -\let\mC@arrow@downlabel@visible\@empty -\let\mC@branch@visible\@empty -\def\makevisible{ - \def\mC@reactant@visible{draw=red!60,solid} - \def\mC@arrow@uplabel@visible{draw=green!60,solid} - \def\mC@arrow@downlabel@visible{draw=blue!60,solid} - \def\mC@branch@visible{draw=cyan,solid} +% -------------------------------------------------------------------------- +% NODES SICHTBAR/UNSICHTBAR MACHEN +\mCh@new@variable\reactant@visible +\mCh@new@variable\arrow@uplabel@visible +\mCh@new@variable\arrow@downlabel@visible +\mCh@new@variable\branch@visible + +\mCh@empty@variable\reactant@visible +\mCh@empty@variable\arrow@uplabel@visible +\mCh@empty@variable\arrow@downlabel@visible +\mCh@empty@variable\branch@visible + +\newrobustcmd\makevisible{% + \ifmCh@draft + \mCh@set@variable\reactant@visible{draw=red!60,solid}% + \mCh@set@variable\arrow@uplabel@visible{draw=green!60,solid}% + \mCh@set@variable\arrow@downlabel@visible{draw=blue!60,solid}% + \mCh@set@variable\branch@visible{draw=cyan,solid}% + \fi } -\def\makeinvisible{ - \let\mC@reactant@visible\@empty - \let\mC@arrow@uplabel@visible\@empty - \let\mC@arrow@downlabel@visible\@empty - \let\mC@branch@visible\@empty + +\newrobustcmd\makeinvisible{% + \mCh@empty@variable\reactant@visible + \mCh@empty@variable\arrow@uplabel@visible + \mCh@empty@variable\arrow@downlabel@visible + \mCh@empty@variable\branch@visible } -% ------------------------------------------------------------------------------------- % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\endinput
\ No newline at end of file + +\endinput + +% ---------------------------------------------------------------------------- +HISTORY: +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<name> 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 <tikz>, + command \anywhere now has similar syntax + - arrow types <=>> and <<=> added + - arrow type -+> modified: more flexible + - bugfixes in error-handling +2011/04/27 version 1.5.1 - removed bondwidth.tex + - \arrow, \reactant, \mesomeric, \transition, \anywhere, + \dummy, \branch, and \chemand only defined inside scheme + environments +2012/07/27 version 1.99 - conflict with `pdfpages' resolved, LaTeXified various + parts in order to minimize conflicts with other + packages; \elmove and \merge are also only defined + inside the scheme environments +% ---------------------------------------------------------------------------- +% TODO |