TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to reproduce this graph, using TikZ:


So far, what I got is this:

tex image

It's not bad, I don't mind the circles instead of having elipses (not the point of my question anyway)... The problem is: how do I post text inside the three spaces so that LaTeX automatically forces the text inside of those spaces so that if the text is a lot, it might even fit the same shapes? As you can see the preview text, which is lol, goes to the center of the circles which inevitably means being on the circle lines. (You can use any text for the answer, like lipsum, and so on.) My current Tex code is:


% Definition of circles
\def\firstcircle{(0,0) circle (5cm)}
\def\secondcircle{(0:5cm) circle (5cm)}

\colorlet{circle edge}{black}
\colorlet{circle area}{white}

\tikzset{filled/.style={fill=circle area, draw=circle edge, thick},
outline/.style={draw=circle edge, thick}}


                            \firstcircle node(1) {$lol$}
                            \secondcircle node(2) {$lol$};

\node[anchor=east] at (current bounding box.west) {\huge{A}};
\node[anchor=west] at (current bounding box.east) {\huge{B}};
\node[anchor=north] at (current bounding box.south) {\huge{C}};


share|improve this question
up vote 22 down vote accepted

I would suggest placing the text using \nodes and then to use the fit library to draw the ellipses around the appropriate nodes; something along these lines:



\begin{tikzpicture}[node distance=2cm,
 every fit/.style={ellipse,ultra thick,draw,inner sep=0pt},
 mytext/.style={inner sep=6pt}]

\node[mytext,align=right,rectangle] (a) {some text \\ goes here \\ and spans \\ several\\ lines};
\node[mytext,align=center,rectangle,left=of a] (b) {some text \\ goes here \\ and spans \\ several\\ lines};
\node[mytext,align=left,rectangle,left=of b] (c) {some text \\ goes here \\ and spans \\ several\\ lines};

\node[draw,fit=(a) (b)] {};
\node[draw,fit=(c) (b)] {};


enter image description here

Using text width=<length> for the text nodes, the text will wrap automatically.

share|improve this answer
Is there a way to make the text centered? – ozsu Jul 9 '12 at 18:35
@gonzalo-medina If you try to color the ellipse by using fill=, the color is applied over the text. Is there a way to ensure the text is in front? – Trevor Alexander Jan 15 '14 at 2:55

Something like Gonzalo's method but here I fix the shapes. I gave some dimensions to the rectangles and then I placed nodes for texts inside the rectangles. The little advantage is to fix the height of the rectangle. If you don't do that and If a text is higher than another, then the ellipses are asymmetrical.


  \def\textfortest { Little text for testing}
\begin{tikzpicture}[txtstyle/.style={minimum width=3cm,minimum height=4cm,draw,inner sep=0pt}]
 \node [txtstyle] (n1) {};
 \node [txtstyle,xshift=-5cm] (n2) {};   
 \node [txtstyle,xshift= 5cm] (n3) {}; 
 \node [ellipse,fit=(n1)(n2),draw] {};
 \node [ellipse,fit=(n1)(n3),draw] {};

 \begin{scope}[every node/.style={text width=3cm,anchor=north west}]
     \node  at (n2.north west){\textfortest. \textfortest}; 
     \node  at (n1.north west){\textfortest. \textfortest};  
     \node  at (n3.north west){\textfortest. \textfortest};


enter image description here

share|improve this answer

Your Answer


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.