2

I am running TikZ (pgf_210.tds), TeX 3.141592, and Fedora 14. I am working on Venn diagrams. The examples all do the right art work, but draw the set identification as in

\draw \firstcircle node[text=white, below] {$A$}
\draw \secondcircle note[text=white, above] {$B$}

on top of each other just left of the midpoint of the left arc of the intersection.

Any thoughts?


\begin{document}
%% From a tikz Venn example
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[fill=gray]
\begin{scope}
\clip (-2,-2) rectangle (2,2)
   (1,0) circle(1);  
\fill (0,0) circle (1);
\end{scope}

\begin{scope}
\clip (-2,-2) rectangle (2,2)
   (0,0) circle(1);
\fill (1,0) circle(1);
\end{scope}

draw (0,0) circle (1) (0,1) node [text=black,above] at (2,2) {$A$}
    (1,0) circle (1) (1,1) node [text=black,above] at (1,1) {$B$}
    (-2,-2) rectangle (3,3);
\end{tikzpicture}
\end{document}
4
  • 5
    Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem.
    – egreg
    Jun 26, 2012 at 22:24
  • 3
    This is most probably taken from texample.net/tikz/examples/venn-diagram
    – percusse
    Jun 26, 2012 at 23:23
  • Still no change. I suspect a compatibility problem, either my TeX/LaTeX package (version 3.14159) or (less likely) Fedora 14. I'll try getting a newer LaTeX version. Thanks for your attention. Jun 29, 2012 at 18:59
  • @JohnSlimick The key here is the version of your packages, not of TeX itself. Add \listfiles to your source and edit the resulting **File List** from the .log file into your answer.
    – Joseph Wright
    Jun 29, 2012 at 20:31

1 Answer 1

4

If I understand your question, you are not able to place the labels for the sets at the appropriate points. The easiest fix for this is to use the syntax node [<options>] {<node_text>}. It will automatically be placed relative to the last point in the path:

\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,3);

which produces:

enter image description here

Note:

  • I have used three separate \draw commands as I think that is clearer, but the above syntax also works.

Code:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[fill=gray]
\begin{scope}
    \clip (-2,-2) rectangle (2,2) (1,0) circle(1);  
    \fill (0,0) circle (1);
\end{scope}

\begin{scope}
    \clip (-2,-2) rectangle (2,2) (0,0) circle(1);
    \fill (1,0) circle(1);
\end{scope}

\draw (0,0) circle (1) (0,1) node [text=black,above] {$A$};
\draw (1,0) circle (1) (1,1) node [text=black,above] {$B$};
\draw (-2,-2) rectangle (3,3);;
\end{tikzpicture}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .