5

I recently wrote up an answer on MSE that involved the mapping f\colon\mathbb{R^+}\to\mathbb{R^+}; the output looked a little different to me, and thus I thought it could have something to do with MathJax, but the same thing happens when I produce the mapping with regular LaTeX:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\begin{enumerate}
    \item$f\colon\mathbb{R^+}\to\mathbb{R^+}$
    \item$f\colon\mathbb{R^+}\to\;\mathbb{R^+}$
    \item$f\colon\mathbb{R^+}\!\!\to\mathbb{R^+}$
\end{enumerate}
\end{document}

produces

enter image description here

In my opinion, (1) looks a little weird in terms of spacing (the arrow seems to be too far right of the first R^+), but what about (2) and (3)? To my eye, (2) looks best, but perhaps there is a little too much space, and (3) looks too condensed.

Maybe it is just my very untrained eye for typography coming into play--does (1) look a little "weird" or "off" to any of you or am I off-base? Also, is there anything particularly good or bad about (2) or (3)?

  • 1
    TeX adds \scriptspace after a sub/superscript, the default is 0.5pt (a bit less than 0.2mm). There is also the optical “hole” created by the shape of +, which is probably responsible for the seeming big space. If you really feel it's too wide, you can try with \!\to. But the third example has too big backspacing. The second one is just wrong, in my opinion. – egreg Jul 3 '15 at 21:17
  • @egreg After trying it with just one \!, it does look a little bit better than (3) I suppose. I was just very surprised by the big space--maybe it's really not worth worrying about, seeing as I imagine many people use it all the time without any issues. – Daniel W. Farlow Jul 3 '15 at 21:20
  • 1
    As I said, the shapes of symbols can create optical illusions or real clashes; for instance, one should type \sqrt{\,\log 3} because of the tall letter (clash) or x^2\!/2 to compensate for the hole created by the relative shapes (optical). Such details make a difference when good typography is concerned. – egreg Jul 3 '15 at 21:25
  • You might try this: f\colon\mathbb R^+\mkern-1.5mu\to\mathbb{R^+} – Bernard Jul 3 '15 at 21:25
  • @Bernard Thanks. I tried fooling around with that, and I think most of what it comes down to is simply me needing a better eye (something that comes with experience I know). For example, I thought using -2.5mu looked pretty good, but I can't tell too much of a difference from that and simply \!. – Daniel W. Farlow Jul 3 '15 at 21:30
6

Here's a comparison where I used alignat for having the arrows vertical aligned (in the first two rows); the third row applies a negative kern.

enter image description here

In the right column I show that the spacing is actually exactly the same in both cases, using a hairline.

The difference is an optical illusion created by the shape of the symbols: the + has a “hole” that seems to leave a bigger space than what's actually used.

In such cases, a \! is usually the simplest and most effective method.

Here's the code for producing the example.

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{alignat*}{2}
R^+&\to &\qquad R^{+\smash{\vrule width 0.1pt height 1ex depth 5ex}}&\to \\
R^2&\to &\qquad R^2&\to \\
R^+&\!\to
\end{alignat*}

\end{document}

If we add also a symbol after the arrow, we see that the \! does its service well:

enter image description here

This was obtained with R^+\!\to R^+. The situation is similar to input such as x^2/2, where a \! gives a better result: compare

\[
x^2/2 \qquad x^2\!/2
\]

enter image description here

Curing such details greatly improves the typographic quality of a document.

  • That's awesome. What you were saying before made a fair amount of sense, but I really appreciate you going more in depth and providing nice illustrations. Thanks! – Daniel W. Farlow Jul 3 '15 at 21:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.