at the risk that this has been solved somewhere, but I just can't find a solution: I want to highlight java class names in my text, for what I've created a macro \newcommand{\class}[1]{\textcolor{Green4}{\texttt{#1}}}
. But when I use e.g. \class{ALongClassName}
, and the text is longer than the rest of the line, the text protrudes out of the regular paragraph. I'd prefer an automatical linebreak before the word when it's too long to fit in the line it's currently in.
I've tried \-\class{ALongClassName}
, but in case of breaking it displays a -
character at the end of the line. Are there any ways of preventing this or possible better methods to accomplish what I need?
Any ideas are greatly appreciated, thanks in advance.