我想标记图像 img1 和 img2。我可以在我的里面这样做吗\node
?如果可以,怎么做?
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\path (0,0) node(a) {\includegraphics[width=2cm] images/img1.png}};
\path (1,6) node(b) {\includegraphics[width=2cm]{images/img2.png}};
\path (9,6) node(c) {\includegraphics[width=2cm]{images/img3.png}};
\path (10,0) node(d) {\includegraphics[width=2cm]{images/img4.png}};
\draw[very thick,green] (a) -- (b) node [midway,right]{\parbox{4cm}{TLS Password Based\\ Authentication}};
\draw[very thick,red] (b) -- (c) node [midway,above]{Certificate based Authentication};
\draw[very thick,green] (c) --(d);
\end{tikzpicture}
\end{document}
我所说的标签是指像这样的东西......
\path (\x,\y) node(a) [rectangle, draw,thick] {This is a rectangle};
类似于图中所示的“Alice”、“Bob”、SIP 代理服务器域”等。
答案1
这个怎么样:
\documentclass{article}
\usepackage{tikz}
\usepackage{lipsum}
\parindent0mm
\begin{document}
\begin{tikzpicture}
\draw (-3,-1) rectangle (3,1) (-2,-2) rectangle (2,2);
\node[below right] at (current bounding box.south west) {\textbf{Image 1: rectangles}};
\end{tikzpicture}
\lipsum[1]
\begin{tikzpicture}
\draw (-3,-1) circle (1) (-2,-2) circle (2);
\node[below right] at (current bounding box.south west) {\textbf{Image 2: circles}};
\end{tikzpicture}
\end{document}
编辑1:大概是这样的(图标已被占用)从这里):
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node (cal) at (0,0) {\includegraphics[scale=4]{Calendar2.png}};
\node (dow) at (7,0) {\includegraphics[scale=1.7]{Downloads.png}};
\node (fol) at (7,7) {\includegraphics[scale=1.7]{Folder.png}};
\node (emo) at (0,7) {\includegraphics[scale=1.7]{Emoticons.png}};
\node[below right] at (emo.south west) {\textbf{Img 1:} Emoticon};
\node[below right] at (fol.south west) {\textbf{Img 2:} Folder};
\node[below right] at (cal.south west) {\textbf{Img 3:} Calendar};
\node[below right] at (dow.south west) {\textbf{Img 4:} Downloads};
\end{tikzpicture}
\end{document}
答案2
[fr] 你还在寻找什么?
[zh] 这是你要找的吗?
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,fit,shapes}
\begin{document}
\begin{tikzpicture}
\node[label={[ below =3.5cm of Alice]:Alice}](Alice) {\includegraphics{PC-Alice.png}};
\node[right=4cm of Alice,label={[ below =3.5cm of bob]:Bob}](bob) {\includegraphics{Tel-Bob.png}};
\node[above = 3cm of Alice,label={[ below =4.5cm of server1]:Server 1}] (server1) {\includegraphics{serveur.png}};
\node[above = 3cm of bob,label={[ below =4.5cm of server2]:Server 2}] (server2) {\includegraphics{serveur.png}};
\node[fit=(Alice) (server1), draw,red,ellipse,inner sep=0pt]{};
\node[fit=(bob) (server2), draw,red,ellipse]{};
\end{tikzpicture}
\end{document}