How do I indicate an en-dash while in math mode using LaTeX?

How do I indicate an en-dash while in math mode using LaTeX?

The simplest way is to use $S=1\mbox{--}2$. If you already have \usepackage{amsmath} in your documents preamble, however, youre better off using \text: $S=1\text{--}2$ because \text will adjust the size of the font when used in super- and subscripts: $S_{1\text{--}2}=0$.

n

An en dash used in math may easily be confused with a minus sign. You may want to look at other techniques for indicating a range such as ellipses (\ldots for dots on the baseline [used between commas], or \cdots for centered dots [used between centered operators such as plus signs]) or using the bracket notation. Some examples:

n

$S = \{1, 2, \ldots, n\}$ indicates an element in the set containing integers between 1 and $n$.n$S = [0, 1]$ indicates a real number between 0 and 1 (inclusive).n

You can use \textrm which does not depend on \usepackage{amsmath}.nSome examples:

n

$S=1\textrm{--}2$n$S_{1\textrm{--}2}=0$ % correctly changes the font size for subscriptn$S_{1\textrm{2}2}=0$  % does not change the font size :(n

n

Or maybe use \textnormal instead of \textrm.nSee also LaTeX: use \textnormal instead of \textrm (or \textsf) in math.

How do I indicate an en-dash while in math mode using LaTeX?

Well, you could use $1\mbox{--}2$, but Id look at the list of math symbols in the symbol list. Hmm. I dont find one.

Leave a Reply

Your email address will not be published.