TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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 want to write something like

In order to avoid a RuntimeException

where RuntimeException appears with a code font.

I've tried something like

\begin{lstlisting} In order to avoid a RuntimeException \end{lstlisting}

but it was of no avail. Any suggestions? If it isn't possible, could anyone point out what's the font being used by default by listings?

share|improve this question
Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – Jubobs Jan 14 '14 at 18:28

Use \lstinline for inline listings:

enter image description here

The \begin{lstlisting}...\end{lstlisting} is for displayed listings.



    To avoid a  \lstinline´RuntimeException´ you need to...
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.