ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: nico <nicolas.marsgui@libertysurf.fr>
Subject: Re: How to \processcommalist inside another commalist?
Date: Tue, 22 Aug 2006 00:26:16 +0200	[thread overview]
Message-ID: <optenm92sz9niby6@localhost> (raw)
In-Reply-To: <44EA20EB.3050007@wxs.nl>

On Mon, 21 Aug 2006 23:08:59 +0200, Hans Hagen <pragma@wxs.nl> wrote:

>>> but after some thinking I realized that it would indeed be a better
>>> idea (less to type?) to have
>>>     \useGNUPLOTgraphic[name][1,3]
>>> and
>>>     \useGNUPLOTgraphic[name][1,3][width=.9\textwidth]
>>> instead.
>>>
>>> At the beginning the main reason against it was that I didn't know how
>>> to distinguish which kind of parameters are being used in the second
>>> pair of brackets, but I guess that I can safely use \ifnumberelse as a
>>> test on the first item to distinguish between the two.
>>>
>>
>> Maybe you could play only with the parameter count. The limitation is  
>> that
>> an empty second argument is required when only options need to be  
>> passed.
>>
> why? in that case #3 is empty and #2 contains the options

Hm, I thought that the initial goal was to know if the parameter passed is  
a number list, or an option list. In the suggested code, the assumption is  
that the number list (if any) is always the second parameter.

If not, how to handle those cases?

\useGNUPLOTgraphic[name][2,3,5]
\useGNUPLOTgraphic[name][width=2in]

But I guess there are clever internal macros that could help :-)

Regards,
BG

>> \def\printPrime#1{#1 is prime.\crlf}
>>
>> \def\useGNUPLOTgraphic
>>    {\dotripleempty\douseGNUPLOTgraphic}
>>
>> \def\douseGNUPLOTgraphic[#1][#2][#3]%
>>    {\ifthirdargument
>>       \doprime{#2}
>>       parameters are #3
>>       \getparameters[gnuplot][#3]
>>     \else\ifsecondargument
>>       \doprime{#2}
>>     \fi\fi}
>>
>> \def\doprime#1{\processcommalist[#1]\printPrime}
>>
>> \starttext
>> \useGNUPLOTgraphic[name]
>> \useGNUPLOTgraphic[name][2,3,5]
>> \useGNUPLOTgraphic[name][3,5,7][width=2in]
>> \useGNUPLOTgraphic[name][][width=4in]
>> \stoptext

  reply	other threads:[~2006-08-21 22:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-21 15:23 Mojca Miklavec
2006-08-21 17:17 ` nico
2006-08-21 18:07   ` Taco Hoekwater
2006-08-21 18:35   ` Mojca Miklavec
2006-08-21 20:51     ` nico
2006-08-21 21:08       ` Hans Hagen
2006-08-21 22:26         ` nico [this message]
2006-08-22  8:13           ` Hans Hagen
2006-08-21 21:04     ` Taco Hoekwater
2006-08-23 20:43       ` Mojca Miklavec
2006-08-21 21:04     ` 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=optenm92sz9niby6@localhost \
    --to=nicolas.marsgui@libertysurf.fr \
    --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).