[Tex/LaTex] How to rotate text in table

rotatingtables

How to rotate text in columns?

\documentclass{article}

\usepackage{rotating}
\usepackage{colortbl}
\usepackage{multirow}
\usepackage[table]{xcolor}

\begin{document}

\begin{table}[h]
\centering
    \begin{tabular}{l|l|llll|llll|l}
        \multicolumn{11}{c}{{\cellcolor[HTML]{EFEFEF}}Dataset} \\
        \multicolumn{1}{l}{} & \begin{sideways}\end{sideways} & \multicolumn{2}{c}{training} & \multicolumn{2}{c|}{validation} &  \multirow{2}{*}{\rotatebox[origin=c]{90}{BatchSize}} & \multirow{2}{*}{\rotatebox[origin=c]{90}{RandBat}} & \multirow{2}{*}{\rotatebox[origin=c]{90}{Loss$\mathcal{L}$}} & \multirow{2}{*}{\rotatebox[origin=c]{90}{\#Params}} & 
        \multirow{2}{*}{\rotatebox[origin=c]{90}{ Runtime}} \\
        \multicolumn{2}{l|}{Methods} & acc & auc & acc & auc &  &  &  &  &  \\ 
        \hline
        Ours & Direct & 94.17 & 98 & 84.86 & 72 & 1 & & CE &  & \\
             & Corr+Conv & 86.13 & 50 & 88.20 &  50 & 1 & & CE &  & \\
             & Corr+Convd & 73.30 & 85  & 82.33 & 89 & 4 &x & CE &  & \\
             & Corr+Conv3d+$\mathcal{H}$& 27.19 & 71 & 83.61 & 73 & 4 & x & HL & & \\ \hline
        Others & Net &  &  &  & 88  & 16 & x & CE & 5 Mio. & 
    \end{tabular}
\caption{Experiments}
\end{table}

\end{document}

The current result looks like that:

enter image description here

Best Answer

A proposition with makecell and the optional arguments of \raisebox:

\documentclass{article}

\usepackage{rotating}
\usepackage{colortbl}
\usepackage{multirow}
\usepackage[table]{xcolor}
\usepackage{makecell}
\newcommand{\myrotcell}[1]{\rotcell{\makebox[0pt][l]{#1}}}

\begin{document}

\begin{table}[h]
\centering\settowidth{\rotheadsize}{Batchs}
    \begin{tabular}{l|l|*{2}{llll|}l}
        \multicolumn{11}{c}{{\cellcolor[HTML]{EFEFEF}}Dataset} \\
        \multicolumn{1}{l}{} & \begin{sideways}\end{sideways} & \multicolumn{2}{c}{\raisebox{-3ex}[0pt][0pt] {training}} & \multicolumn{2}{c|}{\raisebox{-3ex}[0pt][0pt] {validation}}& & & & & \\
        \multicolumn{2}{l|}{Methods} & acc & auc & acc & auc & \myrotcell{BatchSize} & \myrotcell{RandBat} & \myrotcell{Loss$\mathcal{L}$} & \myrotcell{\#Params} & \myrotcell{ Runtime} \\[-1ex]
        \hline
        Ours & Direct & 94.17 & 98 & 84.86 & 72 & 1 & & CE & & \\
             & Corr+Conv & 86.13 & 50 & 88.20 & 50 & 1 & & CE & & \\
             & Corr+Convd & 73.30 & 85 & 82.33 & 89 & 4 &x & CE & & \\
             & Corr+Conv3d+$\mathcal{H}$& 27.19 & 71 & 83.61 & 73 & 4 & x & HL & & \\ \hline
        Others & Net & & & & 88 & 16 & x & CE & 5 Mio. &
    \end{tabular}
\caption{Experiments}
\end{table}

\end{document}%
\multirow{2}{*}

enter image description here