6

I have a variable name that I need to include mid-paragraph. The variable is called "oral_read_score". LaTeX seems to think that I meant the "r" and "s" to be subscripts, and gives an error unless I change to $oral_read_score$, which is not what I want. Is there some option I can use to turn this error off?

12

Two possibilities:

\documentclass{article}

\begin{document}

oral\_read\_score

\verb!oral_read_score!

\end{document}

enter image description here

LaTeX reserves the special character _ for math mode subscripts; you can escape this character using \_ for its use in text mode; the second option uses \verb to write the expression verbatim.

2
  • Many solutions in TeX/SX come without explanation. Explaining why yours is the right solution may help save millions of future LaTeX users precious time. – user10274 Nov 20 '12 at 19:46
  • @MarcvanDongen I added some remarks. – Gonzalo Medina Nov 20 '12 at 19:51
5

An alternative approach

\documentclass{article}
\usepackage{underscore}
\begin{document}
oral_read_score
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.