1

In the document I have to describe a series of transformations, made with a matrix. Each transformation works only on 2x2 or 1x1 block, so I want to visually select this block in the matrix like this:

pmatrix with a rectangle selected

I can type the matrix using the pmatrix environment, but I don't know, how to draw the rectangle. What is the best way to achieve this?

fiktor
  • 1,953

1 Answers1

3

My question was indeed close to duplicate as was hinted by @Werner . For the sake of reference I provide the code, which draws what I wanted. The code was created after analyzing the answer, linked by @Werner.

\begin{tikzpicture}[baseline=(current bounding box.center)]
    \matrix [matrix of math nodes,left delimiter=(,right delimiter=)] (m)
    {
        \!1 & 0 & 0\!\!\! \\ \!0 & {P_\theta \otimes P} & 0\!\!\! \\ \!0 & 0 & 0\!\!\! \\
    };
    \draw (m-1-1.north west) -- (m-1-3.north west) -- (m-3-3.north west) -- (m-3-1.north west) -- (m-1-1.north west);
\end{tikzpicture}

The following code should be included in the preamble.

\usepackage{tikz}
\usetikzlibrary{arrows,matrix,positioning}

This gives the following.

the resulted image is good enough

fiktor
  • 1,953