[Tex/LaTex] Implementing marginfigure

floatsmarginparmarginstufte

sorry for the absolutely beginner question here.

I've been looking at the tufte-latex class, specifically the tufte sample book. It makes use of marginfigures, which I believe are provided by the sidenotes package.

As you can see in the book, there is a marginfigure implemented with the code:

\begin{marginfigure}
  \includegraphics{file}
  \caption{caption}
\end{marginfigure} 

However, in my custom class file I use the sidenotes package using

\usepackage{sidenotes}

It should be noted that this works fine, I can use normal sidenotes without any problems.

However, when I go to put in a marginfigure using the code above I get the following error:

Environment marginfigure undefined. 
\begin{document} ended by \end{marginfigure}

How can this be fixed so that my marginfigure implements properly.
Sorry for the basic question, but I hadn't found any other fixes.

EDIT 1:
Those are the only two errors I have.

All I do is import the package in my class file, then in the document I try to implement marginfigure, but receive the errors above.

Do I need to use any other packages alongside it?

EDIT 2:MWE

\documentclass{article}
\usepackage{sidenotes}
\usepackage{blindtext}
\begin{document}
\blindtext
\begin{marginfigure}
\includegraphics{marginfigure}
\end{marginfigure}
\end{document}

Best Answer

If you include \listfiles before \begin{document} and compile you can see the list of packages and its version shown below.

 *File List*
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
sidenotes.sty    2012/11/09 v0.92 rich text in the margin for LaTeX

you might be using an old version of sidenotes.sty 2011/11/29 v0.81 which causes the error, because marginfigure feature is added in sidenotes from v0.90 as seen in page 6 of Change History. Hence your MWE compiles well with sidenotes.sty 2012/11/09 v0.92.

It is recommended to update to your TeX distribution ? to keep pace with latex package development or use latest version of sidenotes from ctan.

Related Question