I can hyphenate inline verbatim text at a ':'; however, I want to hyphenate inline verbatim text at an underscore '_', but I can not find a solution. The MWE is as follows.
\documentclass{article}
\usepackage{geometry}
\usepackage{listings}
\usepackage[htt]{hyphenat}
\lstset{
basicstyle=\ttfamily\linespread{1.0}\normalsize,
breaklines=true
}
\geometry{hmargin={6cm,6cm}}
\begin{document}
\lstinline¦hello_world_hello_world_hello_world_hello_world_hello_world_hello_world_hello_world_hello_world¦.
\lstinline¦hello:world:hello:world:hello:world:hello:world:hello:world:hello:world:hello:world:hello:world¦.
\end{document}
Is there any solution to hyphenate inline verbatim text at '_' without introducing '-', since \texttt macro can hyphenate the above example, but the result is not what I want.
\texttt{hello\_world\_hello\_world\_hello\_world\_hello\_world\_hello\_world\_hello\_world\_hello\_world\_hello\_world}.

listingsand change the class of_tootherrather thanletter– Andrew Swann Nov 10 '21 at 17:03\textttcode. I have a feeling that your problem might lie with thelistingspackage, nothyphenat. – Peter Wilson Nov 10 '21 at 18:19