Graphics, Figures & Tablesrotating | Bottom Alignment of rotated Content in Table Cell

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
ougka
Posts: 43
Joined: Wed Jan 19, 2011 5:02 pm

rotating | Bottom Alignment of rotated Content in Table Cell

Post by ougka »

Hello all,

I am going crazy with the following.. I've already spent half a day on it. Essentially I have this.

Code: Select all

\documentclass[a4paper,oneside,12pt]{book}
\usepackage{multirow}
\usepackage{rotating}

\begin{document}

\renewcommand{\arraystretch}{1.9}

\begin{table}[!thb]
   \centering{
   \begin{tabular}{|c |l| c |c | c | c | c | c | c | c | c |}
\hline
          \multicolumn{2}{|c|}{\footnotesize{Full support (!) }}  &

       {\multirow{4}{*}{\begin{sideways}\footnotesize{\textbf{Unified Architecture}}                                \end{sideways}}} &
       {\multirow{4}{*}{\begin{sideways}\footnotesize{\textbf{Wang et al.} }           \end{sideways}}}  &
       {\multirow{4}{*}{\begin{sideways}\footnotesize{\textbf{Song et al.}}   \end{sideways}}} &
       {\multirow{4}{*}{\begin{sideways}\footnotesize{\textbf{Lee and Chung} } \end{sideways}}} &
       {\multirow{4}{*}{\begin{sideways}\footnotesize{\textbf{Zrelli et al.}}\end{sideways}}}  &
       {\multirow{4}{*}{\begin{sideways}\footnotesize{\textbf{Fathi et al.} }\end{sideways}}} & {\multirow{4}{*}{\begin{sideways}\footnotesize{\textbf{Heer et al.} }  \end{sideways}}}  &
       {\multirow{4}{*}{\begin{sideways}\footnotesize{\textbf{Kuntz et al.}}           \end{sideways}}} &
       {\multirow{4}{*}{\begin{sideways}\footnotesize{\textbf{Baek et al.} }             \end{sideways}}} \\


          \multicolumn{2}{|c|}{\footnotesize{Some support (-)}}            &      &    &    &    &    &    &    &    &    \\
          \multicolumn{2}{|c|}{\footnotesize{No support ($\times$)}}       &      &    &    &    &    &    &    &    &    \\
          \multicolumn{2}{|c|}{\footnotesize{Unknown (?)}}                 &      &    &    &    &    &    &    &    &    \\ \hline


             \multirow{3}{*}{\begin{sideways}\scriptsize{\textbf{Mobility}}\end{sideways}}
             & Host Mobility	                       & -   & -   & -   & -   & -   & -   & -   & -  & -  \\ \cline{2-11}
             & Single Network Mobility	               & -   & -   & -   & -   & -   & -   & -   & -  & -  \\ \cline{2-11}
			 & Nested Network Mobility	               & -   & -   & -   & -   & -   & -   & -   & -  & -  \\ \hline

		\end{tabular}
    
	\caption{test}
	\label{test}
}
\end{table}
\renewcommand{\arraystretch}{1.0}

\end{document}

that produces this :
rotating-table-sideways.png
rotating-table-sideways.png (19.35 KiB) Viewed 7841 times
What I really want is
  1. to have all the sideway titles of the columns (e.g. Wang et al., Song et al. etc) aligned at the bottom of the cell (and not at the centre as they are now)
  2. have a bit of space on the Unified Architecture title at the top (so that it looks more spacious in the field.
Any ideas?

Thanks a lot!
Last edited by localghost on Tue Nov 27, 2012 10:01 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10322
Joined: Mon Mar 10, 2008 9:44 pm

rotating | Bottom Alignment of rotated Content in Table Cell

Post by Stefan Kottwitz »

Hello ougka!

The code is not so easy to read and to modify, perhaps that's a reason why there was no answer.

LaTeX is a semantic macro language, so it's recommended to do all repeated things by macros, and use semantic markup, not physical markup. For example, don't use \textbf in the text, but define a logical macro such as \headformat, which uses \textbf internally. So it's easy to change the physical formatting in the preamble for the whole document, keeping the logical formatting.

Code: Select all

\newcommand*{\headformat}[1]{\footnotesize\textbf{#1}}
At this occasion, let's save the width of the widest entry in the head, plus a bit more as requested:

Code: Select all

\newlength{\maxlen}
\settowidth{\maxlen}{\headformat{Unified Architecture\ }}
Furthermore, you can define a macro \head which does all those repeated multirow sideways things, plus the desired alignment.

Code: Select all

\newcommand*{\head}[1]{%
  \multirow{4}{*}{
    \begin{sideways}
      \makebox[\maxlen][l]{\headformat{#1}}
    \end{sideways}}}
All of this goes into the preamble. Now the table head becomes pretty clean:

Code: Select all

\begin{tabular}{|c |l| *9{c|}}
\hline
\multicolumn{2}{|c|}{\footnotesize{Full support (!) }}  &
\head{Unified Architecture} & \head{Wang et al.} & \head{Song et al.} & ...
table.png
table.png (31.92 KiB) Viewed 7777 times
Stefan
LaTeX.org admin
Post Reply