带三部分桌子的长桌

带三部分桌子的长桌

有人能帮我弄清楚为什么这段代码在 Lyx 中不起作用吗?尽管使用了 longtable,但表格在溢出底部边距后会在页面末尾被截断。

\begin{threeparttable}  
 \begin{longtable}{@{\hskip\tabcolsep\extracolsep\fill}l*{7}{c}}
        \toprule
    Country & N obs  & Total years & No degree & High school & Some college,+ & smth & smth \\
    & & of education & & & & prestige score & income score \\ \hline  \multirow{2}{0mm}{Albania} & \multirow{2}{0mm}{16} & 12.1 & 9 & 31 & 59 & 48.4 & 32.1 \\
    \medskip  &  & (2.8) & (30) & (47) & (50) & (11.9) & (10.1) \\
    \medskip \multirow{2}{0mm}{Norway} & \multirow{2}{0mm}{229} & 12.2 & 8 & 28 & 65 & 47.0 & 31.0 \\
    \bottomrule
    \end{longtable}
\end{threeparttable} 

答案1

你不应该使用threeparttable包及其同名环境来封装longtable环境。相反,使用三部分表包。(请注意,它的语法是不是与包装相同threeparttable

在此处输入图片描述

\documentclass{article}
\usepackage[margin=1in,a4paper]{geometry} % page parameters
\usepackage{longtable,booktabs,threeparttablex}
\begin{document}

\begin{ThreePartTable}
\renewcommand\TPTminimum{\textwidth}
%% Arrange for "longtable" to take up full width of text block
\setlength\LTleft{0pt}
\setlength\LTright{0pt}
\setlength\tabcolsep{0pt}

\begin{TableNotes}
  \item[a] A note
  \item[b] Another note
\end{TableNotes}

\begin{longtable}{ l @{\extracolsep{\fill}} *{7}{c} }
\toprule
Country & N obs  & Total years & No degree & High school & Some college,+ & smth\tnote{a} & smth\tnote{b} \\
& & of education & & & & prestige score & income score \\ 
\midrule
\endhead

\midrule[\heavyrulewidth]
\multicolumn{8}{r}{\textit{continued}}\\
\endfoot  

\midrule[\heavyrulewidth]
\insertTableNotes  % tell LaTeX where to insert the table-related notes
\endlastfoot

Albania & 16 & 12.1 & 9 & 31 & 59 & 48.4 & 32.1 \\
&  & (2.8) & (30) & (47) & (50) & (11.9) & (10.1) \\
\addlinespace
Norway & 229 & 12.2 & 8 & 28 & 65 & 47.0 & 31.0 \\

\end{longtable}   
\end{ThreePartTable}

\end{document}

相关内容