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 have the following code. I, somehow, could not manage to number the whole figure. I have tried with label but, it does not show label at all.

\begin{figure}
\centering

\subfigure[Single Crossing]{\resizebox{0.4\textwidth}{!}{ %
\begin{tikzpicture}[scale=1.5]
\draw (0,0) -- +(4,0) node[pos=0,left]{\tt\color{black}1};

\draw (0,-4)-- +(4,0) node[pos=0,left]{\tt\color{black}0};

\draw [red,line width=2pt, name path= F] (0,-4) -- (0.5,-4) to [out=20, in=195] (3.5,0)--(4,0);
\draw [blue, line width=2pt, name path= G] (0,-4) -- (1,-4) to [out=20, in=195] (3,0) -- (4,0);

\fill[gray,name intersections={of=F and G,total=\t}]
\foreach \s in {1,...,\t}{(intersection-2) node[left] {E}};

 \draw [fill] (0,-1.5) circle[radius=0.03];

 \draw [dashed,lightgray] (0,-1.5) node[left,black]{$p$} -- (2.12,-1.5) -- (2.12,-4);

 \draw [dashed,thick,gray] (2.12,-4) -- (2.12, -1)-- (0,-1)node(yline)[left,black]   {$p^{\prime}$};

 \draw [fill] (0,-1) circle [radius=0.03];

 \draw [fill=gray] (intersection-2) circle [radius=0.03];

\end{tikzpicture}
share|improve this question

closed as unclear what you're asking by Jubobs, Qrrbrbirlbel, Peter Jansson, Thorsten, Martin Schröder Dec 3 '13 at 20:46

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
Part of your code snippet is missing, a complete example would be better. Do you just want \caption{figure desc.} after the end of the \subfigure? Edit: Oh, and the subfigure package is deprecated (see ctan.org/pkg/subfigure), subcaption or subfig is usually recommended instead. –  Torbjørn T. Dec 3 '13 at 13:14
1  
What do you mean with "number the whole figure"? What does this have to do with TikZ? –  Qrrbrbirlbel Dec 3 '13 at 13:30
    
Note : I read here once the subcaption package was to be preferred for that kind of stuff, so please follow Torbjørn's advice. In it's documentation you'll find how to give a caption (with \caption{your caption}) to each subfigure and for the whole figure as well. Normally it should be out of the \subfigure[]{...} stuff. –  s__C Dec 3 '13 at 13:54
    
Thanks for the advice guys!! –  user64066 Dec 3 '13 at 16:18

1 Answer 1

Remarks

I extended your code to be a minimal working example (MWE). Also, I added several captions to the figure. Furthermore, instead of the deprecated sufigurepackage the newer and favorable package subcaption is used.

Implementation

\documentclass{article}
\pagestyle{empty} %for cropping
\usepackage{tikz,subcaption}
\usetikzlibrary{intersections}
\begin{document}
\begin{figure}
  \centering
  \begin{subfigure}{0.8\linewidth}
    \centering
    \resizebox{0.4\textwidth}{!}{
      \begin{tikzpicture}[scale=1.5]
        \draw (0,0) -- +(4,0) node[pos=0,left]{\tt\color{black}1};
        \draw (0,-4)-- +(4,0) node[pos=0,left]{\tt\color{black}0};
        \draw [red,line width=2pt, name path= F] (0,-4) -- (0.5,-4) to [out=20, in=195] (3.5,0)--(4,0);
        \draw [blue, line width=2pt, name path= G] (0,-4) -- (1,-4) to [out=20, in=195] (3,0) -- (4,0);
        \fill[gray,name intersections={of=F and G,total=\t}]
        \foreach \s in {1,...,\t}{(intersection-2) node[left] {E}};
        \draw [fill] (0,-1.5) circle[radius=0.03];
        \draw [dashed,lightgray] (0,-1.5) node[left,black]{$p$} -- (2.12,-1.5) -- (2.12,-4);
        \draw [dashed,thick,gray] (2.12,-4) -- (2.12, -1)-- (0,-1)node(yline)[left,black]   {$p^{\prime}$};
        \draw [fill] (0,-1) circle [radius=0.03];
        \draw [fill=gray] (intersection-2) circle [radius=0.03];
      \end{tikzpicture}
    }
    \caption{Single Crossing}
  \end{subfigure}
  \caption{Overall caption}
  \label{fig:somefigure}
\end{figure}
\end{document}

Output

enter image description here

share|improve this answer
    
Can you please include the subcaption solution just for completeness? I think that would be a better alternative for future visitor's attention. There is a readily made example in the manual of subcaption. Subfigure is obsolete and replaced by subfig though nowadays I tend to think that subcaption replaced both. –  percusse Dec 3 '13 at 18:31
    
@percusse Thank you for your suggestion. You are right, of course. I replaced my initial subfigure solution instead of adding another solution, because I think it is better to not even cover deprecated packages. –  Henri Menke Dec 4 '13 at 9:19

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