Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
1  
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
add comment

migrated from stackoverflow.com Jul 22 '12 at 21:50

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

1 Answer

up vote 2 down vote accepted

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:

enter image description here

\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
  \end{tabular} \qquad
  \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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.