TransWikia.com

How to put labels on top of Venn diagram circles?

TeX - LaTeX Asked by Carl13531 on June 5, 2021

This is my code:

documentclass{article}
usepackage{tikz}

begin{document}
 begin{tikzpicture}
  tikzset{venn circle/.style={draw,circle,minimum width=4cm}}
  node [venn circle = white] (A) at (0,0) {$5 hspace{1cm}$};
  node [venn circle = white] (C) at (0:2cm) {hspace{1.7cm}$2$\ hspace{1cm} $2$};
  node[below] at (barycentric cs:A=1/2,C=1/2 ) {$5,3$};   
end{tikzpicture} 
end{document}

Above the left circle I’d like the label “Prime factors of 75” and above the right “Prime factors of 60”.
How can I do this? Should I use a different code for the Venn diagram to do so?

One Answer

You can use the label parameter for your nodes and set where you want them to be placed:

documentclass{article} usepackage{tikz}

begin{document} 

begin{tikzpicture} 

tikzset{venn circle/.style={draw,circle,minimum width=4cm}} 
node [venn circle = white] (A) at (0,0) [label={[xshift=-1.0cm, yshift=0.3cm]{footnotesize Prime factors of 75}}] {$5 hspace{1cm}$}; 
node [venn circle = white] (C) at (0:2cm) [label={[xshift=1.0cm, yshift=0.3cm]{footnotesize Prime factors of 60}}] {hspace{1.7cm}$2$ hspace{1cm} $2$}; 
node[below] at (barycentric cs:A=1/2,C=1/2 ) {$5,3$};

end{tikzpicture} 

end{document}

Answered by Plergux on June 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP