EDIT::  I saw the question mentioned in  which the moderator considered mine duplicate. However, I couldn't see how mine is duplicate. My main problem is to write the text in the intersection of CAT B and CAT C.   I am trying to create the following Venn diagram.   Following is my code and output:   \documentclass[border=10pt]{standalone} \usepackage{tikz} \begin{document}     \begin{tikzpicture} \begin{scope}[blend group = soft light] \fill[red!30!white]   ( 90:1.2) circle (2); \fill[green!30!white] (210:1.2) circle (2); \fill[blue!30!white]  (330:1.2) circle (2); \end{scope} \node at ( 90:2)    {CAT A}; \node at ( 210:2)   {CAT B}; \node at ( 330:2)   {CAT C}; \node [font=\small] {text1, text2, text3, text4}; \end{tikzpicture} \end{document}
12256
What I am up to is to write some exercises dealing with logical formulas for my students, like:     And the students should draw these formulas on . At the end of the lesson, I really would like to print the correct answer for them. I found a great resource on a forum thread at , which helped me a lot to make up some Venn diagrams with tikz, but have some problems with visualizing complements, like ~A.  A simple, modified version of the TeX file found on the forum linked above, can be seen below, which produces the following expression:    \documentclass{letter}   \usepackage{tikz}   \def\firstcircle{(90:1.75cm) circle (2.5cm)}   \def\secondcircle{(210:1.75cm) circle (2.5cm)}   \def\thirdcircle{(330:1.75cm) circle (2.5cm)}   \begin{document}     \begin{tikzpicture}       \begin{scope}     \clip \secondcircle;     \fill[cyan] \thirdcircle;       \end{scope}       \begin{scope}     \clip \firstcircle;     \fill[cyan] \thirdcircle;       \end{scope}       \draw \firstcircle node[text=black,above] {$A$};       \draw \secondcircle node [text=black,below left] {$B$};       \draw \thirdcircle node [text=black,below right] {$C$};     \end{tikzpicture}   \end{document}   Which looks like:    Could anyone please help me out plotting/defining some expressions dealing with complements? A nice example could be:    That should look like: (image from )    I do not insist on the red color :)  I would like to use the simplest possible solution, as I would like to mass generate the exercises with the help of . So any suggestion dealing with gnuplot, R or any other opensource packages is welcome. Thank you!    UPDATE (25/01/2011): added details based on answers.  Thank you @Leo Liu, you helped me a lot! I modified a bit the code you suggested to be able to color the area outside of the two circles also (in the H universe), but have no idea how to set a background to that polygon also. The code:  \begin{tikzpicture}[fill=gray] % left hand \scope \clip (-2,-2) rectangle (2,2)       (1,0) circle (1); \fill (0,0) circle (1); \endscope % right hand \scope \clip (-2,-2) rectangle (2,2)       (0,0) circle (1); \fill (1,0) circle (1); \endscope % outline \draw (0,0) circle (1) (0,1)  node [text=black,above] {$A$}       (1,0) circle (1) (1,1)  node [text=black,above] {$B$}       (-2,-2) rectangle (3,2) node [text=black,above] {$H$}; \end{tikzpicture}   And the image generated:    I will also look for even odd rule in the near future which does not make sense for me at the moment but looks really simple and promising!
90327
This afternoon I was looking for a way to draw phasors with tikz (you know the thing which is represented in the complex plane as r*exp(i \theta) or simply x + iy)  For me, the first representation would be much easier to deal with.  Should I use the polar system simply ? But then it comes tricky to make vector summations...
69212
In a software diagram, I'd like to be able to represent multiple instances of an object by two rectangles with one of them slightly shifted. I recently learned about the pic style so I'm using it with two nodes to achieve what I want.  The following example does work, but I'd like to know if I can do the same without using the fill=white. My hack kind of assumes the entire picture background is white and that may not always hold. I'd like to be able to crop the unwanted picture part out.  \documentclass[crop,border=3pt]{standalone}  \usepackage{pgf,tikz} \usetikzlibrary{positioning}  \begin{document} \begin{tikzpicture}[     every node/.style={font=\sffamily\small},     block/.style={         rectangle, draw, align=center, minimum width=2cm,         minimum height=1.4cm, font=\sffamily\small     },     multinode/.pic={         \node [block] at (0.1,0.1) {};         \node [block, \tikzpictextoptions, fill=white] at (0,0) {\tikzpictext};% &lt;-- FILL WHITE     } ]     \node [block] (STG) at (2,5) {single\\instance};     \pic [pic text={multi\\instance}] at (5,5) {multinode}; \end{tikzpicture} \end{document}   The following images show first one version with the fill white hack, and then one version without it.
55356
Let $\Gamma_1$ and $\Gamma_2$ be two non overlapping circles with centers $O_1$ and $O_2$ respectively. From $O_1$, draw the two tangents to $\Gamma_2$ and let them intersect $\Gamma_1$ at points $A$ and $B$. Similarly, from $O_2$, draw the two tangents to $\Gamma_1$ and let them intersect $\Gamma_2$ at points $C$ and $D$.  Prove that $AB=CD$.  I've done some extensive angle chasing on this but have been unable to make any real progress. Can't decide whether $ABCD$ is supposed to be rectangle (as in my diagrams), a parallelogram or even a trapezium. There is a homothety taking one circle to the other but as far as I can see this doesn't help as we don't have a clearly defined center to this.  Any help/hints would be greatly appreciated.
121355
I am trying to write the code to draw the picture below in TikZ. My code is necessarily long with lots of \foreach loops. Could you please give guidance on how to reproduce this picture in TikZ.
113340
Why blue and red lines don't fit the black line, and why are they overlap each other ?    \documentclass[tikz,margin=5pt]{standalone}  \usetikzlibrary{calc} \usetikzlibrary{decorations.markings}  \begin{document}  \begin{tikzpicture}[Dble/.style args={#1 and #2}{% decoration={%     markings,% switch on markings     mark=at position 0 with {%         \node[yshift= .5\pgflinewidth] (Axx) {};         \node[yshift=-.5\pgflinewidth] (Bxx) {};},     mark=at position 1 with {%         \node[yshift= .5\pgflinewidth] (Ayy) {};         \node[yshift=-.5\pgflinewidth] (Byy) {};         \draw [#1] (Axx)--(Ayy) ;         \draw [#2] (Bxx)--(Byy) ;}     },     postaction={decorate}} ]  \coordinate (A) at (0,0) ; \coordinate (B) at (1,1) ;  \draw[Dble={blue and red},very thick] (A)--(B) ;  \end{tikzpicture} \end{document}
64307
How do I create a Venn Diagram with entities no larger than below, but with text scaled to fit; and circles in alignment horizontally?  \documentclass[a4paper, 14pt]{article}  \usepackage{tikz}  \begin{document}  \begin{tikzpicture}   \tikzset{venn circle/.style={draw,circle,minimum width=3cm,fill=#1,opacity=0.4}}    \node [venn circle] (A) at (0,0) {first order logic};   \node [venn circle] (B) at (30:2cm) {logic programming};   \node[below] at (barycentric cs:A=1/2,B=1/2){definite clause logic}; \end{tikzpicture}    \end{document}
52006
How can I Tex this equation?  I try to have exactly the same result but for the moment I only succeeded in having intersecting lines... Thanks!
51849
Why doesn't TikZ find all intersections. They are obviously there …    \documentclass[border=10mm]{standalone}  \usepackage{tikz} \usetikzlibrary{intersections}  \begin{document} \begin{tikzpicture}[point/.style={fill=blue,minimum size=1mm,inner sep=0pt,circle}]     % Zoom (to prevent oveflow)     \def\yzoom{100}     % Plots     \foreach \T/\xmin/\a in {%         0.27/1.538/a,         0.28/1.590/b,         0.29/1.649/c     } {         \draw [thin,name path global/.expanded={kurve \a}]             plot [raw gnuplot] function {%                 set xrange [\xmin:10];                 set yrange [0:0.08*\yzoom];                 set samples 1000;                 f(x) = \yzoom*(\T/(x-1) - 1/(x**2));                 plot f(x);             };     }     % Lines     \foreach \p/\a in {%         %% T = 0.27         0.0231/a,         %% T = 0.28         0.02855/b,         %% T = 0.29         0.0338/c     }{         \draw [red,thin,name path global/.expanded={linie \a}]             (0,\p*\yzoom) -- (10,\p*\yzoom) node [fill=white,pos=0.1] {\a};     }     % Intersections points     \path [name intersections={of=kurve a and linie a,by={P1,P2,P3}}]         (P1) node [point] {} (P2) node [point] {} (P3) node [point] {};     \path [name intersections={of=kurve b and linie b,by={P1,P2,P3}}]         (P1) node [point] {} (P2) node [point] {} (P3) node [point] {};     \path [name intersections={of=kurve c and linie c,by={P1,P2,P3}}]         (P1) node [point] {} (P2) node [point] {} (P3) node [point] {}; \end{tikzpicture} \end{document}   There seems to be no problem with the names of the paths but TikZ is missing four intersection points.  Bonus question: Is it possible to solve the last part (adding blue points) with the second \foreach? I tried it but I get the error File ended while scanning use of \tikz@intersect@path@names@parse..
122859
I have 3 nodes placed on a circle.  These nodes are differently shaped.  I want to connect them and want the arrows to look like a circle, because it is a repeating process.  I can connect them with bend left, but that is not circle enough for me.  I could mess around with in=... and out=..., but that is not a smart solution, because I would have to mess around every time I want such a picture.  Here an example code:  \documentclass{article}  \usepackage{tikz}   \begin{document}     \begin{tikzpicture}      % three differently shaped nodes on a circle     \node [rectangle, draw, text width=3cm] (a) at (180:3cm) {Hello World! Hello World!};     \node [rectangle, draw, text width=2cm] (b) at (60:3cm) {Hello World!};     \node [rectangle, draw, text width=2cm] (c) at (300:3cm) {Hello World!};      % connectors between the nodes     \draw[-&gt;] (a) to [bend left] (b);     \draw[-&gt;] (b) to [bend left] (c);     \draw[-&gt;] (c) to [bend left] (a);      % the circle I wish the connectors to be placed on     \draw[dashed,red] circle [radius=3cm];      \end{tikzpicture} \end{document}   I would like the connectors to be placed directly on the red dashed circle.  Has anyone a smarter solution than try and error with in and out?
115563
Why does this example only partially work?  \documentclass{minimal} \usepackage{etex} \usepackage{tikz} \usetikzlibrary{shapes,calc,arrows,trees,positioning,through,intersections,fadings} \begin{document}     \begin{tikzpicture}[scale=0.5] \coordinate (a) at (0,0); \coordinate (b) at (6,0); \coordinate (c) at (9,6); \node(A)[label=$A$] at (a) {$\bullet$}; \node(B)[label=50:$B$] at (b)  {$\bullet$}; \node(C)[label=$C$] at (c) {$\bullet$}; \draw[thick] (a)--(b)--(c)--cycle; %           \node(c1) at (a)[draw,circle through=(b)] {}; %           \coordinate(ac) at(intersection 1 of c1 and a--c); %            %           \node(c2) at (ac)[draw,circle through=(b)] {}; %           \node(c3) at (b)[draw,circle through=(ac)] {}; %           \coordinate(bta) at(intersection 1 of c2 and c3 ); %           \node(xx)[label=$C$] at (bta) {$\bullet$}; %       \coordinate(bisa) at(intersection 1 of a--bta and b--c); %       \draw (a)--(bisa); %%%%%%%%%%%%%%%%%%%%%%%%%%% work %%%%%%%%%%%%%%%%%%         \node(c4) at (b)[draw,circle through=(a)] {};             \coordinate(bc) at(intersection 1 of c4 and b--c);             \node(xx)[label=$prova$] at (bc) {$\bullet$};             \node(c5) at (bc)[draw,circle through=(a)] {};             \node(c6) at (a)[draw,circle through=(bc)] {};             \coordinate(btb) at(intersection 1 of c5 and c6 );         \node(xx)[label=$prova$] at (btb) {$\bullet$};         \coordinate(bisb) at(intersection 1 of b--btb and a--c);         \draw (b)--(bisb); %%%%%%%%%%%%%%%%%%%%%%%%%%% work %%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% it doesn't work%%%%%%%%%%%%%%%%%% \node(c7) at (c)[draw,circle through=(b)] {}; \coordinate(ac) at(intersection 2 of c7 and a--c); \node(xx)[label=$prova2$] at (ac) {$\bullet$}; %%%%%%%%%%%%%%%%%%%%%%%%%%% it doesn't work %%%%%%%%%%%%%%%%%%  \end{tikzpicture} \end{document}
55865
Are both the Venn diagram's (i and ii) showing dependent properties (showing that A and B are dependent on one another), I am told that the quartered one is independent (Venn diagram i), however I do not see any difference between the 2 diagram's. Surely P(A|B) (probability of B given A), will come out to be the same in both diagrams. This is because we are constrained to A and AB (highlighted red in Venn diagrams) as we know the outcome will be either AA or AB. Further, the ratio of N(AB) to N(A) will give us our probability P(A|B), which can be seen to lie in both diagrams to be in the region A and AB.  I know that if P(A|B) = P(B) , we have independent events, however how can we deduce if the Venn diagrams are showing independent events or not. Thanks
11547
\begin{tikzpicture} \node [draw=black, anchor=south west] (label) at (0,0){\includegraphics[width=300mm]{th.jpg}}; \coordinate (ZX) at (157mm,104mm); \coordinate (YB) at (249mm,39mm); \coordinate (YY) at ($(ZX)!1.5!(YB)$); \coordinate (ZZ) at ($(YB)!2.5!(ZX)$); \draw[blue!20,very thick] (ZZ)--(YY); \draw[red!20,very thick, rotate around={90:(ZX)}] (157mm,104mm)--(249mm,39mm);%It works \draw[red!20,very thick, rotate around={-90:(ZX)}] (ZX)--(YB);%It doesn't work \filldraw[white] (ZX) circle (2mm); \filldraw[white] (YB) circle (2mm); \end{tikzpicture}   a working example       \documentclass{minimal} \usepackage{tikz,tikz-3dplot}  \begin{document}    \tdplotsetmaincoords{70}{115}    \begin{tikzpicture}[scale=4,tdplot_main_coords] \pgfmathsetmacro{\rvec}{.8} \pgfmathsetmacro{\thetavec}{30} \pgfmathsetmacro{\phivec}{60}  \tdplotsetrotatedcoords{\phivec}{\thetavec}{0}   \coordinate (O) at (1,1,1);   %these 2 lines overlap \draw[thick,-&gt;] (O) -- (0,.5,0); \draw[thick,tdplot_rotated_coords,-&gt;] (O) -- (0,.5,0);   %these 2 lines dont overlap \draw[thick,-&gt;] (1,1,1) -- (0,.5,0); \draw[thick,tdplot_rotated_coords,-&gt;] (1,1,1) -- (0,.5,0); \end{tikzpicture} \end{document}
73947
I am trying to create a process flow diagram of my rig using LaTex but I am stuck at trying to figure out how to create a semicircular jump at the intersection of two independent lines in the drawing. My current code and output are as follows.  \documentclass[11pt]{standalone} \usepackage{lmodern} \renewcommand*{\familydefault}{\sfdefault} \usepackage{sfmath} \usepackage[version=4]{mhchem} \usepackage{tikz}  \usetikzlibrary{arrows.meta,fit,positioning,intersections,shapes.geometric, decorations,patterns,decorations.markings} \tikzset{ every path/.style={thick}, every node/.style={     font={\normalsize},     align=center,     transform shape     }, } \begin{document} \begin{tikzpicture}[node distance=0.75cm]     \tikzset{         sv/.pic={             \def \x {0.43}             \node[draw,isosceles triangle,fill=none] (a) at (-\x,0) {};             \node[draw,isosceles triangle,shape border rotate=180,fill=none] at (\x,0){};             \draw[fill=none] (0,0) circle (0.22);            },%shutoff valve         lifwv/.pic={             \def \x {1pt}             \node[draw,circle,minimum size=0.6cm] (a) at (0,0){};             \node[circle,minimum size=0.4cm] (b) at (0.1,0){};             \fill (b.90) circle (\x) (b.0) circle (\x) (b.180) circle (\x) (b.270) circle (\x);             \draw[-&gt;] (a.90) -- ++(0,0.5) -- ++(0.5,0) node[right,ellipse,draw,inner sep=0.5pt](mv){M.V.};             \draw[-&gt;] (a.270) --  ++(0,-0.5) -- node[pos=0.5,nosep] (evap){} ++(1,0) -- ++(0,0.815) -- (a.0);             \node[below right = of evap,draw,yshift=0.25cm] (syp){Pump};             \draw[-&gt;] (syp) -|(evap);                    },%liquid injection right 4-way valve         pt/.pic={             \draw (0,0) -- ++(0.25,0) node[right,draw,circle,minimum size=0.5cm,font=\small,inner sep=0pt](a){P};         },%pressure transducer         jump/.pic={             \filldraw[draw=black,fill=white] (0.15,0) arc (0:180:0.15);             \draw[red,dashed] (0,0) circle (0.5);         },         mfc/.style={             draw,minimum width=1.75cm,minimum height=0.9cm,             text height=1.5ex         },         nosep/.style={             inner sep=0pt,             outer sep=0pt,           },%meeting-point     }     \node[mfc] (mfc1) {a};     \node[below = of mfc1,mfc] (mfc2) {\ce{b}};     \node[below = of mfc2,mfc] (mfc3) {\ce{c}};     \node[below = of mfc3,mfc] (mfc4) {\ce{d}};     \node[below = of mfc4,mfc] (mfc5) {\ce{e}};     \node[below = of mfc5,mfc] (mfc6) {\ce{f}};     \foreach \y in {1,2,...,6}{         \draw[-&gt;] (mfc\y.east) --++(0.5,0) node[right=12pt] (svmfcc\y){} node[right=24pt](svmfcr\y){};         \pic at (svmfcc\y){sv};      };     %line-1     \draw[-&gt;] (svmfcr1) -- node[pos=0.45,nosep](mpl1){} ++(1.5,0) -- pic[pos=0.4,-]{pt}++(0,0.75) -- ++(2,0) pic[right]{lifwv} node[right](l1){};     \foreach \y in {3,5,6} {         \draw[-&gt;] (svmfcr\y) -- ++(0.75,0);      };     \draw[-&gt;] (svmfcr6) ++(0.75,0) -- (mpl1);     %line-2     \draw[-&gt;] (svmfcr2) -- node[pos=0.75,nosep] (mpl2){} ++(1.5,0) -- pic[-,pos=0.4]{pt}++(0,-0.75) -- ++(2,0) pic[right]{lifwv} node[right](l2){};     \draw[-&gt;] (svmfcr4) -- ++(1.16,0) -- (mpl2); \draw[-&gt;] (svmfcr4) -- pic[pos=0.6,-]{jump} ++(1.16,0) -- (mpl2); \end{tikzpicture}    \end{document}      I know one way is to define a semicircular pic with a white fill and overlay it at the intersection (as implemented in the current code and highlighted with a red dashed circle). But ideally, I would like to implement a jump with no fill and define it as a marking decoration on the line, just like an arrow decoration that can be defined using decorations.markings library. Is there a way to implement this?
26964
but now my question is more complicated than just drawing Venn diagrams one by one. I need to draw all possible Venn diagrams efficiently. I need a combinatorical approach because there are 256 combinations.  Let's choose the following sets  as the case to consider. The binary number labels are used to uniquely identified each "atomic" region. My definition: An atomic region does not contain any smaller region.  Because there are 8 atomic regions, each can be either selected or not to compose a new compound region. Therefore there are 2^8 ways.  How to generate all possible Venn diagrams (with the case above) efficiently?    The objective is to produce 256 Venn diagrams, each diagram has a unique colored compound region that has an associated set operation.   Let's use 8-bit integer to represent each diagram.  The first bit (the most left bit or the most significant bit) represents the region 000.  The second bit represents the region 100.  ...  The least significant bit represents the region 111.  Bit 0 represent not-join to produce a new compound region. And 1 otherwise.  If the first diagram with the complement of AuBuC then its binary representation is 1000 0000. 1111 1111 represents S. Etc etc etc!  The Problem Sheet  The problem sheet will ask the student to find a set operation (not necessarily unique) for each RED COMPOUND region in each diagram below.      ...
17033
How do I color intersection of two ellipses in different color. For instances, the ellipses should themselves be colored as yellow and their intersection as red. My code for drawing ellipses is given below  \draw (-4,0) ellipse (8 and 3); \draw (8,0) ellipse (8 and 3);   UPDATE: In the comments to individual answers, I have requested to show it for three ellipses.
100408
I have proved this using Venn diagram but when I am trying to prove this using the rule that "If $ A \subset B \text{ and } B \subset A $ then $ A = B $", I am having some problems with my understanding of the same,here is how I  did so far:  Let $x \in A \cap (B-C) \Rightarrow x \in A  \text{ and }  x \in (B-C) \Rightarrow x \in A \text{ and } (x \in B \text{ and } x \notin C)  $  How to proceed next? Since if I am do something like this: $ x \in A \text{ and } x \in B \text{ and } x \in A \text{ and } x \notin C $, it's not giving the correct results, what exactly I am missing here?