Tell me more ×
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.

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

1 Answer

Use \lstinline for inline listings:

enter image description here

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

References:

Code:

\documentclass{article}
\usepackage{listings}
\lstset{basicstyle=\ttfamily\small}
\begin{document}
    To avoid a  \lstinline´RuntimeException´ you need to...
\end{document}
share|improve this answer

Your Answer

 
discard

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.