Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.