[Tex/LaTex] Error message: too many }’s

compilingerrors

I have a LaTeX document which works fine but whenever I try to add in an image with a figure caption it gives me an error saying there are to many }'s.

\begin{figure}[h!]
  \caption{A picture of a gull.}

  \includegraphics[width=0.5\textwidth]{uml-usecase/overview.png}
\end{figure}

My current packages are:

\usepackage{amsfonts}
\usepackage{amssymb,amsmath}
\usepackage{amsthm}

\usepackage{newlfont}
%\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{lscape}
\usepackage{rotating}

\usepackage{latexsym}
\usepackage{natbib}
\usepackage{geometry}
\usepackage{fancyhdr}
\usepackage{xthesis}
\usepackage{xtocinc} %Include Table of Contents as the first entry in TOC
\usepackage{subfigure}
\usepackage{times}

\usepackage{hyperref}
\usepackage{xcolor}
\usepackage[dvips]{graphicx}
\bibpunct[, ]{(}{)}{;}{a}{,}{,}

As far as I can see it's right, can anyone figure out where I am going wrong?

Best Answer

Most probably it is the package xthesis that contains some pieces of code to redefine \@xfloat in a bad way. It seems that many university's thesis templates contain such a definition from a file named doublespace.sty. The solution is to (re)define \@xfloat in a "good" way, for example: a work around here