Taking the transpose of a matrix with superscripts and subscripts

What is the best way to take a transpose of a matrix with superscripts and subscripts, when the subscript is long?

Neither

$A_{ijk}^{a\top}$

$A_{ijk}^{a^{\top}}$

${A_{ijk}^{a}}^{\top}$

${A^{a}}^{\top}_{ijk}$


seems to have the same spacing and size as $B_{ijk}^{\top}$

• Can you be a little more specific? Your first try looks ok to me, though the result might be different with different fonts. – Ian Thompson Sep 28 '18 at 15:47
• I would like the transpose symbol to be on the upper right, but ignoring the length of the subscript. The first one would put the transpose next to a. It is more evident when you use \ast instead of \top. – user15988 Sep 28 '18 at 15:51
• I would like the position to be the same as A_{ijk}^{a^{\ast}}, but with the same size as A_{ijk}^{\ast}. – user15988 Sep 28 '18 at 15:58
• Perhaps just A_{ijk}^{a^{\scriptstyle\ast}}? – Ian Thompson Sep 28 '18 at 16:02
• I'll go with @IanThompson 's answer – user15988 Sep 28 '18 at 16:58

I'm assuming you wish to denote the transpose of a matrix with \top. Then, if the matrix is written as A_{ijk}^{a}, you may want to write its transpose as {A_{ijk}^{a}}^{\!\!\top}. The \!\! directive (two negative-thinspaces) serves to "snug up" the superscript-\top to the associated matrix.

If you have many matrix transpose expressions, it's useful to create a macro (called \tp in the example below) to speed up the typing process. The default amount of "snugging up" is set to \mkern-6mu, which is equivalent to \!\!, i.e., to two negative thinspaces. The \tp macro is set up to take an optional argument, to let you vary the amount of "snugging up" on a case-by-case basis.

\documentclass{article}
\newcommand\Amat{A_{ijk}^{a}}
\newcommand\tp[2][-6]{{#2}^{\mkern#1mu\top}} % 'transpose' macro
\begin{document}
$\Amat \quad {\Amat}^{\!\!\top} % '\!\!' is equivalent to '\mkern-6mu' \quad \tp{\Amat} % use '\tp' macro \quad \tp{\Amat} \! \Amat % inner product of \Amat with itself \quad \tp[-9]{\Amat} % tighter spacing: -9mu instead of -6mu$
\end{document}


This question seems as much mathematical as it is typographic, by which I mean that the typographic rendering should follow (somewhat) logically from the mathematical meaning. So you need to think about what exactly you are transposing, and then ask how best to place the ^\top to indicate that meaning. In the case of matrices—so just two indices—I prefer

$(A^\top)_{ij} = A_{ji}$


rather than

$(A_{ij})^\top = A_{ji}$


The first says states the mathematical truth that the ij-th entry of A-transpose is the ji-th entry of A. The second is problematic because A_{ij} is just a number, and the transpose of a number is itself.

Because you have more than two indices—{ijk} below, and {a} above—it's not clear on which part of all that you wish ^\top to act. You may need to insert some parentheses to clarify. For example,

$({A_{ij}}^\top)_k^{a} = ({A_{ij}}^\top)_a^{k}$

• +1. One of the main aspects of the OP's query would appear to be that the matrices in question have long subscripts, e.g., ijk. Can you adapt your answer to incorporate this aspect? – Mico Sep 28 '18 at 16:30
• This is not the answer I am looking for. The subscript does not indicate the indices of the matrix. I have a collection of matrices A which is identified by i,j,k. – user15988 Sep 28 '18 at 16:51
• @user15988: Is the superscript a another index? – iron photon Sep 28 '18 at 16:53
• Yes a,i,j,k to be precise – user15988 Sep 28 '18 at 16:54
• @user15988: In that case, @Mico's suggestion looks good to me. You might, for the sake of clarity, consider inserting parentheses. In terms of Mico's \tp macro, you might try \tp[-4]{(\Amat)}. I made use of his optional argument to change the kerning from his default -6 to the slightly looser -4, which I happen to think looks better with the closing parenthesis. – iron photon Sep 28 '18 at 18:15