1

I would like to place an algorithm in the margin of a tufte style book. I am using algorithm2e. I have no idea how to do this, or if it is possible at all. Please help? Here is an example but it place the algorithm in the main body and not in the margin:

\documentclass{tufte-book}
\usepackage{algorithm2e}

\begin{document}

\begin{algorithm}
\While{hungry}{
make cookies\;
eat cookies\;
}
\end{algorithm}

\end{document}

1 Answer 1

2

How about putting it inside marginfigure environment?

enter image description here

\documentclass{tufte-book}
\usepackage{algorithm2e}
\usepackage{blindtext}

\begin{document}

\Blindtext[1]

\begin{marginfigure}
\begin{algorithm}[H]
\While{hungry}{
    make cookies; \newline
    eat cookies; 
}
\caption{Story of my life}
\end{algorithm}
\end{marginfigure}

\Blindtext[1]

\end{document}
1
  • Thank you! This is it :-)
    – efrén
    Aug 6, 2020 at 14:20

You must log in to answer this question.

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