% Beware, integrated ppchtex support is incomplete and under
% construction so when you depend on the full functionality
% you need to use the module!
%
% For testing new functionality:
%
% \startMPextensions
%     input "mp-chem.mp" ;
% \stopMPextensions
% \startluacode
%     dofile(resolvers.find_file("chem-str.lua","tex"))
% \stopluacode
% \setbox\scratchbox\hbox{\startMPcode\stopMPcode}

\enabletrackers[chemistry.structure]

\starttext

\defineprocessor[ch:r][color=red]
\defineprocessor[ch:g][color=green]
\defineprocessor[ch:b][color=blue]

\setupchemical[frame=on,offset=3pt]

\startbuffer[test-set]

    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,MOV1,B] \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,MOV2,B] \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,MOV3,B] \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,MOV4,B] \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,MOV5,B] \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,MOV6,B] \stopchemical \quad

    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,R,AU] \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,R,AD] \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,EB]   \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,DB]     \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,ER]     \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,DR]     \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,BR]     \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,SB]     \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,-SB]    \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,+SB]    \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,C]    \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,CC]   \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,CD]   \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,CCD]  \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,SB,SR]  \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,SB,-SR] \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,SB,+SR] \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,R]    \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,RD]   \stopchemical \quad

    \dontleavehmode \startchemical \chemical[\ChemicalKind,SB,Z]     [a,b,c,d,e,f] \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,R,RZ]   [a,b,c,d,e,f] \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,+R,+RZ] [a,b,c,d,e,f] \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,-R,-RZ] [a,b,c,d,e,f] \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,RB,RZ]  [a,b,c,d,e,f] \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,+RB,+RZ][a,b,c,d,e,f] \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,-RB,-RZ][a,b,c,d,e,f] \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,R,RT]   [a,b,c,d,e,f] \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,R,RTT]  [a,b,c,d,e,f] \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,R,RBT]  [a,b,c,d,e,f] \stopchemical \quad

    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,R,RN]  \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,R,RTN] \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,R,RBN] \stopchemical \quad

    \dontleavehmode \startchemical \chemical[\ChemicalKind,B,R,RN]      \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,ROT1,B,R,RN] \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,ROT2,B,R,RN] \stopchemical \quad
    \dontleavehmode \startchemical \chemical[\ChemicalKind,ROT3,B,R,RN] \stopchemical \quad

\stopbuffer

\dontcomplain

% \startTEXpage

\setupchemicalframed[frame=on]

% \startTEXpage
% \noindent \startchemical \chemical[THREE,     B,R,RZ][RZ_1,RZ_2,RZ_3]\stopchemical
% \noindent \startchemical \chemical[THREE,ROT1,B,R,RZ][RZ_1,RZ_2,RZ_3]\stopchemical
% \noindent \startchemical \chemical[THREE,ROT2,B,R,RZ][RZ_1,RZ_2,RZ_3]\stopchemical
% \noindent \startchemical \chemical[THREE,ROT3,B,R,RZ][RZ_1,RZ_2,RZ_3]\stopchemical
% \noindent \startchemical \chemical[THREE,ROT4,B,R,RZ][RZ_1,RZ_2,RZ_3]\stopchemical

% \noindent \startchemical \chemical[THREE,     B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3]\stopchemical
% \noindent \startchemical \chemical[THREE,ROT1,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3]\stopchemical
% \noindent \startchemical \chemical[THREE,ROT2,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3]\stopchemical
% \noindent \startchemical \chemical[THREE,ROT3,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3]\stopchemical
% \noindent \startchemical \chemical[THREE,ROT4,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3]\stopchemical

% \noindent \startchemical \chemical[THREE,     B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3]\stopchemical
% \noindent \startchemical \chemical[THREE,ROT1,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3]\stopchemical
% \noindent \startchemical \chemical[THREE,ROT2,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3]\stopchemical
% \noindent \startchemical \chemical[THREE,ROT3,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3]\stopchemical
% \noindent \startchemical \chemical[THREE,ROT4,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3]\stopchemical
% \stopTEXpage

% \startTEXpage
% \noindent \startchemical \chemical[SIX,ROT1,B, R, RZ, AU][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6]\stopchemical
% \noindent \startchemical \chemical[SIX,ROT2,B, R, RZ, AU][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6]\stopchemical
% \noindent \startchemical \chemical[SIX,ROT3,B, R, RZ, AU][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6]\stopchemical
% \noindent \startchemical \chemical[SIX,ROT4,B, R, RZ, AU][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6]\stopchemical

% \noindent \startchemical \chemical[SIX,ROT1,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3,-RZ_4,-RZ_5,-RZ_6]\stopchemical
% \noindent \startchemical \chemical[SIX,ROT2,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3,-RZ_4,-RZ_5,-RZ_6]\stopchemical
% \noindent \startchemical \chemical[SIX,ROT3,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3,-RZ_4,-RZ_5,-RZ_6]\stopchemical
% \noindent \startchemical \chemical[SIX,ROT4,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3,-RZ_4,-RZ_5,-RZ_6]\stopchemical

% \noindent \startchemical \chemical[SIX,ROT1,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3,+RZ_4,+RZ_5,+RZ_6]\stopchemical
% \noindent \startchemical \chemical[SIX,ROT2,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3,+RZ_4,+RZ_5,+RZ_6]\stopchemical
% \noindent \startchemical \chemical[SIX,ROT3,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3,+RZ_4,+RZ_5,+RZ_6]\stopchemical
% \noindent \startchemical \chemical[SIX,ROT4,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3,+RZ_4,+RZ_5,+RZ_6]\stopchemical
% \stopTEXpage

% \startTEXpage
% \noindent \startchemical \chemical[FIVE,ROT1,B, R, RZ, AU][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6]\stopchemical
% \noindent \startchemical \chemical[FIVE,ROT2,B, R, RZ, AU][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6]\stopchemical
% \noindent \startchemical \chemical[FIVE,ROT3,B, R, RZ, AU][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6]\stopchemical
% \noindent \startchemical \chemical[FIVE,ROT4,B, R, RZ, AU][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6]\stopchemical

% \noindent \startchemical \chemical[FIVE,ROT1,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3,-RZ_4,-RZ_5,-RZ_6]\stopchemical
% \noindent \startchemical \chemical[FIVE,ROT2,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3,-RZ_4,-RZ_5,-RZ_6]\stopchemical
% \noindent \startchemical \chemical[FIVE,ROT3,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3,-RZ_4,-RZ_5,-RZ_6]\stopchemical
% \noindent \startchemical \chemical[FIVE,ROT4,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3,-RZ_4,-RZ_5,-RZ_6]\stopchemical

% \noindent \startchemical \chemical[FIVE,ROT1,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3,+RZ_4,+RZ_5,+RZ_6]\stopchemical
% \noindent \startchemical \chemical[FIVE,ROT2,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3,+RZ_4,+RZ_5,+RZ_6]\stopchemical
% \noindent \startchemical \chemical[FIVE,ROT3,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3,+RZ_4,+RZ_5,+RZ_6]\stopchemical
% \noindent \startchemical \chemical[FIVE,ROT4,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3,+RZ_4,+RZ_5,+RZ_6]\stopchemical
% \stopTEXpage

% \startTEXpage
% \noindent \startchemical \chemical[FOUR,ROT1,B, R, RZ, AU][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6]\stopchemical
% \noindent \startchemical \chemical[FOUR,ROT2,B, R, RZ, AU][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6]\stopchemical
% \noindent \startchemical \chemical[FOUR,ROT3,B, R, RZ, AU][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6]\stopchemical
% \noindent \startchemical \chemical[FOUR,ROT4,B, R, RZ, AU][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6]\stopchemical

% \noindent \startchemical \chemical[FOUR,ROT1,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3,-RZ_4,-RZ_5,-RZ_6]\stopchemical
% \noindent \startchemical \chemical[FOUR,ROT2,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3,-RZ_4,-RZ_5,-RZ_6]\stopchemical
% \noindent \startchemical \chemical[FOUR,ROT3,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3,-RZ_4,-RZ_5,-RZ_6]\stopchemical
% \noindent \startchemical \chemical[FOUR,ROT4,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3,-RZ_4,-RZ_5,-RZ_6]\stopchemical

% \noindent \startchemical \chemical[FOUR,ROT1,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3,+RZ_4,+RZ_5,+RZ_6]\stopchemical
% \noindent \startchemical \chemical[FOUR,ROT2,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3,+RZ_4,+RZ_5,+RZ_6]\stopchemical
% \noindent \startchemical \chemical[FOUR,ROT3,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3,+RZ_4,+RZ_5,+RZ_6]\stopchemical
% \noindent \startchemical \chemical[FOUR,ROT4,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3,+RZ_4,+RZ_5,+RZ_6]\stopchemical
% \stopTEXpage

% \startTEXpage
% \noindent \startchemical \chemical[THREE,ROT1,B, R, RZ, AU][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6]\stopchemical
% \noindent \startchemical \chemical[THREE,ROT2,B, R, RZ, AU][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6]\stopchemical
% \noindent \startchemical \chemical[THREE,ROT3,B, R, RZ, AU][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6]\stopchemical
% \noindent \startchemical \chemical[THREE,ROT4,B, R, RZ, AU][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6]\stopchemical

% \noindent \startchemical \chemical[THREE,ROT1,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3,-RZ_4,-RZ_5,-RZ_6]\stopchemical
% \noindent \startchemical \chemical[THREE,ROT2,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3,-RZ_4,-RZ_5,-RZ_6]\stopchemical
% \noindent \startchemical \chemical[THREE,ROT3,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3,-RZ_4,-RZ_5,-RZ_6]\stopchemical
% \noindent \startchemical \chemical[THREE,ROT4,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3,-RZ_4,-RZ_5,-RZ_6]\stopchemical

% \noindent \startchemical \chemical[THREE,ROT1,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3,+RZ_4,+RZ_5,+RZ_6]\stopchemical
% \noindent \startchemical \chemical[THREE,ROT2,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3,+RZ_4,+RZ_5,+RZ_6]\stopchemical
% \noindent \startchemical \chemical[THREE,ROT3,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3,+RZ_4,+RZ_5,+RZ_6]\stopchemical
% \noindent \startchemical \chemical[THREE,ROT4,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3,+RZ_4,+RZ_5,+RZ_6]\stopchemical
% \stopTEXpage

% \startTEXpage
% \noindent \startchemical \chemical[EIGHT,ROT1,B, R, RZ, AU][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6,RZ_7,RZ_8]\stopchemical
% \noindent \startchemical \chemical[EIGHT,ROT2,B, R, RZ, AU][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6,RZ_7,RZ_8]\stopchemical
% \noindent \startchemical \chemical[EIGHT,ROT3,B, R, RZ, AU][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6,RZ_7,RZ_8]\stopchemical
% \noindent \startchemical \chemical[EIGHT,ROT4,B, R, RZ, AU][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6,RZ_7,RZ_8]\stopchemical

% \noindent \startchemical \chemical[EIGHT,ROT1,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3,-RZ_4,-RZ_5,-RZ_6,-RZ_7,-RZ_8]\stopchemical
% \noindent \startchemical \chemical[EIGHT,ROT2,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3,-RZ_4,-RZ_5,-RZ_6,-RZ_7,-RZ_8]\stopchemical
% \noindent \startchemical \chemical[EIGHT,ROT3,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3,-RZ_4,-RZ_5,-RZ_6,-RZ_7,-RZ_8]\stopchemical
% \noindent \startchemical \chemical[EIGHT,ROT4,B,-R,-RZ][-RZ_1,-RZ_2,-RZ_3,-RZ_4,-RZ_5,-RZ_6,-RZ_7,-RZ_8]\stopchemical

% \noindent \startchemical \chemical[EIGHT,ROT1,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3,+RZ_4,+RZ_5,+RZ_6,+RZ_7,+RZ_8]\stopchemical
% \noindent \startchemical \chemical[EIGHT,ROT2,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3,+RZ_4,+RZ_5,+RZ_6,+RZ_7,+RZ_8]\stopchemical
% \noindent \startchemical \chemical[EIGHT,ROT3,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3,+RZ_4,+RZ_5,+RZ_6,+RZ_7,+RZ_8]\stopchemical
% \noindent \startchemical \chemical[EIGHT,ROT4,B,+R,+RZ][+RZ_1,+RZ_2,+RZ_3,+RZ_4,+RZ_5,+RZ_6,+RZ_7,+RZ_8]\stopchemical
% \stopTEXpage

% \enabletrackers[chemistry.molecules]

% \startchemicalformula
%     \chemical{S}
%     \chemical{+}
%     \chemical{O_2}
%     \chemical{GIVES}
%     \chemical{\+{4}{S}}
%     \chemical{\+{4}{S}\-{2}{O_2}}
%     \chemical{\-{2}{O_2}}
% \stopchemicalformula

% \startformula
%     \chemical{S}
%     \chemical{+}
%     \chemical{O_2}
%     \chemical{GIVES}
%     \chemical{\+{4}{S}}
%     \chemical{\+{4}{S}\-{2}{O_2}}
%     \chemical{\-{2}{O_2}}
% \stopformula


\startTEXpage[offset=2cm]

% \startchemical[width=fit,size=small,scale=small,frame=on]
%     \chemical[SIX,B]
% \stopchemical

% \startchemical[width=fit,size=small,scale=small,frame=on]
%     \chemical[ONE,SB258]
% \stopchemical

% \startchemical[width=fit,size=small,scale=small,frame=on]
%     \chemical[ONE,ROT3,SB258]
% \stopchemical

% \startchemical[width=fit,size=small,scale=small,frame=on]
%     \chemical[FIVE,ROT3,SB34,+SB2,-SB5,Z345,DR35,SR4,CRZ35,SUB1,ONE,SB258,Z0,Z28][C,N,C,O,O,CH,COOC_2H_5,COOC_2H_5]
% \stopchemical

% \startchemical[scale=small,width=8000,height=8000,frame=on]
%   \chemical[SIX,SB2356,DB14,Z2346,SR36,RZ36]     [C,N,C,C,H,H_2]
%   \chemical[PB:Z1,ONE,Z0,DIR8,Z0,SB24,DB7,Z27,PE][C,C,CH_3,O]
%   \chemical[PB:Z5,ONE,Z0,DIR6,Z0,SB24,DB7,Z47,PE][C,C,H_3C,O]
%   \chemical[SR24,RZ24]                           [CH_3,H_3C]
% \stopchemical

% \startchemical[scale=small,width=6000,height=6000,frame=on]
%   \chemical[SIX,SB2356,DB14,Z,SR36,RZ36,SR1245,RZ24][C,C,N,C,C,C,H,H_2,CH_3,H_3C]
%   \chemical[PB:RZ1,ONE,Z0,SB2,DB7,Z27,PE][C,CH_3,O]
%   \chemical[PB:RZ5,ONE,Z0,SB4,DB7,Z47,PE][C,H_3C,O]
% \stopchemical

% \startchemical[width=fit,size=small,scale=small,frame=on]
% \chemical
%     [SIX,B,C,ADJ1,FIVE,ROT3,SB34,+SB2,-SB5,Z345,DR35,SR4,CRZ35,SUB1,ONE,OFF1,SB258,Z0,Z28]
%     [C,N,C,O,O,CH,COOC_2H_5,COOC_2H_5]
% \stopchemical

% \startchemical[width=fit,height=fit,frame=on,scale=small]
%   \chemical
%     [ONE,SB15,DB7,Z057,3OFF1,MOV1,Z0,3OFF1,MOV1,
%      Z017,SB1357,MOV3,Z0,MOV3,SB1357,Z013,3OFF5,
%      MOV5,Z0,3OFF5,SB5,Z5]
%     [C,H_2N,NH,(CH_2)_3,C,COOH,H,\SL{NH},C,COOH,H,
%      (CH_2)_2,HOOC]
% \stopchemical

% \startchemical[width=fit,height=fit,frame=on,scale=small]
%   \chemical
%     [ONE,SB15,DB7,Z057,3OFF1,MOV1,Z0,3OFF1,MOV1,Z017,SB1357,MOV3,Z0,MOV3,SB1357,Z013,3OFF5,MOV5,Z0,3OFF5,SB5,Z5]
%     [C,H_2N,NH,(CH_2)_3,C,COOH,H,\SL{NH},C,COOH,H,(CH_2)_2,HOOC]
% \stopchemical

% \startchemical
%   \chemical[ONE,Z0,DB,Z][C_0,C_1,C_1,C_3,C_4,C_5,C_6,C_7,C_8]
% \stopchemical

% \startchemical
%   \chemical[ONE,Z0,SB,Z][C_0,C_1,C_1,C_3,C_4,C_5,C_6,C_7,C_8]
% \stopchemical

% \startchemical
%   \chemical[ONE,Z0,DB,CZ][C_0,C_1,C_1,C_3,C_4,C_5,C_6,C_7,C_8]
% \stopchemical

% \startchemical
%   [width=fit,top=2000,bottom=2000,
%    scale=small,size=small]%
%   \chemical
%     [ONE,
%      SAVE,
%        Z0,SB731,MOV1,Z0,SB1,MOV1,Z0,DB8,CZ8,SB1,Z1,
%      RESTORE,
%      SAVE,
%        SUB4,ONE,Z0,SB3,SB1,MOV1,Z0,SB1,MOV1,Z0,DB8,CZ8,SB1,Z1,
%      RESTORE,
%      SUB2,ONE,Z0,SB7,SB1,MOV1,Z0,SB1,MOV1,Z0,DB8,CZ8,SB1,Z1]
%     [\SR{HC},O,C,O,C_{19}H_{39},
%      \SR{H_{2}C},O,C,O,C_{17}H_{29},
%      \SR{H_{2}C},O,C,O,C_{21}H_{41}]
% \stopchemical

% \chemical[width=fit,height=fit,frame=on,scale=small]
%     [ONE,Z0,MOV7,SB1357,Z017,3OFF5,MOV5,Z0,3OFF5,MOV5,SB15,DB7,Z057,MOV0,MOV3,SB1357,Z013,MOV5,3OFF5,Z0,6OFF5,SB5,Z5]
%     [\SL{NH},C,COOH,H,(CH_2)_3,C,H_2H,NH,C,COOH,H,(CH_2)_2,HOOC]
% \stopchemical

% \chemical[width=fit,height=fit,frame=on,scale=small]
%     [ONE,Z0,MOV7,SB1357,Z017,3OFF5,MOV5,Z0,3OFF5,MOV5,SB15,DB7,Z057,MOV0,MOV3,SB1357,Z013,MOV5,3OFF5,Z0,6OFF5,SB5,Z5]
%     [\SL{NH},C,COOH,H,(CH_2)_3,C,H_2H,NH,C,COOH,H,(CH_2)_2,HOOC]
% \stopchemical

% \startchemical[width=fit,top=1500,bottom=3500]
%     \chemical[ONE,Z0,DB1,SB3,SB7,Z7,MOV1,Z0,SB3,SB7,Z3,Z7,MOV0,SUB2,SIX,B,R6,C][C,H,C,H,H]
%     \chemical[ONE,Z0,DB1,SB3,SB7,Z7,MOV1,Z0,SB3,SB7,Z3,Z7,MOV0,SUB2,SIX,B,R6,C][C,H,C,H,H]
%     \bottext{styreen}
% \stopchemical

% \startchemical
%   \chemical[SPACE,PLUS,SPACE]
% \stopchemical
% \startchemical[right=600]
%   \chemical[ONE,CZ0][3CH_{3}OH]
% \stopchemical
% \startchemical
%   \chemical[SPACE,GIVES,SPACE,SPACE][H^+/H_2O]
% \stopchemical
% \startchemical
%   \chemical
%     [ONE,
%      SAVE,
%        Z0,SB7,SB3,SB1,Z1,
%      RESTORE,
%      SAVE,
%        SUB4,ONE,Z0,SB3,SB1,Z1,
%      RESTORE,
%      SUB2,ONE,Z0,SB7,SB1,Z1]
%     [\SR{HC},OH,
%      \SR{H_{2}C},OH,
%      \SR{H_{2}C},OH]
% \stopchemical
% \startchemical
%   \chemical[SPACE,PLUS,SPACE]
% \stopchemical

% \startchemical
%   \chemical
%     [ONE,
%      SAVE,
%        Z0,DB8,CZ8,SB1,SB5,Z5,MOV1,Z0,SB1,Z1,
%      RESTORE,
%      SAVE,
%        SUB4,ONE,Z0,DB8,CZ8,SB1,SB5,Z5,MOV1,Z0,SB1,Z1,
%      RESTORE,
%      SUB2,ONE,Z0,DB8,CZ8,SB1,SB5,Z5,MOV1,Z0,SB1,Z1]
%     [C,O,C_{19}H_{39},O,CH_{3},
%      C,O,C_{17}H_{29},O,CH_{3},
%      C,O,C_{21}H_{41},O,CH_{3}]
% \stopchemical

% \startchemical[height=4500,bottom=2500]
%   \bottext{$\beta$-D-Fructopyranose}
%   \chemical[SIX,FRONT,BB,B1236,+SB4,-SB5,Z5,+R12346,+RZ12346,-R12346,-RZ12346][Z_0,+R_1,+R_2,+R_3,+R_4,+R_6,-R_1,-R_2,-R_3,-R_4,-R_6]
% \stopchemical

% \startchemical[height=4500,bottom=2500]
%   \chemical[SIX,FRONT,BB,B]
% \stopchemical

\defineprocessor[SL][command=\SR]
\defineprocessor[SR][command=\SR]

\startchemical
    [width=fit,height=fit,frame=on]
  \chemical
    [SIX,DB135,SB246,Z,SR6,RZ6][C,C,N,lft->ABCDE,N,C,NH_2]
\stopchemical

% \startchemical
%     [width=fit,height=fit,frame=on]
%   \chemical
%     [SIX,DB135,SB246,Z,SR6,RZ6][C,C,N,\SR{HC},N,C,NH_2]
%   \chemical
%     [SIX,MOV1,DB1,SB23,SS6,Z1..3,SR3,RZ3][N,\SL{CH},N,H]
% \stopchemical

% \startchemical \chemical[SIX,B,R,RZ1=a]    \stopchemical
% \startchemical \chemical[SIX,B,R,RZ1..3=a] \stopchemical
% \startchemical \chemical[SIX,B,R,RZ135=a]  \stopchemical
% \startchemical \chemical[SIX,B,R,RZ] [a]   \stopchemical
% \startchemical \chemical[SIX,B,R,RZ] [a,b] \stopchemical
% \startchemical \chemical[SIX,B,R,RZ=a]     \stopchemical

% \definechemical[molecule]
%   {\chemical
%      [ONE,Z0,SB1357,
%       SAVE,SUB2,SIX,B,R6,C,RESTORE,
%       MOV1,Z0,SB137,MOV1,Z0,SB37,MOV1]
%      [C,C,C]}

% \startchemical[width=fit,height=fit]
%   \chemical[molecule,molecule,molecule]
% \stopchemical

% \definechemical[molecule]
%   {\chemical
%      [ONE,Z0,SB1357,
%       SAVE,SUB2,SIX,B,R6,C,RESTORE,
%       MOV1,Z0,SB137,MOV1,Z0,SB37,MOV1]}

% \startchemical[width=fit,height=fit]
%   \chemical[molecule,molecule,molecule][A,B,C,D,E,F,G,H,I]
% \stopchemical

\stopTEXpage

% \noindent \startchemical
%     \chemical[SIX,B1..3]
% \stopchemical

% \noindent \startchemical[width=fit,height=fit] % auto5 ipb off5
%     \chemical[SIX,B,C,R,RZ][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6]
% \stopchemical
% \noindent \startchemical[width=fit,height=fit] % auto5 ipb off5
%     \chemical[SIX,ROT1,B,C,R,RZ][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6]
% \stopchemical
% \startchemical[width=fit,height=fit] % auto5 ipb off5
%     \chemical[SIX,ROT2,B,C,R,RZ][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6]
% \stopchemical
% \startchemical[width=fit,height=fit] % auto5 ipb off5
%     \chemical[SIX,ROT3,B,C,R,RZ][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6]
% \stopchemical
% \startchemical[width=fit,height=fit] % auto5 ipb off5
%     \chemical[SIX,ROT4,B,C,R,RZ][RZ_1,RZ_2,RZ_3,RZ_4,RZ_5,RZ_6]
% \stopchemical

% \startchemical[width=fit,height=fit,axis=on] % auto5 ipb off5
%     \chemical[SIX,B,C,R6,PB:RZ6,ONE,CZ0,OE1,SB5,MOV5,CZ0,OFF5,OE5,PE][CH,CH_2]
% \stopchemical

% \dontleavehmode \startchemical \chemical[SIX,B,R,RZ][1,2,3,4,5,6,] \stopchemical

% \start
%     \setupchemicalframed[frame=off]
%     \dontleavehmode \startchemical[scale=medium,style=slanted,color=red,rulecolor=green,left=2000,right=4000,top=2000,bottom=2000,axis=on] \chemical[SIX,B,R,RZ][1,2,3,4,5,6,] \stopchemical

%     \dontleavehmode
%     \startchemical[width=fit,height=fit]
%         \chemical[SIX,B][1,2,3,4,5,6]
%         \start
%             \setupchemical[rulecolor=red]
%             \chemical[SIX,R][1,2,3,4,5,6]
%         \stop
%         \chemical[SIX,RZ][1,2,3,4,5,6]
%     \stopchemical
% \stop

% \stopTEXpage

% \stoptext

% \startTEXpage

% \dontleavehmode \startchemical \chemical[ONE,SB,Z0,Z][0,1,2,3,4,5,6,7,8] \stopchemical \quad
% \dontleavehmode \startchemical \chemical[ONE,DB,Z0,Z][0,1,2,3,4,5,6,7,8] \stopchemical \quad
% \dontleavehmode \startchemical \chemical[ONE,TB,Z0,Z][0,1,2,3,4,5,6,7,8] \stopchemical \quad
% \dontleavehmode \startchemical \chemical[ONE,EP,Z0][0] \stopchemical \quad
% \dontleavehmode \startchemical \chemical[ONE,ES,Z0][0] \stopchemical \quad
% \dontleavehmode \startchemical \chemical[ONE,ED,Z0][0] \stopchemical \quad
% \dontleavehmode \startchemical \chemical[ONE,ET,Z0][0] \stopchemical \quad


% \dontleavehmode \startchemical \chemical[ONE,SD,Z0][0] \stopchemical \quad
% \dontleavehmode \startchemical \chemical[ONE,LDD,Z0][0] \stopchemical \quad
% \dontleavehmode \startchemical \chemical[ONE,RDD,Z0][0] \stopchemical \quad
% \dontleavehmode \startchemical \chemical[ONE,HB,Z0][0] \stopchemical \quad
% \dontleavehmode \startchemical \chemical[ONE,BB,Z0][0] \stopchemical \quad
% \dontleavehmode \startchemical \chemical[ONE,OE,Z0][0] \stopchemical \quad


% \dontleavehmode \startchemical \chemical[ONE,SB,Z] [1,2,3,4,5,6,7,8] \stopchemical \quad
% \dontleavehmode \startchemical \chemical[ONE,SB,CZ][1,2,3,4,5,6,7,8] \stopchemical \quad
% \dontleavehmode \startchemical \chemical[ONE,SB,ZT][a,b,c,d,e,f,g,h] \stopchemical \quad
% \dontleavehmode \startchemical \chemical[ONE,SB,ZN][1,2,3,4,5,6,7,8] \stopchemical \quad
% \dontleavehmode \startchemical \chemical[ONE,SB,ZBT][1,2,3,4,5,6,7,8] \stopchemical \quad
% \dontleavehmode \startchemical \chemical[ONE,SB,ZBN][1,2,3,4,5,6,7,8] \stopchemical \quad
% \dontleavehmode \startchemical \chemical[ONE,SB,ZTT][1,2,3,4,5,6,7,8] \stopchemical \quad
% \dontleavehmode \startchemical \chemical[ONE,SB,ZTN][1,2,3,4,5,6,7,8] \stopchemical \quad

% \dontleavehmode \startchemical \chemical[ONE,SB,MOV1,SB] \stopchemical \quad
% \dontleavehmode \startchemical \chemical[ONE,SB,MOV1,SB,MOV3,SB] \stopchemical \quad
% \dontleavehmode \startchemical \chemical[SIX,B,MOV1,B] \stopchemical \quad


% \dontleavehmode \startchemical \chemical[ONE,SB,Z0,Z][0,1,2,3,4,5,6] \stopchemical \quad
% \stopTEXpage


%     \dorecurse{1000}{\dontleavehmode \startchemical \chemical[SIX,B,R,RZ][a,b,c,d,e,f] \stopchemical \quad}

%     \dontleavehmode \startchemical \chemical[SIX,B,R,RT]   [a,b,c,d,e,f] \stopchemical \quad
%     \dontleavehmode \startchemical \chemical[SIX,B,R,RTT]  [a,b,c,d,e,f] \stopchemical \quad
%     \dontleavehmode \startchemical \chemical[SIX,B,R,RBT]  [a,b,c,d,e,f] \stopchemical \quad

%     \dontleavehmode \startchemical \chemical[SIX,B,R,+R,-R] \stopchemical \quad
%     \dontleavehmode \startchemical \chemical[SIX,B1..4] \stopchemical \quad

%     \dontleavehmode \startchemical \chemical[SIX,B,ZN] \stopchemical \quad
%     \dontleavehmode \startchemical \chemical[SIX,B,ZT][A,B,C,D,E,F] \stopchemical \quad
%     \dontleavehmode \startchemical \chemical[SIX,B,R,AU] \stopchemical \quad
%     \dontleavehmode \startchemical \chemical[SIX,B,R,AD] \stopchemical \quad

% \dontleavehmode \startchemical \chemical[SIX,B,ADJ1,SIX,B]       \stopchemical \quad
% \dontleavehmode \startchemical \chemical[SIX,B,ADJ1,FIVE,ROT1,B] \stopchemical \quad
% \dontleavehmode \startchemical \chemical[SIX,B,ADJ1,FOUR,B]      \stopchemical \quad
% \dontleavehmode \startchemical \chemical[SIX,B,ADJ1,THREE,B]     \stopchemical \quad

% \definechemical[sixring]
%    {\chemical[SIX,B,R]}

% \startchemical[frame=on,width=6000]
%   \chemical[sixring,RZ][A,B,C,D,E,F]
% \stopchemical

% \definechemical[test]
%   {\chemical[SIX,SB,Z][A,B,C,D,E,F]}

% \startchemical
%     \chemical[SIX,SB,Z,ADJ1,test,ADJ1,SIX,SB,Z][a,b,c,d,e,f,g,h,j,k,l,m,P,Q,R,S,T,U,W]
%     \chemical[ADJ1,SIX,SB,Z][1,2,3,4,5,6]
% \stopchemical

% \definechemical[test]{\chemical[SIX,SB,Z]}

% \startchemical
%     \chemical[SIX,SB,Z,ADJ1,test,ADJ1,SIX,SB,Z][a,b,c,d,e,f,g,h,j,k,l,m,P,Q,R,S,T,U,W]
%     \chemical[ADJ1,SIX,SB,Z][1,2,3,4,5,6]
% \stopchemical

% \startchemical
%     \chemical[ADJ1,SIX,SB,Z][a_1,a_2,a_3,a_4,a_5,\ominus]
% \stopchemical

% \startchemical
%     \chemical[SIX,SB,Z,SAVE,ADJ1,SIX,SB,Z,ADJ1,SIX,SB,Z,RESTORE,ADJ3,SIX,SB,Z][1,2,3,4,5,6,a,b,c,d,e,f,A,B,C,D,E,F,!,!,!,!,!,!]
% \stopchemical

% $$
% \startchemical
%     \chemical[OPENCOMPLEX]
% \stopchemical
% \startchemical
%     \chemical[SIX,SB,Z][1,2,3,4,5,6]
% \stopchemical
% \startchemical
%     \chemical[SPACE,GIVES,SPACE][a,b]
% \stopchemical
% \startchemical
%     \chemical[SIX,SB,Z][1,2,3,4,5,6]
% \stopchemical
% \startchemical
%     \chemical[CLOSECOMPLEX]
% \stopchemical
% $$

% \stoptext

% \page

% \def\ChemicalKind{SIX}   \getbuffer[test-set]
% \def\ChemicalKind{FIVE}  \getbuffer[test-set]
% \def\ChemicalKind{FOUR}  \getbuffer[test-set]
% \def\ChemicalKind{THREE} \getbuffer[test-set]

% \startchemical
%     \chemical[SIX,SB,C135,SR,Z0,Z,RZ][X,ch:r->A,ch:g->B,ch:b->C,D,E,F,a,b,c,d,e,f]
%     \chemical[MOV1,SIX,SB,C135,SR,Z0,Z,RZ][X,ch:r->A,ch:g->B,ch:b->C,D,E,F,a,b,c,d,e,f]
%     \chemical[MOV3,SIX,SB,C135,SR,Z0,Z,RZ][X,ch:r->A,ch:g->B,ch:b->C,D,E,F,a,b,c,d,e,f]
% \stopchemical

\stoptext
