summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/mychemistry/mychemistry.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/mychemistry/mychemistry.sty')
-rw-r--r--Master/texmf-dist/tex/latex/mychemistry/mychemistry.sty327
1 files changed, 173 insertions, 154 deletions
diff --git a/Master/texmf-dist/tex/latex/mychemistry/mychemistry.sty b/Master/texmf-dist/tex/latex/mychemistry/mychemistry.sty
index 6d595e3df45..089ac37b854 100644
--- a/Master/texmf-dist/tex/latex/mychemistry/mychemistry.sty
+++ b/Master/texmf-dist/tex/latex/mychemistry/mychemistry.sty
@@ -28,7 +28,7 @@
% This work consists of the files mychemistrysty, mychemistry_en.tex,
% README and the derived file mychemistry_en.pdf.
% --------------------------------------------------------------------------
-\ProvidesPackage{mychemistry}[2012/09/20 v1.99a create reaction schemes with LaTeX and chemfig]
+\ProvidesPackage{mychemistry}[2012/12/19 v1.99b create reaction schemes with LaTeX and chemfig]
\RequirePackage{etoolbox,float,xkeyval,chemfig,chemmacros}
\usetikzlibrary{
arrows,
@@ -159,26 +159,14 @@
\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)}}
-}{}
+\RequirePackage{translations}
+\NewTranslation{English} {reaction-scheme-(caption-title)} {Reaction scheme}
+\NewTranslation{French} {reaction-scheme-(caption-title)} {Sch\'{e}ma r\'{e}actionnel}
+\NewTranslation{German} {reaction-scheme-(caption-title)} {Reaktionsschema}
+\NewTranslation{Italian} {reaction-scheme-(caption-title)} {Reazione Scheme}
+\NewTranslation{Spanish} {reaction-scheme-(caption-title)} {Esquema de Reacci\'{o}n}
+\mCh@set@variable\rs@name{\GetTranslation{reaction-scheme-(caption-title)}}
+
% --------------------------------------------------------------------------
% Direction Analysis
@@ -1077,77 +1065,89 @@
% REAKTANDEN
% Standardreaktand
% \reactant[<pos>,<name>,<tikz>]{<something>}
-\newrobustcmd\mCh@reactant[2][]{%
- \ifblank{#1}
- {\mCh@reactant@i}{\mCh@reactant@ii[#1]}
- {#2}}
+\def\mCh@argument@safe{\@makeother\#}
+
+\newrobustcmd\mCh@reactant[1][]{%
+ \begingroup
+ \mCh@argument@safe
+ \ifblank{#1}
+ {\mCh@reactant@i}
+ {\mCh@reactant@ii[#1]}%
+}
\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}};
+ \expandafter\node\expandafter[%
+ \mCh@reactant@visible,
+ on chain=going {at=(\tikzchainprevious.0)},
+ anchor=180,
+ shift=(0:\mCh@rxn@node@distance)]{#1};
+ \endgroup
}
\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}};
+ \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){#2};
+ \endgroup
}
% Mesomerie
% \mesomeric[<pos>,<name>,<tikz>]{<something>}
-\newrobustcmd\mCh@mesomeric[2][]{%
- \ifblank{#1}
- {\mCh@mesomeric@i}{\mCh@mesomeric@ii[#1]}
- {#2}}
+\newrobustcmd\mCh@mesomeric[1][]{%
+ \begingroup
+ \mCh@argument@safe
+ \ifblank{#1}
+ {\mCh@mesomeric@i}
+ {\mCh@mesomeric@ii[#1]}%
+}
\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};
+ \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]#1\endtikzpicture};
+ \endgroup
}
\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};
+ \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]#2\endtikzpicture};
+ \endgroup
}
% Mesomerie-Pfeil
@@ -1158,29 +1158,36 @@
% \anywhere{<pos>,<name>,<tikz>}{<something>}
\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}%
+\newrobustcmd\mCh@anywhere[1]{%
+ \begingroup
+ \mCh@argument@safe
+ \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@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'}%
+ \expandafter\mCh@if@instr\expandafter{\mCh@firstarg}{=}{%
+ \mCh@xset@variable\anywhere@positioning{\mCh@firstarg}%
}{%
- \mCh@set@variable\anywhere@positioning{%
- at=(\mCh@referred@node.\mCh@angle),anchor=\mCh@anchor}%
+ \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};
+ \mCh@anywhere@i
+}
+
+\mCh@def\mCh@anywhere@i#1{%
+ \expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[%
+ \expandafter\mCh@thirdarg\expandafter,%
+ \mCh@anywhere@positioning](\mCh@secondarg){#1};
+ \endgroup
}
% Dummy
@@ -1194,51 +1201,58 @@
% \transition[<pos>,<name>,<tikz>]{<something>}
\mCh@new@variable\transition@name
-\newrobustcmd\mCh@transition[2][]{%
- \ifblank{#1}
- {\mCh@transition@i}{\mCh@transition@ii[#1]}
- {#2}}
+\newrobustcmd\mCh@transition[1][]{%
+ \begingroup
+ \mCh@argument@safe
+ \ifblank{#1}
+ {\mCh@transition@i}
+ {\mCh@transition@ii[#1]}%
+}
\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$};
+ \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){#1};
+ \node at ($(mCh@transition@name.north east)+(.7em,0)$)
+ {$\transitionstatesymbol$};
+ \endgroup
}
\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$};
+ \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){#2};
+ \node at ($(\mCh@transition@name.north east)+(.7em,0)$)
+ {$\transitionstatesymbol$};
+ \endgroup
}
% Abzweigung
@@ -1250,21 +1264,24 @@
% <name>.<angle> (sitzt nicht auf der Kette)
\mCh@new@variable\branch@positioning
-\newrobustcmd\mCh@branch[2][]{%
- \ifblank{#1}
- {\mCh@branch@i}{\mCh@branch@ii[#1]}
- {#2}}
+\newrobustcmd\mCh@branch[1][]{%
+ \begingroup
+ \mCh@argument@safe
+ \ifblank{#1}
+ {\mCh@branch@i}
+ {\mCh@branch@ii[#1]}%
+}
-\mCh@def\mCh@branch@i#1{%
+\mCh@def\mCh@branch@i{%
\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@branch@iii}
-\mCh@def\mCh@branch@ii[#1]#2{%
+\mCh@def\mCh@branch@ii[#1]{%
\let\mCh@remainargs\@empty
\mCh@splitarg{#1}% erste Option: <pos>, zweite Option: <name>, dritte Option: <tikz>
\mCh@ifempty@variable\firstarg{%
@@ -1291,15 +1308,16 @@
}%
}%
}%
- \mCh@branch@iii{#2}}
+ \mCh@branch@iii}
\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
+ \expandafter\expandafter\expandafter\node\expandafter\expandafter\expandafter[%
+ \expandafter\mCh@branch@positioning\expandafter,%
+ \mCh@thirdarg]
+ (\mCh@secondarg){\tikzpicture[start branch]#1\endtikzpicture};
+ \endgroup
+}%
+
% --------------------------------------------------------------------------
% Sonstiges
@@ -1507,7 +1525,7 @@ HISTORY:
- synonym to \reactand=\reactant added
- rxn & rxnscheme rewritten
- commands \reactant, \mesomeric, \branch & \transition
- modified: argument is set with \scantokens{\relax#1},
+ modified: argument is set with \mCh@argument@safe{#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
@@ -1533,6 +1551,7 @@ HISTORY:
packages; \merge is also only defined inside the scheme
environments
2012/09/20 version 1.99a - small adjustments to \elmove
+2012/12/19 version 1.99b - changed catcode regime (# is read with catcode 12)
+ so that chemfig's bond offset works
-% ----------------------------------------------------------------------------
-% TODO \ No newline at end of file
+% ---------------------------------------------------------------------------- \ No newline at end of file