如何在一页内将表格拆分为两页或在下一页继续表格

如何在一页内将表格拆分为两页或在下一页继续表格

我有一张长表,我想将其分成几页,或者在同一页内分成两页。我对 LaTeX 还不太熟悉,所以很难让长表正常工作

\begin{threeparttable}[!htbp] \centering 
  \caption{Descriptive Statistics: Nationality} 
  \label{tab:Table7} 
\scriptsize 
\begin{tabular}[t]{@{\extracolsep{1pt}}lcc} 
\\[-1.8ex]\hline 
\hline \\[-1.8ex] 
 & \multicolumn{3}{c}{\textit{Treatment}} \\ 
\cline{2-4} 
\\[-1.8ex] & Frequency & Percentage \\ 
\hline \\[-1.8ex] 
 Argentina & $10$ & $0.36$ \\ 
 & & \\
  Armenia & $1$ & $0.04$ \\ 
 & &  \\
  Australia & $43$ & $1.96$ \\ 
 & &  \\
  Austria & $22$ & $0.80$ \\ 
 & & \\
  Belgium & $21$ & $0.76$ \\ 
 & &  \\
  Bermuda & $1$ & $0.04$\\
  & & \\
  Bolivia & $1$ & $0.04$ \\
 & & \\
 Brazil & $41$ & $1.49$ \\
 & & \\
  Bulgaria & $1$ & $.04$ \\ 
 & &  \\
 Cameroon & $1$ & $0.04$ \\ 
 & &  \\
 Canada & $86$ & $3.12$ \\ 
 & & \\
   Chile & $13$ & $0.47$ \\ 
 & & \\
  China & $14$ & $0.51$  \\ 
 & &  \\
  Colombia & $18$ & $0.65$ \\ 
 & &  \\
  Costa Rica & $2$ & $0.07$ \\ 
 & &  \\
  Croatia & $1$ & $0.04$ \\ 
 & &  \\
  Cuba & $2$ & $0.07$ \\ 
 & & \\
  Czech Republic & $3$ & $0.11$ \\ 
 & & \\
  Denmark & $15$ & $0.55$  \\ 
 & & \\
  Ecuador & $440$ & $15.99$ \\ 
 & & \\
  Egypt & $2$ & $0.07$ \\ 
 & & \\
 England & $162$ & $5.89$ \\ 
 & & \\
  Estonia & $3$ & $0.11$  \\ 
 & & \\
  *Europe & $8$ & $0.29$  \\ 
 & & \\
  Finland & $7$ & $0.25$  \\ 
 & & \\
  France & $46$ & $1.67$  \\ 
  & & \\
  French Polynesia & $1$ & $0.04$ \\ 
 & & \\
  Germany & $162$ & $5.89$ \\ 
 & & \\
  Greece & $5$ & $0.18$  \\ 
 & & \\
  Guatemala & $1$ & $0.04$  \\ 
 & & \\
  Hungary & $1$ & $0.04$ \\ 
 & & \\
  India & $16$ & $0.58$  \\ 
 & & \\
  Indonesia & $3$ & $0.11$ \\ 
 & & \\
  Iran & $1$ & $0.04$  \\ 
 & & \\
  Ireland & $8$ & $0.29$ \\ 
 & & \\
  Israel & $7$ & $0.25$  \\ 
 & & \\
  Italy & $52$ & $1.89$ \\ 
 & & \\
  Japan & $8$ & $0.29$  \\ 
 & & \\
  Kenya & $1$ & $0.04$  \\ 
 & & \\
  Kosovo & $1$ & $0.04$  \\ 
 & & \\
 
 %figure out how to use longtable format here and split it. 
 
  Lebanon & $1$ & $0.04$  \\ 
 & & \\
  Lithuania & $1$ & $0.04$  \\ 
 & & \\
  Luxembourg & $2$ & $0.07$ \\ 
 & & \\
 Malta & $1$ & $0.04$  \\ 
 & & \\
 Mauritius & $1$ & $0.04$ \\  
 & & \\
 Mexico & $18$ & $0.65$ \\ 
 & & \\
 Monaco & $1$ & $0.04$  \\ 
 & & \\
 Morocco & $1$ & $0.04$  \\ 
 & & \\
 *Multi National & $8$ & $0.29$ \\ 
 & & \\
 Netherlands & $57$ & $2.07$ \\ 
 & & \\
 New Zealand & $10$ & $0.36$ \\ 
 & & \\
 Nigeria & $1$ & $0.04$ \\ 
 & & \\
 Norway & $7$ & $0.25$  \\ 
 & & \\
 Pakistan & $1$ & $0.04$  \\ 
 & & \\
 Panama & $2$ & $0.07$  \\ 
 & & \\
 Peru & $6$ & $0.22$ \\ 
 & & \\
 Philippines & $3$ & $0.11$ \\ 
 & & \\
 Poland & $12$ & $0.44$  \\ 
 & & \\
 Portugal & $13$ & $0.47$  \\ 
 & & \\
 Puerto Rico & $1$ & $0.04$ \\ 
 & & \\
 Romania & $2$ & $0.07$  \\ 
 & & \\
 Russia & $3$ & $0.11$  \\ 
 & & \\
 Saudi Arabia & $1$ & $0.04$  \\ 
 & & \\
 Scotland & $1$ & $0.04$  \\ 
 & & \\
 Serbia & $2$ & $0.07$  \\ 
 & & \\
 Singapore & $4$ & $0.15$ \\ 
 & & \\
 Slovakia & $1$ & $0.04$ \\ 
 & & \\
 Slovenia & $2$ & $0.07$ \\ 
 & & \\
 Somalia & $1$ & $0.04$ \\ 
 & & \\
 South Africa & $6$ & $0.22$ \\ 
 & & \\
 South Korea & $7$ & $0.25$  \\ 
 & & \\
 Spain & $262$ & $9.52$ \\ 
 & & \\
 Sweden & $16$ & $0.58$  \\ 
 & & \\
 Switzerland & $42$ & $1.53$  \\ 
 & & \\
 Taiwan & $4$ & $0.15$  \\ 
 & & \\
 Turkey & $2$ & $0.07$  \\ 
 & & \\
 USA & $1,003$ & $36.45$  \\ 
 & & \\
 Ukraine & $5$ & $0.18$ \\ 
 & & \\
 Uruguay & $2$ & $0.07$  \\ 
 & & \\
 Venezuela & $8$ & $0.29$ \\ 
  & & \\

 


\hline \\[-1.8ex] 
Total & 2,752 & 100.00 \\ 
& & & \\
%Chi-Sqd & 68.4043 \\ 
%P-value & 0.797 \\ 
\hline 
\hline \\[-1.8ex] 
%\textit{Note:  }   \\ 
\end{tabular}
    \begin{tablenotes}
 \footnotesize 
    \item \textit{Note: %Where the H$_0$ for the chi-square test of independence states that the two groups are independent. When the p-value (shown above in parentheses) is not less than p=0.05, the H$_0$ fails to be rejected. That is, there is insufficient evidence that an association exists between the treatment grouping and a given variable. 
    }
\end{tablenotes}

\end{threeparttable} 

抱歉我重复提问了,

答案1

为了将表格拆分成几个页面,你可以使用长桌包裹。

\usepackage{longtable}

...

\begin{center}
\begin{longtable}{p{.1\textline} | p{.3\textline} | p{.3\textline} | p{.3\textline}}
\caption{A sample long table.} \label{tab:long} \\

\hline
\multicolumn{1}{|c|}{\textbf{Main Idea}} & \multicolumn{1}{c|}{\textbf{Source 1}} &
 \multicolumn{1}{c|}{\textbf{Source 2}} & \multicolumn{1}{c|}{\textbf{Source 3}} \\
\hline 
\endfirsthead

\multicolumn{4}{c}{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
\hline 
\multicolumn{1}{|c|}{\textbf{Main Idea}} & \multicolumn{1}{c|}{\textbf{Source 1}} &
\multicolumn{1}{c|}{\textbf{Source 2}} & \multicolumn{1}{c|}{\textbf{Source 3}} \\

\hline 
\endhead

\hline
\multicolumn{4}{|r|}{{Continued on next page}} \\
\hline
\endfoot

\hline
\hline
\endlastfoot

Zero & One & abcdef ghjijklmn & 123.456778 \\
Zero & \small \lipsum[1] \normalsize & abcdef ghjijklmn & 123.456778 \\
Zero & \small \lipsum[4] \normalsize & abcdef ghjijklmn & \small \lipsum[2] \normalsize \\

\end{longtable}
\end{center}

答案2

  • 对于 OP 来说可能已经晚了,但可能会对其他人有所帮助......
  • 您的主要问题(显然)是相应地重写您的表格。这是您的工作,您不能指望其他人代替您做这件事。
  • 为了将表格放在一页中,有两种方法:
    • 正如其他答案所建议的那样
    • 将表拆分为两个平行的部分,即在现有表的中间插入
\end{tabular}
\hfill
\begin{tabular}{...}
  • 第二种情况需要较少的表格编辑工作,但在 中不起作用threeparttable。相反,您应该使用浮动table并将表格注释作为普通文本写在第二个表格下方。
  • 由于表格很大,您需要在表格中减少
    • 字体大小(至\small
    • \tabcolsep,例如 3p
    • \arraystretch,例如 0.95(参见下面的代码片段)
  • 为了看起来更专业、可读性更强,我建议使用booktabs包中定义的规则,并在每十行后插入一些垂直空间(或者如果您愿意,可以更频繁地插入):
\documentclass{article}

\usepackage[skip=1ex, font=small, labelfont=bf]{caption}
\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}
    \begin{table}[ht]
    \caption{Descriptive Statistics Nationality. Treatment: Frequency and Percentage}
    \label{tab:Table7}
    \setlength\tabcolsep{3pt}
    \renewcommand\arraystretch{0.95}
    \small
\begin{tabular}[t]{@{} lSS @{}}
    \toprule
                    &{Frequency}&{Percentage}   \\
    \midrule
  Argentina         & 10        & 0.36          \\
  Armenia           & 1         & 0.04          \\
  Lebanon           & 1         & 0.04          \\
  Lithuania         & 1         & 0.04          \\
  Australia         & 43        & 1.96          \\
  Austria           & 22        & 0.80          \\
  Belgium           & 21        & 0.76          \\
  Bermuda           & 1         & 0.04          \\
  Bolivia           & 1         & 0.04          \\
  Brazil            & 41        & 1.49          \\

\addlinespace
  Bulgaria          & 1         & 0.04          \\
  Cameroon          & 1         & 0.04          \\
% rest of first part table
\addlinespace
  Japan             & 8         & 0.29          \\
  Kenya             & 1         & 0.04          \\
    \midrule[\heavyrulewidth]
\end{tabular}
    \hfill
\begin{tabular}[t]{@{} lS[table-format=4.0]
                        S[table-format=3.2] @{}}
    \toprule
                    &{Frequency}&{Percentage}   \\
    \midrule
    Kosovo          & 1         & 0.04          \\
    Lebanon         & 1         & 0.04          \\
    Lithuania       & 1         & 0.04          \\
    Luxembourg      & 2         & 0.07          \\
    Malta           & 1         & 0.04          \\
    Mauritius       & 1         & 0.04          \\
    Mexico          & 18        & 0.65          \\
    Monaco          & 1         & 0.04          \\
    Morocco         & 1         & 0.04          \\
    *Multi National & 8         & 0.29          \\
 
\addlinespace
    Netherlands     & 57        & 2.07          \\
    New Zealand     & 10        & 0.36          \\
 
\addlinespace
    Uruguay         & 2         & 0.07          \\
    Venezuela       & 8         & 0.29          \\
    \midrule[\heavyrulewidth]
    Total           & 2 752     & 100.00        \\
    \bottomrule
\end{tabular}

\medskip\footnotesize\itshape
Note: Where the H$_0$ for the chi-square test of independence states that the two groups are independent. When the p-value (shown above in parentheses) is not less than p=0.05, the H$_0$ fails to be rejected. That is, there is insufficient evidence that an association exists between the treatment grouping and a given variable.
    \end{table} 
\end{document}

在此处输入图片描述

相关内容