* Re: Custom metaobj object in context
[not found] <mailman.2543.1279171292.4277.ntg-context@ntg.nl>
@ 2010-07-16 7:42 ` Stefan Müller
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Müller @ 2010-07-16 7:42 UTC (permalink / raw)
To: ntg-context
On 15.07.2010 07:21, Aditya Mahajan wrote:
> Can you post a complete metapost file that gives some output.I tried the
> following mp file:
> input metaobj;
Now that's a good start... It didn't occur to me, that I need to "input
metaobj" as in your example. Thank you very much for that hint. My
examples now work in ConTeXt with
\startMPinclusions
input metaobj;
\stopMPinclusions
I assume posting the complete example is needless now. Possibly, it
might have been a good idea to drop a note on this in the metaobj
manual, as it is not working without that input line.
Stefan
___________________________________________________________________________________
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] 5+ messages in thread
* Re: Custom metaobj object in context
2010-07-14 11:16 ` Stefan Müller
@ 2010-07-15 5:21 ` Aditya Mahajan
0 siblings, 0 replies; 5+ messages in thread
From: Aditya Mahajan @ 2010-07-15 5:21 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1131 bytes --]
On Wed, Jul 14, 2010 at 7:16 AM, Stefan Müller <warrence.stm@gmx.de> wrote:
> On 13.07.2010 21:03, Hans Hagen wrote:
>
>> On 13-7-2010 6:01, Stefan Müller wrote:
>>
>>> Hi,
>>>
>>> I just tried to build my own object in metaobj but for some reason I
>>> cannot figure out it does not work. I tried the example from the metaobj
>>> manual in a tex document (it works in a metapost file):
>>>
>>> \startuseMPgraphic{objecttest}
>>> vardef newSegment@#=
>>> assignObj(@#,"Segment");
>>> ObjPoint a,b;
>>> ObjCode "@#b-@#a=(1cm,2cm)";
>>> enddef;
>>> \stopuseMPgraphic
>>>
>>
Can you post a complete metapost file that gives some output.I tried the
following mp file:
input metaobj;
vardef newSegment@#=
assignObj(@#,"Segment");
ObjPoint a,b;
ObjCode "@#b-@#a=(1cm,2cm)";
enddef;
beginfig(1) ;
newSegment.s; % create an instance
endfig ;
end;
but running it through metapost gives me an empty file:
%!PS
%%BoundingBox: 0 0 0 0
%%HiResBoundingBox: 0 0 0 0
%%Creator: MetaPost 1.208
%%CreationDate: 2010.07.15:0119
%%Pages: 1
%%BeginProlog
%%EndProlog
%%Page: 1 1
showpage
%%EOF
Aditya
[-- Attachment #1.2: Type: text/html, Size: 1748 bytes --]
[-- Attachment #2: Type: text/plain, Size: 486 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] 5+ messages in thread
* Re: Custom metaobj object in context
2010-07-13 19:03 ` Hans Hagen
@ 2010-07-14 11:16 ` Stefan Müller
2010-07-15 5:21 ` Aditya Mahajan
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Müller @ 2010-07-14 11:16 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 13.07.2010 21:03, Hans Hagen wrote:
> On 13-7-2010 6:01, Stefan Müller wrote:
>> Hi,
>>
>> I just tried to build my own object in metaobj but for some reason I
>> cannot figure out it does not work. I tried the example from the metaobj
>> manual in a tex document (it works in a metapost file):
>>
>> \startuseMPgraphic{objecttest}
>> vardef newSegment@#=
>> assignObj(@#,"Segment");
>> ObjPoint a,b;
>> ObjCode "@#b-@#a=(1cm,2cm)";
>> enddef;
>> \stopuseMPgraphic
>>
>> When processing this with context (MkIV) I get
>>
>> ! Illegal parameter number in definition of \@MPG@objecttest.
>> <to be read again>
>> =
>> <argument> vardef newSegment@##=
>> assignObj(@##,"Segment"); ObjPoint a,b; Ob...
>> \dostartuseMPgraphic ...leuseMPgraphic {#1}{#2}{#3
>> }}
>> l.7 \stopuseMPgraphic
>>
>> My first wild guess is that it has something to do with the "evil"
>> @-symbol. But even if this is the case I don't know what to do to fix
>> this. Any help appreciated and thank you very much in advance.
>
> no, more with # being special to tex's parser
>
> \string# or \# will probably do
Thank you Hans for the fast answer. Adding \string in front of every #
led to basically the same error message (only difference: "@\sting ##"
instead of "@##"). When using \# instead of # in the vardef the small
example from above works (even with \placefigure added). But there is
still a problem:
\starttext
\startuseMPgraphic{objecttest}
vardef newSegment@\#=
assignObj(@\#,"Segment");
ObjPoint a,b;
ObjCode "@\#b-@\#a=(1cm,2cm)";
enddef;
newSegment.s; % create an instance
\stopuseMPgraphic
\placefigure[here][fig:objecttest]{My
object}{\useMPgraphic{objecttest}}
\stoptext
now produces the metapost error
! Isolated expression.
<to be read again>
(
newSegment->begingroup.assignObj(
(SUFFIX2),"Segment");ObjPoint.a,b;ObjCode"@...
<to be read again>
;
<*> ... "@#b-@#a=(1cm,2cm)"; enddef; newSegment.s;
Without \placefigure there is no error at all. (Maybe then metapost
doesn't even run?) And I again have no clue what's going on. Thanks for
your help in advance.
Stefan.
___________________________________________________________________________________
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] 5+ messages in thread
* Re: Custom metaobj object in context
2010-07-13 16:01 ` Stefan Müller
@ 2010-07-13 19:03 ` Hans Hagen
2010-07-14 11:16 ` Stefan Müller
0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2010-07-13 19:03 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Stefan Müller
On 13-7-2010 6:01, Stefan Müller wrote:
> Hi,
>
> I just tried to build my own object in metaobj but for some reason I
> cannot figure out it does not work. I tried the example from the metaobj
> manual in a tex document (it works in a metapost file):
>
> \startuseMPgraphic{objecttest}
> vardef newSegment@#=
> assignObj(@#,"Segment");
> ObjPoint a,b;
> ObjCode "@#b-@#a=(1cm,2cm)";
> enddef;
> \stopuseMPgraphic
>
> When processing this with context (MkIV) I get
>
> ! Illegal parameter number in definition of \@MPG@objecttest.
> <to be read again>
> =
> <argument> vardef newSegment@##=
> assignObj(@##,"Segment"); ObjPoint a,b; Ob...
> \dostartuseMPgraphic ...leuseMPgraphic {#1}{#2}{#3
> }}
> l.7 \stopuseMPgraphic
>
> My first wild guess is that it has something to do with the "evil"
> @-symbol. But even if this is the case I don't know what to do to fix
> this. Any help appreciated and thank you very much in advance.
no, more with # being special to tex's parser
\string# or \# will probably do
-----------------------------------------------------------------
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] 5+ messages in thread
* Custom metaobj object in context
[not found] <mailman.1.1279015202.10306.ntg-context@ntg.nl>
@ 2010-07-13 16:01 ` Stefan Müller
2010-07-13 19:03 ` Hans Hagen
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Müller @ 2010-07-13 16:01 UTC (permalink / raw)
To: ntg-context
Hi,
I just tried to build my own object in metaobj but for some reason I
cannot figure out it does not work. I tried the example from the metaobj
manual in a tex document (it works in a metapost file):
\startuseMPgraphic{objecttest}
vardef newSegment@#=
assignObj(@#,"Segment");
ObjPoint a,b;
ObjCode "@#b-@#a=(1cm,2cm)";
enddef;
\stopuseMPgraphic
When processing this with context (MkIV) I get
! Illegal parameter number in definition of \@MPG@objecttest.
<to be read again>
=
<argument> vardef newSegment@##=
assignObj(@##,"Segment"); ObjPoint
a,b; Ob...
\dostartuseMPgraphic ...leuseMPgraphic {#1}{#2}{#3
}}
l.7 \stopuseMPgraphic
My first wild guess is that it has something to do with the "evil"
@-symbol. But even if this is the case I don't know what to do to fix
this. Any help appreciated and thank you very much in advance.
Stefan.
___________________________________________________________________________________
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] 5+ messages in thread
end of thread, other threads:[~2010-07-16 7:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <mailman.2543.1279171292.4277.ntg-context@ntg.nl>
2010-07-16 7:42 ` Custom metaobj object in context Stefan Müller
[not found] <mailman.1.1279015202.10306.ntg-context@ntg.nl>
2010-07-13 16:01 ` Stefan Müller
2010-07-13 19:03 ` Hans Hagen
2010-07-14 11:16 ` Stefan Müller
2010-07-15 5:21 ` Aditya Mahajan
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).