如何将表格转换为可以跨页的长表?

如何将表格转换为可以跨页的长表?

根据问题标题,我怎样才能将下表转换为长表并获得相同的结果(但能够跨页)?

\begin{center}
\renewcommand*{\arraystretch}{1.5}
\begin{table}[h]
    \begin{tabular}{ | p{1.9cm} | p{9.9cm} | p{1.7cm} |  }
    \hline
    {\bf First} & {\bf Second} & {\bf Third} \\ \hline

    Text   & Other Text    & Other Text 2 \\ 
           & Other Text 3  &              \\ 
           & Other Text 4  &              \\ \hline

    Text 5 & Other Text 6  & Other Text 7 \\ 
           & Other Text 8  &              \\ 
           & Other Text 9  &              \\ \hline    
    \end{tabular}

\caption{My Table}
  \label{myTable}
\end{table}
\end{center}

我的表中还有更多行。

答案1

添加\usepackage{longtable}到序言中,删除table环境并更改tabularlongtable

在此处输入图片描述

\documentclass{article}
\usepackage[a6paper,vmargin=6cm,hmargin=5mm]{geometry}
\usepackage{array,longtable}
\renewcommand*{\arraystretch}{1.5}

\begin{document}
    \begin{longtable}{|*3{p{2cm}|}}
    \hline
    {\bf First} & {\bf Second} & {\bf Third} \\ \hline

    Text   & Other Text    & Other Text 2 \\ 
           & Other Text 3  &              \\ 
           & Other Text 4  &              \\ \hline

    Text 5 & Other Text 6  & Other Text 7 \\ 
           & Other Text 8  &              \\ 
           & Other Text 9  &              \\ \hline    
    \end{longtable}
\end{document}

还支持添加标题和标签,非常方便。阅读详情长桌样本

相关内容