
내 행렬에서 행과 열을 교차하고 싶지만 여전히 모릅니다.
\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\usepackage{ulem}
\usepackage{kbordermatrix}% http://www.hss.caltech.edu/~kcb/TeX/kbordermatrix.sty
\usepackage{soul}
\begin{document}
\renewcommand{\kbldelim}{(}% Left delimiter
\renewcommand{\kbrdelim}{)}% Right delimiter
\[
\text{matriz} = \kbordermatrix{
& t1 & t2 & t3 & t4 & t5 \\
a1 & 1 & 1 & 1 & 1 & 0 \\
a2 & 0 & 1 & 14 & 99 & 0 \\
a3 & 0 & 0 & 1 & 0 & 0 \\
a4 & 0 & 0 & 0 & 1 & 0 \\
a5 & 30 & 155 & 0 & 0 & 0
}
\]
\end{document}
답변1
nicematrix
매트릭스의 각 셀 아래에 PGF/Tikz 노드를 생성하는 것을 사용할 수 있습니다 . 그런 다음 Tikz로 원하는 선을 그릴 수 있습니다.
\documentclass{article}
\usepackage{nicematrix}
\usepackage{tikz}
\begin{document}
\[
\text{matriz} =
\begin{pNiceMatrix}[first-row,first-col]
& t_1 & t_2 & t_3 & t_4 & t_5 \\
a_1 & 1 & 1 & 1 & 1 & 0 \\
a_2 & 0 & 1 & 14 & 99 & 0 \\
a_3 & 0 & 0 & 1 & 0 & 0 \\
a_4 & 0 & 0 & 0 & 1 & 0 \\
a_5 & 30 & 155 & 0 & 0 & 0
\CodeAfter
\begin{tikzpicture}
\draw [thick,red] (3-1.west) -- (3-5.east) ;
\draw [thick,blue] (4-0.west|-4-5.east) -- (4-5.east) ;
\end{tikzpicture}
\end{pNiceMatrix}
\]
\end{document}