[Tex/LaTex] Bottom table alignment for rotated column headers

longtablerotating

I've been struggling to appropriately align rotated text using longtable, array and rotating packages. I basically want column headers to be aligned at the bottom, however, LaTeX centres them even after issuing an explicit ragged directives.

\documentclass[a4paper,10pt]{report}

\usepackage{longtable}
\usepackage{multirow}
\usepackage{array}
\usepackage{rotating}

\begin{document}

\begin{longtable}{
>{\centering\arraybackslash}m{0.010\linewidth}|
>{\arraybackslash}m{0.60\linewidth}|
>{\arraybackslash}m{0.010\linewidth}|
>{\arraybackslash}m{0.010\linewidth}|
>{\arraybackslash}m{0.010\linewidth}|
>{\arraybackslash}m{0.010\linewidth}|
>{\arraybackslash}m{0.010\linewidth}|
>{\arraybackslash}m{0.010\linewidth}|
>{\arraybackslash}m{0.010\linewidth}}

\caption{Minimal Example Table}
\label{tab:minimal-example:the-table} \\
 \cline{3-9}
 \multicolumn{1}{c}{} &
 \multicolumn{1}{c|}{} &
 \begin{sideways}\textbf{Column 1}\end{sideways} &
 \begin{sideways}\textbf{Column 2}\end{sideways} &
 \begin{sideways}\textbf{Column 3}\end{sideways} &
 \begin{sideways}\textbf{Column 4}\end{sideways} &
 \begin{sideways}\textbf{Long Column 1}\end{sideways} &
 \begin{sideways}\textbf{Column 5}\end{sideways} &
 \begin{sideways}\textbf{Column 6}\end{sideways}\\
 \cline{1-9}
 \endfirsthead
 \caption[]{(continued)}\\
 \cline{3-9}
 \multicolumn{1}{c}{} &
 \multicolumn{1}{c|}{} &
 \begin{sideways}\textbf{Column 1}\end{sideways} &
 \begin{sideways}\textbf{Column 2}\end{sideways} &
 \begin{sideways}\textbf{Column 3}\end{sideways} &
 \begin{sideways}\textbf{Column 4}\end{sideways} &
 \begin{sideways}\textbf{Long Column 1}\end{sideways} &
 \begin{sideways}\textbf{Column 5}\end{sideways} &
 \begin{sideways}\textbf{Column 6}\end{sideways}\\
 \cline{1-9}
 \endhead

 % Page footer
 \cline{1-9}
 \multicolumn{9}{c}{(Continued on next page)} \\
 \endfoot

 % Last page footer
 %\bottomrule
 \endlastfoot

 \multirow{3}{*}{\begin{sideways}\textbf{R1}\end{sideways}} &
 {Place holder text....}&
 {}&
 {}&
 {}&
 {}&
 {X}&
 {}&
 {}\\

 \cline{2-9}

 {}&
 {Place holder text....}&
 {}&
 {X}&
 {X}&
 {}&
 {X}&
 {X}&
 {X}\\

 \cline{1-9}

 \multirow{3}{*}{\begin{sideways}\textbf{R2}\end{sideways}} &
 {Place holder text....}&
 {}&
 {}&
 {}&
 {}&
 {X}&
 {}&
 {}\\

 \cline{2-9}

 {}&
 {Place holder text....}&
 {}&
 {X}&
 {X}&
 {}&
 {X}&
 {X}&
 {X}\\

  \cline{2-9}

 {}&
 {Place holder text....}&
 {}&
 {X}&
 {X}&
 {}&
 {X}&
 {X}&
 {X}\\

 \cline{1-9}

\end{longtable}

\end{document}

Best Answer

You have impossibly narrow columns widths specified, and the rotated text was centred because of the m column specifier.

I would use something like the following although I note you added a comment saying you need to specify columns so you could switch c back to >{\centering\arraybackslash}p{...} for some width.

also rotating package is mainly for compatibility with a latex2.09 package of the same name it is just a wrapper around the standard latex rotation functions, so it is simpler just to use that.

enter image description here

\documentclass[a4paper,10pt]{report}

\usepackage{longtable}
\usepackage{multirow}
\usepackage{array}
\usepackage{rotating}

\begin{document}
\setlength\extrarowheight{3pt}
\begin{longtable}{
c|l|
*{7}{c|}}
\caption{Minimal Example Table}
\label{tab:minimal-example:the-table} \\
 \cline{3-9}
 \multicolumn{1}{c}{} &
 \multicolumn{1}{c|}{} &
 \rotatebox{90}{\textbf{Column 1 }} &
 \rotatebox{90}{\textbf{Column 2 }} &
 \rotatebox{90}{\textbf{Column 3 }} &
 \rotatebox{90}{\textbf{Column 4 }} &
 \rotatebox{90}{\textbf{Long Column 1 }} &
 \rotatebox{90}{\textbf{Column 5 }} &
 \rotatebox{90}{\textbf{Column 6 }}\\
 \cline{1-9}
 \endfirsthead
 \caption[]{(continued)}\\
 \cline{3-9}
 \multicolumn{1}{c}{} &
 \multicolumn{1}{c|}{} &
 \rotatebox{90}{\textbf{Column 1}} &
 \rotatebox{90}{\textbf{Column 2}} &
 \rotatebox{90}{\textbf{Column 3}} &
 \rotatebox{90}{\textbf{Column 4}} &
 \rotatebox{90}{\textbf{Long Column 1}} &
 \rotatebox{90}{\textbf{Column 5}} &
 \rotatebox{90}{\textbf{Column 6}}\\
 \cline{1-9}
 \endhead

 % Page footer
 \cline{1-9}
 \multicolumn{9}{c}{(Continued on next page)} \\
 \endfoot

 % Last page footer
 %\bottomrule
 \endlastfoot

 \multirow{3}{*}{\rotatebox{90}{\textbf{R1}}} &
 {Place holder text....}&
 {}&
 {}&
 {}&
 {}&
 {X}&
 {}&
 {}\\

 \cline{2-9}

 {}&
 {Place holder text....}&
 {}&
 {X}&
 {X}&
 {}&
 {X}&
 {X}&
 {X}\\

 \cline{1-9}

 \multirow{3}{*}{\rotatebox{90}{\textbf{R2}}} &
 {Place holder text....}&
 {}&
 {}&
 {}&
 {}&
 {X}&
 {}&
 {}\\

 \cline{2-9}

 {}&
 {Place holder text....}&
 {}&
 {X}&
 {X}&
 {}&
 {X}&
 {X}&
 {X}\\

  \cline{2-9}

 {}&
 {Place holder text....}&
 {}&
 {X}&
 {X}&
 {}&
 {X}&
 {X}&
 {X}\\

 \cline{1-9}

\end{longtable}

\end{document}
Related Question