ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Mari Voipio <mari.voipio@iki.fi>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Using MPgraphics as externalfigures?
Date: Fri, 3 Aug 2012 22:45:19 +0300	[thread overview]
Message-ID: <CAGbDsP0RK2kvaqgwv4VzS0rxM_Y+3HZVzfOKLykz0UHQctj_SQ@mail.gmail.com> (raw)
In-Reply-To: <20120802103441.7267c0e1@homerow>

Hi Marco & al,

On Thu, Aug 2, 2012 at 11:34 AM, Marco Patzer <homerow@lavabit.com> wrote:
> Read http://wiki.contextgarden.net/Metapost

I was on <http://wiki.contextgarden.net/Mpgraphic> which I actually
found for informative, but not quite enough for my "very dummy" level.


> and 3.3 Integrated Graphics in the MetaFun Manual.

*This* was my missing link (and I was being pretty stupid). I dug the
book out of my pile of ConTeXt papers and found exactly what I needed,
at the end of chapter 3.3, pages 115-117 in my paper copy.


To  answer to myself (in case somebody else ever looks for this);

At least in theory the key to the problem is to create a file
somefile.mp, then write the MP code in the file

beginfig{01}
   .
   .
   .
endfig ;
end .


The whole file is used by

\startMPrun
   input somefile ;
\stopMPrun

and the individual figure is available in the virtual file mprun.01.
Thus it can be included with
\externalfigure[mprun.01][width=0.5\textwidth] %etcetera


Page 117 even has an example of exactly the type of combination I'm
trying to achieve, so now it's just down to creating the graphic(s)
file(s). As my braiding graphics come in groups (steps and variations,
to be exact), this solution looks like a winner for now.


> \defineframed
>   [graphicframe]
>   [frame=on,offset=none]
>
> \define[1]\MPframed
>   {\graphicframe{\useMPgraphic{#1}}}
>
> \startuseMPgraphic{first}
>   fill fullcircle scaled 2cm withcolor red;
> \stopuseMPgraphic
>
> \startreusableMPgraphic{second}
>   fill fullsquare rotated 45 scaled 2cm withcolor blue;
> \stopreusableMPgraphic
>
> \startbuffer [third]
>   fill fullsquare scaled 1cm withcolor green;
> \stopbuffer
>
> \starttext
>   \useMPgraphic{first}
>   \reuseMPgraphic{second}
>   \processMPbuffer [third]
>   \MPframed{second}
> \stoptext


Thank you! I'll have to delve into this bit once the current
almost-past-deadline project is done, looks like this'll take a bit of
processing before it starts to make sense to me (my computer has no
such problems...).


Now, time for some recoding, thanks once more!

Mari
___________________________________________________________________________________
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:[~2012-08-03 19:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-02  3:56 Mari Voipio
2012-08-02  8:34 ` Marco Patzer
2012-08-03 19:45   ` Mari Voipio [this message]
2012-08-03 21:28 ` Aditya Mahajan

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=CAGbDsP0RK2kvaqgwv4VzS0rxM_Y+3HZVzfOKLykz0UHQctj_SQ@mail.gmail.com \
    --to=mari.voipio@iki.fi \
    --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).