I have two picture, one (Image 1) is the big one while the other (Image 2) is the small one that is a detail of the big one. I would like to do something like the zoom option (with tikzpicture
) but instead to have the zoomed image image I just want to see the other image. Everything inside a figure with its caption.
我有两张照片,一张(图片1)是大图片,而另一张图片(图片2)是小图片,是大图片的细节。我想做像缩放选项(使用tikzpicture)之类的东西,而是拥有缩放的图像图像我只想看到另一个图像。图中的所有内容及其标题。
I made an example in case is difficult to understand what I want to do. Image 1
is my main image, the cross represents the schematised detail that is explained with Image 2
. The two images are two .png
.
我做了一个例子,以防很难理解我想做什么。图1是我的主图像,十字表示用图2解释的示意细节。两个图像是两个.png。
Is it possible?
可能吗?
3 个解决方案
#1
8
Starting point. Now, you only need to connect the other anchors and decide the right position for the squares.
初始点。现在,您只需要连接其他锚点并确定正方形的正确位置。
\documentclass{report}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{figure}[h]\centering
\begin{tikzpicture}
\node[draw] (one) at (0,0){\includegraphics[width=6cm]{example-image-a}};
\node[anchor=north,draw,inner sep=0pt] (two) at ([xshift=-1cm]one.north west){\includegraphics[width=1cm]{example-image-b}};
\node[draw] (rect) at (-1,0){};
\draw (two.south east) -- (rect.south west);
\end{tikzpicture}
\caption{text}
\end{figure}
\lipsum[2]
\end{document}
#2
6
A solution using path picture
to clip the zoom.
使用路径图片剪辑缩放的解决方案。
And as @Sigur said 'Starting point. Now, you only need to connect the other anchors and decide the right position for the' circles.
正如@Sigur所说'出发点。现在,您只需要连接其他锚点并确定'圈子的正确位置。
\documentclass[a4paper, 12pt]{article}
\usepackage{mwe}
\usepackage{tikz}
\begin{document}
\begin{figure}[h!]
\centering
\includegraphics[width=.7\linewidth]{example-image}
\caption[Text for the list of figures]{Text under the figure}
\label{fig:theReference0}
\end{figure}
\begin{figure}[h!]
\centering
\begin{tikzpicture}
[path image/.style={path picture={\node at (path picture bounding box.center) {\includegraphics[height=3cm]{#1}};}}]
\node (img) {\includegraphics[width=.7\linewidth]{example-image}};
\node (c1) [draw, circle, red, text width=.7cm] at (img.center) {};
\draw [red] (c1.east) -- (img.east);
\draw [path image=example-image-a,draw=red,thick] (img.east) circle (2cm);
\end{tikzpicture}
\caption[Text for the list of figures]{Text under the figure}
\label{fig:theReference}
\end{figure}
\end{document}
#3
1
With picture
environment:
有图片环境:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\noindent%
\setlength{\unitlength}{\textwidth}%
\begin{picture}(1,0.5)%
\put(0.3,0){\includegraphics[width=.7\textwidth]{example-image}}%
\put(0,0.33){\includegraphics[width=.2\textwidth]{example-grid-100x100bp}}%
\put(0.0,0.33){\line(4,-1){.4}}
\put(0.0,0.53){\line(4,-1){.4}}
\put(0.2,0.33){\line(4,-1){.4}}
\put(0.2,0.53){\line(4,-1){.4}}
\put(0.4,0.23){\line(1,0){.2}}
\put(0.4,0.43){\line(1,0){.2}}
\put(0.4,0.23){\line(0,1){.2}}
\put(0.6,0.23){\line(0,1){.2}}
\end{picture}%
\end{document}
#1
8
Starting point. Now, you only need to connect the other anchors and decide the right position for the squares.
初始点。现在,您只需要连接其他锚点并确定正方形的正确位置。
\documentclass{report}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{figure}[h]\centering
\begin{tikzpicture}
\node[draw] (one) at (0,0){\includegraphics[width=6cm]{example-image-a}};
\node[anchor=north,draw,inner sep=0pt] (two) at ([xshift=-1cm]one.north west){\includegraphics[width=1cm]{example-image-b}};
\node[draw] (rect) at (-1,0){};
\draw (two.south east) -- (rect.south west);
\end{tikzpicture}
\caption{text}
\end{figure}
\lipsum[2]
\end{document}
#2
6
A solution using path picture
to clip the zoom.
使用路径图片剪辑缩放的解决方案。
And as @Sigur said 'Starting point. Now, you only need to connect the other anchors and decide the right position for the' circles.
正如@Sigur所说'出发点。现在,您只需要连接其他锚点并确定'圈子的正确位置。
\documentclass[a4paper, 12pt]{article}
\usepackage{mwe}
\usepackage{tikz}
\begin{document}
\begin{figure}[h!]
\centering
\includegraphics[width=.7\linewidth]{example-image}
\caption[Text for the list of figures]{Text under the figure}
\label{fig:theReference0}
\end{figure}
\begin{figure}[h!]
\centering
\begin{tikzpicture}
[path image/.style={path picture={\node at (path picture bounding box.center) {\includegraphics[height=3cm]{#1}};}}]
\node (img) {\includegraphics[width=.7\linewidth]{example-image}};
\node (c1) [draw, circle, red, text width=.7cm] at (img.center) {};
\draw [red] (c1.east) -- (img.east);
\draw [path image=example-image-a,draw=red,thick] (img.east) circle (2cm);
\end{tikzpicture}
\caption[Text for the list of figures]{Text under the figure}
\label{fig:theReference}
\end{figure}
\end{document}
#3
1
With picture
environment:
有图片环境:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\noindent%
\setlength{\unitlength}{\textwidth}%
\begin{picture}(1,0.5)%
\put(0.3,0){\includegraphics[width=.7\textwidth]{example-image}}%
\put(0,0.33){\includegraphics[width=.2\textwidth]{example-grid-100x100bp}}%
\put(0.0,0.33){\line(4,-1){.4}}
\put(0.0,0.53){\line(4,-1){.4}}
\put(0.2,0.33){\line(4,-1){.4}}
\put(0.2,0.53){\line(4,-1){.4}}
\put(0.4,0.23){\line(1,0){.2}}
\put(0.4,0.43){\line(1,0){.2}}
\put(0.4,0.23){\line(0,1){.2}}
\put(0.6,0.23){\line(0,1){.2}}
\end{picture}%
\end{document}