[XeTeX] Fake italics for some characters only

John Was john.was at ntlworld.com
Wed Dec 5 10:20:09 CET 2018


I work in plain XeTeX, but I hope the following will work (and make sense)
in XeLaTeX too.

You could redefine \textit, but to keep things simple, set up a new command,
say \Textit, and change all occurrences of \textit to \Textit in your
document (or a copy thereof!).


\def\Textit{{\italictrue \textit}} (double braces to keep things local).

You will also need a new \if:


Now, supposing the character you want to influence as you describe is ć 
(Unicode 0107).

Make that active:

\defć{{\ifitalic  {\fakeslantfont \char"0107} \else \char"0107 \fi}}

Obviously, change \fakeslantfont to whatever you have used to define the 
faked italic font.  Again I have used double {{ }} for safety.

ć will then appear with artificial slanting whenever it occurs within 

And so on for all the characters to be treated this way.

(More elegantly, redefine \textit itself but I'm not experienced with the 
LaTeX \renewcommand etc. features.)

Hope this helps (and I hope XeTeX picks up on the fact that I'm actually now 
at johnoxuk at gmail.com!)



-----Original Message----- 
From: Benct Philip Jonsson
Sent: Tuesday, December 04, 2018 7:57 PM
To: xetex at tug.org
Subject: [XeTeX] Fake italics for some characters only

I have a somewhat unusual problem. In a document produced using
XeLaTeX I need to use four Unicode letters with scarce font
support in italicized words and passages but the font which I have
to use supports these characters only in roman. The obvious
solution is to use the FakeSlant feature of fontspec but I don’t
want to enclose these characters in a command argument, in the
hope that a future version of the document can use an italic font
which supports these characters, but neither do I (perhaps
needless to say) want to use fake italics except for these four
characters. In other words I would like to perform some kind of
“keyhole surgery” in the preamble and use these characters
normally in the body of the document, which I guess means having
to make them active and somehow detect when they are inside the
argument of `\textit`. (Note: it is appropriate to use `\textit`
rather than `\emph` here because the purpose of the italicization
is to mark text as being in an object language in a linguistic
text.) Is that at all possible? I guess I could wrap `\textit` in
a macro which locally redefines the active characters, but I’m not
sure how to do that, nor how to access the glyphs corresponding to
the characters once the characters are active. I am a user who
isn’t afraid of using and making the most of various packages or
of writing an occasional custom command to wrap up some repeatedly
needed operation, but I am no expert. I am aware of all the
arguments against fake italics — that is why I want to limit the
damage as much as possible! — but I have no choice here. Waiting
for the/an appropriate font to include italic versions of these
characters is not an option at the moment.


Subscriptions, Archive, and List information, etc.:

More information about the XeTeX mailing list