# Superscripts and bold math

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:

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?

-

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

\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:

\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}$

-
Thanks, that's a clever solution. But yes, I prefer to have bold roman, if possible. – Yori Apr 25 '12 at 19:07
Ah, either I missed the second part of your answer, or you added it later. This looks like an acceptable solution. It'd be nice if this could be done automatically somehow, based on font measurements? I don't know enough about how TeX handles these things to do that though. Thanks! – Yori Apr 25 '12 at 21:26
sorry I edited it in in response to your comment, I thought the system would alert you. perhaps not? teX has little information about the glyph shape so it doesn't really "know" an A is different from a B. the math fonts have a limited amount of italic correction information tuned for script adjustment, but it often needs manual tweaks for absolute best quality and \mathbf uses a font designed for text use mainly so has nothing special for superscript positioning – David Carlisle Apr 25 '12 at 21:35
I see, so what I'm asking is conceptually impossible. Thanks very much for clearing that up! – Yori Apr 25 '12 at 22:35
Okay, one more question: somehow your solution does not seem to work if used inside a figure caption. Latex says "Undefined control sequence". Why is that? MWE: \documentclass{article} \usepackage{amssymb} \begin{document} \newcommand\TT[1]{% \mathbf{#1}% \def\tmp{#1}% \def\tmpA{A}% \ifx\tmp\tmpA\mkern-5mu\fi ^\intercal} \begin{figure} \caption{$\TT{A}$.} \end{figure} \end{document} – Yori Apr 25 '12 at 23:05