# vertical alignment of a turned cell

I know using turn command and a sample code like this:

\usepackage{rotating}

\begin{turn}{90} Supervised Learning \end{turn}}


we can rotate a text inside a cell, however, I couldn't find a way to vertically center this rotated text. Any suggestions is appreciated.

Here is the sample MWE:

\begin{table}[]
\centering
\begin{tabular}{|>{\centering\arraybackslash}m{0.5cm}|c|>{\centering\arraybackslash}m{8cm}|}
\hline
\multicolumn{2}{|c|}{Classification} & References \\ \hline
%\multirow{2}{*}{{\begin{turn}{90}Supervised Learning\end{turn}}}
\multirow{2}{*}{\rotatebox[origin=c]{90}{Supervised Learning}}
\end{tabular}
\caption{A Classification}
\label{tab:Machine_Learning_models}
\end{table}


• Maybe some here know this package ... however, to other will help a MWE (small complete document, which we can compile), which will show your problem. – Zarko Aug 28 '16 at 18:57
• my bad, it was called rotating – Amir Aug 28 '16 at 19:16
• I have updated the question with a MWE – Amir Aug 28 '16 at 19:36
• Your subject and objective of your updated question is radically different from what you asked originally. Instead of editing an existing question and changing its content dramatically, you should consider leaving the original query unchanged and posting a second, new query to address the new subject material. If nothing else, this approach would avoid rendering the answer that was addressed the initial version of your query meaningless and inapplicable. – Mico Aug 28 '16 at 19:47
• My question was on how to vertically center a rotated text and my question is still that one. – Amir Aug 28 '16 at 19:56

since your question seems to be unstable system ... i'm afraid that my answer will miss your point as it was Mico answer (which finish with deletion) :-( )

anyway, for exercise:

• your rotated text is taller than rest of table, so it can not bo properly centered
• easier way to rotate cell content is use \rothead macro from makecell package (for which you need to define cell height)
• vertically centering in multirow cell needs some manual tweaking

with this (and expand the table) I obtain the following result:

MWE:

\documentclass{article}
\usepackage{rotating}
\usepackage{array,makecell,multirow}

\begin{document}
\begin{table}[htb]
\centering
\begin{tabular}{| l | c |
>{\centering\arraybackslash}p{8cm}|}
\hline
\multicolumn{2}{|c|}{Classification}    &   References  \\ \hline
&                               &  1            \\ \cline{2-3}
&                               &  2            \\ \cline{2-3}
&                               &  3            \\ \cline{2-3}
&                               &  4            \\ \cline{2-3}
&                               &  5            \\ \cline{2-3}
&                               &  6            \\ \cline{2-3}
&                               &  7            \\ \cline{2-3}
&                               &  8            \\ \hline                \end{tabular}
\caption{A Classification}
\label{tab:Machine_Learning_models}
\end{table}
\end{document}


Addendum: Font size of text in \rothead is determined by \headfont macro. Default value is \footnotesize. It can be changed by

\renewcommand\theadfont{\normalsize}


(or whatever size, font family and shape you like). Considering above change of font size, the relvant part of MWE become:

\documentclass{article}
\usepackage{rotating}
\usepackage{array,makecell,multirow}

\begin{document}
\begin{table}[htb]
\centering
\begin{tabular}{| l | c |
>{\centering\arraybackslash}p{8cm}|}
\hline
\multicolumn{2}{|c|}{Classification}    &   References  \\ \hline

• Thanks for suggesting makecell package. Could you ellaborate more on the \settowidth\rotheadsize{Supervised Learning} and that [1.5ex] in the command. – Amir Aug 28 '16 at 20:51
• all is explained in answer ...\settowidth\rotheadsize{Supervised Learning} determine the length of text, which rotated should fit into cell. i.e. determine cell height. [1.ex] in multirow is manual adjustment of vertical position of cell content. sorry, i do not understand the second comment. which size is reduced? if you like to have table width equal to text width (i guessing) than the best way to achieve this is use of tabularx instead of table where instead p{...} you use X column type. – Zarko Aug 28 '16 at 21:06
• Thanks @Zarko. My 2nd question was about the text of the {Supervised Learning} is now being reduced in font size despite having enough of space in the column. The vertical alignment is OK now after manually setting [1.ex] – Amir Aug 29 '16 at 13:00
• Indeed, the fonts for vertical text is smaller. It is defined by \theadfont which default size is \footnotesize. to increase it you need to add \renewcommand\theadfont{\normalsize}( or whatever size, font family and shape you like). I will edit my answer. – Zarko Aug 29 '16 at 13:52