Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
4  
Would breakatwhitespace=true be good enough? –  Torbjørn T. Feb 12 '13 at 0:26

1 Answer 1

up vote 3 down vote accepted

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

One simply has to say:

\lstset{%
  breaklines=true,
  breakatwhitespace=true,
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.