%D \module %D [ file=m-chemie, %D versie=1996.10.16, %D naam=\PPCHTEX\ (Plain Pictex Context cHemie \TEX), %D auteur=J. Hagen, %D datum=\huidigedatum, %D copyright=J. Hagen, A.F. Otten] % % Copyright Notice / 1996 % % This module is part of the ConTeXt distribution. This % macropackage will be put in the public domain as soon as the % source is fully documented. % % This module is to be used as a whole and may not be adapted % without knowledge of the authors. No separate parts may be % distributed. % % Non-commercial (educational) institutions are hereby granted % to use this module. Commercial use is only permitted after % written permission. % % Errors can be reported to the authors and will be solved as % soon as possible. Suggestions are welcome. % % copyright : PRAGMA % authors : J. Hagen / A.F. Otten % address : Postbox 125 % 8000 AC Zwolle % The Netherlands % telephone : 038 4 229 775 % e-mail : pragma@pi.net % Deze module ondersteunt het zetten van chemische % (structuur)formules. Hoewel de macro' zijn afgestemd op % CONTEXT, zijn ze ook buiten deze zetomgeving te gebruiken. % % Dit is, afgezien van updates, de definitieve versie van % PPCHTEX. Gebruikersgemak, eenvoud, flexibiliteit, en % snelheid zijn inmiddels redelijk geoptimaliseerd. Dit neemt % niet weg dat hier en daar nog verbetering mogelijk is. Dit % zal dan ook nog gebeuren. % % Volgende versies zullen tenminste dezelfde functionaliteit % hebben. We houden ons natuurlijk het recht voor de kwaliteit % van de output te verbeteren. Daarnaast staan nog op het % wensenlijstje: % % - optimaliseren in termen van proces-tijd % - aanpassen naamgeving van interne macro's % - toevoegen van functionaliteit % - in \!!-vorm omzetten van GIVES, TB enz. % % De mix tussen engels en nederlands lijkt soms verwarrend. % Meestal zijn verborgen macro's engels en zichtbare macro's % nederlands. Het gebruik van [ ] en { } sluit aan op andere % Context-macro's. Hetzelfde geldt voor instellingen en % \start-\stop-constructies. % % De schijnbaar overbodige \bgroup-\egroup constructie % garandeert aansluiting bij de Context-macro's voor het % plaatsen van figuren, tabellen en andere floats. % % Binnen Context worden de macro's geladen met % \gebruikextras[chemie]. Daarbij wordt een passende melding % getoont. Buiten Context genereren we een melding: \doifundefined{gebruikextras}% {\writestatus{laden}{Context Chemie Macro's / 1996.3.1}} % Er wordt gebruik gemaakt van PiCTeX, een macropakket dat % is ontwikkeld door M.J. Wichura. Hieronder wordt PiCTeX % geladen. Er wordt, zonodig, rekening gehouden met LaTeX. \doifundefined{doinputonce} {\def\doinputonce#1{\input #1 \relax}} \doifundefined{fiverm} % In the more recent LaTeX versions {\font\fiverm=cmr5 } % \fiverm is no longer (pre)defined. \doifundefined{beginpicture} % PiCTeX {\doifdefinedelse{newenvironment}% % LaTeX {\doinputonce{prepictex}% \doinputonce{pictex}% \doinputonce{postpictex}}% {\doinputonce{pictex}}} % De onderstaande help-informatie (%I) kan worden opgeroepen % in TeXEdit. De daaropvolgende setup-informatie (%S) kan % nadat zij is uit deze file is gefilterd met TeXUtil, in % handleidingen worden gebruikt. In deze file opgenomen % documentatie (%D en %M) kan worden gebruikt voor een % technische handleiding. Met %T kunnen templates worden % gedefinieerd voor TeXEdit. %I n=Chemie %I c=\stelchemiein,\chemie %I %I Chemische formules kunnen worden gezet met behulp van de %I onderstaande commando's: %I %I buiten $ en $$ : %I %I \chemie[segmenten][symbolen] %I %I \startchemie[instellingen] %I \chemie... %I \chemie... %I \stopchemie %I %I en binnen $ en $$: %I %I \chemie{}{} %I %I Voor tekst, uitleg en voorbeelde verwijzen we vooralsnog %I naar de handleiding. %P %I Het gedrag van de macro's kan worden ingesteld met: %I %I \stelchemiein[breedte=,hoogte=,links=,rechts=,boven=, %I onder=,korps=,schaal=,status=,assenstelsel=,kader=, %I variant=,optie=,formaat=,tekstformaat=,resolutie=, %I offset=,letter=] %I %I Structuren kunnen worden voorgedefinieerd met het commando %I %I \definieerchemie[naam]{\chemie...} %S \startsetup %S \command %S [stelchemiein] %S \type %S [\!!vars] %S \variable %S [\!!breedte] %S [\!!getal,\!!passend] %S [0] %S \variable %S [\!!hoogte] %S [\!!getal,\!!passend] %S [0] %S \variable %S [\!!links] %S [\!!getal] %S [0] %S \variable %S [\!!rechts] %S [\!!getal] %S [0] %S \variable %S [\!!boven] %S [\!!getal] %S [0] %S \variable %S [\!!onder] %S [\!!getal] %S [0] %S \variable %S [\!!resolutie] %S [\!!getal] %S [\systeemresolutie] %S \variable %S [\!!korps] %S [10pt,11pt,12pt] %S [\systeemkorps] %S \variable %S [\!!schaal] %S [\!!klein,\!!middel,\!!groot] %S [\!!middel] %S \variable %S [\!!formaat] %S [\!!klein,\!!middel,\!!groot] %S [\!!groot] %S \variable %S [\!!tekstformaat] %S [\!!klein,\!!middel,\!!groot] %S [\!!groot] %S \variable %S [\!!status] %S [\!!start,\!!stop] %S [\!!start] %S \variable %S [\!!kader] %S [\!!aan,\!!uit] %S [\!!uit] %S \variable %S [\!!assenstelsel] %S [\!!aan,\!!uit] %S [\!!uit] %S \variable %S [\!!optie] %S [\!!test] %S [] %S \variable %S [\!!variant] %S [1,2] %S [1] %S \variable %S [\!!offset] %S [HIGH,LOW] %S [LOW] %S \variable %S [\!!letter] %S [\!!commando] %S [\rm] %S \stopsetup %S \startsetup %S \command %S [startchemie] %S \type %S [\!!vars\!!stp] %S \variable %S [\!!breedte] %S [\!!getal,\!!passend] %S [0] %S \variable %S [\!!hoogte] %S [\!!getal,\!!passend] %S [0] %S \variable %S [\!!links] %S [\!!getal] %S [0] %S \variable %S [\!!rechts] %S [\!!getal] %S [0] %S \variable %S [\!!boven] %S [\!!getal] %S [0] %S \variable %S [\!!onder] %S [\!!getal] %S [0] %S \variable %S [\!!korps] %S [10pt,11pt,12pt] %S [\systeemkorps] %S \variable %S [\!!schaal] %S [\!!klein,\!!middel,\!!groot] %S [\!!groot] %S \variable %S [\!!status] %S [\!!start,\!!stop] %S [\!!start] %S \variable %S [\!!kader] %S [\!!aan,\!!uit] %S [\!!uit] %S \variable %S [\!!assenstelsel] %S [\!!aan,\!!uit] %S [\!!uit] %S \variable %S [\!!optie] %S [\!!test] %S [] %S \variable %S [\!!variant] %S [1,2] %S [1] %S \variable %S [\!!offset] %S [HIGH,LOW] %S [LOW] %S \variable %S [\!!letter] %S [\!!commando] %S [\rm] %S \stopsetup %S \startsetup %S \command %S [chemie] %S \type %S [\!!vals\!!vals] %S \value %S [\!!list] %S [] %S \value %S [\!!list] %S [] %S \stopsetup %S \startsetup %S \command %S [definieerchemie] %S \type %S [\!!val\!!arg] %S \value %S [\!!text] %S [] %S \stopsetup \unprotect % Om te voorkomen dat sub- en superscripts botsen passen we % wat fontdimen's aan (Knuth, The TeXBook, p179). Helaas % kunnen deze instellingen niet lokaal worden gehouden door % groeperen, vandaar dat een en ander moet worden geset ‚n % gereset. % % Er dient een relatie te worden gelegd met de afmetingen % van de letters. In een eerdere versie werden daartoe de % \fontdimen's opgehoogd. Omdat dit problemen gaf bij % scaled fonts, is bij nader inzien gekozen voor de % onderstaande oplossing, waarbij de nieuwe waarden worden % afgeleid van de x-height (\fontdimen5). De factor 0.70 % is min of meer experimenteel vastgesteld. Soms worden de % regels iets verder uit elkaar gezet. Jammer. Italic fonts % hebben grotere cijfers en vallen min of meer uit de boot. \newif\ifloweredsubscripts % Due to some upward incompatibality of LaTeX to LaTeX2.09 % and/or LaTeX2e we had to force \@@chemieletter. Otherwise % some weird \nullfont error comes up. \def\beginlatexmathmodehack% {\ifmmode \let\endlatexmathmodehack=\relax \else \def\endlatexmathmodehack{$}$\@@chemieletter \fi} \def\setsubscripts% {\beginlatexmathmodehack \def\dosetsubscript##1##2##3% {\dimen0=##3\fontdimen5##2% \setxvalue{@@\string##1\string##2}{\the##1##2\relax}% ##1##2=\dimen0\relax}% \def\dodosetsubscript##1##2% {\dosetsubscript{##1}{\textfont2}{##2}% \dosetsubscript{##1}{\scriptfont2}{##2}% \dosetsubscript{##1}{\scriptscriptfont2}{##2}}% %\dodosetsubscript{\fontdimen14}{?}% \dodosetsubscript{\fontdimen16}{.7}% \dodosetsubscript{\fontdimen17}{.7}% \global\loweredsubscriptstrue \endlatexmathmodehack} \def\resetsubscripts% {\ifloweredsubscripts \beginlatexmathmodehack \def\doresetsubscript##1##2% {\dimen0=\getvalue{@@\string##1\string##2}\relax ##1##2=\dimen0}% \def\dodoresetsubscript##1% {\doresetsubscript{##1}{\textfont2}% \doresetsubscript{##1}{\scriptfont2}% \doresetsubscript{##1}{\scriptscriptfont2}}% %\dodoresetsubscript{\fontdimen14}% \dodoresetsubscript{\fontdimen16}% \dodoresetsubscript{\fontdimen17}% \global\loweredsubscriptsfalse \endlatexmathmodehack \fi} \def\doresetsubscripts% {\resetsubscripts} \def\sethighsubscripts% {\resetsubscripts \let\dosetsubscripts=\relax} \def\setlowsubscripts% {\def\dosetsubscripts{\setsubscripts}} \setlowsubscripts \newcount\horchemical % t.z.t. \newcounter \newcount\verchemical % t.z.t. \newcounter \newcount\txtchemical % t.z.t. \newcounter \newcount\chemicalfile % t.z.t. \newcounter \newif\ifinchemical \inchemicalfalse \newif\iffixedchemical \fixedchemicalfalse \newif\ifsavechemical \savechemicalfalse \newif\ifloadchemical \loadchemicalfalse \newbox\chemicalsymbols % Eigenlijk moeten de constanten en variabelen in cont-nl.tex % staan. Dit pakket is echter relatief onafhankelijk van CONTEXT. \def\!!chemie {chemie} \def\??chemie {@@chemie} \def\!!translate {translate} \def\!!distance {distance} \def\!!mirror {mirror} \def\!!rotate {rotate} \def\!!substitute {substitute} \def\!!executechemical {executechemical} \def\!!chemicaltextelement {chemicaltext} \def\!!chemicallinesegment {chemicalline} \def\!!chemicalcircsegment {chemicalcirc} \def\!!chemicalspace {\quad} % begin van experiment: % % De onderstaande twee macro's kunnen worden gebruikt voor % bijvoorbeeld een interactiemechanisme. % % \gotochemical {verwijzing} {tekst} % \thisischemical {verwijzing} \def\dowithchemical% {} \doifdefinedelse{@@iastatus} {\def\gotochemical#1#2{\naar{#2}[#1]}% \def\thisischemical#1{\paginareferentie[#1]}} {\def\gotochemical#1{}% \def\thisischemical#1{}} % eind van experiment \def\setchemicalmaximum #1 {\def\maxchemical{#1}} \def\doifchemicalnumber#1#2#3% {\doifnumberelse{#1} {\ifnum#1>\maxchemical \writestatus{chemie}{nummer #1 wordt overgeslagen}% \else #3% \fi} {\unknownchemical{#2}}}% \def\stelchemieformaatin[#1]% {\assignvalue {\dogetvalue{#1}{\!!formaat}} {\@@localchemieformaat} {\scriptscriptstyle} {\scriptstyle} {\textstyle}% \assignvalue {\dogetvalue{#1}{\!!tekstformaat}} {\chemicalstyle} {\scriptscriptstyle} {\scriptstyle} {\textstyle}% \assignvalue {\dogetvalue{#1}{\!!schaal}} {\@@localchemieschaal} {500} {625} {750}} \def\dostelchemiein[#1]% {\getparameters[\??chemie\!!chemie][#1]% \doifelse{\@@chemiechemieoffset}{LOW} {\setlowsubscripts} {\sethighsubscripts}% \stelchemieformaatin[\??chemie\!!chemie]} \def\stelchemiein% {\dosingleargument\dostelchemiein} \def\@@chemieletter% % $inner-style$ {\@@chemiechemieletter} % $$outer-style$$ \def\doloadchemical% {\global\advance\chemicalfile by 1\relax \writestatus{chemie}{inlezen uit chem-\the\chemicalfile.tex}% \replot "chem-\the\chemicalfile.tex" } \def\dosavechemical% {\global\advance\chemicalfile by 1\relax \writestatus{chemie}{wegschrijven naar chem-\the\chemicalfile.tex}% \savelinesandcurves on "chem-\the\chemicalfile.tex" } \def\writetest#1#2% {} \def\complexstartchemie[#1]% {\copyparameters [\??chemie][\??chemie\!!chemie] [\!!breedte,\!!hoogte,\!!links,\!!rechts,\!!boven,\!!onder, \!!korps,\!!formaat,\!!schaal,\!!status,\!!kader,\!!assenstelsel, \!!plaats,\!!optie,\!!variant,\!!file,\!!resolutie,\!!offset, \!!letter]% \getparameters [\??chemie] [#1]% \beginpicture % \stelchemieformaatin[\??chemie]% % \doif{\@@chemievariant}{2} {\!widtha=50.8mm \divide\!widtha by \@@chemieresolutie\relax \plotsymbolspacing=\!widtha \setplotsymbol({\vrule\!!!height\!widtha\!!!width\!widtha})}% % \!counta=250000 \divide\!counta by \@@localchemieschaal \!widtha=\@@chemiekorps \divide\!widtha by \!counta \setcoordinatesystem units <\the\!widtha,\the\!widtha>% % % \!counta = -x \!countc = -y % \!countb = +x \!countd = +y % \def\calculateaxis##1##2##3##4##5% {##1=##3\relax ##2=##4\relax \ifnum##5=0 \ifnum##3=0 \ifnum##4=0 ##1=2000 ##2=2000 \fi \fi \else \ifnum##3=0 \ifnum##4=0 ##1=##5\relax \divide##1 by 2 ##2=##1\relax \else ##1=##5\relax \advance##1 by -##2\relax \fi \else \ifnum##4=0 ##2=##5\relax \advance##2 by -##1\relax \fi \fi \fi}% \fixedchemicalfalse \doif{\@@chemiebreedte}{\!!passend} {\def\@@chemiebreedte{1}% \fixedchemicaltrue}% \doif{\@@chemiehoogte}{\!!passend} {\def\@@chemiehoogte{1}% \fixedchemicaltrue}% \calculateaxis {\!counta}{\!countb} {\@@chemielinks}{\@@chemierechts}{\@@chemiebreedte}% \calculateaxis {\!countc}{\!countd} {\@@chemieonder}{\@@chemieboven}{\@@chemiehoogte}% % \doifelse{\@@chemieplaats}{\!!intekst} {\accountingon \setplotarea x from 0 to 0, y from 0 to 0 }% {\setplotarea x from {-\the\!counta} to {\the\!countb}, y from {-\the\!countc} to {\the\!countd} }% % \doifinset{\!!aan}{\@@chemiekader,\@@chemieassenstelsel} {\axis top / \axis bottom / \axis left / \axis right / }% \doif{\@@chemiestatus}{\!!start} {\doif{\@@chemieassenstelsel}{\!!aan} {\axis bottom shiftedto y=0 ticks from {-\the\!counta} to {\the\!countb} by 500 / \axis left shiftedto x=0 ticks from {-\the\!countc} to {\the\!countd} by 500 / }}% \iffixedchemical \accountingon \def\account##1##2% {\put {} at {##1} {##2} }% \else \accountingoff \def\account##1##2% {}% \fi \doifelse{\@@chemieoptie}{\!!test} {\def\writetest{\writestatus}} {\def\writetest##1##2{}}% \doif{\@@chemiefile}{load} % experiment {\loadchemicaltrue % experiment \doloadchemical}% % experiment \doif{\@@chemiefile}{save} % experiment {\savechemicaltrue % experiment \dosavechemical}% % experiment \ignorespaces} \def\startchemie% {\bgroup % t.b.v. ungrouped floats \catcode`\^=\@@superscript % t.b.v. \enableduplication \catcode`\_=\@@subscript % t.b.v. de zekerheid \begingroup % t.b.v. symmetrietest: %% \endgroup \inchemicaltrue \def\@@chemicalpostponed{}% \setbox0=\vbox\bgroup \complexorsimpleempty{startchemie}} \def\stopchemie% {\put {\box\chemicalsymbols} at 0 0 % \endpicture \egroup \!heighta=\ht0 \advance\!heighta by \dp0 \ht0=\!heighta \dp0=\!!zeropoint \box0 \inchemicalfalse % t.b.v. symmetrietest: %% \begingroup \endgroup \egroup % t.b.v. ungrouped floats \ignorespaces} % \setchemicalcoordinates{#1}{#2} % % #1: verplaatsing in x-richting % #2: verplaatsing in y-richting \def\setchemicalcoordinates#1#2% {\advance\horchemical by #1\relax \advance\verchemical by #2\relax \setcoordinatesystem point at {\the\horchemical} {\the\verchemical} } \def\resetchemicalcoordinates% {\horchemical=0 \verchemical=0 \setcoordinatesystem point at 0 0 } \def\setchemicaltranslate #1 #2 #3 {\setvalue{\!!translate#1}{\setchemicalcoordinates{#2}{#3}}} \def\processchemicaltranslate#1% {\def\doprocess[##1##2]% {\doifchemicalnumber{##1}{MOV#1} {\ifnum##1=0 \resetchemicalcoordinates \else \getvalue{\!!translate##1}% \dochemicaloffset{##1}% \def\chemicaloffset{0}% \def\chemicaloffsetfactor{1}% \fi}}% \doprocess[#1]} \def\setchemicaldistance #1 {\setvalue{\!!distance1}{\setchemicalcoordinates{-#1}{ 0}}% \setvalue{\!!distance2}{\setchemicalcoordinates{ 0}{ #1}}% \setvalue{\!!distance3}{\setchemicalcoordinates{ #1}{ 0}}% \setvalue{\!!distance4}{\setchemicalcoordinates{ 0}{-#1}}} \def\processchemicaldistance#1% {\def\doprocess[##1##2]% {\doifchemicalnumber{##1}{ADJ#1} {\ifnum##1=0 \resetchemicalcoordinates \else \def\@@chemicalpostponed{\getvalue{\!!distance##1}}% \@@chemicalpostponed \fi}}% \doprocess[#1]} \def\setchemicalsubstitute #1 {\setvalue{\!!substitute1}{\setchemicalcoordinates{-#1}{ 0}}% \setvalue{\!!substitute2}{\setchemicalcoordinates{ 0}{ #1}}% \setvalue{\!!substitute3}{\setchemicalcoordinates{ #1}{ 0}}% \setvalue{\!!substitute4}{\setchemicalcoordinates{ 0}{-#1}}} \def\processchemicalsubstitute#1% {\def\doprocess[##1##2]% {\doifchemicalnumber{##1}{SUB#1} {\ifnum##1=0 \resetchemicalcoordinates \else \def\@@chemicalpostponed{\getvalue{\!!substitute##1}}% \@@chemicalpostponed \fi}}% \doprocess[#1]} % Het is mogelijk een offset of move meerdere malen uit te % voeren, door een nummer voor het commando te plaatsen. \def\chemicalrepeat {1} \def\doprocesschemical[#1#2]#3% {\doifnumberelse{#1} {\def\chemicalrepeat{#1}% \processchemical[#2]% \def\chemicalrepeat{1}} {#3}} % \dochemicaloffset{#1} % % #1: binding \def\chemicaloffsetfactor {1} \def\chemicaloffset {0} \def\processchemicaloffset#1% {\def\doprocess[##1##2]% {\doifnumberelse{##1} {\let\chemicaloffsetfactor=\chemicalrepeat \def\chemicaloffset{##1}} {\unknownchemical{OFF#1}}}% \doprocess[#1]} \def\dochemicaloffset#1% {\doifinsetelse{#1}{1,2,8}% {\!counta=200\relax \multiply\!counta by \chemicaloffset\relax \multiply\!counta by \chemicaloffsetfactor\relax \edef\currentchemicaloffset{\the\!counta}% \setchemicalcoordinates{-\currentchemicaloffset}{0}% \def\undochemicaloffset% {\setchemicalcoordinates{\currentchemicaloffset}{0}% \def\undochemicaloffset{}}} {\def\undochemicaloffset{}}} % \dosetchemicalrotation{#1}{#2} % % #1: cos(phi) % #2: sin(phi) \def\chemicalrotation {1} \def\setchemicalmirror#1% {\setvalue{\!!mirror#1}{*}} \def\resetchemicalmirror#1% {\resetvalue{\!!mirror#1}} \def\togglechemicalmirror#1% {\doifelse{\getvalue{\!!mirror#1}}{*} {\resetchemicalmirror{#1}} {\setchemicalmirror{#1}}} \def\dosetchemicalrotation#1#2% {\startrotation by {#1} {#2} } %% \stoprotation (t.b.v. testen) \def\chemicalrotate[#1]% {\doifdefinedelse{\!!mirror#1} {\getvalue{\!!rotate\chemicalrotation.#1\getvalue{\!!mirror#1}}} {\getvalue{\!!rotate\chemicalrotation.#1}}} \def\setchemicalrotation #1 #2 #3 #4 #5 #6 #7 #8 #9 {\setvalue{\!!rotate1.#1}{\dosetchemicalrotation{#2}{#3}}% \setvalue{\!!rotate2.#1}{\dosetchemicalrotation{#4}{#5}}% \setvalue{\!!rotate3.#1}{\dosetchemicalrotation{#6}{#7}}% \setvalue{\!!rotate4.#1}{\dosetchemicalrotation{#8}{#9}}} \def\processchemicalrotation#1% {\def\doprocess[##1##2]% {\doifnumberelse{##1} {\def\chemicalrotation{##1}} {\unknownchemical{ROT#1}}}% \doprocess[#1]} % \filtertextelement[#1][#2][#3][#4] % % #1: volgnummer % #2: offset in uitlijningen % #3: lijst met uitlijningen -> \chemicalloca % #4: lijst met teksten -> \chemicaltext \def\filterchemicaltextelement[#1][#2][#3][#4]% {\ifnum#1=0\relax \edef\chemicalloca{}% \else \!counta=\chemicalrotation \advance\!counta by -1 \multiply\!counta by #2 \advance\!counta by #1 \getfromcommalist[#3][\the\!counta]% \let\chemicalloca=\commalistelement \fi \advance\txtchemical by 1 \getfromcommalist[#4][\txtchemical]% \let\chemicaltext=\commalistelement} % \putchemicaltext{#1}{#2} % % #1 : x-coordinaat % #2 : y-coordinaat % % \chemicaltext en \chemicalloca worden met \gettextelement % opgehaald uit de tweede set bij \chemie % % Ten behoeve van testdoeleinden wordt gebruik gemaakt van % \chemicalframe in plaats van het meer sjieke, maar tevens % meer trage \omlijnd. \def\chemicalframe#1% {\hbox{\vbox{\hrule\hbox{\vrule\vbox{#1}\vrule}\hrule}}} \def\putchemicaltext#1#2% % t.b.v. symmetrietest: %% \startrotation {\doifelse{\@@chemieoptie}{\!!test} {\def\@@chemieframe{\stoprotation\chemicalframe}} {\def\@@chemieframe{}}% \dosetsubscripts \setbox2=\hbox{$\@@chemieletter{\@@localchemieformaat \chemicaltext}$}% \setbox4=\hbox{$\@@chemieletter{\@@localchemieformaat C_2^2}$}% \setbox6=\hbox{$\@@chemieletter{\@@localchemieformaat O}$}% % C \doresetsubscripts \doifnot{\@@chemieplaats}{\!!intekst} {\ht2=\ht4 \dp2=\dp4}% \setbox2=\hbox{\@@chemieframe{\box2}}% \ifdim\wd2>\wd6 \doifelse{#1#2}{00} {\wd2=\wd6} {\doifinset{\chemicalloca}{t,b}{\wd2=\wd6}}% \fi \put {\dowithchemical{\copy2}} % per se \copy0 i.p.v. \box2 [\chemicalloca] at {#1} {#2} } \def\setchemicaltextelement #1 #2 #3 {\setvalue{\!!chemicaltextelement#1}{\putchemicaltext{#2}{#3}}} \def\getchemicaltextelement[#1][#2][#3][#4][#5]% {\filterchemicaltextelement[#2][#3][#4][#5]% \doifelse{#2}{0} {\putchemicaltext{0}{0}} {\chemicalrotate[#2]% \dochemicaloffset{#2}% \getvalue{\!!chemicaltextelement#1}% \undochemicaloffset}} \def\processchemicaltextelement#1#2#3#4#5% {\def\doprocess[##1##2##3##4##5]% {\doifelse{##1}{?} {\doprocess[1..\maxchemical ????]} {\doifchemicalnumber{##1}{#1#2} {\doifelse{##2##3}{..} {\doifchemicalnumber{##4}{#1#2} {\getchemicaltextelement[#1][##1][#4][#5][#3]% \doifnot{##1}{##4} {\!counta=##1\relax \advance\!counta by 1 \edef\nextsegment{\the\!counta}% \doprocess[\nextsegment..##4##5]}}} {\getchemicaltextelement[#1][##1][#4][#5][#3]% \doifnot{##2}{?}{\doprocess[##2##3##4##5]}}}}}% \doprocess[#2]} % \plotchemicalline{#1}{#2}{#3}{#4} % % #1: x-coordinaat beginpunt % #2: y-coordinaat beginpunt % #3: x-coordinaat eindpunt % #4: y-coordinaat eindpunt \def\plotchemicalline#1#2#3#4% {\ifloadchemical \else \plot {#1} {#2} {#3} {#4} / \fi \account{#1}{#2}% \account{#3}{#4}} \def\setchemicallinesegment #1 #2 #3 #4 #5 {\setvalue{\!!chemicallinesegment#1}{\plotchemicalline{#2}{#3}{#4}{#5}}} \def\getchemicallinesegment[#1][#2]% {\chemicalrotate[#1]% \dochemicaloffset{#1}% \getvalue{\!!chemicallinesegment#2}% \getvalue{\!!chemicallinesegment#21}% \getvalue{\!!chemicallinesegment#22}% \undochemicaloffset} \def\getprivatechemicallinesegment[#1][#2]% {\chemicalrotate[#1]% \getvalue{\!!chemicallinesegment#2#1}} \def\doprocesschemicallinesegment#1#2#3% {\def\doprocess[##1##2##3##4##5]% {\doifelse{##1}{?} {\doprocess[1..\maxchemical ????]} {\doifchemicalnumber{##1}{#2#3} {\doifelse{##2##3}{..} {\doifchemicalnumber{##4}{#2#3} {#1[##1][#2]% \doifnot{##1}{##4} {\!counta=##1\relax \advance\!counta by 1 \edef\nextsegment{\the\!counta}% \doprocess[\nextsegment..##4##5]}}} {#1[##1][#2]% \doifnot{##2}{?} {\doprocess[##2##3##4##5]}}}}}% \doprocess[#3]} \def\processchemicallinesegment% {\doprocesschemicallinesegment\getchemicallinesegment} \def\processprivatechemicallinesegment% {\doprocesschemicallinesegment\getprivatechemicallinesegment} % \plotchemicalcircle{#1}{#2}{#3}{#4} % % #1: lengte van de boog in graden % #2: x-coordinaat eindpunt % #3: y-coordinaat eindpunt \def\plotchemicalcircle#1#2#3% {\ifloadchemical \else \circulararc {#1} degrees from {#2} {#3} center at {0} {0} % \fi} \def\setchemicalcircsegment #1 #2 #3 #4 {\setvalue{\!!chemicalcircsegment#1}{\plotchemicalcircle{#2}{#3}{#4}}} \def\getchemicalcircsegment[#1][#2]% {\chemicalrotate[#1]% \getvalue{\!!chemicalcircsegment#2}} \def\processchemicalcircsegment#1#2% {\def\doprocess[##1##2##3##4##5]% {\doifelse{##1}{?} {\doprocess[1..\maxchemical ????]} {\doifchemicalnumber{##1}{#1#2} {\doifelse{##2##3}{..} {\doifchemicalnumber{##4}{#1#2} {\getchemicalcircsegment[##1][#1]% \doifnot{##1}{##4} {\!counta=##1\relax \advance\!counta by 1 \edef\nextsegment{\the\!counta}% \doprocess[\nextsegment..##4##5]}}} {\getchemicalcircsegment[##1][#1]% \doifnot{##2}{?} {\doprocess[##2##3##4##5]}}}}}% \doprocess[#2]} \def\doskipchemie[#1][#2]% {{\tt[chemie]}} \def\skipchemie% {\dodoubleargument\doskipchemie} \def\complexchemie% {\ifinchemical \let\next=\dochemie \else \writestatus{chemie}{de [][]-vorm is hier niet toegestaan}% \let\next=\skipchemie \fi \next} \newif\ifinnerchemical \def\dosimplechemie#1#2% {\doifdefinedelse{@@chemieplaats} {\writestatus{chemie}{de {}{}-vorm is hier niet toegestaan}} {\ifinnerchemical \let\chemicalsign=\chemicalinnersign \let\chemicalmolecule=\chemicalinnermolecule \let\chemicalsinglearrow=\chemicalsingleinnerarrow \let\chemicaldoublearrow=\chemicaldoubleinnerarrow \else \let\chemicalsign=\chemicaloutersign \let\chemicalmolecule=\chemicaloutermolecule \let\chemicalsinglearrow=\chemicalsingleouterarrow \let\chemicaldoublearrow=\chemicaldoubleouterarrow \fi \processallactionsinset [#1] [ HIGH=>\sethighsubscripts, % NIEUW LOW=>\setlowsubscripts, % NIEUW PLUS=>\chemicalsign{+}, GIVES=>\chemicalsinglearrow{#2}, EQUILIBRIUM=>\chemicaldoublearrow{#2}, SINGLE=>\singlechemicalbond, DOUBLE=>\doublechemicalbond, TRIPLE=>\triplechemicalbond, +=>\chemicalsign{+}, ->=>\chemicalsinglearrow{#2}, <->=>\chemicaldoublearrow{#2}, -=>\singlechemicalbond, --=>\doublechemicalbond, ---=>\triplechemicalbond, \!!!unknown=>\chemicalmolecule{\commalistelement}{#2}]}} \def\dosimplechemieA#1% {\let\!!chemicalspace=\relax \def\dodosimplechemie##1% {\dosimplechemie{##1}{}}% \processcommalist[\@@chemiechemieoffset,#1]\dodosimplechemie \egroup} \def\dosimplechemieB#1#2% {\dosimplechemie{#1}{#2}% \egroup} \def\dosimplechemieC#1% {$\simplechemie{#1}{}$% \egroup} % erbij \def\simplechemie% {\ifinner \innerchemicaltrue \else \innerchemicalfalse \fi \bgroup \catcode`\^=\@@superscript % t.b.v. \enableduplication \catcode`\_=\@@subscript % t.b.v. de zekerheid \ifmmode \ifinnerchemical \let\next=\dosimplechemieA \else \let\next=\dosimplechemieB \fi \else \let\next=\dosimplechemieC \fi \next} \def\chemie% {\complexorsimple{chemie}} \def\donaarchemie[#1]% {\def\dowithchemical% % experiment {\gotochemical{#1}}% % experiment \chemie} % experiment \def\naarchemie% % experiment {\dosingleargument\donaarchemie} % experiment \def\dododochemie#1[#2][#3]% % experiment {\def\simpledododochemie% % experiment {#1[#2][#3]}% % experiment \def\complexdododochemie[##1]% % experiment {\def\dowithchemical% % experiment {\thisischemical{#2}}% % experiment #1[#3][##1]}% % experiment \complexorsimple{dododochemie}}% % experiment \def\dochemie[#1]% {\def\simpledochemie% {\writetest{chemie}{[#1][]}% \dodochemie[#1][]}% % \def\complexdochemie[##1]% {\writetest{chemie}{[#1][##1]}% \txtchemical=0% \dodochemie[#1][##1]}% % \def\complexdochemie[##1]% % experiment {\writetest{chemie}{[#1][##1]}% % experiment \txtchemical=0% % experiment \dododochemie\dodochemie[#1][##1]}% % experiment % \complexorsimple{dochemie}} \def\dodochemie[#1][#2]% {\ignorespaces \ifinchemical \drawchemical[#1][#2]% \ignorespaces \else \startchemie[\!!plaats=\!!intekst]% \drawchemical[#1][#2]% \stopchemie \fi \ignorespaces} % \reversechemical#1#2#3 % % #1: prefix % #2: volgnummer enz % #3: tegengestelde volgnummers \def\reversechemical#1#2#3% {\def\doprocess[##1##2]% {\doifchemicalnumber{##1}{#1#2}% {\getfromcommalist[#3][##1]% \let\reversechemicalaction=\commalistelement \processchemical[#1\reversechemicalaction##2]}}% \doprocess[#2]} % \processunknownchemical[#1????][#2] % % #1: bindingen enz. % #2: atomen enz. \def\defaultchemical% {SIX} \def\processunknownchemical[#1????][#2]% {\processaction [#1] [ SAVE=>\executechemicalSAVE, RESTORE=>\executechemicalRESTORE, \!!!default=>, \!!!unknown=>\doifdefinedelse{\!!executechemical#1} {\def\chemicalrotation{1}% \def\chemicaloffset{0}% \doifdefined{\!!executechemical#1} {\getvalue{\!!executechemical#1}[#2]}% \@@chemicalpostponed} {\getpredefinedchemical{#1}}]} \setvalue{\!!chemie\!!x1}{0} \setvalue{\!!chemie\!!y1}{0} \def\executechemicalSAVE% {%\writestatus{chemie}{saving \the\horchemical,\the\verchemical}% \increment\chemicalstack \letvalue {\!!chemie n\chemicalstack}=\chemicalname %\letvalue {\!!chemie p\chemicalstack}=\@@chemicalpostponed \setevalue{\!!chemie x\chemicalstack}{\the\horchemical}% \setevalue{\!!chemie y\chemicalstack}{\the\verchemical}} \def\restorechemicalvalues#1% {\let\oldprocesschemical=\processchemical \doifdefined{\!!executechemical#1}{\getvalue{\!!executechemical#1}[]}% \let\processchemical=\oldprocesschemical} \def\executechemicalRESTORE% {\ifnum\chemicalstack=0\relax \horchemical=\getvalue{\!!chemie x1}\relax \verchemical=\getvalue{\!!chemie y1}\relax \else \restorechemicalvalues{\getvalue{\!!chemie n\chemicalstack}}% %\@EA\let\@EA\@@chemicalpostponed\@EA=\csname\!!chemie p\chemicalstack\endcsname \let\@@chemicalpostponed=\relax \horchemical=\getvalue{\!!chemie x\chemicalstack}\relax \verchemical=\getvalue{\!!chemie y\chemicalstack}\relax \decrement\chemicalstack \fi %\writestatus{chemie}{restoring \the\horchemical,\the\verchemical}% \setcoordinatesystem point at {\the\horchemical} {\the\verchemical} } % \processlocalchemicals{#1} % % #1: commando's \def\dodoprocesschemical#1% {\processchemical[#1????]} \def\processlocalchemicals#1% {\processcommalist[#1]\dodoprocesschemical} % \drawchemical[#1][#2] % % #1: bindingen enz. % #2: atomen enz. \newcounter\chemicalnesting \def\localdodochemie[#1][#2]% {\writetest{chemie}{[#1][#2]}% %\bgroup % koppelen en afmetingen gaat fout \increment\chemicalnesting \letvalue{\??chemie\!!!unknown\chemicalnesting}\unknownchemical \setevalue{\??chemie\!!tekst\chemicalnesting}{\the\txtchemical}% \txtchemical=0 \dodochemie[#1][#2]% \@EA\txtchemical\@EA\csname\??chemie\!!tekst\chemicalnesting\endcsname \@EA\let\@EA\unknownchemical\csname\??chemie\!!!unknown\chemicalnesting\endcsname \decrement\chemicalnesting %\egroup % koppelen en afmetingen gaat fout \ignorespaces}% \def\drawchemical[#1][#2]% {\ignorespaces \def\dodochemie[##1][##2]% {\drawchemical[##1][##2]% \ignorespaces}% \def\dochemie[##1]% {\def\simpledochemie% {\writetest{chemie}{[##1][#2]}% \dodochemie[##1][#2]% \ignorespaces}% \def\complexdochemie[####1]% {\dododochemie\localdodochemie[##1][####1,#2]}% \complexorsimple{dochemie}}% \doif{\@@chemiestatus}{\!!start} {\doif{\chemicalname}{\!!!unknown} {\getvalue{\!!executechemical\defaultchemical}[#2]}% \def\unknownchemical##1% {\processunknownchemical[##1][#2]}% \processcommalist[\@@chemieoffset,#1]\dodoprocesschemical}% \ignorespaces} % De onderstaande macro's zijn verantwoordelijk voor het zetten % van de + en pijlen. De +, en dus ook de pijlen, worden omhoog % gehaald. Dit oogt m.i. fraaier. \def\chemicalraise#1#2% {{\setbox0=\hbox{$#1+$}% \raise\dp0\hbox{$#1#2$}}} \def\chemicalinnersign#1% {\chemicalraise{\chemicalstyle}{#1}} \def\chemicaloutersign#1% {\chemicalraise{}{#1}} \def\chemicalsingleinnerarrow#1% {\chemicalraise{\chemicalstyle}{\longrightarrow}} \def\chemicalsingleouterarrow#1% {\chemicalraise{}{\hbox% {$\!!chemicalspace \buildrel \@@chemieletter{\scriptstyle\quad#1\quad}% \over{\overrightarrow {\hphantom{\@@chemieletter{\scriptstyle\quad#1\quad}}}}% \!!chemicalspace$}}} \def\chemicalsinglepicturearrow#1% {\lower.5ex\hbox {$\!!chemicalspace \buildrel \@@chemieletter{\scriptstyle\quad#1\quad}% \over{\overrightarrow {\hphantom{\@chemieletter{\scriptstyle\quad#1\quad}}}}% \!!chemicalspace$}} \def\chemicaldoubleinnerarrow#1% {\lower.2ex\hbox {\setbox2=\hbox{$\chemicalstyle\longrightarrow$}% \wd2=\!!zeropoint \raise\ht2\box2\hbox{$\chemicalstyle\longleftarrow$}}} \def\chemicaldoubleouterarrow#1% {\lower.5ex\hbox {$\!!chemicalspace \buildrel \@@chemieletter{\scriptstyle\quad#1\quad}% \over{\overrightarrow{\overleftarrow {\hphantom{\@@chemieletter{\scriptstyle\quad#1\quad}}}}}% \!!chemicalspace$}} \def\chemicaldoublepicturearrow#1% {\lower.5ex\hbox {$\!!chemicalspace \buildrel \@@chemieletter{\scriptstyle\quad#1\quad}% \over{\overrightarrow{\overleftarrow {\hphantom{\@@chemieletter{\scriptstyle\quad#1\quad}}}}}% \!!chemicalspace$}} \def\chemicalinnermolecule#1#2% {\!!chemicalspace %\mathop % onnodig, genereert trouwens een spatie {\dosetsubscripts \hbox{$\@@chemieletter{\chemicalstyle\strut#1}$}% \doresetsubscripts}% \!!chemicalspace} \def\chemicaloutermolecule#1#2% {\!!chemicalspace \mathop {\dosetsubscripts \hbox{$\@@chemieletter{\strut#1}$}% \doresetsubscripts}% \doifnot{#2}{} {_{\@@chemieletter{\strut#2}}}% \!!chemicalspace} % Bij de in-line bindingen wordt gebruik gemaakt van % een \hrule. De maatvoering wordt bepaald door een % kunstmatige em (\wd0). \def\somechemicalbond% {\hrule width \wd0 height .4pt} \def\dochemicalbonds#1#2#3% {{\setbox0=\hbox {$\@@chemieletter{\chemicalstyle M}$}% \vbox to \ht0 {\hsize\wd0 \vskip.1\wd0#1\vfill#2\vfill#3\vskip.1\wd0}}} \def\singlechemicalbond% {\dochemicalbonds{}{\somechemicalbond}{}} \def\doublechemicalbond% {\dochemicalbonds{\somechemicalbond}{}{\somechemicalbond}} \def\triplechemicalbond% {\dochemicalbonds{\somechemicalbond}{\somechemicalbond}{\somechemicalbond}} % In plaats van \def\naam{\chemie[...]...} kan beter gebruik % worden gemaakt van het commando % % \definieerchemie[naam]{commando's} % % De naam krijgt, om problemen met bestaande macro's te % voorkomen, een prefix. Bij het ophalen van een commando % worden beide definities afgehandeld. \def\dodefinieerchemie[#1]#2% {\doifdefined{\??chemie#1} {\writestatus{chemie}{definitie #1 bestaat reeds}}% \setvalue{\??chemie#1}{#2}} \def\definieerchemie {\dosingleargument\dodefinieerchemie} \def\getpredefinedchemical#1% {\doifdefinedelse{\??chemie#1} {\getvalue{\??chemie#1}} {\doifdefinedelse{#1} {\getvalue{#1}} {\writestatus{chemie}{definitie #1 bestaat niet}}}} % Hieronder zijn de definities van de structuren opgenomen. De % naam van de structuur is als volgt opgebouwd: % % \executechemicalNUMBER[#1] % % waarbij [#1] betrekking heeft op de tekstelementen van \chemie, % de [tweede lijst] dus. % % De aan \chemie[#1][#2] meegegeven lijst van segmenten wordt % deels door de in \execute gedefinieerde macro's afgehandeld, % deels door algemene macro's. Segmenten hebben de vorm: % % [+|-|]identifier[X|XYZ|X..Y] % % Voorbeelden van segmenten zijn: % % R1 % R1..4 % R135 % -R1 % +R35 \setchemicalmaximum 0 \def\processchemical[#1]% {\unknownchemical{#1}} \def\setchemicalname#1 % {\def\chemicalname{#1}} \let\chemicalname=\!!!unknown % Vooruitlopend op een gedetailleerde documentatie, zijn hier % vast enkele gebruikte afmetingen: % % lengte radikalen : 500 % afstand radikalen : 100 % afstand dubbele radikalen : 260 % afstand substituenten : +125 \def\executechemicalONE[#1]% {\setchemicalname ONE % \setchemicalmaximum 8 \setchemicaldistance 0 \setchemicalsubstitute 625 % \setchemicalrotation 1 1 0 1 0 1 0 1 0 \setchemicalrotation 2 0.707 -0.707 0.707 -0.707 0.707 -0.707 0.707 -0.707 \setchemicalrotation 3 0 -1 0 -1 0 -1 0 -1 \setchemicalrotation 4 -0.707 -0.707 -0.707 -0.707 -0.707 -0.707 -0.707 -0.707 \setchemicalrotation 5 -1 0 -1 0 -1 0 -1 0 \setchemicalrotation 6 -0.707 0.707 -0.707 0.707 -0.707 0.707 -0.707 0.707 \setchemicalrotation 7 0 1 0 1 0 1 0 1 \setchemicalrotation 8 0.707 0.707 0.707 0.707 0.707 0.707 0.707 0.707 % \setchemicaltranslate 1 -1000 0 \setchemicaltranslate 2 -1000 1000 \setchemicaltranslate 3 0 1000 \setchemicaltranslate 4 1000 1000 \setchemicaltranslate 5 1000 0 \setchemicaltranslate 6 1000 -1000 \setchemicaltranslate 7 0 -1000 \setchemicaltranslate 8 -1000 -1000 % \setchemicallinesegment SB 300 0 700 0 \setchemicallinesegment DB1 300 50 700 50 \setchemicallinesegment DB2 300 -50 700 -50 % \setchemicaltextelement Z 800 0 \setchemicaltextelement RZ 950 0 % \def\processchemical[##1##2##3##4]% {\doprocesschemical[##1##2##3##4] {\processaction [##1##2##3##4] [ SUB##4=>\processchemicalsubstitute{##4}, ADJ##4=>\processchemicaldistance{##4}, MOV##4=>\processchemicaltranslate{##4}, OFF##4=>\processchemicaloffset{##4}, SB##3##4=>\processchemicallinesegment{SB}{##3##4}, DB##3##4=>\processchemicallinesegment{DB}{##3##4}, TB##3##4=>\processchemicallinesegment{SB}{##3##4}% \processchemicallinesegment{DB}{##3##4}, CZ##3##4=>\processchemicaltextelement{RZ}{##3##4}{#1}{0} {}, Z##2##3##4=>\processchemicaltextelement{Z}{##2##3##4}{#1}{0} {l,l,t,r,r,r,b,l}, \!!!unknown=>\unknownchemical{##1##2##3##4}]}}} \def\executechemicalTHREE[#1]% {\setchemicalname THREE % \setchemicalmaximum 3 \setchemicaldistance 289 \setchemicalsubstitute 952 % \setchemicalrotation 1 1 0 0 -1 -1 0 0 1 \setchemicalrotation 2 -0.5 -0.866 -0.866 0.5 0.5 0.866 0.866 -0.5 \setchemicalrotation 3 -0.5 0.866 0.866 0.5 0.5 -0.866 -0.866 -0.5 % \setchemicaltranslate 1 -1000 0 \setchemicaltranslate 2 0 1000 \setchemicaltranslate 3 1000 0 \setchemicaltranslate 4 0 -1000 % \setchemicallinesegment B 577 0 -289 -500 \setchemicallinesegment SB 352 -130 -64 -370 \setchemicallinesegment -SB 352 -130 -289 -500 \setchemicallinesegment +SB 577 0 -64 -370 \setchemicallinesegment DB1 327 -87 -89 -327 \setchemicallinesegment DB2 377 -172 -39 -413 \setchemicallinesegment R 577 0 1077 0 \setchemicallinesegment -R 577 0 1010 250 \setchemicallinesegment +R 577 0 1010 -250 \setchemicallinesegment ER1 577 50 1077 50 \setchemicallinesegment ER2 577 -50 1077 -50 \setchemicallinesegment SR 837 0 1077 0 \setchemicallinesegment -SR 802 130 1010 250 \setchemicallinesegment +SR 802 -130 1010 -250 \setchemicallinesegment DR1 837 50 1077 50 \setchemicallinesegment DR2 837 -50 1077 -50 % \setchemicaltextelement Z 577 0 \setchemicaltextelement RZ 1177 0 \setchemicaltextelement -RZ 1097 300 \setchemicaltextelement +RZ 1097 -300 \setchemicaltextelement CRZ 1077 0 % \def\processchemical[##1##2##3##4]% {\processaction [##1##2##3##4] [ ROT##4=>\processchemicalrotation{##4}, MOV##4=>\processchemicaltranslate{##4}, SUB##4=>\processchemicalsubstitute{##4}, ADJ##4=>\processchemicaldistance{##4}, -RZ##4=>\processchemicaltextelement{-RZ}{##4}{#1}{3} {l,t,r, l,r,l, r,b,l, r,l,r}, +RZ##4=>\processchemicaltextelement{+RZ}{##4}{#1}{3} {l,r,b, r,r,l, r,l,t, l,l,r}, -SB##4=>\processchemicallinesegment{-SB}{##4}, +SB##4=>\processchemicallinesegment{+SB}{##4}, -SR##4=>\processchemicallinesegment{-SR}{##4}, +SR##4=>\processchemicallinesegment{+SR}{##4}, CRZ##4=>\processchemicaltextelement{CRZ}{##4}{#1}{0} {}, DB##3##4=>\processchemicallinesegment{DB}{##3##4}, DR##3##4=>\processchemicallinesegment{DR}{##3##4}, RZ##3##4=>\processchemicaltextelement{RZ}{##3##4}{#1}{3} {l,r,r, t,r,l, r,l,l, b,l,r}, ER##3##4=>\processchemicallinesegment{ER}{##3##4}, SB##3##4=>\processchemicallinesegment{SB}{##3##4}, SR##3##4=>\processchemicallinesegment{SR}{##3##4}, -R##3##4=>\processchemicallinesegment{-R}{##3##4}, +R##3##4=>\processchemicallinesegment{+R}{##3##4}, B##2##3##4=>\processchemicallinesegment{B}{##2##3##4}, R##2##3##4=>\processchemicallinesegment{R}{##2##3##4}, Z##2##3##4=>\processchemicaltextelement{Z}{##2##3##4}{#1}{0} {}, \!!!unknown=>\unknownchemical{##1##2##3##4}]}} \def\executechemicalFOUR[#1]% {\setchemicalname FOUR % \setchemicalmaximum 4 \setchemicaldistance 500 \setchemicalsubstitute 0 % \setchemicalrotation 1 1 0 0 -1 -1 0 0 1 \setchemicalrotation 2 0 -1 -1 0 0 1 1 0 \setchemicalrotation 3 -1 0 0 1 1 0 0 -1 \setchemicalrotation 4 0 1 1 0 0 -1 -1 0 % \setchemicaltranslate 1 -1000 0 \setchemicaltranslate 2 0 1000 \setchemicaltranslate 3 1000 0 \setchemicaltranslate 4 0 -1000 % \setchemicallinesegment B 500 500 500 -500 \setchemicallinesegment SB 500 240 500 -240 \setchemicallinesegment -SB 500 240 500 -500 \setchemicallinesegment +SB 500 500 500 -240 \setchemicallinesegment DB1 450 240 450 -240 \setchemicallinesegment DB2 550 240 550 -240 \setchemicallinesegment EB 360 300 360 -300 \setchemicallinesegment R 500 500 854 854 \setchemicallinesegment -R 500 500 500 1000 \setchemicallinesegment +R 500 500 1000 500 \setchemicallinesegment ER1 465 535 819 889 \setchemicallinesegment ER2 535 465 889 819 \setchemicallinesegment SR 684 684 854 854 \setchemicallinesegment -SR 500 760 500 1000 \setchemicallinesegment +SR 760 500 1000 500 \setchemicallinesegment DR1 649 719 819 889 \setchemicallinesegment DR2 719 649 889 819 % \setchemicaltextelement Z 500 500 \setchemicaltextelement RZ 925 925 \setchemicaltextelement -RZ 500 1100 \setchemicaltextelement +RZ 1100 500 \setchemicaltextelement CRZ 1038 1038 % \def\processchemical[##1##2##3##4]% {\processaction [##1##2##3##4] [ ROT##4=>\processchemicalrotation{##4}, SUB##4=>\processchemicalsubstitute{##4}, ADJ##4=>\processchemicaldistance{##4}, MOV##4=>\processchemicaltranslate{##4}, -RZ##4=>\processchemicaltextelement{-RZ}{##4}{#1}{4} {b,l,t,r, l,t,r,b, t,r,b,l, r,b,l,t}, +RZ##4=>\processchemicaltextelement{+RZ}{##4}{#1}{4} {l,t,r,b, t,r,b,l, r,b,l,t, b,l,t,r}, -SB##4=>\processchemicallinesegment{-SB}{##4}, +SB##4=>\processchemicallinesegment{+SB}{##4}, -SR##4=>\processchemicallinesegment{-SR}{##4}, +SR##4=>\processchemicallinesegment{+SR}{##4}, CRZ##4=>\processchemicaltextelement{CRZ}{##4}{#1}{0} {}, DB##3##4=>\processchemicallinesegment{DB}{##3##4}, DR##3##4=>\processchemicallinesegment{DR}{##3##4}, EB##3##4=>\processchemicallinesegment{EB}{##3##4}, ER##3##4=>\processchemicallinesegment{ER}{##3##4}, RZ##3##4=>\processchemicaltextelement{RZ}{##3##4}{#1}{4} {lb,lt,rt,rb, lt,rt,rb,lb, rt,rb,lb,lt, rb,lb,lt,rt}, SB##3##4=>\processchemicallinesegment{SB}{##3##4}, SR##3##4=>\processchemicallinesegment{SR}{##3##4}, -R##3##4=>\processchemicallinesegment{-R}{##3##4}, +R##3##4=>\processchemicallinesegment{+R}{##3##4}, B##2##3##4=>\processchemicallinesegment{B}{##2##3##4}, R##2##3##4=>\processchemicallinesegment{R}{##2##3##4}, Z##2##3##4=>\processchemicaltextelement{Z}{##2##3##4}{#1}{0} {}, \!!!unknown=>\unknownchemical{##1##2##3##4}]}} \def\executechemicalFIVE[#1]% {\setchemicalname FIVE % \setchemicalmaximum 5 \setchemicaldistance 688 \setchemicalsubstitute 1226 % \setchemicalrotation 1 1 0 0 -1 -1 0 0 1 \setchemicalrotation 2 0.309 -0.951 -0.951 -0.309 -0.309 0.940 0.951 0.309 \setchemicalrotation 3 -0.809 -0.588 -0.588 0.809 0.809 0.588 0.588 -0.809 \setchemicalrotation 4 -0.809 0.588 0.588 0.809 0.809 -0.588 -0.588 -0.809 \setchemicalrotation 5 0.309 0.951 0.951 -0.309 -0.309 -0.951 -0.951 0.309 % \setchemicaltranslate 1 -1376 0 \setchemicaltranslate 2 -425 1304 \setchemicaltranslate 3 1113 809 \setchemicaltranslate 4 1113 -809 \setchemicaltranslate 5 -425 -1304 % \setchemicallinesegment B 688 500 688 -500 \setchemicallinesegment S -263 808 688 -500 \setchemicallinesegment SB 688 240 688 -240 \setchemicallinesegment -SB 688 240 688 -500 \setchemicallinesegment +SB 688 500 688 -240 \setchemicallinesegment DB1 638 240 638 -240 \setchemicallinesegment DB2 738 240 738 -240 \setchemicallinesegment EB 548 340 548 -340 \setchemicallinesegment R 688 500 1093 794 \setchemicallinesegment -R 688 500 688 1000 \setchemicallinesegment +R 688 500 1163 345 \setchemicallinesegment ER1 659 540 1064 834 \setchemicallinesegment ER2 727 460 1122 754 \setchemicallinesegment SR 898 653 1093 794 \setchemicallinesegment -SR 688 760 688 1000 \setchemicallinesegment +SR 935 420 1163 345 \setchemicallinesegment DR1 869 693 1064 834 \setchemicallinesegment DR2 927 613 1122 754 % \setchemicaltextelement Z 688 500 \setchemicaltextelement RZ 1188 863 \setchemicaltextelement -RZ 688 1100 \setchemicaltextelement +RZ 1258 315 \setchemicaltextelement CRZ 1323 947 % \setchemicalcircsegment C 72 475 -345 % \def\processchemical[##1##2##3##4]% {\processaction [##1##2##3##4] [ ROT##4=>\processchemicalrotation{##4}, SUB##4=>\processchemicalsubstitute{##4}, ADJ##4=>\processchemicaldistance{##4}, MOV##4=>\processchemicaltranslate{##4}, -RZ##4=>\processchemicaltextelement{-RZ}{##4}{#1}{5} {b,l,t,r,r, l,t,r,r,l, t,r,r,l,l, r,b,l,t,r}, +RZ##4=>\processchemicaltextelement{+RZ}{##4}{#1}{5} {l,t,r,r,b, t,r,r,l,l, r,r,l,l,r, b,l,l,r,r}, -SB##4=>\processchemicallinesegment{-SB}{##4}, +SB##4=>\processchemicallinesegment{+SB}{##4}, -SR##4=>\processchemicallinesegment{-SR}{##4}, +SR##4=>\processchemicallinesegment{+SR}{##4}, CRZ##4=>\processchemicaltextelement{CRZ}{##4}{#1}{0} {}, DB##3##4=>\processchemicallinesegment{DB}{##3##4}, DR##3##4=>\processchemicallinesegment{DR}{##3##4}, EB##3##4=>\processchemicallinesegment{EB}{##3##4}, ER##3##4=>\processchemicallinesegment{ER}{##3##4}, RZ##3##4=>\processchemicaltextelement{RZ}{##3##4}{#1}{5} {l,l,r,r,r, l,r,r,b,l, r,r,b,l,t, r,l,l,t,r}, SB##3##4=>\processchemicallinesegment{SB}{##3##4}, SR##3##4=>\processchemicallinesegment{SR}{##3##4}, -R##3##4=>\processchemicallinesegment{-R}{##3##4}, +R##3##4=>\processchemicallinesegment{+R}{##3##4}, B##2##3##4=>\processchemicallinesegment{B}{##2##3##4}, C##2##3##4=>\processchemicalcircsegment{C}{##2##3##4}, R##2##3##4=>\processchemicallinesegment{R}{##2##3##4}, S##2##3##4=>\processchemicallinesegment{S}{##2##3##4}, Z##2##3##4=>\processchemicaltextelement{Z}{##2##3##4}{#1}{0} {}, \!!!unknown=>\unknownchemical{##1##2##3##4}]}} \def\executechemicalSIX[#1]% {\setchemicalname SIX % \setchemicalmaximum 6 \setchemicalsubstitute 1375 \setchemicaldistance 866 % \setchemicalrotation 1 1 0 0 -1 -1 0 0 1 \setchemicalrotation 2 0.5 -0.866 -0.866 -0.5 -0.5 0.866 0.866 0.5 \setchemicalrotation 3 -0.5 -0.866 -0.866 0.5 0.5 0.866 0.866 -0.5 \setchemicalrotation 4 -1 0 0 1 1 0 0 -1 \setchemicalrotation 5 -0.5 0.866 0.866 0.5 0.5 -0.866 -0.866 -0.5 \setchemicalrotation 6 0.5 0.866 0.866 -0.5 -0.5 -0.866 -0.866 0.5 % \setchemicaltranslate 1 -1732 0 \setchemicaltranslate 2 -866 1500 \setchemicaltranslate 3 866 1500 \setchemicaltranslate 4 1732 0 \setchemicaltranslate 5 866 -1500 \setchemicaltranslate 6 -866 -1500 % \setchemicallinesegment B 866 500 866 -500 \setchemicallinesegment S 0 1000 866 -500 \setchemicallinesegment SB 866 240 866 -240 \setchemicallinesegment -SB 866 240 866 -500 \setchemicallinesegment +SB 866 500 866 -240 \setchemicallinesegment DB1 816 240 816 -240 \setchemicallinesegment DB2 916 240 916 -240 \setchemicallinesegment EB 726 340 726 -340 \setchemicallinesegment R 866 500 1299 750 \setchemicallinesegment -R 866 500 866 1000 \setchemicallinesegment +R 866 500 1299 250 \setchemicallinesegment ER1 841 543 1274 793 \setchemicallinesegment ER2 891 457 1324 707 \setchemicallinesegment SR 1091 630 1299 750 \setchemicallinesegment -SR 866 740 866 1000 \setchemicallinesegment +SR 1091 370 1299 250 \setchemicallinesegment DR1 1066 673 1274 793 \setchemicallinesegment DR2 1116 588 1324 707 % \setchemicalcircsegment C 60 600 -346 % \setchemicaltextelement Z 866 500 \setchemicaltextelement RZ 1386 800 \setchemicaltextelement -RZ 866 1100 \setchemicaltextelement +RZ 1386 200 \setchemicaltextelement CRZ 1524 880 % \def\processchemical[##1##2##3##4]% {\processaction [##1##2##3##4] [ ROT##4=>\processchemicalrotation{##4}, SUB##4=>\processchemicalsubstitute{##4}, ADJ##4=>\processchemicaldistance{##4}, MOV##4=>\processchemicaltranslate{##4}, -RZ##4=>\processchemicaltextelement{-RZ}{##4}{#1}{6} {b,l,l,t,r,r, l,l,r,r,r,l, t,r,r,b,l,l, r,r,l,l,l,r}, +RZ##4=>\processchemicaltextelement{+RZ}{##4}{#1}{6} {l,t,r,r,b,l, r,r,r,l,l,l, r,b,l,l,t,r, l,l,l,r,r,r}, -SB##4=>\processchemicallinesegment{-SB}{##4}, +SB##4=>\processchemicallinesegment{+SB}{##4}, -SR##4=>\processchemicallinesegment{-SR}{##4}, +SR##4=>\processchemicallinesegment{+SR}{##4}, CRZ##4=>\processchemicaltextelement{CRZ}{##4}{#1}{0} {}, DB##3##4=>\processchemicallinesegment{DB}{##3##4}, EB##3##4=>\processchemicallinesegment{EB}{##3##4}, ER##3##4=>\processchemicallinesegment{ER}{##3##4}, RZ##3##4=>\processchemicaltextelement{RZ}{##3##4}{#1}{6} {l,l,t,r,r,b, l,r,r,r,l,l, r,r,b,l,l,t, r,l,l,l,r,r}, SB##3##4=>\processchemicallinesegment{SB}{##3##4}, SR##3##4=>\processchemicallinesegment{SR}{##3##4}, DR##3##4=>\processchemicallinesegment{DR}{##3##4}, -R##3##4=>\processchemicallinesegment{-R}{##3##4}, +R##3##4=>\processchemicallinesegment{+R}{##3##4}, B##2##3##4=>\processchemicallinesegment{B}{##2##3##4}, C##2##3##4=>\processchemicalcircsegment{C}{##2##3##4}, R##2##3##4=>\processchemicallinesegment{R}{##2##3##4}, S##2##3##4=>\processchemicallinesegment{S}{##2##3##4}, Z##2##3##4=>\processchemicaltextelement{Z}{##2##3##4}{#1}{0} {}, \!!!unknown=>\unknownchemical{##1##2##3##4}]}} % 1 : 0 % 2 : -115 % 3* : -195 % 3 : -165 % 4 : -245 \def\executechemicalCARBON[#1]% {\setchemicalname CARBON % \setchemicalmaximum 4 \setchemicaldistance 0 \setchemicalsubstitute 0 % \setchemicalrotation 1 1 0 0 -1 -1 0 0 1 \setchemicalrotation 2 -0.423 -0.906 -0.906 0.423 0.423 0.906 0.906 -0.423 \setchemicalrotation 3 -0.966 -0.259 -0.259 0.966 0.966 0.259 0.259 -0.966 \setchemicalrotation 3* -0.966 0.259 0.259 0.966 0.966 -0.259 -0.259 -0.966 \setchemicalrotation 4 -0.423 0.906 0.906 0.423 0.423 -0.906 -0.906 -0.423 % \setchemicaltranslate 1 -1500 0 \setchemicaltranslate 2 0 1500 \setchemicaltranslate 3 1500 0 \setchemicaltranslate 4 0 -1500 % \setchemicallinesegment B1 500 0 1000 0 \setchemicallinesegment B2 300 0 1000 0 \setchemicallinesegment B3 500 0 1000 0 \setchemicallinesegment B4 300 0 1000 0 % \setchemicaltextelement Z 1100 0 % \setchemicalcircsegment C 360 0 -500 % \def\processchemical[##1##2##3##4##5]% {\processaction [##1##2##3##4##5] [ MIR????=>\setchemicalmirror{3}, -MIR????=>\resetchemicalmirror{3}, *MIR????=>\togglechemicalmirror{3}, CB????=>\processlocalchemicals{B,C,Z}, C????=>\processchemicalcircsegment{C}{1????}, -ROT##5=>\reversechemical{ROT}{##5}{3,4,1,2}, ROT##4##5=>\processchemicalrotation{##4##5}, MOV##4##5=>\processchemicaltranslate{##4##5}, CB##3##4##5=>\processlocalchemicals {ROT##3,C,B,Z2..4, MOV##3,*MIR,-ROT##3,C,B,Z2..4}, B##2##3##4##5=>\processprivatechemicallinesegment{B}{##2##3##4##5}, Z##2##3##4##5=>\processchemicaltextelement{Z}{##2##3##4##5}{#1}{4} {l,t,r,b, t,r,b,l, r,b,l,t, b,l,t,r}, \!!!unknown=>\unknownchemical{##1##2##3##4##5}]}} % 1: 45 2: -90 3: -225 % 4: -45 5: -135 6: -270 \def\executechemicalNEWMAN[#1]% {\setchemicalname NEWMAN % \setchemicalmaximum 6 \setchemicaldistance 0 \setchemicalsubstitute 0 % \setchemicalrotation 1 0.707 0.707 0.707 -0.707 -0.707 -0.707 -0.707 0.707 \setchemicalrotation 2 0 -1 -1 0 0 1 1 0 \setchemicalrotation 3 -0.707 0.707 0.707 0.707 0.707 -0.707 -0.707 -0.707 \setchemicalrotation 4 0.707 -0.707 -0.707 -0.707 -0.707 0.707 0.707 0.707 \setchemicalrotation 5 -0.707 -0.707 -0.707 0.707 0.707 0.707 0.707 -0.707 \setchemicalrotation 6 0 1 1 0 0 -1 -1 0 % \setchemicaltranslate 1 -1500 0 \setchemicaltranslate 2 0 1500 \setchemicaltranslate 3 1500 0 \setchemicaltranslate 4 0 -1500 % \setchemicallinesegment B1 0 0 1000 0 \setchemicallinesegment B2 0 0 1000 0 \setchemicallinesegment B3 0 0 1000 0 \setchemicallinesegment B4 500 0 1000 0 \setchemicallinesegment B5 500 0 1000 0 \setchemicallinesegment B6 500 0 1000 0 % \setchemicaltextelement Z 1100 0 % \setchemicalcircsegment C 360 0 -500 % \def\processchemical[##1##2##3##4]% {\processaction [##1##2##3##4] [ B????=>\processlocalchemicals{B1..6}, CB????=>\processlocalchemicals{B1..6,C,Z1..6}, C????=>\processchemicalcircsegment{C}{1????}, ROT##4=>\processchemicalrotation{##4}, MOV##4=>\processchemicaltranslate{##4}, B##2##3##4=>\processprivatechemicallinesegment{B}{##2##3##4}, Z##2##3##4=>\processchemicaltextelement{Z}{##2##3##4}{#1}{6} {l,t,r,l,r,b, l,r,l,r,r,l, r,b,l,r,l,t, r,l,r,l,l,r}, \!!!unknown=>\unknownchemical{##1##2##3##4}]}} \def\executechemicalarrow#1#2[#3]% {\getfromcommalist[#3][1]% \let\toptext=\commalistelement \getfromcommalist[#3][2]% \let\bottext=\commalistelement \def\dochemicaltext##1% {\dosetsubscripts% $\@@chemieletter{\@@localchemieformaat\strut##1}$% \doresetsubscripts}% \doifelse{\@@chemieplaats}{\!!intekst}% {#1{\dochemicaltext\toptext}}% {\setbox\chemicalsymbols=\hbox {\box\chemicalsymbols \vbox{\halign{##\cr \hbox to 3em{\hss\dochemicaltext{\toptext}\hss}\cr #2% \hbox to 3em{\hss\dochemicaltext{\bottext}\hss}\cr}}}}} \def\executechemicalGIVES% {\executechemicalarrow {\chemicalsinglepicturearrow}% nodig {\rightarrowfill\cr}} \def\executechemicalEQUILIBRIUM% {\executechemicalarrow {\chemicaldoublepicturearrow}% nodig {\rightarrowfill\cr\leftarrowfill\cr}} \def\executechemicalsign#1[#2]% {\doifelse{\@@chemieplaats}{\!!intekst} {\dosetsubscripts $\@@chemieletter{\@@localchemieformaat#1}$% \doresetsubscripts} {\setbox\chemicalsymbols=\hbox {\box\chemicalsymbols \dosetsubscripts $\@@chemieletter{\@@localchemieformaat#1}$% \doresetsubscripts}}} \def\executechemicalPLUS% {\executechemicalsign{+}} \def\executechemicalMINUS% {\executechemicalsign{-}} \def\executechemicalSPACE[#1]% {\doifnot{\@@chemieplaats}{\!!intekst}% {\setbox\chemicalsymbols=\hbox {\box\chemicalsymbols \quad}}} \def\executechemicalLOW[#1]% {\setlowsubscripts} \def\executechemicalHIGH[#1]% {\sethighsubscripts} \stelchemiein [\!!breedte=0, \!!hoogte=0, \!!links=0, \!!rechts=0, \!!boven=0, \!!onder=0, \!!korps=\systeemkorps, \!!resolutie=\systeemresolutie, \!!schaal=\!!middel, \!!formaat=\!!middel, \!!tekstformaat=\!!groot, \!!kader=\!!uit, \!!assenstelsel=\!!uit, \!!status=\!!start, \!!letter=\rm, \!!plaats=, \!!optie=, \!!file=, \!!offset=LOW, \!!variant=1] % Tijdelijk plaatsen we deze extra macro's hier. % % mathontop: \mtop {} {} % textontop: \ttop {} {} \def\putontop#1#2% {\vbox {\halign {\strut\hss##\hss\cr #1\cr #2\cr}}} \def\ttop#1#2% {\putontop{\tx#1}{#2}} \def\mtop#1#2% {\vbox {\offinterlineskip \halign {\hss##\hss\cr $\scriptscriptstyle#1$\cr \noalign{\vskip.5ex}% $#2$\cr}}} \def\ctop#1#2% {\vbox {\offinterlineskip \halign {\hss##\hss\cr $\@@chemieletter{\@@localchemieformaat\scriptscriptstyle#1}$\cr \noalign{\vskip.5ex}% $\@@chemieletter{\@@localchemieformaat#2}$\cr}}} \protect