# Specific blockmatrices

I would like to put some block matrices in LaTeX: in the end they should look like this; The first matrix that I need looks like this, sorry I know it does not look very clear this way (for a better view, check out the following image). The larger dots indicate that the blocks have to be repeated. The smaller dots indicate that the matrices can be larger in size. I dont need to have it like this exactly in latex, just dots in the below left corner is also okay.)

 2 -1  0  0  0  0  0  0
-1  2  0  0  0  0  0  0
0 -1  2 -1  0  .  .  .
0  0 -1  2 -1  0  0  .
0  0  0 -1  2 -1  0  0
and so on...


and the second one looks like this:

1 0  0  0 0  0 0
0 1 -1  0 0  0 0
0 -1 1  0 0  0 0
0 0  0  1 -1 0 0
0 0  0  -1 1 0 0
0 0  0  0  0 . .
0 .  .  .  . ...


I tried to do it like this using the easybmat package.

$\left( \begin{BMAT}(rc){c:c}{c:c} \begin{BMAT}(rc){cc}{cc} 1 & -1\\ -1 & 1 \end{BMAT} &\begin{array}{cc} 0 & . \\ 0 & 0 \\ \end{array}\\ \begin{array}{cc} 0& 0 \\ . & 0 \\ \end{array} & \begin{BMAT}(rc){cc}{cc} 1 & -1\\ -1 & 1 \end{BMAT} \end{BMAT} \right)$


But this gives the right idea, but I don't know how to adjust this to a bigger size. And I also don't know how to put in the extra cells which I need for the second matrix.

• Welcome to TeX.sx! A tip: If you indent lines by 4 spaces, then they are marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). – Caramdir Jul 22 '11 at 19:53
• @Maartje: it would be really helpful if you could provide a link to the images so that we can see the actual blocks. – Gonzalo Medina Jul 22 '11 at 20:31

## 3 Answers

Here's a possible code for the first matrix:

\documentclass{book}
\usepackage{easybmat}

\begin{document}

$A= \delta^{-2} \left( \begin{BMAT}[8pt]{cc:cc:cc:c}{cc:cc:cc:c} 1 & -1 & 0 & & & & 0 \\ -1 & 1 & 0 & 0 & 0 & & \\ 0 & 0 & \bullet & \bullet & 0 & &\\ & 0 & \bullet & \bullet & 0 & 0 & \\ & & 0 & 0 & \bullet & \bullet & 0 \\ & & & 0 & \bullet & \bullet & 0 \\ 0 & & & 0 & 0 &0 & \end{BMAT} \right)$

\end{document}


Using this example code you can easily build the second matrix.

• It looks great, Gonzalo! =) – Paulo Cereda Jul 22 '11 at 21:15
• Thank you very much! It works and I was also able to make matrix B. – Maartje Jul 22 '11 at 22:18
• @Maartje: Besides the “Thank you” comment, you could also up-vote the answers (with the upward pointing arrow to the left of them) and accept the best one (by clicking on the checkmark). – Gonzalo Medina Jul 22 '11 at 22:43

The first matrix in your picture can be obtained by the following code:

$\left( \begin{BMAT}(c)[4pt]{cc:cc:cc:c}{cc:cc:cc:c} 1 & -1 & 0 & & & & 0 \\ -1 & 1 & 0 & 0 & 0 & & \\ 0 & 0 & \bullet & \bullet & 0 & & \\ & 0 & \bullet & \bullet & 0 & 0 & 0\\ & & 0 & 0 & \bullet & \bullet & 0 \\ & & & 0 & \bullet & \bullet & 0 \\ 0 & & & 0 & 0 & 0 & \smash{\ddots} \end{BMAT} \right)$


The (c) means that columns should all be of the same width; the [4pt] denotes an additional spacing. Then come the column pattern:

cc:cc:cc:c


means "two centered columns, separation, two centered columns, separation, one centered column".

After it the specification for the rows, which is similar. It's important to put in each row the exact number of & characters, six in this example. Hope this helps; the documentation at http://mirror.ctan.org/macros/latex/contrib/easy/doc/docbmat.pdf is somewhat cryptic.

I would use arydshln or tabu package instead of easybmat. The syntax is more standard and flexible.

\documentclass{article}
\usepackage{arydshln}

\begin{document}

$A= \delta^{-2} \left( \begin{array}{cc:cc:cc:c} 1 & -1 & 0 & & & & 0 \\ -1 & 1 & 0 & 0 & 0 & & \\ \hdashline 0 & 0 & \bullet & \bullet & 0 & &\\ & 0 & \bullet & \bullet & 0 & 0 & \\ \hdashline & & 0 & 0 & \bullet & \bullet & 0 \\ & & & 0 & \bullet & \bullet & 0 \\ \hdashline 0 & & & 0 & 0 &0 & \ddots \end{array} \right)$

\end{document}


with tabu:

\documentclass{article}
\usepackage{tabu}
\begin{document}

$A= \delta^{-2} \tabulinestyle{on 2pt off 2pt} \begin{tabu}{cc|cc|cc|c} 1 & -1 & 0 & & & & 0 \\ -1 & 1 & 0 & 0 & 0 & & \\ \tabucline- 0 & 0 & \bullet & \bullet & 0 & &\\ & 0 & \bullet & \bullet & 0 & 0 & \\ \tabucline- & & 0 & 0 & \bullet & \bullet & 0 \\ & & & 0 & \bullet & \bullet & 0 \\ \tabucline- 0 & & & 0 & 0 &0 & \ddots \end{tabu}$

\end{document}