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:






@{\hspace{2\tabcolsep}}|@{\hspace{-.5\tabcolsep}}to@{\hspace{4.5\tabcolsep}}|@{\hspace{-3\tabcolsep}}– Mico May 30 '17 at 05:08\colstrikemethod proposed in @Werner's answer -- which he himself called "rudimentary" -- was only every meant to work with columns that contain single letters or numerals. For more general situations, you should look into employing one of the tikz-based methods proposed in the other answers. – Mico May 30 '17 at 05:21\documentclassand ending with\end{document}. – Bobyandbob Dec 13 '17 at 12:18pdflatexjust once. Whenever you use\tikzmark-like stuff (placing nodes withremember picture,overlay, and referencing those elsewhere) you have to run twice to get the correct output. In the first run the coordinates on the page are found and saved to theauxfile, in the second run those coordinates can be used. – Torbjørn T. Feb 21 '18 at 12:05