ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Weird Fieldstack problem
@ 2007-06-08  8:35 Zhichu Chen
  2007-06-08 14:26 ` Aditya Mahajan
  0 siblings, 1 reply; 5+ messages in thread
From: Zhichu Chen @ 2007-06-08  8:35 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1104 bytes --]

Hi,

I've written the following test file:

======================
\setupcolors[state=start]
\setuppagenumbering[state=stop]
\setupinteraction  [state=start]

\starttext

\MPdrawingdonetrue

\startMPdrawing
draw (0,0)--(2cm,2cm);
\stopMPdrawing
\definesymbol[aa][\getMPdrawing]

\startMPdrawing
draw (2cm,2cm)--(2cm,0);
\stopMPdrawing

\definesymbol[bb][\getMPdrawing]

\startMPdrawing
draw (0,0)--(2cm,0);
\stopMPdrawing

\definesymbol[cc][\getMPdrawing]

\definefieldstack[somemap][aa,bb,cc][height=fit,width=fit,frame=on]


\fieldstack[somemap]
\goto{here} [JS(Walk_Field{somemap})]

\stoptext
======================

It seems that the fieldstack does not work. Is there anything wrong?

-- 
Best Regards
Chen
----------------------------------------------------------------

          Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
         No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
             tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
                                               | www.sinap.ac.cn
----------------------------------------------------------------

[-- Attachment #1.2: Type: text/html, Size: 1746 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Weird Fieldstack problem
  2007-06-08  8:35 Weird Fieldstack problem Zhichu Chen
@ 2007-06-08 14:26 ` Aditya Mahajan
  2007-06-08 15:16   ` Zhichu Chen
  0 siblings, 1 reply; 5+ messages in thread
From: Aditya Mahajan @ 2007-06-08 14:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, 8 Jun 2007, Zhichu Chen wrote:

> Hi,
>
> I've written the following test file:
>
> ======================
> \setupcolors[state=start]
> \setuppagenumbering[state=stop]
> \setupinteraction  [state=start]
>
> \starttext
>
> \MPdrawingdonetrue
>
> \startMPdrawing
> draw (0,0)--(2cm,2cm);
> \stopMPdrawing
> \definesymbol[aa][\getMPdrawing]
>
> \startMPdrawing
> draw (2cm,2cm)--(2cm,0);
> \stopMPdrawing
>
> \definesymbol[bb][\getMPdrawing]
>
> \startMPdrawing
> draw (0,0)--(2cm,0);
> \stopMPdrawing
>
> \definesymbol[cc][\getMPdrawing]
>
> \definefieldstack[somemap][aa,bb,cc][height=fit,width=fit,frame=on]
>
>
> \fieldstack[somemap]
> \goto{here} [JS(Walk_Field{somemap})]
>
> \stoptext
> ======================
>
> It seems that the fieldstack does not work. Is there anything wrong?

I haven't tested this, but I think that all elements in the fieldstack 
should have the same bounding box. Look at the widget manual, where 
Hans shows how to make sure that all elements have the same bounding 
box.

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Weird Fieldstack problem
  2007-06-08 14:26 ` Aditya Mahajan
@ 2007-06-08 15:16   ` Zhichu Chen
  2007-06-08 17:35     ` Aditya Mahajan
  0 siblings, 1 reply; 5+ messages in thread
From: Zhichu Chen @ 2007-06-08 15:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2421 bytes --]

Hi Aditya,

Actually, they should have the same boundingbox, the first MPdrawing
environment draws a line from (0,0) to (2cm,2cm) and the sequence MPdrawing
environments just add two lines that are in the previous boundingbox.

I know what's happening now. \definesymbol doesn't define a symbol
from \getMPdrawing at once.


On 6/8/07, Aditya Mahajan <adityam@umich.edu> wrote:
>
> On Fri, 8 Jun 2007, Zhichu Chen wrote:
>
> > Hi,
> >
> > I've written the following test file:
> >
> > ======================
> > \setupcolors[state=start]
> > \setuppagenumbering[state=stop]
> > \setupinteraction  [state=start]
> >
> > \starttext
> >
> > \MPdrawingdonetrue
> >
> > \startMPdrawing
> > draw (0,0)--(2cm,2cm);
> > \stopMPdrawing
> > \definesymbol[aa][\getMPdrawing]
> >
> > \startMPdrawing
> > draw (2cm,2cm)--(2cm,0);
> > \stopMPdrawing
> >
> > \definesymbol[bb][\getMPdrawing]
> >
> > \startMPdrawing
> > draw (0,0)--(2cm,0);
> > \stopMPdrawing
> >
> > \definesymbol[cc][\getMPdrawing]
> >
> > \definefieldstack[somemap][aa,bb,cc][height=fit,width=fit,frame=on]
> >
> >
> > \fieldstack[somemap]
> > \goto{here} [JS(Walk_Field{somemap})]
> >
> > \stoptext
> > ======================
> >
> > It seems that the fieldstack does not work. Is there anything wrong?
>
> I haven't tested this, but I think that all elements in the fieldstack
> should have the same bounding box. Look at the widget manual, where
> Hans shows how to make sure that all elements have the same bounding
> box.
>
> Aditya
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
>
> ___________________________________________________________________________________
>



-- 
Best Regards
Chen
----------------------------------------------------------------

          Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
         No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
             tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
                                               | www.sinap.ac.cn
----------------------------------------------------------------

[-- Attachment #1.2: Type: text/html, Size: 3808 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Weird Fieldstack problem
  2007-06-08 15:16   ` Zhichu Chen
@ 2007-06-08 17:35     ` Aditya Mahajan
  2007-06-11 11:56       ` Zhichu Chen
  0 siblings, 1 reply; 5+ messages in thread
From: Aditya Mahajan @ 2007-06-08 17:35 UTC (permalink / raw)
  To: ntg-context

Quoting Zhichu Chen <zhichu.chen@gmail.com>:

> Hi Aditya,
>
> Actually, they should have the same boundingbox, the first MPdrawing
> environment draws a line from (0,0) to (2cm,2cm) and the sequence MPdrawing
> environments just add two lines that are in the previous boundingbox.
>
> I know what's happening now. \definesymbol doesn't define a symbol
> from \getMPdrawing at once.

Yes, \definesymbol[a][b] is roughly equal to \def\a{b}, for example

\starttext

\def\something{aa}

\definesymbol[aa][\something]
\symbol[aa]

\def\something{bb}
\symbol[aa]

\stoptext

This is what is also happening in your case. You need to go back to the 
definebuffer and processbuffer as suggested in metafun manual.

I do not know if it makes sense to have a \edef version of 
definesymbol. In any case, getting expansion to work with \getMPdrawing 
is going to be difficult.

Aditya

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Weird Fieldstack problem
  2007-06-08 17:35     ` Aditya Mahajan
@ 2007-06-11 11:56       ` Zhichu Chen
  0 siblings, 0 replies; 5+ messages in thread
From: Zhichu Chen @ 2007-06-11 11:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2450 bytes --]

Hi Aditya,

In my situation, I can't use buffer conveniently. So is there an easy way to
\includeMPgraphic recurrently? I've tried
====================================
\newcount\steps

%%%%%%%% repeat the following block several times
\advance\steps\plusone
\startuseMPgraphics{step\the\steps}
. . . % Some random graphics
\stopuseMPgraphic
%%%%%%%%%%%%%%%%%%%%%%%%%

\startuseMPgraphic{aa}
\dorecurse{\the\steps}
  {\includeMPgraphic{step\recurselevel}}
\stopuseMPgraphic
====================================

but, it's not working.

On 6/9/07, Aditya Mahajan <adityam@umich.edu> wrote:
>
> Quoting Zhichu Chen <zhichu.chen@gmail.com>:
>
> > Hi Aditya,
> >
> > Actually, they should have the same boundingbox, the first MPdrawing
> > environment draws a line from (0,0) to (2cm,2cm) and the sequence
> MPdrawing
> > environments just add two lines that are in the previous boundingbox.
> >
> > I know what's happening now. \definesymbol doesn't define a symbol
> > from \getMPdrawing at once.
>
> Yes, \definesymbol[a][b] is roughly equal to \def\a{b}, for example
>
> \starttext
>
> \def\something{aa}
>
> \definesymbol[aa][\something]
> \symbol[aa]
>
> \def\something{bb}
> \symbol[aa]
>
> \stoptext
>
> This is what is also happening in your case. You need to go back to the
> definebuffer and processbuffer as suggested in metafun manual.
>
> I do not know if it makes sense to have a \edef version of
> definesymbol. In any case, getting expansion to work with \getMPdrawing
> is going to be difficult.
>
> Aditya
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
>
> ___________________________________________________________________________________
>



-- 
Best Regards
Chen
----------------------------------------------------------------

          Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
         No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
             tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
                                               | www.sinap.ac.cn
----------------------------------------------------------------

[-- Attachment #1.2: Type: text/html, Size: 3757 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-06-11 11:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-08  8:35 Weird Fieldstack problem Zhichu Chen
2007-06-08 14:26 ` Aditya Mahajan
2007-06-08 15:16   ` Zhichu Chen
2007-06-08 17:35     ` Aditya Mahajan
2007-06-11 11:56       ` Zhichu Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).