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.

1
  • 4
    Would breakatwhitespace=true be good enough? Feb 12, 2013 at 0:26

1 Answer 1

4

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

One simply has to say:

\lstset{%
  breaklines=true,
  breakatwhitespace=true,
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .