How do I split a cell diagonally, when I'm using tabularx
with X
column, i.e. \begin{tabularx}{\textwidth}{X}
?
I've seen many answers on this topic on TeX.SE, but none of them are applicable to cells with a fluid width (X column).
I've currently solved my problem by using the diagbox
package with a hard-coded width (found through trial-and-error). However, I would like to know how to solve it properly, i.e. a way to achieve the diagonal split without knowing the dimensions of the cell in advance.
This is my current code, demonstrating the visually desired result, achieved by hard-coding the width of the backslashbox
.
\documentclass{standalone}
\usepackage{tabularx}
\usepackage{diagbox}
\begin{document}
\begin{tabularx}{\textwidth}{|X|c|c|c|}
\hline
\backslashbox[92mm]{Task}{Question} & 1 & 2 & 3\\
\hline
What? & Yes & Yes & Yes \\
\hline
\end{tabularx}
\end{document}
Result:
Best Answer