Hyphenation for words with underscore
The underscore
package provides a way to do this automatically: It modifies the defintion of the \_
command in order to allow hyphenation after the underscore. Furthermore, it allows you to simply write _
instead of \_
in text mode to produce an underscore. Everything you have to do is loading the package with
\usepackage{underscore}
\newcommand{\gpus}{\_\discretionary{-}{}{}}
If \gpus
is used in other places where hyphenation is not wanted, you can modify its definition only in the argument of \gpmono
:
\newcommand{\gpmono}[1]{\begingroup
\renewcommand{\gpus}{\_\discretionary{-}{}{}}%
\ttfamily#1\endgroup}
Of course, without knowing your original definitions of \gpmono
and \gpus
, I tried to guess.