Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Emacs running in an urxvt, and I cannot get italics to work in Emacs although the terminal supports it.

Here’s my current setup:

  • I haven’t set $TERM, so it is the default rxvt-unicode-256color.
  • My ~/.Xdefaults defines URxvt.font: xft:Inconsolata:size=15 as the terminal font.
  • Running echo '\e[3mitalics\e[m' in the shell indeed yields italics, so italics in the terminal do work, basically.

When customizing the “Italic” face, it doesn’t make any difference whether I select italic, oblique, normal, or roman as the value for the Slant attribute, nor does it if I don’t set the Slant attribute at all. I also tried this in combination with explicitly defining URxvt.italicFont in my ~/.Xdefaults, but to no avail.

Bold works fine, italic doesn’t work at all. Any ideas?

share|improve this question
I didn't realize it was even remotely possible to have italics in a terminal. Thanks for that. – wfaulk Aug 10 '11 at 13:56
up vote 8 down vote accepted

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.)

share|improve this answer
This answer looks good, but right now I can't test it because the only linux install I have is as a guest in a win7 host. As a result I'm having difficulties testing this. Specifically I can't seem to insert the ascii escape codes. If someone else can test to confirm or explain what I might be doing wrong with the escape sequences I'll be happy to award the bounty. – vschum Aug 11 '11 at 17:09
@vschum If you're trying to change your terminfo database, this answer should help. We can't help with your difficulties unless you explain them; you could ask a question about them. – Gilles Aug 11 '11 at 23:30
@Gilles Actually, it has more to do with this answer. I can't figure out how to insert the sequences to test if the italics work or not. When I type ESC [ 3 m nothing shows up in the terminal. – vschum Aug 12 '11 at 2:07
@vschum Pressing ESC doesn't insert an escape character. You can press Ctrl+V ESC to insert one, but you rarely need to. E.g. the escape character is represented by \E in terminfo source; in a terminal (with bash/ksh/zsh), try echo $'\e[3mhello\e[0m'. – Gilles Aug 12 '11 at 7:19

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.

share|improve this answer
This information is probably out of date.... – Samuel Edwin Ward Jul 16 '13 at 14:53

I'm adding this answer because the others are out of date. Emacs 24.5 does correctly display italic faces in terminals.

enter image description here

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
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.