ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Labels in MetaPost (MetaObj)
@ 2011-01-18 12:17 Stefan Müller
  2011-01-20  8:59 ` Taco Hoekwater
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Müller @ 2011-01-18 12:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi list,

I'm having some trouble with MetaPost in general and MetaObj in 
particular. I hope someone on this list can assist me here. I'm trying 
to run the appended ConTeXt file with a quite simple object "Segment" 
(from the manual [1], section 2.1). This script works fine as it is. I 
wanted to add a simple TeX label ("\tt \overbar{E}") to the drawing 
macro, but failed.

When including the line marked with "% 1" the TeX run fails. I don't 
understand why.

The line with "% 2" is taken frome the metaobj manual (section 5.8) [1], 
but including this doesn't work either.

It would be great if someone could tell me what's wrong with the mp-code 
below and explain how to place a (TeX) label inside a metaobj object.

Thanks in advance,
Stefan.


[1] http://tex.loria.fr/prod-graph/momanual.pdf

PS: Both variants fail with mp error messages like this:

"mplib           > mp terminal: ! Inconsistent equation (off by 1).
<to be read again>
                    ;
assignObj->(SUFFIX0)=incr(nObj_);
 
iname_[(SUFFIX0)]=str(SUFFIX0);addclass_((S...

newSegment->...roup.assignObj((SUFFIX2),"Segment")
 
;ObjPoint.a,b;ObjCode"@##b...
<to be read again>
                    ;
<*> ...ar {E}") shifted n.a; enddef; newSegment.s;
                                                    s.a=origin; 
drawObj(s); ;
! Redundant equation.
<to be read again>
                    ;
assignObj->...bj_);iname_[(SUFFIX0)]=str(SUFFIX0);
 
addclass_((SUFFIX0),(EXPR1...

newSegment->...roup.assignObj((SUFFIX2),"Segment")
 
;ObjPoint.a,b;ObjCode"@##b..."


<=======================================>
\startMPinclusions
	input metaobj;
\stopMPinclusions

\startMPpage
	vardef newSegment@#=
		assignObj(@#,"Segment");
		ObjPoint a,b;
		ObjCode "@#b-@#a=(1cm,2cm)";
	enddef;

	def drawSegment(suffix n)=
		draw n.a--n.b;
%		draw btex \tt \overbar{E} etex shifted n.a; % 1
	enddef;

	newSegment.s;
%	ObjLabel.s(btex hello! etex) "labpoint(a)"; % 2
	s.a=origin;
	drawObj(s);
\stopMPpage
<=======================================>
___________________________________________________________________________________
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] 11+ messages in thread

end of thread, other threads:[~2011-01-24 15:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-18 12:17 Labels in MetaPost (MetaObj) Stefan Müller
2011-01-20  8:59 ` Taco Hoekwater
2011-01-21 23:10   ` Hans Hagen
2011-01-22  1:38     ` Aditya Mahajan
2011-01-22 13:25       ` Stefan Müller
2011-01-22 16:30         ` Aditya Mahajan
2011-01-23 11:40           ` Stefan Müller
2011-01-23 12:25             ` Stefan Müller
2011-01-23 17:22               ` Aditya Mahajan
2011-01-23 21:14                 ` Stefan Müller
2011-01-24 15:34                   ` Stefan Müller

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).