# Hyphenate word with detokenized underscores

I want to write clean underscores without backslashes and hyphenate words by underscores.

I tried to use underscore package, but it doesn't work with clean underscores and also breaks includegraphics, when there are underscores in picture name.

MWE:

\documentclass{article}
\usepackage{array}

\begin{document}

\begin{center}
\begin{tabular}{ | m{3cm}| }
\hline
SOME\_LONG\_COMMAND  \\\hline
SOME\_LONG \_COMMAND  \\\hline                  % looks as I want, but stiil have backslashes before underscore
\detokenize{SOME_LONG_COMMAND}  \\\hline

\end{tabular}
\end{center}

\end{document}


I'm not sure I fully understand your requirements, but I think you need to set up a pair of switches to change the catcode of the underscore (just as \makeatletter and makeatother do for @).

\documentclass{article}
\usepackage[T1]{fontenc}
\newcommand\textunderscoreon{\catcode_=11}
\newcommand\textunderscoreoff{\catcode_=8}
\begin{document}
\textunderscoreon
I_CAN_DO_WHAT_I_LIKE_WITH_UNDERSCORES
\textunderscoreoff

NOW\_THEIR\_BEHAVIOUR\_IS\_BACK\_TO\_NORMAL $a_1$
\end{document}


Note that you need to load fontenc or else you will get strange effects, related to the fact that the original TeX fonts have no underscore glyph (they used a short rule in its place).