## Break or wrap a long word containing underscores in Latex

My situation is that I have many long words that containing underscores such as “how\_are\_you\_doing_?”, and they don’t break at the end of a line. Therefore, a line that contains these words sometimes is stretched over the page margin.

To fix this problem, we need to redefine the underscore command. Here is how I do it. I put the following Latex code after the \usepackage{} at the beginning of a Latex document.

%Redefine the underscore command
\let\underscore\_

%Issue the changed underscore command to the whole document.
\myunderscore

Credit to the original post at http://newsgroups.derkeiler.com/Archive/Comp/comp.text.tex/2007-03/msg00647.html