2

If I have two images side by side, how do I include an inset using tikz as shown below: enter image description here

Thank you very much!

4

I use three nodes: first node a contains left image, the second b contains the right image and is shifted of 1 cm from first one. Last node c points out the area you want. Right image is repeated a second time to overlap partially the \draw(c.north east) -- (b.north east); and \draw(c.south east) -- (b.south east);.

\documentclass{article}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{mwe}
\begin{document}
\begin{tikzpicture}
\node(a){\includegraphics[width=.4\textwidth]{example-image-a}};
\node(b)[inner sep=0pt,right = 1cm of a] {\phantom{\includegraphics[width=.4\textwidth]{example-image-b}}};
\node(c)[draw,minimum size=2cm, at=(a)]{};
\begin{scope}[thin,blue!40]
\draw(c.north east) -- (b.north east);
\draw(c.south east) -- (b.south east);
\draw(c.north west) -- (b.north west);
\draw(c.south west) -- (b.south west);
\end{scope}
\node [at=(b),inner sep=0pt,right = 1cm of a] {\includegraphics[width=.4\textwidth]{example-image-b}};
\end{tikzpicture}

\end{document}

enter image description here

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.