0

I have a very long table (with 200 rows) and it doesn´t fit just on one page. I had tried to use "longtable" but I got an error message and I can´t create the pdf file. Could you please let me know how to use longtable with tabular and scalebox?

Many thanks in advance!

This is what I've tried:

\begin{longtable}[H]\caption{\large{Title}}
\begin{center}
\scalebox{1.3}{
\begin{tabular}{lcc}\hline\hline
\textbf{County}  & \textbf{N of obs} & \textbf{\%}     \\ 
\hline
Lake1    &  Observations  &  Percentage    \\
Lake2    &  Observations  &  Percentage    \\
..
..
Lake200  &  Observations  &  Percentage    \\
\hline\hline
\end{tabular}
}
\end{center}
\end{longtable}
4
  • Don't use scalebox to make a table fit onto a page. This will lead to inconsistent font sized throughout your document.
    – leandriis
    Apr 5 '20 at 18:47
  • longtable is a tabular-like environment, so youl shouldn't nest a tabular inside. Actually, your table preamble should be \begin{longtable}{lcc}, and you should never use a ` center` environment inside a table, as it adds spurious vertical spacing. Furthermore, a longtable is centred by default.
    – Bernard
    Apr 5 '20 at 18:48
  • longtable definitely is a better approach than scalebox. However, you used it incorrectly. \begin{longtable}{lcc}\caption{caption text}\label{key}\\ \hline County & N of Obs....should work.
    – leandriis
    Apr 5 '20 at 18:48
  • \begin{longtable}[H]\caption{\large{Title}} \begin{center} \scalebox{1.3}{ you can not have [H] or \begin{center} or \scalebox around a longtable, if there is a tutorial suggesting this sort of markup please let us know so we can get it fixed. Apr 5 '20 at 20:54
2

Here is an example of a xcorrect code. I replaced the \hlines with the rules of booktabs, which have some vertical padding and make tables look less tight, and the caption package to have control on the caption layout.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe]{geometry} 
\usepackage{booktabs}
\usepackage{caption} 
\usepackage{longtable}

\begin{document}

 \null\vspace{0.72\textheight}

{\renewcommand{\arraystretch}{1.33}
\begin{longtable}{lcc}
\captionsetup{font={large}, labelfont=bf, skip=4pt}
\caption{Title} \\
\toprule\midrule
\textbf{County} & \textbf{N\textsuperscript{o} of obs} & \textbf{\%} \\
\midrule
\endfirsthead
 \caption{Title (continued)}\\
\midrule
\textbf{County} & \textbf{N\textsuperscript{o} of obs} & \textbf{\%} \\
\midrule
\endhead
\midrule
\multicolumn{3}{r@{}}{\itshape To be continued}
\endfoot
\midrule\bottomrule
\endlastfoot
Lake1 & Observations & Percentage \\
Lake2 & Observations & Percentage \\
Lake Pipple-popple & Observations & Percentage \\
$\vdots$ & $\vdots$ & $\vdots$ \\
Lake197 & Observations & Percentage \\
Lake198 & Observations & Percentage \\
Lake199& Observations & Percentage \\
Lake200 & Observations & Percentage \\
\end{longtable}
}

\end{document} 

enter image description here enter image description here

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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