2

I am trying to move a multipage longtable left of the set margins in the document, but I have some difficulties with this as I'm completely new to LaTeX. I have a large table in Excel, which I've converted to a longtable environment in LaTeX with the website Tables Generator, copying it into my tex-file.

Here's a MWE:

%% Define document class with options
\documentclass[12pt,twoside,openright]{report} 

\usepackage{geometry} % Easy modification of the page layout.
\geometry{a4paper,inner=28mm,outer=25mm,top=25mm,bottom=25mm} % Required layout

\usepackage{booktabs, longtable, pdflscape, fancyhdr} 
\usepackage[skip=1ex]{caption}


% Getting landscape page and page number/footer on bottom of page (instead of to the left)
\fancypagestyle{mylandscape}{
\fancyhf{} %Clears the header/footer
\fancyfoot{% Footer
\makebox[\textwidth][r]{% Right
  \rlap{\hspace{1.5cm}% Push out of margin by \footskip
    \smash{% Remove vertical height
      \raisebox{13.6cm}{% Raise vertically
        \rotatebox{90}{\thepage}}}}}}% Rotate counter-clockwise
\renewcommand{\headrulewidth}{0pt}% No header rule
\renewcommand{\footrulewidth}{0pt}% No footer rule
}

% For table headers with line breaks
\usepackage{fourier} 
\usepackage{array}
\usepackage{makecell}

\renewcommand\theadalign{bc}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{\Gape[4pt]}
\renewcommand\cellgape{\Gape[4pt]}


\begin{document}

\begin{landscape}
\pagestyle{mylandscape}
\begin{center}
  \scriptsize
\begin{longtable}[c]{@{}cccccccccccccccc@{}}
\caption{\textbf{Caption heading.} Some caption.}
\label{tab:table1}\\
\toprule
\multicolumn{1}{c}{\thead{Method}} &
  \multicolumn{1}{c}{\thead{Sample ID}} &
  \multicolumn{1}{c}{\thead{Statistics}} &
  \multicolumn{1}{c}{\thead{A long\\ header}} &
  \multicolumn{1}{c}{\thead{Another\\ statistic}}&
  \multicolumn{1}{c}{\thead{More\\ statistics}} &
  \multicolumn{1}{c}{\thead{Number of\\ something}} &
  \multicolumn{1}{c}{\thead{Number of\\ something else}} &
  \multicolumn{1}{c}{\thead{Number of\\ something similar}} &
  \multicolumn{1}{c}{\thead{Number of\\ unique\\ something}} &
  \multicolumn{1}{c}{\thead{Number of\\ specific\\ stuff here}} &
  \multicolumn{1}{c}{\thead{Interesting\\ stuff about\\ something}} &
  \multicolumn{1}{c}{\thead{LaTeX \\ is hard}} &
  \multicolumn{1}{c}{\thead{ButI\\ cool}} &
  \multicolumn{1}{c}{\thead{Sampling\\ day}} \\* \midrule
\endfirsthead
%
\multicolumn{16}{c}%
{{\bfseries Table \thetable\ continued from previous page}} \\
\toprule
\multicolumn{1}{c}{\thead{Method}} &
  \multicolumn{1}{c}{\thead{Sample ID}} &
  \multicolumn{1}{c}{\thead{Statistics}} &
  \multicolumn{1}{c}{\thead{A long\\ header}} &
  \multicolumn{1}{c}{\thead{Another\\ statistic}} &
  \multicolumn{1}{c}{\thead{More\\ statistics}} &
  \multicolumn{1}{c}{\thead{Number of\\ something}} &
  \multicolumn{1}{c}{\thead{Number of\\ something else}} &
  \multicolumn{1}{c}{\thead{Number of\\ something similar}} &
  \multicolumn{1}{c}{\thead{Number of\\ unique\\ something}} &
  \multicolumn{1}{c}{\thead{Number of\\ specific\\ stuff here}} &
  \multicolumn{1}{c}{\thead{Interesting\\ stuff about\\ something}} &
  \multicolumn{1}{c}{\thead{LaTeX \\ is hard}} &
  \multicolumn{1}{c}{\thead{ButI\\ cool}} &
  \multicolumn{1}{c}{\thead{Sampling\\ day}} \\* \midrule
\endhead
%
\bottomrule
\endfoot
%
\endlastfoot
%
METHOD 1 & 1-D0-VO-L-3         & 60  & 0,5  & 1,57 & 1116,23 & 911  & 467 & 421 & 291 & 98  & 52 & Freshwater & VO    & 0  \\
METHOD 1 & 1-D0-VO-L-T1-1      & 49  & 0,4  & 1,37 & 766,17  & 891  & 432 & 394 & 275 & 94  & 53 & Saltwater  & VO    & 0  \\
METHOD 1 & 10-D0-MA-L-T1-2     & 58  & 0,48 & 1,51 & 757,45  & 868  & 451 & 405 & 278 & 98  & 58 & Saltwater  & MA    & 0  \\
[…]
METHOD 4   & 39-D6-MA-VO-L-T2-1  & 17  & 0,14 & 1,01 & 1553,21 & 659  & 257 & 269 & 194 & 50  & 26 & Saltwater  & MA-VO & 6  \\
METHOD 4   & 40-D6-MA-VO-L-T2-2  & 17  & 0,14 & 1,01 & 2181,26 & 595  & 231 & 242 & 172 & 44  & 27 & Saltwater  & MA-VO & 6  \\
METHOD 4   & 9-D6-VO-L-1         & 108 & 0,89 & 1,61 & 781,27  & 1080 & 677 & 503 & 338 & 167 & 82 & Freshwater & VO    & 6 \\* \bottomrule
\end{longtable}
\end{center}
\end{landscape}

\end{document}

MWE table

As you can see from the first two pages, I have just gotten the table within the page frame, but I would very much like to move it a bit to the left so that there is a bit of whitespace on each side of it. After hours on hours Googling for a solution, I've come across several similar questions on this discussion forum, e.g.:

I have tried to implement all of these (plus some others I could not find back to), unfortunately without any luck. The table does not seem to want to change position no matter what. Therefore, I was hoping that someone might be able to help me with my specific problem. Any help is very much appreciated!

7
  • 1
    remove center (it does not centre a longtable) and remove [c] (as that sets \LTleft) and then set \setlength\LTleft{-3cm} before the table and it will move to the left Commented Jun 2, 2021 at 16:04
  • Thank you so much, @DavidCarlisle! I cannot believe how much time I've spent on this when the answer was so simple, but at least I've learned something today :) Thanks again, mate!
    – OMMJREN
    Commented Jun 2, 2021 at 16:14
  • 1
    Some of your column headings are much wider than the column data. Try and reduce these (e.g., by changing a four word two line title into a four word three line title) which will help the table fit better on the page. Commented Jun 2, 2021 at 16:38
  • @PeterWilson, thanks for the tip! Will play around with the column headers a bit, and find what suits best.
    – OMMJREN
    Commented Jun 2, 2021 at 16:50
  • To further increase the readability of the table, you might want to consider adding a small vertical white space (for example through \addlinespace from booktabs) every fifth or so row. This can serve as a guide to the eye and helps to prevent the reader from unintentionally switching between rows of a wide table with many entries.
    – leandriis
    Commented Jun 2, 2021 at 18:13

1 Answer 1

2

Remove center (it does not centre a longtable) and remove [c] (as that sets \LTleft) and then set \setlength\LTleft{-3cm} before the table and it will move to the left.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .