I really need to use \marginpar like in the following code:




Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. 
Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer 
id, vulputate a, magna. Donec vehicula augue eu neque.

\captionof{figure}{Ut purus elit, vestibulum ut, placerat ac, adipiscing 
vitae\marginpar{Lorem ipsum \ref{fig:RedArrow} dolor sit amet, consectetuer 
adipiscing elit.}, felis. Cur- Lorem ipsum dolor sit amet, consectetuer 
adipiscing elit.}


But I just get errors. What can I do?

  • 1
    Welcome to TeX.SX! To remove the ! Argument of \caption@ydblarg has an extra } error, you just put \protect in front of \marginpar (see this). But then another error comes up: ! LaTeX Error: Not in outer par mode, which is intentionally programmed in \marginpar, so I don't think it's possible to do what you want without changing \marginpar... See if this answer solves your problem. May 23, 2018 at 23:15
  • Smells like an XY problem. I suggest you tell us what you really need to do and not the way you think you need to do it, because the former is very likely possible, whereas the latter is very likely impossible. What you think you need ain't going to work, but what you actually need probably would. Not knowing what you're trying to do, it's hard to suggest much more than trying not to really need it.
    – cfr
    May 23, 2018 at 23:49
  • @PhelypeOleinik, @cfr: Thanks for your answers. I saw the link, but it uses a figure block. I am using a minipage block in order to put the figure and its caption aligned within an item inside an itemize block. The figure block seems to align the figure and its caption within the page width... Look this
    – MaribuS
    May 24, 2018 at 1:41
  • If you use the short caption (add [] after {figure}) you get the more normal error message, "Not in outer par mode." Which you aren't, inside a minipage. Try marginnotes instead. May 24, 2018 at 14:47
  • Thanks, I will try marginnotes. I hope that it works...
    – MaribuS
    May 26, 2018 at 22:04


You must log in to answer this question.

Browse other questions tagged .