我刚刚开始学习乳胶,现在我正在尝试创建一个表.这是我的代码:
\begin{table}
\caption{Top Scorers}
\begin{tabular}{ l l }
\hline
\bf Goals & \bf Players\\
\hline
4 & First Last, First Last, First Last, First Last\\
3 & First Last\\
2 & First Last\\
1 & First Last, First Last, First Last, First Last, First Last, First Last, First Last, First Last, First Last, First Last, First Last, First Last, First Last\\
\hline
\end{tabular}
\end{table}
Run Code Online (Sandbox Code Playgroud)
问题是表格比页面宽.我希望它会像普通文本一样自动适应页面,但事实并非如此.如何告诉乳胶使表适合页面?
Cat*_*lus 34
使用p{width}列说明符:例如,\begin{tabular}{ l p{10cm} }将列的内容放入10cm宽的parbox中,文本将被正确分解为多行,如正常段落中所示.
您还可以使用tabular*环境指定整个表的宽度.
您也可以使用这些选项,使用\footnotesize或\tiny。这对于安装大桌子确实有帮助。
\begin{table}[htbp]
\footnotesize
\caption{Information on making the table size small}
\label{table:table1}
\begin{tabular}{ll}
\toprule
S.No & HMD \\
\midrule
1 & HTC Vive \\
2 & HTC Vive Pro \\
\bottomrule
\end{tabular}
\end{table}
Run Code Online (Sandbox Code Playgroud)
小智 7
您必须在resizebox下取整列.这段代码对我有用
\begin{table}[htbp]
\caption{Sample Table.}\label{tab1}
\resizebox{\columnwidth}{!}{\begin{tabular}{|l|l|l|l|l|}
\hline
URL & First Time Visit & Last Time Visit & URL Counts & Value\\
\hline
https://web.facebook.com/ & 1521241972 & 1522351859 & 177 & 56640\\
http://localhost/phpmyadmin/ & 1518413861 & 1522075694 & 24 & 39312\\
https://mail.google.com/mail/u/ & 1516596003 & 1522352010 & 36 & 33264\\
https://github.com/shawon100& 1517215489 & 1522352266 & 37 & 27528\\
https://www.youtube.com/ & 1517229227 & 1521978502 & 24 & 14792\\
\hline
\end{tabular}}
\end{table}
Run Code Online (Sandbox Code Playgroud)