In my document I have defined


and using this the following matrix:


How can I draw boxes around the three blocks which build the matrix?


A solution with basic tools:


\hhline{|--|}#1 \\


\,\fblock{0&1\\ 1&0 }&&\\
&\mkern-9mu\fblock{0&1\\ 1&0}&\multicolumn{2}{c}{\raisebox{3ex}{\bigzero}} \\
&&\makebox[0pt]{$ \ddots $}\\[-0.5ex]
\multicolumn{2}{c}{\raisebox{4ex}{\bigzero}} &&\fblock{0&1\\ 1&0}\,


enter image description here


This is only a fun answer. I am trying out LoopSpace's great update of the tikzmark package, which has now a command in that I was always looking for: \tikzmarknode. And it just works. (Yes, using tikz here may be an overkill, as I said, this is just for fun and to learn something new.) EDIT: Moved the brackets away from the boxes, big thanks to @manooooh!

\begin{tikzpicture}[overlay, remember picture]
\foreach \X in {1,2,3}
{\node[inner sep=1pt,draw,fit=(\X A)(\X B)]{};}

enter image description here

  • +1, but I think the boxes are too stick to the braces of the matrix. Maybe using someting like \left(\;\begin{matrix}...\end{matrix}\;\right) would be ok? – manooooh Sep 9 '18 at 20:54
  • 1
    @manooooh You are absolutely right. Yet this is really just for fun and to pay tribute to LoopSpace's updated package. In this case, you can easily produce a very simple \fbox only solution by placing the 2x2 matrices in \fboxes. I was actually not expecting to get any votes for that, just wanted to draw the attention to the updated library such that LoopSpace and I have company when testing it. ;-) – marmot Sep 9 '18 at 20:58
  • 1
    @manooooh No, I am now on a promotion tour. Undoubtedly someone else will come and say this is a sledge hammer and it is possible to achieve the same with \fboxes (which is true in this case, but not when the boxes should become a tiny bit more fancy). ;-) – marmot Sep 9 '18 at 21:08
  • 1
    Very nice, but why is the bottom zero of the middle box misaligned? – Max Sep 10 '18 at 5:44
  • 2
    The misalignment is actually from the previous line where you have ~~ after the 1 which adds a bit of space after the 1, thus seeming to push the 0 further out due to the centring of the matrix entries. – Loop Space Sep 11 '18 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy