0

I have a wide table, which I want to put in landscape, like in the example below. But it overlaps with the page header!

\documentclass[a4paper,12pt]{scrbook}

\usepackage[pass]{geometry}
\usepackage{pdflscape}

\usepackage[automark]{scrpage2}
\pagestyle{scrheadings}
\setheadsepline{1pt}

\usepackage{lipsum}

\begin{document}

\chapter{first chapter}
\lipsum

\begin{landscape}
    \begin{tabular}{c|ccccccccccccccc}
        some wide table & 12345 & 12345 & 12345 & 12345 & 12345 & 12345 & 12345 & 12345 & 12345 & 12345 & 12345 & 12345 & 12345 & 12345 & 12345  \\
    \end{tabular}
\end{landscape}

\end{document}

How can I avoid this? So far I only have part of a solution by reducing the page margins with

\newgeometry{
    top=3cm,
    bottom=1cm,
    left=1cm,
    right=1cm
    }

before the landscape environment and \restoregeometry after it. But then I have to define the top margin manually and it will not result in a consistent header with respect to the rest of the document.

Feodoran
  • 197
  • 2
    Maybe try with something like \begin{landscape} \small \setlength{\tabcolsep}{4pt}. – leandriis Jun 13 '19 at 14:36
  • @leandriis that helps somewhat, but is not really what I am looking for. – Feodoran Jun 13 '19 at 15:55
  • 1
    If using a smaller font size in order to make the table fit between the margins does not suit your needs, could you please clarify on the desired result? – leandriis Jun 13 '19 at 21:01
  • 1
    what you mean with long table? From your MWE can be concluded, that your table is to wide even for landscape orientation. But it can be placed on one page, Do I'm right? – Zarko Jun 13 '19 at 21:27
  • Yes, the table is too wide for the margins. As a result it exceeds the right (top) margin, but still respects the left (bottom) margin. Therefore it is not centered on the page. I want to reduce the margins on both side, so that the table can be placed centered on the page. However, I want to keep the header placement consistent with the remaining document. – Feodoran Jun 14 '19 at 07:03
  • @Feodoran, is the table size of your example the desired one for your document or just a generic table that it could be longer/wider? – Ñako Jun 14 '19 at 07:33
  • @Ñako it is just generic – Feodoran Jun 14 '19 at 07:35
  • @Feodoran, then IMHO you have 4 possibilities: 1) Scale the table size with scalebox, resizebox or by changing the font size (my answer). The drawback is that table font size does not match with the document one, if this were a problem for you. 2) Of course you can also adapt the table parameters (Zarko´s answer) to fit the page margins. 3) You can also split the table in more subtables and thus place them in more pages. Therewith, the document font size is maintained. 4) Or changing the document margins (your approach). Any other ideas? – Ñako Jun 14 '19 at 07:54
  • any combination of the first 4 approaches xD
  • – Feodoran Jun 14 '19 at 08:10
  • @Feodoran, Touché! XD – Ñako Jun 14 '19 at 08:27