4

I like to continued on next page also having 100 lines of data throwing error

\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}
Zarko
  • 296,517
Prasad
  • 419

2 Answers2

4

Since the tabular material will occupy at least two pages (and possibly more), you need an environment that can break across pages. Neither the sidewaystable nor the tabularx environments are suitable. Instead, I suggest you use a longtable environment (so that header and footer information is provided on each page) embedded in a landscape environment (provided by the pdflscape package. Depending on your page and text block parameters, you'll probably need to fiddle a bit with the column widths. The good news is that you'll only need to do this once.

enter image description here

\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}
Mico
  • 506,678
4

Alternatively (with assumption, that other rows have the similar amount of text in cells), you can use smaller font and table set in normal portrait orientation. In this the package ltablex can be handy:

\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}

enter image description here

To obtain final look-out of table at least two compilations are necessary.

Zarko
  • 296,517