2

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 Answer 1

2

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

2
  • 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
    Commented Aug 12, 2013 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. Commented Aug 12, 2013 at 14:30

You must log in to answer this question.

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