# Vertically Centering Text/Numbers in Rows of Array using Math Mode

I am trying to center text in an array of two rows inside a math mode environment so that the text in the second column of the array appears half way between the first and second row of the first column. Here's an example of what I have done so far.

\documentclass{article}

\usepackage{amsmath}

\begin{document}
$A = \left[ \begin{array}{c|c} B & \\ a^{T} & b \\ \end{array} \right]$
\end{document}


This is how I would like it to appear:

Any help/suggestions on how to do this would be appreciated.

-

An easy way out here is to nest two array environments:

\documentclass{article}
\begin{document}
$A = \left[ \begin{array}{c|c} \begin{array}{@{}c@{}} B \\ a^{T} \end{array} & b \\ \end{array} \right]$
\end{document}


Note the use of @{} around the innermost array column specification. This removes the inter-column spacing. Otherwise the spacing for the first column would be doubled due to the nested array - this does not seem to be the case with the example in your question though. Alternatively, the makecell package also provides a means to do this (using the \makecell{<array/tab>} command), yielding a similar result:

\documentclass{article}
\usepackage{makecell}% http://ctan.org/pkg/makecell
\begin{document}
$A = \left[ \begin{array}{c|c} \makecell{B \\ a^{T}} & b \\ \end{array} \right]$
\end{document}

-
Excellent! Thanks for that! I am not after perfection. I just want something that works. Once again, thank you for your help. – Bill Oct 7 '11 at 7:34

Yet another option would be to use \multirow from the multirow package:

\documentclass{article}
\usepackage{multirow}
\begin{document}
$A = \left[ \begin{array}{c|c} B & \multirow{2}{*}{b} \\ a^{T} \\ \end{array} \right]$
\end{document}


-
Thanks for confirming that I can use \multirow as another method for solving this problem. I thought that using this was only possible in tabular environments. – Bill Oct 7 '11 at 22:15

Alternatively you can use amsmath's aligned inside of an equation. That would look like this:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
A= \left[ \left. \begin{aligned} B \\ a^T \end{aligned} \right| b \right]
\end{document}


But frankly, I think Werner's solutions looks a bit better.

-
Thanks for that! Yes, I prefer Werner's solution better too! But, good to know that there's more than one way to achieve the same result. – Bill Oct 7 '11 at 7:41