3

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

3
  • I guess you're looking for this answer.
    – user121799
    Dec 10, 2018 at 17:46
  • \rotatebox[origin=c]{90}{rota} I have exactly from your link. The problem is, that the cell is not expanding/adapting to the text.
    – Peter
    Dec 10, 2018 at 18:21
  • The link says \parbox[t]{2mm}{\multirow{3}{*}{\rotatebox[origin=c]{90}{rota}}}...
    – user121799
    Dec 10, 2018 at 18:57

2 Answers 2

1

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

2

My try:

\begin{table}[h]
\centering
    \begin{tabular}{l|l|llll|llll|l}
        \multicolumn{11}{c}{{\cellcolor[HTML]{EFEFEF}}Dataset} \\
        \multicolumn{1}{l}{} &  & \multicolumn{2}{c}{} & \multicolumn{2}{c|}{}&   &  &  &  & \\
        \multicolumn{1}{l}{} &  & \multicolumn{2}{c}{training} & \multicolumn{2}{c|}{validation}&  \vbox{\hbox{\multirow{2}{0pt}{\rotatebox{90}{BatchSize}}}\vspace{20pt}} 
        & \vbox{\hbox{\multirow{2}{*}{\rotatebox[origin=c]{90}{RandBat}}}\vspace{16pt}} & \vbox{\hbox{\multirow{2}{*}{\rotatebox[origin=c]{90}{Loss$\mathcal{L}$}}}\vspace{3pt}} & \vbox{\hbox{\multirow{2}{*}{\rotatebox[origin=c]{90}{\#Params}}}\vspace{17pt}} & \vbox{\hbox{\multirow{2}{*}{\rotatebox[origin=c]{90}{ Runtime}}}\vspace{15pt}} \\
        \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}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .