From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/44243 Path: news.gmane.org!not-for-mail From: Steffen Wolfrum Newsgroups: gmane.comp.tex.context Subject: Re: how to color italics? Date: Tue, 23 Sep 2008 18:01:25 +0200 Message-ID: <739ACEDF-CE96-4EC6-8A98-08755DBE7B2E@st.estfiles.de> References: <409BC877-2849-4311-85F9-7EBF49EC2492@st.estfiles.de> <48D785F3.8040207@elvenkind.com> <48D78948.6080002@elvenkind.com> <48D78FD3.4000902@elvenkind.com> <48D796D6.80308@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v929.2) Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1222185921 27502 80.91.229.12 (23 Sep 2008 16:05:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 23 Sep 2008 16:05:21 +0000 (UTC) To: Hans Hagen , mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Sep 23 18:06:17 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 1KiAO6-0002Er-8F for gctc-ntg-context-518@m.gmane.org; Tue, 23 Sep 2008 18:05:41 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id EB3421FDDD; Tue, 23 Sep 2008 18:04:13 +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 16995-04-3; Tue, 23 Sep 2008 18:03:21 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 6442D1FD76; Tue, 23 Sep 2008 18:03:20 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id CECD41FD76 for ; Tue, 23 Sep 2008 18:03:13 +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 20907-01-3 for ; Tue, 23 Sep 2008 18:02:27 +0200 (CEST) Original-Received: from smtprelay09.ispgateway.de (smtprelay09.ispgateway.de [80.67.29.23]) by ronja.ntg.nl (Postfix) with ESMTP id 0604C1FDF4 for ; Tue, 23 Sep 2008 18:01:26 +0200 (CEST) Original-Received: from [89.247.36.172] (helo=[192.168.1.2]) by smtprelay09.ispgateway.de with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.68) (envelope-from ) id 1KiAKM-0003Z1-6P; Tue, 23 Sep 2008 18:01:26 +0200 In-Reply-To: <48D796D6.80308@wxs.nl> X-Mailer: Apple Mail (2.929.2) X-Df-Sender: 698580 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:44243 Archived-At: 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 ___________________________________________________________________________________ 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 ___________________________________________________________________________________