#173 How to typeset an underscore character in LaTeX

The underscore character _ is ordinarily used in TeX to indicate a subscript in maths mode; if you type _, on its own, in the course of ordinary text, TeX will complain. The “proper” LaTeX command for underscore is \textunderscore, but the LaTeX 2.09 command \_ is an established alias.

This procedure will provide a command \textunderscore which robustly selects the right character.

% (1) choose a font that is available as T1
% for example:
\usepackage{lmodern}

% (2) specify encoding
\usepackage[T1]{fontenc}

% (3) load symbol definitions
\usepackage{textcomp}

Discover more from Tips and Hints for Aerospace Engineers

Subscribe now to keep reading and get access to the full archive.

Continue reading