![我怎样才能修复具有两列布局的长超级表格?](https://linux22.com/image/303229/%E6%88%91%E6%80%8E%E6%A0%B7%E6%89%8D%E8%83%BD%E4%BF%AE%E5%A4%8D%E5%85%B7%E6%9C%89%E4%B8%A4%E5%88%97%E5%B8%83%E5%B1%80%E7%9A%84%E9%95%BF%E8%B6%85%E7%BA%A7%E8%A1%A8%E6%A0%BC%EF%BC%9F.png)
我尝试了很多解决方案来解决我的问题,最后采用的是这里的方法。我需要在 2 列布局文档中插入一个较长的超表(80 行)。目前我的表格没有在第二列继续,而是超出了页面的底部边缘并被剪裁。
这是我的消息来源:
\documentclass[a4paper,10pt,twocolumn,twoside,openright]{article}
\usepackage{supertabular,booktabs}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr,graphics,graphicx,color,xcolor,makeidx,setspace,html,htmllist}
%\usepackage{latexsym,ifthen}
\usepackage{stfloats,dblfloatfix}
\usepackage[small]{caption}
%\usepackage[usenames,dvipsnames]{color}
\begin{document}
.. other setions...
\section{current section}
\subsection{Material and methods}
... text of the section...
\begin{table}
\small
\tablefirsthead{
\toprule
\multicolumn{1}{@{\,}l}{App} &
\multicolumn{1}{@{\,}l}{Category} &
\multicolumn{1}{@{\,}l}{Free} &
\multicolumn{1}{@{\,}l}{Rating} &
\multicolumn{1}{@{\,}l}{DL} &
\multicolumn{1}{@{\,}l}{Class} \\
\midrule
}
\tablehead{%
\multicolumn{6}{c}%
{{\bfseries ... continued}} \\
\toprule
\multicolumn{1}{@{\,}l}{App} &
\multicolumn{1}{@{\,}l}{Category} &
\multicolumn{1}{@{\,}l}{Free} &
\multicolumn{1}{@{\,}l}{Rating} &
\multicolumn{1}{@{\,}l}{DL} &
\multicolumn{1}{@{\,}l}{Class} \\
\midrule
}
%
\tabletail {%
\midrule
\multicolumn{6}{r}{{Continue...}} \\
\midrule
}
\tablelasttail{%
\\
\midrule
\multicolumn{6}{r}{{Concluded}} \\
\bottomrule
}
\begin{supertabular}{p{0.15\textwidth}@{\,}l@{\,}l@{\,}c@{\,}c@{\,}l}
ACLS sim 2012 & medical & no & 4,2 & 7500 & - \\ \hline
... other rows...
Workout Trainer & H. \& Fit. & yes & 4,3 & 7500000 & \multicolumn{1}{l|}{} \\ \hline
\end{supertabular}
\end{document}
出了什么问题?我还尝试删除表格环境并将 \small 命令移至 supertabular 环境中:在这种情况下,表格位于第二列(下一页),但表格超出了除第一列之外的每一列的右边距。
先感谢您
答案1
由于您仅提供了该表的一些短片段,因此无法确定为什么长表不允许分列。
下面的代码实现了以下建议:
我使用
%%
(双注释符号)来注释掉那些对文档排版不利的指令。不要同时加载
graphics
和graphicx
。同样,不要同时加载color
和xcolor
。由于您正在使用该
booktabs
软件包,因此不是使用\hline
说明。相反,考虑使用\midrule
以获得更好的水平线间距。最重要的是:不是启动一个
table
环境来封装一个supertabular
环境。如前所述,无法准确诊断出主要问题的原因,因为您没有提供足够的材料来使环境supertabular
超过一列的高度。但是,我很确定是错误使用环境table
导致了这个问题。
\documentclass[a4paper,10pt,twocolumn,twoside,openright]{article}
\usepackage{supertabular,booktabs}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr, %% graphics, % do not load both 'graphics' and 'graphicx'
graphicx,%%color, % do not load both 'color' and 'xcolor'
xcolor,makeidx,setspace}
%%,html,htmllist % why on earth are you loading these two packages?
%\usepackage{latexsym,ifthen} % "latexsym" package has been obsolete for 20+ years
\usepackage{stfloats}%%,dblfloatfix} % Do you actually need 'dblfloatfix' package?
\usepackage[small]{caption}
%\usepackage[usenames,dvipsnames]{color}
\begin{document}
\dots other setions \dots
\section{Current section}
\subsection{Material and methods}
\dots text of the section \dots
%%\begin{table} %% not needed! In fact, it causes an error
\begingroup %%this is new; it localizes effect of "\small"
% reset "\tabcolsep": % no need for 17 [!!] instances of "@{\,}", right?
\setlength\tabcolsep{1.5pt}
\small
\tablefirsthead{%
\toprule
App & Category & Free &
\multicolumn{1}{l}{Rating} &
\multicolumn{1}{l}{DL} &
Class \\
\midrule
}
\tablehead{%
\multicolumn{6}{@{}l}{\bfseries \dots continued} \\[1ex]
\toprule
App & Category & Free &
\multicolumn{1}{l}{Rating} &
\multicolumn{1}{l}{DL} &
Class \\
\midrule
}
%
\tabletail {%
\midrule
\multicolumn{6}{r@{}}{Continued\dots} \\
\midrule
}
\tablelasttail{%
\\
\midrule
\multicolumn{6}{r@{}}{Concluded} \\
\bottomrule
}
\begin{supertabular}{@{}p{0.15\textwidth}llccl}
ACLS sim 2012 & medical & no & 4,2 & 7500 & - \\
\midrule
\dots other rows\dots \\
Workout Trainer & H.\,\& Fit. & yes & 4,3 & 7500000 & \\ \midrule
\end{supertabular}
\endgroup
\end{document}