Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
    
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
add comment

2 Answers

up vote 5 down vote accepted

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

share|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
add comment

[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

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.