Hello,
I have what seemed to me a simple problem, but I haven't found any useful hints on all the web.
I would like to set a text with a wide outer margin, and place almost all my figures in this margin (including caption). Now I have no problems putting my pictures or any text in those margins, but a figure environment is a float. And so is a marginal note. There seems to be a constraint there.
What I do not want (and I have found tricks for these), are figures in the text block with their captions in the margin, "wrapped" figures, figures extending into the margin, or only graphics but no floating environment in the margin.
Any ideas will be highly appreciated.
Thanks a lot.
Graphics, Figures & Tables ⇒ Figures in the margin
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Figures in the margin
The solution is given with the caption package. It allows captions for figures or tables outside float environments. Search the manual for the \captionof command. A good example is given in epslatex (Section 22 - Marginal figures, p. 89f). In this context I recommend to use the marginnote package for a more flexible typesetting of marginals. For the case that you are running into trouble, build a minimal working example (MWE) and we will see what we can do.
Best regards and welcome to the board
Thorsten¹
Best regards and welcome to the board
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Figures in the margin
Thanks a lot for your very quick reply!
And it works, too. The \captionof (caption-outside-float) command is a feature of the newer versions of the caption package I was not aware of. If you only need the functionality of this command (as a memoir class user I don't need the rest, for instance), you can load the "lighter" package capt-of, which has no other features.
For the record (in case people are interested in doing the same thing), calling the package is as simple as \usepackage{capt-of} in your preamble. And to place a figure in the margin, instead of naively:
(This doesn't work)
You do the following:
The same should work for tables as well.
Thanks a lot for the help!
And it works, too. The \captionof (caption-outside-float) command is a feature of the newer versions of the caption package I was not aware of. If you only need the functionality of this command (as a memoir class user I don't need the rest, for instance), you can load the "lighter" package capt-of, which has no other features.
For the record (in case people are interested in doing the same thing), calling the package is as simple as \usepackage{capt-of} in your preamble. And to place a figure in the margin, instead of naively:
Code: Select all
\marginpar{
\begin{figure}
\includegraphics[width=\textwidth]{filename}
\caption{Text of the caption}
\end{figure}
}
You do the following:
Code: Select all
\marginpar{
\includegraphics[width=\marginparwidth]{filename}
\captionof{figure}{Text of the caption}
}
Thanks a lot for the help!