An example: (right matrix)
I have not found proper answer searching. I need this one for Jordan's normal form
matrices
An example: (right matrix)
I have not found proper answer searching. I need this one for Jordan's normal form
Each block need its own pair of marks; I changed the definition of \tikzdrawbox
; the first mandatory argument is a number used for the marks; the second optional argument allows you to pass options to \draw
and the optional argument allows you to specify some "correction" to the block dimensions to prevent some borders to overlap:
\documentclass{article}
\usepackage{pgf}
\usepackage{tikz}
\usetikzlibrary{calc,fit,matrix,arrows,automata,positioning}
\newcommand\x{\times}
\newcommand\y{\colorbox{red}{$\times$}}
\newcommand\z{\colorbox{gray}{$\times$}}
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\newcommand{\tikzdrawbox}[3][(0pt,0pt)]{%
\tikz[overlay,remember picture]{
\draw[#3]
($(left#2)+(-0.3em,0.9em) + #1$) rectangle
($(right#2)+(0.2em,-0.4em) - #1$);}
}
\begin{document}
\begin{equation}\label{eq:blockedgivens}
\left(\begin{array}{ccccccccccccccc}
\x & \x & \x & \x & \x & \x & \x & \x & \x & \x & \x & \x & \x & \x & \x \\
0 & \x & \x & \x & \x & \x & \x & \x & \x & \x & \x & \x & \x & \x & \x \\
0 & 0 & \x & \x & \x & \x & \x & \x & \x & \x & \x & \x & \x & \x & \x \\
0 & 0 & 0 & \tikzmark{left1}\x & \x & \x & \x & \tikzmark{left3}\x & \x & \x & \x & \x & \x & \x & \x \\
0 & 0 & 0 & \z & \x & \x & \x & \x & \x & \x & \x & \x & \x & \x & \x \\
0 & 0 & 0 & 0 & \z & \x & \x & \x & \x & \x & \x & \x & \x & \x & \x \\
0 & 0 & 0 & 0 & 0 & \z & \x & \x & \x & \x & \x & \x & \x & \x & \x \\
0 & 0 & 0 & 0 & 0 & 0 & \z & \tikzmark{left2} \x \tikzmark{right1} & \x & \x & \x & \tikzmark{left4} \x & \x & \x & \x \tikzmark{right3} \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & \z & \x & \x & \x & \x & \x & \x & \x \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \z & \x & \x & \x & \x & \x & \x \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \z & \x & \x & \x & \x & \x \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \z & \x \tikzmark{right2} & \x & \x & \x \tikzmark{right4} \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \z & \x & \x & \x \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \z & \x & \x \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \z & \x \\
\end{array}\right)
\tikzdrawbox{1}{thick,red}
\tikzdrawbox{2}{thick,red}
\tikzdrawbox[(-1pt,2pt)]{3}{thick,green}
\tikzdrawbox[(-4pt,2pt)]{4}{thick,green}
\end{equation}
\end{document}
Maybe I took it a little too literal.
\documentclass{article}
\usepackage{emerald,tikz}
\usepackage[T1]{fontenc}
\usetikzlibrary{calc,decorations.pathmorphing,fit}
\makeatletter
\pgfdeclaredecoration{penciline}{initial}{
\state{initial}[width=+\pgfdecoratedinputsegmentremainingdistance,auto corner on length=1mm,]{
\pgfpathcurveto%
{% From
\pgfqpoint{\pgfdecoratedinputsegmentremainingdistance}
{\pgfdecorationsegmentamplitude}
}
{% Control 1
\pgfmathparse{0.1*rand}
\pgfpointadd{\pgfqpoint{\pgfdecoratedinputsegmentremainingdistance}{0pt}}
{\pgfqpoint{-\pgfdecorationsegmentaspect\pgfdecoratedinputsegmentremainingdistance}%
{\pgfmathresult\pgfdecorationsegmentamplitude}
}
}
{%TO
\pgfpointadd{\pgfpointdecoratedinputsegmentlast}{\pgfpoint{1pt}{1pt}}
}
}
\state{final}{}
}
\makeatother
\begin{document}\ECFTallPaul
\begin{tikzpicture}
[zeros/.style={},scale=0.8,transform shape,
xes/.style={outer sep=1.5pt,decoration=penciline,decorate}]
\foreach \y in {1,...,4}{
\foreach \x in {1,...,5}{
\ifnum\x>\numexpr\y+1
\node[zeros] (mynode-\x-\y) at (\y,-\x) {0};
\else
\pgfmathparse{\y-\x<1?"draw":""}
\node[xes,\pgfmathresult](mynode-\x-\y) at (\y,-\x) {X};
\ifnum\x<5
\ifnum\x<\y\draw[<-,xes] (mynode-\x-\y) -- +(0,-0.7);\fi
\ifnum\x=\y\draw[<-,xes] (mynode-\x-\y) -- +(0,-0.7);\fi
\ifnum\y<4\draw[<-,xes] (mynode-\x-\y) -- +(0.7,-0.7);\fi
\fi
\fi
}
}
\node[fit=(mynode-1-1)(mynode-5-4),draw,thick,xes,red,label=90:{\Large dependencies}] {};
\begin{scope}[xshift=4.7cm]
\foreach \x[remember=\x as \lastx] in {1,...,5}{
\node (myvecs1-\x) at (0,-\x) {X};
\node (myvecs2-\x) at (1,-\x) {X};
\node (myvecsn-\x) at (5,-\x) {X};
\ifnum\x>1
\draw[->,xes] (myvecs1-\x) -- (myvecs1-\lastx);
\draw[->,xes] (myvecs2-\x) -- (myvecs2-\lastx);
\draw[->,xes] (myvecsn-\x) -- (myvecsn-\lastx);
\fi
}
\node[fit=(myvecs1-1)(myvecsn-5),draw,thick,xes,green!50!blue,label=90:{\Large Free of diagonal dep.}] {};
\end{scope}
\end{tikzpicture}
\end{document}
Mostly stolen from
TikZ marking several blocks in a matrix
and for the font
Best Answer