ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* processaction in keyval lists
@ 2005-01-22 15:01 Thomas A.Schmitz
  2005-01-22 16:37 ` processaction in keyval lists[SOLVED] Thomas A.Schmitz
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas A.Schmitz @ 2005-01-22 15:01 UTC (permalink / raw)


All,

I couldn't resist spending some time today working on the Greek  
problem. I'm trying to write a proper module that would allow me to set  
up definitions for fonts and scaling. But I'm running into a problem   
that is beyond my meagre TeX abilities. I want to define the  
setup-command like so (using code that Taco send to the list a couple  
of months ago and that can be found on the wiki):

\unprotect

\def\setupgreek{\dodoubleempty\dosetupgreek}

\def\dosetupgreek#1[#2]{%
   \getparameters[GG][Scale=,Font=,#2]%Font,Scale
\edef\MyScale{\GGScale}%
\expandafter\processaction\expandafter[\GGFont]
    [SomeFont1     =>\def\MyFont{somefont },
     SomeFont2     =>\def\MyFont{someotherfont }]
}

\protect

\definebodyfont[4pt,5pt,6pt,7pt,8pt,9pt,10pt,10.5pt,11pt,12pt,14pt,14.4p 
t,16pt,18pt,20pt,22pt][rm][Gf=\MyFont sa \MyScale]

So I want this setup
\setupgreek[Scale=1.5,Font=SomeFont1]
to be expanded to somefont scaled at 1.5.

However, when I process a file, I always get this error:

! Undefined control sequence.
<argument> \MyFont
                    sa \MyScale
\parsefontspec #1->\xdef \somefontspec {#1
                                           \space }\@EA \doparsefontspec  
\som...

\xxdododefinefont ...tsize {#2}\parsefontspec {#4}
                                                   \newfontidentifier  
\let \l...

\fontstrategy ...ame #1\csname #2#3#4#5\endcsname
                                                   \tryingfontfalse \fi
<inserted text> ...yle \fontalternative \fontsize
                                                   \fi \iftryingfont  
\fontstr...

\synchronizefont ...strategy \the \fontstrategies
                                                   \relax \fi  
\ifskipfontchar...
...

When I add this line

\def\MyFont{somefont }

to the module, files compile without problems. So I conclude: the  
mistake is not in the definiton of MyFont itself, but my values are not  
getting processed the proper way; something in the \processaction part  
must be wrong. But I'm "stymied" here. Any suggestions would be most  
welcome!

Best

Thomas

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: processaction in keyval lists[SOLVED]
  2005-01-22 15:01 processaction in keyval lists Thomas A.Schmitz
@ 2005-01-22 16:37 ` Thomas A.Schmitz
  2005-01-23 21:04   ` h h extern
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas A.Schmitz @ 2005-01-22 16:37 UTC (permalink / raw)


Answering my own question, and apologizing for the noise: after having  
a look at some instances of \processaction in the source, I just took  
out \expandafter before and after \processaction; now it works. I'm  
just getting a mysterious pair of brackets in my pdf, but I'll try and  
hunt that down, too.

Best

Thomas
On Jan 22, 2005, at 4:01 PM, Thomas A.Schmitz wrote:

> All,
>
> I couldn't resist spending some time today working on the Greek  
> problem. I'm trying to write a proper module that would allow me to  
> set up definitions for fonts and scaling. But I'm running into a  
> problem  that is beyond my meagre TeX abilities. I want to define the  
> setup-command like so (using code that Taco send to the list a couple  
> of months ago and that can be found on the wiki):
>
> \unprotect
>
> \def\setupgreek{\dodoubleempty\dosetupgreek}
>
> \def\dosetupgreek#1[#2]{%
>   \getparameters[GG][Scale=,Font=,#2]%Font,Scale
> \edef\MyScale{\GGScale}%
> \expandafter\processaction\expandafter[\GGFont]
>    [SomeFont1     =>\def\MyFont{somefont },
>     SomeFont2     =>\def\MyFont{someotherfont }]
> }
>
> \protect
>
> \definebodyfont[4pt,5pt,6pt,7pt,8pt,9pt,10pt,10.5pt,11pt,12pt,14pt,14.4 
> pt,16pt,18pt,20pt,22pt][rm][Gf=\MyFont sa \MyScale]
>
> So I want this setup
> \setupgreek[Scale=1.5,Font=SomeFont1]
> to be expanded to somefont scaled at 1.5.
>
> However, when I process a file, I always get this error:
>
> ! Undefined control sequence.
> <argument> \MyFont
>                    sa \MyScale
> \parsefontspec #1->\xdef \somefontspec {#1
>                                           \space }\@EA  
> \doparsefontspec \som...
>
> \xxdododefinefont ...tsize {#2}\parsefontspec {#4}
>                                                   \newfontidentifier  
> \let \l...
>
> \fontstrategy ...ame #1\csname #2#3#4#5\endcsname
>                                                   \tryingfontfalse \fi
> <inserted text> ...yle \fontalternative \fontsize
>                                                   \fi \iftryingfont  
> \fontstr...
>
> \synchronizefont ...strategy \the \fontstrategies
>                                                   \relax \fi  
> \ifskipfontchar...
> ...
>
> When I add this line
>
> \def\MyFont{somefont }
>
> to the module, files compile without problems. So I conclude: the  
> mistake is not in the definiton of MyFont itself, but my values are  
> not getting processed the proper way; something in the \processaction  
> part must be wrong. But I'm "stymied" here. Any suggestions would be  
> most welcome!
>
> Best
>
> Thomas
>
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: processaction in keyval lists[SOLVED]
  2005-01-22 16:37 ` processaction in keyval lists[SOLVED] Thomas A.Schmitz
@ 2005-01-23 21:04   ` h h extern
  0 siblings, 0 replies; 3+ messages in thread
From: h h extern @ 2005-01-23 21:04 UTC (permalink / raw)


Thomas A.Schmitz wrote:
>>    [SomeFont1     =>\def\MyFont{somefont },
>>     SomeFont2     =>\def\MyFont{someotherfont }]

no spaces before the =>

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-01-23 21:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-22 15:01 processaction in keyval lists Thomas A.Schmitz
2005-01-22 16:37 ` processaction in keyval lists[SOLVED] Thomas A.Schmitz
2005-01-23 21:04   ` h h extern

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