10

I want to label the images img1 and img2.. can i do that inside my \node? If yes, how??

\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}

What i mean by label is that something like this..

\path (\x,\y) node(a) [rectangle, draw,thick] {This is a rectangle};

Something like this as shown in figureas "Alice", "Bob", SIP Proxy Server Domain" etc.. enter image description here

  • What should the \ref{..} command show in this case? There are no numbers referred to each image. – Spike Jun 28 '12 at 12:35
  • 1
    Do you want a \label to refer to the images, or do you want to add a text label on top of the image? – Jake Jun 28 '12 at 12:37
  • If you want to use \caption inside the main picture, I think the answer is no. – Alain Matthes Jun 28 '12 at 14:39
  • sry for the goof up....what i want is to write things below a node like this.. \path (\x,\y) node(a) [rectangle, draw,thick] {This is an element}; – Vineet Menon Jun 29 '12 at 5:41
8

How about this:

\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}

enter image description here


Edit 1: Probably like this (the icon are taken from here):

\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}

enter image description here

| improve this answer | |
  • you cannot combine node definition and label addition?? as in a case where \includegraphics is not used.. – Vineet Menon Jun 29 '12 at 16:33
2

[fr] est-ce cela que tu cherches?

[en] Is this what you are looking for?

\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}

enter image description here

| improve this answer | |
  • the key here is label...thx – Vineet Menon Jun 29 '12 at 16:52

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.