双列环境中的 supertabular

双列环境中的 supertabular

我写了一个文档,它代表了一些东西的目录。大部分内容是一个长表,表头位于两个平衡的列中。xelatex用于构建 pdf。

longtabu我计划使用禁忌但似乎与multicols和不兼容在 LaTeX 中平衡多列内的长表不支持解决方案标头。

所以目前我supertabular使用使用新命令将 Supertabular 转换为 Multicols。它运行良好,但第一页看起来不正确。第一列未完全填充:

在此处输入图片描述

此外,如果删除标题,它不会填充所有页面上的两列: 在此处输入图片描述

为什么会发生这种情况以及如何解决?

\documentclass[10pt,twoside,a4paper]{book}
\usepackage{polyglossia}
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{supertabular}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage[table]{xcolor}
\usepackage[
    top=29mm,
    left=20mm,
    right=10mm,
    bottom=13mm,
    headheight=28mm,
    headsep=-4mm,
    twoside,
    a4paper]
{geometry}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% page style
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\definecolor{HeadBg}{HTML}{004687}
\definecolor{FooterBg}{HTML}{D9DCEB}

\newcommand{\hd}{%
\begin{tabular}{@{}c@{}}
\color{HeadBg}\rule{\textwidth}{19mm} \\
\end{tabular}
}

\newcommand{\fd}[1]{%
\begin{tabular}{@{}p{10mm}@{}}
\centering\rule{0mm}{8mm}\cellcolor{FooterBg}\raisebox{1em}{#1} \\
\end{tabular}
}

\fancypagestyle{codetable}{%
    \fancyhf{}
    \fancyhead[EC]{\hd}
    \fancyhead[OC]{\hd}
    \fancyfoot[C]{\fd{\thepage}}
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0pt}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% table stuff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% https://tex.stackexchange.com/questions/105717/trick-supertabular-into-multicols-in-new-command
%% BEGIN
\newcount\n
\n=0
\def\tablebody{}
\makeatletter
\loop\ifnum\n<100
        \advance\n by1
        \protected@edef\tablebody{\tablebody
                \textbf{\number\n.}& shortText
                \tabularnewline
        }
\repeat

\makeatletter
\let\mcnewpage=\newpage
\newcommand{\TrickSupertabularIntoMulticols}{%
  \renewcommand\newpage{%
    \if@firstcolumn
      \hrule width\linewidth height 0pt
      \columnbreak
    \else
      \mcnewpage
    \fi
  }%
}
\makeatother
%% END

\definecolor{CellBg}{HTML}{CCD1E4}

%% Header
\newcommand{\catalogheader}{
\rowcolor{CellBg}
\multicolumn{2}{c}{\rule{0pt}{10mm}\rule{20mm}{0pt}} &&\\
\rowcolor{CellBg}
\rule{15mm}{0pt} & \rule{15mm}{0pt}%
& \multirow{-2}{*}[7mm]{\rule{0pt}{15mm}\rule{20mm}{0pt}}
& \multirow{-2}{*}[7mm]{\rule{0pt}{15mm}\rule{22mm}{0pt}} \\
\arrayrulecolor{white}
\hline
\arrayrulecolor{black}
}


\setlength{\columnsep}{1mm}

%% http://xpt.sourceforge.net/techdocs/language/latex/latex22-Controlling/ar01s03.html
\def\nlines#1{\expandafter\nlineii\romannumeral\number\number #1 000\relax}
\def\nlineii#1{\if#1m\expandafter\theline\expandafter\nlineii\fi}
\def\theline{\cellcolor{CellBg}{\textbf{one}} & two & \cellcolor{CellBg}{three} & four \\ \hline}

\begin{document}
\pagestyle{codetable}

\begin{multicols}{2}
\TrickSupertabularIntoMulticols

\tablefirsthead{\catalogheader}
\tablehead{\catalogheader}
\begin{supertabular}{clll}
\nlines{500}
\end{supertabular}

\end{multicols}
\end{document}

我不熟悉 TeX lang,所以很难理解为什么这两列技巧有效。

我曾尝试过longtablextab和。并且比其他tabu方法更适合这项任务。supertabularsupertabular

如果该问题无法通过 supertabular 解决,那么也许还有其他支持标题、分页符和多列环境(基本上是两列)的表格包?

谢谢!

相关内容