2

This question already has an answer here:

enter image description here

I don't know how to draw in Latex. Maybe someone has an idea how to make the diagram in the picture? Many thanks!

So here is my try:

\def\firstcircle{(0,0) circle (1.5cm)}
\def\secondcircle{(0:2cm) circle (1.5cm)}

\begin{tikzpicture}
    \draw[filled] \firstcircle node {$n_{ij}$}
                  \secondcircle node {};
    \node[anchor=south] at (current bounding box.north) {$t_i,  t_j $};
\end{tikzpicture}

Do someone know how to write $t_i$ on the left side and $t_j$ on the right side?

marked as duplicate by Henri Menke, skpblack, CroCo, Jesse, ChrisS Jul 18 '17 at 23:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • see texample.net/tikz/examples/venn-diagram. welcome to site! – Zarko Jul 18 '17 at 19:45
  • How do I write letters inside or outside the diagram? – flos Jul 18 '17 at 19:46
  • similarly as inside. you only need to define its definition. please, provide what you try so far. in given link you have good tart to compose your MWE (Minimal Working Example). From it to your desired result we can easy help you. Without it this is "do-it-for-me" question which is not likely to be answered (soon). – Zarko Jul 18 '17 at 19:55
  • well, given link show tikz solution. beside it exist solution with other packages, like pstrick etc. Your question is not very clear about this. For tikz existe exist good manual, where are also examples for Wenn diagrams. – Zarko Jul 18 '17 at 19:59
  • I will try to post a version of the code, but since I am new it will take me some time to understand how it works. I would be then glad to discuss it since I am afraid I will not manage to do it as it is in the picture. Thanks again – flos Jul 18 '17 at 20:10
2

It's very simple with the venndiagram package:

    \documentclass[svgnames]{article}

    \usepackage{venndiagram}

    \begin{document}

    \begin{venndiagram2sets}[labelA=, labelB=, shade =Gainsboro!65!Lavender!30]%
    \fillACapB
    \setpostvennhook
    {%
      \draw (labelA) ++(150:4ex) node{$ t_i $};
      \draw (labelA) ++(-105:8ex) node{$\scriptstyle\bullet$} ++(0,0) node[above]{$n_{i j} $};
     \draw (labelB) ++(20:5ex) node{$t_j$};;
        }%
    \end{venndiagram2sets}

    \end{document}

enter image description here

  • Thank you very much, it is very beautiful! However is there the option to put away the rectangle around? – flos Jul 18 '17 at 23:39
  • @flos: I'm sure it's possible, but I'll have to look at the package code tomorrow – I must say I know pstricks better than TiKZ. – Bernard Jul 19 '17 at 0:13
2

With pure tikz, based on example of venn-diagram

enter image description here

\documentclass[tikz, margin=3mm]{standalone}

\begin{document}
    \begin{tikzpicture}[
dot/.style = {circle, inner sep=0pt, minimum size=1mm, fill,
              node contents={}}
                        ]
\def\firstcircle{(-1.2,0) coordinate (a) circle (2cm)}
\def\secondcircle{(1.2,0) coordinate (b)  circle (2cm)}
    \begin{scope}
\clip \secondcircle;
\fill[cyan] \firstcircle;
    \end{scope}
\draw \firstcircle  node[dot,label=$n_{ij}$];
\draw \secondcircle;
\node (c) [above] at (current bounding box.north -| a) {$t_i$};
\node at (c -| b) {$t_j$};
    \end{tikzpicture}
  \end{document}
  • Thank you very much also for your solution. It looks good! – flos Jul 18 '17 at 23:40

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