On Wednesday, 8 August 2018 11.38.50 WEST Jürgen Spitzmüller wrote:
> \begin{lstlistings}
> [foo]
>
> reads [foo] as content, whereas
>
> \begin{lstlistings}%
> [foo]
>
> or
>
> \begin{lstlistings}[foo,
> bar]
>
> reads [foo...] as argument.
>
> Patch attached. Please test.
>
> It's possible that minted needs the same fix. I have not tested (I
> don't have minted installed).
I am sorry, I was busy with more pressing issues (Sara is on holidays). :-)
OK, with your patch the initial snippet works but not the attached. That is
basically:
\begin{lstlisting}%
[str] = disp(x)
\end{lstlisting}
latex has no problem with it.
Regards,
--
José Abílio
\documentclass{scrbook}
\usepackage{listings}
\lstset{language=Octave}
\begin{document}
\begin{lstlisting}%
[str] = disp(x)
\end{lstlisting}
\end{document}