# Fixing wrapfig caption alignment?

I'm using wrapfig for the first time, and having a problem with its alignment of captions. As far as I can figure, what seems to happen is: if a caption is short enough that it fits it a single line of the figure, then instead of getting horizontally centered within the figure, it gets horizontally centred within a full \textwidth, starting at the left-hand edge of the figure, so it ends up way too far to the right (even off the page, if the figure is narrow). Below is a minimal counterexample.

Am I doing something silly that I should fix? Or if not, is there a good workaround?

\documentclass{amsart}
\usepackage{wrapfig}
\begin{document}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam congue, turpis nec dignissim condimentum, lorem elit sodales justo, ut feugiat erat libero mollis diam. Phasellus ac dolor vel quam vehicula pellentesque quis vel purus.

\begin{wrapfigure}{r}{0.5\textwidth}
No problem.
\caption{Long captions align correctly.}
\end{wrapfigure}

In scelerisque, metus in convallis pulvinar, massa lacus condimentum tortor, ut mattis sapien libero quis diam. In eu diam pulvinar quam tempor suscipit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

\begin{wrapfigure}{r}{0.5\textwidth}
Problem!
\caption{But not short!}
\end{wrapfigure}

Duis luctus est ligula. Proin fermentum risus id mauris rhoncus vestibulum. Pellentesque vel leo elit. Cras tempus rutrum dui, vitae lobortis lorem egestas a. Vivamus suscipit commodo lectus vel aliquet. Proin molestie ullamcorper est, sed hendrerit leo pellentesque et. Nunc odio massa, sodales nec elementum at, vehicula quis enim.

\end{document}

-

## 1 Answer

You are not going crazy!

\documentclass{amsart} is the culprit.

With standard article class everything works fine.

Can you change the class? Maybe updating ams packages helps? Somebody more involved with ams classes should help.

-
Ah, thanks very much! Changing document class is more than an option: it's something I'll be doing anyway, since the article is actually an individual chapter which will soon become one of several in a \documentclass{amsbook}. But it's still an ams class, so I guess that may not help. But it's good to know that that's the culprit, in any case, and I guess I can try other book classes too — as long as they play nicely with amsthm, that's all I really need. –  Peter LeFanu Lumsdaine Nov 5 '10 at 3:01