Re: [RISOLTO] Riquadri in una matrice

#65513
Up
0
Down
::


Ho trovato! 🙂

`\documentclass[fleqn,12pt,a4paper]{article}

\usepackage{tikz,kbordermatrix,amsmath}

\newcounter{nodecount}
\newcommand\mn[1]{%
\addtocounter{nodecount}{1}%
\tikz \node (\arabic{nodecount}) {$#1$};}

\tikzstyle{every picture}+=[remember picture,baseline]
\tikzstyle{every node}+=[inner sep=2pt,anchor=base,align=center,text depth=.25ex,outer sep=1.5pt]
\tikzstyle{every path}+=[thick]

\begin{document}
\[\let\kbldelim\lVert\let\kbrdelim\rVert\kbordermatrix{%
& E_5 & E_3 & E_6 & E_4 & E_8 & E_1 & E_2 & E_7 & E_9 \\
E_5 & \mn{1} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
E_3 & 0 & \mn{x} & x & 0 & 0 & 0 & 0 & 0 & 0 \\
E_6 & 0 & x & \mn{x} & 0 & 0 & 0 & 0 & 0 & 0 \\
E_4 & 0 & 0 & 0 & \mn{x} & x & 0 & 0 & 0 & 0 \\
E_8 & 0 & 0 & 0 & x & \mn{x} & 0 & 0 & 0 & 0 \\
E_1 & 0 & 0 & 0 & x & x & \mn{x} & 0 & 0 & 0 \\
E_2 & 0 & x & x & 0 & 0 & x & \mn{x} & 0 & 0 \\
E_7 & 0 & 0 & 0 & 0 & 0 & x & 0 & 0 & x \\
E_9 & x & x & x & 0 & 0 & 0 & 0 & x & 0
}\]

\begin{tikzpicture}[overlay]
\draw (1.north west) — (1.north east) — (1.south east) — (1.south west) — cycle;
\draw (2.north west) -| (3.south east) -| (2.north west) — cycle;
\draw (4.north west) -| (5.south east) -| (4.north west) — cycle;
\draw[thin] (4.north west) -| (6.south east) -| (4.north west) — cycle;
\draw[thin] (2.north west) -| (7.south east) -| (2.north west) — cycle;
\end{tikzpicture}
\end{document}`

Mi sono rifatto a questa discussione, con in più il pacchetto kbordermatrix (che non sta su CTAN! cercalo con google).

Ciao,
A.

Go to top