I apologise - I realise this has been asked a million times already, but I've been struggling as I'm not very well-versed in LaTeX.
I have a wide table that goes over several pages that I am trying to fit onto the page. I have re-created the table with dummy text (and many rows shorter).
Copy-pasting from excel into word tells me that it should fit on an A4 page when everything wraps.
But this is the output I get in overleaf
I've made this using a table generator, which has worked well for me for other tables.
I'm currently not concerned about the text on the second page floating up - I've had that before and I just force a page break to fix that (or the missing backslash for leftrightarrow - that's just a find/replace job)
I guess I'm trying to figure out how to get the contents of the columns to wrap?
Finally, the code: I used this template (which in hindsight I now very much regret)
\documentclass[
11pt, % The default document font size, options: 10pt, 11pt, 12pt
oneside, % Two side (alternating margins) for binding by default, uncomment to switch to one side
english, % ngerman for German
doublespacing, % Single line spacing, alternatives: onehalfspacing or doublespacing
%draft, % Uncomment to enable draft mode (no pictures, no links, overfull hboxes indicated)
nolistspacing, % If the document is onehalfspacing or doublespacing, uncomment this to set spacing in lists to single
liststotoc, % Uncomment to add the list of figures/tables/etc to the table of contents
%toctotoc, % Uncomment to add the main table of contents to the table of contents
parskip, % Uncomment to add space between paragraphs
%nohyperref, % Uncomment to not load the hyperref package
headsepline, % Uncomment to get a line under the header
%chapterinoneline, % Uncomment to place the chapter title next to the number on one line
consistentlayout, % Uncomment to change the layout of the declaration, abstract and acknowledgements pages to match the default layout
]{MastersDoctoralThesis} % The class file specifying the document structure
\usepackage{multirow}
\usepackage[table,xcdraw]{xcolor}
\usepackage{lscape}
\usepackage{longtable}
\usepackage{pdflscape}
% i think these are all the relevant packages to my question - there are a lot in the preamble since it's a whole thesis using a template
\begin{landscape}
\begin{longtable}[c]{|c|c|c|c|c|c|c|c|c|c|}
\caption{}
\label{tab:my-table}\\
\hline
\rowcolor[HTML]{D0CECE}
\textbf{Reference} &
\textbf{Column 1} &
\textbf{Column 2 that is descriptive} &
\textbf{Column 3 that also contains more information and is long} &
\textbf{Column 4 is also long and needs space} &
\textbf{Column 5} &
\textbf{Column 6} &
\textbf{Column 7} &
\textbf{Column 8 ABC} &
\textbf{Column9 ABCDE} \\ \hline
\endhead
%
&
&
&
&
&
&
Male &
↑ Result &
&
results that are a little long too \\ \cline{7-8} \cline{10-10}
\multirow{-2}{*}{Smith et al., 2004} &
\multirow{-2}{*}{Rat Rat Mouse} &
\multirow{-2}{*}{Stress Type} &
\multirow{-2}{*}{short description} &
\multirow{-2}{*}{ABC} &
\multirow{-2}{*}{PND100} &
Female &
leftrightarrow No Change &
\multirow{-2}{*}{description that is a bit long to add detail} &
results that are a little longer and need to go here too ABCD 1234 \\ \hline
Smith et al., 2004 &
Rat Rat Mouse &
Stress Type &
long description bla bla bla bla &
ABC &
PND100 &
Male &
↑ Result &
NOT TESTED &
NOT TESTED \\ \hline
Smith et al., 2004 &
Rat Rat Mouse &
Stress Type &
long description bla bla bla bla &
ABC &
PND100 &
Male &
↑ Result &
description that is a bit long to add detail &
results that are a little long too \\ \hline
&
&
&
&
&
&
Male &
leftrightarrow No Change &
&
results that are a little long too \\ \cline{7-8} \cline{10-10}
\multirow{-2}{*}{Smith et al., 2004} &
\multirow{-2}{*}{Rat Rat Mouse} &
\multirow{-2}{*}{Stress Type} &
\multirow{-2}{*}{long description bla bla bla bla} &
\multirow{-2}{*}{ABC} &
\multirow{-2}{*}{PND100} &
Female &
↑ Result &
\multirow{-2}{*}{description that is a bit long to add detail} &
leftrightarrow No Change \\ \hline
&
&
&
&
&
&
Male &
↑ Result &
&
\\ \cline{7-8}
\multirow{-2}{*}{Smith et al., 2004} &
\multirow{-2}{*}{Rat Rat Mouse} &
\multirow{-2}{*}{Stress Type} &
\multirow{-2}{*}{long description bla bla bla bla} &
\multirow{-2}{*}{ABC} &
\multirow{-2}{*}{PND100} &
Female &
↑ Result &
\multirow{-2}{*}{NOT TESTED} &
\multirow{-2}{*}{NOT TESTED} \\ \hline
&
&
&
long description bla bla bla bla &
&
&
Male &
↑ Result &
&
results that are a little longer and need to go here too ABCD 1234 \\ \cline{4-4} \cline{7-8} \cline{10-10}
\multirow{-2}{*}{Smith et al., 2004} &
\multirow{-2}{*}{Rat Rat Mouse} &
\multirow{-2}{*}{Stress Type} &
long description bla bla bla bla &
\multirow{-2}{*}{ABC} &
\multirow{-2}{*}{PND100 but more detail required} &
Female &
leftrightarrow No Change &
\multirow{-2}{*}{description that is a bit long to add detail} &
results that are a little longer and need to go here too ABCD 1234 \\ \hline
&
&
&
long description bla bla bla bla &
&
&
Male &
leftrightarrow No Change &
&
results that are a little longer and need to go here too ABCD 1234 \\ \cline{4-4} \cline{7-8} \cline{10-10}
\multirow{-2}{*}{Smith et al., 2004} &
\multirow{-2}{*}{Rat Rat Mouse} &
\multirow{-2}{*}{Stress Type} &
long description bla bla bla bla &
\multirow{-2}{*}{ABC} &
\multirow{-2}{*}{PND100 but more detail required} &
Female &
↑ Result &
\multirow{-2}{*}{description that is a bit long to add detail} &
results that are a little longer and need to go here too ABCD 1234 \\ \hline
&
&
&
long description bla bla bla bla &
&
&
Male &
leftrightarrow No Change &
&
results that are a little longer and need to go here too ABCD 1234 \\ \cline{4-4} \cline{7-8} \cline{10-10}
\multirow{-2}{*}{Smith et al., 2004} &
\multirow{-2}{*}{Rat Rat Mouse} &
\multirow{-2}{*}{Stress Type} &
long description bla bla bla bla &
\multirow{-2}{*}{ABC} &
\multirow{-2}{*}{PND100 but more detail required} &
Female &
↑ Result &
\multirow{-2}{*}{description that is a bit long to add detail} &
results that are a little longer and need to go here too ABCD 1234 \\ \hline
&
&
&
long description bla bla bla bla &
&
&
Male &
leftrightarrow No Change &
&
results that are a little longer and need to go here too ABCD 1234 \\ \cline{4-4} \cline{7-8} \cline{10-10}
\multirow{-2}{*}{Smith et al., 2004} &
\multirow{-2}{*}{Rat Rat Mouse} &
\multirow{-2}{*}{Stress Type} &
long description bla bla bla bla &
\multirow{-2}{*}{ABC} &
\multirow{-2}{*}{PND100 but more detail required} &
Female &
↑ Result &
\multirow{-2}{*}{description that is a bit long to add detail} &
results that are a little longer and need to go here too ABCD 1234 \\ \hline
&
&
&
long description bla bla bla bla &
&
&
Male &
leftrightarrow No Change &
&
results that are a little longer and need to go here too ABCD 1234 \\ \cline{4-4} \cline{7-8} \cline{10-10}
\multirow{-2}{*}{Smith et al., 2004} &
\multirow{-2}{*}{Rat Rat Mouse} &
\multirow{-2}{*}{Stress Type} &
long description bla bla bla bla &
\multirow{-2}{*}{ABC} &
\multirow{-2}{*}{PND100 but more detail required} &
Female &
↑ Result &
\multirow{-2}{*}{description that is a bit long to add detail} &
results that are a little longer and need to go here too ABCD 1234 \\ \hline
\end{longtable}
\end{landscape}
\end{document}