[Tex/LaTex] tabularx with rotatebox and top-alignment

rotatingtablestabularx

I would like to write a table with column name in a rotatebox.

The problem is that I can't make the row title in 2 lines and rotated and then, the content in itemize is not top-aligned.

Can you help me doing what I want.

Here is my code :

\begin{tabularx}{\textwidth}{|l|X|X|}
    \hline
     & \textbf{column title1} & \textbf{column title2} \\ 
    \hline 
    \parbox{1cm}{\rotatebox{90}{\textbf{title1\\ on 2 lines}}}
    &
    \begin{itemize}
        \item content item1 top aligned.
        \item content item2.
    \end{itemize}
    &
    \begin{itemize}
        \item content item1 top aligned.
        \item content item2.
    \end{itemize} \\ 
    \hline 
     & \textbf{column title1} & \textbf{column title2} \\ 
    \hline
    \parbox{1cm}{\rotatebox{90}{\textbf{title2\\ on 2 lines}}} 
    &
    \begin{itemize}
        \item content item1 top aligned.
        \item content item2.
    \end{itemize}
    &
    \begin{itemize}
        \item content item1 top aligned.
        \item content item2.
    \end{itemize} \\ 
    \hline
\end{tabularx}

Thanks for your replies.

ps: sorry for my English, I'm a french tex user 🙂

Best Answer

The \belowbaseline command pushes its argument to a distance below the baseline, given by the optional argument. In this case, I made it 0ex, but you can change that.

The drop of the normally aligned columns, relative to the top of their cells, is due to the itemize environment.

\documentclass{article}
\usepackage{stackengine}
\usepackage{rotating}
\usepackage{tabularx}
\begin{document}


\begin{tabularx}{\textwidth}{|l|X|X|}
    \hline
     & \textbf{column title1} & \textbf{column title2} \\ 
    \hline 
    \belowbaseline[0ex]{\rotatebox{90}{\parbox{1.7cm}{%
       \raggedright\textbf{title1\\ on 2 lines}}}}
    &
    \begin{itemize}
        \item content item1 top aligned.
        \item content item2.
    \end{itemize}
    &
    \begin{itemize}
        \item content item1 top aligned.
        \item content item2.
    \end{itemize} \\ 
    \hline 
     & \textbf{column title1} & \textbf{column title2} \\ 
    \hline
    \belowbaseline[0ex]{\rotatebox{90}{\parbox{1.7cm}{%
      \raggedright\textbf{title2\\ on 2 lines}}}}
    &
    \begin{itemize}
        \item content item1 top aligned.
        \item content item2.
    \end{itemize}
    &
    \begin{itemize}
        \item content item1 top aligned.
        \item content item2.
    \end{itemize} \\ 
    \hline
\end{tabularx}
\end{document}

enter image description here