12

The coffee package is great fun, however on documents with figures the coffee is placed behind the figures. It seems improper to do this on a printed version. How do I get my coffee on top of the figures?

MWE:

\documentclass{memoir}
\usepackage{graphicx}
\newsubfloat{figure}
\usepackage[onEveryPage]{coffee}
\begin{document}
\begin{figure}[htb]
    \centering
    \subbottom[A \label{fig:examplea}]{\includegraphics[width=0.4\columnwidth,height=20cm]{example-image-a}}
    \hspace{0.1\columnwidth}
    \subbottom[B\label{fig:exampleb}]{\includegraphics[width=0.4\columnwidth,height=10cm]{example-image-b}}
    \caption{Example A and B}
    \label{fig:examples}
\end{figure}
\end{document}

Which might produce this (the coffee spot is random): enter image description here

6

You can load the eso-pic yourself and then place the coffee stain:

\documentclass{memoir}
\usepackage{graphicx}
\newsubfloat{figure}
\usepackage{coffee}
\usepackage{eso-pic}
\AddToShipoutPictureFG{\cofeSplash{}}
\begin{document}
\begin{figure}[htb]
    \centering
    \subbottom[A \label{fig:examplea}]{\includegraphics[width=0.4\columnwidth,height=20cm]{example-image-a}}
    \hspace{0.1\columnwidth}
    \subbottom[B\label{fig:exampleb}]{\includegraphics[width=0.4\columnwidth,height=10cm]{example-image-b}}
    \caption{Example A and B}
    \label{fig:examples}
\end{figure}
\end{document}

enter image description here

  • 5
    If that's meant to be coffee, I'm sticking to tea .... – cfr Jun 15 '17 at 0:46
  • 1
    Will this solution put a random splash on every page? (the coffee5 class readjusts the size, location and rotation of all of the four coffee splashes n the original coffee class, and put's one on each page) – Thorbjørn E. K. Christensen Jun 15 '17 at 0:50
  • 1
    Why don't you simply try it out? – Ulrike Fischer Jun 15 '17 at 7:11
  • I'm sorry for being so slow at accepting your answer, I was writing my bachelors thesis and apparently I asked this question around 18 hours before deadline, so I had thrown it off my mind. – Thorbjørn E. K. Christensen Nov 14 '17 at 21:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.