2

I am trying to embed a longtable in landscape mode. What I have always done is put \usepackage{longtable} and \usepackage{pdflscape} in the preamble, then put the table between \begin{landscape} and \end{landscape}. But this is simply not working on the file I have posted at this link. When I export to pdf, the first page comes out empty, and the second page clips the bottom rows. Sorry for this trivial question, but I simply can't figure it out.

  • You're not using a longtable, but a normal tabular, and that cannot break across pages. – Torbjørn T. Nov 18 '13 at 7:03
  • Hi Torbjørn... In LyX I just need to put longtable in the preamble. – user3671 Nov 18 '13 at 7:52
  • I mean the environment, not the package. Just adding \usepackage{longtable} to the preamble does nothing. You have to go into the table settings and activate Use long table in the Longtable tab. This would also add the package to the preamble, so there's no need to do that manually. – Torbjørn T. Nov 18 '13 at 7:54
  • Ahh! Thank you, thank you. Works perfectly now. – user3671 Nov 18 '13 at 7:56
4

Simply adding \usepackage{longtable} to the preamble does not mean that all tables automatically are allowed to break across pages. The standard LaTeX environment for tables, which is used by LyX as default, is called tabular, and does not break across pages. The longtable package defines a new table environment by the same name which can break across pages (between table rows). Small LaTeX code example:

\documentclass{article}
\usepackage{longtable}
\begin{document}
Default \texttt{tabular}, can not break across pages:

\begin{tabular}{c}
...
\end{tabular}

\texttt{longtable}, can break across pages:

\begin{longtable}{c}
...
\end{longtable}
\end{document}

You have to tell LyX to use the latter construct. This is done in the tabular settings, which is found by right clicking inside the table, and choosing More --> Settings. The third tab is called Longtable, and there is a check box Use long table at the top that must be checked, see screenshot below. This will also add \usepackage{longtable} to the preamble, so it is not necessary to do that manually.

enter image description here

  • Many thanks for the detailed response, Torbjørn. I just accepted it as correct. – user3671 Nov 19 '13 at 8:14

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.