I am trying to make a table where the column label is rotated 90 degrees, I found some code online (see below) and almost got where I wanted. However the lines are not running up completely so column labels are not well separated, also some table "walls" are missing, I would like to fix this issues. Please note there should be a big blank cell (i.e. no walls) in the upper-left side of the table. Any help is very much appreciated.
\documentclass[12pt]{article}
\usepackage{answers}
\usepackage{multicol}
\usepackage{adjustbox}
\usepackage[table,x11names]{xcolor}
\usepackage{float}
\usepackage[utf8]{inputenc}
\usepackage{caption}
\usepackage{array}
\newcolumntype{?}{!{\vrule width 2pt}}
\usepackage[spanish, es-tabla]{babel}
\makeatletter
\renewcommand{\@seccntformat}[1]{}
\makeatother
\setlength\parindent{24pt}
\newcolumntype{R}[2]{%
>{\adjustbox{angle=#1,lap=\width-(#2)}\bgroup}%
l%
<{\egroup}%
}
\newcommand*\rot{\multicolumn{1}{R{90}{1em}}}% no optional argument here, please!
\begin{document}
\begin{tabular}{r|c|c|c|c|c|}
& \rot{Hello} &
\rot{Hello} &
\rot{Hello} &
\rot{Hello} &
\rot{Hello} \\
\hline
Hello & 0 & 0 & 0 & 0 & 0 \\
\hline
Hello & 0 & 0 & 0 & 0 & 0 \\
\hline
Hello & 0 & 0 & 0 & 0 & 0 \\
\hline
Hello & 0 & 0 & 0 & 0 & 0 \\
\hline
Hello & 0 & 0 & 0 & 0 & 0 \\
\hline
\end{tabular}
\end{document}
R{90}{1em}|
would put the|
back\rot
:\newcommand*\rot[2][90]{\adjustbox{rotate=#1}{#2}}
. The first argument between[]
is optional and = 90 by default, and the second argument is mandatory, e.g.\rot[45]{Hello}
. If it's working, remove the definition ofR{}
.