图表列表产生错误,文档无法编译

图表列表产生错误,文档无法编译

我有一份需要图表列表的文档。它以前可以工作,但由于某种原因,文档无法再编译。抱歉,我不是 tex-Expert,但下面的错误消息说我可能没有关闭括号或类似的东西。当我注释掉时,一切都编译得很好\listoffigures

例子:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}

\usepackage{titlesec}

\titleformat*{\section}{\huge\bfseries}
\titleformat*{\subsection}{\Large\bfseries}

\titlespacing*{\section}
{0pt}{2cm}{1cm}
\titlespacing*{\subsection}
{0pt}{5.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}

\usepackage{tocloft}

\usepackage{geometry}
 \geometry{
 a4paper,
 left=23mm,
 right=23mm,
 top=23mm,
 bottom=23mm
 }

\title{Something}
\author{Team}
\date{\today}

\usepackage{natbib}
\usepackage{graphicx}

\usepackage{changepage}
\usepackage{lipsum}

\usepackage{bibentry}
\nobibliography*

\usepackage{longtable}
\usepackage{color}

\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}


\usepackage[hidelinks]{hyperref}
\usepackage{setspace}
\renewcommand{\baselinestretch}{1}
\usepackage{placeins}
\usepackage{amsmath}
\usepackage[gen]{eurosym}
\DeclareUnicodeCharacter{20AC}{\euro{}}
\usepackage{rotating}
\usepackage{pdfpages}
\usepackage{multirow}
\usepackage{adjustbox}
\usepackage[labelfont=bf, small]{caption}
\linespread{1.25}


\begin{document}

\pagebreak

\pagenumbering{Roman} %--- START

\section*{Acknowledgements}
\pagebreak

\tableofcontents
\pagebreak


\listoftables
\pagebreak

\listoffigures
\pagebreak

\pagenumbering{Roman} %--- END

\pagenumbering{arabic}
\setcounter{page}{1}


\section{Introduction}\label{sec:Introduction}


\begin{figure}[!ht]
\centering
    \includegraphics[scale=0.5]{Photo.PNG}
    \caption[Shortcaption]{Longcaption.}
    \label{fig:1}
\end{figure}
\FloatBarrier



\end{document}

我收到此错误:

Argument of \NAT@@citetp has an extra }.

<inserted text> 
                \par 
l.1 ...xxxreturns \citep [}}{4}{figure.caption.1}
                                                  %
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.

Runaway argument?
! Paragraph ended before \NAT@@citetp was complete.
<to be read again> 
                   \par 
l.1 ...xxxreturns \citep [}}{4}{figure.caption.1}
                                                  %
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.

还有这个错误:

Extra }, or forgotten \endgroup.

<recently read> }
                 
l.1 ...xxxreturns \citep [}}{4}{figure.caption.1}
                                                  %
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.

! Extra }, or forgotten \endgroup.
<argument> ...ces xxxxx \citep [}}
                                                  \hyper@linkend 
l.1 ...xxreturns \citep [}}{4}{figure.caption.1}
                                                  %
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.

答案1

如果标题是

\caption[Shortcaption \citep[p. 23]{xyz}]{Longcaption}

该问题是由于括号]结束了错误的可选参数造成的。

使固定:

\caption[Shortcaption {\citep[p. 23]{xyz}}]{Longcaption}

因为大括号会隐藏里面的括号。

顺便说一句,你应该使用\clearpage而不是\pagebreak并删除第二个\pagenumbering{Roman}没用的东西。也删除\setcounter{page}{1},因为\pagenumbering{arabic}已经处理好了。

相关内容