编译我的 LaTeX 源代码时出现以下错误:
! LaTeX Error: \begin{document} ended by \end{sidewaystable}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.98
导致问题的表格在 chapter1.tex 中定义,并包含在主文档中\include{chapter1}
,具体如下:
\afterpage{
\clearpage
\begin{sidewaystable}
\begin{center}
\scalebox{0.75}{
\begin{tabular}{p{4cm}|c|p{4cm}|p{5cm}l|ll|l|}
\hline
\multicolumn{3}{c|}{}
& \multicolumn{2}{c|}{Time Complexity}
& \multicolumn{2}{c|}{Space Complexity} \\
\hline
Author
& Year
& Method
& $m < n$
& $m = n$
& $m < n$
& $m = n$ \\
\hline
\hline
...
\hline
\end{tabular}
}
\caption{Time and space complexity of algorithms used to calculate Hermite Normal Form matrices measured in terms of the matrix dimension, $n$, by letting $M = O(n^c)$ for some constant $c$, and $m = O(n)$. Such conversions will be denoted by $O^{\thicksim}$(*).}
\end{center}
\end{sidewaystable}
\clearpage
}
主源文件使用report
文档类。它还使用以下包:
\usepackage{uowthesis}
\usepackage{epsfig}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathdots}
\usepackage{color}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{epsf}
\usepackage{float}
\usepackage{multirow}
\usepackage{afterpage}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
除了一些\newtheorem
和\newcommand
语句之外,主源文件没有什么特别之处导致它以这种方式运行,除非\afterpage
(上面的)语句干扰了主源中也包含的\beforepreface
和语句。\afterpreface
请注意,由于篇幅限制,我决定不将主要源文件粘贴为本问题中的示例代码。此外,由于违反保密、知识产权等。但是,如果需要,我可以详细说明主要源的某些部分。
修改:法案 2012 年 1 月 3 日 - 添加了示例主文件。
这是主文件的精简版本,可用于引起/显示问题。希望对您有所帮助。
\documentclass[a4,12pt]{report}
\usepackage{uowthesis}
\usepackage{epsfig}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathdots}
\usepackage{color}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{epsf}
\usepackage{float}
\usepackage{multirow}
\usepackage{afterpage}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
%
\title{Optimal Key Lengths and Digital Signatures}
\author{Vasilios Evangelos Tourloupis}
\dedicate{My Family}
\degree{Master of Computer Science}
\dept{School of Computer Science and Software Engineering}
\beforepreface
%\include{abstract} % Abstract
%\include{acknowledgement} % Acknowledgements}
%\include{papers} % Publications
\afterpreface
\include{chapter1} % Introduction
\include{Chapter2} % Background
\include{Chapter3} % Efficient Self-Certified Signatures with Batch Verification
\include{chapter4} % Self-Certified Ring Signatures
\include{Chapter5} % Conclusion
%\bibliographystyle{alpha}
%\bibliography{thesis} %\include{NoCites} % Important references (probably not cited before)
\end{document}
答案1
uowthesis
是为 LaTeX 2.09 编写的旧 LaTeX 样式。特别是的重新定义与 LaTeX2e 不兼容。作为一种解决方法,可以在包含样式之前\@xfloat
保存的定义,然后进行适当的重新定义:\@xfloat
uowthesis
\documentclass[a4paper,12pt]{report}
% Save \@xfloat
\makeatletter
\let\@xfloat@ORI\@xfloat
\makeatother
\usepackage{uowthesis}
% Redefine \@xfloat in a way which works with LaTeX2e
\makeatletter
\def\@xfloat#1[#2]{%
\@xfloat@ORI{#1}[{#2}]%
\def\baselinestretch{1}\@normalsize} % This line taken from uowthesis
\makeatother
\usepackage{rotating}
\begin{document}
\begin{sidewaystable}
\centering
\begin{tabular}{p{4cm}|c|p{4cm}|p{5cm}l|ll|l|}
\hline
\multicolumn{3}{c|}{}
& \multicolumn{2}{c|}{Time Complexity}
& \multicolumn{2}{c|}{Space Complexity} \\
\hline
% ...
\hline
\end{tabular}
\caption{Time and space complexity of algorithms...}
\end{sidewaystable}
\end{document}
请注意,这也不是最新的编码。更好的方法是使用setspace
包来实现此目的。会setspace
自动为浮动环境和脚注启用单倍行距,因此无需修补\@xfloat
,\@footnotetext
就像在中所做的那样uowthesis
。
答案2
您可能打开了某些东西但未关闭。(它可能在源文档中,也可能在某个宏的扩展中。)
注释掉某些内容,直到找到可行的内容。然后再添加回去。此时,您就知道有问题的部分了。