# How to align rotated table texts?

I turned the captions of my table by 90 degrees.

Unfortunately, the headings do not fit to the table contents. Screenshot:

Can this be changed? I already tried parbox but that did not work.

Here is my table:

\begin{tabular}{cccc}

\noalign{\vskip\doublerulesep}

& CSS & Canvas & SVG

\tabularnewline[\doublerulesep]

& \includegraphics[scale=0.7]{images/screenshots/chrome_css3}
& \includegraphics[scale=0.7]{images/screenshots/chrome_canvas}
& \includegraphics[scale=0.7]{images/screenshots/chrome_svg}

\tabularnewline[\doublerulesep]

\multirow{1}{*}{\rotatebox{90}{\mbox{Opera}}}
& \includegraphics[scale=0.7]{images/screenshots/opera_css3}
& \includegraphics[scale=0.7]{images/screenshots/opera_canvas}
& \includegraphics[scale=0.7]{images/screenshots/opera_svg}

\tabularnewline[\doublerulesep]

\multirow{1}{*}{\rotatebox{90}{\mbox{Mozilla Firefox}}}
& \includegraphics[scale=0.7]{images/screenshots/firefox_css3}
& \includegraphics[scale=0.7]{images/screenshots/firefox_canvas}
& \includegraphics[scale=0.7]{images/screenshots/firefox_svg}

\tabularnewline[\doublerulesep]

\multirow{1}{*}{\rotatebox{90}{\mbox{Apple Safari}}}
& \includegraphics[scale=0.7]{images/screenshots/safari_css3}
& \includegraphics[scale=0.7]{images/screenshots/safari_canvas}
& \includegraphics[scale=0.7]{images/screenshots/safari_svg}

\end{tabular}


Relevant posts here on Stack Exchange could not help me.

Am I using multirow wrong?

-

This is similar to @HarishKumar 's approach. But to get the titles to center on the rows, I set the height of the images.

Here though, I set the image height; the graphicx package will scale the width appropriately. This allows you to label your rows and center them manually as I have done by bracketing the content between two \hspace*{\fill}.

\documentclass{article}
\usepackage{graphicx}
\usepackage[margin=1in]{geometry}
\begin{document}
\renewcommand{\arraystretch}{1.2}
\begin{tabular}{cccc}

\noalign{\vskip\doublerulesep}

& CSS & Canvas & SVG

\tabularnewline[4ex]

& \fbox{\rotatebox[origin=c]{-45}{\includegraphics[totalheight=1.25in]{example-image-10x16}}}
& \fbox{\rotatebox[origin=c]{-45}{\includegraphics[totalheight=1.25in]{example-image-10x16}}}
& \fbox{\rotatebox[origin=c]{-45}{\includegraphics[totalheight=1.25in]{example-image-10x16}}}

\tabularnewline[4ex]

\rotatebox{90}{\parbox[t]{1.25in}{\hspace*{\fill}Opera\hspace*{\fill}}}
& \fbox{\rotatebox[origin=c]{-45}{\includegraphics[totalheight=1.25in]{example-image-10x16}}}
& \fbox{\rotatebox[origin=c]{-45}{\includegraphics[totalheight=1.25in]{example-image-10x16}}}
& \fbox{\rotatebox[origin=c]{-45}{\includegraphics[totalheight=1.25in]{example-image-10x16}}}

\tabularnewline[4ex]

\rotatebox{90}{\parbox[t]{1.25in}{\hspace*{\fill}Mozilla Firefox\hspace*{\fill}}}
& \fbox{\rotatebox[origin=c]{-45}{\includegraphics[totalheight=1.25in]{example-image-10x16}}}
& \fbox{\rotatebox[origin=c]{-45}{\includegraphics[totalheight=1.25in]{example-image-10x16}}}
& \fbox{\rotatebox[origin=c]{-45}{\includegraphics[totalheight=1.25in]{example-image-10x16}}}

\tabularnewline[4ex]

\rotatebox{90}{\parbox[t]{1.25in}{\hspace*{\fill}Apple Safari\hspace*{\fill}}}
& \fbox{\rotatebox[origin=c]{-45}{\includegraphics[totalheight=1.25in]{example-image-10x16}}}
& \fbox{\rotatebox[origin=c]{-45}{\includegraphics[totalheight=1.25in]{example-image-10x16}}}
& {\includegraphics[height=1.25in]{example-image-10x16}}

\end{tabular}
\end{document}


I don't have the images you refer to. So, I don't know whether they're already rotated or not. What that means is that you may not need to use the \rotatebox on the \includegraphics calls. If you don't need to make that call, then you can change totalheight to just straight height. Though a word of caution, the images don't scale as you expect if you pass demo to the graphicx package: hence my call to the image from the mwe package.

I believe that part of what's happening with your alignment is that you're center on the baseline of the image, which is the bottom of the image.

I've mucked around a bit with your multirow approach. I'm not able to get a satisfactory looking result. So I'd suggest just dispensing with that idea.

-
It has worked. The text is nicely centered. Thanks for that! A \ rotatebox was not necessary. My images are already rotated. But good to know that it is possible! –  Benny Neugebauer Feb 21 '13 at 22:31

You don't need multirow, parbox will do it.:

\documentclass{article}
\usepackage[demo]{graphicx}
\begin{document}
\begin{tabular}{cccc}

\noalign{\vskip\doublerulesep}

& CSS & Canvas & SVG

\tabularnewline[\doublerulesep]

& \includegraphics[width=1in]{images/screenshots/chrome_css3}
& \includegraphics[width=1in]{images/screenshots/chrome_canvas}
& \includegraphics[width=1in]{images/screenshots/chrome_svg}

\tabularnewline[\doublerulesep]

\rotatebox{90}{\parbox[t]{1in}{Opera}}
& \includegraphics[width=1in]{images/screenshots/opera_css3}
& \includegraphics[width=1in]{images/screenshots/opera_canvas}
& \includegraphics[width=1in]{images/screenshots/opera_svg}

\tabularnewline[\doublerulesep]

\rotatebox{90}{\parbox[t]{1in}{Mozilla Firefox}}
& \includegraphics[width=1in]{images/screenshots/firefox_css3}
& \includegraphics[width=1in]{images/screenshots/firefox_canvas}
& \includegraphics[width=1in]{images/screenshots/firefox_svg}

\tabularnewline[\doublerulesep]

\rotatebox{90}{\parbox[t]{1in}{Apple Safari}}
& \includegraphics[width=1in]{images/screenshots/safari_css3}
& \includegraphics[width=1in]{images/screenshots/safari_canvas}
& \includegraphics[width=1in]{images/screenshots/safari_svg}

\end{tabular}
\end{document}


-
Thanks for the answer! –  Benny Neugebauer Feb 21 '13 at 22:29