Expand special characters inside lstinline

listings

I have some inline code I want to use some special characters with.

The desired result:

`CMD ...`

Working Tex without lstinline:

\textasciigrave CMD \ldots\textasciigrave

However, when I try to put the Tex inside \lstinline{}, the special characters no longer expand correctly, instead giving me the raw Tex code. The backticks don't look right when I just use ` and the LaTeX checker complains that I should use \ldots instead of ....

Is there a way to get the special characters to expand as I want inside lstinline?

Best Answer

\lstinline is part of the listings package and it is used to print "verbatim" its content, that is, it jumps into loops to avoid interpreting any commands (there are exceptions and options, but mainly that is the main objective of the command) in order to be able to typeset code.

If what you need is the monospaced fonts, just use:

\texttt{\textasciigrave CMD \ldots\textasciigrave}

which prints the (evaluated!) content in the current monospaced font.

Related Question