I've been trying to get a diagonally-split table header using the diagbox
package, but I have a problem.
Here's a working sample that shows the problem:
\documentclass[12pt, a4paper, twoside]{article}
\usepackage{diagbox} %table split headers
\usepackage{longtable}
\usepackage{array}
\usepackage{rotating}
\newcommand{\tabred}{-4pt}
\newcommand*\rot{\rotatebox{90}}
\begin{document}
\begin{longtable}{
| l<{\hspace{\tabred}}
| >{\hspace{\tabred}}c<{\hspace{\tabred}}
| >{\hspace{\tabred}}c<{\hspace{\tabred}}
| >{\hspace{\tabred}}c<{\hspace{\tabred}}
| >{\hspace{\tabred}}c<{\hspace{\tabred}}
| >{\hspace{\tabred}}c<{\hspace{\tabred}}
| >{\hspace{\tabred}}c<{\hspace{\tabred}}
|}
\hline
\diagbox[dir=NW]{Feature}{Tool} & %THIS IS THE PROBLEM!
\rot{Tool Alpha} &
\rot{Tool Delta} &
\rot{Tool Gamma} &
\rot{Tool Theta} &
\rot{Tool Upsilon} &
\rot{\textbf{Tool X (our proposal) }}\\
%\midrule
\hline
Feature A - Fooing the Bar & NO & NO & NO & NO & OK & OK\\
Feature B - Barring the Foo & OK & NO & OK & NO & NO & OK\\
\hline
\end{longtable}
\end{document}
The problem is that, since I rotate the headers, they are very tall. As you can see from the image below, this ruins the alignment of the diagonal line:
As you can see, there are two problems: the north-west end of the diagonal line doesn't touch the north-west corner of the box, and the south-east end of the diagonal line doesn't touch the south-east corner.
With the answer posted here: https://tex.stackexchange.com/a/215370/45766 I've been able to use \rule
to fix one of the angles, but never both. No matter what I try, the spacing screws up.
Any ideas?
Best Answer
I propose to make the last rotated header two-lined. This is possible with the
\rothead
and\rotcell
commands frommakecell
* also use the keysheight=
andwidth=
fromdiagbox
. The width is set with the help of teeqparbox
package, witheqboxwidth
length. Finally I replaced your\tabred
command with changing the value off\tabcolsep
.