I’m using the breaklines
and prebreak
option with listings, but I find it visually not very pleasing that the prebreak-symbols are not vertically aligned. I’d prefer if they were all on the very right of the listing.
Here is example code.
\documentclass{standalone}
\usepackage{listings}
\begin{document}
\begin{lstlisting}[breaklines,breakatwhitespace,prebreak=!,basicstyle=\ttfamily]
This is a long line This is a long line This is a long line This is a long line This is a long line
This is another long line This is another long line This is another long line This is another long line
\end{lstlisting}
\end{document}
Which yields:
while I want something like
listings
documentation warns against using spaces (other than\space
) in the token list forprebreak
andpostbreak
: "You must not use dynamic space (in particular spaces) since internally we use\discretionary
. However\space
is redefined to be used inside tokens." The required alignment might be hard to achieve.