Taco Hoekwater wrote:
Aditya Mahajan wrote:
Ah, so that is why it is lowlevel. I wonder why the following does not work.
\setupbodyfontenvironment [default] [em={\italic\color[red]}]
The em key is a bit extra extra special: it has to be either 'italic' or 'slanted', everything else is ignored. This is because of the need to allow bold emphasis. (\bf\em == \bs or \bi).
I would personally be happier if it would just use whatever was in the argument when it is *not* italic or slanted, instead of ignoring the argument, but that's how it is.
\def\doemphasistypeface#1#2% {\doifelsevalue{\??ft\fontclass\normalizedbodyfontsize\c!em}\v!slanted {#1}% {\doifelsevalue{\??ft\fontclass\normalizedbodyfontsize\c!em}\v!italic {#2}% {\doifelsevaluenothing{\??ft\fontclass\normalizedbodyfontsize\c!em} {\doifelsevalue{\??ft\normalizedbodyfontsize\c!em}\v!slanted {#1}% {\doifelsevalue{\??ft\normalizedbodyfontsize\c!em}\v!italic {#2}% {\getvalue{\??ft\normalizedbodyfontsize\c!em}}}} {\getvalue{\??ft\fontclass\normalizedbodyfontsize\c!em}}}}} however, this does not provide italic correction, so better is: \newtoks\everyemphasized \unexpanded\def\em {\relax \ifdim\slantperpoint>\zeropoint \settrue\emneeded \else \setfalse\emneeded \fi \setemphasisboldface % new \ifx\fontalternative\c!it % \ifnum\fam=\itfam \def\emphasistypeface{\it}\tf \else\ifx\fontalternative\c!sl % \ifnum\fam=\slfam \def\emphasistypeface{\sl}\tf \else\ifx\fontalternative\c!bf % \ifnum\fam=\bffam \emphasisboldface \else\ifx\fontalternative\c!bs % \ifnum\fam=\bsfam \def\emphasisboldface{\bs}\bf \else\ifx\fontalternative\c!bi % \ifnum\fam=\bifam \def\emphasisboldface{\bi}\bf \else \emphasistypeface \fi\fi\fi\fi\fi \the\everyemphasized \ifconditional\emneeded\relax \else \expandafter\aftergroup \fi \emphasiscorrection} which provides a hook, as in: \appendtoks \red \to \everyemphasized both mechanisms will be provided (maybe something emcolor later, when i can get myself motivated for such an possibly never documented feature) ----------------------------------------------------------------- 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 -----------------------------------------------------------------