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

Jonathan Kew jfkthame at googlemail.com
Tue Mar 31 01:32:47 CEST 2009


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



More information about the XeTeX mailing list