How to draw this Venn Diagram using PSTricks?
I could only reproduce your output after setting unit
to 0.5cm. Anyway, this code produces something close to your desired picture.
\documentclass{article}
\usepackage{pstricks}
\usepackage{amsmath}
\usepackage{auto-pst-pdf}
\begin{document}
\psset{unit=0.5cm}
\begin{pspicture}(-6,-6)(6,6)
\pscircle(-3,-3){6}
\pscircle(5,-3){6}
\rput[c](-4,-3){\begin{tabular}{c}multiples\\ of 2
\end{tabular}}
\rput[c](6,-3){\begin{tabular}{c}
multiples\\ of 3
\end{tabular}
}
\pscustom[fillstyle=solid, fillcolor=lightgray, linestyle=solid]{
\psarc(-3,-3){6}{-48}{48}
\psarc(5,-3){6}{132}{228}
}
\rput[c](1,-3){\begin{tabular}{c}
multiples\\ of 6
\end{tabular}}
\end{pspicture}
\end{document}
I'd also recommend to use the pstricks
command \rput
instead of \put
.
Use clipping:
\documentclass{article}
\usepackage{pstricks}
\begin{document}
\begin{pspicture}(-6,-3)(6,3)
\rput(-2.5,0){\shortstack{multiples\\of 2}}
\rput(2.5,0){\shortstack{multiples\\ of 3}}
\psclip{\pscircle(-2,0){3}}
\pscircle[fillstyle=solid, fillcolor=lightgray](2,0){3}
\endpsclip
\pscircle(2,0){3}
\rput(0,0){\shortstack{multiples\\ of 6}}
\end{pspicture}
\end{document}
If you prefer \pscustom
, then use
\documentclass{article}
\usepackage{pst-eucl}
\begin{document}
\begin{pspicture}[showgrid](-6,-3)(6,3)
\pstGeonode[PointName=none,PointSymbol=none](-2,0){A}(2,0){B}
\pstInterCC[RadiusA=\pstDistVal{3},RadiusB=\pstDistVal{3}]{A}{}{B}{}{I1}{I2}
\pscustom[fillstyle=solid,fillcolor=red!30]{%
\pstArcOAB{A}{I2}{I1}
\pstArcOAB{B}{I1}{I2}
}
\pscircle(A){3}\pscircle(B){3}
\end{pspicture}
\end{document}
You can use pst-eucl.
\documentclass[svgnames,dvipsnames]{article}
\usepackage{pstricks,pstricks-add,pst-eucl}
\usepackage{amsmath}
\usepackage{auto-pst-pdf}
\begin{document}
\psset{unit=0.5cm}
\begin{pspicture}[showgrid](-9,-6)(11,6)
\pnode(-3,0){A}
\pnode(5,0){B}
\midAB(A)(B){M}
\def\radA{6}
\def\radB{6}
\pscircle(A){\radA}
\pscircle(B){\radB}
\rput[r](A){\shortstack{multiples\\ of 2}}
\rput[l](B){\shortstack{multiples\\ of 3}}
\pstInterCC[DistCoef=1, RadiusA=\pstDistVal{\radA},DistCoef=1,
RadiusB=\pstDistVal{\radB}]{A}{}{B}{}{E}{F}%
\pscustom[fillstyle=solid, fillcolor=lightgray, linestyle=solid]{
\pstArcOAB{A}{F}{E}
\pstArcOAB{B}{E}{F}
}
\rput[c](M){\shortstack{multiples\\ of 6}}
\end{pspicture}
\end{document}
If it is necessary to calculate the angles, this can be done on the postscript-side:
\documentclass[pstricks,border=5mm,x11names,svgnames,dvipsnames]{standalone}
\usepackage{pstricks-add,pst-eucl}
\usepackage{amsmath}
\usepackage{auto-pst-pdf}
\begin{document}
\psset{unit=0.5cm}
\begin{pspicture}[showgrid,saveNodeCoors,NodeCoorPrefix=n](-9,-6)(11,6)
\pnodes(-3,0){A}(5,0){B}
\midAB(A)(B){M}
\def\radA{6}
\def\radB{6}
\pscircle(A){\radA}
\pscircle(B){\radB}
\rput[r](A){\shortstack{multiples\\ of 2}}
\rput[l](B){\shortstack{multiples\\ of 3}}
\pstInterCC[RadiusA=\pstDistVal{\radA},RadiusB=\pstDistVal{\radB}]{A}{}{B}{}{E}{F}%
\pnode(F){Fq}\pnode(E){Eq}
\pscustom[fillstyle=solid,fillcolor=lightgray,linestyle=solid]{
\psarc(A){\radA}{! nFqy nAy sub nFqx nAx sub atan}{! nEqy nAy sub nEqx nAx sub atan}
\psarc(B){\radB}{! nEqy nBy sub nEqx nBx sub atan}{! nFqy nBy sub nFqx nBx sub atan}
}
\rput[c](M){\shortstack{multiples\\ of 6}}
\end{pspicture}
\end{document}