Como posso riscar uma linha ou coluna em uma matriz

Como posso riscar uma linha ou coluna em uma matriz

Quero cruzar uma linha e colunas na minha matriz, mas ainda não sei.

\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}

Rix

Responder1

Você pode usar nicematrixo qual criará um nó PGF/Tikz em cada célula da matriz. Então, você pode desenhar as linhas que desejar com o 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}

Resultado do código acima

informação relacionada