\documentclass[12pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{xtab} % table page breaks
\usepackage{array} % for advanced column specification: use >{\command} for
% commands executed right before each column element
% and <{\command} for commands to be executed right after
% each column element
\usepackage{booktabs} % toprule, bottomrule, midrule
\begin{document}
\renewcommand{\arraystretch}{1.5}
\begin{xtabular}{>{$}l<{$} c c}
\toprule
\text{Model} & \text{AIC (logistic link)} & \text{AIC (linear link)} \\
\midrule
\{ \phi(\cdot) , p(\cdot) \} & 986 & 986 \\
\{ \phi(\cdot) , p(t) \} & 993 & 993 \\
\{ \phi(\cdot) , p(h_2) \} & 961 & 959 \\
\{ \phi(\cdot) , p(h_3) \} & 948 & 948 \\
\{ \phi(\cdot) , p(h_4) \} & 952 & 952 \\
\{ \phi(\cdot) , p(t+h_2) \} & 969 & 977 \\
\{ \phi(\cdot) , p(t+h_3) \} & 949 & 981 \\
\{ \phi(\cdot) , p(t+h_4) \} & 953 & 999 \\
\{ \phi(\cdot) , p(t \times h_2) \} & 970 & 1032 \\
\{ \phi(\cdot) , p(t \times h_3) \} & 979 & 1131 \\
\{ \phi(\cdot) , p(t \times h_4) \} & 993 & 1124 \\
\{ \phi(t) , p(\cdot) \} & & 994 \\
\{ \phi(t) , p(t) \} & & 996 \\
\{ \phi(t) , p(h_2) \} & 963 & 963 \\
\{ \phi(t) , p(h_3) \} & 952 & 952 \\
\{ \phi(t) , p(h_4) \} & 956 & 956 \\
\{ \phi(t) , p(t+h_2) \} & 973 & 976 \\
\{ \phi(t) , p(t+h_3) \} & 954 & 968 \\
\{ \phi(t) , p(t+h_4) \} & 958 & 975 \\
\{ \phi(t) , p(t \times h_2) \} & & 1018 \\
\{ \phi(t) , p(t \times h_3) \} & 976 & 1165 \\
\{ \phi(t) , p(t \times h_4) \} & 999 & 1167 \\
\{ \phi(h_2) , p(\cdot) \} & 968 & 968 \\
\{ \phi(h_3) , p(\cdot) \} & 972 & 972 \\
\{ \phi(h_4) , p(\cdot) \} & 976 & 976 \\
\{ \phi(h_2) , p(t) \} & & 971 \\
\{ \phi(h_3) , p(t) \} & 975 & 1055 \\
\{ \phi(h_4) , p(t) \} & 979 & 979 \\
\{ [\phi(h) , p(h)]_2 \} & 970 & 959 \\
\{ [\phi(h) , p(h)]_3 \} & 951 & 951 \\
\{ [\phi(h) , p(h)]_4 \} & 957 & 957 \\
\{ [\phi(h) , p(t+h)]_2 \} & 967 & 972 \\
\{ [\phi(h) , p(t+h)]_3 \} & 957 & 969 \\
\{ [\phi(h) , p(t+h)]_4 \} & 959 & 976 \\
\{ [\phi(h) , p(t \times h)]_2 \} & 987 & 993 \\
\{ [\phi(h) , p(t \times h)]_3 \} & 978 & 1047 \\
\{ [\phi(h) , p(t \times h)]_4 \} & 993 & 1063 \\
\{ \phi(t+h_2) , p(\cdot) \} & 982 & 987 \\
\{ \phi(t+h_3) , p(\cdot) \} & 977 & 983 \\
\{ \phi(t+h_4) , p(\cdot) \} & & 987 \\
\{ \phi(t+h_2) , p(t) \} & 977 & 982 \\
\{ \phi(t+h_3) , p(t) \} & 980 & 987 \\
\{ \phi(t+h_4) , p(t) \} & 985 & 992 \\
\{ [\phi(t+h) , p(h)]_2 \} & 965 & 967 \\
\{ [\phi(t+h) , p(h)]_3 \} & 956 & 959 \\
\{ [\phi(t+h) , p(h)]_4 \} & 962 & 966 \\
\{ [\phi(t+h) , p(t+h)]_2 \} & 965 & 984 \\
\{ [\phi(t+h) , p(t+h)]_3 \} & 959 & 1000 \\
\{ [\phi(t+h) , p(t+h)]_4 \} & 965 & 1009 \\
\{ [\phi(t+h) , p(t \times h)]_2 \} & 981 & 1043 \\
\{ [\phi(t+h) , p(t \times h)]_3 \} & 987 & 1185 \\
\{ [\phi(t+h) , p(t \times h)]_4 \} & 994 & 1080 \\
\{ \phi(t \times h_2) , p(\cdot) \} & 978 & 991 \\
\{ \phi(t \times h_3) , p(\cdot) \} & 993 & 1045 \\
\{ \phi(t \times h_4) , p(\cdot) \} & 1012 & 1023 \\
\{ [\phi(t \times h) , p(h)]_2 \} & 970 & 974 \\
\{ [\phi(t \times h) , p(h)]_3 \} & 1000 & 990 \\
\{ [\phi(t \times h) , p(h)]_4 \} & 1003 & 1000 \\
\bottomrule
\topcaption{AIC values}
\end{xtabular}
\end{document}
如果您查看第 2 页和第 3 页的输出,列宽会比第 1 页的列宽小。我的意思是第 2 页和第 3 页的表格被视为具有“标题”的单独表格。
有没有什么办法可以改善这种情况?
为什么会在那些点处断开?显然,我们在第一页和第二页上放了更多行。
顶部标题在哪里???
谢谢!
答案1
因为这就longtable
足够了。
\documentclass[12pt,a4paper]{article}
\usepackage[showframe]{geometry}
\usepackage{amsmath}
\usepackage{longtable} % table page breaks
\usepackage{array} % for advanced column specification: use >{\command} for
% commands executed right before each column element
% and <{\command} for commands to be executed right after
% each column element
\usepackage{booktabs} % toprule, bottomrule, midrule
\begin{document}
\renewcommand{\arraystretch}{1.5}
\begin{longtable}{>{$}l<{$} c c}
\caption{AIC values}
\\\toprule \text{Model} & \text{AIC (logistic link)} & \text{AIC (linear link)} \\
\midrule
\endfirsthead
\\\toprule \text{Model} & \text{AIC (logistic link)} & \text{AIC (linear link)} \\
\midrule
\endhead
\midrule\multicolumn{3}{r}{{Continued on next page}} \\ \bottomrule
\endfoot
\bottomrule
\endlastfoot
\{ \phi(\cdot) , p(\cdot) \} & 986 & 986 \\
\{ \phi(\cdot) , p(t) \} & 993 & 993 \\
\{ \phi(\cdot) , p(h_2) \} & 961 & 959 \\
\{ \phi(\cdot) , p(h_3) \} & 948 & 948 \\
\{ \phi(\cdot) , p(h_4) \} & 952 & 952 \\
\{ \phi(\cdot) , p(t+h_2) \} & 969 & 977 \\
\{ \phi(\cdot) , p(t+h_3) \} & 949 & 981 \\
\{ \phi(\cdot) , p(t+h_4) \} & 953 & 999 \\
\{ \phi(\cdot) , p(t \times h_2) \} & 970 & 1032 \\
\{ \phi(\cdot) , p(t \times h_3) \} & 979 & 1131 \\
\{ \phi(\cdot) , p(t \times h_4) \} & 993 & 1124 \\
\{ \phi(t) , p(\cdot) \} & & 994 \\
\{ \phi(t) , p(t) \} & & 996 \\
\{ \phi(t) , p(h_2) \} & 963 & 963 \\
\{ \phi(t) , p(h_3) \} & 952 & 952 \\
\{ \phi(t) , p(h_4) \} & 956 & 956 \\
\{ \phi(t) , p(t+h_2) \} & 973 & 976 \\
\{ \phi(t) , p(t+h_3) \} & 954 & 968 \\
\{ \phi(t) , p(t+h_4) \} & 958 & 975 \\
\{ \phi(t) , p(t \times h_2) \} & & 1018 \\
\{ \phi(t) , p(t \times h_3) \} & 976 & 1165 \\
\{ \phi(t) , p(t \times h_4) \} & 999 & 1167 \\
\{ \phi(h_2) , p(\cdot) \} & 968 & 968 \\
\{ \phi(h_3) , p(\cdot) \} & 972 & 972 \\
\{ \phi(h_4) , p(\cdot) \} & 976 & 976 \\
\{ \phi(h_2) , p(t) \} & & 971 \\
\{ \phi(h_3) , p(t) \} & 975 & 1055 \\
\{ \phi(h_4) , p(t) \} & 979 & 979 \\
\{ [\phi(h) , p(h)]_2 \} & 970 & 959 \\
\{ [\phi(h) , p(h)]_3 \} & 951 & 951 \\
\{ [\phi(h) , p(h)]_4 \} & 957 & 957 \\
\{ [\phi(h) , p(t+h)]_2 \} & 967 & 972 \\
\{ [\phi(h) , p(t+h)]_3 \} & 957 & 969 \\
\{ [\phi(h) , p(t+h)]_4 \} & 959 & 976 \\
\{ [\phi(h) , p(t \times h)]_2 \} & 987 & 993 \\
\{ [\phi(h) , p(t \times h)]_3 \} & 978 & 1047 \\
\{ [\phi(h) , p(t \times h)]_4 \} & 993 & 1063 \\
\{ \phi(t+h_2) , p(\cdot) \} & 982 & 987 \\
\{ \phi(t+h_3) , p(\cdot) \} & 977 & 983 \\
\{ \phi(t+h_4) , p(\cdot) \} & & 987 \\
\{ \phi(t+h_2) , p(t) \} & 977 & 982 \\
\{ \phi(t+h_3) , p(t) \} & 980 & 987 \\
\{ \phi(t+h_4) , p(t) \} & 985 & 992 \\
\{ [\phi(t+h) , p(h)]_2 \} & 965 & 967 \\
\{ [\phi(t+h) , p(h)]_3 \} & 956 & 959 \\
\{ [\phi(t+h) , p(h)]_4 \} & 962 & 966 \\
\{ [\phi(t+h) , p(t+h)]_2 \} & 965 & 984 \\
\{ [\phi(t+h) , p(t+h)]_3 \} & 959 & 1000 \\
\{ [\phi(t+h) , p(t+h)]_4 \} & 965 & 1009 \\
\{ [\phi(t+h) , p(t \times h)]_2 \} & 981 & 1043 \\
\{ [\phi(t+h) , p(t \times h)]_3 \} & 987 & 1185 \\
\{ [\phi(t+h) , p(t \times h)]_4 \} & 994 & 1080 \\
\{ \phi(t \times h_2) , p(\cdot) \} & 978 & 991 \\
\{ \phi(t \times h_3) , p(\cdot) \} & 993 & 1045 \\
\{ \phi(t \times h_4) , p(\cdot) \} & 1012 & 1023 \\
\{ [\phi(t \times h) , p(h)]_2 \} & 970 & 974 \\
\{ [\phi(t \times h) , p(h)]_3 \} & 1000 & 990 \\
\{ [\phi(t \times h) , p(h)]_4 \} & 1003 & 1000 \\
%\bottomrule
\end{longtable}
\end{document}
在您的示例中,由于您使用了l
和c
说明符,因此列宽会调整为最宽条目的宽度。第一页有宽标题,而第二页和第三页没有标题,因此它们较窄。我也在其中添加了标题。
答案2
环境xtabular
会高估每行,为其计算添加比正常行至少多 10% 的空间。这是为了补偿更高的行。
当它决定必须生成新块时,xtabular
关闭一个表并打开一个新表,因此不会保留前一个块的列宽。这是该包的一个功能。
第一个问题,即在页面底部留下未占用的空间,可以通过使用来解决\xentrystretch
;第二个问题,除非仅指定固定宽度的列,否则是无法解决的。
应\topcaption
在表格前键入。
\documentclass[12pt,a4paper]{article}
\usepackage{showframe} % to show a page frame
\usepackage{amsmath}
\usepackage{xtab}
\usepackage{array}
\usepackage{booktabs}
\usepackage{caption} % better caption spacing
\begin{document}
\begin{center}
\renewcommand{\arraystretch}{1.5}
\xentrystretch{-0.1} % reduce the overshoot
\topcaption{AIC values}
\begin{xtabular}{>{$}l<{$} c c}
\toprule
\text{Model} & \text{AIC (logistic link)} & \text{AIC (linear link)} \\
\midrule
\{ \phi(\cdot) , p(\cdot) \} & 986 & 986 \\
\{ \phi(\cdot) , p(t) \} & 993 & 993 \\
\{ \phi(\cdot) , p(h_2) \} & 961 & 959 \\
\{ \phi(\cdot) , p(h_3) \} & 948 & 948 \\
\{ \phi(\cdot) , p(h_4) \} & 952 & 952 \\
\{ \phi(\cdot) , p(t+h_2) \} & 969 & 977 \\
\{ \phi(\cdot) , p(t+h_3) \} & 949 & 981 \\
\{ \phi(\cdot) , p(t+h_4) \} & 953 & 999 \\
\{ \phi(\cdot) , p(t \times h_2) \} & 970 & 1032 \\
\{ \phi(\cdot) , p(t \times h_3) \} & 979 & 1131 \\
\{ \phi(\cdot) , p(t \times h_4) \} & 993 & 1124 \\
\{ \phi(t) , p(\cdot) \} & & 994 \\
\{ \phi(t) , p(t) \} & & 996 \\
\{ \phi(t) , p(h_2) \} & 963 & 963 \\
\{ \phi(t) , p(h_3) \} & 952 & 952 \\
\{ \phi(t) , p(h_4) \} & 956 & 956 \\
\{ \phi(t) , p(t+h_2) \} & 973 & 976 \\
\{ \phi(t) , p(t+h_3) \} & 954 & 968 \\
\{ \phi(t) , p(t+h_4) \} & 958 & 975 \\
\{ \phi(t) , p(t \times h_2) \} & & 1018 \\
\{ \phi(t) , p(t \times h_3) \} & 976 & 1165 \\
\{ \phi(t) , p(t \times h_4) \} & 999 & 1167 \\
\{ \phi(h_2) , p(\cdot) \} & 968 & 968 \\
\{ \phi(h_3) , p(\cdot) \} & 972 & 972 \\
\{ \phi(h_4) , p(\cdot) \} & 976 & 976 \\
\{ \phi(h_2) , p(t) \} & & 971 \\
\{ \phi(h_3) , p(t) \} & 975 & 1055 \\
\{ \phi(h_4) , p(t) \} & 979 & 979 \\
\{ [\phi(h) , p(h)]_2 \} & 970 & 959 \\
\{ [\phi(h) , p(h)]_3 \} & 951 & 951 \\
\{ [\phi(h) , p(h)]_4 \} & 957 & 957 \\
\{ [\phi(h) , p(t+h)]_2 \} & 967 & 972 \\
\{ [\phi(h) , p(t+h)]_3 \} & 957 & 969 \\
\{ [\phi(h) , p(t+h)]_4 \} & 959 & 976 \\
\{ [\phi(h) , p(t \times h)]_2 \} & 987 & 993 \\
\{ [\phi(h) , p(t \times h)]_3 \} & 978 & 1047 \\
\{ [\phi(h) , p(t \times h)]_4 \} & 993 & 1063 \\
\{ \phi(t+h_2) , p(\cdot) \} & 982 & 987 \\
\{ \phi(t+h_3) , p(\cdot) \} & 977 & 983 \\
\{ \phi(t+h_4) , p(\cdot) \} & & 987 \\
\{ \phi(t+h_2) , p(t) \} & 977 & 982 \\
\{ \phi(t+h_3) , p(t) \} & 980 & 987 \\
\{ \phi(t+h_4) , p(t) \} & 985 & 992 \\
\{ [\phi(t+h) , p(h)]_2 \} & 965 & 967 \\
\{ [\phi(t+h) , p(h)]_3 \} & 956 & 959 \\
\{ [\phi(t+h) , p(h)]_4 \} & 962 & 966 \\
\{ [\phi(t+h) , p(t+h)]_2 \} & 965 & 984 \\
\{ [\phi(t+h) , p(t+h)]_3 \} & 959 & 1000 \\
\{ [\phi(t+h) , p(t+h)]_4 \} & 965 & 1009 \\
\{ [\phi(t+h) , p(t \times h)]_2 \} & 981 & 1043 \\
\{ [\phi(t+h) , p(t \times h)]_3 \} & 987 & 1185 \\
\{ [\phi(t+h) , p(t \times h)]_4 \} & 994 & 1080 \\
\{ \phi(t \times h_2) , p(\cdot) \} & 978 & 991 \\
\{ \phi(t \times h_3) , p(\cdot) \} & 993 & 1045 \\
\{ \phi(t \times h_4) , p(\cdot) \} & 1012 & 1023 \\
\{ [\phi(t \times h) , p(h)]_2 \} & 970 & 974 \\
\{ [\phi(t \times h) , p(h)]_3 \} & 1000 & 990 \\
\{ [\phi(t \times h) , p(h)]_4 \} & 1003 & 1000 \\
\bottomrule
\end{xtabular}
\end{center}
\end{document}
一个更完整的例子,其中不同的列宽通过重复标题被稍微掩盖(也可以根据第一列中最宽的条目添加幻影宽度)。
\documentclass[12pt,a4paper]{article}
\usepackage{showframe}
\usepackage{amsmath}
\usepackage{xtab}
\usepackage{array}
\usepackage{booktabs,caption}
\begin{document}
\begin{center}
\renewcommand{\arraystretch}{1.5}
\xentrystretch{-0.12}
\topcaption{AIC values}
\tablehead{%
\toprule
\text{Model} & \text{AIC (logistic link)} & \text{AIC (linear link)} \\
\midrule
}
\tabletail{%
\midrule[\heavyrulewidth]
\multicolumn{3}{r}{\footnotesize\itshape Continues}\\
}
\tablelasttail{\bottomrule}
\begin{xtabular}{>{$}l<{$} c c}
\{ \phi(\cdot),p(\cdot) \} & 986 & 986 \\
\{ \phi(\cdot),p(t) \} & 993 & 993 \\
\{ \phi(\cdot),p(h_2) \} & 961 & 959 \\
\{ \phi(\cdot),p(h_3) \} & 948 & 948 \\
\{ \phi(\cdot),p(h_4) \} & 952 & 952 \\
\{ \phi(\cdot),p(t+h_2) \} & 969 & 977 \\
\{ \phi(\cdot),p(t+h_3) \} & 949 & 981 \\
\{ \phi(\cdot),p(t+h_4) \} & 953 & 999 \\
\{ \phi(\cdot),p(t \times h_2) \} & 970 & 1032 \\
\{ \phi(\cdot),p(t \times h_3) \} & 979 & 1131 \\
\{ \phi(\cdot),p(t \times h_4) \} & 993 & 1124 \\
\{ \phi(t),p(\cdot) \} & & 994 \\
\{ \phi(t),p(t) \} & & 996 \\
\{ \phi(t),p(h_2) \} & 963 & 963 \\
\{ \phi(t),p(h_3) \} & 952 & 952 \\
\{ \phi(t),p(h_4) \} & 956 & 956 \\
\{ \phi(t),p(t+h_2) \} & 973 & 976 \\
\{ \phi(t),p(t+h_3) \} & 954 & 968 \\
\{ \phi(t),p(t+h_4) \} & 958 & 975 \\
\{ \phi(t),p(t \times h_2) \} & & 1018 \\
\{ \phi(t),p(t \times h_3) \} & 976 & 1165 \\
\{ \phi(t),p(t \times h_4) \} & 999 & 1167 \\
\{ \phi(h_2),p(\cdot) \} & 968 & 968 \\
\{ \phi(h_3),p(\cdot) \} & 972 & 972 \\
\{ \phi(h_4),p(\cdot) \} & 976 & 976 \\
\{ \phi(h_2),p(t) \} & & 971 \\
\{ \phi(h_3),p(t) \} & 975 & 1055 \\
\{ \phi(h_4),p(t) \} & 979 & 979 \\
\{ [\phi(h),p(h)]_2 \} & 970 & 959 \\
\{ [\phi(h),p(h)]_3 \} & 951 & 951 \\
\{ [\phi(h),p(h)]_4 \} & 957 & 957 \\
\{ [\phi(h),p(t+h)]_2 \} & 967 & 972 \\
\{ [\phi(h),p(t+h)]_3 \} & 957 & 969 \\
\{ [\phi(h),p(t+h)]_4 \} & 959 & 976 \\
\{ [\phi(h),p(t \times h)]_2 \} & 987 & 993 \\
\{ [\phi(h),p(t \times h)]_3 \} & 978 & 1047 \\
\{ [\phi(h),p(t \times h)]_4 \} & 993 & 1063 \\
\{ \phi(t+h_2),p(\cdot) \} & 982 & 987 \\
\{ \phi(t+h_3),p(\cdot) \} & 977 & 983 \\
\{ \phi(t+h_4),p(\cdot) \} & & 987 \\
\{ \phi(t+h_2),p(t) \} & 977 & 982 \\
\{ \phi(t+h_3),p(t) \} & 980 & 987 \\
\{ \phi(t+h_4),p(t) \} & 985 & 992 \\
\{ [\phi(t+h),p(h)]_2 \} & 965 & 967 \\
\{ [\phi(t+h),p(h)]_3 \} & 956 & 959 \\
\{ [\phi(t+h),p(h)]_4 \} & 962 & 966 \\
\{ [\phi(t+h),p(t+h)]_2 \} & 965 & 984 \\
\{ [\phi(t+h),p(t+h)]_3 \} & 959 & 1000 \\
\{ [\phi(t+h),p(t+h)]_4 \} & 965 & 1009 \\
\{ [\phi(t+h),p(t \times h)]_2 \} & 981 & 1043 \\
\{ [\phi(t+h),p(t \times h)]_3 \} & 987 & 1185 \\
\{ [\phi(t+h),p(t \times h)]_4 \} & 994 & 1080 \\
\{ \phi(t \times h_2),p(\cdot) \} & 978 & 991 \\
\{ \phi(t \times h_3),p(\cdot) \} & 993 & 1045 \\
\{ \phi(t \times h_4), p(\cdot) \ & 1012 & 1023 \\
\{ [\phi(t \times h), p(h)]_2 \} & 970 & 974 \\
\{ [\phi(t \times h), p(h)]_3 \} & 1000 & 990 \\
\{ [\phi(t \times h), p(h)]_4 \} & 1003 & 1000 \\
\end{xtabular}
\end{center}
\end{document}
就 而言,仍然不令人满意longtable
。