This question is closely related to LaTeX Photo With Rounded Corners. Suppose I want to put a rounded corners image in a marginnote, so the image fits the \linewidth
of the margin. If I use the technique proposed in the answers to that question, what fits the \linewidth
is not the image, but the image plus the white frame to produce the rounded corners.
A MWE with three images. The first one, just normal. The second one with the method of @PeterGrill. The third one is what I want to get, I've used \hspace
, \vspace
and a little calculation to fit the image. But I don't know if this solution could be problematic as I'm expanding the TikZ picture outside the marginpar. I'd like a TikZ-only solution. Would it be better, doesn't it?
\documentclass[twoside,a4paper]{tufte-handout}
\usepackage{blindtext}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{calc}
\newcommand*{\ClipSep}{0.4cm}%
\begin{document}
\marginnote{\includegraphics[width=\linewidth]{frog.jpg}
%\raggedright \blindtext
}
\marginnote{
\begin{center}
\begin{tikzpicture}
\node [inner sep=0pt] at (0,0) {\includegraphics[width=\linewidth]{frog.jpg}};
\draw [white, rounded corners=\ClipSep, line width=\ClipSep]
(current bounding box.north west) --
(current bounding box.north east) --
(current bounding box.south east) --
(current bounding box.south west) -- cycle
;
\end{tikzpicture}
\end{center}
\raggedright \blindtext}
\marginnote{
\begin{center}
\hspace*{-\ClipSep}\begin{tikzpicture}
\node [inner sep=0pt] at (0,0) {\includegraphics[width=\linewidth + \ClipSep]{frog.jpg}};
\draw [white, rounded corners=\ClipSep, line width=\ClipSep]
(current bounding box.north west) --
(current bounding box.north east) --
(current bounding box.south east) --
(current bounding box.south west) -- cycle
;
\end{tikzpicture}
\end{center}
\vspace*{-\ClipSep}
\raggedright \blindtext}
\Blindtext
\end{document}