我的 LaTeX 表格太宽,放不下。我是使用 Overleaf 编辑 LaTeX 学术项目报告的新手。我用来tablegenerator.com
生成和复制粘贴的表格太宽了,我不知道该如何修复。
以下是代码:
\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
\endfirsthead
%
\endhead
%
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}
我还有 7 行这样的行,我该怎么办?我已经做了其他所有事情,但在过去的 6 个小时里,我一直卡在这个问题上,有人可以重写这段代码,这样我的表格就不会太宽吗?
我添加了它的外观以及我希望它看起来的样子的图像:
答案1
如果您要删除表格中所有这些干扰的表格环境,则可以用l
固定宽度的列替换您的列,例如p{3cm}
(您将调整宽度以使其与您拥有的任何页面几何形状相匹配)
\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
\endfirsthead
%
\endhead
%
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}
或者你可以切换到tabularray
包:
\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}