Hi all, Some times ago, I have discovered MetaUML via the MetaPost ML. As a consequence, I have tried to use it with ConTeXt... Here is the result: Considering a VERY simple example: \starttext \startuseMPgraphic{xx} input metauml; Class.A("A")()(); drawObject(A); \stopuseMPgraphic \placefigure[here][fig:xx]{xx}{\useMPgraphic{xx}} \stoptext The compilation failed with:
clearboxes ! Isolated expression. <to be read again> ; <scantokens> ...nsidefigure := false ; clearboxes;
<to be read again> ; endfig->scantokens.extra_endfig; shipit;endgroup l.125 endfig ; Apparently, MetaUML is based on boxes.mp (temp-mpgraph.mp (/usr/share/texmf-tetex/metapost/metauml/metauml.mp HERE ====> (/usr/share/texmf-tetex/metapost/base/boxes.mp) (/usr/share/texmf-tetex/metapost/metauml/util_infrastructure.mp (/usr/share/texmf-tetex/metapost/metauml/util_log.mp)) .... .... It have already tried to use boxes.mp in ConTeXt in the past, but switched for metaobj because: 1. metaobj is more suitable to my needs 2. boxes.mp causes troubles when used with ConTeXT I'll keep searching a solution but if one of yours has already dealt with this kind of problems and succeeded in using boxes or, best, MetaUML... (I have to precise that I don't want to include a ps or pdf file generated by metapost only. I would embed the code in my document) Cheers, Renaud
On Tue, 02 May 2006 16:55:45 +0200, Renaud AUBIN
Hi all,
Some times ago, I have discovered MetaUML via the MetaPost ML. As a consequence, I have tried to use it with ConTeXt... Here is the result:
Considering a VERY simple example: [...]
Apparently, MetaUML is based on boxes.mp
(temp-mpgraph.mp (/usr/share/texmf-tetex/metapost/metauml/metauml.mp HERE ====> (/usr/share/texmf-tetex/metapost/base/boxes.mp) (/usr/share/texmf-tetex/metapost/metauml/util_infrastructure.mp (/usr/share/texmf-tetex/metapost/metauml/util_log.mp)) .... ....
It have already tried to use boxes.mp in ConTeXt in the past, but switched for metaobj because: 1. metaobj is more suitable to my needs 2. boxes.mp causes troubles when used with ConTeXT
I'll keep searching a solution but if one of yours has already dealt with this kind of problems and succeeded in using boxes or, best, MetaUML...
I remember I had such troubles when including boxes. It makes a mess when included in a graphic. Inluding it via \startMPinclusions makes your example work. \starttext \startMPinclusions input metauml.mp; \stopMPinclusions \startuseMPgraphic{xx} Class.A("A")()(); drawObject(A); \stopuseMPgraphic \placefigure[here][fig:xx]{xx}{\useMPgraphic{xx}} \stoptext Regards, BG
Renaud AUBIN wrote:
clearboxes ! Isolated expression.
can you grep your metapost tree for 'clearboxes'? where is it defined? Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Hi Hans, The example with clearboxes's crash: \setupoutput[pdftex] \starttext \startuseMPgraphic{my_uml_figure} input metauml; Class.A("Point") ("+x: int", "+y: int") (); Class.B("Circle") ("radius: int") ("+getRadius(): int", "+setRadius(r: int):void"); topToBottom(45)(A, B); drawObjects(A, B); clink(aggregationUni)(A, B); \stopuseMPgraphic \placefigure[here]{none}{\useMPgraphic{my_uml_figure}} \stoptext The resulting pdf looks good... strange... I use teTeX on debian + metapost 0.901 renaud@rescue:/usr/share/texmf-tetex/metapost/base$ grep clearboxes * boxes.mp: expandafter def expandafter clearboxes expandafter = boxes.mp: clearboxes cl($); boxes.mp: & "boxjoin();save pic_,sproc_,pproc_;def clearboxes=enddef;"; boxes.mp:extra_endfig := extra_endfig & "clearboxes;"; Now, I have solved my problem with this (horrible!?) hack: \startuseMPgraphic{my_uml_figure} input metauml; beginfig(1); Class.A("Point") ("+x: int", "+y: int") (); Class.B("Circle") ("radius: int") ("+getRadius(): int", "+setRadius(r: int):void"); topToBottom(45)(A, B); drawObjects(A, B); clink(aggregationUni)(A, B); endfig; \stopuseMPgraphic I don't want to put "input metauml;" within MPinclusions because for my PhD thesis, I have a lot of MPgraphic (without MetaUML) and: 1. I don't want to load metauml for each metapost run 2. I use MetaObj... (MetaUML and MetaObj interfere to each other) Cheers, Renaud Hans Hagen a écrit :
Renaud AUBIN wrote:
clearboxes
! Isolated expression.
can you grep your metapost tree for 'clearboxes'? where is it defined?
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
_______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Renaud AUBIN wrote:
Hi Hans,
The example with clearboxes's crash:
this is probably due to the fact that clearboxes hooks into endfig \setupoutput[pdftex] \starttext \startMPinclusions input boxes; \stopMPinclusions \startuseMPgraphic{my_uml_figure} input metauml; Class.A("Point") ("+x: int", "+y: int") (); Class.B("Circle") ("radius: int") ("+getRadius(): int", "+setRadius(r: int):void"); topToBottom(45)(A, B); drawObjects(A, B); clink(aggregationUni)(A, B); \stopuseMPgraphic \placefigure[here]{none}{\useMPgraphic{my_uml_figure}} \stoptext this only works when in boxes.mp, we have: extra_beginfig := extra_beginfig & "boxjoin();save pic_,sproc_,pproc_;def clearboxes=enddef;"; extra_endfig := extra_endfig & " clearboxes"; (space added before clearboxes in string) (maybe i should clean up boxes.mp and preload that in metafun if only i know what it's meant for) i suggest that you contact the author of metauml: - rename the util_* files into metauml_util_* in order to prevent clashes with other util_* files - load all files into the main file, so that you get rid of the redundant file reads (loading quits when the files are already loaded,but best do some testing before they are input) - provide a metauml_preload.mp file that preloads e.g. boxes.mp so that you can do \startMPinclusions input metauml_preload; \stopMPinclusions \startuseMPgraphic{my_uml_figure} input metauml; \stopuseMPgraphic - provide "load_metauml" that loads once only, so that you can do \startMPinclusions input metauml_preload; \stopMPinclusions \startuseMPgraphic{my_uml_figure} load_metauml; \stopuseMPgraphic \startuseMPgraphic{my_second_uml_figure} load_metauml; \stopuseMPgraphic and get only one load when you collect graphics instead of runtime processing Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Hi all, Ovidiu Gheorghies has sent to me an intermediate-release yesterday, I'll test it and if same problems occur I'll try to modify the metauml structure by myself in interaction with Ovidiu (according th Hans's advice). I'll do that as soon as I have the time... ;) Cheers, Renaud Hans Hagen a écrit :
Renaud AUBIN wrote:
Hi Hans,
The example with clearboxes's crash:
this is probably due to the fact that clearboxes hooks into endfig
\setupoutput[pdftex]
\starttext
\startMPinclusions input boxes; \stopMPinclusions
\startuseMPgraphic{my_uml_figure} input metauml;
Class.A("Point") ("+x: int", "+y: int") ();
Class.B("Circle") ("radius: int") ("+getRadius(): int", "+setRadius(r: int):void");
topToBottom(45)(A, B);
drawObjects(A, B);
clink(aggregationUni)(A, B); \stopuseMPgraphic
\placefigure[here]{none}{\useMPgraphic{my_uml_figure}}
\stoptext
this only works when in boxes.mp, we have:
extra_beginfig := extra_beginfig & "boxjoin();save pic_,sproc_,pproc_;def clearboxes=enddef;"; extra_endfig := extra_endfig & " clearboxes";
(space added before clearboxes in string)
(maybe i should clean up boxes.mp and preload that in metafun if only i know what it's meant for)
i suggest that you contact the author of metauml:
- rename the util_* files into metauml_util_* in order to prevent clashes with other util_* files - load all files into the main file, so that you get rid of the redundant file reads (loading quits when the files are already loaded,but best do some testing before they are input) - provide a metauml_preload.mp file that preloads e.g. boxes.mp so that you can do
\startMPinclusions input metauml_preload; \stopMPinclusions
\startuseMPgraphic{my_uml_figure} input metauml; \stopuseMPgraphic
- provide "load_metauml" that loads once only, so that you can do
\startMPinclusions input metauml_preload; \stopMPinclusions
\startuseMPgraphic{my_uml_figure} load_metauml; \stopuseMPgraphic
\startuseMPgraphic{my_second_uml_figure} load_metauml; \stopuseMPgraphic
and get only one load when you collect graphics instead of runtime processing
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
_______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
participants (3)
-
Hans Hagen
-
nico
-
Renaud AUBIN