I know about the fragility of verbatim-like commands, and that they should not be used as an argument of another macro, but a need to write a description environment in which the terms to be defined are programming variables and functions, and thus I need use \lstinline with them.
I know about Verbatim description list item, but my question is somewhat different, for the following reasons:
- I don't want only verbatim output and
ttfont, I want the syntax highlighting provided by\lstinline. - I don't write those description environments, they are automatically generated with a tool (
pandoc).
In essence, I have a markdown source file containing for example:
The arguments of the function are:
`foo`
: Name of the file
`bar`
: Permissions
(the syntax is a markdown extension for descriptions, implemented by pandoc). When processed through pandoc with the appropiate options, the following tex code is generated:
The arguments of the function are:
\begin{description}
\item[\lstinline!foo!]
Name of the file
\item[\lstinline!bar!]
Permissions
\end{description}
And of course when latex compiles this, it chokes (strangely enough, it does not produce compiling errors, but in the resulting pdf the defined terms disappeared, and they appear later, all overlayed at the same place, at first \item in the next itemize).
So my questions are (in order of preference):
- There is some way to redefine
\itemor\lstinlineso that the above works without changes in the generatedtexcode? - If not, is it possible to define some other command instead of
\item(say,\lstitem) which would produce the defined term typeset (and syntax-highlighted) bylistings. In this second case I would write a script which searches thetexfile for the\item[\lstinline!.*!]stuff and replaces it by\lstitem{.*}.
]inside\lstinline) also works against my expectatives, but it's great. I guess that\lstinlineredefines again]'s catcode. Thank you so much. – JLDiaz Jan 15 '13 at 18:59\lstinlineredefines]'s catcode again until the trailing!. – Martin Scharrer Jan 15 '13 at 19:00beamerclass in case of incremental overlay specifications. – Denis Bitouzé Dec 17 '17 at 18:33\bibitemfor an\item...) I'm usingnatbib. – Evgeni Sergeev Jun 18 '18 at 00:47