what do you see as best way of presenting class names in LaTeX documents (writing about a piece of software).
I'm currently using \texttt
(monospaced typewrite font) which otherwise works fine but my class names end up goind "over" the margins.
So, I'm asking for either
br, Touko
\texttt
is a good choice.
If your class names end up "going over the margins", that's because LaTeX doesn't hyphenate \texttt
text by default. (You're probably getting warnings about "overfull hboxes" because of this.)
There are two possible solutions to this: Either rewrite your text so that class names don't appear at the ends of lines, or tell LaTeX to hyphenate your class names (if that's acceptable to you). For the latter, check out the hyphenat
package. Try using it like this:
\usepackage[htt]{hyphenat}
You will also probably need to tell LaTeX where to hyphenate your class names, like this:
This\-Is\-My\-Long\-Class\-Name
(for class ThisIsMyLongClassName
).
Perhaps better would be to define your own macro:
\newcommand{\classname}[1]{\texttt{#1}}
which you then use like this:
\classname{MyClass}
Doing this means that your class names are tagged as such, not as typewriter-style text.
You could use the url package, which despite its name can be used to typeset any kind of text in a typewriter font, allowing for linebreaks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With