6

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}
3

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

3

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}

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.