I'm curious how to automatically get a bit of spacing around symbols that are written together.

Let us assume we have symbols A and B that represent some abstract objects. We define commands \A and \B that insert the symbols.


Now I would like to have a bit of space between these symbols when written together with other symbols. Unfortunately, with the above definitions, it is necessary to add these spaces explicitly.

Desired output

How can I get the extra spacing automatically? It is especially important that not just a static amount of space is added, to prevent extra spaces between equal signs and the symbols, and between repeated symbols.

The MWE that produced above output:





Symbols with no spacing \eqref{nospaces},
explicit \texttt{\textbackslash,} spaces \eqref{spaces}.
y &= \A x &
y &= x' \A x &
\B &= \A \A &
\B &= \A' \A
y &= \A \, x &
y &= x' \, \A \, x &
\B &= \A \, \A &
\B &= \A' \, \A

  • Why should \mathbf{A}\,\mathbf{B} be preferred to the normal \mathbf{A}\mathbf{B} in the first place?
    – egreg
    Commented Sep 28, 2014 at 21:05
  • As a matter of personal taste, I prefer to write multiplication with a small space. Usually I'm not dealing with simple two symbol expressions, and things get very messy when not separated well.
    – user53911
    Commented Sep 28, 2014 at 21:07
  • Never seen. By the way, if vectors are bold italic, matrices should be too.
    – egreg
    Commented Sep 28, 2014 at 21:10
  • I do not agree. They are operators, which means roman for me. Both are bold because they are n-dimensional. But I'm probably just used to this, it's pretty common among the papers I read.
    – user53911
    Commented Sep 28, 2014 at 21:14
  • No, a matrix is not an operator. It induces an operator, but the two aspects should be kept distinct: mixing them is a sure cause for misunderstandings. Only when you have fixed bases the matrix represents a map and changing the bases will change the representing matrix. An operator is independent of bases.
    – egreg
    Commented Sep 28, 2014 at 21:25

3 Answers 3


Definitely not an answer but compare the following two results.

     y &= Ax &\chi^2 &= x^TAx &C&= AB &D &= A^T B\\
     y &= A\,x &\chi^2 &= x^T \, A \, x &C &= A   \, B &D &= A^T \, B\\
     y &= A   x &\chi^2 &= x^T A x &C &= AB &D &= A^T B

enter image description here enter image description here

I've repeated thrice to look similar. I don't think anything needs to be bold to be able convey the message. Capital letters matrices, lowercase letters vectors. The transpose is not standard some use prime for that but lowercase t always looks like a misprinted prime, especially when matrices are bold, since it doesn't have enough weight.

  • 1
    I agree that neither vectors nor matrices need to be bold. When writing for a theoretical physics audience, I would not bother to make anything bold. But in my part of astronomy, the dominant style is bold italic vectors, bold matrices, often in sans serif. Probably because this is the style of MNRAS.
    – user53911
    Commented Sep 28, 2014 at 21:21
  • 1
    @Nicolas They won't stop reading if you change your style to a normalized, simplified version. Tradition is strong, but not as much as you think.
    – percusse
    Commented Sep 28, 2014 at 21:23
  • I have changed the question to focus more on the spacing.
    – user53911
    Commented Sep 29, 2014 at 13:36

In case there is someone else out there looking for a solution, I will share what I have come up with after some trial and error.

In this answer, the combination \mathrm{}\! is used to add a bit of spacing before a differential d. So I defined the following two commands to add space to the left and right of symbols:


Then I add the spaces manually to my symbols:


This seems to produce the desired effect:

Seems to work


I like Mathematica's way to denote products with spaces (horresco referens!). To do this in TeX, I have redefined * (see below) so that it inserts a thin space in math mode. This is not automatic, but it seems to work well with ordinary atoms, parentheses and operators. If needed, it can easily be switched off.

For other uses of * in math mode, \ast may be used instead. The behaviour of * outside of math mode is unchanged.


$a b$
$a*\cos b$
$a \cos b$
$a\,\cos b$

(Note that using \, instead of * inserts an unwanted space in the last expression.)

  • Ah, Mathematica! That must be where I picked up the habit. Oh and a very nice solution, I will be using this.
    – user53911
    Commented Oct 1, 2014 at 19:30

You must log in to answer this question.