3

I am trying to draw a table, but some of the fields are missing. The table fields are out of the page. I am using the following packages.

\documentclass{Dissertate}
\begin{document}

\usepackage{longtable} % for 'longtable' environment
\usepackage{rotating}
\usepackage{lscape}

\begin{landscape}
\begin{longtable}[c]{p{5cm}c c c c c c c c c c c c c c c }
    \hline
Parameter & Device & Table & Variable & night\_lowlimit & night\_upperlimit & day\_lowlimit & day\_upperlimit & sensor\_definition\\\hline 

Global\_radiations & DAR & EMB1.DAR & PYR.R.SWDR.Avg &0 & 0 & 0 & 10 & EB1.PYR.R.SWDR.001.AVG  \\   
Reflected\_irradiance & DAR & EMB1.DAR & PYR.R.SWUR.Avg & 0 &0&  0& 10 & EB1.PYR.R.SWUR.001.AVG  \\

\end{longtable}
\end{landscape}
 \end{document}

I am trying to draw table completely on one page. If someone help me to get rid of this problem. I will be grateful

robbin
  • 175
  • 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. – ebosi Oct 08 '17 at 17:45
  • @ebo thanks for pointing out. I will edit it. I am new to this forum. .thanks – robbin Oct 08 '17 at 17:47
  • if you want the table on one page then do not use longtable the only thing that package does is allow tables to break onto multiple pages. – David Carlisle Oct 08 '17 at 17:48
  • Your main issue here is that you have too much content to fit on one row. (It's like saying "I would like the whole Lord of the Ring trilogy fit on the first line of my document".) What you could do is change the font size or allow breaks in your cell content (p-type column, or using tabularx/tabulary packages/environment). Yet at some point, you cannot make a very large content fit a limited space... – ebosi Oct 08 '17 at 17:50
  • @DavidCarlisle I try without longtable, but again the table fields are missing and they are cut out of the page. – robbin Oct 08 '17 at 17:51
  • @DavidCarlisle Above is the example data. you can try to draw that data table on a single page. But Thanks for guidance. – robbin Oct 08 '17 at 17:58
  • sorry I'd missed the edit although I do not have Dissertate class, I assume it will be Ok to use article – David Carlisle Oct 08 '17 at 18:09
  • @DavidCarlisle Thanks for help. I tried my best. but i am new to latex, so i am unable to solve this problem. . – robbin Oct 08 '17 at 18:12
  • Take a look at https://tex.stackexchange.com/questions/332902/my-table-doesnt-fit-what-are-my-options – cmhughes Oct 08 '17 at 18:34

2 Answers2

4

Here is a solution turning the heads of the numeric columns 90° counterclockwise and using a sidewaystable enironment in the place of landscape. In adition, the rules from booktabs have some vertical padding aroind them:

\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{array, booktabs, caption}
\usepackage{rotating}
\usepackage{lscape}

\begin{document}

\begin{sidewaystable}
  \setlength{\extrarowheight}{2pt}
  \caption{A sideways table}\label{table:swtab}
  \begin{tabular}[c]{l*{8}{c}}
    \toprule
    Parameter & Device & Table & Variable & \rotatebox{90}{night\_lowlimit} & \rotatebox{90}{night\_upperlimit} & \rotatebox{90}{day\_lowlimit} & \rotatebox{90}{day\_upperlimit} & sensor\_definition \\
    \midrule
    Global\_radiations & DAR & EMB1.DAR & PYR.R.SWDR.Avg & 0 & 0 & 0 & 10 & EB1.PYR.R.SWDR.001.AVG \\
    Reflected\_irradiance & DAR & EMB1.DAR & PYR.R.SWUR.Avg & 0 & 0 & 0 & 10 & EB1.PYR.R.SWUR.001.AVG \\
    \bottomrule
  \end{tabular}
\end{sidewaystable}

\end{document} 

enter image description here

Bernard
  • 271,350
  • thanks a lot. both solutions works fine for me. I will accept zarko answer as i am using that solution. But i am thankful to you for your precious time and help. . – robbin Oct 08 '17 at 19:06
3
  • i haven't Dissertate document class, so i use book and width geometry package define margins to be 25mm
  • i also assume, that the table can be fit in one page
  • since table is doe to wide columns head wide than text width in landscape environment, i suggest to redesign column headers and use \tnotes from threeparttable for describing column titles meaning

\documentclass{book}%{Dissertate}
    \usepackage[margin=25mm]{geometry}
\usepackage{pdflscape}
\usepackage{booktabs, threeparttable}
\usepackage{rotating}
\usepackage{siunitx}

\begin{document}

\begin{landscape}
\begin{threeparttable}
\begin{tabular}{p{5cm} ccc *{4}{S[table-format=2.0,
                                    table-column-width=9mm]}c}
    \toprule
\multicolumn{4}{c}{}
    &   \multicolumn{2}{c}{night limit}
        &   \multicolumn{2}{c}{day limit}                           \\
    \cmidrule(lr){5-6}\cmidrule(lr){7-8}
Parameter & Device & Table & Variable
    & {low\tnote{a}} & {upper\tnote{b}}
        & {low\tnote{c}} & {upper\tnote{d}} & sensor\_definition        \\
    \midrule

Global\_radiations & DAR & EMB1.DAR & PYR.R.SWDR.Avg &0 & 0 & 0 & 10 & EB1.PYR.R.SWDR.001.AVG  \\
Reflected\_irradiance & DAR & EMB1.DAR & PYR.R.SWUR.Avg & 0 &0&  0& 10 & EB1.PYR.R.SWUR.001.AVG  \\
    \bottomrule
\end{tabular}
    \begin{tablenotes}[para, flushleft]\footnotesize
    \item[a] night\_lowlimit
    \item[b] night\_upperlimit
    \item[c] day\_lowlimit
    \item[d] day\_upperlimit
    \end{tablenotes}
\end{threeparttable}
\end{landscape}
 \end{document}

enter image description here

Zarko
  • 296,517
  • thanks a lot. both solutions works completely fine. I will accept your answer cox i am using this one. .but i am also thankful to bernard for his valuable time. . – robbin Oct 08 '17 at 19:05