# Gap under the title row when designing a table with diagonale title

I'm trying to make a table with diagonale titles. For this, I used some functions from the answer from Heiko Oberdiek in the post Special Table with Diagonal lines

I create the following functions by using the Heiko's proposition and modify it in order to have a line up and down, multiline support and the capability to increase the angle selection:

\usepackage{makecell}
\newcolumntype{M}{>{\centering\arraybackslash}m{3mm}}

\renewcommand*{\arraystretch}{1.5}%

\newcommand*{\vcorr}{%
\global\let\vcorr\relax
}%
\multicolumn{#2}{@{}#3@{}}{%
\vcorr
\sbox4{\kern\tabcolsep\redtriangle\kern\tabcolsep}%
\sbox6{\rotatebox{#4}{\rule{0pt}{\dimexpr\ht0+\dp0\relax}}}%
\sbox0{\raisebox{0.25\dimexpr\dp0-\ht0\relax}[0pt][0pt]{\unhcopy0}}%

\dimen0=\dimexpr\wd2+0.5\wd4\relax
\rlap{\rotatebox{#5}{\hbox{\vrule width\dimen0 height .4pt}}}%
\fi
\kern.75\wd4 %

\rlap{%
\raisebox{.1\wd4}{\rotatebox{#4}{\unhcopy0}}%
}%

\kern.25\wd4 %
\rlap{\rotatebox{#5}{\hbox{\vrule width\dimen0 height .4pt}}}%
\fi
}%
}%


And I create my table in a separate tex file thanks the following:

\documentclass[./main.tex]{subfiles}

\begin{document}

\begin{tabular}{%
>{\bfseries}rM|M|M|M|M|M|M|M|M|M|M%
}%
& \headmulti{\thead{$n^{th}$ - Flight Conditions}}{5}
\\
\toprule
\sbox0{S}%
\rule{0pt}{\dimexpr\ht0 + 2ex\relax}%
Repercussion Phase
& {\cellcolor{blue!25}}  & \cellcolor{gray!25}\greencheck
&\greencheck &\greencheck & \greencheck
&\greencheck & \greencheck &  \cellcolor{gray!25}\greencheck
& {\cellcolor{blue!25}}\\
\hline
S1 Detection
& {\cellcolor{blue!25}}  & \cellcolor{gray!25}\redtriangle
& \redtriangle & \redtriangle & \redtriangle
& \redtriangle & \redtriangle &  \cellcolor{gray!25}\redtriangle
& {\cellcolor{blue!25}}\\
\hline
Risk Time
& {\cellcolor{blue!25}}  & \cellcolor{gray!25}\greencheck
&\greencheck & \greencheck & \greencheck
&\greencheck&\greencheck&  \cellcolor{gray!25}\greencheck
& {\cellcolor{blue!25}}\\
\hline
\multicolumn{3}{c|}{\multirow{2}{*}{Time(s)}}
& \multicolumn{5}{c|}{$t_0$}\\
\cline{3-9}
\multicolumn{2}{c|}{} & \multicolumn{7}{c|}{Mainteance Time $MT_1$} \\
\cline{3-9}
\end{tabular}%
\kern19.5mm
\newline
\begin{tabular}{%
*{2}{c|}c%
}%
&
&
&
&
\\
\sbox0{S}%
\rule{0pt}{\dimexpr\ht0 + 2ex\relax}%
StreamIt & \textcolor{tabred}{\bfseries 1} &&
\redtriangle & \redtriangle & & & &&
\greenbullet & \greenbullet & \orangecirc & \greenbullet & &&
\greenbullet & \greenbullet & \greenbullet
\\\hline
StreamC/KernelC & \textcolor{tabred}{\bfseries 1} &&
& & & & \redtriangle &&
\greenbullet & \greenbullet & & \greenbullet & &&
\greenbullet & &
\\\hline
SDF & \textcolor{tabred}{\bfseries 1} &&
& \redtriangle & & & &&
\greenbullet & \greenbullet & \greenbullet & & &&
& \greenbullet & \greenbullet
\\\hline
MDSDF & \textcolor{tabgreen}{\bfseries\itshape n} &&
& \redtriangle & & \redtriangle & &&
\greenbullet & \greenbullet & \greenbullet & & &&
\greenbullet & \greenbullet & \greenbullet
\\\hline
ArrayOL & \textcolor{tabgreen}{\bfseries\itshape n} &&
& \redtriangle & & \redtriangle & &&
\greenbullet & \greenbullet & \orangecirc & & &&
\greenbullet & \greenbullet & \greenbullet
\\\hline
Brook & \textcolor{tabgreen}{\bfseries\itshape n} &&
& & & & \redtriangle &&
& \greenbullet & & & &&
\greenbullet & &
\\\hline
Sequoia & \textcolor{tabgreen}{\bfseries\itshape n} &&
& & \redtriangle & \redtriangle & \redtriangle &&
& & & & &&
\greenbullet & &
\\\hline
\rowcolor{tabyellow}%
Block-parallel & \textcolor{tabbrown}{\bfseries 2} &&
& \redtriangle & & & &&
\greenbullet & \greenbullet & \orangecirc & \greenbullet &
\greenbullet &&
\greenbullet & \greenbullet & \greenbullet
\\[.5ex]
\multicolumn{3}{c}{} &
\multicolumn{5}{c}{\bfseries Limitations} &&
\multicolumn{5}{c}{\bfseries Features} &&
\multicolumn{3}{c}{\bfseries Parallelism}
\\
\end{tabular}%
\kern19.5mm % manually with the help of the next \vrule
% \vrule height 50mm
\end{document}


Except for the gap between the title row and the first data raw, it is working great (not so bad for a beginner...).

Do you know I can reduce / delete this Gap between the first rows??.

I try to modify several parameters, but unefortunately, it does nothing. I think the problem is in vcorr,

\newcommand*{\vcorr}{%
\global\let\vcorr\relax
}


I don't understand the behavior, nor the goal of @arstrutbox. In fact, I found very few information about it...

Furthermore if someone can explain me how I could push my horizontal text in multiline...? Think, I will have to use some cosinus and sinus function to do a perfect behavior...

• Welcome to TeX.SX! booktabs rules (\toprule and the like) don't go along with vertical rules. – egreg Feb 4 '18 at 22:53

You have to use the \specialrule command, with a padding above and below equal to 0pt to remove the gape. I took the liberty to replace the \head commands with a simpler (in my opinion) \myrothead command, which makes the column heads have zero width, and a \rotatebox{45}{{\phantom{longest head}} to compensate for the vertical spacing.

Note the second table is too large to fit on the page, so perhaps you should consider swapping rows and columns:

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage[T1]{fontenc}
\usepackage{booktabs, multirow}
\usepackage[table]{xcolor}
\usepackage{rotating, graphicx}
\usepackage{amsmath, amssymb}
\usepackage{bbding}
\newcommand*{\redtriangle}{\ensuremath{\color{red}{\triangle}}}
\newcommand*{\greencheck}{\ensuremath{\color{green}{\XSolidBrush}}}
\newcommand*{\greenbullet}{\color{green}{\textbullet}}
\newcommand*{\orangecirc}{\ensuremath{\color{orange}{\circ}}}
\colorlet{tabred}{red}
\colorlet{tabgreen}{green}
\colorlet{tabyellow}{yellow}
\colorlet{tabbrown}{brown}

\usepackage{makecell}
\newcolumntype{M}{>{\centering\arraybackslash}m{3mm}}

\renewcommand*{\arraystretch}{1.5}%

\usepackage{lipsum}
\begin{document}
\lipsum[2]
\renewcommand{\cellrotangle}{45}
\begin{tabular}{%
>{\bfseries}rM|M|M|M|M|M|M|M|M|M|M%
}%
& \multicolumn{5}{c}{\thead[b]{$n^\text{th}$ - Flight Conditions}}{5}
\\
\sbox0{S}%
\rule{0pt}{\dimexpr\ht0 + 2ex\relax}%
Repercussion Phase
& {\cellcolor{blue!25}} & \cellcolor{gray!25}\greencheck
&\greencheck &\greencheck & \greencheck
&\greencheck & \greencheck & \cellcolor{gray!25}\greencheck
& {\cellcolor{blue!25}}\\
\hline
S1 Detection
& {\cellcolor{blue!25}} & \cellcolor{gray!25}\redtriangle
& \redtriangle & \redtriangle & \redtriangle
& \redtriangle & \redtriangle & \cellcolor{gray!25}\redtriangle
& {\cellcolor{blue!25}}\\
\hline
Risk Time
& {\cellcolor{blue!25}} & \cellcolor{gray!25}\greencheck
&\greencheck & \greencheck & \greencheck
&\greencheck&\greencheck& \cellcolor{gray!25}\greencheck
& {\cellcolor{blue!25}}\\
\hline
\multicolumn{3}{c|}{\multirow{2}{*}{Time(s)}}
& \multicolumn{5}{c|}{$t_0$}\\
\cline{3-9}
\multicolumn{2}{c|}{} & \multicolumn{7}{c|}{Maintenance Time $MT_1$} \\
\cline{3-9}
\end{tabular}%
\kern19.5mm
\newline
\begin{tabular}{%
*{2}{c|}c%
}%
&
&
&
&
\\
\sbox0{S}%
\rule{0pt}{\dimexpr\ht0 + 2ex\relax}%
StreamIt & \textcolor{tabred}{\bfseries 1} &&
\redtriangle & \redtriangle & & & &&
\greenbullet & \greenbullet & \orangecirc & \greenbullet & &&
\greenbullet & \greenbullet & \greenbullet
\\\hline
StreamC/KernelC & \textcolor{tabred}{\bfseries 1} &&
& & & & \redtriangle &&
\greenbullet & \greenbullet & & \greenbullet & &&
\greenbullet & &
\\\hline
SDF & \textcolor{tabred}{\bfseries 1} &&
& \redtriangle & & & &&
\greenbullet & \greenbullet & \greenbullet & & &&
& \greenbullet & \greenbullet
\\\hline
MDSDF & \textcolor{tabgreen}{\bfseries\itshape n} &&
& \redtriangle & & \redtriangle & &&
\greenbullet & \greenbullet & \greenbullet & & &&
\greenbullet & \greenbullet & \greenbullet
\\\hline
ArrayOL & \textcolor{tabgreen}{\bfseries\itshape n} &&
& \redtriangle & & \redtriangle & &&
\greenbullet & \greenbullet & \orangecirc & & &&
\greenbullet & \greenbullet & \greenbullet
\\\hline
Brook & \textcolor{tabgreen}{\bfseries\itshape n} &&
& & & & \redtriangle &&
& \greenbullet & & & &&
\greenbullet & &
\\\hline
Sequoia & \textcolor{tabgreen}{\bfseries\itshape n} &&
& & \redtriangle & \redtriangle & \redtriangle &&
& & & & &&
\greenbullet & &
\\\hline
\rowcolor{tabyellow}%
Block-parallel & \textcolor{tabbrown}{\bfseries 2} &&
& \redtriangle & & & &&
\greenbullet & \greenbullet & \orangecirc & \greenbullet &
\greenbullet &&
\greenbullet & \greenbullet & \greenbullet
\\[.5ex]
\multicolumn{3}{c}{} &
\multicolumn{5}{c}{\bfseries Limitations} &&
\multicolumn{5}{c}{\bfseries Features} &&
\multicolumn{3}{c}{\bfseries Parallelism}
\\
\end{tabular}%
\kern19.5mm % manually with the help of the next \vrule
% \vrule height 50mm

\end{document}


• Thakns Bernard for the proposition. I would like to keep the borders around the text set in the first row. I try to add the | , but it generates vertical lines and not 45deg lines... :( I add the \specialrule... but it changes nothing. – Dede Vince Feb 5 '18 at 22:33
• @DedeVince: I'm afarid I don't see what you mean: the table I Ihave here is the same as the table produced by the code you posted, after I've completed it to make it compilable. Could you explain more what you want exactly? Or maybe post an image of the result you obtain? – Bernard Feb 5 '18 at 22:55
• On my initial view <img src="i.stack.imgur.com/Ahcdk.png">, the column titles are set with 45° lines separator. Unfortunately, I can't create such 45deg lines with your proposition. When I used the traditional | to create the vertical separator, I have a vertical line, crossing the text of the first line... I try to use the specialrule, but the gap remains. – Dede Vince Feb 7 '18 at 22:36
• Did you try with the \specialrule command, (I suppressed all no vertical padding around the rule)? – Bernard Feb 7 '18 at 22:58
• Yes.... :) Did it, I don't know why ny first tries with specialrule where not concluant, but now it is. I will provide my code latter, now I need to go work :( Thanks @Bernard – Dede Vince Feb 8 '18 at 22:59

Thanks @Bernard, I modify the code. Here, the code used for the head description

\usepackage{pifont}
\usepackage{makecell}
\newcolumntype{M}{>{\centering\arraybackslash}m{3mm}}
\renewcommand*{\arraystretch}{1.5}
\multicolumn{#2}{@{}#3@{}}{%
\sbox4{\kern\tabcolsep\redtriangle\kern\tabcolsep}%
\sbox0{\raisebox{0.25\dimexpr\dp0-\ht0\relax}[0pt][0pt]{\unhcopy0}}%
\dimen0=\dimexpr\wd2+0.5\wd4\relax
\rlap{\rotatebox{#5}{\hbox{\vrule width\dimen0 height .4pt}}}%
\fi
\kern.75\wd4 %
\rlap{%
\raisebox{0.1\wd4}{\rotatebox{#4}{\unhcopy0}}%
}%
\kern.25\wd4 %
\rlap{\rotatebox{#5}{\hbox{\vrule width\dimen0 height .4pt}}}%
\fi
}%
}%


And I create the table thanks the following lines:

\begin{tabular}{%
>{\bfseries}rM|M|M|M|M|M|M|M|M|M|M%
}%

& \headmulti{\thead{$n^{th}$ - Flight Conditions}}{5}
Repercussion Phase
& {\cellcolor{blue!25}}  & \cellcolor{gray!25}\greencheck
&\greencheck &\greencheck & \greencheck
&\greencheck & \greencheck &  \cellcolor{gray!25}\greencheck
& {\cellcolor{blue!25}}\\
\hline
S1 Detection
& {\cellcolor{blue!25}}  & \cellcolor{gray!25}\redtriangle
& \redtriangle & \redtriangle & \redtriangle
& \redtriangle & \redtriangle &  \cellcolor{gray!25}\redtriangle
& {\cellcolor{blue!25}}\\
\hline
Risk Time
& {\cellcolor{blue!25}}  & \cellcolor{gray!25}\greencheck
&\greencheck & \greencheck & \greencheck
&\greencheck&\greencheck&  \cellcolor{gray!25}\greencheck
& {\cellcolor{blue!25}}\\
\hline
\multicolumn{3}{c|}{\multirow{2}{*}{Time(s)}}
& \multicolumn{5}{c|}{$t_0$}\\
\cline{3-9}
\multicolumn{2}{c|}{} & \multicolumn{7}{c|}{Mainteance Time $MT_1$} \\
\cline{3-9}
\end{tabular}%


The {\heavyrulewidth}{-5.5pt}{0pt}... should be tune manually to avoid the gap between the head and the subpart of the table.