ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Using metapost figures in context
Date: Wed, 14 Jun 2006 11:00:49 -0400 (EDT)	[thread overview]
Message-ID: <Pine.WNT.4.63.0606141055210.2444@nqvgln> (raw)
In-Reply-To: <448E7381.8070501@wxs.nl>

On Tue, 13 Jun 2006, Hans Hagen wrote:

> Aditya Mahajan wrote:
>> I have right now kept the command as MPfigure.
>>
> grep MPfigure in  meta-fig -)
>

Now I am using staticMPfigure. This is the final version

\def\startstaticMPfigure#1#2\stopstaticMPfigure
   {\bgroup
     \setMPrandomseedfalse
     %Otherwise randomseed := number line always differ
     \doifmodeelse{*pdf}
     {\def\executeMPTEX##1%
     {texmfstart --verbose --ifchanged=##1.mp texexec --mpgraphic 
##1.mp}
     \let\executeMPOST=\executeMPTEX}
     {\def\executeMPOST##1%
     {texmfstart --verbose --ifchanged=##1.mp bin:mpost

\ifcase\interactionmode\MPOSTbatchswitch\or\MPOSTnonstopswitch\fi
       \space\ifuseMETAFUNformat \MPOSTformatswitch metafun \fi ##1}
    \def\executeMPTEX##1% slower, due to nested texexec call
    {texmfstart --verbose --ifchanged=##1.mp texexec
        --batch \ifcase\interactionmode --logfile='mptex.log' \fi
        --output=\MPOSTdriver\space
        \ifuseMETAFUNformat --mpformat=metafun \fi --mptex --nomp 
--once ##1}}
     \def\MPgraphicfile{\jobname-#1}
     \newcount\currentMPgraphic
     \startMPgraphic
       #2
     \stopMPgraphic\egroup\deallocateMPslot\currentMPgraphic}

\def\usestaticMPfigure{\dosingleempty\dousestaticMPfigure}

\def\dousestaticMPfigure[#1]%
   {\doifmodeelse{*pdf}
   {\externalfigure[\jobname-#1.pdf]}
   {\externalfigure[\jobname-#1.1]}}

\starttext

\startstaticMPfigure{circle}
   fill fullcircle scaled 10cm;
\stopstaticMPfigure

\startstaticMPfigure{axis}
   drawarrow (0,0)--(1cm,0) ;
   drawarrow (0,0)--(0,1cm) ;
   label.llft(textext("(0,0)") ,origin) ;
\stopstaticMPfigure

\hbox to \hsize  \bgroup
\hss \usestaticMPfigure[circle][width=1cm] \hss 
\usestaticMPfigure[axis] \hss \egroup
\stoptext

Thanks,
Aditya

  reply	other threads:[~2006-06-14 15:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-12 18:48 Aditya Mahajan
2006-06-12 21:43 ` Hans Hagen
2006-06-12 23:29   ` Aditya Mahajan
2006-06-13  0:16     ` Aditya Mahajan
2006-06-13  8:12     ` Hans Hagen
2006-06-14 15:00       ` Aditya Mahajan [this message]
2006-06-13  9:38     ` Hans Hagen
     [not found]       ` <Pine.WNT.4.63.0606131213490.892@nqvgln>
2006-06-13 20:16         ` Using metapost figures in context (offlist) Hans Hagen
2006-06-13 20:33           ` Aditya Mahajan
2006-06-13 21:16             ` Hans Hagen
2006-06-14  1:52               ` Aditya Mahajan
2006-06-14  2:03                 ` Aditya Mahajan
2006-06-14  7:35                   ` Hans Hagen
2006-06-14 14:41                     ` Aditya Mahajan
2006-06-16  9:47                     ` Uwe Koloska
2006-06-16 10:10                       ` Hans Hagen

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=Pine.WNT.4.63.0606141055210.2444@nqvgln \
    --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).