From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/44214 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: how to color italics? Date: Mon, 22 Sep 2008 15:00:06 +0200 Message-ID: <48D796D6.80308@wxs.nl> References: <409BC877-2849-4311-85F9-7EBF49EC2492@st.estfiles.de> <48D785F3.8040207@elvenkind.com> <48D78948.6080002@elvenkind.com> <48D78FD3.4000902@elvenkind.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1222088514 23998 80.91.229.12 (22 Sep 2008 13:01:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 22 Sep 2008 13:01:54 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Mon Sep 22 15:02:50 2008 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1Khl3x-0006pl-A3 for gctc-ntg-context-518@m.gmane.org; Mon, 22 Sep 2008 15:02:49 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 4F87E1FE20; Mon, 22 Sep 2008 15:01:45 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 14853-02-6; Mon, 22 Sep 2008 15:00:55 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id DE6941FD9B; Mon, 22 Sep 2008 15:00:52 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 75C8D1FDFA for ; Mon, 22 Sep 2008 15:00:46 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 14424-03-2 for ; Mon, 22 Sep 2008 15:00:11 +0200 (CEST) Original-Received: from mail.pragma-ade.net (dsl-083-247-100-017.solcon.nl [83.247.100.17]) by ronja.ntg.nl (Postfix) with ESMTP id B16131FD9B for ; Mon, 22 Sep 2008 15:00:06 +0200 (CEST) Original-Received: from [10.100.1.100] (unverified [10.100.1.100]) by controller-1 (SurgeMail 3.9e) with ESMTP id 568-1840426 for ; Mon, 22 Sep 2008 15:00:03 +0200 User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) In-Reply-To: <48D78FD3.4000902@elvenkind.com> X-Originating-IP: 10.100.1.100 X-Authenticated-User: hagen@controller-1 X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:44214 Archived-At: 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 ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________