8

Is there a way like wrap the line after at most 60 letters but it should not break inside some commands like listings does?

Example:

    \documentclass[a5paper]{article}
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
    \usepackage{listings}
    \usepackage{xcolor}

    \lstset{%
      language=[LaTeX]TeX,
      backgroundcolor=\color{gray!25},
      basicstyle=\ttfamily,
      breaklines=true,
      columns=fullflexible
    }

    \begin{document}
    \begin{lstlisting}
    The roadrunner is the fastest running bird \remark{Check this again with a zoologist!}.
    \end{lstlisting}
    \end{document}

Output:

    The roadrunner is the fastest running bird         remark{Check this again with a zoologist!}.

That should not happen! In my eyes this problem is not discussed in verbatim environment that can break too long lines.

strpeter
  • 5,215

1 Answers1

4

Thanks to Torbjørn T., my question is answered:

One simply has to say:

\lstset{%
  breaklines=true,
  breakatwhitespace=true,
}
strpeter
  • 5,215