![Longtables 的列大小调整问题](https://linux22.com/image/279000/Longtables%20%E7%9A%84%E5%88%97%E5%A4%A7%E5%B0%8F%E8%B0%83%E6%95%B4%E9%97%AE%E9%A2%98.png)
我被环境中一个非常奇怪的问题困住了longtable
。我试图使用命令设置列宽p{width}
。实际上,它适用于除第三列之外的每一列。显然,LateX 似乎完全忽略了该特定列的命令,而其他列的一切都运行顺利。下面您可以找到我正在使用的代码:
\documentclass[a4paper,12pt]{Thesis}
\usepackage{booktabs, multicol, multirow}
\usepackage{tabularx, array}
\usepackage{subfigure}
\usepackage{bigstrut}
\usepackage{amsmath}
\usepackage{lipsum}
\usepackage{hyperref}
\usepackage{latexsym}
\usepackage[table]{xcolor}
\usepackage[english]{babel}
\usepackage[section]{placeins}
\usepackage{longtable}
\begin{document}
\begin{center}
\small
\begin{longtable}{p{10pt} p{100pt} p{10pt} p{100pt} p{10pt} p{100pt}}
\caption[caption]{caption} \label{grid_mlmmh} \\
\hline \multicolumn{1}{c}{\textbf{N}} & \multicolumn{1}{c}{\textbf{Google Categories}} & \multicolumn{1}{c}{\textbf{N}} & \multicolumn{1}{c}{\textbf{Google Categories}} & \multicolumn{1}{c}{\textbf{N}} & \multicolumn{1}{c}{\textbf{Google Categories}} \\ \hline
\endfirsthead
\multicolumn{3}{c}%
{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
\hline \multicolumn{1}{c}{\textbf{N}} & \multicolumn{1}{c}{\textbf{Google Categories}} & \multicolumn{1}{c}{\textbf{N}} & \multicolumn{1}{c}{\textbf{Google Categories}} & \multicolumn{1}{c}{\textbf{N}} & \multicolumn{1}{c}{\textbf{Google Categories}} \\ \hline
\endhead
\hline \multicolumn{3}{r}{{Continued on next page}} \\ \hline
\endfoot
\hline \hline
\endlastfoot
& & & & & \\
1 & Clubs \& Nightlife & 61 & Car Electronics & 121 & Immigration Policy \& Border Issues \\
2 & Ticket Sales & 62 & TV \& Video Equipment & 122 & Visa \& Immigration \\
3 & Autos \& Vehicles & 63 & Electronics \& Electrical & 123 & Legal \\
4 & Automotive Industry & 64 & Enterprise Technology & 124 & Military \\
5 & Commercial Vehicles & 65 & Open Source & 125 & Crime and Justice \\
6 & Hybrid \& Alternative Vehicles & 66 & Finance & 126 & Counseling Services \\
\end{longtable}
\end{center}
\end{document}
为了简单起见,我将表格中的行数从 7 减少到 60,但概念保持不变。有人知道为什么似乎无法调整第三列的大小吗?
先感谢您
答案1
第三列太宽,因为前三列太窄
...——接上页。
在这种情况下,5 列就足够了。
%\documentclass[a4paper,12pt]{Thesis}
\documentclass[12pt]{article}
\usepackage{booktabs, multicol, multirow}
\usepackage{tabularx, array}
\usepackage{subfigure}
\usepackage{bigstrut}
\usepackage{amsmath}
\usepackage{lipsum}
\usepackage{hyperref}
\usepackage{latexsym}
\usepackage[table]{xcolor}
\usepackage[english]{babel}
\usepackage[section]{placeins}
\usepackage{longtable}
\begin{document}
\begin{center}
\small
\begin{longtable}{p{10pt} p{100pt} p{10pt} p{100pt} p{10pt} p{100pt}}
\caption[caption]{caption} \label{grid_mlmmh} \\
\hline \multicolumn{1}{c}{\textbf{N}} & \multicolumn{1}{c}{\textbf{Google Categories}} & \multicolumn{1}{c}{\textbf{N}} & \multicolumn{1}{c}{\textbf{Google Categories}} & \multicolumn{1}{c}{\textbf{N}} & \multicolumn{1}{c}{\textbf{Google Categories}} \\ \hline
\endfirsthead
%\multicolumn{3}{c}% % old (PS)
\multicolumn{5}{c}% % new (PS)
{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
\hline \multicolumn{1}{c}{\textbf{N}} & \multicolumn{1}{c}{\textbf{Google Categories}} & \multicolumn{1}{c}{\textbf{N}} & \multicolumn{1}{c}{\textbf{Google Categories}} & \multicolumn{1}{c}{\textbf{N}} & \multicolumn{1}{c}{\textbf{Google Categories}} \\ \hline
\endhead
\hline \multicolumn{3}{r}{{Continued on next page}} \\ \hline
\endfoot
\hline \hline
\endlastfoot
& & & & & \\
1 & Clubs \& Nightlife & 61 & Car Electronics & 121 & Immigration Policy \& Border Issues \\
2 & Ticket Sales & 62 & TV \& Video Equipment & 122 & Visa \& Immigration \\
3 & Autos \& Vehicles & 63 & Electronics \& Electrical & 123 & Legal \\
4 & Automotive Industry & 64 & Enterprise Technology & 124 & Military \\
5 & Commercial Vehicles & 65 & Open Source & 125 & Crime and Justice \\
6 & Hybrid \& Alternative Vehicles & 66 & Finance & 126 & Counseling Services \\
\end{longtable}
\end{center}
\end{document}