我正在尝试使用\makebox
来居中一个宽\supertabular
表,但如果该表跨越多页,LaTeX 会给出! Missing \endgroup inserted
。关于如何居中宽表,您有什么想法supertable
吗?
下面是一个示例,如果您删除一行以使表格适合一页,则效果很好:
\documentclass{article}
\usepackage{supertabular}
\begin{document}
\tablehead{
\hline \hline
1 & 2 & 3 & 4 & 5 \\ \hline
}
\tabletail{
\hline \hline
}
\noindent\makebox[\textwidth]{
\begin{supertabular}{ c c c c c c}
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
\end{supertabular}
}
\end{document}
此外,的标题supertable
似乎有问题,包括\tablecaption
的结果! Missing \endgroup inserted
:
\documentclass{article}
\usepackage{supertabular}
\begin{document}
\tablehead{
\hline \hline
1 & 2 & 3 & 4 & 5 \\ \hline
}
\tabletail{
\hline \hline
}
\tablecaption{example table}
\noindent\makebox[\textwidth]{
\begin{supertabular}{ c c c c c c}
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
\end{supertabular}
}
\end{document}
答案1
您不想使用盒子,因为根据定义,它不会跨页。
通常情况下,您可以只使用\centering
,但首先您需要使文本宽度比内容更宽,这样居中才能起作用(对于任何居中,而不仅仅是表格,您都需要这样做)outdent
这里的环境只是一个副本,quote
但减少而不是增加边距,并添加\centering
。
\documentclass{article}
\usepackage{supertabular}
\newenvironment{outdent}
{\begin{list}{}{\leftmargin-2cm\rightmargin\leftmargin}\centering\item\relax}
{\end{list}\ignorespacesafterend}
\begin{document}
\tablehead{
\hline \hline
1 & 2 & 3 & 4 & 5 \\ \hline
}
\tabletail{
\hline \hline
}
\noindent X \dotfill X
\begin{outdent}
\noindent X \dotfill X
\begin{supertabular}{ c c c c c c }
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
AAAAAAAAAA & BBBBBBBBBB & DDDDDDDDDDD & EEEEEEEEEE & FFFFFFFFFF \\
\end{supertabular}
\end{outdent}
\end{document}