5

I want to produce equations with block matrices

\documentclass[a4paper,12pt,titlepage]{article}
\usepackage[fleqn]{amsmath}
\usepackage[pdftex]{graphicx}
\usepackage{blkarray}
\usepackage{mathtools}
\usepackage{multirow}
\newcommand{\rdots}{\hspace{.2ex}\raisebox{1ex}{\rotatebox{-12}{$\ddots$}}}


\begin{document}


\resizebox{0.9\textwidth}{!}{\begin{minipage}{\textwidth}
\begin{align}
 \begin{blockarray}{(cccc|cccc)}
  1 &  & 0 & \cdots & \BAmulticolumn{4}{c}{\multirow{4}{*}{\huge$0$}}\\
   & \rdots &  &  & & & &\\
  0 &  &  1 &  & & & &\\
  \vdots &  &  & \rdots & & & &\\
  \cline{1-8}
& & &  & 1 &  &  & \cdots \\
\BAmulticolumn{4}{c|}{\multirow{4}{*}{\huge$0$}} & & \rdots  &  \\
& & & & 0 &  & 1 &  \\
& & & & \vdots &  &  &\rdots \\
 \end{blockarray}+
 \begin{blockarray}{(cccc|cccc)}
  \BAmulticolumn{4}{c|}{\multirow{4}{*}{\huge$0$}} &  \BAmulticolumn{4}{c}{\multirow{4}{*}{\huge$S-T$}}  \\
    &     &   &   &    &   &   &   & \\
   &     &   &   &    &   &   &   & \\
     &     &   &   &    &   &   &   & \\
  \cline{1-8}
  \BAmulticolumn{4}{c|}{\multirow{4}{*}{\huge$T-S$}} & \BAmulticolumn{4}{c}{\multirow{4}{*}{\huge$0$}}   \\
   &     &   &   &    &   &   &   & \\
   &     &   &   &    &   &   &   & \\
   &     &   &   &    &   &   &   & \\
 \end{blockarray}
\end{align}
\end{minipage}}

\end{document}

My code produces the correct matrices, but they are not the same size: enter image description here

the one on the lefthand size (with the S-T) is smaller! I don't get why, can anyone help?

  • Why not simply using something like \[ \huge \left( \begin{array}{c|c} I & 0 \\ \hline 0 & I \end{array} \right) + \left( \begin{array}{c|c} 0 & S-T \\ \hline T-S & 0 \end{array} \right) \] (with a possible remark explaining that I denotes an identity matrix of the given size)? This is more concise and looks a lot better (in my opinion). – Gonzalo Medina Jan 16 '15 at 15:56
4

Here's a slightly simpler approach, omitting the unsightly internal rules in the matrices, and using a scalebox to shrink the identity matrix instead of trying to grow the other parts. The other trick used here is to insert an invisible vertical rule to control the spacing.

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\newcommand{\IM}{\scalebox{0.7}{\(\begin{matrix}1&0&\cdots\\0&1\\\vdots&&\ddots\end{matrix}\)}}
\newcommand{\BigO}{\vrule width 0pt height 17pt depth 15pt 0}
\[
    \left( \begin{matrix} \IM & \BigO \\ \BigO & \IM \end{matrix} \right)
    +
    \left( \begin{matrix} \BigO & S-T \\ T-S & \BigO \end{matrix} \right)
\]
\end{document}

enter image description here

  • Thanks, I was looking for some invisible character to control spacing, but could not find one that worked in math mode. Anyway, I noticed that what makes the first matrix is bigger are the dots, the seems to take up more room than regular characters. Gonna try your solution. – Amok Jan 17 '15 at 17:39

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.