[XeTeX] Reset bold, italic or small-caps to "normal"

Andy Black andy_black at sil.org
Tue Mar 31 17:10:13 CEST 2009


Date: Tue, 31 Mar 2009 00:32:47 +0100
From: Jonathan Kew <jfkthame at googlemail.com>
Subject: Re: [XeTeX] Reset bold, italic or small-caps to "normal"
To: Unicode-based TeX for Mac OS X and other platforms <xetex at tug.org>
Message-ID: <A8CFB84A-2150-4D06-BFFB-E005821BAF6D at googlemail.com>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

On 31 Mar 2009, at 00:16, Andy Black wrote:

> I'm transforming some XML to use XeLaTeX.  The XML allows for  
> sequences
> of embedded data like this (lines broken for clarity - I hope):
>
> <p>I'm normal,
> <object type="tBold">I'm bold</object>,
> <object type="tItalic">I'm italic</object>,
> <object type="tBoldItalic">I'm bold and italic</object>, and
> <object type="tBoldItalic">Bold-italic <object type="tNormal">I'm an
> embedded normal</object> bold-italic </object>.</p>
>
> Notice that at the end, it has an embedded <object> element which is  
> to
> be typeset with neither bold nor italic even though its parent element
> is to be typeset using both bold and italic.
>
> My transform currently produces this TeX output (lines broken for
> clarity - I hope):
>
> I'm normal,
> {\textbf{I'm bold}},
> {\textit{I'm italic}},
> {\textit{\textbf{I'm bold and italic}}}, and
> {\textit{\textbf{Bold-italic {I'm an embedded normal} bold-italic}}}.
>
> What I'm wondering is this: is there is a way to tell XeLaTeX to use
> "normal" rather than bold or italic for the "I'm an embedded normal"
> portion?  I see that there is \textnormal, but it uses the main  
> document
> font and there is no guarantee that the main document font will be the
> correct one in the context.

Try \textmd ("medium" weight) to cancel boldness (these are called  
"font series" in NFSS), and \textup ("upright" shape) to cancel any of  
italic, slanted, or small-caps (these are "font shapes").  So if you  
wrap your embedded "normal" object in \textmd{\textup{....}} you  
should get what you want.

For more, check your friendly local LaTeX reference book for details  
about NFSS, the New Font Selection Scheme (though it was "new" a long  
time ago now!).

JK


Jonathan:

Thanks so much.  This is exactly what I was looking for: a way to cancel bold, 
italic or small-caps without also canceling other font characteristics that 
were currently in place.

--Andy

P.S. My apologies for possibly messing up the thread on this message - I neglected
to change back from digest mode before sending my message.




More information about the XeTeX mailing list