
這是我的程式碼:
\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}