ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Taco Hoekwater <taco@elvenkind.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Passing info from MetaPost to TeX
Date: Fri, 30 Jul 2010 09:04:06 +0200	[thread overview]
Message-ID: <4C527966.3030504@elvenkind.com> (raw)
In-Reply-To: <E8AA0FE6-F93C-4260-91FC-763722A11841@mpq.mpg.de>

On 07/30/2010 08:20 AM, Oliver Buerschaper wrote:
> No answer :-( Does that mean it's impossible with current technology?

Well, you could create a temporary file from withing the metapost
graphic, then read that file back on the TeX side, and then shift
the image vertically based on the info from that.

Complicated and a bit ugly, but doable. A nicer solution is to
adjust the bounging box of the image itself so that it does the
right thing. This seems to do the trick (but I recall there is
a way to pass a TeX variable to the figure; and that would be much
cleaner; but I don't remember how offhand).


\startuseMPgraphic{diagram2}
    u := StrutHeight;
    draw origin--(2u,0)--(u,sqrt(3)*u)--cycle;
    currentpicture := currentpicture shifted (0,-(sqrt(3)*u/3));
    setbounds currentpicture to (origin--(2u,0)--(u,sqrt(3)*u)--cycle);
\stopuseMPgraphic

\starttext

\startformula
   A\raise\Umathaxis\displaystyle\hbox{\useMPgraphic{diagram2}}
   =B
\stopformula

\stoptext

___________________________________________________________________________________
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:[~2010-07-30  7:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-20 12:00 Oliver Buerschaper
2010-07-22 20:22 ` Hans Hagen
2010-07-24 18:35   ` Oliver Buerschaper
2010-07-30  6:20     ` Oliver Buerschaper
2010-07-30  7:04       ` Taco Hoekwater [this message]
2010-08-01 10:16         ` Oliver Buerschaper
2010-08-01 10:42           ` Taco Hoekwater
2010-08-01 10:52           ` Oliver Buerschaper

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=4C527966.3030504@elvenkind.com \
    --to=taco@elvenkind.com \
    --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).