# New paragraph in table with rotated box

I'd like to have a new line in a rotated box in a tabular environment. MWE as follows:

\documentclass[english]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{microtype}
\usepackage{lmodern}
\usepackage{graphicx}

\begin{document}

\begin{tabular}{p{5cm} | p{5cm}}
A & B \\
Here it \newline works & \rotatebox{90}{Here it \newline doesn‘t} \\
\end{tabular}

\end{document}


• For more than one line, you can put a \parbox inside the \rotatebox. Or use varwidth or (as in Mico's answer) a tabular. – John Kormylo Mar 19 at 15:57

The contents of the second argument of \rotatebox is subject to some restrictive assumptions regarding possible content. That's why the approach you tried in your query doesn't quite "work".

A flexible solution is to define a custom tabular environment and to employ it in the second argument of \rotatebox. This is done in the following example.

\documentclass[english]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{microtype,array,lmodern,graphicx}
\newcommand\mytab[1]{\begin{tabular}[t]{c}#1\end{tabular}}
\newcommand\rotbox[1]{\rotatebox[origin=c]{90}{\mytab{#1}}}

\begin{document}

\begin{tabular}{|p{5cm}|>{\centering\arraybackslash}p{5cm}|}
\hline
A & B \\
\hline
Here it \newline works & \rotbox{Here it\\does too} \\
\hline
\end{tabular}

\end{document}