I was wondering how I could create this matrix in LaTeX:
I know how to do the matrix part but my question is the lines, how can I make them stop in (1,1), (2,2) and (3,3)?
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityHere is a possibility with nicematrix
and tikz
.
\documentclass{article}
\usepackage{nicematrix, tikz}
\begin{document}
\[
\NiceMatrixOptions{cell-space-limits = 2pt}
\begin{pNiceMatrix}[first-col]
\color{red}\Delta_1 & \frac{\partial^2f}{\partial x_1^2} & \frac{\partial^2f}{\partial x_1^2} & \frac{\partial^2f}{\partial x_1^2}\\
\color{green}\Delta_2 & \frac{\partial^2f}{\partial x_1^2} & \frac{\partial^2f}{\partial x_1^2} & \frac{\partial^2f}{\partial x_1^2}\\
\color{blue}\Delta_3 & \frac{\partial^2f}{\partial x_1^2} & \frac{\partial^2f}{\partial x_1^2} & \frac{\partial^2f}{\partial x_1^2}
\CodeAfter
\tikz{
\draw[red, shorten >=-3mm] (1-|2) -- (2-|2) -- (2-|1);
\draw[green, shorten >=-3mm] (1-|3) -- (3-|3) -- (3-|1);
\draw[blue, shorten >=-3mm] (1-|4) -- (4-|4) -- (4-|1);
}
\end{pNiceMatrix}
\]
\end{document}
nicematrix
a try, since it is build using tikz this should not be a problem.\documentclass{...}
and ending with\end{document}