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 am trying to have a sideways table on multiple pages with the header rotated at 90 deg.

I have used landscape and longtable for the rotation and multipage span (sidewaystable doesn't work with multipage for some reason). And I have used \rotatebox{90} for the header.

The header row of the table is too long. I would like to reduce it's height and have the text in those cells be on several "lines".

Sample code:

\documentclass{article}
\usepackage{longtable}
\usepackage{pdflscape}
\usepackage{siunitx}
\begin{document}
\begin{landscape}          

\centering    
\begin{longtable}{|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
{\rotatebox{90}{\textbf{Experiment No. }}}  &
{\rotatebox{90}{\textbf{Sample  }}}  &
{\rotatebox{90}{\textbf{Temperature  }}}  &
{\rotatebox{90}{\textbf{Sample Weight  }}}  &
{\rotatebox{90}{\textbf{Tar Fraction  }}}  &
{\rotatebox{90}{\textbf{Char Fraction  }}}  &
{\rotatebox{90}{\textbf{Steam Flow Rate [ml/min]  }}}  &
{\rotatebox{90}{\textbf{Nitrogen Flow Rate [ml/min]  }}}  &
{\rotatebox{90}{\textbf{Reaction Distance  }}}  &
{\rotatebox{90}{\textbf{Flow Rate/Sample Weight  }}}  &
{\rotatebox{90}{\textbf{Residence Time [s]  }}}  &
{\rotatebox{90}{\textbf{Stochiometric error  }}}  \hline \endhead %\\

017 & ABS & 700\Deg & 0.56 & 24.0\% & 0\% & 0.000 & 250.000 & 0.6 & 0.000 & 41.15 & 0.0 \\
029 & ABS & 700\Deg & 1.07 & 23.0\% & 0.0\% & 0.000 & 350.000 & 0.5 & 0.000 & 29.41 & 0.0 \\
021 & ABS & 700\Deg & 1.60 & 24.3\% & 0.0\% & 0.167 & 250.000 & 0.6 & 0.104 & 22.49 & 1.2 \\

\end{document}

enter image description here

share|improve this question
    
Please always post complete small documents that show the problem. \centering has no effect on longtable. It isn't clear which text in your fragment you mean by "long text" nor where you want it to span. Each of the rotated headings apparently just needs a single column? –  David Carlisle Feb 3 '13 at 17:10
    
Welcome to TeX.SE! I'm afraid I don't know how to interpret your statement, "I would like the long text in header to span on several row...". Do you intend to have different header rows for different pages, or the same header row for each page? If it's the latter, then your use of the longtable environment should get the job done. –  Mico Feb 3 '13 at 17:10

1 Answer 1

up vote 10 down vote accepted

Is it like this? I used \parbox. The width of parbox may be adjusted as needed.

\documentclass{article}
\usepackage{longtable}
\usepackage{pdflscape}
\usepackage{siunitx}
\begin{document}
\begin{landscape}
%\begin{sidewaystable}

\centering
%\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|}
\begin{longtable}{|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
{\rotatebox{90}{\parbox[t]{3cm}{\raggedright\textbf{Experiment No. }}}}  &
{\rotatebox{90}{\parbox[t]{3cm}{\raggedright\textbf{Sample  }}}}  &
{\rotatebox{90}{\parbox[t]{3cm}{\raggedright\textbf{Temperature  }}}}  &
{\rotatebox{90}{\parbox[t]{3cm}{\raggedright\textbf{Sample Weight  }}}}  &
{\rotatebox{90}{\parbox[t]{3cm}{\raggedright\textbf{Tar Fraction  }}}}  &
{\rotatebox{90}{\parbox[t]{3cm}{\raggedright\textbf{Char Fraction  }}}}  &
{\rotatebox{90}{\parbox[t]{3cm}{\raggedright\textbf{Steam Flow Rate [ml/min]  }}}}  &
{\rotatebox{90}{\parbox[t]{3cm}{\raggedright\textbf{Nitrogen Flow Rate [ml/min]  }}}}  &
{\rotatebox{90}{\parbox[t]{3cm}{\raggedright\textbf{Reaction Distance  }}}}  &
{\rotatebox{90}{\parbox[t]{3cm}{\raggedright\textbf{Flow Rate/Sample Weight  }}}}  &
{\rotatebox{90}{\parbox[t]{3cm}{\raggedright\textbf{Residence Time [s]  }}}}  &
{\rotatebox{90}{\parbox[t]{3cm}{\raggedright\textbf{Stochiometric error  }}}} \\
 \hline \endhead %\\

017 & ABS & \SI{700}{\degree} & 0.56 & 24.0\% & 0\% & 0.000 & 250.000 & 0.6 & 0.000 & 41.15 & 0.0 \\
029 & ABS & \SI{700}{\degree} & 1.07 & 23.0\% & 0.0\% & 0.000 & 350.000 & 0.5 & 0.000 & 29.41 & 0.0 \\
021 & ABS & \SI{700}{\degree} & 1.60 & 24.3\% & 0.0\% & 0.167 & 250.000 & 0.6 & 0.104 & 22.49 & 1.2 \\
\end{longtable}
\end{landscape}
\end{document}

enter image description here

You may also use \SI{700}{\celsius}. See the siunitx manual for using the SI units..

share|improve this answer
    
+1 for attempting (I couldn't guess what was required). Probably a \raggedright in the parboxes would help not stretch the titles so much. –  David Carlisle Feb 3 '13 at 23:28
    
@DavidCarlisle Thanks. Added. –  Harish Kumar Feb 3 '13 at 23:33
    
@Harish Kumar - thanks that is exactly what I was looking for. –  Ivan P. Feb 4 '13 at 1:09

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.