Question: I'd like to draw vertical/horizontal lines over the entries of a column/row in an array. I find the method to draw horizontal lines at [Draw a horizonal line over the entries of a row in an array](https://tex.stackexchange.com/questions/79741/draw-a-horizonal-line-over-the-entries-of-a-row-in-an-array).
But when I used the same way to draw the vertical lines. It didn't look well.
My codes are:

```
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\newcommand{\DrawLine}[3][]{%
\begin{tikzpicture}[overlay,remember picture]
    \draw [#1] ($(#2)+(0,0.6ex)$) -- ($(#3)+(0,0.6ex)$);
\end{tikzpicture}%
}%

\begin{displaymath}
\left[
\begin{array}{cccc}
\tikzmark{11}{15} & 0 & \tikzmark{13}{0} &0\tikzmark{14} \\
0 & 50 & 20 & 25 \\
35 & 5 & 0 & 10\\
\tikzmark{41}{0} & 65 & \tikzmark{43}{50} & 65
\end{array}
\right].
\DrawLine[black,thick]{11}{14}
\DrawLine[black,thick]{11}{41}
\DrawLine[black,thick]{13}{43}
\end{displaymath}

```

The result looks like 

![enter image description here](https://i.stack.imgur.com/ResXR.png)

But the result I want is 

![enter image description here](https://i.stack.imgur.com/YP4cZ.png)

Does anyone know how to fix this?
Thank you.

Answer: 
Without `tikzmark` or `matrix of nodes` , a simple solution is to use the `\rule` command with proper adjustment of `lift`, `width`, and `length`. Here is how to implement this:

```
\documentclass{article} 
\usepackage{amsmath}
\begin{document}
\[\begin{bmatrix}
  15\makebox(-10,0){\rule[-18.5ex]{0.4pt}{4\normalbaselineskip}} 
     & 0 & 0 \makebox(-5,0){\rule[-18.5ex]{0.4pt}{4\normalbaselineskip}} 
             \makebox(-25,0){\rule[1.5ex]{6\normalbaselineskip}{0.4pt}} 
               & 0 \\
  0  & 50 & 20 & 25 \\
  35 & 5  & 0  & 10 \\
  0  & 65 & 50 & 65
\end{bmatrix}\]
\end{document}

```

The output as required:

![enter image description here](https://i.stack.imgur.com/XY6Wm.png)
I thought I'd have a go at it too. I tried to compute as much as possible, but still need fudge factors to vertically center the lines over the numbers. At least it should be independent of font size.

```
\documentclass{article}
\usepackage{mathtools}

\newsavebox{\tempbox}
\newlength{\tempwidth}
\newlength{\tempheight}

% drwa horizontal line across matrix
\newcommand{\hmline}{\rlap{\rule[.6ex]{\tempwidth}{.5ex}}}

% draw vertical line up from bottom row of matrix
\newcommand{\vmline}[1]% #1 = comun entry (bottom row)
{\begingroup%
\settowidth{\tempwidth}{$#1$}%
\addtolength{\tempwidth}{-.5ex}% line width
\rlap{\hspace{.5\tempwidth}\raisebox{-.8ex}[0pt][0pt]{\rule{.5ex}{\tempheight}}}#1%
\endgroup}

\begin{document}
% compute size of matrix (no brackets}
\savebox{\tempbox}{$\displaystyle\begin{matrix}
    15 &  0 &  0 &  0 \\
     0 & 50 & 20 & 25 \\
    35 &  5 &  0 & 10 \\
     0 & 65 & 50 & 65
\end{matrix}$}%
\settoheight{\tempheight}{\usebox{\tempbox}}%
\settodepth{\tempwidth}{\usebox{\tempbox}}%
\addtolength{\tempheight}{\tempwidth}%
\settowidth{\tempwidth}{\usebox{\tempbox}}%

\[
\begin{bmatrix}
    \hmline
    15 &  0 &  0 &  0 \\
     0 & 50 & 20 & 25 \\
    35 &  5 &  0 & 10 \\
    \vmline{0} & 65 & \vmline{50} & 65
\end{bmatrix}
\]
\end{document}

```

![matrix](https://i.stack.imgur.com/j6ooD.png)