我尝试制作一个最小的工作示例,但很难重现此行为。我希望你们中的一些人遇到了同样的问题,并能够找出问题的根源。
基本上,我的某些表格没有出现在生成的 pdf 中,而是看到一些逗号,如下所示:
你们中有人遇到过这种情况吗?
这是我的序言,表格来自我正在撰写章节的单独文件
\documentclass[11pt,a4paper,twoside,openany]{book}
% paragraph spacing and indentation
\setlength\parindent{0cm}
\setlength\parskip{11pt}
% Remove asymmetric to swap margins
\usepackage[top=2cm, bottom=4cm, left=3cm, right=3cm, asymmetric]{geometry}
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{afterpage}
\usepackage{amsmath,amssymb}
\usepackage{rotating}
\usepackage{fancyhdr}
\usepackage[font=small,labelfont=bf,textfont=up]{caption}
% links
\usepackage{xcolor}
\usepackage{hyperref}
\definecolor{hyperlinkcolor}{rgb}{0.23, 0.27, 0.29} % arsenic
\hypersetup{
colorlinks=true, % false: boxed links; true: colored links
linkbordercolor=lightgray,
linkcolor=hyperlinkcolor, % color of internal links
citecolor=hyperlinkcolor, % color of links to bibliography
filecolor=hyperlinkcolor, % color of file links
urlcolor=hyperlinkcolor
}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\renewcommand{\captionfont}{\normalfont \sffamily \itshape \small}
%Algorithms
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
% Tables
\usepackage{array}
\usepackage{booktabs} % toprule, ...
\usepackage[flushleft]{threeparttable}
\begin{document}
\frontmatter
\pagestyle{plain} % No headers in front matter
%\input{frontmatter/titlepage}
\thispagestyle{empty}
\normalfont
\cleardoublepage
\setcounter{page}{1} % TOC is page 1
{ % index
\setlength\parskip{0pt}
\hypersetup{
colorlinks=true, % false: boxed links; true: colored links
linkcolor=black, % color of internal links
}
\tableofcontents
\listoffigures
\listoftables
}
\cleardoublepage
%\input{frontmatter/summary}
%\input{frontmatter/aknowledgments}
\clearpage
\mainmatter
% Headers
\fancyfoot{} % Remove the number of the page at the bottom
\pagestyle{fancy}\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[RE]{\bfseries\leftmark}
\fancyhead[LO]{\bfseries\rightmark}
\renewcommand{\headrulewidth}{0.3pt}
%\input{chapters/c1}
%\input{chapters/c2}
%\input{chapters/c2}
%\input{chapters/c3} % dummy titles...
%\input{chapters/results}
\cleardoublepage
% ---- Bibliography ----
\addcontentsline{toc}{chapter}{Bibliography}
\bibliographystyle{alpha}
%\bibliography{references}
%\nocite{*}
\appendix
\pagestyle{plain}
%\input{appendices/app1}
\end{document}
答案1
- 抱歉,您的文档示例不包含可以证实您的主张的信息(它不包含任何表格)
- 如果您遵守 LaTeX 文档编码规则,我真的怀疑这种情况是否会发生。
- 您的文档序言有点不寻常:
hyperref
包及其设置应该(除了极少数例外,我在你的文档示例中没有看到)在序言中最后加载- 所有新命令、页面样式等的定义都应放在序言中。文档正文应仅包含文档内容以及必要的标记说明。
- 不要按原样使用过时的软件包
subfigure
。相反,现在可以使用subfig
,并且subcaption
语法略有不同:\subfigure
-->subfloat
atsubfig
和
\begin{subfigure}[<position>]{<width>}
\includegraphics[...]{...}
\caption{...}
\label{...}
\end{subfigure}
在subcaption
。
- 我怀疑您的错误是由您的表格构造引起的。我(或任何人)可以确认这一点,您应该显示表格代码,这些代码会消失。下面的 MWE 中使用的小表格不会发生这种情况。
下面是有关如何重新组织序言的建议,并提供了运行良好的文档正文的示例:
\documentclass[11pt, a4paper,twoside,openany]{book}
% Remove asymmetric to swap margins
\usepackage[vmargin={2cm, 4cm},
hmargin=3cm,
asymmetric % due to equal left and right text border is not needed
]{geometry}
% paragraph spacing and indentation
\setlength\parindent{0cm}
\setlength\parskip{11pt}
\usepackage[english]{babel}
\usepackage{lipsum} % added for dummy text
%Algorithms
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
% Tables
\usepackage{array}
\usepackage{booktabs} % toprule, ...
\usepackage[flushleft]{threeparttable}
\usepackage{rotating}
\usepackage{graphicx}
%\usepackage{subfigure} % it is obsolete, use
\usepackage{subfig}
\usepackage{afterpage}
\usepackage{amsmath,amssymb}
% Headers
\usepackage{fancyhdr}
\fancyfoot{} % Remove the number of the page at the bottom
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[RE]{\bfseries\leftmark}
\fancyhead[LO]{\bfseries\rightmark}
\renewcommand{\headrulewidth}{0.3pt}
\usepackage[font={small,sf}, labelfont=bf]{caption}
% links
\usepackage{xcolor}
\usepackage{hyperref}
\definecolor{hyperlinkcolor}{rgb}{0.23, 0.27, 0.29} % arsenic
\hypersetup{
colorlinks=true, % false: boxed links; true: colored links
linkcolor=black, % color of internal links
colorlinks=true, % false: boxed links; true: colored links
linkbordercolor=lightgray,
linkcolor=hyperlinkcolor, % color of internal links
citecolor=hyperlinkcolor, % color of links to bibliography
filecolor=hyperlinkcolor, % color of file links
urlcolor=hyperlinkcolor
}
\begin{document}
\frontmatter
\pagestyle{plain} % No headers in front matter
%\input{frontmatter/titlepage}
\thispagestyle{empty}
%\normalfont % <--- not needed
\cleardoublepage
\setcounter{page}{1} % TOC is page 1
\tableofcontents
\listoffigures
\listoftables
%\cleardoublepage % <--- not needed
%\input{frontmatter/summary}
%\input{frontmatter/aknowledgments}
%\clearpage % <--- not needed
\mainmatter
\pagestyle{fancy}
%%%% FOR TEST PURPOSES ONLY
\chapter{Does table really disappear?}
\lipsum
\begin{table}[ht]
\caption{My table not disaper from document}
\centering
\begin{tabular}{|c|c|c|}
\hline
1 & 2 & 3 \\
\hline
\end{tabular}
\end{table}
%%%%
%\input{chapters/c1}
%\input{chapters/c2}
%\input{chapters/c2}
%\input{chapters/c3} % dummy titles...
%\input{chapters/results}
\cleardoublepage
\appendix
\pagestyle{plain} % <--???
%\input{appendices/app1}
\backmatter
% ---- Bibliography ----
\pagestyle{plain}
\addcontentsline{toc}{chapter}{Bibliography}
\bibliographystyle{alpha}
%\bibliography{references}
%\nocite{*}
\end{document}
经过两次编译得到:
结论: 以上并不是真正的答案。更多收集了一些关于如何组织文档的提示。
为了帮助您解决表格“消失”的问题,您应该按照我的 MWE 格式准备您的 MWE,以重现您的问题。这意味着用您的问题制造者表格替换我的表格。如果它能正常工作,那么您的文档文件中就会出现一些奇怪的东西。从提供的信息中无法找出原因。抱歉...