Italics in Emacs on a text terminal (rxvt-unicode)
In short: you cannot with the current version of Emacs (checked with 23.2), but see below for a possible workaround.
Longer story: support for italics is encoded in the
terminfo database
as the sitm
(enter italics) and ritm
(exit italics) capabilities
(also called ZH
and ZR
for termcap compatibility); you can check
that your terminal supports them via:
infocmp $TERM | egrep '(sitm|ritm)'
If those are not present, then your rxvt-unicode-256color
terminal
description does not provide information to the ncurses library about
the italics capabilities of the terminal and you might want to add
them, otherwise no TTY application can use italics.
However, function turn_on_face
(in the Emacs sources, file
src/term.c
at line 1919--2012), which manages the terminal display,
does not provide support for italics: it checks for
bold/dim/blinking/underline attributes of a face. Actually, there is
no "italics" attribute encoded in struct face
.
Indeed, my Emacs (version 23.1 on Ubuntu 11.04 natty) shows italicized faces (which display correctly in X11) as underlined in a TTY. (Which means that, if you do not care about underlining, you can just change the terminfo description of your terminal to use the enter/exit italics escape sequences instead of the enter/exit underline ones and get italics.)
I'm adding this answer because the others are out of date. Emacs 24.5 does correctly display italic faces in terminals.
This is emacs 24.5 running in a terminal (emacs -nw
). The terminal is uxvrt
and the setup in my .Xdefaults
is:
URxvt*termName: rxvt-unicode-256color
URxvt.font: xft:DejaVu Sans Mono:size=9
Regarding emacs not able to utilise italics in terminal emulators which provide this funtionality: This is emacs bug #9652 which was fixed by Chong Yidong on Jun 10, 2012.
The fix is not in any released version of emacs though, but for instance in the emacs-snapshot package from emacs.naquadah.org.