\text{\textunderscore}

The command \text{\textunderscore} is used to produce an underscore character within text mode in LaTeX. This is particularly useful when you need to include underscores in text, such as in email addresses, file names, or identifiers, where the underscore is not meant to indicate a subscript.

Examples

Displaying a file name with an underscore in text mode.

\text{my\textunderscore file.txt}

Showing a username with an underscore in text mode.

\text{user\textunderscore name}

Including an underscore in an email address in text mode.

\text{email\textunderscore address@example.com}