4

I have a problem with following matrix. Actually I can't put this matrix in LaTeX.

enter image description here

0

3 Answers 3

10

The boxes drawn with TikZ:

\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath}

\begin{document}
\[
  \check B \equiv
  \left[
    \begin{array}{cc}
      \begin{tikzpicture}[baseline=(tmp.base)]
        \node (tmp) {$B^L$};
        \path (tmp.north) ++(0,.3em);
        \draw[overlay]
          (tmp.south east) ++(.75em, -.5em) rectangle (tmp.north west)
        ;
      \end{tikzpicture}
      & 0 \\[.4em]
      0 &
      \begin{tikzpicture}[baseline=(tmp.base)]
        \node (tmp) {$B^R$};
        \path (tmp.south) ++(0, -.3em);
        \draw[overlay]
          (tmp.north west) ++(-.75em, .5em) rectangle (tmp.south east)
        ;
      \end{tikzpicture}
    \end{array}
  \right]
\]
\end{document}

Result

Or a little larger:

\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath}

\begin{document}
\[
  \check B \equiv
  \left[
    \begin{array}{cc}
      \begin{tikzpicture}[baseline=(tmp.base)]
        \node (tmp) {$B^L$};
        \path (tmp.north) ++(0,.3em);
        \draw[overlay]
          (tmp.south east) ++(.75em, -.75em) rectangle (tmp.north west)
        ;
      \end{tikzpicture}
      & 0 \\[1em]
      0 &
      \begin{tikzpicture}[baseline=(tmp.base)]
        \node (tmp) {$B^R$};
        \path (tmp.south) ++(0, -.3em);
        \draw[overlay]
          (tmp.north west) ++(-.75em, .75em) rectangle (tmp.south east)
        ;
      \end{tikzpicture}
    \end{array}
  \right]
\]
\end{document}

Result

9

Some improvements to @onewhaleid's tikz-free solution. I slighly modified some parameters and managed to get the brackets fully enclose the contents of the matrix:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{equation}
  \setlength{\fboxsep}{1.25em}
  \check B \equiv
  \begin{bmatrix}\noalign{\vskip0.5ex}
  \, \boxed{B^L} & \hspace{-2em} 0 \\[-0.8em]
  0 & \hspace{-1.85em}\boxed{B^R} \,\rule[-3.5ex]{0pt}{0pt}
  \end{bmatrix}
\end{equation}

\end{document} 

enter image description here

3
  • Very nice. I should have put my \setlength inside the align environment too.
    – onewhaleid
    Sep 6, 2015 at 21:15
  • For one row displays, use equation, not align.
    – egreg
    Sep 6, 2015 at 21:38
  • @egreg: Oh yes, I forgot that. I took@onewhaleid's code as a starting point, and focused on the problem of the brackets size. Thanks for pointing that.
    – Bernard
    Sep 6, 2015 at 22:00
7

This is a non-tikz alternative, although I can't work out how to get the brackets the correct size.

\documentclass{article}

\usepackage{amsmath}

\begin{document}

% increase padding around fboxes
\setlength{\fboxsep}{1em}

\begin{align}
\check B \equiv
\begin{bmatrix}
\, \boxed{B^L} & \hspace{-2em} 0 \\[-0.9em]
0 & \hspace{-2em} \boxed{B^R} \,
\end{bmatrix}
\end{align}

\end{document}

enter image description here

1
  • 1
    For one row displays, use equation, not align.
    – egreg
    Sep 6, 2015 at 21:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .