Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

For instance, is it correct to use $\sin\lvert x\rvert$, not $\sin|x|$, for the sine of the absolute value of $x$? I think that since the argument of $\sin$ is $|x|$, it makes more sense to have a thin space between the two, by analogy with the automatic thin space between $\sin$ and $x$ in $\sin x$. Similarly, I think that it makes more logical sense to use $\sin\,(x+y)^2$, not $\sin(x+y)^2$, when the argument of $\sin$ is $(x+y)^2$. But I could be going against established standards here.

What about $\sum_{i=1}^\infty(a_i+b_i)c_i$ versus $\sum_{i=1}^\infty\,(a_i+b_i)c_i$, where the summand is $(a_i+b_i)c_i$?

And what about $\int(x-1)^2\,dx$ versus $\int\,(x-1)^2\,dx$ for the indefinite integral of $(x-1)^2$?

share|improve this question

3 Answers 3

up vote 6 down vote accepted

As egreg said, you must use \lvert...\rvert for absolute values or else internal spacing will be incorrect. If you want automatic sizing and correct spacing of absolute values, use

\newcommand{\abs}[1]{\mathopen{}\mathclose\bgroup\left|#1\right|\egroup}

or (better), with the mathtools package

\DeclarePairedDelimiter{\abs}{|}{|}

You can thus choose the size of the absolute value (\abs{...} is normal size, \abs*{...} is like \left...\right and \abs[\bigg] is like \biggl...\biggr)

Now, to your questions. There are various ways of handling the spacing of operators and delimiters, but a good and coherent rule to use is that a delimiter used as parenthesis (e.g. sin(x + y)) should not be preceded by a space (because the parenthesis already plays the same role as the space i.e. showing where the sine stops) whereas a delimiter used as an argument should be preceded by a thin space (e.g. ln |x| because it's the same shortcut for ln(|x|) as ln x is to ln(x)). More specifically, with this set of rules,

  1. Yes, there should be a thin space between \sin and \abs{x} because sin |x| is the sine applied to |x|. With the above command, you just have to type \sin{\abs{x}} to do it automatically without side effects.

  2. Concerning \sin(x+y)^2, you should not be writing this as it is ambiguous, especially if your document is for students (is it \sin((x+y)^2) or (\sin(x+y))^2?) If you don't like to use two parenthesis in a row, you could use \sin[(x+y)^2].

  3. For \sum or \int, the same applies and using {...} for the "argument" prevents the introduction of manual \, (alternatively, as big operators are special, you could always use \sum{...} instead of \sum... to have the additional space). Thus you would type $\sum_{i=1}^{\infty}{(a_i+b_i)c_i}$ but $\sum_{i=1}^{\infty}(a_i+b_i)$ and $\int{(x-1)^2\,dx}$ but $\int(f+g)$.

A few related links you might be interested in:

share|improve this answer

In general there should not be a thin space between "sin" and a delimiter such as a parenthesis. The thin space should not go after \int or \sum if they are followed by a delimiter.

However this hard and fast rule may reveal to be inadequate in particular cases, depending on the relative shapes of the characters. One of these is the absolute value.

The standard setting makes | into an ordinary symbol, which can give wrong results in cases such as $|-1|$ and amsmath comes to the rescue by providing \lvert and \rvert so that $\lvert-1\rvert$ produces the intended result.

In the particular case of "operator followed by absolute value" this may be questionable and one may well prefer the result obtained by

\sin\,\lvert x\rvert

rather than the one produced by

\sin\lvert x\rvert

The TeXbook lists some of the cases in which a thin space or a negative thin space should be added manually because of visual clashes. Some common examples are

  • $n!\,(n+1)$
  • $2!\,3!$
  • $\sqrt{2}\,x$
  • $\sqrt{\,\log x}$
  • $\log n\,(\log\log n)^2$
  • $x^2\!/2$

For "the sine of the absolute value of x" choose your way and be consistent. Unfortunately no automated solution exists if you want to insert the thin space: either use $\sin|x|$ or \sin\,\lvert x\rvert.

Personally, I use $\sin\lvert x\rvert$.

share|improve this answer
    
In many of my documents, I have the command \newcommand{\abs}[1]{\left\lvert#1\right\rvert} to deal automatically with expressions that starts with a unary minus symbol. :-) And, I use $\sin\abs{x}$. –  Mico Nov 21 '11 at 0:42
    
@Mico While this adds the maybe desirable space after an operator, it adds it also in situations where it might not be desirable, for example in \abs{x}/y. –  egreg Nov 21 '11 at 0:50

You ask several questions, but with a common theme. My personal view -- others will no doubt have other views -- is that

  1. the spacing between an operator and subsequent variables/entities/expressions is an active design choice and
  2. the choices embedded in the TeX and LaTeX commands you mention (and the Computer Modern fonts) are excellent under most circumstances. (There are exceptions, mainly related to certain glyph combinations being either too close or too far apart under TeX's default settings, but I take it that these exceptions aren't the subject of your question.)

Hence, I would not add a thinspace between the various combinations of text or symbolic operators and the subsequent material.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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