![如何给不同的图像添加缩放框效果?](https://linux22.com/image/308451/%E5%A6%82%E4%BD%95%E7%BB%99%E4%B8%8D%E5%90%8C%E7%9A%84%E5%9B%BE%E5%83%8F%E6%B7%BB%E5%8A%A0%E7%BC%A9%E6%94%BE%E6%A1%86%E6%95%88%E6%9E%9C%EF%BC%9F.png)
答案1
以下是使用评论中链接的 Caramdir 解决方案作为与软件包结合的起点的一种可能方法subcaption
。
\documentclass{article}
\usepackage{mwe,subcaption,tikz}
\tikzset{boximg/.style={remember picture,red,thick,draw,inner sep=0pt,outer sep=0pt}}
\begin{document}
\begin{figure}
\centering
\begin{subfigure}{.45\linewidth}
\begin{tikzpicture}[boximg]
\node[anchor=south west] (img) {\includegraphics[width=\linewidth]{example-image-a}};
\begin{scope}[x=(img.south east),y=(img.north west)]
\node[draw,minimum height=1.6cm,minimum width=1.00cm] (B1) at (0.2,0.60) {};
\node[draw,minimum height=0.8cm,minimum width=0.50cm] (B2) at (0.7,0.25) {};
\node[draw,minimum height=0.4cm,minimum width=0.25cm] (B3) at (0.9,0.10) {};
\end{scope}
\end{tikzpicture}
\caption{}
\end{subfigure}\\[0.5\baselineskip]
\begin{subfigure}{.45\linewidth}
\begin{tikzpicture}[boximg]
\node (img1) {\includegraphics[width=0.3\linewidth]{example-image-10x16}};
\draw (img1.south west) rectangle (img1.north east);
\end{tikzpicture}\hfill%
\begin{tikzpicture}[boximg]
\node (img2) {\includegraphics[width=0.3\linewidth]{example-image-10x16}};
\draw (img2.south west) rectangle (img2.north east);
\end{tikzpicture}\hfill%
\begin{tikzpicture}[boximg]
\node (img3) {\includegraphics[width=0.3\linewidth]{example-image-10x16}};
\draw (img3.south west) rectangle (img3.north east);
\end{tikzpicture}
\caption{}
\end{subfigure}
\begin{tikzpicture}[overlay,boximg]
\draw (B1) -- (img1);
\draw (B2) -- (img2);
\draw (B3) -- (img3);
\end{tikzpicture}
\caption{The National Gallery of Canada}
\end{figure}
\end{document}