Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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:

enter image description here

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

share|improve this question
add comment

3 Answers 3

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}

Array

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}
share|improve this answer
    
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
add comment

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}

enter image description here

share|improve this answer
    
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
add comment

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

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

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

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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