I'm pulling my hair with the rendering of table cell borders when using multirow
and multicol
. In the below example, the double-lines in the table's "header" do not extend to the table top, and even more annoying, there is a gap in the top-right corner of the table. Any clues?
\documentclass{article}
\usepackage[utf8x]{inputenc}
\usepackage{multirow}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\begin{tabular}{|l|c||c|c|c|c||c|c|c|c|} \hline \\
\multirow{2}{*}{} & \multirow{2}{*}{\rotatebox{90}{Target}} & \multicolumn{4}{|c||}{Banana} & \multicolumn{4}{|c|}{Pear} \\
& & \rotatebox{90}{Apple 1} & \rotatebox{90}{Apple 2} & \rotatebox{90}{Apple 3} & \rotatebox{90}{Apple 4} & \rotatebox{90}{Apple 1} & \rotatebox{90}{Apple 2} & \rotatebox{90}{Apple 3} & \rotatebox{90}{Apple 4} \\
\hline
Apple 1 & $+$ & & $*$ & $*$ & $*$ & $+$ & & & \\ \hline
Apple 2 & $+$ & $*$ & & $*$ & $*$ & & $+$ & & \\ \hline
Apple 3 & $+$ & $*$ & $*$ & & $*$ & & & $+$ & \\ \hline
Apple 4 & $+$ & $*$ & $*$ & $*$ & & & & & $+$ \\ \hline
\end{tabular}
\end{figure}
\end{document}
Best Answer
Here's an improved alternative:
You've inserted an additional row in the very first line using
\hline \\
. I've just removed the\\
and used some fine-tuning in the\multirow{<rows>}{<width>}[<fine-tune>]{<stuff>}
. That is, pushed the content down1em
.If you really want the empty row (for spacing), you need to complete the row with empty cells in order to have the vertical rules be placed correctly. In that sense, the following provides what you're after:
In order to control the spacing more precisely, you can use the e-TeX
\dimexpr
in the following way:This will "back skip"
\normalbaselineskip
and then "forward skip"\jot
, leaving you with a3pt
(the dimension of\jot
) between the rules.