在 Latex 中添加插图

在 Latex 中添加插图

如果我有两张并排的图像,如何使用 tikz 包含插图,如下所示:在此处输入图片描述

非常感谢!

答案1

我使用三个节点:第一个节点a包含左图像,第二个节点b包含右图像,并且与第一个节点偏移 1 厘米。最后一个节点c指出您想要的区域。右图像重复第二次以部分重叠\draw(c.north east) -- (b.north east);\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}

在此处输入图片描述

相关内容