The problem is that in the inline listing "ABC-ABC" the hyphen disappears. It works if I remove the literate=... parameter but I need it because I want to wrap around long inline code by specifying manual hyphenation markers with "-". How can I solve this problem?
Another weird thing is that inline listing only works with \newcommand as the second part in the example shows. Is this a bug?
\documentclass{article}
\usepackage{listings}
\lstdefinestyle{Inline}
{
literate={\-}{}{0\discretionary{-}{}{}}
}
\newcommand{\code}[1]{\lstinline[style=Inline]{#1}}
\begin{document}
\code{ABC-ABC}\\
\code{AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABC\-ABC}\\[1cm]
Bug in listings???\\
\code{AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABC\-ABC}\\
\lstinline[style=Inline]{AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABC\-ABC}
\end{document}

\code. Rather try:\newcommand{\code}{\lstinline[style=Inline]}– Werner Mar 30 '14 at 14:14