Latex - \multirow and \rotatebox dont match together - how to align

Minimal example:

    \begin{table}[H]
\centering
\begin{tabular}{|l|c|c|}
\hline
Text A & Text B & Text C\\
\hline
& \multirow{2}{*}{\rotatebox{90}{Gewichtung}} \\
\hline
& & \\
\hline
A & 1 & 100 \\
\hline
B & 2 & 100 \\
\hline
\end{tabular}
\end{table}


If I use it like this, the text of the rotatet cell goes in another cell. So the cell doesnt get bigger. If I use:

    \begin{table}[H]
\centering
\begin{tabular}{|l|c|c|}
\hline
Text A & Text B & Text C\\
\hline
& \rotatebox{90}{\multirow{2}{*}{Gewichtung}} \\ \hline
& & \\
\hline
A & 1 & 100 \\
\hline
B & 2 & 100 \\
\hline
\end{tabular}
\end{table}


it looks better. But how do I get the text "Gewichtung" centered now? Its a bit more right and on the top of the box.

-

migrated from stackoverflow.comJul 22 '12 at 21:50

This question came from our site for professional and enthusiast programmers.

In the first example, \multirow is correctly interpreted to allow for spanning of multiple rows. In the second example, \multirow is completely ignored (notice how Gewichtung only spans one row). Since you seem to "prefer" the second - which doesn't require \multirow at all, what is it you're after exactly? You could even consider making a drawing of the table and including that in your post... –  Werner Jul 22 '12 at 14:01
As you said, \multirow gets ignored. So I removed it and it works in nice alignment.Thanks. –  user1189762 Jul 22 '12 at 15:48
Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Jul 22 '12 at 22:28

The use of \multirow in your examples don't really make sense. So, in the examples below, I've only focussed on centering the rotated cell contents vertically:

\documentclass{article}
%\usepackage{float}% http://ctan.org/pkg/float
%\usepackage{multirow}% http://ctan.org/pkg/multirow
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\begin{document}
\begin{table}
\centering
\begin{tabular}{|l|c|c|}
\hline
Text A & Text B & Text C\\
\hline
& \rotatebox{90}{Gewichtung} & \\ \hline
A & 1 & 100 \\
\hline
B & 2 & 100 \\
\hline
\begin{tabular}{|l|c|c|}
\hline
Text A & Text B & Text C\\
\hline
& \rotatebox{90}{Gewichtung~} & \\ \hline
A & 1 & 100 \\
\hline
B & 2 & 100 \\
\hline
\end{tabular}
\end{table}
\end{document}


I've added a tie/non-breaking space ~ to the end of Gewichtung to increase the upper gap between the lines, making it seem more centred. Other options are also available in terms of column padding. See Column padding in tables.

You may also consider looking into using booktabs for your tabular presentation. By default it suggests removing vertical rules. See the documentation for more examples and details.

-