0

I want to place images in the right margin with a caption beneath them. I've looked at some of the questions and answers -- only one looked like my problem but when I copied the answer into my project it produced a figure in the middle of the text with the caption in the left margin. It included the package 'geometry' and a command \floatsetup that I'm convinced is the key to getting what I want. However, I could not find info on the command so I couldn't figure out how to change its parameters to get what I want. I started with the following, which made sense to me, but the compiler doesn't like it:

\documentclass{amsbook}
\usepackage{graphicx}
\begin{document}
\chapter{Test}
\marginpar{
\begin{figure}
\includegraphics[scale=0.25]{example-image-a}}
\end{figure}
\caption{My pic}
\end{document}
1
  • Please make you code compileable. Your caption for example is outside of the float. Also the \marginpar closes inside the figure float.
    – Roland
    Commented Nov 26, 2021 at 5:35

1 Answer 1

1

Try this:

\documentclass{amsbook}
 \usepackage{graphicx,caption,lipsum}
  \begin{document} 
    \chapter{Test}
    \lipsum[1] \marginpar{\vspace{-3cm}\centering\includegraphics[scale=0.25]{logoRS.png}\captionof{figure}{Logo}}  
  \end{document}

enter image description here

If you dont want 'Figure 1 Logo' but only 'Logo' edit the code this way:

\marginpar{\vspace{-3cm}\centering\includegraphics[scale=0.25]{logoRS.png}\captionof*{figure}{Logo}}

(captionof starred).

enter image description here

5
  • Shiny! Thanks Raffaela.
    – TonyK
    Commented Nov 26, 2021 at 6:24
  • @ TonyK My name is Raffaele. If you are happy with my answer, you could accept and up vote my answer. Thanks. Commented Nov 26, 2021 at 8:29
  • Happily. I clicked on the check mark in the left margin -- I think that's right.
    – TonyK
    Commented Nov 26, 2021 at 16:43
  • Yes. Now you can click also on the big arrow on the left. Thanks. Commented Nov 26, 2021 at 16:46
  • Raffaele, I'm sorry about the scoring - I thought it was either 0 or 1. I didn't realize it could be higher. Your answer was perfect and deserved a higher score. Next time I'll be smarter.
    – TonyK
    Commented Dec 12, 2021 at 4:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .