How would one typset an array with cells above a bmatrix, something like
[a] & [b]
\begin{bmatrix}
1 & 2 \\
3 & 4
\end{bmatrix}
Where somehow the [a] and [b] cells would appear aligned and above the bmatrix.
How would one typset an array with cells above a bmatrix, something like
[a] & [b]
\begin{bmatrix}
1 & 2 \\
3 & 4
\end{bmatrix}
Where somehow the [a] and [b] cells would appear aligned and above the bmatrix.
You can use a modified \bordermatrix. It is described in mathmode.
You can also use blkarray package for convenience, see also this question.
\documentclass{article}
\usepackage{blkarray}
\begin{document}
\[
\begin{blockarray}{cc}
[a] & [b] \\
\begin{block}{[cc]}
1 & 2 \\
3 & 4 \\
\end{block}
\end{blockarray}
\]
\end{document}

Instead of \[...\] you can use $...$. one example with arrays and one with \multicolumn
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\begin{array}{cc}
[a] & [b]\\
\left[\begin{array}{c}
1\\
3
\end{array}\right. &
\left.\begin{array}{c}
2\\
4
\end{array}\right]
\end{array}
\]
\[
\begin{array}{cc}
[a] & [b]\\
\multicolumn{2}{@{}c@{}}{%
\begin{bmatrix}
~1 & 2~ \\
~3 & 4~
\end{bmatrix}}%
\end{array}
\]
\end{document}

\multicolumn is not supported by mediawiki.
– Leo Liu
Feb 11 '11 at 14:54
For wikipedia only, you can use this manual dirty version. It is tested in Wikipedia's sandbox.
<math>
\begin{matrix}
\begin{matrix} [a] & [b] \end{matrix} \\
\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}
\end{matrix}
</math>
With {bNiceMatrix} of nicematrix and its key first-row.
\documentclass{article}
\usepackage{nicematrix}
\begin{document}
[
\begin{bNiceMatrix}[first-row]
[a] & [b] \
1 & 2 \
3 & 4 \
\end{bNiceMatrix}
]
\end{document}
\[ ... \]is the math environment. You can replace it witheuqationenv. – Leo Liu Feb 11 '11 at 14:32