
これが私のコードです:
\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}
左の円の上に「75 の素因数」というラベルを付け、右の円の上に「60 の素因数」というラベルを付けたいのですが、どうすればいいでしょうか。これを行うには、ベン図に別のコードを使用する必要がありますか。
答え1
ノードのパラメータを使用してlabel
、配置する場所を設定できます。
\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}