# [NTG-context] combined style?

Tue Jun 19 13:08:31 CEST 2012

Am 19.06.2012 um 12:44 schrieb Meer, H. van der:

> I had hoped to be able to combine style features in parameters, in this manner:
> \macro[param={a,b}]. Doing this with foregroundstyle did not work, see the following examples:
>
> \framed[foregroundstyle=italic]{ABCD} => typesets in italic
> \framed[foregroundstyle=small]{ABCD} => typesets small
> \framed[foregroundstyle={small,italic}]{ABCD} => typesets not in small-italic but first "small,italic" followed by the framed ABCD
>
> Of course the effect wanted can be obtained by \framed[foregroundstyle={\tfx\it}]{ABCD}
>
> But my problem is the fact that I would like to use style settings from within XML-nodes in the following manner:
> <node style="small,italic">
> leading to somewhere a call of \setupsomething[foregroundstyle={small,italic}].
> It is a pity that <node style="small" style="italic"> does not work, because with two successive calls
> \setupsomething[foregroundstyle=small]
> \setupsomething[foregroundstyle=italic]
> the first setting is lost.
>
> Translating internally smallitallic to \tfx\it is a remote possibility, but then each and every combination has to be provided for. There are simply too many of them if one wants to combine size (small,large) type (mono,calligraphic,serif,sansserif) and (bold, italic, slanted, normal).
>
> Is there a solution?

\definealternativestyle[smallitalic][\itx][\itx]

\starttext

\framed[foregroundstyle=small]{text}
\framed[foregroundstyle=italic]{text}
\framed[foregroundstyle=smallitalic]{text}

\stoptext

or

\starttext

\scratchtoks\emptytoks
\appendtoks\tx\to\scratchtoks % check if the style attribute contains “small”
\appendtoks\it\to\scratchtoks % check if the style attribute contains “italic”

\framed[foregroundstyle=\the\scratchtoks]{text}

\stoptext

Wolfgang