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.

enter image description hereUsing Latex to try to reproduce the multi-column table with rotation and wrapping of text in the example shown above. It is columns 2 and 3 of the attached image that is giving me the problems.

I've tried a variety things like \begin{rotate}{90} stuff \end{90} with no luck.

I've also tried to \begin{sideways} stuff \end{sideways} with no luck.

share|improve this question

migrated from stackoverflow.com Mar 15 '13 at 3:12

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

    
What have you tried so far? –  JBWhitmore Mar 15 '13 at 0:28
1  
What about: \usepackage{graphicx} \newcommand{\rotatecol}[1]{\makebox[1em][l]{\rotatebox{90}{#1}}}; then in your table: \rotatecol{Same Research Area} and \rotatecol{Support Status}, etc. (Sometimes I like to use an angle of 60 degrees for things like these.) Also: the 1em will not be enough if your rotated columns need two lines of text. –  jon Mar 15 '13 at 3:45
    
Wait: 60 degree angle would be very bad if the other columns are not rotated! (It is obviously too late for me to be suggesting anything to anyone....) –  jon Mar 15 '13 at 4:02
1  
Thanks Jon, that only partially works. It is the two lines that make it tricky. I have almost got it with \newcolumntype{P}[2]{% >{\begin{turn}{#1}\begin{minipage}{#2}\small\raggedright\hspace{0pt}}l% <{\end{minipage}\end{turn}}% } then by doing \multicolumn{1}{P{90}{4.0cm}@{}}{ \textbf{ Same Research Area} (Yes/No) } but it "covers" up the vertical lines which is no good :( –  user2172065 Mar 15 '13 at 4:50

1 Answer 1

up vote 3 down vote accepted

It might be easier than you think, but it's hard to say since I don't really know the contents of the table. Anyway, this is a little different from my ad hoc comment, but the principle is the same:

\documentclass[landscape]{article}

\usepackage{graphicx,booktabs,longtable}
\newcommand{\sameresearch}{%
  \rotatebox[origin = r]{90}{\parbox[c]{3.5cm}{\hfill\bfs{Same Research Area}\\ \null\hfill (Yes/No)}}}%
\newcommand{\supportstatus}{%
  \rotatebox[origin = r]{90}{\parbox[c]{4cm}{\hfill\bfs{Support Status}\\ (Requested/Current/Past)}}}%

\newcommand{\bfs}[1]{\textsf{\textbf{#1}}}%

\begin{document}

\begin{longtable}{%
    @{}p{4cm} | p{1cm} | p{1cm} | p{3cm} |
    p{1cm} | p{1cm} | p{1cm} | p{1cm} | p{1cm}}
  \toprule
  \bfs{Description}\par
  (all named investigators on any Proposal or grant/ project/
  fellowship in which a participant is/was involved, project title,
  source of support, scheme and round) &
  \sameresearch &
  \supportstatus &
  \bfs{Proposal/Project ID} (if applicable) &
  \bfs{2012} (\$'000) &
  \bfs{2013} (\$'000) &
  \bfs{2014} (\$'000) &
  \bfs{2015} (\$'000) &
  \bfs{2016} (\$'000) \\
  \midrule

  &&&&&&&&\\
  &&&&&&&&\\

  \bottomrule
\end{longtable}

\end{document}

I should probably mention that the author of booktabs, and much of the TeX world, will tell you to avoid vertical rules like the plague. I would add in a much softer tone that it is bad (English) style to write 'grant/ project/ fellowship': the slash should not have space on one of its sides, though it may take a space on both of its sides if one or more of the 'halves' is more than one words long --- e.g., some might think it 'bad / not correct' practice.

share|improve this answer
    
Thank you so much! You can thank the Australian Government for all these vertical rules and bad English/style. I only have to reproduce it for a grant :-) thanks again. –  user2172065 Mar 15 '13 at 5:59
    
@user2172065 -- Yeah, well that's often how it goes: large institutions favour vertical lines in tables. I guess there are weirder things in life. Glad it worked out though! –  jon Mar 15 '13 at 12:53

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.