In in-line math mode, I tend to use the literal slash (i.e. /
) to denote division. Unlike the common binary operators [+ - \times \div
], /
is treated as an ordinary math object, though. This may easily result in inconsistent (asymmetric) horizontal spacing, for instance when /
is preceded by a variable and succeeded by a function, as in the following example:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\noindent
\(\tan x = \sin x / \cos x\)
\end{document}
Output:
Of course, I can correct the horizontal spacing by turning \cos x
into an ordinary math object:
\(\tan x = \sin x / {\cos x}\)
Output:
Alternatively, I can make /
function as a binary operator similar to [+ - \times \div
]:
\(\tan x = \sin x \mathbin{/} \cos x\)
Output:
Now, I am curious: Which of the above two workarounds should be preferred? Or is there even a better one?
/
behave as a binary operator, following printer's traditions ("printer" as in "someone who operates a printing press".) (I guess that's well known to you, @barbarabeeton.)/
would be clever enough to behave in the correct way automatically if followed by a mathop.$n/\!\log n$
is recommended. Doing this is equivalent to$n/{\log n}$, but I'd prefer using
\!`.\log
and there the wider space on the right was camouflaged by the height of thel
. maybe this is a topic for a disquisition on "niceties"; i'll pursue that.