Graphics, Figures & Tablesrotated centred boxes in a nonrotated table?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
marto1980
Posts: 10
Joined: Sun Apr 11, 2010 8:51 am

rotated centred boxes in a nonrotated table?

Post by marto1980 »

Dear LaTeX users,

I have a question regarding tables. I would like to ask you how to produce the table that I have attached (LongTerm.pdf) with LaTeX, more specifically with Beamer? I have tried so far with the package rotating, but I could not reproduce the good-looking horizontally and vertically centred writings in the table boxes. I would be very thankful if someone provides me some clue.

Thanks in advance,

Martin Ivanov
Attachments
LongTerm.pdf
(58.24 KiB) Downloaded 272 times

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
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

rotated centred boxes in a nonrotated table?

Post by frabjous »

Vertical centering is always tricky, and combining it with rotation is going to make things tricky. You can get pretty close by combing the m column specification with \centering, but even then, sometimes manual tweaks are needed -- at least as far as I know. Maybe someone else will be able to suggest something better.

Code: Select all

Code, edit and compile here:
\documentclass[12pt]{beamer}
\usepackage{helvet}
\usepackage{multirow}
\usepackage{array}
\begin{document}
\begin{frame}
\begin{center}
\renewcommand{\arraystretch}{1.4}
\begin{tabular}{>{\centering\arraybackslash}m{4ex}>{\centering\arraybackslash}m{4ex}>{\centering\arraybackslash}m{4ex}>{\centering\arraybackslash}m{4ex}}
\cline{3-4}
% row 1
& & 1963 & 1976 \\
\hline
% row 2
\multirow{2}{*}{%
\rotatebox{90}{Climate Indices\hspace{-0.4em}}
}
&
\rotatebox{90}{\textcolor{red}{\shortstack{Polarity\\Change}}\ }
&
\textcolor{red}{\shortstack{SOI\\PNA\\AMO}}
&
\textcolor{red}{\raisebox{-0.6ex}{\shortstack{NAO\\SOI\\PNA\\PDO}}}
\\ \cline{2-4}
&
\rotatebox{90}{Extrema\ }
&
\shortstack{NAO\\PDO}
& \\
\hline
\rotatebox{90}{\shortstack{Thermal\\Forcings}\ }
&
\rotatebox{90}{\shortstack{Trend\\Change}\ }
&
EPG
& \\ \hline
\end{tabular}
\end{center}
\end{frame}
\end{document}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
chart.png
chart.png (14.33 KiB) Viewed 2325 times
marto1980
Posts: 10
Joined: Sun Apr 11, 2010 8:51 am

rotated centred boxes in a nonrotated table?

Post by marto1980 »

frabjous,
Thank you really very very much for your reply, it was tremendously helpful. However, as I am using a coloured version of this table there are some further complications. Here is a working example of my table:

Code: Select all

Code, edit and compile here:
\begin{tabular}{*{4}{>{\columncolor[gray]{1}\centering\arraybackslash}m{4ex}}}
\hhline{~~--}
% row 1
& & \raisebox{-.3ex}{1963} & \raisebox{-.3ex}{1976} \\
\hline
% row 2
\multirow{2}{*}{%
\rotatebox{90}{Climate Indices\hspace{-0.4em}}
}
&
\rotatebox{90}{\textcolor{red}{\shortstack{Polarity\\Change}}\ }
&
\textcolor{red}{\shortstack{SOI\\PNA\\AMO}}
&
\textcolor{red}{\raisebox{-0.6ex}{\shortstack{NAO\\SOI\\PNA\\PDO}}}\\
\hhline{~---}
&
\rotatebox{90}{Extrema\ }
&
\shortstack{NAO\\PDO}
& \\
\hline
\rotatebox{90}{\shortstack{Thermal\\Forcings}\ }
&
\rotatebox{90}{\shortstack{Trend\\Change}\ }
&
EPG
& \\ \hline
\end{tabular}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The problem is that in the third row the white background for the first cell overlaps the "Climate" inscription and so it looks empty. Is there any trick to circumvent this problem? Also, I need to make the horizontal rule for the first cell in the second row white, as currently, although it is not printed, it has taken the background colour from the beamer block, which is not right.

I am posting an outlook of the current state of my table in my beamer presentation (Table.png). Any suggestions will be appreciated.
Attachments
table.png
table.png (31.74 KiB) Viewed 2314 times
Post Reply