# [NTG-context] scaling reusableMPgraphic & some ConTeXt programming

Mojca Miklavec mojca.miklavec.lists at gmail.com
Tue Jul 25 15:55:16 CEST 2006

On 7/24/06, Hans Hagen wrote:
> Mojca Miklavec wrote:
> > Hello,
> >
> > the answers to these three questions are most probably one-liners, but
> > I don't know which ones ;)
> >
> > 1. How can I scale (an already defined) reusableMPgraphic? Simplified
> > example of what I currently (want to) have:
> >
> > % how should I change this definition?
> > \def\usemygraphic[#1][#2]{\reuseMPgraphic{#1}}
> > \usemygraphic[name][width=.7\textwidth]
> >
> \def\usemygraphic[#1][#2]{\scale[#2]{\reuseMPgraphic{#1}}
>
> \usempgraphic[name][width=4cm,height=5cm]
>
> \scale accepts the same scaling options as externalfigure

Thanks to both you and Taco!

> why do you need a counter

> > 3. I would like to change \usemygraphic, so that
> > \usemygraphic[othername] or \usemygraphic[othername][height=5cm] would
> > resolve to
> >     \dorecurse{2}{\useMPgraphic{gpg:othername:\recurselevel}}
> > and \usemygraphic[name][n={1,3},width=8cm] (syntax might be different
> > if necessary) to
> >     \reuseMPgraphic{gpg:name:1}
> >     \reuseMPgraphic{gpg:name:3}
> > (with proper scaling if possible).
> >
> you want all graphics?
>
> \def\usemygraphic#1%
>   {\doloop
>      {\doifMPgraphicelse{gpg:#1:\recurselevel}
>         {\reuseMPgraphic{gpg:name:\recurselevel}}
>         {\exitloop}}}
>
> or so ...

Wow! No, I don't need a counter in that case ;)

Just a little detail: Yes, I want all the graphics except if the user
provides "n={1,3}" or "n=4", then I would like to output only the ones
specified. I know that this is a trivial question, but how do I
extract the argument of "n=..." to \processcommalist on it?

And yet another short&stupid question: when does \c!something=\v!value
work? I tried to change \setupGNUPLOT[terminal=context] into
[\c!terminal=\v!context] (in \unprotect-ed area), but I get a
command-undefined error.

Thanks,
Mojca