From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/6194 Path: main.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: [ConTeXt] Re: pictures for numbers Date: Fri, 16 Nov 2001 17:37:12 +0100 Sender: owner-ntg-context@let.uu.nl Message-ID: <5.1.0.14.1.20011116171336.03241368@server-1> References: <5.1.0.14.1.20011116125114.02eebb88@server-1> <20011116105527.A29519@cs.uu.nl> <5.1.0.14.1.20011116125114.02eebb88@server-1> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Trace: main.gmane.org 1035396736 8390 80.91.224.250 (23 Oct 2002 18:12:16 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 23 Oct 2002 18:12:16 +0000 (UTC) Cc: ntg-context@ntg.nl Original-To: Andres Loeh In-Reply-To: <20011116160637.G29519@cs.uu.nl> Xref: main.gmane.org gmane.comp.tex.context:6194 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:6194 At 04:06 PM 11/16/2001 +0100, Andres Loeh wrote: > > Date: Fri, 16 Nov 2001 12:53:14 +0100 > > From: Hans Hagen > > Subject: [ConTeXt] Re: pictures for numbers > >Hello again, > >thanks for your help so far. I tried to construct a solution out of >Taco's and your remarks, and I got that far: > >%--BEGIN >\useexternalfigure [sleutelI] [sleutelsI_new] [height=3ex] >\useexternalfigure [sleutelV] [sleutelsV_new] [height=3ex] >\useexternalfigure [sleutelX] [sleutelsX_new] [height=3ex] > >\def\Sleutels#1% > {\hbox{\expandafter\DoSleutels\romannumeral #1\relax}\relax} > >\def\DoSleutels#1% > {\if #1\relax > \let\next\relax > \else > \if #1i% > \externalfigure[sleutelI] > \else > \if #1v% > \externalfigure[sleutelV] > \else > \if #1x% > \externalfigure[sleutelX] > \else > \relax > \fi > \fi > \fi > \let\next\DoSleutels > \fi > \next} > >The generation of the pictures works perfectly as >a standalone function. However, I want them to appear >as chapter numbers. If I uncomment either the line marked >%(1)% or the lines marked %(2)%, I get errors: > >(1): As said, the #1 is not really a number but a whole bunch of info, liek font switches; try \showargument{#1} in your macro and you will see what i mean. This is why you need the alternative that i send you. That one uses the raw number. If you want an uppercase rommannumeral, use \def\MyNiceNumber#1% {\edef\TheRomanNumber{\Romannumerals\currentheadnumber}% \expandafter\handletokens\TheRomanNumber\with\MyRomanPicture} \def\MyRomanPicture#1% {\hbox{\externalfigure[RomanDigit#1][widyh=1cm]}} \setuphead[chapter][numbercommand=\MyNiceNumber] \dorecurse{25}{\chapter{It Works}} For this to work you need the following macro (which i made for patrick some weeks ago, in core-con, but that one generates a \relax: \def\doRomannumerals#1#2\relax % spaces after ifcase prevent \relax {\ifnum#1#2<10 \ifcase0#1#2 \or I\or II\or III\or IV\or V\or VI\or VII\or VIII\or IX\fi \else\ifnum#1#2<100 \ifcase0#1 \or X\or XX\or XXX\or XL\or L\or LX\or LXX\or LXXX\or XC\fi \doRomannumerals#2\relax \else\ifnum#1#2<1000 \ifcase0#1 \or C\or CC\or CCC\or CD\or D\or DC\or DCC\or DCCC\or CM\fi \doRomannumerals#2\relax \else\ifnum#1#2<4000 \ifcase0#1 \or M\or MM\or MMM\fi \doRomannumerals#2\relax \else \uppercase\expandafter{\romannumeral#1#2}% \fi\fi\fi\fi} ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com -------------------------------------------------------------------------