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.

I have a big table with a problem, when I want to rotate the text in a \multirow cell, the text is placed outside and is bigger than the dimensions of the cell, I took some advice from here, using\parbox, and then \rotatebox. But I don't get good results.

 \documentclass{article}
 \usepackage{array,multirow,graphicx}
 \begin{document}
 \begin{table}[H]
 \centering
 \begin{tabular}{|c|l|r|r|r|r|}
 \hline
 & \multicolumn{1}{|c|}{Text} & \multicolumn{1}{|c|}{Text} & \multicolumn{1}{|c|}{Text} & \multicolumn{1}{|c|}{Text} & \multicolumn{1}{|c|}{text}\\
 \hline
 \rotatebox{90}{\parbox{2mm}{\multirow{3}{*}{rota}}} & text &&&&\\
 & text &&&&\\
 & text &&&&\\
 \hline
 \end{tabular}
 \end{table}
 \end{document}

Which results in:

rotate problem

share|improve this question
add comment

1 Answer

up vote 18 down vote accepted

Put \rotatebox inside like:

\parbox[t]{2mm}{\multirow{3}{*}{\rotatebox[origin=c]{90}{rota}}}

Code:

 \documentclass{article}
 \usepackage{array,multirow,graphicx}
 \begin{document}
 \begin{table}[H]
 \centering
 \begin{tabular}{|c|l|r|r|r|r|}
 \hline
 & \multicolumn{1}{c|}{Text} & \multicolumn{1}{c|}{Text} & \multicolumn{1}{c|}{Text} & \multicolumn{1}{c|}{Text} & \multicolumn{1}{c|}{text}\\
 \hline
 \parbox[t]{2mm}{\multirow{3}{*}{\rotatebox[origin=c]{90}{rota}}} & text &&&&\\
 & text &&&&\\
 & text &&&&\\
 \hline
 \end{tabular}
 \end{table}
 \end{document}

enter image description here

I have eliminated some spurious vertical lines in the title and introduced the origin for rotation. However, the idea of introducing a parbox did not get in to my head as this may not be needed for the present MWE. In case you have other uses in your actual code, you may use the alignment specifiers to parbox (Here [t]).

share|improve this answer
    
Thanks so much, it works for all my table. –  Isai Jan 3 '13 at 16:14
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.