\lstlistoflistings 导致错误

\lstlistoflistings 导致错误

我的问题是,我向 Tex 文档添加了一些列表。第一次运行时一切正常,所有内容都显示出来。第二次重新运行后,它不再编译。

错误:

 !Paragraph ended before \contentsline was complete. <to be read again> \par l.6 ...9.4169pt}\xdef 101.60083pt{101.60083pt}\par \noindent \hbox {}\global... 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.

一旦我删除

\lstlistoflistings 

为了显示目录中的列表,它会再次编译。

我已经从列表中删除了所有标题。但它仍然不起作用。

非常感谢您的帮助。

妇女权利委员会:

\documentclass[a4paper,12pt,headsepline]{scrartcl}    
% Use PNG graphics
\usepackage{graphicx}

\usepackage{glossaries}
\makeglossaries

% Listing
\usepackage{listings}
\usepackage{color}

% Package for textcolors
\usepackage{color}

% picture captions
\usepackage{capt-of}

% create indexes
\makeindex
% Href
\usepackage{nameref}

% Colors for background of listing
\definecolor{myGrey}{gray}{0.9}
% Style of the listing
\lstset{
language=java,                      % Code language
basicstyle=\scriptsize\ttfamily,    % Style
keywordstyle=\color{red}\bfseries,  % Style for keywords
identifierstyle=\color{blue},       % Identifier get special color
stringstyle=\ttfamily,              % Stil of the Strings 
breaklines=true,            
numbers=left,               
numberstyle=\tiny,          
frame=single,               
backgroundcolor=\color{myGrey},     
caption={Java-Code},            % Caption
tabsize=2               
}



\begin{document}

% Main Page%
\include{latex_settings}
% show table of contents
\newpage
\tableofcontents
 %show all figures in table of content
 \listoffigures
 %show all listings in table of content
 \lstlistoflistings (**this caused the error**)
 %input other tex documents
 \input{tex}

 \printglossaries

 \end{document}

答案1

看起来您使用了一个脆弱的命令,删除包含列表的生成文件,也可能会删除除您的 tex 源之外的所有文件,然后.aux再试一次。

如果你把标题放回去,请在任何脆弱的命令前加上前缀,\protect这样它就不会在外部文件写入时在错误的时间扩展)

相关内容