ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Mojca Miklavec" <mojca.miklavec.lists@gmail.com>
Subject: scaling reusableMPgraphic & some ConTeXt programming
Date: Sun, 23 Jul 2006 08:14:26 +0200	[thread overview]
Message-ID: <6faad9f00607222314o3e536aeah58399fb71472423f@mail.gmail.com> (raw)

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]


2. I have several graphics defined as

\startGNUPLOTgraphic[1][name]
	draw fullcircle scaled 3cm withcolor .625red;
\stopGNUPLOTgraphic
\startGNUPLOTgraphic[2][name]
	draw fullcircle scaled 3cm withcolor .625green;
\stopGNUPLOTgraphic
\startGNUPLOTgraphic[3][name]
	draw fullcircle scaled 3cm withcolor .625blue;
\stopGNUPLOTgraphic

\startGNUPLOTgraphic[1][othername]
	fill fullcircle scaled 3cm withcolor .625red;
\stopGNUPLOTgraphic
\startGNUPLOTgraphic[2][othername]
	fill fullcircle scaled 3cm withcolor .625green;
\stopGNUPLOTgraphic

and a pretty stupid definition:

\long\def\startGNUPLOTgraphic
	{\dodoubleargument\dostartGNUPLOTgraphic}

\long\def\dostartGNUPLOTgraphic[#1][#2]#3\stopGNUPLOTgraphic % [number][name]
	{% add to counter to note the nuber of the graphic
         % define a new counter for the first time when you use it
	 \doif{#1}{1}{\doglobal\newcounter\abc}% counter name has to depend on #2
	 \doglobal\increment\abc % assigning the value #1 to it would also be OK
	 \startreusableMPgraphic{gpg:#2:#1}#3\stopreusableMPgraphic}

How can I give a better name than \abc to the counter (the name should
depend on #2 in order to be unique)?


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).

How should I start?

Thank you a lot for any hints,
    Mojca Miklavec

             reply	other threads:[~2006-07-23  6:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-23  6:14 Mojca Miklavec [this message]
2006-07-24  9:03 ` Taco Hoekwater
2006-07-24  9:03 ` Hans Hagen
2006-07-25 13:55   ` Mojca Miklavec
2006-07-25 21:51     ` Hans Hagen
2006-07-25 21:52     ` Hans Hagen
2006-07-26  7:58       ` Mojca Miklavec

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=6faad9f00607222314o3e536aeah58399fb71472423f@mail.gmail.com \
    --to=mojca.miklavec.lists@gmail.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).