[Tex/LaTex] Listing / lstinline and line breaks

line-breakinglistings

I'm using \lstinline among other things for writing file names of my source files. For example

\lstinline{foofoo.pl}

Then, sometimes I have the problem that some lines containing this string are longer than others:

example

If I use something like that

\lstset{
  breaklines=true
}

The text will be breaked like

foofoo
.pl

But I only want

asdfljsfljadf foofoo.pl

with a correct length of the line or a line break before the whole text of lstinline, like

asdfljsfljadf
foofoo.pl

I hope that you understand my problem… 😉

Thanks for your help!

Best Answer

for such paragraphs use

\begin{sloppypar}
... your paragraph with \lstinline...
\end{sloppypar}
Related Question