# How to insert graphics into margins using memoir

I've read through memoir manual chapters regarding side notes and marginal notes (12.2 to 12.4) but I'm unable to figure out how to insert graphics into margins.

Is it possible and if so, how?

What you must not do is try to use the figure environment which is a floating environment (marginal notes themselves are also floating envivonments). Just use, for example \includegraphics... or begin{picture}... in the note.

If you need a caption then:

\newfixedcaption{\figcaption}{\caption}{figure}


and you can use \figcaption just like \caption for captioning an illustration that is not presented in the figure environment.

See the section CONTINUATION CAPTIONS AND LEGENDS in the user manual.

I have done it somewhat like this.

\documentclass[letterpaper]{memoir}

\usepackage{lipsum}
\usepackage{graphicx}
\usepackage{caption}

\setulmarginsandblock{1in}{*}{1}
\setlrmarginsandblock{1in}{*}{4}
\setmarginnotes{2em}{4in}{\baselineskip}
\checkandfixthelayout

\begin{document}

\lipsum[1]

\marginpar{
\includegraphics[width=\linewidth]{test}
\captionof{figure}{This is a test case.}
\label{fig:test}
}
\lipsum[2]

This is a reference to Figure~\ref{fig:test}.

\lipsum[3]

\end{document}