[Tex/LaTex] Fixing wrapfig caption alignment

captionshorizontal alignmentwrapfigure

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}

Best 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.