Objective
I'm trying to achieve the following output.
Here's the code I used to produce it. I had to hack it
\begin{document}
\begin{description}
\item In \texttt{./build/org.eclipse.cdt.managedbuilder.core/plugin.xml}
\\ there is an extension
{\btHL \texttt{org.eclipse.cdt.managedbuilder.language} }
{ \btHL \texttt{.settings.providers.GCCBuildCommandParser}}
corresponding to the name \texttt {GCCBuildOutputParser.name}.
This is extending at the point
{\btHL \texttt{org.eclipse.cdt.core.LanguageSettingsProvider}}
\end{description}
\end{document}
As you can see, I had to manually insert line breaks to typeset it correctly. I'd like to have LaTeX automatically break the lines also.
The preamble that defines \btHL
was taken from Highlight text in code listing while also keeping syntax highlighting
Why?
As I've shown in the example above, java classes can be really long string with no spaces. And sometimes you need to mention them inline. On top of that I think highlighting them(adding background color) will enhance the readability. As it's java code I want to typeset it in monospace. Syntax highlighting is not a high priority though.
The Challenge
So far I've looked at the following answers for wrapping text
- Wrapping long lines that contain no spaces
- http://mrtextminer.wordpress.com/2009/02/26/break-or-wrap-a-continuous-text-in-latex/
- Long code that needs to wrap
- How to make inline listings wrap nicely?
- http://mirrors.ctan.org/macros/latex/contrib/seqsplit/seqsplit.pdf
- http://mirrors.ctan.org/macros/latex/contrib/listings/listings.pdf
- How to get long \texttt sections to break
- http://en.wikibooks.org/wiki/LaTeX/Hyperlinks
And the following links for Highlighting and background color.
- Different background colors for lstinline
- How to redefine \lstinline to automatically highlight or draw frames around all inline code snippets?
- Background color in inline code listings with linebreak
- Colored background in inline listings
- Highlight text in code listing while also keeping syntax highlighting
- http://pleasemakeanote.blogspot.com/2009/08/how-to-highlight-text-in-latex.html
- Highlight text in code listing while also keeping syntax highlighting
It's very tedious to try every combination of techniques from both the sets but I tried many. It seems like the hard part is that both the applications use some kind of walk through technique, the first to calculate the line break points and the second to calculate the size of the box. If it wasn't inline then setting background color wouldn't require and fancy computation and this would be doable.
Summary
So in summary, how do I achieve the same output as above without having to manually insert line breaks? I don't want to worry about typesetting while typing the reports/journal entries.