TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following equation:

<trigger threshold> = average - (<trigger fraction> * average)

I want to print this in math mode in a very specific way: <trigger threshold> and <trigger fraction> need to be in a fixed-width font. They should appear exactly as they do in this paragraph. I can't figure out how to get LaTeX to ignore < and > and still print in a fixed-width font. Things I've tried:

\[ \mathtt{<trigger threshold>} = \mathrm{average} - (\mathtt{<trigger fraction>} * \mathrm{average}) \]

The above doesn't work for 2 reasons: the < and > symbols are interpreted as less than and greater than, and also, there is no space between the words "trigger" and "threshold". Another attempt:

\[ \mathtt{\mathrm{<trigger threshold>}} = \mathrm{average} - (\mathtt{\mathrm{<trigger fraction>}} * \mathrm{average}) \]

Here, trigger threshold doesn't appear with a space and also doesn't appear in a fixed-width font. I've played around with a lot of things, but I just can't get this. I'm guessing I may have to resort to a package to do this, but I'm not sure where to look. Does anyone know how to accomplish this?

share|improve this question
up vote 7 down vote accepted

You could just use a text-version of "tt", called \texttt:

enter image description here

  \texttt{<trigger threshold>} = \mathrm{average} - (\texttt{<trigger fraction>} \times \mathrm{average})

In the above example I've included both, just to show you that you can mix and match what you want. However, if you're interested in such things on a more global scale, it's best to define something like

\newcommand{\variable}{\texttt}% or \newcommand{\variable}[1]{\texttt{#1}}

and then use

\variable{<trigger threshold>} = \mathrm{average} - (\variable{<trigger fraction>} \times \mathrm{average})

See Consistent typography. If you're not using a macro-form, a plain short-hand \verb also suffices.

share|improve this answer
Nice, that worked! I didn't even think that \texttt would work in math mode, so I didn't try it. Thanks. – Geoff Oct 31 '12 at 20:26

Your Answer


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.