質問: 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.
回答: 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} ```