Graphics, Figures & Tables ⇒ Figures in the margin
Figures in the margin
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.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Figures in the margin
Best regards and welcome to the board
Thorsten¹
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Figures in the margin
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!