1

My longtable need to spread into 3 pages. I have reviewed many past answers on longtable and tried without success. I need to post here for suggestion. Below is my existing Latex code:

\begin{table*}[!htbp]
    \centering
    \tiny
    \renewcommand{\arraystretch}{1.3}
    \caption{State-of-the-art based on the taxonomy.}
    %\label{table}
    \begin{tabular}{l|p{7.5cm}|p{1.5cm}|p{2.5cm}|p{1.5cm}}
        %\hline 
        Item& Sota & DummyA & DummyB & DummyC\\
        \hline 
        \hline 
        A & ASota & AA & AB&AC\\
        \hline 
        B & BSota& BA & BB & BC\\
        \hline
        C & CSota& CA& CB &CC\\
        \hline
        D & DSota& DA& DB &DC \\
        \hline  
        E & ESota& EA& EB &EC \\
        \hline 
        F & FSota& FA& FB &FC \\
        \hline
        G & GSota& GA& GB &GC \\
        \hline
        H & HSota& HA& HB &HC \\
        \hline
        I & ISota& IA& IB &IC \\
        \hline
        J & JSota& JA& JB &JC \\
        \hline
        K & KSota& KA& KB &KC \\
        \hline
        L & LSota& LA& LB &LC \\
        \hline
        M & MSota& MA& MB &MC \\
        \hline
    \end{tabular}
\end{table*}

Thanks in advance.

2
  • Please be more specific about what you've tried. E.g., what does "without success" mean in the present context?
    – Mico
    Commented Feb 3, 2018 at 0:22
  • That is I change the tabular into longtable or tabularX and the caption into longtable environment , remove table* ...the results did not ends well. I think I got problems in translating !hdbp and the tabular arguments into longtable arguments.
    – Casey Yeow
    Commented Feb 3, 2018 at 0:33

1 Answer 1

3

When converting from a table/tabular pair of environments to a (single) longtable environment, be sure to define the table's headers and footers, via \endfirsthead, \endhead, \endfoot, and \endlastfoot directives.

If you need to change the font size of the longtable (say, to \tiny), do encase the entire longtable environment in a pair of \begingroup and \endgroup statements. This'll keep the scope of \tiny local.

enter image description here

\documentclass{article}
\usepackage[letterpaper,margin=1in]{geometry} % set page parameters suitably
\usepackage{longtable,array}
\usepackage{caption}
\begin{document}

\begingroup 
%\tiny %% is this really necessary?
%\renewcommand{\arraystretch}{1.3}
\setlength\extrarowheight{3pt}
\captionsetup{font=normalsize,skip=0.333\baselineskip}

\begin{longtable}{@{}l|p{7.5cm}|p{1.5cm}|p{2.5cm}|p{1.5cm}@{}}
%% headers and footers

\caption{State-of-the-art based on the taxonomy.}
\label{table}\\
Item & Sota & DummyA & DummyB & DummyC \\
\hline \hline 
\endfirsthead

\multicolumn{5}{@{}l}{\em Table \ref{table}, continued}\\[1ex]
Item& Sota & DummyA & DummyB & DummyC\\
\hline\hline
\endhead

\multicolumn{5}{r@{}}{\em (Continued on following page)}\\
\endfoot

\hline
\endlastfoot

%% body of longtable env.
        A & ASota& AA& AB &AC \\
        \hline 
        B & BSota& BA& BB &BC \\
        \hline
        C & CSota& CA& CB &CC \\
        \hline
        D & DSota& DA& DB &DC \\
        \hline  
        E & ESota& EA& EB &EC \\
        \hline 
        F & FSota& FA& FB &FC \\
        \hline
        G & GSota& GA& GB &GC \\
        \hline
        H & HSota& HA& HB &HC \\
        \hline
        I & ISota& IA& IB &IC \\
        \hline
        J & JSota& JA& JB &JC \\
        \hline
        K & KSota& KA& KB &KC \\
        \hline
        L & LSota& LA& LB &LC \\
        \hline
        M & MSota& MA& MB &MC \\
        \hline
        A & ASota& AA& AB &AC \\
        \hline 
        B & BSota& BA& BB &BC \\
        \hline
        C & CSota& CA& CB &CC \\
        \hline
        D & DSota& DA& DB &DC \\
        \hline  
        E & ESota& EA& EB &EC \\
        \hline 
        F & FSota& FA& FB &FC \\
        \hline
        G & GSota& GA& GB &GC \\
        \hline
        H & HSota& HA& HB &HC \\
        \hline
        I & ISota& IA& IB &IC \\
        \hline
        J & JSota& JA& JB &JC \\
        \hline
        K & KSota& KA& KB &KC \\
        \hline
        L & LSota& LA& LB &LC \\
        \hline
        M & MSota& MA& MB &MC \\
        \hline
        A & ASota& AA &AB &AC \\
        \hline 
        B & BSota& BA &BB &BC \\
        \hline
        C & CSota& CA& CB &CC \\
        \hline
        D & DSota& DA& DB &DC \\
        \hline  
        E & ESota& EA& EB &EC \\
        \hline 
        F & FSota& FA& FB &FC \\
        \hline
        G & GSota& GA& GB &GC \\
        \hline
        H & HSota& HA& HB &HC \\
        \hline
        I & ISota& IA& IB &IC \\
        \hline
        J & JSota& JA& JB &JC \\
        \hline
        K & KSota& KA& KB &KC \\
        \hline
        L & LSota& LA& LB &LC \\
        \hline
        M & MSota& MA& MB &MC \\
        \hline 
        F & FSota& FA& FB &FC \\
        \hline
        G & GSota& GA& GB &GC \\
        \hline
        H & HSota& HA& HB &HC \\
        \hline
        I & ISota& IA& IB &IC \\
        \hline
        J & JSota& JA& JB &JC \\
        \hline
        K & KSota& KA& KB &KC \\
        \hline
        L & LSota& LA& LB &LC \\
        \hline
        M & MSota& MA& MB &MC \\

\end{longtable}
\endgroup

\end{document}
16
  • Thanks Mico for very prompt response! I will try out first and let you know.
    – Casey Yeow
    Commented Feb 3, 2018 at 0:37
  • I tried and it spread out into 30 pages instead of 3 pages. Then I turn on tiny and it reduce into 6 pages. I think I need to reduce the line spacing as my Sota column is full of texts, any idea? Thx.
    – Casey Yeow
    Commented Feb 3, 2018 at 0:57
  • @CaseyYeow - Without knowledge of what's in the "sota" column, it's not really possible to give specific advice. My answer uses single-spacing; is your document set to use wide line-spacing? If so, how is it set up?
    – Mico
    Commented Feb 3, 2018 at 1:02
  • You see, comparing to my original, the new line spacing(you are using single spacing) for "tiny" is much wider. Example of content in "Sota" column" : "HS-Relay/2013\cite{corallo2013high}-is a centralized, exclusive and high speed relaying network/system of peering nodes, which comprised of miners, exchanges and merchants. Its main aims are to scale up the blockchain by reducing the block propagation latency among miners as well as a fallback in time of Bitcoin main network failure." Regarding my document setting:
    – Casey Yeow
    Commented Feb 3, 2018 at 1:11
  • 1
    oic..sorry, the directive \setlength\extrarowheight{3pt} only applies to the longtable.
    – Casey Yeow
    Commented Feb 3, 2018 at 9:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .