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'm very very new to tikz, I've already done this:

enter image description here

With this code:

\documentclass{article}

\usepackage[spanish,es-noquoting]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{tikz}
\usetikzlibrary{shadows}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{positioning}
\usetikzlibrary{calc,intersections}

\begin{document}
\begin{tikzpicture}[terminal/.style={draw, drop shadow, fill=white, rectangle, inner sep=5pt, font=\bfseries, align=center}]
\tikzset{fallastyle/.style={text=red}}
\tikzset{pasastyle/.style={text=green}}
\def \radius {0.25\textwidth}
\def \margin {20} % margin in angles, depends on the radius

\path[name path=circulo] (0, 0) circle (\radius);

\node(escribir_prueba)[name path=path_escribir_prueba,terminal] at ({0+90}:\radius){(Re)Escribir\\ Prueba};
\node(correr_prueba)[name path=path_correr_prueba, terminal] at ({300+90}:\radius){Correr\\ Prueba};
\node(escribir_codigo)[name path=path_escribir_codigo, terminal] at ({240+90}:\radius){Escribir\\ Código};
\node(correr_todas_pruebas_1)[name path=path_correr_todas_pruebas_1, terminal] at ({180+90}:\radius){Correr todas\\ las pruebas};
\node(refactorizar)[name path=path_refactorizar, terminal] at ({120+90}:\radius){Refactorizar};
\node(correr_todas_pruebas_2)[name path=path_correr_todas_pruebas_2, terminal] at ({60+90}:\radius){Correr todas\\ las pruebas};


\node (start) [node distance=8mm and -1mm, above left=of escribir_prueba, circle, fill=black, minimum width=1pt]{};

% INTERSECCIONES
\path [name intersections={of=circulo and path_escribir_prueba,name=intESCRIBIRPRUEBA}];
\def \ESCRIBIRRIGHT {intESCRIBIRPRUEBA-1}
\def \ESCRIBIRLEFT {intESCRIBIRPRUEBA-2}

\path [name intersections={of=circulo and path_correr_prueba,name=intCORRERPRUEBA}];
\def \CORRERPRUEBAUP {intCORRERPRUEBA-1}
\def \CORRERPRUEBADOWN {intCORRERPRUEBA-2}

\path [name intersections={of=circulo and path_escribir_codigo,name=intESCRIBIRCODIGO}];
\def \ESCRIBIRCODIGOUP {intESCRIBIRCODIGO-1}
\def \ESCRIBIRCODIGODOWN {intESCRIBIRCODIGO-2}

\path [name intersections={of=circulo and path_correr_todas_pruebas_1,name=intCORRERTODASPRUEBASFIRST}];
\def \CORRERTODASPRUEBASFIRSTLEFT {intCORRERTODASPRUEBASFIRST-1}
\def \CORRERTODASPRUEBASFIRSTRIGHT {intCORRERTODASPRUEBASFIRST-2}

\path [name intersections={of=circulo and path_refactorizar,name=intREFACTORIZAR}];
\def \REFACTORIZARUP {intREFACTORIZAR-1}
\def \REFACTORIZARDOWN {intREFACTORIZAR-2}


\path [name intersections={of=circulo and path_correr_todas_pruebas_2,name=intCORRERTODASPRUEBASSECOND}];
\def \CORRERTODASPRUEBASSECONDUP {intCORRERTODASPRUEBASSECOND-1}
\def \CORRERTODASPRUEBASSECONDDOWN {intCORRERTODASPRUEBASSECOND-2}


\draw [->,bend left=15] (\ESCRIBIRRIGHT) to (\CORRERPRUEBAUP);
\draw [->,bend left=15] (node cs:name=correr_prueba, anchor=west) to  node [midway,left,pasastyle] { [pasa] } (node cs:name=escribir_prueba, anchor=south);
\draw [->,bend left=15] (\CORRERPRUEBADOWN) to node [midway,right,fallastyle] { [falla] } (\ESCRIBIRCODIGOUP);
\draw [->,bend left=15] (\ESCRIBIRCODIGODOWN) to (\CORRERTODASPRUEBASFIRSTRIGHT);
\draw [->,bend left=15] (node cs:name=correr_todas_pruebas_1, anchor=north) to  node [midway,left,fallastyle] { [falla] } (node cs:name=escribir_codigo, anchor=west);
\draw [->,bend left=15] (\CORRERTODASPRUEBASFIRSTLEFT) to node [midway,left,pasastyle] { [pasa] } (\REFACTORIZARDOWN);
\draw [->,bend left=15] (\REFACTORIZARUP) to (\CORRERTODASPRUEBASSECONDDOWN);
\draw [->,bend left=15] (node cs:name=correr_todas_pruebas_2, anchor=south) to  node [midway,right,fallastyle] { [falla] } (node cs:name=refactorizar, anchor=north);
\draw [->,bend left=15] (\CORRERTODASPRUEBASSECONDUP) to node [midway,left,pasastyle] { [pasa] }(\ESCRIBIRLEFT);


\draw [->,bend left=15] (node cs:name=start, anchor=east) to (node cs:name=escribir_prueba, anchor=north);
\end{tikzpicture}

I'm sure it's not the best way to do that, but as I said, I'm very new in tikz, and the concept seems clear: draw the nodes at 360/total_nodes degrees, find intersections between node and a circle, draw an arc between intersections.

So far so good. Now I want to do this, that is pretty much the same thing: enter image description here

I would like to make the 3 bubbles (prueba-codigo-refactor) a node, so I can do the same thing I did before.

This code draws the 3 bubbles:

\begin{tikzpicture}
\node [draw, circle, fill=white, minimum width=5em]at (0, 0){Prueba};
\node [draw, circle, fill=white, minimum width=5em]at (1.2, -0.6){Código};
\node [draw, circle, fill=white, minimum width=5em]at (1.2, 0.6){Refactor};
\end{tikzpicture}

But I need the hole thing to behave as one node. So the questions are:

  1. How can I do to make the 3 bubbles a node (and behave like a node) so I can do the same thing I did before?
  2. This is all I can think with one-day experience with tikz, you sure know better and may come up with a better solution, I want to hear it!

I want to learn tikz, so a "here, paste this code and works, bye bye" it's not the best answer for me. On the other side, "look at this link, bye bye" it's kind of hard to me to understand, a MME would be awesome (and the link).

share|improve this question
    
It’s rather complex to have one node (i.e. a shape) with three text parts, that behaves fully compatible, especially the shape border part. It may be easier to implement a macro that places three bubbles/nodes around mid point. –  Qrrbrbirlbel May 13 '13 at 13:28
    
In this case, the text in each bubble is always the same and it won't change, does that make any difference? Could you post the macro that does that? How do I do the intersections with that solution? –  Nico May 13 '13 at 13:30
    
The bit that I think will be really difficult is automatically computing intersection coordinates with the boundary since each of the three circles will have to be computed in turn and then some method used to figure out which intersection point is the right one. –  Loop Space May 13 '13 at 13:52
5  
If this is what you can come up with after one day of TikZ, take a bow. Nice job so far. –  Matthew Leingang May 13 '13 at 15:27
    
@MatthewLeingang well, most of the job was done by guys here and pgf manual, it was a lot of copy-paste with little tweaks –  Nico May 13 '13 at 16:28

1 Answer 1

Since the node shape is not special in the sense that custom paths are not required, you can place two more nodes whenever you place one somewhere. I've cooked up a style that works for this example but you can also make it more customized to accept positioning details, colors, styles etc.

Some care is needed to use it as it is because it will draw over the bubbles if you address directly the underlying bubble for the paths. There are some remedies but I'm not sure if you need them. Also append after command should be used inside a path but here we are just being adventurous.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{positioning}

\tikzset{single bubble/.style={draw, circle, fill=white, minimum width=5em},
tribubble/.style={
        single bubble,
        append after command={
             \pgfextra{\let\mylastnode\tikzlastnode} 
             node [single bubble, above right = 1mm and 5mm of \mylastnode.center] {Código}
             node [single bubble, below right = 1mm and 5mm of \mylastnode.center] {Refactor}
        }
    }
}


\begin{document}

\begin{tikzpicture}
    \draw (0,0) circle (3cm);
    \node[tribubble] at (45:3cm){Prueba};
    \node[tribubble] at (-45:3cm){Prueba};
\end{tikzpicture}


\end{document}

enter image description here

share|improve this answer
    
@Qrrbrbirlbel Where is the fun in that? :P –  percusse May 13 '13 at 22:15
    
Even less adventure (this produces the same layout as OP’s): label={[single bubble, shift={(1.2,-0.6)}]center:Código},label={[single bubble, shift={(1.2,0.6)}]center:Refactor}. –  Qrrbrbirlbel May 13 '13 at 22:24
    
Oh, I like it. I'll see what I can do with the intersection and I'd let you know. Thks! –  Nico May 13 '13 at 23:45
    
@Qrrbrbirlbel I don't understand how to use what you said, could you give me some tips? –  Nico May 14 '13 at 1:02

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.