![如果将表格列表放在图表列表之后,则为空](https://linux22.com/image/406452/%E5%A6%82%E6%9E%9C%E5%B0%86%E8%A1%A8%E6%A0%BC%E5%88%97%E8%A1%A8%E6%94%BE%E5%9C%A8%E5%9B%BE%E8%A1%A8%E5%88%97%E8%A1%A8%E4%B9%8B%E5%90%8E%EF%BC%8C%E5%88%99%E4%B8%BA%E7%A9%BA.png)
我不是 LateX 专家,所以如果我的问题太明显,我深表歉意。这是我的问题:我正在用 Overleaf(课本)写我的硕士论文,我注意到我的表格列表什么都没有显示,它完全是空的,而代码如下:
\tableofcontents
\listoffigures
\listoftables
但如果我把 Lot 和 Lof 的顺序颠倒过来,比如
\tableofcontents
\listoftables
\listoffigures
然后,正常的表格列表就会出现,这是应该的。我尝试清除缓存文件,编译两次,但我遗漏了一些可能很明显的东西。有什么想法吗?我可以提供一个 MWE(即使它不是那么小)
这是包含我使用的所有软件包的 MWE。在论文中,我实际上使用 \input{Abstract.tex} 来描述 \chapter(Abstract)(和类似内容)。我没有粘贴参考书目部分(图片很随意,只是一个例子)。非常感谢任何知道我遗漏了什么的人!
\documentclass[11pt,twoside, openright, cleardoublepage=empty
]{book}
\usepackage[english]{babel}
\usepackage{geometry}
%\geometry{a4paper,top=35mm,bottom=35mm,inner=30mm}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\usepackage{emptypage}
\fancyhead[RO]{\nouppercase\rightmark}
\fancyhead[LE]{\textit\leftmark}
\fancyfoot[C]{\thepage}
\usepackage{blindtext}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage[font=small,format=hang,labelfont={sf,bf}]{caption}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{array}
\usepackage{csquotes}
\usepackage{rotating}
\usepackage{color}
\usepackage{colortbl}
\usepackage{subfig}
\usepackage{longtable}
\usepackage{lscape}
\usepackage{hyperref}
\usepackage{textcomp}
\usepackage{caption}
\usepackage{eurosym}
\usepackage{multirow}
\usepackage{pdfpages}
\usepackage{floatrow}
\usepackage{multicol}
\usepackage{wrapfig}
\usepackage{verbatim}
\usepackage{threeparttable}
\usepackage[toc,page]{appendix}%for Appendix
\usepackage{floatrow}
\usepackage{siunitx}
\DeclareSIUnit \year {y}
\usepackage{eurosym}
\PassOptionsToPackage{hyphens}{url}\usepackage{hyperref}
\usepackage{bm}
\usepackage{adjustbox}
\usepackage{booktabs}
\usepackage{varwidth}
\usepackage{url}
\usepackage{guit}
\newlength{\adjust}
\usepackage{verbatim}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
\usepackage{url} % To break long url
\makeatletter
\g@addto@macro{\UrlBreaks}{\UrlOrds}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
\usepackage{nomencl}[noprefix] %% Symbols List
\makenomenclature
\usepackage{etoolbox}
\renewcommand\nomgroup[1]{%
\item[\bfseries
\ifstrequal{#1}{G}{\large{Greek letters}}{%
\ifstrequal{#1}{R}{\large{Roman letters}}{%
\ifstrequal{#1}{O}{Other Symbols}{}}}%
]}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newenvironment{abstract}%
{\cleardoublepage\null\vfill\begin{center}%
\bfseries\abstractname\end{center}}%
{\vfill \null }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DOCUMENT
\begin{document}
\frontmatter
% \frontmatter
% \includepdf[]{FrontespizioTESI} % this document layout is compulsory fro my University
% \thispagestyle{empty}
% \cleardoublepage
\thispagestyle{empty}
\begin{flushright}
\null\vspace {\stretch {1}}
\textit{Eventual text here}
\vspace {\stretch{2}}\null
\end{flushright}
\tableofcontents
\listoffigures
\listoftables
% \renewcommand{\nomname}{List of Symbols}
% \newcommand{\nomunit}[1]{%
% \renewcommand{\nomentryend}{\hspace*{\fill}#1}}
% \printnomenclature
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\mainmatter
\chapter*{Abstract}
\addcontentsline{toc}{chapter}{Abstract}
% \thispagestyle{empty}
This work aims to ...
\chapter*{Introduction}
\pagestyle{plain}
\addcontentsline{toc}{chapter}{Introduction}
This is going to be the introduction of this work...
\chapter{First chapter}
\pagestyle{fancy}
This will be the first chapter...
This could be a figure
\begin{figure}[ht]
\centering
\includegraphics[scale=0.25]{Cervino.jpg}
\caption[image of Cervino]{This is Cervino mountain}
\label{fig:my_label}
\end{figure}
and this one a table:
\begin{table}[ht]
\begin{tabular}{|c|c|c|c|c|l|}
\hline
\multirow{2}{*}{\textbf{Hs {[}m{]}}} & \multirow{2}{*}{\textbf{Tp {[}s{]}}} & \multirow{2}{*}{\textbf{Direction {[}°{]}}} & \multirow{2}{*}{\textbf{DSPR {[}°{]}}} & \multicolumn{2}{c|}{\textbf{Resolution}} \\ \cline{5-6}
& & & & \multicolumn{1}{l|}{fine grid} & coarse grid \\ \hline
0.5 & 15.2 & -65 & 15 & 300 & \multicolumn{1}{c|}{3000} \\ \hline
\end{tabular}
\caption[wave data table]{This is table on wave data}
\label{Table}
\end{table}
\end{document}
答案1
我将您的文档示例简化为:
\documentclass[11pt,twoside, openright, cleardoublepage=empty]{book}
\usepackage[font=small,format=hang,labelfont={sf,bf}]{caption}
\usepackage{graphicx}
\PassOptionsToPackage{hyphens}{url}
\usepackage{hyperref}
\begin{document}
\frontmatter
\tableofcontents\listoftables\listoffigures
\mainmatter
\chapter{one}
\section{one}
\section{two}
\section{three}
One image
\begin{figure}[ht]
\centering
\includegraphics[scale=0.25]{example-image-a}
\caption[Image of Cervino]{This is Cervino mountain}
\label{fig:my_label}
\end{figure}
and one a table:
\begin{table}[ht]
\centering
\begin{tabular}{|c|c|}
\hline
1 & 2 \\
\hline
\end{tabular}
\caption[wave data table]{This is table on wave data}
\label{Table}
\end{table}
\end{document}
经过两次编译后,它给出了所需的结果。您可以通过在其前言中添加包和定义来扩展 MWE,看看其结果是否会改变(我希望不会改变)。
答案2
我终于解决了这个问题(愚蠢,我的错):在所有的 \input{chapter.tex}(1,2,3 等)之后。我有一个 appendix.tex,在 appendix.tex 里面,开头有:
\addtocontents{lof}{\protect\setcounter{tocdepth}{0}}
我将 0 改为 2,表格列表不再为空。我想,这是一个内容显示深度的问题。感谢社区!