[Tex/LaTex] Superscripts and bold math

spacingsuperscripts

I'm writing the transpose of a matrix that is denoted by a bold capital letter. This looks fine when the matrix is denoted by B, but when the matrix is denoted by A, the transpose superscript is too far away from the letter A. Here is a MWE to show what I mean:

\documentclass{article}
\usepackage{amssymb}

\begin{document}
\newcommand\T{{\hspace{-2pt}\intercal}}
\[
\mathbf{A}^\intercal,
\mathbf{B}^\intercal,
\mathbf{A}^\T,
\mathbf{B}^\T
\]
\end{document}

The output is:

enter image description here

One way to deal with this is to use \hspace to move the transpose superscript a little bit to the left, but this does not look good for B (as shown in the MWE). I could define two different transpose commands, one of which I would use for the transpose of A, and one for the transpose of B. But is there no more elegant and more efficient way of dealing with this?

Best Answer

Do you need bold roman? bm would give bold math italic without any extra grouping and give tighter spacing:

enter image description here

\documentclass{article}
\usepackage{amssymb,bm}

\begin{document}
\newcommand\T{{\hspace{-2pt}\intercal}}
\[
A^\intercal,
B^\intercal,
A^\T,
B^\T
\]
\[
\mathbf{A}^\intercal,
\mathbf{B}^\intercal,
\mathbf{A}^\T,
\mathbf{B}^\T
\]
\[
\bm{A}^\intercal,
\bm{B}^\intercal,
\bm{A}^\T,
\bm{B}^\T
\]
\end{document}

So if you do want bold roman, then I think you need to change the input syntax slightly and add kerns for each letter on a case by case basis:

enter image description here

\newcommand\TT[1]{%
  \mathbf{#1}%
  \def\tmp{#1}%
  \def\tmpA{A}%
  \ifx\tmp\tmpA\mkern-5mu\fi
  ^\intercal}

used as in:

\[
\TT{A},
\TT{B}
\]