# Blockarray superscript

I am using blkarray to generate a labelled matrix. I would like to indicate the transpose of such matrix using a superscript with T. However I cannot find the right syntax to get what I want. Below you can find my attempts.

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

\begin{document}

$$\begin{blockarray}{ccccccc} 1 & & 12 & 13 & 14 & 15 & 16\\ \begin{block}{(ccccccc)} 0 & \cdots & 0 & 1 & 1 & 1 & 1\\ \end{block} \end{blockarray}^T$$

\end{document}


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

\begin{document}

$$\begin{blockarray}{ccccccc} 1 & & 12 & 13 & 14 & 15 & 16\\ \begin{block}{(ccccccc)} 0 & \cdots & 0 & 1 & 1 & 1 & 1\\ \end{block}^T \end{blockarray}$$

\end{document}


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

\begin{document}

$$\begin{blockarray}{cccccccc} 1 & & 12 & 13 & 14 & 15 & 16 &\\ \begin{block}{(ccccccc)c} 0 & \cdots & 0 & 1 & 1 & 1 & 1 & ^T\\ \end{block} \end{blockarray}$$

\end{document}


How can I get the superscript nicely, as if the matrix was not generated with blkarray?

• Yes, it should be a superscript to the closing bracket, same position that you get when applying a superscript to a pmatrix environment for example. – Francesco Jan 23 at 16:07

Something like this?

\documentclass{article}
\usepackage{blkarray}

\begin{document}

$$\begin{blockarray}{cccccccc} 1 & & 12 & 13 & 14 & 15 & 16 &\\ \begin{block}{(ccccccc)@{\hphantom{)}}l} 0 & \cdots & 0 & 1 & 1 & 1 & 1 & {\vphantom{)}}^T\\ \end{block} \end{blockarray}$$
\end{document}


• Nice! May I ask you what \hphantom and \vphantom do in the syntax? – Francesco Jan 23 at 16:14
• @Francesco \hphantom{)} inserts an empty horizontal space/symbol that is as wide as ), and \vphantom{)} inserts and empty symbol that is as high as ). You can put any symbol in the arguments of these phantoms. (There is alos \phantom which inserts an "empty" symbol.) – marmot Jan 23 at 16:17
• Thanks @marmot. So basically \begin{block}{(ccccccc)@{\hphantom{)}}l} indicates the beginning of a block with 7 centered elements enclosed by brackets followed by left-aligned element having the same horizontal width of )? – Francesco Jan 23 at 16:36
• @Francesco Almost. @{\hphantom{)}}l says this is a left-aligned column with horizontal space as wide as ) in the beginning. You could also say \begin{block}{(ccccccc)@{}l} 0 & \cdots & 0 & 1 & 1 & 1 & 1 & {\phantom{)}}^T\\ \end{block} to achieve the same. – marmot Jan 23 at 16:40

Set the indices using a smaller font:

\documentclass{article}

\usepackage{array}

\begin{document}

$\begin{tabular}{c} \mbox{\scriptsize\begin{tabular}{ *{7}{>{\centering}p{10pt}} } 1 & & 12 & 13 & 14 & 15 & 16 \end{tabular}} \\ \begin{tabular}{ *{7}{>{\centering}p{10pt}} } \makebox[0pt][r]{\bigl(}% 0 & \cdots & 0 & 1 & 1 & 1 & 1% \makebox[0pt][l]{\bigr)^T} \end{tabular} \end{tabular}$

\end{document}


Above I use a tabular with fixed-width columns, setting elements inside p{10pt} columns. You can use zero-width boxes in the outer-columns to simulate a matrix-style (...)^T.

Do you need blockarray at all?

\documentclass{article}
\usepackage{amsmath}

\newcommand{\IND}[2]{\overset{#2\vphantom{\smash[t]{\Big|}}}{#1}}

\begin{document}

$$\bigl(\IND{0}{1} \quad \cdots \quad \IND{0}{12} \quad \IND{1}{13} \quad \IND{1}{14} \quad \IND{1}{15} \quad \IND{1}{16}\bigr)^T$$

\end{document}


Alternative version:

\documentclass{article}
\usepackage{amsmath}

\newcommand{\IND}[2]{%
\vbox{\ialign{%
\hfil$##$\hfil\cr
\scriptstyle#2\cr
#1\cr
}}%
}

\begin{document}

$$\bigl(\IND{0}{1} \quad \cdots \quad \IND{0}{12} \quad \IND{1}{13} \quad \IND{1}{14} \quad \IND{1}{15} \quad \IND{1}{16}\bigr)^T$$

\end{document}