* MetaPost instance mechanism broken @ 2012-11-25 17:11 Marco Patzer 2012-11-25 17:40 ` Wolfgang Schuster ` (2 more replies) 0 siblings, 3 replies; 10+ messages in thread From: Marco Patzer @ 2012-11-25 17:11 UTC (permalink / raw) To: context Hi, in one of the last few betas the MetaPost instance mechanism broke. \defineMPinstance [myinstance] [metafun] \startuseMPgraphic{mympgraphic} fill fullsquare scaled 1cm withcolor blue; \stopuseMPgraphic \starttext\null \useMPgraphic{myinstance::mympgraphic} \stoptext Marco ___________________________________________________________________________________ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: MetaPost instance mechanism broken 2012-11-25 17:11 MetaPost instance mechanism broken Marco Patzer @ 2012-11-25 17:40 ` Wolfgang Schuster 2012-11-25 17:40 ` Aditya Mahajan 2012-12-06 19:10 ` Marco Patzer 2 siblings, 0 replies; 10+ messages in thread From: Wolfgang Schuster @ 2012-11-25 17:40 UTC (permalink / raw) To: mailing list for ConTeXt users Am 25.11.2012 um 18:11 schrieb Marco Patzer <homerow@lavabit.com>: > Hi, > > in one of the last few betas the MetaPost instance > mechanism broke. > > \defineMPinstance > [myinstance] > [metafun] > > \startuseMPgraphic{mympgraphic} > fill fullsquare scaled 1cm withcolor blue; > \stopuseMPgraphic > > \starttext\null > \useMPgraphic{myinstance::mympgraphic} > \stoptext The problem lies in the \uniqueMPgraphic and \useMPgrpahic commands. There is a commented line in each command which is the correct setting and the next line is wrong. \def\meta_unique_page_graphic#1#2% {\meta_begin_graphic_group{#1}% \let\overlaystamp\overlaypagestamp \setupMPvariables[\m_meta_page_prefix:\currentMPgraphicname][#2]% prefix is new here % \getvalue{\??mpgraphic\m_meta_page_prefix:\currentMPgraphicname}{}% \getvalue{\??mpgraphic\m_meta_page_prefix:#1}{}% \meta_end_graphic_group} \def\meta_use_graphic#1#2% {\meta_begin_graphic_group{#1}% \doifsomething{#2}{\setupMPvariables[\currentMPgraphicname][#2]}% %\getvalue{\??mpgraphic\currentMPgraphicname}\empty \getvalue{\??mpgraphic#1}\empty \meta_end_graphic_group} Wolfgang ___________________________________________________________________________________ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: MetaPost instance mechanism broken 2012-11-25 17:11 MetaPost instance mechanism broken Marco Patzer 2012-11-25 17:40 ` Wolfgang Schuster @ 2012-11-25 17:40 ` Aditya Mahajan 2012-11-25 18:05 ` Marco Patzer 2012-12-06 19:10 ` Marco Patzer 2 siblings, 1 reply; 10+ messages in thread From: Aditya Mahajan @ 2012-11-25 17:40 UTC (permalink / raw) To: mailing list for ConTeXt users On Sun, 25 Nov 2012, Marco Patzer wrote: > Hi, > > in one of the last few betas the MetaPost instance > mechanism broke. > > \defineMPinstance > [myinstance] > [metafun] > > \startuseMPgraphic{mympgraphic} > fill fullsquare scaled 1cm withcolor blue; > \stopuseMPgraphic > > \starttext\null > \useMPgraphic{myinstance::mympgraphic} > \stoptext I am still using the old 2012.11.16 version, but now you have to specify the instance in the \startuseMPgraphic as well (Hans had announced this on the mailing list a few weeks ago): \startuseMPgraphic{instance::mygraphic} ... \stopuseMPgraphic 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: MetaPost instance mechanism broken 2012-11-25 17:40 ` Aditya Mahajan @ 2012-11-25 18:05 ` Marco Patzer 2012-11-26 14:32 ` Sietse Brouwer 0 siblings, 1 reply; 10+ messages in thread From: Marco Patzer @ 2012-11-25 18:05 UTC (permalink / raw) To: ntg-context 2012-11-25 Aditya Mahajan: > I am still using the old 2012.11.16 version, but now you have to specify > the instance in the \startuseMPgraphic as well (Hans had announced this > on the mailing list a few weeks ago): I missed that. > \startuseMPgraphic{instance::mygraphic} > ... > \stopuseMPgraphic This works. Thanks to both of you, Wolfgang and Aditya. Marco ___________________________________________________________________________________ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: MetaPost instance mechanism broken 2012-11-25 18:05 ` Marco Patzer @ 2012-11-26 14:32 ` Sietse Brouwer 2012-11-26 16:10 ` Marco Patzer 0 siblings, 1 reply; 10+ messages in thread From: Sietse Brouwer @ 2012-11-26 14:32 UTC (permalink / raw) To: mailing list for ConTeXt users Aditya wrote: > I am still using the old 2012.11.16 version, but now you have to specify > the instance in the \startuseMPgraphic as well (Hans had announced this > on the mailing list a few weeks ago): > \startuseMPgraphic{instance::mygraphic} > ... > \stopuseMPgraphic Since I don't use MetaPost, I don't think I'm the best person to document this. But I took this as an opportunity to create the command reference pages for a bunch of the \...MP... commands; perhaps one of you could add this info to the proper page(s)? E.g. at http://wiki.contextgarden.net/Command/startuseMPgraphic There is an overview of the new stubs at http://wiki.contextgarden.net/Template:MetaPost_see_also Also: a question about \startuseMPgraphic and \startuniqueMPgraphic. Both are supposed to be recompiled at every usage, so how are they different? Actually trying it out suggests that useMPgraphic is the only one of the two that re-evaluates its code every time; compare the examples at * http://wiki.contextgarden.net/Command/startuseMPgraphic and * http://wiki.contextgarden.net/Command/startuniqueMPgraphic But then \startuniqueMPgraphic would be the same as \startreuseMPgraphic, so I think I'm still missing something. Cheers, Sietse ___________________________________________________________________________________ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: MetaPost instance mechanism broken 2012-11-26 14:32 ` Sietse Brouwer @ 2012-11-26 16:10 ` Marco Patzer 2012-11-26 16:46 ` Aditya Mahajan 2012-11-26 16:50 ` Hans Hagen 0 siblings, 2 replies; 10+ messages in thread From: Marco Patzer @ 2012-11-26 16:10 UTC (permalink / raw) To: ntg-context [-- Attachment #1: Type: text/plain, Size: 1105 bytes --] 2012-11-26 Sietse Brouwer: > Since I don't use MetaPost, I don't think I'm the best person to > document this. But I took this as an opportunity to create the command > reference pages for a bunch of the \...MP... commands; perhaps one of > you could add this info to the proper page(s)? Thanks. I added some info about the change mentioned in this thread. > Also: a question about > \startuseMPgraphic and > \startuniqueMPgraphic. > Both are supposed to be recompiled at every usage, so how are they > different? Actually trying it out suggests that useMPgraphic is the > only one of the two that re-evaluates its code every time; compare the > examples at AFAIK useMPgraphic is always recalculated, reusableMPgraphic never is. uniqueMPgraphic takes the size into account and recalculates if the graphic dimensions change. If I recall correctly this is mentioned somewhere in the MetaFun manual. But I agree, all these commands for including MP graphics are confusing, given the fact that one can survive pretty well with only useMPgraphic. I attached a small example to show the difference. Marco [-- Attachment #2: t.tex --] [-- Type: text/x-tex, Size: 1042 bytes --] \startuseMPgraphic{alpha} fill unitsquare xyscaled (\overlaywidth, \overlayheight) withcolor (uniformdeviate 1, uniformdeviate 1, uniformdeviate 1); \stopuseMPgraphic \defineoverlay [alpha] [\useMPgraphic{alpha}] \startreusableMPgraphic{beta} fill unitsquare xyscaled (\overlaywidth, \overlayheight) withcolor (uniformdeviate 1, uniformdeviate 1, uniformdeviate 1); \stopreusableMPgraphic \defineoverlay [beta] [\reuseMPgraphic{beta}] \startuniqueMPgraphic{gamma} fill unitsquare xyscaled (\overlaywidth, \overlayheight) withcolor (uniformdeviate 1, uniformdeviate 1, uniformdeviate 1); \stopuniqueMPgraphic \defineoverlay [gamma] [\uniqueMPgraphic{gamma}] \starttext \dontleavehmode \framed[background=alpha]{foo} \framed[background=alpha]{foo} \framed[background=alpha]{foobar} \dontleavehmode \framed[background=beta]{foo} \framed[background=beta]{foo} \framed[background=beta]{foobar} \dontleavehmode \framed[background=gamma]{foo} \framed[background=gamma]{foo} \framed[background=gamma]{foobar} \stoptext [-- Attachment #3: Type: text/plain, Size: 485 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: MetaPost instance mechanism broken 2012-11-26 16:10 ` Marco Patzer @ 2012-11-26 16:46 ` Aditya Mahajan 2012-11-26 16:50 ` Hans Hagen 1 sibling, 0 replies; 10+ messages in thread From: Aditya Mahajan @ 2012-11-26 16:46 UTC (permalink / raw) To: mailing list for ConTeXt users On Mon, 26 Nov 2012, Marco Patzer wrote: > 2012-11-26 Sietse Brouwer: > >> Since I don't use MetaPost, I don't think I'm the best person to >> document this. But I took this as an opportunity to create the command >> reference pages for a bunch of the \...MP... commands; perhaps one of >> you could add this info to the proper page(s)? > > Thanks. I added some info about the change mentioned in this thread. > >> Also: a question about >> \startuseMPgraphic and >> \startuniqueMPgraphic. >> Both are supposed to be recompiled at every usage, so how are they >> different? Actually trying it out suggests that useMPgraphic is the >> only one of the two that re-evaluates its code every time; compare the >> examples at > > AFAIK useMPgraphic is always recalculated, reusableMPgraphic never > is. uniqueMPgraphic takes the size into account and recalculates if > the graphic dimensions change. If I recall correctly this is > mentioned somewhere in the MetaFun manual. But I agree, all these > commands for including MP graphics are confusing, given the fact > that one can survive pretty well with only useMPgraphic. I attached > a small example to show the difference. The distinction was more important in MkII when extra runs for different MP graphics could take a lot of time. But it MkIV, the difference in performance is, I believe, inconsequential. 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: MetaPost instance mechanism broken 2012-11-26 16:10 ` Marco Patzer 2012-11-26 16:46 ` Aditya Mahajan @ 2012-11-26 16:50 ` Hans Hagen 1 sibling, 0 replies; 10+ messages in thread From: Hans Hagen @ 2012-11-26 16:50 UTC (permalink / raw) To: mailing list for ConTeXt users On 11/26/2012 5:10 PM, Marco Patzer wrote: > 2012-11-26 Sietse Brouwer: > >> Since I don't use MetaPost, I don't think I'm the best person to >> document this. But I took this as an opportunity to create the command >> reference pages for a bunch of the \...MP... commands; perhaps one of >> you could add this info to the proper page(s)? > > Thanks. I added some info about the change mentioned in this thread. > >> Also: a question about >> \startuseMPgraphic and >> \startuniqueMPgraphic. >> Both are supposed to be recompiled at every usage, so how are they >> different? Actually trying it out suggests that useMPgraphic is the >> only one of the two that re-evaluates its code every time; compare the >> examples at > > AFAIK useMPgraphic is always recalculated, reusableMPgraphic never > is. uniqueMPgraphic takes the size into account and recalculates if > the graphic dimensions change. If I recall correctly this is Can be more than dimensions. This is the default hash: \def\overlaystamp {\overlaywidth :% \overlayheight:% \overlaydepth :% \MPcolor\overlaycolor:% \MPcolor\overlaylinecolor} so: width, height, depth, background color, line color but is one says \startuniqueMPgraphic{mygraphic}{linewidth,.....} given that linewidth is set, those values are also taken into account > mentioned somewhere in the MetaFun manual. But I agree, all these > commands for including MP graphics are confusing, given the fact > that one can survive pretty well with only useMPgraphic. I attached > a small example to show the difference. It does make a difference when you have documents with thousands of graphics (mkiv is much faster btw) and the pdf file is also smaller when reuse is applied Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: MetaPost instance mechanism broken 2012-11-25 17:11 MetaPost instance mechanism broken Marco Patzer 2012-11-25 17:40 ` Wolfgang Schuster 2012-11-25 17:40 ` Aditya Mahajan @ 2012-12-06 19:10 ` Marco Patzer 2012-12-06 22:12 ` Hans Hagen 2 siblings, 1 reply; 10+ messages in thread From: Marco Patzer @ 2012-12-06 19:10 UTC (permalink / raw) To: context On 2012–11–25 Marco Patzer wrote: > in one of the last few betas the MetaPost instance > mechanism broke. Did the interface change again? The following does not work on today's beta, only “alpha” and “gamma” are printed. \defineMPinstance [myinstance] [metafun] \startuseMPgraphic{alpha} draw textext("alpha") ; \stopuseMPgraphic \startuseMPgraphic{myinstance::beta} draw textext("beta") ; \stopuseMPgraphic \starttext \useMPgraphic{alpha} \useMPgraphic{myinstance::beta} \startMPcode{myinstance} draw textext("gamma") ; \stopMPcode \stoptext Marco ___________________________________________________________________________________ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: MetaPost instance mechanism broken 2012-12-06 19:10 ` Marco Patzer @ 2012-12-06 22:12 ` Hans Hagen 0 siblings, 0 replies; 10+ messages in thread From: Hans Hagen @ 2012-12-06 22:12 UTC (permalink / raw) To: context On 12/6/2012 8:10 PM, Marco Patzer wrote: > On 2012–11–25 Marco Patzer wrote: > >> in one of the last few betas the MetaPost instance >> mechanism broke. > > Did the interface change again? The following does not work on > today's beta, only “alpha” and “gamma” are printed. > > \defineMPinstance > [myinstance] > [metafun] > > \startuseMPgraphic{alpha} > draw textext("alpha") ; > \stopuseMPgraphic > > \startuseMPgraphic{myinstance::beta} > draw textext("beta") ; > \stopuseMPgraphic > > \starttext > \useMPgraphic{alpha} > \useMPgraphic{myinstance::beta} > \startMPcode{myinstance} > draw textext("gamma") ; > \stopMPcode > \stoptext sure, we have a different interface on odd days Currently instances are played with a bit (as Alan and I want the chemical module to run in its own but also want it to be public). Anyhow, one complication is in the related variables. I now have a version that supports this: \defineMPinstance [myinstance] [metafun] \startuseMPgraphic{alpha} draw textext("alpha") ; \stopuseMPgraphic \startuseMPgraphic{myinstance::beta} draw textext("beta") ; \stopuseMPgraphic \startuniqueMPgraphic{myinstance::beta}{width} draw textext("beta") xsized \MPvar{width} ; \stopuniqueMPgraphic \startuseMPgraphic{myinstance::epsilon}{width,height} draw textext("epsilon") xysized (\MPvar{width},\MPvar{height}) ; \stopuseMPgraphic \setMPvariables [myinstance::beta] [width=5cm] \setMPvariables [epsilon] [width=5cm, height=5cm] \starttext one : \useMPgraphic{alpha} \blank two : \useMPgraphic{myinstance::beta} \blank three : \startMPcode{myinstance} draw textext("gamma") ; \stopMPcode \blank four : \reuseMPgraphic{myinstance::beta}{width=2cm} \blank five : \startMPcode{myinstance} draw textext("delta") ; \stopMPcode \blank six : \reuseMPgraphic{myinstance::epsilon}{height=2cm} \blank seven : \reuseMPgraphic{myinstance::epsilon} \blank \stoptext Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-12-06 22:12 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-11-25 17:11 MetaPost instance mechanism broken Marco Patzer 2012-11-25 17:40 ` Wolfgang Schuster 2012-11-25 17:40 ` Aditya Mahajan 2012-11-25 18:05 ` Marco Patzer 2012-11-26 14:32 ` Sietse Brouwer 2012-11-26 16:10 ` Marco Patzer 2012-11-26 16:46 ` Aditya Mahajan 2012-11-26 16:50 ` Hans Hagen 2012-12-06 19:10 ` Marco Patzer 2012-12-06 22:12 ` Hans Hagen
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).