Graphics, Figures & Tables45 degree rotating text in table header

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
spacer76
Posts: 1
Joined: Tue Nov 16, 2010 9:23 pm

45 degree rotating text in table header

Post by spacer76 »

Hi all,

Just did a quick search on the web and this forum for a solution to following problem.

I want the text in the first row (header) of a table rotated 45° so I use \rotatebox{45}{some text} in each 'header' cell.

Code: Select all

\begin{tabular}{l|c|c|c|c|c|c|c|c|c}
	& \rotatebox{45}{Header 02} & \rotatebox{45}{Header 03}  
	& \rotatebox{45}{Header 04} & \rotatebox{45}{Header 05} \\ \hline

Row 1 & Data 2 & Data 3 & Data 4 & Data 5 \\
\end{tabular}
... works like expected.

But if you have two lines of text to put in the header, then the approach in the previous example gives way to much spacing :

Code: Select all

\begin{tabular}{l|c|c|c|c|c|c|c|c|c}
	& \rotatebox{45}{Header 02} & \rotatebox{45}{Header 03}  
	& \rotatebox{45}{Header 04} & \rotatebox{45}{Header 05} \\
	& \rotatebox{45}{Subheader 02} & \rotatebox{45}{Subheader 03}  
	& \rotatebox{45}{Subheader 04} & \rotatebox{45}{Subheader 05} \\ \hline

Row 1 & Data 2 & Data 3 & Data 4 & Data 5 \\
\end{tabular}
Is there someone who knows a way to put the 'header' and 'subheader' correctly spaced in one rotated cell ?

Recommended reading 2024:

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

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

Post Reply