如何自动拆分具有多列的长表?

如何自动拆分具有多列的长表?

我希望有一个表格,当它不适合页面时会自动中断。这可能吗?我手动制作了一个示例来说明所需的行为。我在一个小页面内创建了多个表格。请参阅下面的图片和代码。

表格示例

\begin{minipage}{\textwidth}

\begin{tabular}{|p{3cm}|c|c|c|c|c|c|c|c|c|c|}
\hline
letter & a & e & o & s & r & i & d & m & t & n \\ 
\hline
freq.\footnote{frequencia relativa de ocorrência} (\%) & 14.634 & 11.570 & 9.735 & 6.805 & 6.530 & 6.186 & 4.992 & 4.738 & 4.736 & 4.046 \\
\hline
\end{tabular}

\vspace{0.3cm}

\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
c & u & l & p & v & g & q & b & f & h & \~a & \^o & \^a \\
\hline
3.882 & 3.634 & 2.779 & 2.523 & 1.575 & 1.303 & 1.204 & 1.043 & 1.023 & 0.781 & 0.733 & 0.635 & 0.562 \\
\hline
\end{tabular}

\vspace{0.3cm}

\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
\'c & z & \^e & j & \'e & \'o & x & \'u & \'i & \'a & \`a & w & \"u \\
\hline
0.530 & 0.470 & 0.450 & 0.397 & 0.337 & 0.296 & 0.253 & 0.207 & 0.132 & 0.118 &   0.072 & 0.037 & 0.026  \\
\hline
\end{tabular}

\vspace{0.3cm}

\begin{tabular}{|c|c|}
\hline
k & y \\
\hline
0.015 & 0.006 \\
\hline
\end{tabular}
\end{minipage}

答案1

我删除了脚注和规则,因为它们使其变得更加困难:-)此外,退格的行数可以更加自动......

\documentclass{article}
\def\foo{\setbox0\vbox\bgroup
\tabcolsep4em plus 1fill
\let\\\cr
\halign\bgroup&\strut\hfil\ \ignorespaces##\unskip\ \hfil\cr}

\def\endfoo{%
\crcr\egroup
\par
\unpenalty\unskip
\global\setbox1\lastbox
\unpenalty\unskip
\global\setbox3\lastbox
\egroup

\raggedright
{\baselineskip=4\baselineskip
\noindent\unhbox3\par}

\vspace{-15\baselineskip}
\vspace{-\parskip}
{\baselineskip=4\baselineskip
\noindent\unhbox1\par}


}


\begin{document}


\begin{foo}
letter & a & e & o & s & r & i & d & m & t & n &
c & u & l & p & v & g & q & b & f & h & \~a & \^o & \^a &
\'c & z & \^e & j & \'e & \'o & x & \'u & \'i & \'a & \`a & w & \"u &
k & y \\
freq. (\%) & 14.634 & 11.570 & 9.735 & 6.805 & 6.530 & 6.186 & 4.992 & 4.738 & 4.736 & 4.046 &
3.882 & 3.634 & 2.779 & 2.523 & 1.575 & 1.303 & 1.204 & 1.043 & 1.023 & 0.781 & 0.733 & 0.635 & 0.562 &
0.530 & 0.470 & 0.450 & 0.397 & 0.337 & 0.296 & 0.253 & 0.207 & 0.132 & 0.118 &   0.072 & 0.037 & 0.026 &
0.015 & 0.006 
\end{foo}


\end{document}

相关内容