I would like to create a Latex table with a line on the main diagonal. My problem: diagbox does not calculate the height in the right way for multirow fields. A small example:
\documentclass[a4paper]{article}
\usepackage{calc}
\usepackage{diagbox}
\begin{document}
\begin{tabular}{p{\textwidth*1/7}*{3}{|p{\textwidth*1/7}}}
\diagbox[innerwidth=\textwidth*1/7]{from}{to} & item1 & item2 & item3 \\\hline
item1 & \diagbox[innerwidth=\textwidth*1/7]{~}{~} & --- this --- is --- a --- very --- long --- multirow --- text --- & \\\hline
item2 & & \diagbox[innerwidth=\textwidth*1/7]{~}{~} & \\\hline
item3 & & & \diagbox[innerwidth=\textwidth*1/7]{~}{~}
\end{tabular}
\end{document}
How can I connect the diagonal lines?
Greeting, Patrick
Best Answer
I don't know why if you use
height=...
option of\diagbox
the text of the following multiline cell is shifted down, but you can work around it adding a\vspace{-...}
to bring it up again.However, I suggest to you to redesign your table with no vertical rules, no diagonal boxes, and em-dashes as text of the cells on the diagonal.