So you have a document that used algorithm2e and want to apply the elsart document class to it? Well, with the latest version of algorithm2e (3.9, released 4 October 2005) you'll get the error:
! Too many }'s.
l.1616
What do you do? You need to undefine algorithm before loading the algorithm2e package, since both elsart and algorithm2e define the algorithm environment. This answer is discussed in this post. Sometime before \usepackage{algorithm2e} you need:
\makeatletter
\newif\if@restonecol
\makeatother
\let\algorithm\relax
\let\endalgorithm\relax
This took me a while to discover, so I hope having this information in another place on the web is helpful.
Thanks man .. been trying every combination i could think of for the last 2 days.
Posted by: Thanks man ... | January 26, 2008 at 06:46 AM
Thanks a lot. It works perfectly.
Posted by: Junio | February 01, 2008 at 07:31 AM
Thank you very much for posting this information here. After months of this error bugging me, I am very happy it is now fixed. The original post you link to didn't come up in my searches (only your page as #1 googling "latex elsart algorithm2e too many").
Posted by: Matt Duckham | March 26, 2008 at 03:09 PM
Props for the trick, it did help me alot
Posted by: Alexandre Faure | June 29, 2008 at 09:54 AM
Thanks for this. This had been bugging me for a while, but while I was using TexNixCenter it only issued a warning... But now I wanted to switch to Led and I got a compilation error. Anyway, you fixed it. :)
Posted by: José Ribeiro | September 08, 2009 at 03:54 PM