I know that there is a way to cross out a row of a Tabular, by using \hline. Is there an easy to cross out a column of a Tabular?
The picture below is a Tabular, where some of the rows are crossed out. I would love to cross out column.
Best Answer
I once used something like the following code.
Because perpendicular lines don't work well in this example I have added different styles to cross out columns.
It can also cross out rows but there I have not implemented different styles.
The two files should be located in the same directory.
I have formatted the table in compliance with the recommendations from the booktabs package (section 2 The layout of formal tables, page 3):
You will not go far wrong if you remember two simple guidelines at all times:
Never, ever use vertical rules.
Never use double rules.
Also I have used siunitx' S column type to align the numbers.
You can customize the visual appearance by redefining the following commands:
\strikethroughcolor
\strikethroughwidth
\strikethroughCrossWidth
or calling the following commands:
\strikethroughColumnStylePerpendicular
\strikethroughColumnStyleDiagonal
\strikethroughColumnStyleCounterdiagonal
\strikethroughColumnStyleCross
I have seen your comment that you just want to cross out the column $m_3=50$ but I have crossed out one more just to show how easy it would be to cross out more.
Please note that I have splitted up the first column in two to align the numbers therefore the column indices differ from what one might expect at first glance.
Adding something visual to every row (like with \newcolumntype{=}{@{${}={}$}} which would have been great here) would not deliver the desired output because I am adding an invisible row above and below where it would then appear, too.
You can use the adjustbox package to rotate the content and limit it official width. I would also recommend to use a separate \newcolumntype for it as well as a \rot macro which inserts the required \multicolumn command. You won't avoid that one. However, such a macro must be fully expandable and start directly with \multicolumn. If you want multi line headings add the minipage=<width> option to \adjustbox.
\documentclass{article}
\usepackage{adjustbox}
\usepackage{array}
\newcolumntype{R}[2]{%
>{\adjustbox{angle=#1,lap=\width-(#2)}\bgroup}%
l%
<{\egroup}%
}
\newcommand*\rot{\multicolumn{1}{R{45}{1em}}}% no optional argument here, please!
\begin{document}
\begin{tabular}{r|ccc}
&
\rot{Property 1} &
\rot{Property 2} &
\rot{Property 3}
\\ \hline
System 1 & & & X \\
System 2 & X & X & X \\
System 3 & X & & X \\ \hline
\end{tabular}
\renewcommand*\rot{\multicolumn{1}{R{60}{1em}}}% no optional argument here, please!
\begin{tabular}{r|ccc}
&
\rot{Property 1} &
\rot{Property 2} &
\rot{Property 3}
\\ \hline
System 1 & & & X \\
System 2 & X & X & X \\
System 3 & X & & X \\ \hline
\end{tabular}
\renewcommand*\rot[2]{\multicolumn{1}{R{#1}{#2}}}% no optional argument here, please!
\begin{tabular}{r|ccc}
&
\rot{90}{1em}{Property 1} &
\rot{60}{1em}{Property 2} &
\rot{45}{2em}{Property 3}
\\ \hline
System 1 & & & X \\
System 2 & X & X & X \\
System 3 & X & & X \\ \hline
\end{tabular}
\end{document}
Best Answer
I once used something like the following code. Because perpendicular lines don't work well in this example I have added different styles to cross out columns.
It can also cross out rows but there I have not implemented different styles.
table-strikethrough.tex:
main.tex:
The two files should be located in the same directory.
I have formatted the table in compliance with the recommendations from the booktabs package (section 2 The layout of formal tables, page 3):
Also I have used siunitx'
S
column type to align the numbers.You can customize the visual appearance by redefining the following commands:
\strikethroughcolor
\strikethroughwidth
\strikethroughCrossWidth
or calling the following commands:
\strikethroughColumnStylePerpendicular
\strikethroughColumnStyleDiagonal
\strikethroughColumnStyleCounterdiagonal
\strikethroughColumnStyleCross
I have seen your comment that you just want to cross out the column $m_3=50$ but I have crossed out one more just to show how easy it would be to cross out more.
Please note that I have splitted up the first column in two to align the numbers therefore the column indices differ from what one might expect at first glance.
Adding something visual to every row (like with
\newcolumntype{=}{@{${}={}$}}
which would have been great here) would not deliver the desired output because I am adding an invisible row above and below where it would then appear, too.