TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting 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

How do I provide multiple emphstyles with the listings package?

if something
end if

Both styles above (\emph and \textbf} don't get applied. If I use only one style, it works.

share|improve this question
Welcome to TeX.sx! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can use backticks ` to mark your inline code‌​. You can also highlight the code and click the "code" button (with "{}" on it). – Torbjørn T. Nov 20 '11 at 0:44
up vote 8 down vote accepted

I guess you want it to be italic and boldshape. By using \itshape and \bfseries instead it works.

if something
end if

enter image description here

share|improve this answer
Thanks. I wonder from where they expect you to learn that. – Salil Nov 20 '11 at 0:48
@Salil: Experience :) Perhaps this is a start: Is there a difference between \textit and \itshape? The motivation here is that \textbf, \textit and \textsf are local macros that take arguments, while \bfseries, \itshape and \sffamily are switches. – Werner Nov 20 '11 at 1:44

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.