In many place in my current text I have to insert something like Name_of_model for instance. I found the last suggestion in this answer very helpful. However, I am facing a problem when it come to hyphenation of the argument of the macro \escapeus. How can I improve \escapeus so it will enable hyphenation of the argument. In particular, if hyphenation is needed, it should put it right after an underscore, for example: Name_of_-model.
Inspired by this one, I tried to modify the definition given by @egreg above as follows:
\DeclareRobustCommand*{\escapeus}[1]{%
\begingroup\@activeus\scantokens{#1\endinput}\endgroup}
\begingroup\lccode`\~=`\_\relax
\lowercase{\endgroup\def\@activeus{\catcode`\_=\active \let~\_\discretionary{-}{}{}}}
All my attempts (which included moving the _ around) failed.
How can I improve the code above, so it will enable hyphenation of the argument of \escapeus?
