![](https://secure.gravatar.com/avatar/e79f226aa442b589932230491affa641.jpg?s=120&d=mm&r=g)
Am 22.09.2008 um 15:00 schrieb Hans Hagen:
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
Be careful: this kills the ability of the emphasized word to be hyphenated! (... at least here with MKII) Steffen