How to Draw a Line in a Matrix Latex

\documentclass[10pt,a4paper]{scrartcl} \usepackage{amsmath}   \usepackage{pstricks} \usepackage{pst-all} \usepackage{pstricks-add}  \begin{document} 	 \begin{eqnarray} 	\left | A_{4 \times 4} \right |= 	\begin{vmatrix} 		a_{11} & a_{12} & a_{13} & a_{14}\\ 		a_{21} & a_{22} & a_{23} & a_{24}\\ 		a_{31} & a_{32} & \rnode{a33a}{a_{33}} & a_{34}\\ 		a_{41} & a_{42} & a_{43} & a_{44} 	\end{vmatrix} 		& = & ~~~a_{11} 	\begin{vmatrix} 		a_{22} & a_{23} & a_{24}\\ 		a_{32} & \rnode{a33b}{a_{33}} & a_{34}\\ 		a_{42} & a_{43} & a_{44} 	\end{vmatrix} 		-a_{12} 	\begin{vmatrix} 		a_{21} & a_{23} & a_{24}\\ 		a_{31} & a_{33} & a_{34}\\ 		a_{41} & a_{43} & a_{44} 	\end{vmatrix}      \nonumber   \\ 		&      & + \: a_{13} 	\begin{vmatrix} 		a_{21} & a_{22} & a_{24}\\ 		a_{31} & a_{32} & a_{34}\\ 		a_{41} & a_{42} & a_{44} 	\end{vmatrix} 		-a_{14} 	\begin{vmatrix} 		a_{21} & a_{22} & a_{23}\\ 		a_{31} & a_{32} & a_{33}\\ 		a_{41} & a_{42} & a_{43} 	\end{vmatrix}     \nonumber   \\ 	%\IEEEyesnumber\\ 	%%%%%%%%%%%%%%%%%%%%% 		& = & ~~a_{11} 	\rnode{leftbracket}{}\left \{ a_{22}\underline{\begin{vmatrix} 		a_{33} & a_{34} \\ 		a_{43} & a_{44} 	\end{vmatrix}  }_{<1>} 		-a_{23}\underline{\begin{vmatrix} 		a_{32} & a_{34} \\ 		a_{42} & a_{44} 	\end{vmatrix}}_{<2>} 		+a_{24}\underline{\begin{vmatrix} 		a_{32} & a_{33} \\ 		a_{42} & a_{43} 	\end{vmatrix} }_{<3>} 	\right \}   \nonumber   \\ 		&      & -a_{12} 	\left \{ a_{21}\underline{\begin{vmatrix} 		a_{33} & a_{34} \\ 		a_{43} & a_{44} 	\end{vmatrix}}_{<1>}  		-a_{23}\underline{\begin{vmatrix} 		a_{31} & a_{34} \\ 		a_{41} & a_{44} 	\end{vmatrix}}_{<4>} 		+a_{24}\underline{\begin{vmatrix} 		a_{31} & a_{33} \\ 		a_{41} & a_{43} 	\end{vmatrix} }_{<5>} 	\right \}   \nonumber   \\ 		&      & +a_{13} 	\left \{ a_{21}\underline{\begin{vmatrix} 		a_{32} & a_{34} \\ 		a_{42} & a_{44} 	\end{vmatrix}  }_{<2>} 		-a_{22}\underline{\begin{vmatrix} 		a_{31} & a_{34} \\ 		a_{41} & a_{44} 	\end{vmatrix}}_{<4>} 		+a_{24}\underline{\begin{vmatrix} 		a_{31} & a_{32} \\ 		a_{41} & a_{42} 	\end{vmatrix} }_{<6>} 	\right \}   \nonumber   \\ 		&      & -a_{14} 	\left \{ a_{21}\underline{\begin{vmatrix} 		a_{32} & a_{33} \\ 		a_{42} & a_{43} 	\end{vmatrix}  }_{<3>} 		-a_{22}\underline{\begin{vmatrix} 		a_{31} & a_{33} \\ 		a_{41} & a_{43} 	\end{vmatrix}}_{<5>} 		+a_{23}\underline{\begin{vmatrix} 		a_{31} & a_{32} \\ 		a_{41} & a_{42} 	\end{vmatrix} }_{<6>} 	\right \}\rnode{rightbracket}{} 	%\IEEEyesnumber\\ 	\label{eq:4-dimension-to-2-dimension} 	% 	% Node connections: 	\ncline[linecolor=red]{leftbracket}{rightbracket} 	\nccurve[angleA=-60, ncurvA=1.5, angleB= 125, linewidth=0.6pt, linecolor=gray, linestyle=dashed]{->}{a33a}{a33b} 	\end{eqnarray}    	 	\end{document}

example.png
example.png (41.67 KiB) Viewed 4622 times

What the code means:
\rnode{label}{something} places a node on the 'something' object with a given label (much like labels for references in figures and tables).
You can then connect any existing node by using \ncline{firstlabel}{secondlabel} for a straight line. Additional commands for changing the line stile are accepted too. The \nccurve command does the same but with a curve instead of a plain straight line.
There are much more connecting lines available to choose from. For more on this check the pstricks documentation

Note:
The pstricks packages loaded in the preamble. Pdflatex compilation will nolonger work with the pdf package. You will have to compile tex-dvi-ps-pdf in order to use pstricks. This also means that any graphics included in the document (by \includegraphics{myepspic}) need to be encapsulated post script figures.
I hope this is not too much of a trade off for you. I personally use pstricks a lot and hence always compile tex-dvi-ps-pdf.

The last closing curly bracket looks odd, I don't know where this is coming from...(?) But, it was there before I started adding the nodes and lines. I'm clueless as to what causes this.

Cheers
Achim

ps: A general note on lines in equations. I think it's not regarded as good practice to cross out terms in equations, this should probably rather be described in text form. Also It becomes kind of messed up if you have too many arrows and lines pointing form one term to an other. I know this is exactly what I've done in the example I showed in my first response. I should mention, however, that I used this matrix in a beamer presentation and it served well for visualising my point.
"Use the Force wisely, Anakin... :-) "

How to Draw a Line in a Matrix Latex

Source: https://latex.org/forum/viewtopic.php?t=9973

0 Response to "How to Draw a Line in a Matrix Latex"

Enregistrer un commentaire

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel