At 05:13 PM 8/29/2001 +0200, Herv� Rouault wrote:
>Hi all!!
>
>How can I load a ppchtex graphic to add something with metapost. I don't
>know which command to use... I tried with loadcurrentgraphc, then it's
>loaded but i can't modify it.
>
>I have already ask the question th Hans, but I'd like more explaination.

Ah, so the manual sucks -)

Well, i hope that the next example shows you the way to even more dirty 
trickery. The \cpos macro will be added to ppchtex.tex

[beware: this example only works in context]

[i'll send you the file off line]

% output=pdftex

\usemodule[chemic]

\def\cpos#1#2%
   {\bgroup
    \pushmacro\dowithchemical
    \gdef\dowithchemical##1{\hpos{#1}{##1}\popmacro\dowithchemical}%
    #2%
    \egroup}

\starttext

The idea is this:

\startMPpositiongraphic{connect}
   initialize_box_pos(1, \MPpos{\MPvar{from}}) ;
   initialize_box_pos(2, \MPpos{\MPvar{to}})   ;
   pickup pencircle scaled 1.5pt ;
   draw pxy[1] ; draw pxy[2] ;
   drawarrow (cxy[1] -- cxy[2]) dashed evenly ;
   anchor_box(\MPanchor{\MPvar{from}}) ;
\stopMPpositiongraphic

\setMPpositiongraphic{chem:a}{connect}{from=chem:a,to=chem:b}

\hpos{chem:a}{A} \hskip3cm \hpos{chem:b}{B}

Applied to a chemical:

\startMPpositiongraphic{connect}
   initialize_box_pos(1, \MPpos{\MPvar{from}}) ;
   initialize_box_pos(2, \MPpos{\MPvar{to}})   ;
   pickup pencircle scaled 1.5pt ;
   drawarrow (cxy[1] {up} .. cxy[2]) dashed evenly ;
   anchor_box(\MPanchor{\MPvar{from}}) ;
\stopMPpositiongraphic

\setMPpositiongraphic{chem:1}{connect}{from=chem:1,to=chem:2}

\startchemical
   \chemical[SIX,B,R,RZ][A,\cpos{chem:1}{B},C,D,\cpos{chem:2}{E},F]
\stopchemical

Or crossing chemicals:

\startMPpositiongraphic{explain}
   initialize_box_pos(1, \MPpos{\MPvar{from}}) ;
   initialize_box_pos(2, \MPpos{\MPvar{by}})   ;
   initialize_box_pos(3, \MPpos{\MPvar{to}})   ;
   pickup pencircle scaled 1.5pt ;
   draw fullcircle scaled 1cm shifted cxy[2] ;
   drawarrow (cxy[1] .. cxy[2] .. cxy[3]) dashed evenly ;
   anchor_box(\MPanchor{\MPvar{from}}) ;
\stopMPpositiongraphic

\setMPpositiongraphic{chem:3}{explain}{from=chem:3,by=chem:4,to=chem:5}

\startchemical
   \chemical[SIX,B,R,RZ][A,\cpos{chem:3}{B},C,D,\cpos{chem:4}{E},F]
\stopchemical

\startchemical
   \chemical[SIX,B,R,RZ][A,\cpos{chem:5}{B},C,D,E,F]
\stopchemical

\stoptext

-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | [EMAIL PROTECTED]
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------

Reply via email to