diff options
author | Karl Berry <karl@freefriends.org> | 2011-04-17 00:44:16 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-04-17 00:44:16 +0000 |
commit | 267a9b3c9510955de4cafd61675964c21b89c493 (patch) | |
tree | 3c48b6a7b8ec612730bb79a0c5ec34b5263738f3 /Master/texmf-dist/tex/latex/mychemistry | |
parent | 7edde448c95089b13dddb78516c93cadcabd7b43 (diff) |
mychemistry 1.4 (16apr11)
git-svn-id: svn://tug.org/texlive/trunk@22097 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 | 730 |
1 files changed, 459 insertions, 271 deletions
diff --git a/Master/texmf-dist/tex/latex/mychemistry/mychemistry.sty b/Master/texmf-dist/tex/latex/mychemistry/mychemistry.sty index 07b86991346..cf4ed6a2118 100644 --- a/Master/texmf-dist/tex/latex/mychemistry/mychemistry.sty +++ b/Master/texmf-dist/tex/latex/mychemistry/mychemistry.sty @@ -4,7 +4,7 @@ % - Creating reaction schemes with LaTeX and ChemFig ---------------------------------- % % ------------------------------------------------------------------------------------- % % - Clemens Niederberger -------------------------------------------------------------- % -% - 2011/03/27 ------------------------------------------------------------------------ % +% - 2011/04/15 ------------------------------------------------------------------------ % % ------------------------------------------------------------------------------------- % % - http://www.niederberger-berlin.net/2011/02/latex-mychemistry/ --------------------- % % - kontakt@niederberger-berlin.net --------------------------------------------------- % @@ -30,6 +30,7 @@ % - mychemistry_en.tex - % % ------------------------------------------------------------------------------------- % % - 2011/02/24 version 1.0 - % +% - first release to CTAN - % % ------------------------------------------------------------------------------------- % % - 2011/03/01 version 1.1 - % % - package option `english' added - % @@ -59,11 +60,10 @@ % - commands \setrcndist, \setrxnalign, \setschemealign added - % % - rxn-, rxnscheme-key align added - % % - 2011/03/26 version 1.2.1 - % -% - rewriting commands, so they accept second argument without first: - % +% - rewritten commands, so they accept second argument without first: - % % - \reactand, \mesomeric, \transition, \branch, \makevisible, \makeinvisible - % -% - rewritten - % % - 2011/03/28 version 1.2.2 - % -% - bugfix with transition resolved - % +% - bugfix with transition - % % - atomsize, arrowlength, bondlength and bondshape renamed into set<name> - % % - and code slightly rewritten - % % - \mCsetup added - % @@ -76,14 +76,31 @@ % - 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 - % % ------------------------------------------------------------------------------------- % % - TODO - % -% - make the arrow type {-|>} look nicer - % % - work on how chemistry-packages are automatically loaded; - % % - add ui for easy handling this issue? (via \mCsetup ?) - % % - add rotate=<winkel> for diagonal arrows? - % -% - option for baseline-alignment of reactands et.al.? - % +% - option for baseline-alignment of reactants et.al.? - % % - option for shifting arrows? - % +% - Hook, damit die Befehle erkennen, ob sie innerhalb Umgebung sind? - % +% - Pfeil-Typen: <<=>/<=>> hinzufügen - % % ------------------------------------------------------------------------------------- % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\mC@def#1{% @@ -92,78 +109,77 @@ \fi \def#1% } -\mC@def\mC@version{v1.3} -\mC@def\mC@date@de{04. April 2011} -\mC@def\mC@date@en{April 4th 2011} -\mC@def\mC@Date{2011/04/04} +\mC@def\mC@version{1.4} +\mC@def\mC@date@de{15. April 2011} +\mC@def\mC@date@en{April 15th 2011} +\mC@def\mC@date{2011/04/15} \mC@def\mC@name{myChemistry} -\ProvidesPackage{mychemistry}[\mC@Date\space v\mC@version] +\ProvidesPackage{mychemistry}[\mC@date\space v\mC@version] \typeout{} -\typeout{\mC@name\space \mC@version} -\typeout{\mC@Date\space Clemens Niederberger} +\typeout{\mC@name\space v\mC@version} +\typeout{\mC@date\space Clemens Niederberger} \typeout{} -\RequirePackage{ifthen,calc,float} -\RequirePackage{xkeyval} +\RequirePackage{ifthen,calc,float,xkeyval} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Optionen, z.T. auch an chemexec weitergeben -\newcommand{\mC@exec@color}{black} -\newcommand{\mC@exec@shade}{false} +\mC@def\mC@exec@color{black} +\mC@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 - \renewcommand{\mC@exec@color}{#1} - \renewcommand{\mC@exec@shade}{true} + \def\mC@exec@color{#1} + \def\mC@exec@shade{true} } % sonst nicht: \DeclareOptionX[MC]{nocolor}{ \@usecolortrue - \renewcommand{\mC@exec@color}{black} - \renewcommand{\mC@exec@shade}{false} + \def\mC@exec@color{black} + \def\mC@exec@shade{false} } % shade separat (de-)aktivieren \DeclareOptionX[MC]{shade}{% - \renewcommand{\mC@exec@shade}{true} + \def\mC@exec@shade{true} } % chemexec abschalten -\newcommand{\mC@exec@true}{true} +\mC@def\mC@exec@true{true} \DeclareOptionX[MC]{nochemexec}{% - \renewcommand{\mC@exec@true}{false} + \def\mC@exec@true{false} } % mhchem abschalten -\newcommand{\mC@mhchem@true}{true} +\mC@def\mC@mhchem@true{true} \DeclareOptionX[MC]{nomhchem}{% - \renewcommand{\mC@mhchem@true}{false} + \def\mC@mhchem@true{false} } % chemcompounds abschalten -\newcommand{\mC@compound@true}{true} +\mC@def\mC@compound@true{true} \DeclareOptionX[MC]{nocompounds}{% - \renewcommand{\mC@compound@true}{false} + \def\mC@compound@true{false} } % chemstyle einschalten -\newcommand{\mC@chemstyle@true}{false} +\mC@def\mC@chemstyle@true{false} \DeclareOptionX[MC]{chemstyle}{% - \renewcommand{\mC@chemstyle@true}{true} + \def\mC@chemstyle@true{true} } % nur `chemfig' laden \DeclareOptionX[MC]{nopackages}{% - \renewcommand{\mC@exec@true}{false} - \renewcommand{\mC@mhchem@true}{false} - \renewcommand{\mC@compound@true}{false} - \renewcommand{\mC@chemstyle@true}{false} + \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 -\newcommand{\mC@exec@english}{} -\newcommand{\mC@rs@name}{Reaktionsschema} +\mC@def\mC@exec@english{} +\mC@def\mC@rs@name{Reaktionsschema} \DeclareOptionX[MC]{english}{ - \renewcommand{\mC@exec@english}{,english} - \renewcommand{\mC@rs@name}{Reaction scheme} + \def\mC@exec@english{,english} + \def\mC@rs@name{Reaction scheme} } -\newcommand{\mC@rs@placement}{H} -\newcommand{\mC@rs@currentplacement}{\mC@rs@placement} +\mC@def\mC@rs@placement{H} +\mC@def\mC@rs@currentplacement{\mC@rs@placement} \define@key[MC]{mychemistry.sty}{placement}{ - \renewcommand{\mC@rs@placement}{#1} + \def\mC@rs@placement{#1} } \ProcessOptionsX[MC] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -185,7 +201,7 @@ } }{} }{ - \PackageWarning{myChemistry: `chemcompounds' is not installed. You shoul use the `nocompounds' option.} + \PackageWarning{mychemistry}{`chemcompounds' is not installed. You should use the `nocompounds' option.} } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % chemfig laden, falls verfügbar @@ -195,7 +211,7 @@ } \usetikzlibrary{arrows,positioning,decorations.pathmorphing,shapes,calc,matrix,chains,scopes} }{% sonst Fehlermeldung - \PackageError{mychemistry}{`ChemFig' is not installed! `mychemistry' can't work without it!} + \PackageError{mychemistry}{`ChemFig' is not installed! `myChemistry' can't work without it!} } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % chemexec laden, falls verfügbar, falls nicht, dann wenigstens mhchem laden @@ -209,7 +225,7 @@ } }{} }{ - \PackageWarning{myChemistry: `chemexec' ist not installed. You should use the `nochemexec' option.} + \PackageWarning{mychemistry}{`chemexec' ist not installed. You should use the `nochemexec' option.} \IfFileExists{mhchem.sty}{ \ifthenelse{\equal{\mC@mhchem@true}{true}}{ \@ifpackageloaded{mhchem}{}{ @@ -217,7 +233,7 @@ } }{} }{ - \PackageWarning{myChemistry: `mhchem' ist not installed. You should use the `nomhchem' option.} + \PackageWarning{mychemistry}{`mhchem' ist not installed. You should use the `nomhchem' option.} } } @@ -232,15 +248,19 @@ \IfFileExists{bondwidth.tex}{% \ifx\CF@ver\mC@CFversion@test\input{bondwidth}\fi }{}% +\def\mC@CFversion@test{0.4} +\IfFileExists{bondwidth.tex}{% + \ifx\CF@ver\mC@CFversion@test\input{bondwidth}\fi +}{}% % Optional Argument Analysis ---------------------------------------------------------- % % Prüfen ob #2 in #1 enthalten ist \mC@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\mC@if@instr@i##1#2##2\@nil{\ifx\@empty##2\@empty\expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi}% + \mC@if@instr@i#1\@@nil#2\@nil } % Am ersten , splitten, #1 in #3 speichern, #2 in \mC@remainargs \mC@def\mC@splitfirst#1,#2\@nil#3{% - \def#3{#1}\def\mC@remainargs{#2}% + \def#3{#1}\def\mC@remainargs{#2}% } % ein durch , in 3 Teile getrenntes Argument splitten \mC@def\mC@splitarg#1{ @@ -252,49 +272,51 @@ % PFEILE ------------------------------------------------------------------------------ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % interne Befehle, Voreinstellungen --------------------------------------------------- % -\newcommand{\mC@arrow@above}{above} % oben -\newcommand{\mC@arrow@currentabove}{\mC@arrow@above} % -\newcommand{\mC@arrow@below}{below} % unten -\newcommand{\mC@arrow@currentbelow}{\mC@arrow@below} % -\newcommand{\mC@arrow@direction}{right} % Richtung -\newcommand{\mC@arrow@currentdirection}{\mC@arrow@direction} -\newcommand{\mC@arrow@currentlength}{\mC@arrow@length} +\mC@def\mC@arrow@above{above} % oben +\mC@def\mC@arrow@currentabove{\mC@arrow@above} % +\mC@def\mC@arrow@below{below} % unten +\mC@def\mC@arrow@currentbelow{\mC@arrow@below} % +\mC@def\mC@arrow@direction{right} % Richtung +\mC@def\mC@arrow@currentdirection{\mC@arrow@direction} +\mC@def\mC@arrow@currentlength{\mC@arrow@length} \newlength{\mC@arrow@length@actual} -\newcommand{\mC@arrow@rotate}{} -\newcommand{\mC@arrow@argument@angle}{} -\newcommand{\mC@arrow@argument@shift}{2pt} -\newcommand{\mC@arrow@argument@anchor}{} -\newcommand{\mC@arrow@argument@both}{} -\newcommand{\mC@arrow@above@anchor}{} -\newcommand{\mC@arrow@below@anchor}{} -\newcommand{\mC@arrow@type}{->} % Pfeiltyp -\newcommand{\mC@arrow@currenttype}{\mC@arrow@type} % -\newcommand{\mC@arrow@start@up}{0,0.05} % Verschiebung für Glgw-Pfeil -\newcommand{\mC@arrow@start@down}{0,-0.05} % -\newcommand{\mC@arrow@placement}{on chain=going \mC@arrow@currentdirection} % wohin? -\newcommand{\mC@arrow@currentplacement}{\mC@arrow@placement} -\newcommand{\mC@arrow@cross@base@x}{} % Befehle für durchgestrichenen Pfeil -\newcommand{\mC@arrow@cross@base@y}{} % -\newcommand{\mC@arrow@cross@angle}{} % -\newcommand{\mC@arrow@cross@length}{} % -\newcommand{\mC@arrow@cross@draw}{} % +\mC@def\mC@arrow@rotate{} +\mC@def\mC@arrow@argument@angle{} +\mC@def\mC@arrow@argument@shift{2pt} +\mC@def\mC@arrow@argument@anchor{} +\mC@def\mC@arrow@argument@both{} +\mC@def\mC@arrow@above@anchor{} +\mC@def\mC@arrow@below@anchor{} +\mC@def\mC@arrow@type{->} % Pfeiltyp +\mC@def\mC@arrow@currenttype{\mC@arrow@type} % +\mC@def\mC@arrow@start@up{0,0.05} % Verschiebung für Glgw-Pfeil +\mC@def\mC@arrow@start@down{0,-0.05} % +\mC@def\mC@arrow@placement{on chain=going \mC@arrow@currentdirection} % wohin? +\mC@def\mC@arrow@currentplacement{\mC@arrow@placement} +\mC@def\mC@arrow@cross@base@x{} % Befehle für durchgestrichenen Pfeil +\mC@def\mC@arrow@cross@base@y{} % +\mC@def\mC@arrow@cross@angle{} % +\mC@def\mC@arrow@cross@length{} % +\mC@def\mC@arrow@cross@draw{} % % Laengenfaktor ----------------------------------------------------------------------- % -\newcommand{\mC@arrow@length}{1.0} % Längenfaktor -\newcommand{\mC@arrow@length@factor}{1.0} % Default-Faktor -\newcommand{\mC@arrow@end}{\mC@arrow@length@actual,0} % Pfeilende +\mC@def\mC@arrow@length{1.0} % Längenfaktor +\mC@def\mC@arrow@length@factor{1.0} % Default-Faktor +\mC@def\mC@arrow@end{\mC@arrow@length@actual,0} % Pfeilende \define@key{arrow}{length}[\mC@arrow@length]{% % \renewcommand{\mC@arrow@currentlength}{#1}}% % \newlength{\mC@arrow@length@default} % -\setlength{\mC@arrow@length@default}{5em} % Default-Laenge +\setlength{\mC@arrow@length@default}{5em} % +\newlength{\mC@arrow@length@value} % +\setlength{\mC@arrow@length@value}{\mC@arrow@length@default} % Default-Laenge \mC@def\setarrowlength#1{ \ifx\@empty#1\@empty - \setlength{\mC@arrow@length@default}{5em} + \setlength{\mC@arrow@length@value}{\mC@arrow@length@default} \else - \setlength{\mC@arrow@length@default}{#1} + \setlength{\mC@arrow@length@value}{#1} \fi } -\let\arrowlength\setarrowlength +% \let\arrowlength\setarrowlength % Beschriftungen ---------------------------------------------------------------------- % \newlength{\mC@arrow@argument@aboveshift} % Verschieben der Beschriftung @@ -308,8 +330,8 @@ } % Anker ------------------------------------------------------------------------------- % -\newcommand{\mC@arrow@name}{} % Anker -\newcommand{\mC@arrow@currentname}{\mC@arrow@name} % +\mC@def\mC@arrow@name{} % Anker +\mC@def\mC@arrow@currentname{\mC@arrow@name} % \define@key{arrow}{name}[\mC@arrow@name]{% % \renewcommand{\mC@arrow@currentname}{#1}}% % @@ -471,29 +493,86 @@ } } -% Pfeiltyp ---------------------------------------------------------------------------- % -\newcommand{\mC@arrow@drawing}{} +% Pfeildicke -------------------------------------------------------------------------- % +\mC@def\mC@arrow@linethickness@default{semithick} +\mC@def\mC@arrow@linethickness{\mC@arrow@linethickness@default} +\mC@def\setarrowline#1{% + \ifx\@empty#1\@empty% + \def\mC@arrow@linethickness{\mC@arrow@linethickness@default}% + \else% + \def\mC@arrow@linethickness{#1}% + \fi% +} +% eigene Pfeilspitze ------------------------------------------------------------------ % +\pgfarrowsdeclare{mCtip}{mCtip}% +{ +\arrowsize=0.2pt +\advance\arrowsize by .5\pgflinewidth +\pgfarrowsleftextend{-4\arrowsize-.5\pgflinewidth} +\pgfarrowsrightextend{.5\pgflinewidth} +} +{ +\pgfsetdash{}{0pt} % do not dash +\pgfsetroundjoin% fix join +\pgfsetroundcap% fix cap +\pgfpathmoveto{\pgfpointorigin} +\pgfpathlineto{\pgfpoint{-3pt}{1pt}} +\pgfpathlineto{\pgfpoint{-1.5pt}{0pt}} +\pgfpathlineto{\pgfpoint{-3pt}{-1pt}} +\pgfpathlineto{\pgfpoint{0pt}{0pt}} +\pgfusepathqfillstroke +} + +\pgfarrowsdeclare{mChtip}{mChtip}% +{ +\arrowsize=0.2pt +\advance\arrowsize by .5\pgflinewidth +\pgfarrowsleftextend{-4\arrowsize-.5\pgflinewidth} +\pgfarrowsrightextend{.5\pgflinewidth} +} +{ +\pgfsetdash{}{0pt}% do not dash +\pgfsetroundjoin% fix join +\pgfsetroundcap% fix cap +\pgfpathmoveto{\pgfpoint{0pt}{0pt}} +\pgfpathlineto{\pgfpoint{-3pt}{1pt}} +\pgfpathlineto{\pgfpoint{-1.5pt}{0pt}} +\pgfpathlineto{\pgfpoint{0pt}{0pt}} +\pgfusepathqfillstroke +} +% Pfeil zeichnen ---------------------------------------------------------------------- % +\mC@def\mC@arrow@drawing{} \define@key{arrow}{type}[\mC@arrow@type]{% \renewcommand{\mC@arrow@currenttype}{#1} \ifthenelse{\equal{#1}{->}}{ - \renewcommand{\mC@arrow@drawing}{\draw[->,thick,text height=0] (0,0) -- node[pos=.5](@arrow@center){} ++(\mC@arrow@end);} + \let\mC@arrow@plusminus\@empty + \renewcommand{\mC@arrow@drawing}{\draw[-mCtip,\mC@arrow@linethickness,text height=0] (0,0) -- node[pos=.5](@arrow@center){} ++(\mC@arrow@end);} }{ \ifthenelse{\equal{#1}{<->}}{ - \renewcommand{\mC@arrow@drawing}{\draw[<->,thick,text height=0] (0,0) -- node[pos=.5](@arrow@center){} ++(\mC@arrow@end);} + \let\mC@arrow@plusminus\@empty + \renewcommand{\mC@arrow@drawing}{\draw[mCtip-mCtip,\mC@arrow@linethickness,text height=0] (0,0) -- node[pos=.5](@arrow@center){} ++(\mC@arrow@end);} }{ \ifthenelse{\equal{#1}{<-}}{ - \renewcommand{\mC@arrow@drawing}{\draw[<-,thick,text height=0] (0,0) -- node[pos=.5](@arrow@center){} ++(\mC@arrow@end);} + \let\mC@arrow@plusminus\@empty + \renewcommand{\mC@arrow@drawing}{\draw[mCtip-,\mC@arrow@linethickness,text height=0] (0,0) -- node[pos=.5](@arrow@center){} ++(\mC@arrow@end);} }{ \ifthenelse{\equal{#1}{<=>}}{ - \renewcommand{\mC@arrow@drawing}{\draw[-left to,thick,text height=0] (\mC@arrow@start@up) -- ++(\mC@arrow@end);\draw[left to-,thick,text height=0] (\mC@arrow@start@down) -- ++(\mC@arrow@end);\draw[draw=none] (0,0) -- node[pos=.5](@arrow@center){} ++(\mC@arrow@end);} + \let\mC@arrow@plusminus\@empty + \renewcommand{\mC@arrow@drawing}{\draw[-mChtip,\mC@arrow@linethickness,text height=0] (\mC@arrow@start@up) -- ++(\mC@arrow@end);\draw[mChtip-,\mC@arrow@linethickness,text height=0] (\mC@arrow@start@down) -- ++(\mC@arrow@end);\draw[draw=none] (0,0) -- node[pos=.5](@arrow@center){} ++(\mC@arrow@end);} }{ \ifthenelse{\equal{#1}{-|>}}{ - \setlength{\mC@arrow@argument@aboveshift}{.75em} - \setlength{\mC@arrow@argument@belowshift}{.75em} - \renewcommand{\mC@arrow@cross@draw}{\draw[thick] ($(@arrow@center.base) + (\mC@arrow@cross@base@x,\mC@arrow@cross@base@y) + (\mC@arrow@cross@angle:\mC@arrow@cross@length)$) -- ($(@arrow@center.base) + (\mC@arrow@cross@base@x,\mC@arrow@cross@base@y) + (\mC@arrow@cross@angle-180:\mC@arrow@cross@length)$);\draw[thick] ($(@arrow@center.base) + (-\mC@arrow@cross@base@x,-\mC@arrow@cross@base@y) + (\mC@arrow@cross@angle:\mC@arrow@cross@length)$) -- ($(@arrow@center.base) + (-\mC@arrow@cross@base@x,-\mC@arrow@cross@base@y) + (\mC@arrow@cross@angle-180:\mC@arrow@cross@length)$);} - \renewcommand{\mC@arrow@drawing}{\draw[->,thick,text height=0] (0,0) -- node[pos=.5](@arrow@center){} ++(\mC@arrow@end);\mC@arrow@cross@draw} + \let\mC@arrow@plusminus\@empty + \setlength{\mC@arrow@argument@aboveshift}{.75em} + \setlength{\mC@arrow@argument@belowshift}{.75em} + \renewcommand{\mC@arrow@cross@draw}{\draw[\mC@arrow@linethickness] ($(@arrow@center.base) + (\mC@arrow@cross@base@x,\mC@arrow@cross@base@y) + (\mC@arrow@cross@angle:\mC@arrow@cross@length)$) -- ($(@arrow@center.base) + (\mC@arrow@cross@base@x,\mC@arrow@cross@base@y) + (\mC@arrow@cross@angle-180:\mC@arrow@cross@length)$);\draw[\mC@arrow@linethickness] ($(@arrow@center.base) + (-\mC@arrow@cross@base@x,-\mC@arrow@cross@base@y) + (\mC@arrow@cross@angle:\mC@arrow@cross@length)$) -- ($(@arrow@center.base) + (-\mC@arrow@cross@base@x,-\mC@arrow@cross@base@y) + (\mC@arrow@cross@angle-180:\mC@arrow@cross@length)$);} + \renewcommand{\mC@arrow@drawing}{\draw[-mCtip,\mC@arrow@linethickness,text height=0] (0,0) -- node[pos=.5](@arrow@center){} ++(\mC@arrow@end);\mC@arrow@cross@draw} }{ - \PackageError{mychemistry}{Unknown arrow type}% oder Fehler + \ifthenelse{\equal{#1}{-+>}}{ + \def\mC@arrow@plusminus{true} + \renewcommand{\mC@arrow@drawing}{\draw[-mCtip,\mC@arrow@linethickness,text height=0] (0,0) -- node[pos=.5](@arrow@center){} ++(\mC@arrow@end);} + }{ + \PackageError{mychemistry}{Unknown arrow type}% oder Fehler + } } } } @@ -508,14 +587,14 @@ \newlength{\mC@width@A} \newlength{\mC@width@B} \newlength{\mC@arrow@argument@width} -\newcommand{\mC@savenode}{% +\mC@def\mC@savenode{% \global\let\mC@minx=\pgfpositionnodelaterminx% \global\let\mC@maxx=\pgfpositionnodelatermaxx% \global\let\mC@miny=\pgfpositionnodelaterminy% \global\let\mC@maxy=\pgfpositionnodelatermaxy% }% % der nächste Befehl benötigt pgf v2.10! -\newcommand{\mC@largernode}[2]{ +\mC@def\mC@largernode#1#2{ \@ifundefined{pgfpositionnodelater}{ \PackageError{mychemistry}{The command \string\pgfpositionnodelater is undefined. Make sure, you have installed the latest version of pgf.} }{} @@ -538,11 +617,11 @@ } % Pfeil zeichnen ---------------------------------------------------------------------- % -\newcommand{\mC@arrow}[3][]{ +\mC@def\mC@arrow#1#2{ \renewcommand{\mC@arrow@length@factor}{\mC@arrow@currentlength} - \setlength{\mC@arrow@length@actual}{\mC@arrow@currentlength\mC@arrow@length@default} + \setlength{\mC@arrow@length@actual}{\mC@arrow@currentlength\mC@arrow@length@value} \ifthenelse{\equal{\mC@arrow@argument@both}{true}}{ - \mC@largernode{#2}{#3} + \mC@largernode{#1}{#2} }{ \setlength{\mC@arrow@argument@width}{0pt} \setlength{\mC@arrow@argument@height}{0pt} @@ -552,10 +631,17 @@ } }; \mC@arrow@argument@anchor - \draw node[anchor=\mC@arrow@above@anchor,rotate=\mC@arrow@rotate,minimum width=\mC@arrow@argument@width, minimum height=\mC@arrow@argument@height] - at ($(@arrow@center.base)+(90+\mC@arrow@argument@angle:\mC@arrow@argument@aboveshift)$) {#2}; - \draw node[anchor=\mC@arrow@below@anchor,rotate=\mC@arrow@rotate,minimum width=\mC@arrow@argument@width, minimum height=\mC@arrow@argument@height] - at ($(@arrow@center.base)+(-90+\mC@arrow@argument@angle:\mC@arrow@argument@belowshift)$) {#3}; + \ifx\@empty\mC@arrow@plusminus + \draw node[anchor=\mC@arrow@above@anchor,rotate=\mC@arrow@rotate,minimum width=\mC@arrow@argument@width, minimum height=\mC@arrow@argument@height] + at ($(@arrow@center.base)+(90+\mC@arrow@argument@angle:\mC@arrow@argument@aboveshift)$) {#1}; + \draw node[anchor=\mC@arrow@below@anchor,rotate=\mC@arrow@rotate,minimum width=\mC@arrow@argument@width, minimum height=\mC@arrow@argument@height] + at ($(@arrow@center.base)+(-90+\mC@arrow@argument@angle:\mC@arrow@argument@belowshift)$) {#2}; + \else + \draw (@arrow@center.base) edge[bend left] ++(146.3+\mC@arrow@argument@angle:.361\mC@arrow@length@actual); + \node[anchor=\mC@arrow@above@anchor,inner sep=.1em] at ($(@arrow@center.base)+(146.3+\mC@arrow@argument@angle:.361\mC@arrow@length@actual)$) {#1}; + \draw (@arrow@center.base) edge[bend right,-mCtip] ++(33.7+\mC@arrow@argument@angle:.361\mC@arrow@length@actual); + \node[anchor=\mC@arrow@above@anchor,inner sep=.1em] at ($(@arrow@center.base)+(33.7+\mC@arrow@argument@angle:.361\mC@arrow@length@actual)$) {#2}; + \fi \setlength{\mC@arrow@argument@aboveshift}{2pt} \setlength{\mC@arrow@argument@belowshift}{2pt} } @@ -567,75 +653,116 @@ {} % Eigentlicher Befehl: -\providecommand{\arrow}[3][]{ - \setkeys{arrow}{#1} - \mC@arrow{#2}{#3} +\mC@def\arrow{\@ifnextchar[{\mC@arrow@i}{\setkeys{arrow}{}\mC@arrow}} +\mC@def\mC@arrow@i[#1]{% [<direction>,<type>,<length>,<name>,both] + \let\mC@remainargs\@empty\mC@splitarg{#1}% + \ifx\@empty\mC@firstarg% erste Option: direction + \def\mC@arrow@key@direction{right}% + \else% + \let\mC@arrow@key@direction\mC@firstarg% + \fi% + \ifx\@empty\mC@secondarg% zweite Option: type + \def\mC@arrow@key@type{->}% + \else% + \let\mC@arrow@key@type\mC@secondarg% + \fi% + \let\mC@remainargs\@empty% + \expandafter\mC@splitarg\expandafter{\mC@thirdarg}% + \ifx\@empty\mC@firstarg% dritte Option: length + \def\mC@arrow@key@length{1.0}% + \else% + \let\mC@arrow@key@length\mC@firstarg% + \fi% + \ifx\@empty\mC@secondarg% vierte Option: name + \let\mC@arrow@key@name\@empty% + \else% + \def\mC@arrow@key@name{\mC@secondarg}% + \fi% + \ifx\@empty\mC@thirdarg% fünfte Option: both + \let\mC@arrow@key@both\@empty% + \else% + \let\mC@arrow@key@both\mC@thirdarg% + \fi% + \setkeys{arrow}{direction=\mC@arrow@key@direction,type={\mC@arrow@key@type},length={\mC@arrow@key@length},name=\mC@arrow@key@name,\mC@arrow@key@both}\mC@arrow% } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % MERGE ------------------------------------------------------------------------------- % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\newcommand{\mC@merge@direction}{below} -\newcommand{\mC@merge@to}{} -\newcommand{\mC@merge@from@one}{} -\newcommand{\mC@merge@from@two}{} -\newcommand{\mC@merge}[3]{ - \renewcommand{\mC@merge@to}{#1} - \renewcommand{\mC@merge@from@one}{#2} - \renewcommand{\mC@merge@from@two}{#3} -} +\mC@def\mC@merge@length@default{3em} +\mC@def\mC@merge@length@value{\mC@merge@length@default} % Basisbefehle ------------------------------------------------------------------------ % -\newcommand{\mC@merge@right}{ - \draw[stealth-,thick] ($(\mC@merge@to.west)+(-1em,0)$) -- ($(\mC@merge@to.west)+(-4em,0)$) node(crossing) {}; - \draw[thick] ($(\mC@merge@from@one.east)+(1em,0)$) -| (crossing.base); - \draw[thick] ($(\mC@merge@from@two.east)+(1em,0)$) -| (crossing.base); -} -\newcommand{\mC@merge@above}{ - \draw[stealth-,thick] ($(\mC@merge@to.south)+(0,-1em)$) -- ($(\mC@merge@to.south)+(0,-4em)$) node(crossing) {}; - \draw[thick] (crossing.base) -| ($(\mC@merge@from@one.north)+(0,1em)$); - \draw[thick] (crossing.base) -| ($(\mC@merge@from@two.north)+(0,1em)$); -} -\newcommand{\mC@merge@left}{ - \draw[stealth-,thick] ($(\mC@merge@to.east)+(1em,0)$) -- ($(\mC@merge@to.east)+(4em,0)$) node(crossing) {}; - \draw[thick] ($(\mC@merge@from@one.west)+(-1em,0)$) -| (crossing.base); - \draw[thick] ($(\mC@merge@from@two.west)+(-1em,0)$) -| (crossing.base);; -} -\newcommand{\mC@merge@below}[3]{ - \draw[stealth-,thick] ($(\mC@merge@to.north)+(0,1em)$) -- ($(\mC@merge@to.north)+(0,4em)$) node(crossing) {}; - \draw[thick] (crossing.base) -| ($(\mC@merge@from@one.south)+(0,-1em)$); - \draw[thick] (crossing.base) -| ($(\mC@merge@from@two.south)+(0,-1em)$); -} -% key zur Auswahl --------------------------------------------------------------------- % -\define@choicekey{merge}{direction}[\val\nr]{right,above,left,below}[below]{ - \ifcase\nr\relax - \mC@merge@right - \or - \mC@merge@above - \or - \mC@merge@left - \or +\mC@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[thick] ($(\mC@merge@from@one.east)+(\mC@rxn@node@distance,0)$) -| (crossing.base); + \draw[thick] ($(\mC@merge@from@two.east)+(\mC@rxn@node@distance,0)$) -| (crossing.base); +} +\mC@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[thick] (crossing.base) -| ($(\mC@merge@from@one.north)+(0,\mC@rxn@node@distance)$); + \draw[thick] (crossing.base) -| ($(\mC@merge@from@two.north)+(0,\mC@rxn@node@distance)$); +} +\mC@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[thick] ($(\mC@merge@from@one.west)+(-\mC@rxn@node@distance,0)$) -| (crossing.base); + \draw[thick] ($(\mC@merge@from@two.west)+(-\mC@rxn@node@distance,0)$) -| (crossing.base); +} +\mC@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[thick] (crossing.base) -| ($(\mC@merge@from@one.south)+(0,-\mC@rxn@node@distance)$); + \draw[thick] (crossing.base) -| ($(\mC@merge@from@two.south)+(0,-\mC@rxn@node@distance)$); +} +% eigentlicher Befehl ----------------------------------------------------------------- % +\mC@def\mC@merge{\@ifnextchar[{\mC@merge@ii}{\mC@merge@i}} +\mC@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 +} +\mC@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 } -% Voreinstellung ---------------------------------------------------------------------- % -\presetkeys% - {merge} - {direction=below} - {} -% eigentlicher Befehl ----------------------------------------------------------------- % -\newcommand{\merge}[4][]{ - \mC@merge{#2}{#3}{#4} - \setkeys{merge}{#1} +\mC@def\merge{\mC@merge} + +\mC@def\setmergelength#1{ + \ifx\@empty#1\@empty + \def\mC@merge@length@value{\mC@merge@length@default} + \else + \def\mC@merge@length@value{#1} + \fi } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % REAKTIONSSCHEMA --------------------------------------------------------------------- % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newlength{\mC@rxn@node@distance@default} +\setlength{\mC@rxn@node@distance@default}{1em} \newlength{\mC@rxn@node@distance} -\setlength{\mC@rxn@node@distance}{1em} +\setlength{\mC@rxn@node@distance}{\mC@rxn@node@distance@default} \mC@def\setrcndist#1{% \ifx\@empty#1\@empty% - \setlength{\mC@rxn@node@distance}{1em}% + \setlength{\mC@rxn@node@distance}{\mC@rxn@node@distance@default}% \else% \setlength{\mC@rxn@node@distance}{#1}% \fi% @@ -643,104 +770,135 @@ % ------------------------------------------------------------------------------------- % % Schema ------------------------------------------------------------------------------ % % ------------------------------------------------------------------------------------- % -\newcommand{\mC@rs@scale}{1.0} % Default-Skalierung -\newcommand{\mC@rs@currentscale}{\mC@rs@scale} % -\providecommand{\setschemename}[1]{\renewcommand{\mC@rs@name}{#1}} -\newcommand{\mC@rs@caption}{} % Beschriftung -\newcommand{\mC@rs@label}{} % Label -\newcommand{\mC@rs@currentlabel}{\mC@rs@label} % -\define@key{rxnscheme}{label}{% % - \ifthenelse{\equal{#1}{}}{}{ % - \renewcommand{\mC@rs@currentlabel}{#1} % - } % -} % -\define@key{rxnscheme}{scale}[1.0]{ % Skalierung - \renewcommand{\mC@rs@currentscale}{#1} % -} % -\define@key{rxnscheme}{name}{ % Name - \renewcommand{\mC@rs@name}{#1} % -} % -\define@key{rxnscheme}{placement}{ % Float-Platzierung - \renewcommand{\mC@rs@currentplacement}{#1} % -} % -\newcommand{\mC@rs@align}{center} % -\newcommand{\mC@rs@right}{right} % -\newcommand{\mC@rs@center}{center} % -\newcommand{\mC@rs@left}{left} % +\mC@def\mC@rs@scale{1.0} % Default-Skalierung +\mC@def\mC@rs@currentscale{\mC@rs@scale} % +\mC@def\setschemename#1{\def\mC@rs@name{#1}} % +\mC@def\mC@rs@caption{} % Beschriftung +\mC@def\mC@rs@label{} % Label +\mC@def\mC@rs@currentlabel{\mC@rs@label} % +\mC@def\mC@rs@align{center} % +\mC@def\mC@rs@right{right} % +\mC@def\mC@rs@center{center} % +\mC@def\mC@rs@left{left} % \mC@def\setschemealign#1{% % - \ifx\@empty#1\@empty % - \renewcommand{\mC@rs@align}{center} % - \else % - \renewcommand{\mC@rs@align}{#1} % - \fi % + \ifx\@empty#1\@empty% % + \def\mC@rs@align{center}% % + \else% % + \def\mC@rs@align{#1}% % + \fi% % } % -\define@key{rxnscheme}{align}{ % Alignment - \renewcommand{\mC@rs@align}{#1} -} % Gleitumgebung \floatstyle{ruled} \newfloat{rxnfloat}{\mC@rs@currentplacement}{rxnscheme} \floatname{rxnfloat}{\mC@rs@name} % Name ändern % eigentliche Umgebung: -\newenvironment{rxnscheme}[2][]{% - \setkeys{rxnscheme}{#1} - \renewcommand\mC@rs@caption{#2} - \begin{rxnfloat} - %\centering - \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 - \begin{tikzpicture}[every picture/.style={scale=\mC@rs@currentscale},start chain,node distance=\mC@rxn@node@distance,inner sep=0pt,outer sep=0pt] -}{% - \end{tikzpicture}% - \caption{\mC@rs@caption} - \ifthenelse{\equal{\mC@rs@currentlabel}{}}{}{\label{\mC@rs@currentlabel}} - \end{rxnfloat} +\mC@def\mC@rxnscheme{\@ifnextchar[{\mC@rxnscheme@ii}{\let\mC@rs@currentlabel\@empty\mC@rxnscheme@i}} +\mC@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% +} +\mC@def\mC@rxnscheme@i#1{% + \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% +} +\mC@def\rxnscheme{\mC@rxnscheme} +\mC@def\endrxnscheme{% + \endtikzpicture% + \caption{\mC@rs@caption}% + \ifx\@empty\mC@rs@currentlabel\else% + \label{\mC@rs@currentlabel}% + \fi + \endrxnfloat% } % ------------------------------------------------------------------------------------- % % einfache Reaktion ------------------------------------------------------------------- % % ------------------------------------------------------------------------------------- % -\newcommand{\mC@reaction@scale}{1.0} -\newcommand{\mC@reaction@align}{center} +\mC@def\mC@reaction@scale{1.0} +\mC@def\mC@reaction@align{center} \mC@def\setrxnalign#1{ \ifx\@empty#1\@empty - \renewcommand{\mC@reaction@align}{center} + \def\mC@reaction@align{center} \else - \renewcommand{\mC@reaction@align}{#1} + \def\mC@reaction@align{#1} \fi } -\newcommand{\mC@reaction@right}{right} -\newcommand{\mC@reaction@center}{center} -\newcommand{\mC@reaction@left}{left} -\define@key{rxn}{scale}{ - \renewcommand{\mC@reaction@scale}{#1}} -\define@key{rxn}{align}{ - \renewcommand{\mC@reaction@align}{#1}} -\newenvironment{rxn}[1][]{% - \setkeys{rxn}{#1} - \ifx\mC@reaction@align\mC@reaction@center - \begin{center} - \fi - \ifx\mC@reaction@align\mC@reaction@left - \begin{flushleft} - \fi - \ifx\mC@reaction@align\mC@reaction@right - \begin{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] -}{% - \end{tikzpicture}% - \ifx\mC@reaction@align\mC@reaction@center - \end{center} - \fi - \ifx\mC@reaction@align\mC@reaction@left - \end{flushleft} - \fi - \ifx\mC@reaction@align\mC@reaction@right - \end{flushright} +\mC@def\mC@reaction@right{right} +\mC@def\mC@reaction@center{center} +\mC@def\mC@reaction@left{left} + +\mC@def\mC@rxn{\@ifnextchar[{\mC@rxn@ii}{\mC@rxn@i}} +\mC@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 +} +\mC@def\mC@rxn@i{% + \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% + \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% +} +\mC@def\rxn{\mC@rxn} +\mC@def\endrxn{% + \endtikzpicture% + \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 } @@ -748,15 +906,16 @@ % REAKTANDEN -------------------------------------------------------------------------- % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Standardreaktand -------------------------------------------------------------------- % -\mC@def\mC@reactand{\@ifnextchar[{\mC@reactand@ii}{\mC@reactand@i}} -\mC@def\mC@reactand@i#1{\def\mC@firstarg{on chain=going right}\let\mC@secondarg\@empty\let\mC@thirdarg\@empty\mC@reactand@iii{#1}} -\mC@def\mC@reactand@ii[#1]#2{ +\mC@def\mC@reactant{\@ifnextchar[{\mC@reactant@ii}{\mC@reactant@i}} +\mC@def\mC@reactant@i#1{\def\mC@firstarg{on chain=going right}\let\mC@secondarg\@empty\let\mC@thirdarg\@empty\mC@reactant@iii{#1}} +\mC@def\mC@reactant@ii[#1]#2{ \let\mC@remainargs\@empty\mC@splitarg{#1} - \ifx\mC@firstarg\@empty\def\mC@reactand@alignment{right}\else\let\mC@reactand@alignment\mC@firstarg\fi - \def\mC@firstarg{on chain=going \mC@reactand@alignment} - \mC@reactand@iii{#2}} -\mC@def\mC@reactand@iii#1{\expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@firstarg\expandafter,\mC@thirdarg](\mC@secondarg){#1};} -\mC@def\reactand{\mC@reactand} + \ifx\mC@firstarg\@empty\def\mC@reactant@alignment{right}\else\let\mC@reactant@alignment\mC@firstarg\fi + \def\mC@firstarg{on chain=going \mC@reactant@alignment} + \mC@reactant@iii{#2}} +\mC@def\mC@reactant@iii#1{\expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@firstarg\expandafter,\mC@thirdarg](\mC@secondarg){\scantokens{\relax#1}};}% scantokens nötig, da sonst eine Dreifanchbindung ~ vor () mit falschem catcode interpretiert wird +\mC@def\reactand{\mC@reactant}% old command +\mC@def\reactant{\mC@reactant}% new correctly spelled command % Mesomerie --------------------------------------------------------------------------- % \mC@def\mC@mesomeric{\@ifnextchar[{\mC@mesomeric@ii}{\mC@mesomeric@i}} @@ -766,12 +925,24 @@ \ifx\mC@firstarg\@empty\def\mC@mesomeric@alignment{right}\else\let\mC@mesomeric@alignment\mC@firstarg\fi \def\mC@firstarg{on chain=going \mC@mesomeric@alignment} \mC@mesomeric@iii{#2}} -\mC@def\mC@mesomeric@iii#1{\expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@firstarg\expandafter,\mC@thirdarg,inner sep=1pt,left delimiter={[},right delimiter={]}](\mC@secondarg){\tikzpicture[start branch]#1\endtikzpicture};} +\mC@def\mC@mesomeric@iii#1{\expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@firstarg\expandafter,\mC@thirdarg,inner sep=1pt,left delimiter={[},right delimiter={]}](\mC@secondarg){\tikzpicture[start branch]\scantokens{\relax#1}\endtikzpicture};}% scantokens nötig, da sonst eine Dreifanchbindung ~ vor () mit falschem catcode interpretiert wird \mC@def\mesomeric{\mC@mesomeric} -\providecommand{\marrow}[1][right]{\arrow[type=<->,length=.5,direction=#1]{}{}} +% Mesomerie-Pfeil --------------------------------------------------------------------- % +\mC@def\marrow{\@ifnextchar[{\mC@marrow@i}{\mC@marrow@ii}} +\mC@def\mC@marrow@i[#1]{\arrow[#1,<->,.5]{}{}} +\mC@def\mC@marrow@ii{\arrow[,<->,.5]{}{}} + +% Anywhere ---------------------------------------------------------------------------- % +\mC@def\mC@anywhere{\@ifnextchar[{\mC@anywhere@ii}{\mC@anywhere@i}} +\mC@def\mC@anywhere@ii[#1]#2#3{\node[#2](#1){#3};} +\mC@def\mC@anywhere@i#1#2{\node[#1]{#2};} +\mC@def\anywhere{\mC@anywhere} + % Dummy ------------------------------------------------------------------------------- % -\providecommand{\dummy}[1][]{\draw node[on chain,xshift=-\mC@rxn@node@distance](#1) {};} +\mC@def\dummy{\@ifnextchar[{\mC@dummy@i}{\mC@dummy@ii}} +\mC@def\mC@dummy@i[#1]{\draw node[on chain,xshift=-\mC@rxn@node@distance](#1){};} +\mC@def\mC@dummy@ii{\draw node[on chain,xshift=-\mC@rxn@node@distance]{};} % Uebergangszustand ------------------------------------------------------------------- % \mC@def\mC@transition@name{x} @@ -783,31 +954,36 @@ \def\mC@firstarg{on chain=going \mC@transition@alignment} \ifx\mC@secondarg\@empty\let\mC@secondarg\mC@transition@name\fi \mC@transition@iii{#2}} -\mC@def\mC@transition@iii#1{\expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@firstarg\expandafter,\mC@thirdarg,inner sep=1pt,left delimiter={[},right delimiter={]}](\mC@secondarg){#1} node at ($(\mC@secondarg.north east)+(.25,0)$) {$\ddagger$};} +\mC@def\mC@transition@iii#1{\expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@firstarg\expandafter,\mC@thirdarg,inner sep=1pt,left delimiter={[},right delimiter={]}](\mC@secondarg){\scantokens{\relax#1}} node[above right=of \mC@secondarg,xshift=-.2em,yshift=-1.2em] {$\ddagger$};}% scantokens nötig, da sonst eine Dreifanchbindung ~ vor () mit falschem catcode interpretiert wird \mC@def\transition{\mC@transition} % Abzweigung -------------------------------------------------------------------------- % \mC@def\mC@branch{\@ifnextchar[{\mC@branch@ii}{\mC@branch@i}} \mC@def\mC@branch@i#1{\def\mC@firstarg{on chain=going right}\let\mC@secondarg\@empty\let\mC@thirdarg\@empty\mC@branch@iii{#1}} \mC@def\mC@branch@ii[#1]#2{\let\mC@remainargs\@empty\mC@splitarg{#1}\ifx\mC@firstarg\@empty\def\mC@firstarg{on chain=going right}\fi\mC@branch@iii{#2}} -\mC@def\mC@branch@iii#1{\expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@firstarg\expandafter,\mC@thirdarg](\mC@secondarg){\tikzpicture[start branch]#1\endtikzpicture};} +\mC@def\mC@branch@iii#1{\expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@firstarg\expandafter,\mC@thirdarg](\mC@secondarg){\tikzpicture[start branch]\scantokens{\relax#1}\endtikzpicture};}% scantokens nötig, da sonst eine Dreifanchbindung ~ vor () mit falschem catcode interpretiert wird \mC@def\branch{\mC@branch} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Sonstiges --------------------------------------------------------------------------- % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Elektronenverschiebungspfeile ------------------------------------------------------- % -\providecommand{\elmove}[5][->,red,shorten <=3pt,shorten >=1pt]{\chemmove{\draw[#1](#2).. controls +(#3) and +(#5)..(#4);}} +\mC@def\elmove{\@ifnextchar[{\mC@elmove@i}{\mC@elmove@ii}} +\mC@def\mC@elmove@i[#1]#2#3#4#5{\chemmove{\draw[#1](#2).. controls +(#3) and +(#5)..(#4);}} +\mC@def\mC@elmove@ii#1#2#3#4{\chemmove{\draw[->,red,shorten <=3pt,shorten >=1pt](#1).. controls +(#2) and +(#4)..(#3);}} + % Bindungslänge ----------------------------------------------------------------------- % -\newcommand{\mC@bondlength}{\setatomsep{1.8em}} +\mC@def\mC@bondlength@default{1.8em} +\mC@def\mC@bondlength{\setatomsep{\mC@bondlength@default}} \mC@def\setbondlength#1{ \ifx\@empty#1\@empty - \renewcommand{\mC@bondlength}{\setatomsep{1.8em}} + \def\mC@bondlength{\setatomsep{\mC@bondlength@default}} \else - \renewcommand{\mC@bondlength}{\setatomsep{#1}} + \def\mC@bondlength{\setatomsep{#1}} \fi } -\let\bondlength\setbondlength +% \let\bondlength\setbondlength + % Keilbindungen ----------------------------------------------------------------------- % \mC@def\mC@bondshape@one{3pt} \mC@def\mC@bondshape@two{.5pt} @@ -829,18 +1005,21 @@ \renewcommand{\mC@bondshape@three}{#3} \fi } -\let\bondshape\setbondshape +% \let\bondshape\setbondshape \mC@def\mC@bondshape{\setcrambond{\mC@bondshape@one}{\mC@bondshape@two}{\mC@bondshape@three}} + % Atomgröße --------------------------------------------------------------------------- % -\mC@def\mC@atomsize{\small} +\mC@def\mC@atomsize@default{\small} +\mC@def\mC@atomsize{\mC@atomsize@default} \mC@def\setatomsize#1{ \ifx\@empty#1\@empty - \renewcommand{\mC@atomsize}{\small} + \renewcommand{\mC@atomsize}{\mC@atomsize@default} \else \renewcommand{\mC@atomsize}{#1} \fi } -\let\atomsize\setatomsize +% \let\atomsize\setatomsize + % Plus -------------------------------------------------------------------------------- % \mC@def\mC@chemand{\@ifnextchar[{\mC@chemand@ii}{\mC@chemand@i}} \mC@def\mC@chemand@i{\def\mC@firstarg{on chain=going right}\let\mC@secondarg\@empty\let\mC@thirdarg\@empty\mC@chemand@iii} @@ -851,17 +1030,20 @@ \mC@chemand@iii} \mC@def\mC@chemand@iii{\expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@firstarg\expandafter,\mC@thirdarg](\mC@secondarg){\chemsign[0pt]{+}};} \mC@def\chemand{\mC@chemand} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Setup myChemistry ------------------------------------------------------------------- % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \mC@def\mCsetup#1{\setkeys{setup}{#1}} -\define@key{setup}{arrowlength}[5em]{% +\define@key{setup}{arrowlength}[\mC@arrow@length@default]{% \setarrowlength{#1}} -\define@key{setup}{atomsize}[\small]{% +\define@key{setup}{arrowline}[\mC@arrow@linethickness@default]{% + \setarrowline{#1}} +\define@key{setup}{atomsize}[\mC@atomsize@default]{% \setatomsize{#1}} -\define@key{setup}{bondlength}[1.8em]{% +\define@key{setup}{bondlength}[\mC@bondlength@default]{% \setbondlength{#1}} -\define@key{setup}{rcndist}[1em]{% +\define@key{setup}{rcndist}[\mC@rxn@node@distance@default]{% \setrcndist{#1}} \define@key{setup}{rxnalign}[center]{% \setrxnalign{#1}} @@ -870,25 +1052,30 @@ \define@key{setup}{align}[center]{% \setrxnalign{#1} \setschemealign{#1}} +\define@key{setup}{mergelength}[\mC@merge@length@default]{ + \setmergelength{#1}} \define@key{setup}{reset}[]{% \setarrowlength{} + \setarrowline{} + \setmergelength{} \setatomsize{} \setbondlength{} \setbondshape{}{}{} \setrcndist{} \setrxnalign{} - \setschemealign{}} + \setschemealign{} + } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % NODES SICHTBAR/UNSICHTBAR MACHEN ---------------------------------------------------- % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand\makevisible{ - \def\mC@reactand@iii##1{\expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@firstarg\expandafter,\mC@thirdarg,draw=red!60,solid](\mC@secondarg){##1};} - \def\mC@branch@iii##1{\expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@firstarg\expandafter,\mC@thirdarg,draw=purple,dotted](\mC@secondarg){\tikzpicture[start branch]##1\endtikzpicture};} - \def\mC@transition@iii##1{\expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@firstarg\expandafter,\mC@thirdarg,inner sep=1pt,left delimiter={[},right delimiter={]},draw=red!60,solid](\mC@secondarg){##1} node at ($(\mC@secondarg.north east)+(.25,0)$) {$\ddagger$};} + \def\mC@reactant@iii##1{\expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@firstarg\expandafter,\mC@thirdarg,draw=red!60,solid](\mC@secondarg){\scantokens{\relax##1}};} + \def\mC@branch@iii##1{\expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@firstarg\expandafter,\mC@thirdarg,draw=purple,dotted](\mC@secondarg){\tikzpicture[start branch]\scantokens{\relax##1}\endtikzpicture};} + \def\mC@transition@iii##1{\expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@firstarg\expandafter,\mC@thirdarg,inner sep=1pt,left delimiter={[},right delimiter={]},draw=red!60,solid](\mC@secondarg){\scantokens{\relax##1}} node at ($(\mC@secondarg.north east)+(.25,0)$) {$\ddagger$};} \renewcommand{\mC@arrow}[3][]{ \renewcommand{\mC@arrow@length@factor}{\mC@arrow@currentlength} - \setlength{\mC@arrow@length@actual}{\mC@arrow@currentlength\mC@arrow@length@default} + \setlength{\mC@arrow@length@actual}{\mC@arrow@currentlength\mC@arrow@length@value} \ifthenelse{\equal{\mC@arrow@argument@both}{true}}{ \mC@largernode{##2}{##3} }{ @@ -910,12 +1097,12 @@ } \newcommand\makeinvisible{ - \def\mC@reactand@iii##1{\expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@firstarg\expandafter,\mC@thirdarg](\mC@secondarg){##1};} - \def\mC@branch@iii##1{\expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@firstarg\expandafter,\mC@thirdarg](\mC@secondarg){\tikzpicture[start branch]##1\endtikzpicture};} - \def\mC@transition@iii##1{\expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@firstarg\expandafter,\mC@thirdarg,inner sep=1pt,left delimiter={[},right delimiter={]}](\mC@secondarg){##1} node at ($(\mC@secondarg.north east)+(.25,0)$) {$\ddagger$};} + \def\mC@reactant@iii##1{\expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@firstarg\expandafter,\mC@thirdarg](\mC@secondarg){\scantokens{\relax##1}};} + \def\mC@branch@iii##1{\expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@firstarg\expandafter,\mC@thirdarg](\mC@secondarg){\tikzpicture[start branch]\scantokens{\relax##1}\endtikzpicture};} + \def\mC@transition@iii##1{\expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[\expandafter\mC@firstarg\expandafter,\mC@thirdarg,inner sep=1pt,left delimiter={[},right delimiter={]}](\mC@secondarg){\scantokens{\relax##1}} node at ($(\mC@secondarg.north east)+(.25,0)$) {$\ddagger$};} \renewcommand{\mC@arrow}[3][]{ \renewcommand{\mC@arrow@length@factor}{\mC@arrow@currentlength} - \setlength{\mC@arrow@length@actual}{\mC@arrow@currentlength\mC@arrow@length@default} + \setlength{\mC@arrow@length@actual}{\mC@arrow@currentlength\mC@arrow@length@value} \ifthenelse{\equal{\mC@arrow@argument@both}{true}}{ \mC@largernode{##2}{##3} }{ @@ -936,4 +1123,5 @@ } } % ------------------------------------------------------------------------------------- % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ No newline at end of file +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\endinput
\ No newline at end of file |