General ⇒ How to avoid overfull box due to lstinline?
How to avoid overfull box due to lstinline?
I am using the lstinline command to show java class names in a special font. Now, this seems to produce overfull boxes. So in some cases the class name is shown in the margins of the page, rather then breaking to the next line.
Is there any way to avoid this? One easy solution would be to have hypenation, but I dont think thats very good practice.
Thanks for helping,
Ben
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
How to avoid overfull box due to lstinline?
Have you tryed something like:
Code: Select all
bla bla bla \lstinline[breaklines=true]!some source code! bla bla bla
Cheers,
Nuno
P.S. Next time, please refer to which package belongs the command you're in trouble. Though its straightforward for some people (not my case), it may help other users (my case) to quickly get synchronized with the problem context.

Re: How to avoid overfull box due to lstinline?
Re: How to avoid overfull box due to lstinline?
Re: How to avoid overfull box due to lstinline?
{\ttfamily Null\-Pointer\-Exception}
How to avoid overfull box due to lstinline?
http://en.wikibooks.org/wiki/LaTeX/Form ... ween_Words
This solves the problem for long variable or class names. They will not be broken up, but put into the next line instead of having them spill over.
The mentioned breaklines option for lstinline does not seem to work with dots. If you have a long concatenation using dot syntax and want the expression to break at the dots, you can instead mark it with the nolinkurl command. Technically, it's code and not a URL, but both are displayed in typewriter by default.
Here's an example:
Code: Select all
\begin{sloppypar}
Blah blah blah \nolinkurl{javax.management.modelmbean.ModelMBeanNotificationBroadcaster.removeAttributeChangeNotificationListener()} yadda yadda yadda.
\end{sloppypar}