我想继续下一页,也有 100 行数据抛出错误
\documentclass{article}
\usepackage{booktabs, tabularx}% new
\newcolumntype{L}{>{\raggedright\arraybackslash}X}% new
\usepackage{rotating}
\usepackage{showframe}% only for show page layout
\renewcommand*\ShowFrameColor{\color{red}}
\begin{document}
\begin{sidewaystable}[htbp]
\setlength\tabcolsep{4pt}
\centering
\caption{Add caption}
\begin{tabularx}{\textheight}{l % table width is equal text height
>{\hsize=0.8\hsize}L% new column type
>{\hsize=1.2\hsize}L
>{\hsize=1.2\hsize}L
>{\hsize=0.8\hsize}L
l}
\toprule % added rules
\textbf{Author} & \textbf{Mechanism} & \textbf{Features} & \textbf{Protocol} & \textbf{Attacks} & \textbf{Limitations} \\
\midrule
R. Molva et al., & Across domains & Mutual \& one way authentication
& Stateless Authentication
& Eavesdroppers & GSM \\
\addlinespace
Hung-Yu et al., & Subscriber identity& Mutual authentication Non repudiation
& Public key & Subscriber ID Compromised session key
& GSM \\
\addlinespace
Muxiang Zhang & Fresh key & Mutual authentication \& eliminate synchronisation & AP-AKA symetric key & Redirection attack & 3GPP \\
\bottomrule
\end{tabularx}%
\label{tab:addlabel}%
\end{sidewaystable}%
\end{document}
答案1
由于表格材料将占用至少两页(可能更多),因此您需要一个可以跨页的环境。sidewaystable
和tabularx
环境都不适合。相反,我建议您使用longtable
嵌入在环境中的环境landscape
(由pdflscape
包提供)。根据您的页面和文本块参数,您可能需要稍微调整一下列宽。好消息是您只需执行一次此操作。
\documentclass{article}
\usepackage{booktabs, array, longtable, ragged2e, pdflscape}
\newcolumntype{P}[1]{>{\RaggedRight\arraybackslash}p{#1}}
\begin{document}
\begin{landscape}
\begin{longtable}{@{}l P{3cm} P{4cm} P{3cm} P{3cm} l @{}}
% header information
\caption{Add caption} \label{tab:addlabel}\\
\toprule
\textbf{Author} & \textbf{Mechanism} & \textbf{Features} & \textbf{Protocol} & \textbf{Attacks} & \textbf{Limitations}\\
\midrule
\endfirsthead
\multicolumn{5}{@{}l}{Table \ref{tab:addlabel}, continued}\\
\addlinespace
\toprule
\textbf{Author} & \textbf{Mechanism} & \textbf{Features} & \textbf{Protocol} & \textbf{Attacks} & \textbf{Limitations}\\
\midrule
\endhead
% footer information
\midrule
\multicolumn{6}{r@{}}{Continued on following page}\\
\endfoot
\bottomrule
\endlastfoot
% body of longtable
R. Molva et al. & Across domains & Mutual \& One way authentication & Stateless Authentication & Eavesdroppers & GSM \\
\addlinespace
Hung-Yu et al. & Subscriber identity& Mutual authentication Non repudiation & Public key & Subscriber ID Compromised session key & GSM \\
\addlinespace
Muxiang Zhang & Fresh key & Mutual authentication \& eliminate synchronisation & AP-AKA symetric key & Redirection attack & 3GPP \\
\end{longtable}
\end{landscape}
\end{document}
答案2
或者(假设其他行单元格中的文本量相同),您可以使用较小的字体和设置为正常纵向的表格。在这种情况下,该包ltablex
会很方便:
\documentclass{article}
\usepackage[margin=25mm]{geometry}%new
\usepackage{booktabs, ltablex}% new
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{showframe}% only for show page layout
\renewcommand*\ShowFrameColor{\color{red}}
\begin{document}
\setlength\tabcolsep{3pt}
\small% new: smaller font for beter fit table to text width
\centering
\begin{tabularx}{\textwidth}{l % table width is equal text height
>{\hsize=0.8\hsize}L% new column type
>{\hsize=1.2\hsize}L
>{\hsize=1.2\hsize}L
>{\hsize=0.8\hsize}L
l}
\caption{Add caption}\\
\toprule % added rules
\textbf{Author} & \textbf{Mechanism} & \textbf{Features} & \textbf{Protocol} & \textbf{Attacks} & \textbf{Limitations} \\
\midrule
\endfirsthead
\toprule % added rules
\textbf{Author} & \textbf{Mechanism} & \textbf{Features} & \textbf{Protocol} & \textbf{Attacks} & \textbf{Limitations} \\
\midrule
\endhead
\bottomrule
\endfoot
R. Molva et al., & Across domains & Mutual \& one way authentication
& Stateless Authentication
& Eavesdroppers & GSM \\
R. Molva et al., & Across domains & Mutual \& one way authentication
& Stateless Authentication
& Eavesdroppers & GSM \\
\addlinespace
Hung-Yu et al., & Subscriber identity& Mutual authentication Non repudiation
& Public key & Subscriber ID Compromised session key
& GSM \\
\addlinespace
Muxiang Zhang & Fresh key & Mutual authentication \& eliminate synchronisation & AP-AKA symetric key & Redirection attack & 3GPP \\
\end{tabularx}%
\label{tab:addlabel}%
\end{document}
为了获得最终的表格,至少需要进行两次编译。