我怎样才能阻止表格移动到不同的页面?

我怎样才能阻止表格移动到不同的页面?

我有一张这种格式的长表格,从第一页中间开始。但是当我填充表格时,它会移动到第二页,而不是从第一页继续。我该怎么做?

\begin{tabular}{p{0.4\linewidth}p{0.6\linewidth}}
%    \toprule
    \multicolumn{1}{l}{\textbf{Requirements}} &        
    \multicolumn{1}{l}{\textbf{My Qualifications}} \\ 
%    \midrule
Education & 4 years experience.\\

Modeling & Have modeled.\\

%    \bottomrule
\end{tabular}

答案1

如果希望表格包含分页符,请使用longtable( \usepackage{longtable}),然后将其替换tabular为。另外,请注意不要让(或) 环境longtable的宽度超出文本块的宽度。longtabletabular

\documentclass{article}
\usepackage{longtable,calc,booktabs}
\begin{document}

\begin{longtable}{@{} p{0.4\linewidth-\tabcolsep} p{0.6\linewidth-\tabcolsep} @{}}

\toprule
\textbf{Requirements} & \textbf{My Qualifications} \\ 
\midrule
\endfirsthead

\bottomrule
\endlastfoot

Education & 4 years experience.\\
Modeling & Have modeled.\\
\end{longtable}

\end{document}

答案2

由于您明确希望表格能够覆盖整个行宽,因此我认为最好的办法是加载包,该包将带来以下\tablex功能:longtabletabularx

\documentclass{article}
\usepackage{ltablex,booktabs}
\keepXColumns

\begin{document}

\begin{tabularx}{\linewidth}{@{}>{\hsize=0.8\hsize}X>{\hsize=1.2\hsize}X}@{}}

\toprule
\textbf{Requirements} & \textbf{My Qualifications} \\ 
\midrule
\endfirsthead

\bottomrule
\endlastfoot

Education & 4 years experience.\\
Modeling & Have modeled.\\
\end{tabularx}

\end{document}

相关内容