Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

my problem is, I added some listings to my Tex document. On the first run everything went fine and all was shown. After the second rerun, it does not compile anymore.

Error:

 !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.

As soon as I delete the

\lstlistoflistings 

to show the listings in the table of content, it does compile again.

I already deleted all captions from the listings. But it is still not working.

Every help is appreciated.

The MWE:

\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}
share|improve this question
    
Looks like you used a fragile command, delete the generated file with the listings probably delete all files except your tex source so .aux as well then try again. –  David Carlisle May 16 at 15:30
    
@DavidCarlisle this really did the job, should have thought about this. Post your comment as answer, gonna mark it as solved asap. Thanks a lot –  broesel001 May 16 at 15:35
1  
@broesel001 It would be better if you added the offending caption. –  egreg May 16 at 15:57
1  
Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Christian Hupfer May 16 at 15:58
    
@ChristianHupfer I did at a little MWE, hope this helps –  broesel001 May 16 at 16:53

1 Answer 1

up vote 4 down vote accepted

It looks like you used a fragile command, delete the generated file with the listings probably delete all files except your tex source so .aux as well then try again.

If you put your captions back, prefix any fragile command with \protect so it does not expand at the wrong time while the external file is being written)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.