0

I want to achieve a table with the headers being rotated 90 degree so that it appears bottom up.

I use the following code with both rotation 90 and -90 but I am facing different errors. Here is the code:

\documentclass[graybox,envcountchap,sectrefs]{svmono}
\usepackage{rotating}
\usepackage{amssymb}% http://ctan.org/pkg/amssymb
\usepackage{pifont}% http://ctan.org/pkg/pifont
\usepackage{array}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}

\begin{document}
\begin{table}
\begin{tabular}{ | P{4cm} | P{1cm} |  P{1cm} }
\hline
col 0
& \begin{rotate}{90} Col1 \end{rotate}
& \begin{rotate}{-90} Col2 too much text is written here that i want to split on multiple line but rotated 90 degree \end{rotate}\\[25ex]
\svhline
first row & \checkmark & \ding{55} \\
\hline
\end{tabular}
\end{table}
\end{document}

Here is the output: enter image description here

So my questions are:

  1. How to start from the button towards the top like first 'Col1' but to start from the bottom of the cell
  2. How to make it fit the cell size and use multi rotated line, shall I do that by hand or can it be made in an automatic manner, and if by hand how can that be done

Here is a link to the class svmono.cs

  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – samcarter_is_at_topanswers.xyz Dec 21 '16 at 14:24
  • Done. Shall I add a link to the style ? – Kasparov92 Dec 21 '16 at 14:27
  • would be nice. I found one at http://static.springer.com/sgw/documents/72921/application/zip/svmono.zip but I do get the error Undefined control sequence. \svhline – samcarter_is_at_topanswers.xyz Dec 21 '16 at 14:33
  • @samcarter Done – Kasparov92 Dec 21 '16 at 14:37
  • Try http://tex.stackexchange.com/a/32689/36296 – samcarter_is_at_topanswers.xyz Dec 21 '16 at 14:43
  • @samcarter Well this is not working, Unluckily I cant make a comment at that post. Here is what I get when I compile what he has written: https://www.sharelatex.com/project/583eb8a7cc4df62c695b4e4e – Kasparov92 Dec 21 '16 at 15:25
  • \rotatebox from graphicx allows you to specify the origin of rotation. – John Kormylo Dec 21 '16 at 15:32
  • @JohnKormylo that didnot help for using multiline when exceeding the given height of the table cell https://www.sharelatex.com/project/585aa2e099a83e0a5332f934 – Kasparov92 Dec 21 '16 at 15:43
  • @Kasparov92, see last answer to http://tex.stackexchange.com/questions/32683/rotated-column-titles-in-tabular, which I just added, if it can help you. With it the to long vertical text is automatically broken into more lines. – Zarko Dec 21 '16 at 16:37

1 Answers1

1

My Advice would be, to create a new column type, say R for rotated. In that column, you fill in the text into a minipage. The minipage can break overfull lines and arrange them accordingly. To do so, you have to define the width of the minipage. As the minipage will be rotated afterwards, the formerly width will result in the height of your cell.

This is my MWE

\documentclass{article}
\usepackage{rotating}
\usepackage{amssymb}% http://ctan.org/pkg/amssymb
\usepackage{pifont}% http://ctan.org/pkg/pifont
\usepackage{array}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
%% New definition (\scriptsize can be deleted)
\newcolumntype{R}[1]{%
  >{\begin{turn}{90}\begin{minipage}{#1}%
        \scriptsize\raggedright\hspace{0pt}}l%
      <{\end{minipage}\end{turn}}}

\begin{document}
\begin{table}
  \begin{tabular}{ | P{4cm} | P{1cm} |  P{1cm} }
    \hline
    col 0
    %% now insert our new columns.  
    %% Don't forget, you have to repeat the 
    %% column delimiters "|" in your declaration!
    & \multicolumn{1}{R{5em}}{Col1}
    & \multicolumn{1}{|R{5em}}{Col2 too much text is written here that i want to split on multiple line but rotated 90 degree}\\%[25ex]
    \hline
    first row & \checkmark & \ding{55} \\
    \hline
  \end{tabular}
\end{table}
\end{document}
Jan
  • 5,293