I want to use the wrapfig
packet to wrap text around an image. Since the image is longer than wide I'd like the caption to be aside of the image. Finally, the image should be placed in the upper right corner of my document. Currently it looks like this:
I tried to place the caption on the right side of the image. Therefore I tried to use the sidecap
package and the SCfigure
environment. Here is an example code (with an example image) that demonstrates my attempt:
\documentclass{article}
\usepackage{mwe}% for this example only
\usepackage{wrapfig}
\usepackage{sidecap}
\begin{document}
\begin{wrapfigure}{r}{1.8cm}
\begin{SCfigure}
\begin{center}
\includegraphics[width=1.5cm]{example-image}
\end{center}
\caption{Example side caption text for example image}
\end{SCfigure}
\end{wrapfigure}
\lipsum[2]
\end{document}
Unfortunately this won't work. The image doesn't get printed. Hence I have two questions:
- How can one combine
wrapfig
andsidecap
? - How can one place a
wrapfigure
in the upper right corner?
Edit: "how can one place a wrapfigure"
The wrapfigure
is defined between two paragraphs. I do not know where the page break occurs. So I am looking for a solution that ensures that the wrapfigure
will always be in the upper right corner, something like: \begin{table}[t]
.
Cras nec ante. Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel,
wisi.
\begin{wrapfigure}{r}{1.8cm}
\begin{center}
\includegraphics[width=1.5cm]{example-image}
\end{center}
\caption{Example side caption text for example image}
\end{wrapfigure}
Morbi auctor lorem non justo. Nam lacus libero, pretium at,
lobortis vitae, ultricies et, tellus. Donec aliquet, tortor sed accumsan bibendum,
erat ligula aliquet magna, vitae ornare odio metus a mi. Morbi ac orci et
nisl hendrerit mollis. Suspendisse ut massa. Cras nec ante.