2

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.

3

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}

enter image description here

  • Is there a solution within the math environment? Great solution, but I need it to be within an equation environment. – ccook Feb 11 '11 at 14:30
  • @ccook: \[ ... \] is the math environment. You can replace it with euqation env. – Leo Liu Feb 11 '11 at 14:32
  • I should have made less of an assumption. I'm trying to typeset it for wikimedia and it doesn't recognize the blocks :( – ccook Feb 11 '11 at 14:34
  • @ccook: Wiki uses part of TeX syntax for math formulas. However, wiki does NOT have full TeX abilities. You'll have to use the restricted TeX described in en.wikipedia.org/wiki/Wikipedia:Editing_Math – Leo Liu Feb 11 '11 at 14:41
1

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}

enter image description here

  • This also does not work for wikipedia. Even \multicolumn is not supported by mediawiki. – Leo Liu Feb 11 '11 at 14:54
  • then we do it withpout \multicolumn ... – user2478 Feb 11 '11 at 15:07
1

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>
  • Thank you, this works well for wikimedia. I did have to push the header around with \quad, but as you said, quick and dirty for wikimedia. – ccook Feb 11 '11 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.