[NTG-context] scaling reusableMPgraphic & some ConTeXt programming

Taco Hoekwater taco at elvenkind.com
Mon Jul 24 11:03:14 CEST 2006



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]

Guessing:

   \def\usemygraphic[#1][#2]{\scaled[#2]{\reuseMPgraphic{#1}}}

> 
> 2. I have several graphics defined as
 > ....
> How can I give a better name than \abc to the counter (the name should
> depend on #2 in order to be unique)?

Better use \definenumber instead of the low-level command.

> 
> 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}}

Where does this '2' come from?

> 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).
> 
> How should I start?

Create a commalist of desired numbers first (possibly using recursion),
then run \processcommalist on each item.

Cheers, Taco


More information about the ntg-context mailing list