# How to typeset variables and other code?

The variance of the signal `sig3` is 43.2.

How should I typeset the above in LaTeX?

-
Are the four characters in `sig3` all supposed to be on one line, or is `3` to be typeset as a subscript to `sig`? And, is `sig` a (mathematical, physical, engineering) variable? –  Mico Nov 29 '11 at 15:16
@Micro: They are supposed to be on one line. `sig3` a MATLAB variable. –  Anders Nov 29 '11 at 15:19
In that case the answer provided by @LeoLiu should fully meet your needs. :-) –  Mico Nov 29 '11 at 16:12

`\verb|sig3|` or `\texttt{sig3}` if no special characters included.
Since this is LaTeX which emphasizes semantic markup, providing a command such as `\newcommand{\code}[1]{\texttt{#1}}` would be a good idea so that you can easily change the appearance of all code bits in the future. –  mforbes Feb 14 '12 at 19:13