2

When typesetting the LaTeX in Math mode is it safe to create a space (one carriage return) around a LaTeX symbol to isolate it from the surrounding character instead of enclosing the surrounding character with {..}. For example if I copy the following here it displays the same:

\hat T \\
\hat{T} \\
\sin x \\
\sin{x} \\
\int f(x)dx \\
\int{f(x)}dx

For readability the use of {..} seems a better choice but are there any examples where using the space option will cause an issue? I'm using amsmath package.

  • Related: When one should use spacing like \quad or \, – Werner Jul 23 '15 at 17:00
  • Related/possible duplicate: Do spaces in $xy=1$ have differences between $x y = 1$? – Werner Jul 23 '15 at 17:14
  • 2
    using {....} here is wrong and will in general adversely affect the spacing – David Carlisle Jul 23 '15 at 17:51
  • I'm interested more in cases where a symbol is defined with alpha characters, e.g. \hat (and not the symbols like ^ or _) and the character that follows is non-numeric. So, for instance, isolating symbol from the character that follows is not an issue for a^2 or \hat2 or \sin2. Hence, in my cases the preferred method would be to use a space and not {..} for isolation, correct? – nam Jul 23 '15 at 18:35
3

Spaces (including a single carriage return) are gobbled under math mode. From the TeX Book, Chapter 18: Fine Points of Mathematics Typing (p 166):

[consider]

$$ F_n = F_{n-1} + F_{n-2}, \qquad n \ge 2. $$

It is perhaps worth reiterating that TeX ignores all the spaces in math mode (except, of course, the space after \qquad, which is needed to distinguish between \qquad n and \qquadn); so the same result would be obtained if you were to leave out all but one space:

$$F_n=F_{n-1}+F_{n-2},\qquad n\ge2.$$

Whenever you want spacing that differs from the normal conventions, you must specify it explicitly [...].

In fact, it's the preferred method for improving readability, as the use of {..} may influence the spacing necessarily - changing math elements into a ordinal atom \mathord.

So, instead of grouping elements to "improve readability", use spaces. Here is an example of using {..} which causes a problem:

  • After reading yours and David's response, I'm inclined to use spacing over {...}. – nam Jul 25 '15 at 1:59

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.