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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running into a problem when using cleveref to refer to marginfigures in memoir. The following code illustrates the problem (apologies for the somewhat long preamble, but I need the space in the margin to illustrate the problem):

%%% formatting
\setstocksize{29.7cm}{21.0cm} % A4 stock
\settrimmedsize{27.94cm}{21.0cm}{*} % 27.94cm = 11in
%%% clever referencing (should be loaded last)
  a^2 + b^2 = c^2
\Cref{eq:pyth} is known as Pythagoras' theorem. 
This should be a reference to figure 1, but it comes out as 
  x^2 + y^2 = r^2
  \left(\frac{x}{a}\right)^2 + \left(\frac{y}{b}\right)^2 = 1
\Cref{eq:circ} describes a circle, \cref{eq:ell} an ellipse. 
This should be a reference to figure 2, but it comes out as 

When you run this, the references to the figures turn out as references to the equations. Do I need to tell cleveref about the marginfigure environment in some way (I could not find anything in the newest manual) or is the marginfigure not supported yet by cleveref?

share|improve this question
up vote 3 down vote accepted

The problem is simply that you have the \label before the \caption. Put the \label last of the two, and it works fine. See e.g., Where to put the \label on a figure environment?

share|improve this answer
Thanks for putting me straight. This was an oversight on my part. I've been using memoir with sidecaption for so long that I completely forgot about that when I tried marginfigure. (In memoir's sidecaption environment, the label is specified as an optional argument.) – user1362373 Nov 26 '11 at 11:20

Your Answer


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.