1

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 :)

1

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

  • Thank you for your reply, it helped me a little. However, can you add how to make my row title on 2 separated lines please? I tried to do it by adding `\\`on the title but it did not work ? Why not ? hurtauda – hurtauda Aug 12 '13 at 13:30
  • @user2551001 See revision. I reversed parbox and rotatebox. Also, I added extra parbox width to force result onto 2, not three lines. – Steven B. Segletes Aug 12 '13 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.