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 want to typeset a matrix which consists of several submatrices. As they consist of some longer formulae I'd like to assign each a name. I tried to use \underbace and \overbrace. However now the braces and the letter appears inside the matrix and I'd like to have it above or below the matrix. What would you suggest here?

\documentclass{article}
\usepackage{amsmath}
\usepackage{xfrac}
\begin{document}
\begin{gather*}
H_{8kl}=
\begin{pmatrix}
    \overbrace{\sfrac{1}{2} (A+B)\otimes E + \sfrac{1}{2} (A-B)\otimes G}^{K} &
    \overbrace{\sfrac{1}{2} (A+B)\otimes F + \sfrac{1}{2} (A-B)\otimes H}^{L}\\
    \underbrace{\sfrac{1}{2} (C+D)\otimes E + \sfrac{1}{2} (C-D)\otimes G}_{M} &
    \underbrace{\sfrac{1}{2} (C+D)\otimes F + \sfrac{1}{2} (C-D)\otimes H}_{M}
  \end{pmatrix}
\end{gather*}
\end{document}
share|improve this question

2 Answers 2

up vote 3 down vote accepted

I \smashed the over and undersets, so that the matrix would not know of them. However, I had to compensate with a leading rule to accound for the vertical space that was smashed (the three 4ex expressions in the \rule can be changed in size to increase or decrease the gap above/below the expression).

Struts had to be added outside the over- and under-sets so as to get the parens to set to the right vertical size and also inside the over- and under-sets to get the braces to stand off from the expression appropriately.

\documentclass{article}
\usepackage{amsmath}
\usepackage{xfrac}
\usepackage{lipsum}
\begin{document}
\lipsum[3]
\begin{gather*}
\rule[\dimexpr-4ex-\ht\strutbox]{0pt}{\dimexpr4ex+4ex+\baselineskip}
 H_{8kl}=
\begin{pmatrix}
    \strut\smash{\overbrace{\strut\sfrac{1}{2} (A+B)\otimes E + \sfrac{1}{2} (A-B)\otimes G}^{K}} &
    \strut\smash{\overbrace{\strut\sfrac{1}{2} (A+B)\otimes F + \sfrac{1}{2} (A-B)\otimes H}^{L}}\\
    \strut\smash{\underbrace{\strut\sfrac{1}{2} (C+D)\otimes E + \sfrac{1}{2} (C-D)\otimes G}_{M}} &
    \strut\smash{\underbrace{\strut\sfrac{1}{2} (C+D)\otimes F + \sfrac{1}{2} (C-D)\otimes H}_{M}}
  \end{pmatrix}
\end{gather*}
\lipsum[4]
\end{document}

enter image description here

share|improve this answer

You could use explicit sizing instructions -- e.g., \Biggl and \Biggr -- for the parentheses that surround the matrix. To simplify the overall look of the matrix, you may also want to factor out the common term 0.5.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for "matrix" environment
\begin{document}
\[
H_{\textit{8kl}}= \frac{1}{2}
\Biggl( \, \begin{matrix} 
    \overbrace{ (A+B)\otimes E +  (A-B)\otimes G}^{K} &
    \overbrace{ (A+B)\otimes F +  (A-B)\otimes H}^{L}\\[1ex]
    \underbrace{ (C+D)\otimes E +  (C-D)\otimes G}_{M} &
    \underbrace{ (C+D)\otimes F +  (C-D)\otimes H}_{M}
\end{matrix} \, \Biggr)
\]
\end{document}
share|improve this answer

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.