[Tex/LaTex] Automatic spacing of symbols

spacingsymbols

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.

\newcommand\A{\mathrm{A}}
\newcommand\B{\mathrm{B}}

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:

\documentclass[preview,border=10pt,fleqn]{standalone}

\usepackage{amsmath}
\setlength\mathindent{0pt}

\newcommand\A{\mathrm{A}}
\newcommand\B{\mathrm{B}}

\begin{document}

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

\end{document}

Best Answer

Definitely not an answer but compare the following two results.

\documentclass[preview,border=10pt,fleqn]{standalone}
\usepackage{mathtools}
\begin{document}
\begin{align*}
     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
\end{align*}
\end{document}

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.

Related Question