I got a large table in landscape format after some text. The text before the table uses the standard margins set by article
. Now for the table afterwards, I would like to change the margins, that is make the table as large as possible but still fit on one page with the associated caption. In the following please imagine the table in landscape format, so the height refers to the vertical distance and the width to the horizontal distance on the landscape page. I am providing some code below to show my problem.
Particularly on the top of the height of the landscape page, there is way too much space from the upper section to the beginning of the caption. Additionally the width should be as large as possible, so the table still fits the page and there is room for the page numbering on the left. Currently the part on the right of the table is cut off.
From my understanding, the margins of the document should be changed just for the table part, or the table creation ignores the margins somehow, at least with regards to the width on the right. The width does not have to be equidistant to the left and right necessarily from my point of view. It's most important to make the table fit on the page.
Here is the code:
\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage[USenglish]{babel}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{longtable}
\usepackage{lscape}
\usepackage{pdflscape}
\usepackage{rotating}
\usepackage{tabularx}
\usepackage{threeparttable}
\usepackage[font=small]{caption}
\usepackage{enumitem}
\usepackage{titling}
%\usepackage{mathptmx}
\usepackage{lipsum}
\begin{document}
\lipsum
\begin{landscape}
%\begin{minipage}[b]{\linewidth}
%\footnotesize
\begin{longtable}{@{}
lrrrrrrrrrrrrrr@{}}
\caption{This is an arbitrary caption spanning multiple lines. The text will be repeated multiple times for illustration only. The text will be repeated multiple times for illustration only. The text will be repeated multiple times for illustration only. The text will be repeated multiple times for illustration only. The text will be repeated multiple times for illustration only. The text will be repeated multiple times for illustration only. The text will be repeated multiple times for illustration only. The text will be repeated multiple times for illustration only. The text will be repeated multiple times for illustration only. The text will be repeated multiple times for illustration only. The text will be repeated multiple times for illustration only. The text will be repeated multiple times for illustration only. The text will be repeated multiple times for illustration only.} \\
Name of unit & \multicolumn{1}{l}{History until 1980} & \multicolumn{1}{l}{History from 1981} & \multicolumn{1}{l}{Date first found} & \multicolumn{1}{l}{Date second found} & \multicolumn{1}{l}{Info1} & \multicolumn{1}{l}{Info2} & \multicolumn{1}{l}{Info3} & \multicolumn{1}{l}{Info4} & \multicolumn{1}{l}{Info5} & \multicolumn{1}{l}{Incr over time} & \multicolumn{1}{l}{Other effects} & \multicolumn{1}{l}{Spring} & \multicolumn{1}{l}{Winter} & \multicolumn{1}{l}{Autumn} \\
\hline
Testunit & 0.23 & 0.23 & 1945-03-31 & 1945-04-01 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-04-01 & 1945-04-02 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-04-02 & 1945-04-03 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-04-03 & 1945-04-04 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-04-04 & 1945-04-05 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-04-05 & 1945-04-06 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-04-06 & 1945-04-07 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-04-07 & 1945-04-08 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-04-08 & 1945-04-09 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-04-09 & 1945-04-10 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-04-10 & 1945-04-11 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-04-11 & 1945-04-12 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-04-12 & 1945-04-13 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-04-13 & 1945-04-14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-04-14 & 1945-04-15 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-04-15 & 1945-04-16 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-04-16 & 1945-04-17 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-04-17 & 1945-04-18 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-04-18 & 1945-04-19 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-04-19 & 1945-04-20 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-04-20 & 1945-04-21 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-04-21 & 1945-04-22 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-04-22 & 1945-04-23 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-04-23 & 1945-04-24 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-04-24 & 1945-04-25 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-04-25 & 1945-04-26 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-04-26 & 1945-04-27 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-04-27 & 1945-04-28 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-04-28 & 1945-04-29 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-04-29 & 1945-04-30 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-04-30 & 1945-05-01 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-05-01 & 1945-05-02 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-05-02 & 1945-05-03 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-05-03 & 1945-05-04 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-05-04 & 1945-05-05 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-05-05 & 1945-05-06 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-05-06 & 1945-05-07 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-05-07 & 1945-05-08 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-05-08 & 1945-05-09 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-05-09 & 1945-05-10 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-05-10 & 1945-05-11 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-05-11 & 1945-05-12 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-05-12 & 1945-05-13 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-05-13 & 1945-05-14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-05-14 & 1945-05-15 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-05-15 & 1945-05-16 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-05-16 & 1945-05-17 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-05-17 & 1945-05-18 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-05-18 & 1945-05-19 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-05-19 & 1945-05-20 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-05-20 & 1945-05-21 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-05-21 & 1945-05-22 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-05-22 & 1945-05-23 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-05-23 & 1945-05-24 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-05-24 & 1945-05-25 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-05-25 & 1945-05-26 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-05-26 & 1945-05-27 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-05-27 & 1945-05-28 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-05-28 & 1945-05-29 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-05-29 & 1945-05-30 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-05-30 & 1945-05-31 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-05-31 & 1945-06-01 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-06-01 & 1945-06-02 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-06-02 & 1945-06-03 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-06-03 & 1945-06-04 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-06-04 & 1945-06-05 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-06-05 & 1945-06-06 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-06-06 & 1945-06-07 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-06-07 & 1945-06-08 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-06-08 & 1945-06-09 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-06-09 & 1945-06-10 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-06-10 & 1945-06-11 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-06-11 & 1945-06-12 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-06-12 & 1945-06-13 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-06-13 & 1945-06-14 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-06-14 & 1945-06-15 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-06-15 & 1945-06-16 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-06-16 & 1945-06-17 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-06-17 & 1945-06-18 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-06-18 & 1945-06-19 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-06-19 & 1945-06-20 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-06-20 & 1945-06-21 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-06-21 & 1945-06-22 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-06-22 & 1945-06-23 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-06-23 & 1945-06-24 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-06-24 & 1945-06-25 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.59 & 0.59 & 1945-06-25 & 1945-06-26 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.59 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.23 & 0.23 & 1945-06-26 & 1945-06-27 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.23 & 0.909 & 0.909 & 0.909 & 0.909 \\
Testunit & 0.14 & 0.14 & 1945-06-27 & 1945-06-28 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.14 & 0.909 & 0.909 & 0.909 & 0.909 \\
\hline
\label{tab:labelxyz}%
\end{longtable}%
%\end{minipage}
\end{landscape}
\end{document}
If you have any questions please ask. Thanks for any advice.
landscape
you can have your table on two package (usinglongtable
as you show in question). so far your table occupy three page