From 491e32b45dde494beb7d8cbdfbfeb5543f66ce3d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 1 Mar 2011 23:51:02 +0000 Subject: new latex package mychemistry (1mar11) git-svn-id: svn://tug.org/texlive/trunk@21579 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/mychemistry/mychemistry.sty | 591 +++++++++++++++++++++ 1 file changed, 591 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/mychemistry/mychemistry.sty (limited to 'Master/texmf-dist/tex/latex/mychemistry') diff --git a/Master/texmf-dist/tex/latex/mychemistry/mychemistry.sty b/Master/texmf-dist/tex/latex/mychemistry/mychemistry.sty new file mode 100644 index 00000000000..fc7edb23c58 --- /dev/null +++ b/Master/texmf-dist/tex/latex/mychemistry/mychemistry.sty @@ -0,0 +1,591 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% ------------------------------------------------------------------------------------- % +% - myChemistry - mychemistry.sty ----------------------------------------------------- % +% - Creating reaction schemes with LaTeX and ChemFig ---------------------------------- % +% ------------------------------------------------------------------------------------- % +% - Clemens Niederberger -------------------------------------------------------------- % +% - 2011/03/01 ------------------------------------------------------------------------ % +% ------------------------------------------------------------------------------------- % +% - 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. -------------------------------------------------------------------- % +% ------------------------------------------------------------------------------------- % +% - Licence CC BY-NC-SA 3.0 ----------------------------------------------------------- % +% - http://creativecommons.org/licenses/by-nc-sa/3.0/ - % +% - You are free: - % +% - to Share: to copy, distribute and transmit the work - % +% - to Remix: to adapt the work - % +% - Under the following conditions: - % +% - Attribution: You must attribute the work in the manner specified by the author - % +% - or licensor (but not in any way that suggests that they endorse you or your - % +% - use of the work). - % +% - Noncommercial: You may not use this work for commercial purposes. - % +% - Share Alike: If you alter, transform, or build upon this work, you may - % +% - distribute the resulting work only under the same or similar license to - % +% - this one. - % +% - - % +% - This work consists of the files mychemistry.sty, mychemistry_de.tex and - % +% - mychemistry_en.tex - % +% ------------------------------------------------------------------------------------- % +% - 02/24/2011 version 1.0 - % +% ------------------------------------------------------------------------------------- % +% - 03/01/2011 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 - % +% ------------------------------------------------------------------------------------- % +% - TODO - % +% - correct branch alignment - % +% - correct arrow argument behaviour - % +% - make the arrow type {-|>} look nicer - % +% ------------------------------------------------------------------------------------- % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\@mc@version{v1.1} +\def\@mc@date@de{01. M\"arz 2011} +\def\@mc@date@en{March 01. 2011} +\ProvidesPackage{mychemistry}[2011/03/01] +\typeout{myChemistry \@mc@version} +\typeout{2011/03/01 Clemens Niederberger} +\typeout{} +\RequirePackage{ifthen,calc,float} +\RequirePackage{xkeyval} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Optionen, auch an chemexec weitergeben +\newcommand{\@mc@exec@color}{black} +\newcommand{\@mc@exec@shade}{false} +\newif\if@usecolor\@usecolorfalse +% wenn key color, dann Farbe weitergeben und Option shade=true +\define@key[MC]{mychemistry.sty}% + {color}{ + \@usecolortrue + \renewcommand{\@mc@exec@color}{#1} + \renewcommand{\@mc@exec@shade}{true} + } +% sonst nicht: +\DeclareOptionX[MC]{nocolor}{ + \@usecolortrue + \renewcommand{\@mc@exec@color}{black} + \renewcommand{\@mc@exec@shade}{false} +} +% shade separat (de-)aktivieren +\DeclareOptionX[MC]{shade}{% + \renewcommand{\@mc@exec@shade}{true} +} +% chemexec abschalten +\newcommand{\@mc@exec@true}{true} +\DeclareOptionX[MC]{nochemexec}{% + \renewcommand{\@mc@exec@true}{false} +} +% englische Version von chemexec, englische Variante von myChemistry +\newcommand{\@mc@exec@english}{} +\newcommand{\@mc@rs@name}{Reaktionsschema} +\DeclareOptionX[MC]{english}{ + \renewcommand{\@mc@exec@english}{,english} + \renewcommand{\@mc@rs@name}{Reaction scheme} +} +\newcommand{\@mc@rs@placement}{H} +\newcommand{\@mc@rs@currentplacement}{\@mc@rs@placement} +\define@key[MC]{mychemistry.sty}{placement}{ + \renewcommand{\@mc@rs@placement}{#1} +} +\ProcessOptionsX[MC] +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% chemcompounds laden, falls verfügbar +\IfFileExists{chemcompounds.sty}{% + \@ifpackageloaded{chemcompounds}{}{ + \RequirePackage{chemcompounds} + } +}{ + \typeout{`chemcompounds' is not installed.} +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% 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}{`ChemFig' is not installed! `mychemistry' can't work without it!} +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% 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}}{ + \@ifpackageloaded{chemexec}{}{ + \RequirePackage[color=\@mc@exec@color,shade=\@mc@exec@shade,exercise,exersize=large\@mc@exec@english]{chemexec} + } + }{} +}{ + \typeout{`chemexec' ist not installed.} + \IfFileExists{mhchem.sty}{ + \@ifpackageloaded{mhchem}{}{ + \RequirePackage[version=3]{mhchem} + } + }{ + \typeout{`mhchem' ist not installed.} + } +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% ochem laden, falls verfügbar +%\IfFileExists{ochem.sty}{% +% \@ifpackageloaded{ochem}{}{ +% \RequirePackage{ochem} +% } +%}{ +% \typeout{`ochem' is not installed.} +%} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% NEUE BEFEHLE: % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\providecommand{\mCversion}{\@mc@version} +\providecommand{\mCdate}[1]{ + \ifthenelse{\equal{#1}{de}}{\@mc@date@de}{} + \ifthenelse{\equal{#1}{en}}{\@mc@date@en}{} +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% PFEILE ------------------------------------------------------------------------------ % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% interne Befehle, Voreinstellungen --------------------------------------------------- % +\newcommand{\@arrow@above}{above} % oben +\newcommand{\@arrow@currentabove}{\@arrow@above} % +\newcommand{\@arrow@below}{below} % unten +\newcommand{\@arrow@currentbelow}{\@arrow@below} % +\newcommand{\@arrow@direction}{right} % Richtung +\newcommand{\@arrow@currentdirection}{\@arrow@direction} +\newcommand{\@arrow@currentlength}{\@arrow@length} +\newcommand{\@arrow@yshift}{0} % Verschieben der Beschriftung +\newcommand{\@arrow@xshift}{0} % +\newcommand{\@arrow@type}{->} % Pfeiltyp +\newcommand{\@arrow@currenttype}{\@arrow@type} % +\newcommand{\@arrow@start@up}{0,0.05} % Verschiebung für Glgw-Pfeil +\newcommand{\@arrow@start@down}{0,-0.05} % +\newcommand{\@arrow@placement}{on chain=going \@arrow@currentdirection} % wohin? +\newcommand{\@arrow@currentplacement}{\@arrow@placement} +\newcommand{\@arrow@cross@base@x}{} % Befehle für durchgestrichenen Pfeil +\newcommand{\@arrow@cross@base@y}{} % +\newcommand{\@arrow@cross@angle}{} % +\newcommand{\@arrow@cross@length}{} % +\newcommand{\@arrow@cross@draw}{} % + +% Laengenfaktor ----------------------------------------------------------------------- % +\newcommand{\@arrow@length}{1.0} % Längenfaktor +\newcommand{\@arrow@length@factor}{1.0} % Default-Faktor +\newcommand{\@arrow@end}{\@arrow@length@factor\@arrow@length@default,0} % Pfeilende +\define@key{arrow}{length}[\@arrow@length]{% % + \renewcommand{\@arrow@currentlength}{#1}}% % +\newlength{\@arrow@length@default} % +\setlength{\@arrow@length@default}{5em} % Default-Laenge +\newcommand{\arrowlength}[1]{\setlength{\@arrow@length@default}{#1}} + +% Anker ------------------------------------------------------------------------------- % +\newcommand{\@arrow@name}{} % Anker +\newcommand{\@arrow@currentname}{\@arrow@name} % +\define@key{arrow}{name}[\@arrow@name]{% % + \renewcommand{\@arrow@currentname}{#1}}% % + +% Richtung ---------------------------------------------------------------------------- % +% Vorbefehl: Quadratwurzel berechnen +\newdimen\eins +\newlength\zwei +\newdimen\wert +\newlength\squareroot % Wert der Wurzelberechnung, in pt +\newcommand{\wurzel}[1]{% Wurzelberechnung, Naeherung nach Heron (sechs Iterationen) +\setlength\zwei{#1} %x +\wert=\zwei %x +\eins=\zwei %a +% erste Iteration: +\setlength\zwei{1pt*\ratio{\wert}{\eins}} %b=x/a +\advance\eins by \zwei %a+b +\divide\eins by 2 %(a+b)2 = a +% zweite Iteration: +\setlength\zwei{1pt*\ratio{\wert}{\eins}} %b=x/a +\advance\eins by \zwei %a+b +\divide\eins by 2 %(a+b)2 = a +% dritte Iteration: +\setlength\zwei{1pt*\ratio{\wert}{\eins}} %b=x/a +\advance\eins by \zwei %a+b +\divide\eins by 2 %(a+b)2 = a +% vierte Iteration: +\setlength\zwei{1pt*\ratio{\wert}{\eins}} %b=x/a +\advance\eins by \zwei %a+b +\divide\eins by 2 %(a+b)2 = a +% fuenfte Iteration: +\setlength\zwei{1pt*\ratio{\wert}{\eins}} %b=x/a +\advance\eins by \zwei %a+b +\divide\eins by 2 %(a+b)2 = a +% sechste Iteration: +\setlength\zwei{1pt*\ratio{\wert}{\eins}} %b=x/a +\advance\eins by \zwei %a+b +\divide\eins by 2 %(a+b)2 = a + +\setlength\squareroot{\eins} +} +\newlength{\@arrow@shift@value} % Shift: Verschieben der Beschriftung, +\newcommand{\@arrow@shift}[1]{\wurzel{#1pt} % abhängig von der Pfeilausrichtung + \setlength{\@arrow@shift@value}{\squareroot*40}} + +\define@key{arrow}{direction}[\@arrow@direction]{% + \renewcommand{\@arrow@currentdirection}{#1} % + \ifthenelse{\equal{#1}{right}}{% nach rechts, Einstellungen: + \renewcommand{\@arrow@end}{\@arrow@length@factor\@arrow@length@default,0} + \renewcommand{\@arrow@currentabove}{above} + \renewcommand{\@arrow@currentbelow}{below} + \renewcommand{\@arrow@xshift}{0} + \renewcommand{\@arrow@yshift}{1.2em} + \renewcommand{\@arrow@start@up}{0,0.03} + \renewcommand{\@arrow@start@down}{0,-0.03} + \renewcommand{\@arrow@cross@base@x}{.15em} + \renewcommand{\@arrow@cross@base@y}{0} + \renewcommand{\@arrow@cross@angle}{60} + \renewcommand{\@arrow@cross@length}{.5em} + }{ + \ifthenelse{\equal{#1}{above right}}{% nach oben rechts, Einstellungen: + \renewcommand{\@arrow@end}{\@arrow@length@factor\@arrow@length@default,\@arrow@length@factor\@arrow@length@default} + \renewcommand{\@arrow@currentabove}{above left} + \renewcommand{\@arrow@currentbelow}{below right} + \renewcommand{\@arrow@xshift}{\the\@arrow@shift@value} + \renewcommand{\@arrow@yshift}{\the\@arrow@shift@value} + \renewcommand{\@arrow@start@up}{0.02,-0.02} + \renewcommand{\@arrow@start@down}{-0.02,0.02} + \renewcommand{\@arrow@cross@base@x}{.1em} + \renewcommand{\@arrow@cross@base@y}{.1em} + \renewcommand{\@arrow@cross@angle}{-15} + \renewcommand{\@arrow@cross@length}{.7em} + }{ + \ifthenelse{\equal{#1}{above}}{% nach oben, Einstellungen: + \renewcommand{\@arrow@end}{0,\@arrow@length@factor\@arrow@length@default} + \renewcommand{\@arrow@currentabove}{left} + \renewcommand{\@arrow@currentbelow}{right} + \renewcommand{\@arrow@xshift}{1.2em} + \renewcommand{\@arrow@yshift}{0} + \renewcommand{\@arrow@start@up}{0.03,0} + \renewcommand{\@arrow@start@down}{-0.03,0} + \renewcommand{\@arrow@cross@base@x}{0} + \renewcommand{\@arrow@cross@base@y}{.15em} + \renewcommand{\@arrow@cross@angle}{30} + \renewcommand{\@arrow@cross@length}{.5em} + }{ + \ifthenelse{\equal{#1}{above left}}{% nach oben links, Einstellungen: + \renewcommand{\@arrow@end}{-\@arrow@length@factor\@arrow@length@default,\@arrow@length@factor\@arrow@length@default} + \renewcommand{\@arrow@currentabove}{above right} + \renewcommand{\@arrow@currentbelow}{below left} + \renewcommand{\@arrow@xshift}{-\the\@arrow@shift@value} + \renewcommand{\@arrow@yshift}{\the\@arrow@shift@value} + \renewcommand{\@arrow@start@up}{-0.02,-0.02} + \renewcommand{\@arrow@start@down}{0.02,0.02} + \renewcommand{\@arrow@cross@base@x}{-.1em} + \renewcommand{\@arrow@cross@base@y}{.1em} + \renewcommand{\@arrow@cross@angle}{15} + \renewcommand{\@arrow@cross@length}{.7em} + }{ + \ifthenelse{\equal{#1}{left}}{% nach links, Einstellungen: + \renewcommand{\@arrow@end}{-\@arrow@length@factor\@arrow@length@default,0} + \renewcommand{\@arrow@currentabove}{above} + \renewcommand{\@arrow@currentbelow}{below} + \renewcommand{\@arrow@xshift}{0} + \renewcommand{\@arrow@yshift}{1.2em} + \renewcommand{\@arrow@start@up}{0,0.03} + \renewcommand{\@arrow@start@down}{0,-0.03} + \renewcommand{\@arrow@cross@base@x}{.15em} + \renewcommand{\@arrow@cross@base@y}{0} + \renewcommand{\@arrow@cross@angle}{60} + \renewcommand{\@arrow@cross@length}{.5em} + }{ + \ifthenelse{\equal{#1}{below left}}{% nach unten links, Einstellungen: + \renewcommand{\@arrow@end}{-\@arrow@length@factor\@arrow@length@default,-\@arrow@length@factor\@arrow@length@default} + \renewcommand{\@arrow@currentabove}{above left} + \renewcommand{\@arrow@currentbelow}{below right} + \renewcommand{\@arrow@xshift}{\the\@arrow@shift@value} + \renewcommand{\@arrow@yshift}{\the\@arrow@shift@value} + \renewcommand{\@arrow@start@up}{-0.02,0.02} + \renewcommand{\@arrow@start@down}{0.02,-0.02} + \renewcommand{\@arrow@cross@base@x}{.1em} + \renewcommand{\@arrow@cross@base@y}{.1em} + \renewcommand{\@arrow@cross@angle}{-15} + \renewcommand{\@arrow@cross@length}{.7em} + }{ + \ifthenelse{\equal{#1}{below}}{% nach unten, Einstellungen: + \renewcommand{\@arrow@end}{0,-\@arrow@length@factor\@arrow@length@default} + \renewcommand{\@arrow@currentabove}{left} + \renewcommand{\@arrow@currentbelow}{right} + \renewcommand{\@arrow@xshift}{1.2em} + \renewcommand{\@arrow@yshift}{0} + \renewcommand{\@arrow@start@up}{0.03,0} + \renewcommand{\@arrow@start@down}{-0.03,0} + \renewcommand{\@arrow@cross@base@x}{0} + \renewcommand{\@arrow@cross@base@y}{.15em} + \renewcommand{\@arrow@cross@angle}{30} + \renewcommand{\@arrow@cross@length}{.5em} + }{ + \ifthenelse{\equal{#1}{below right}}{% nach unten rechts, Einstellungen: + \renewcommand{\@arrow@end}{\@arrow@length@factor\@arrow@length@default,-\@arrow@length@factor\@arrow@length@default} + \renewcommand{\@arrow@currentabove}{above right} + \renewcommand{\@arrow@currentbelow}{below left} + \renewcommand{\@arrow@xshift}{-\the\@arrow@shift@value} + \renewcommand{\@arrow@yshift}{\the\@arrow@shift@value} + \renewcommand{\@arrow@start@up}{0.02,0.02} + \renewcommand{\@arrow@start@down}{-0.02,-0.02} + \renewcommand{\@arrow@cross@base@x}{-.1em} + \renewcommand{\@arrow@cross@base@y}{.1em} + \renewcommand{\@arrow@cross@angle}{15} + \renewcommand{\@arrow@cross@length}{.7em} + }{ + \PackageError{mychemistry}{Unknown arrow direction}% oder Fehler + } + } + } + } + } + } + } + } +} + +% Pfeiltyp ---------------------------------------------------------------------------- % +\newcommand{\@arrow@drawing}{} +\define@key{arrow}{type}[\@arrow@type]{% + \renewcommand{\@arrow@currenttype}{#1} + \ifthenelse{\equal{#1}{->}}{ + \renewcommand{\@arrow@drawing}{\tikz\draw[->,thick,text height=0] (0,0) -- ++(\@arrow@end);} + }{ + \ifthenelse{\equal{#1}{<->}}{ + \renewcommand{\@arrow@drawing}{\tikz\draw[<->,thick,text height=0] (0,0) -- ++(\@arrow@end);} + }{ + \ifthenelse{\equal{#1}{<-}}{ + \renewcommand{\@arrow@drawing}{\tikz\draw[<-,thick,text height=0] (0,0) -- ++(\@arrow@end);} + }{ + \ifthenelse{\equal{#1}{<=>}}{ + \renewcommand{\@arrow@drawing}{\tikz{\draw[-left to,thick,text height=0] (\@arrow@start@up) -- ++(\@arrow@end);\draw[left to-,thick,text height=0] (\@arrow@start@down) -- ++(\@arrow@end);}} + }{ + \ifthenelse{\equal{#1}{-|>}}{ + \renewcommand{\@arrow@cross@draw}{\draw[thick] ($(@cross.base) + (\@arrow@cross@base@x,\@arrow@cross@base@y) + (\@arrow@cross@angle:\@arrow@cross@length)$) -- ($(@cross.base) + (\@arrow@cross@base@x,\@arrow@cross@base@y) + (\@arrow@cross@angle-180:\@arrow@cross@length)$);\draw[thick] ($(@cross.base) + (-\@arrow@cross@base@x,-\@arrow@cross@base@y) + (\@arrow@cross@angle:\@arrow@cross@length)$) -- ($(@cross.base) + (-\@arrow@cross@base@x,-\@arrow@cross@base@y) + (\@arrow@cross@angle-180:\@arrow@cross@length)$);} + \renewcommand{\@arrow@drawing}{\tikz{\draw[->,thick,text height=0] (0,0) -- node[pos=.5](@cross){} ++(\@arrow@end);\@arrow@cross@draw}} + }{ + \PackageError{mychemistry}{Unknown arrow type}% oder Fehler + } + } + } + } + } +}% + +% Pfeil zeichnen ---------------------------------------------------------------------- % +\newcommand{\@arrow}[3][]{ + \renewcommand{\@arrow@length@factor}{\@arrow@currentlength} + \@arrow@shift{\@arrow@length@factor} + \draw node[on chain=going \@arrow@currentdirection](\@arrow@currentname) {\@arrow@drawing}; + \begin{scope}[start branch] + \node[on chain=going \@arrow@currentabove, yshift=-\@arrow@yshift, xshift=\@arrow@xshift]{#2}; + \end{scope} + \begin{scope}[start branch] + \node[on chain=going \@arrow@currentbelow, yshift=\@arrow@yshift, xshift=-\@arrow@xshift] {#3}; + \end{scope} +} + +% Voreinstellungen: +\presetkeys% + {arrow} + {direction=\@arrow@direction,length=\@arrow@length,type=\@arrow@type} + {} + +% Eigentlicher Befehl: +\providecommand{\arrow}[3][]{ + \setkeys{arrow}{#1} + \@arrow{#2}{#3} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% MERGE ------------------------------------------------------------------------------- % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newcommand{\@merge@direction}{below} +\newcommand{\@merge@to}{} +\newcommand{\@merge@from@one}{} +\newcommand{\@merge@from@two}{} +\newcommand{\@merge}[3]{ + \renewcommand{\@merge@to}{#1} + \renewcommand{\@merge@from@one}{#2} + \renewcommand{\@merge@from@two}{#3} +} +% Basisbefehle ------------------------------------------------------------------------ % +\newcommand{\@merge@right}{ + \draw[stealth-,thick] ($(\@merge@to.west)+(-1em,0)$) -- ($(\@merge@to.west)+(-4em,0)$) node(crossing) {}; + \draw[thick] ($(\@merge@from@one.east)+(1em,0)$) -| (crossing.base); + \draw[thick] ($(\@merge@from@two.east)+(1em,0)$) -| (crossing.base); +} +\newcommand{\@merge@above}{ + \draw[stealth-,thick] ($(\@merge@to.south)+(0,-1em)$) -- ($(\@merge@to.south)+(0,-4em)$) node(crossing) {}; + \draw[thick] (crossing.base) -| ($(\@merge@from@one.north)+(0,1em)$); + \draw[thick] (crossing.base) -| ($(\@merge@from@two.north)+(0,1em)$); +} +\newcommand{\@merge@left}{ + \draw[stealth-,thick] ($(\@merge@to.east)+(1em,0)$) -- ($(\@merge@to.east)+(4em,0)$) node(crossing) {}; + \draw[thick] ($(\@merge@from@one.west)+(-1em,0)$) -| (crossing.base); + \draw[thick] ($(\@merge@from@two.west)+(-1em,0)$) -| (crossing.base);; +} +\newcommand{\@merge@below}[3]{ + \draw[stealth-,thick] ($(\@merge@to.north)+(0,1em)$) -- ($(\@merge@to.north)+(0,4em)$) node(crossing) {}; + \draw[thick] (crossing.base) -| ($(\@merge@from@one.south)+(0,-1em)$); + \draw[thick] (crossing.base) -| ($(\@merge@from@two.south)+(0,-1em)$); +} +% key zur Auswahl --------------------------------------------------------------------- % +\define@choicekey{merge}{direction}[\val\nr]{right,above,left,below}[below]{ + \ifcase\nr\relax + \@merge@right + \or + \@merge@above + \or + \@merge@left + \or + \@merge@below + \fi +} +% Voreinstellung ---------------------------------------------------------------------- % +\presetkeys% + {merge} + {direction=below} + {} +% eigentlicher Befehl ----------------------------------------------------------------- % +\newcommand{\merge}[4][]{ + \@merge{#2}{#3}{#4} + \setkeys{merge}{#1} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% REAKTIONSSCHEMA --------------------------------------------------------------------- % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% ------------------------------------------------------------------------------------- % +% Schema ------------------------------------------------------------------------------ % +% ------------------------------------------------------------------------------------- % +\newcommand{\@mc@rs@scale}{1.0} % Default-Skalierung +\newcommand{\@mc@rs@currentscale}{\@mc@rs@scale} % +\newcommand{\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]{ % + \renewcommand{\@mc@rs@currentscale}{#1} % +} % +\define@key{rxnscheme}{name}{ % + \renewcommand{\@mc@rs@name}{#1} % +} +\define@key{rxnscheme}{placement}{ + \renewcommand{\@mc@rs@currentplacement}{#1} +} +% Voreinstellungen: +\presetkeys% + {rxnscheme} + {scale=\@mc@rs@scale,label=\@mc@rs@label} + {} +% 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\@mc@atomsize\@mc@bondlength\@mc@bondshape + \begin{tikzpicture}[every picture/.style={scale=\@mc@rs@currentscale},start chain,node distance = 1em] +}{% + \end{tikzpicture}% + \caption{\@mc@rs@caption} + \ifthenelse{\equal{\@mc@rs@currentlabel}{}}{}{\label{\@mc@rs@currentlabel}} + \end{rxnfloat} +} + +% ------------------------------------------------------------------------------------- % +% einfache Reaktion ------------------------------------------------------------------- % +% ------------------------------------------------------------------------------------- % +\newcommand{\@mc@reaction@scale}{1.0} +\newenvironment{rxn}[1][1.0]{% + \begin{center} + \@mc@bondlength\@mc@bondshape\@mc@atomsize\renewcommand{\@mc@reaction@scale}{#1} + \begin{tikzpicture}[every picture/.style={scale=\@mc@reaction@scale},start chain,node distance = 1em] +}{% + \end{tikzpicture}% + \end{center} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% REAKTANDEN -------------------------------------------------------------------------- % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Standardreaktand -------------------------------------------------------------------- % +\newcommand{\@mc@reactand}[3][]{\draw node[on chain=going #1](#3) {#2};} +\providecommand{\reactand}[3][right]{\@mc@reactand[#1]{#2}{#3}} + +% Mesomerie --------------------------------------------------------------------------- % +\newcommand{\@mc@mesomeric}[3][]{\draw node[on chain=going #1,left delimiter={[},right delimiter={]}](#3) {#2};} +\providecommand{\mesomeric}[3][right]{\@mc@mesomeric[#1]{\begin{tikzpicture}[start branch]#2\end{tikzpicture}}{#3}} +\providecommand{\marrow}[1][right]{\arrow[type=<->,length=.5,direction=#1]{}{}} +\providecommand{\dummy}[1][]{\draw node[on chain,xshift=-1em](#1) {};} + +% Uebergangszustand ------------------------------------------------------------------- % +\newcommand\@mc@transition@name{} +\newcommand{\@mc@transition}[3][]{ + \ifthenelse{\equal{#3}{}}{\renewcommand\@mc@transition@name{a}}{\renewcommand\@mc@transition@name{#3}} + \draw node[on chain=going #1,left delimiter={[},right delimiter={]}](\@mc@transition@name) {#2} node at ($(\@mc@transition@name.north east)+(.25,0)$) {$\ddagger$}; +} +\providecommand{\transition}[3][right]{\@mc@transition[#1]{\begin{tikzpicture}[start branch]#2\end{tikzpicture}}{#3}} + +% Abzweigung -------------------------------------------------------------------------- % +\newcommand{\@mc@branch}[3][]{\node[#1] (#3) {#2};} +\providecommand{\branch}[3][on chain=going right]{\@mc@branch[#1]{\begin{tikzpicture}[start branch]#2\end{tikzpicture}}{#3}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Sonstiges --------------------------------------------------------------------------- % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Elektronenverschiebungspfeile ------------------------------------------------------- % +\providecommand{\elmove}[5][->,red,shorten <=3pt,shorten >=1pt]{\chemmove{\draw[#1](#2).. controls +(#3) and +(#5)..(#4);}} +% Bindungslänge ----------------------------------------------------------------------- % +\newcommand{\@mc@bondlength}{\setatomsep{1.8em}} +\providecommand{\bondlength}[1]{ + \ifthenelse{\equal{#1}{}}{ + \renewcommand{\@mc@bondlength}{\setatomsep{1.8em}} + }{ + \renewcommand{\@mc@bondlength}{\setatomsep{#1}} + } +} +% Keilbindungen ----------------------------------------------------------------------- % +\newcommand{\@mc@bondshape@one}{3pt} +\newcommand{\@mc@bondshape@two}{.5pt} +\newcommand{\@mc@bondshape@three}{1pt} +\providecommand{\bondshape}[3]{ + \ifthenelse{\equal{#1}{}}{ + \renewcommand{\@mc@bondshape@one}{3pt} + }{ + \renewcommand{\@mc@bondshape@one}{#1} + } + \ifthenelse{\equal{#2}{}}{ + \renewcommand{\@mc@bondshape@two}{.5pt} + }{ + \renewcommand{\@mc@bondshape@two}{#2} + } + \ifthenelse{\equal{#3}{}}{ + \renewcommand{\@mc@bondshape@three}{1pt} + }{ + \renewcommand{\@mc@bondshape@three}{#3} + } +} +\newcommand{\@mc@bondshape}{\setcrambond{\@mc@bondshape@one}{\@mc@bondshape@two}{\@mc@bondshape@three}} +% Atomgröße --------------------------------------------------------------------------- % +\newcommand{\@mc@atomsize}{\small} +\providecommand{\atomsize}[1]{ + \ifthenelse{\equal{#1}{}}{ + \renewcommand{\@mc@atomsize}{\small} + }{ + \renewcommand{\@mc@atomsize}{#1} + } +} +% ------------------------------------------------------------------------------------- % \ No newline at end of file -- cgit v1.2.3