I am trying to highlight a specific line inside a listing with listinline. The code I am currently using looks like this:
\begin{lstlisting}[escapechar=!]
class A {
void m() {
B b = ...
!\fbox{b.n();}!
}
}
\end{lstlisting}
This works somewhat, however the text inside the fbox is obviously not processed by the listings package. Using !fbox{\lstinline{b.n();}}! produces an error.
!\verb|...|!is allowed – daleif Apr 05 '11 at 14:16Verbatimenvironment insidelrboxand aminipageenvironment and use\fbox{\usebox\mybox}again. You can also use myadjustboxpackage and wrapVerbatimwith\begin{adjustbox}{minipage=\linewidth,fbox} .. \end{adjustbox}. Feel free to open a follow-up question if this doesn't help you enough. – Martin Scharrer Jan 10 '13 at 07:49