Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 11 down vote accepted

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.

share|improve this answer
    
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. –  Marc van Dongen Nov 20 '12 at 19:46
    
@MarcvanDongen I added some remarks. –  Gonzalo Medina Nov 20 '12 at 19:51
    
Thanks. I think this improves the answer. –  Marc van Dongen Nov 20 '12 at 19:52
add comment

An alternative approach

\documentclass{article}
\usepackage{underscore}
\begin{document}
oral_read_score
\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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