1

I've found this code from How to cross a row in matrix with a line?

\documentclass{article}
\usepackage{tikz}
\newcommand{\pmark}[1]{\begin{tikzpicture}[overlay,remember picture]\node(#1)at (-1em,.7ex){};\end{tikzpicture}}
\newcommand{\smark}[1]{\begin{tikzpicture}[overlay,remember picture]\draw(#1)--(0,.7ex);\end{tikzpicture}}
\begin{document}
$$\begin{array}{cccc|c}
a&b&bc&d&f\\\hline
0\pmark{a}&0&1&1&1\smark{a}\\
0&0&0&1&0\\
0&0&1&1&1\\
\end{array}$$
\end{document}

It works like a charm for rows but the lines are quite skewed. Can someone see how to fix this to work for both rows and columns?

Jamgreen
  • 3,687
  • 1
    Did you see http://tex.stackexchange.com/questions/196258/draw-a-vertical-line-over-the-entries-of-a-column-in-an-array ? – egreg Mar 28 '15 at 19:02

1 Answers1

0

I don't know, try this may be it help you

\documentclass{article}
\usepackage{tikz}
\newcommand{\pmark}[1]{\begin{tikzpicture}[overlay,remember picture]\node(#1)at (-1em,.7ex){};\end{tikzpicture}}
\newcommand{\smark}[1]{\begin{tikzpicture}[overlay,remember picture]\draw(#1)--(0,.7ex);\end{tikzpicture}}
\newcommand{\vpmark}[1]{\begin{tikzpicture}[overlay,remember picture]\node(#1)at (.3em,5ex){};\end{tikzpicture}}
\newcommand{\vsmark}[1]{\begin{tikzpicture}[overlay,remember picture]\draw(#1)--(.3em,-1ex);\end{tikzpicture}}
\begin{document}
\[\begin{array}{cccc|c}
a&b&bc&d&f\\\hline
0\pmark{a}&0&\vpmark{b}1&1&1\smark{a}\\
0&0&0&1&0\\
0&0&\vsmark{b}1&1&1\\
\end{array}\]
\end{document}
touhami
  • 19,520