I want to be able to have inline code (printed in typewriter or something) where I can also use LaTeX commands like \myinlinecode{here comes a backslash: <\textbackslash>}
. So it should be possible to use non-verbatim parts inside the code command.
I read that it should be possible with the listings
package but I could't get it to work. What I tried was:
\documentclass{article}
\usepackage{listings}
\begin{document}
\lstset{escapebegin=x, escapeend=y}
\lstinline|x\textbraceleft y|
\lstset{escapebegin={x}, escapeend={y}}
\lstinline_x\textbraceleft y_
\lstset{escapebegin={\textbackslash}, escapeend={\textbackslash}}
\lstinline_\\textbraceleft \_
\end{document}
listings
' possibilities for escaping to LaTeX are only available for the environment and not for the inline command. Do you need verbatim? Otherwise there's of course\texttt{}
...listings
manual, the answer in the linked question seems to be incorrect. The correct key should beescapechar
, orescapeinside
.