So using the last answer from here, as I am using an array not any matrix. I am using MathTex for Libre Office Writer. FYI.
Normal Matrix:
\left[
\begin{array}{ccc}
3 & 3 & 1 \\
1 & 0 & -4 \\
1 & -3 & 5
\end{array}
\right]
And my Stiked Matrix:
\renewcommand*{\arraystretch}{1.5}
\makeatletter
\newcommand*{\rowstrike}{%
\noalign{%
% normal "baselineskip" in tabular is height + depth of \@arstrutbox
\vskip-.5\dimexpr\ht\@arstrutbox+\dp\@arstrutbox\relax
% default line thickness is 0.4pt
\vskip-.2pt\relax
\hrule
\vskip-.2pt\relax
\vskip+.5\dimexpr\ht\@arstrutbox+\dp\@arstrutbox\relax
}%
}
\newcommand{\colstrike}{%
@{\hspace{2\tabcolsep}}|@{\hspace{-.5\tabcolsep}}c@{}@{\hspace{1.5\tabcolsep}}
}
\left[
\begin{array}{@{}\colstrike cc}
3 & 3 & 1 \\
1 & 0 & ^-4 \\ \rowstrike
1 & ^-3 & 5
\end{array}
\right]
The problem is in my Column strike through, the alignment of the second row is messed up. I would like to modify my macro so as to have a single command to strike any column, of any size (if possible). And, to fix the alignment. Got the alignment to work by altering:
@{\hspace{2\tabcolsep}}|@{\hspace{-.5\tabcolsep}}c@{}
to:
@{\hspace{2\tabcolsep}}|@{\hspace{-.5\tabcolsep}}c@{}@{\hspace{1.5\tabcolsep}}
But it only works for a single number, any more and this occurs:
I would like it to be centred on the column.
EDIT:
I tried to use a tikz command from another question, but it does not work right:
\usepackage{tikz}
\newcommand{\tm}[2]{%
\tikz[overlay,remember picture,baseline] \node [anchor=base] (#1) {$#2$};%
}
\newcommand{\DrawVLine}[3][]{%
\begin{tikzpicture}[overlay,remember picture]
\draw[shorten <=0.3ex, #1] (#2.north) -- (#3.south);
\end{tikzpicture}
}
\newcommand{\DrawHLine}[3][]{%
\begin{tikzpicture}[overlay,remember picture]
\draw[shorten <=0.2em, #1] (#2.west) -- (#3.east);
\end{tikzpicture}
}
\left[
\begin{array}{ccc}
\tm{topA}{3} & 3 & 1 \\
\tm{leftA}{1} & 0 & \tm{rightA}{^-4} \\
\tm{bottomA}{1} & ^-3 & 5
\end{array}
\right]
\DrawHLine[black, thick, opacity=0.5]{topA}{bottomA}
\DrawVLine[black, thick, opacity=0.5]{leftA}{rightA}
Which results in:
Best Answer
The last code does work, you misplaced the commands
\DrawHLine
and\DrawVLine
so the lines could not be orthogonal.