如何固定longtable LATEX的宽度

Lan*_*erg 5 latex longtable width

我想设置我的宽度longtable,使其适合页面而不是裁剪掉。我有 206 列和 17 行。

我使用tablesgenerator.com 来获取我的longtable,但选项“将表格缩放到文本宽度”不适用于longtable,需要一些帮助。(这里是乳胶初学者)。

\documentclass{article}
\usepackage{longtable}
\usepackage{booktabs}

\begin{document}

\begin{longtable}{@{}lllllllllllllllll@{}}
\toprule
\textbf{SN} & \textbf{zhelio} & \textbf{zhelio\_un} & \textbf{zCMB} & 
\textbf{zCMB\_un} & \textbf{Peak\_MJD} & \textbf{Peak\_MJD\_un} & \textbf{x1} 
& \textbf{x1\_un} & \textbf{c} & \textbf{c\_un} & \textbf{mB} & 
\textbf{mB\_un} & \textbf{t} & \textbf{t\_un} & \textbf{Host\_logmass} & 
\textbf{Host\_logmass\_un} \\* \midrule
\endhead

%table stuff here...

\caption{}
\label{tab:my-table}\\
\end{longtable}

\end{document}
Run Code Online (Sandbox Code Playgroud)

这就是它的样子

图像

sam*_*ter 1

假设您的意思是 206 行而不是列,那么您可以尝试以下策略:

  • 将表格放在横向页面上

  • 使用较小的字体

  • 减少文档的边距以获得更多空间

  • 减少列之间的空间


\documentclass{article}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage[vmargin=2cm]{geometry}
\usepackage{lscape}

\begin{document}

\begin{landscape}
\small
\setlength{\tabcolsep}{2pt}
\begin{longtable}{@{}lllllllllllllllll@{}}
\toprule
\textbf{SN} & \textbf{zhelio} & \textbf{zhelio\_un} & \textbf{zCMB} & 
\textbf{zCMB\_un} & \textbf{Peak\_MJD} & \textbf{Peak\_MJD\_un} & \textbf{x1} 
& \textbf{x1\_un} & \textbf{c} & \textbf{c\_un} & \textbf{mB} & 
\textbf{mB\_un} & \textbf{t} & \textbf{t\_un} & \textbf{Host\_logmass} & 
\textbf{Host\_logmass\_un} \\* \midrule
\endhead

%table stuff here...

\caption{}
\label{tab:my-table}\\
\end{longtable}
\end{landscape}
\end{document}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述