What is the best practice for hyphenating long identifiers like Character.isJavaIdentifierStart
when they appear in body text? I am aware of the path
package that also deals with otherwise active characters.
On occasion I have locally defined
\def\+{\discretionary{}{}{}}
which introduces a hyphenation point at \+
but no hyphen in order to avoid the confusion whether the hyphen belongs to the identifier or not.
Best Answer
I am not too sure if there is a
best
practice, but here are two approaches.The first method uses the
url
command to automatically hyphenate at certain points such as for example dots. The second one uses a discretionary (with or without a hyphen). Whatever you choose, I am sure that you will need to give TeX a helping hand, that is you cannot avoid doing some manual editing in the end.In the example I colored the word and used a libertine family font.