My LaTeX Table is too wide and it does not display the contents fully

My LaTeX table is too wide and it does not fit properly. I'm a total beginner using Overleaf to edit my Academic Project Report on LaTeX. My table which I used tablegenerator.com to generate and copy pasted is too wide and I don't know how to fix it.

Here is the code:

\begin{longtable}{|l|l|l|l|l|}
\caption{Tabular Summary of Literature Survey}
\label{tab:my-table}\\
\hline
S.No &
Paper Research Name \& Year &
Paper Publishing Details &
Summary &
Scope of Improvement \\ \hline
%
%
1. &\begin{tabular}[c]{@{}l@{}}Stock Closing Price Prediction using \\ \\ Machine Learning Techniques\end{tabular} &
\begin{tabular}[c]{@{}l@{}}Published by: \\ Mehar Vij, \\ Deeksha Chandola,\\ Vinay Anand\\  Tikkiwal, \\ Arun Kumar\end{tabular} &
\begin{tabular}[c]{@{}l@{}}I. Due to the volatility\\ and non-linearity of \\ financial stock markets, \\ it is very difficult to \\ accurately predict stock \\ market returns.\\
\end{tabular} \\ \hline
\end{longtable}


I have 7 more rows like this What do i do? I've done everything else and I've been stuck at this for the past 6 hours, can someone please rewrite this code so that my table is not too wide?

I've added image of how it looks and how I want it to look:

How it looks right now:

How I want it to look :

• There is not a generic fix for a table that is too large. You need to decide how to make it fit in the page: you can split it into two tables, make the font smaller, reduce the spacing, centre the table in the page if it protrudes a bit, rotate the table by 90 degrees, etc. Mar 8 at 15:37
• @Andrea I wanna Fit all the columns in a single page, right now i can fit only till summary in a single page which is also getting cut in half. Mar 8 at 15:39
• I press enter too soon, I've edited the comment. Here we can help you produce Latex that does what you want, but you need to be clear on what you want. There is no single bullet to make a table fit if it's too large. But it seems like your cells contain quite a lot of text: it may be good to break each cell into multiple lines to reduce the width of the column. You can find multiple resources on how to do that. Oh, and please post a Minimum Working Example (MWE) of code, it helps other people help you. Mar 8 at 15:41
• Hi @Andrea I've edited to include pictures is it clear now? Mar 8 at 15:47

If you would remove all these interfering tabular environments inside your table, you could replace your l columns with fixed width columns, e.g. p{3cm} (you will have adjust the widths so that they match whatever page geometry you have)

\documentclass{article}

\usepackage{geometry}
\usepackage{longtable}
\usepackage{array}

\begin{document}

\begin{longtable}{|p{0.92cm}|>{\raggedright}p{3cm}|>{\raggedright}p{3cm}|>{\raggedright}p{3cm}|>{\raggedright\arraybackslash}p{3cm}|}
\caption{Tabular Summary of Literature Survey}
\label{tab:my-table}\\
\hline
S.No &
Paper Research Name \& Year &
Paper Publishing Details &
Summary &
Scope of Improvement \\ \hline
%
%
1. &Stock Closing Price Prediction using Machine Learning Techniques &
Published by: Mehar Vij, Deeksha Chandola, Vinay Anand Tikkiwal, Arun Kumar &
I. Due to the volatility and non-linearity of financial stock markets, it is very difficult to accurately predict stock market returns. & \\ \hline
\end{longtable}

\end{document}


or you could switch to the tabularray package:

\documentclass{article}

\usepackage{geometry}
\usepackage{tabularray}

\begin{document}

\begin{longtblr}[
caption={Tabular Summary of Literature Survey},
label={tab:my-table}
]{
colspec={lX[l]X[l]X[l]X[l]},
vlines,hlines
}
S.No &
Paper Research Name \& Year &
Paper Publishing Details &
Summary &
Scope of Improvement \\
1. &Stock Closing Price Prediction using Machine Learning Techniques &
Published by: Mehar Vij, Deeksha Chandola, Vinay Anand Tikkiwal, Arun Kumar &
I. Due to the volatility and non-linearity of financial stock markets, it is very difficult to accurately predict stock market returns. & \\
\end{longtblr}

\end{document}