38

I tried to add hyperref package, but TexWorks has this error:

Runaway argument?
{\@firstoffive }\fi . \begin {figure}[h!] \centering \includegraphics \ETC.
! Paragraph ended before \Hy@setref@link was complete.
<to be read again> 
                   \par 
l.12

Please, can anyone see the mistake in this?

\documentclass[a4paper,11pt]{report}
\usepackage[T1]{fontenc}    
\usepackage[czech,english]{babel}
\usepackage[cp1250]{inputenc}     
\usepackage{amssymb, amsmath}    
\usepackage{epsfig}     
\usepackage[a4paper]{geometry}     
\usepackage{natbib}    
\usepackage{graphicx}     
\usepackage{booktabs}    
\usepackage{a4wide}
\usepackage{array}
\usepackage{paralist}     
\usepackage{verbatim}     
\usepackage{subfig}     
\usepackage{natbib}    
\usepackage{wrapfig}    
\usepackage{xcolor}    
\usepackage{index}     
\usepackage[linktoc=all]{hyperref}
\hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=black,
    urlcolor=black
}
Stefan Kottwitz
  • 231,401
user28990
  • 381
  • 3
    Welcome to TeX.SE! Real quick -- by indenting lines of LaTeX code by four spaces, the material will be "pretty-printed" automatically, making it much easier to read. Please edit your example to create a minimum working example (MWE) that generates the issue you're trying to fix. Much of the preamble material you've posted would appear to be irrelevant to the error you report, which seems to be occurring somewhere inside a figure environment. – Mico Apr 13 '13 at 20:18
  • You error message has l.12 which means the error occurred on line 12. I assume you have \input or \included files. Have a look in the log file to see what's the last named file before that error. That will help trace where the error occurs so that you can create a MWE – Nicola Talbot Apr 13 '13 at 21:35
  • 13
    If you have any \include files and then add hyperref make sure you delete all the the .aux files, or do not use \includeonly for one run so fresh ones get generated. (unrelated but don't load epsfig unless you need compatibility with the LaTeX2.09 package of that name ie documents from 1980's) – David Carlisle Apr 13 '13 at 22:08
  • 81
    remove all .aux files, then try again. – barbara beeton Apr 13 '13 at 22:29
  • If you use the option -file-line-error and compile from the terminal, it should tell you which file has the problematic code. – jon Apr 13 '13 at 22:48
  • 2
    Without a full MWE, this is unclear as the error could be anywhere. As Barbara comments, a fault in the .aux file is likely: deleting it and re-running LaTeX may well solve the issue. – Joseph Wright Aug 13 '13 at 07:34
  • Who has done the reopen call without editing the question and without any comment explaining the reopen reason? – Schweinebacke Jun 25 '17 at 07:13
  • With a similar error, I found that simply rerunning pdflatex worked. – Joe Corneli Aug 08 '17 at 16:43
  • 8
    Had the same problem six years after the question was posed and removing the .aux files worked for me. I wish the question would be reopened and Barbara Beeton would post the comment as answer so I could upvote it properly. As it is, comments can theoretically vanish at any time. – NoDataDumpNoContribution Apr 05 '19 at 10:46
  • This question should be reopened. It helped me, has +33/-0, and the answer-as-comment by Barbara Breeton has +75, so it looks like it helped more people. – wimi Apr 16 '21 at 08:33
  • @barbarabeeton Thanks for the simple solution. Removing the .aux files solves the issue. – GA316 Nov 17 '21 at 01:26
  • 1
  • @barbarabeeton Was going to promote your comment to a CW answer, but I’ll follow your suggestion and vote to link to the dupe instead. – Davislor Nov 17 '21 at 23:24
  • 1
    @Davislor -- That gives the reason, not just an easy fix. In the long run, I think that's more valuable. Thanks, – barbara beeton Nov 18 '21 at 00:43

0 Answers0