# “Extra }, or forgotten \endgroup” error

Don't understand why this piece won't compile fluently. TeX file as following:

\begin{figure}
\centering
\includegraphics[width=\textwidth]{chapter2/epjb/groups_0.pdf}
\caption{\label{fig:epjbgroups} Schematic diagram indicating the presence of          coalescence
and fragmentation processes, for a population of $N=15$ objects
dynamically partitioned into clusters. The size of cluster $i$ is
$s_i=2$, while the size of cluster $j$ is $s_j=6$ etc. The
fragmentation process exhibits the richest range of possibilities,
given the combinatorial number of ways in which a cluster can in
principle be divided. There are many possible realizations of the
objects themselves, e.g.  humans, animals, macromolecules, though
for simplicity we show them as humans.}
\end{figure}


the output of pdfLaTeX is:

!Extra }, or forgotten \endgroup.
\color@endbox ->egroup
1.118 \end{figure}

?


Don't understand where the extra } come from.

### MWE:

\newcommand{\papers}{umthesis}

\documentclass[letterpaper,12pt,oneside,onecolumn,final,openany,pdftex]{\papers/umdiss}

\usepackage{cite}
\usepackage{epstopdf}
\usepackage{amsmath,amssymb,nicefrac}
\usepackage{psfrag}
\usepackage{subfigure}
\usepackage{url}
\usepackage{multirow}
\usepackage{rotating}
\usepackage{pifont}
\usepackage{boxedminipage}
\usepackage{amssymb}
\usepackage{bbm}
\usepackage{float}
\usepackage{lscape}
\usepackage{amsfonts}
\usepackage{helvet}
\usepackage{amsxtra}
\usepackage{multirow}
\usepackage{titletoc}
\usepackage{algpseudocode}
\usepackage{lastpage}
\usepackage{verbatim}
\usepackage{graphicx}

\begin{document}

\begin{figure}
\centering
\includegraphics[width=\textwidth]{groups_0.pdf}
\caption{\label{fig:epjbgroups} blablabla}
\end{figure}

\end{document}


problem still exist. So please someone help me to check the \usepackage? Many thanks.

• after the \caption the } is missing! – user2478 Mar 30 '12 at 16:46
• These are much too many packages for a minimal working example. Deleting those which are irrelevant for the error will not only make the example simpler, but is already an important step in finding the answer! – Stephan Lehmke Mar 30 '12 at 18:53
• With a umdiss.cls found on the net, I get only a warning relative to psfrag (which is incompatible with pdftex) – egreg Mar 30 '12 at 21:20
• I now merged your original question "Extra }, or forgotten \endgroup" error which was migrated with this one. This copied all comments and answer over here. Your two user accounts on StackOverflow and here actually should have been connected, allowing you to edit your old question. For some reason this didn't happened. You might have used a different email address etc. for both accounts. – Martin Scharrer Mar 31 '12 at 14:12

!Extra }, or forgotten \endgroup.
\color@endbox ->egroup
1.118 \end{figure}


As others have said the snippet you gave works without error in the standard classes (which is why we always ask for a complete example). However the error you show used to be common:

In 1993 when LaTeX2e was introduced figures (and other box commands) had modified definitions to support colour (which requires an extra group layer for technical reasons)

So, the error you show makes me suspect that you are using a class or package that is assuming an old (positively ancient:-) LaTeX2.09 definition of the figure environment without the extra colour groups, and another part of the code you are using is assuming the colour groups are there and so you get a group mis-match.

• The use of \usepackage{comment} and \excludecomment, attempting to remove figures triggered this for me. – jozxyqk Jun 25 '14 at 4:51
• Is there a list of packages that are known to assume the ancient definition of figures environment? – wilx Feb 19 '15 at 22:50
• @wilx no any package that is known about would have been fixed by now, this can only happen if some document comes out of cold storage and hasn't been used for 20 years and then is used with a current latex. – David Carlisle Feb 19 '15 at 22:56

I don't know if this helps because I was trying to solve the same problem. After one hour of head banging, I figured out that if you remove \usepackage{rotating} this particular error goes away. However, an alternative is probably needed to take care of the removal of the rotating package.

[Update]: This error for me was generated as result of using XThesis.sty that had issues in the definition of \@xfloat. After removing the whole definition of \@xfloat the error is gone. HTH others encountering similar problem.

I had the same issue. In my case the problem was that in a previous run the .out was corrupted somehow. Deleting this file and rerunning the pdflatex command solved the issue.

I also got this error. I was trying to make multiple subfigures appear on a landscape page using the pdflscape package like this:

\begin{figure}
\landscape


I found the proper way to do it here, here and here by importing the rotating package with \usepackage{rotating} in the preamble and instead of using \landscape doing this:

\begin{sidewaysfigure}


It seems this error has different sources of occurrences. After an hour of tedious work, I found that this happens because I was using the following package.

\usepackage[utf8x]{inputenc}


The error disappeared after commenting this line; you might want to take care of this package by other methods. Hope this helps someone with the same issue.

To add to the (seemingly endless) list of causes for which this error occurs, in my case it was because some @article entries in the.bib file were inserted without a journal field. Converting them to @misc fixed the issue.