ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Labels in MetaPost (MetaObj)
Date: Sat, 22 Jan 2011 11:30:10 -0500 (EST)	[thread overview]
Message-ID: <alpine.LNX.2.01.1101221126290.5824@ybpnyubfg.ybpnyqbznva> (raw)
In-Reply-To: <4D3ADACE.7090900@gmx.de>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1438 bytes --]

On Sat, 22 Jan 2011, Stefan Müller wrote:

> So its either using text or using metaobj? Too bad, metaobj is quite fun... I 
> still hope you guys can fix this, but it's not urgent (to me).
>
> Anyway, what does the [+] after 
> \startMPinclusions? I did not find documentation for that on the wiki.

\startMPinclusions
   path a ;
\stopMPinclusions

\startMPinclusions
   a := (0,0) -- (1cm,0) ;
\stopMPinclusions

will fail, because the second inclusions overwrites the first. If you use 
[+], then the second inclusions in appended after the first.

> Just as a wild guess I tested the example below today, trying to make use of 
> the things Aditya said, but to no avail.

The trick is to ensure that the offending code (assignObj) is not run 
twice.

\startMPinclusions[+]
   input metaobj;
   boolean flag; flag := false;
\stopMPinclusions

\startMPdefinitions
   vardef newSegment@\#=
     if not flag :
       assignObj(@\#,"Segment");
       ObjPoint a,b;
       ObjCode "@\#b-@\#a=(1cm,2cm)";
     fi ;
   enddef;

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

\starttext
\startMPpage
   newSegment.s;
   ObjLabel.s(btex hello! etex) "labpoint(a)"; % 2
   s.a=origin;
   drawObj(s);
   flag := true ;
\stopMPpage
\stoptext

@Hans, can we have a `trialtypesetting` for MP code?

Aditya

[-- 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
___________________________________________________________________________________

  reply	other threads:[~2011-01-22 16:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-18 12:17 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.01.1101221126290.5824@ybpnyubfg.ybpnyqbznva \
    --to=adityam@umich.edu \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).