# When to use $something$ syntax?

I know the difference between \emph{something} and \textit{something} (\emph or \textit). But when to use syntax like: $something$.

• Never. What goes between dollars is math, not text. – Manuel Nov 28 '14 at 11:23

I think it's worth stating simply: anything between dollar signs is math, but it appears in line with the surrounding text (not on a separate line). So you should use $...$ when you are writing inline math, and you should not use it when you are not writing inline math.

As already commented by Manuel, $...$ puts the stuff between them into math mode. Here, totally different rules apply, e.g.

• unless it is part of a command (introduced by a backslash) every alphabetical character is considered to be the name of a mathematical variable, i.e. a chain of characters is just a bunch of variables;
• as the characters are treated separately, there's no kerning between them (cf. the "Te" in my example below;
• spaces are ignored;
• there is no hyphenation.

The fact, that the text is printed in italics is just due to typesetting convention. Hence it is by no means comparable to \emph{...} or \textit{...} but has a totally different use case.

\documentclass{article}
\begin{document}
The difference between \verb|\emph{...}| and \verb|$...$|? Just compare it yourself:

\verb|\emph{some Text}|: \emph{some Text}

\verb|$some Text$|: $some Text$
\end{document}


• The fact that \emph produces italics is also just due to typesetting conventions. Hence it is by no means comparable to textit. Although it does not have a totally different use case in the sense that it is not necessarily inappropriate to substitute one for the other. But it has a different use case when considered as semantic markup. (\emph can to configured to produce something other than italics e.g. bold or oblique or whatever.) – cfr Nov 28 '14 at 17:34
• You may also want to mention that there's no ligaturing going on in math mode. Thus, \textit{office} looks very different from $office$, and \textit{fluffy} and $fluffy$ also produce rather different results. – Mico Nov 28 '14 at 17:37
• @cfr - As you no doubt know, one of the very nice features of \emph is that it can be nested in useful ways; the material in an inner \emph environment is usually (but not necessarily) typeset using upright latin letters if the outer \emph environment renders its material in italics. In contrast, nesting \textit instructions produces no benefit. And, trying to nest \$ symbols is likely to create an error... – Mico Nov 28 '14 at 17:41
• @Mico Yes, I wasn't thinking about that, but that is, of course, a better example. – cfr Nov 28 '14 at 17:47
• @cfr I'm of course aware of the fact that \emph is not equal to \textit but as the OP already linked a question where the difference is explained and says himself that he understands the difference. Hence I didn't for that part of the story. – Benedikt Bauer Nov 30 '14 at 15:30