2

My code is essentially the following.

\documentclass{article}
\usepackage{pstricks}
\begin{document}
 \psset{xunit=1cm, yunit=1cm, algebraic= true}
 \begin{pspicture}(-6,-7)(6,7)
 \pspolygon[showpoints = false, linearc = 0.2](5,6.2)(5,-6.2)(-5,-6.2)(-5, 6.2)
 \pscircle[](0,0){4.9} %outermost circle
 \pscircle[](0,0){3.5} %inner large circle
 \pscircle[](0,2.2){.5} %tiny circle
 \pscircle[](1.55,2.2){.6} %another tiny circle
\pscustom[fillstyle=solid, fillcolor=lightgray]{
 \psellipse[](-1.3,-.3)(3.2,2) %shaded ellipse
 }
\pscustom[fillstyle=solid, fillcolor=white]{\psellipse[](-.5,-.5)(1.5, 1.5)} %circle within shaded ellipse
 \pscircle[](-.8,-.5){.68} 
 \pscircle[](0,0){3.5} % restoring portion of inner circle shaded over
 \uput{1.7}[180]
        (-1.95,0){xxx}
\end{pspicture}
\end{document}

It generates the figure below

shading picture

which is precisely what I want with one exception: the region of the ellipse outside the large inner circle and marked xxx only should be unshaded with no other changes. Is there a straightforward way to do this? Thanks in advance.

2 Answers 2

1

Here is the code in tikz (your code lack of the position and dimension of the second circle inside the ellipse):

\documentclass{article}
\usepackage{tikz}
\begin{document}
    
    \begin{tikzpicture}
        %\draw[gray!25](-6,-7) grid (6,7);
        \draw[rounded corners] (-5,-6.2) rectangle (5, 6.2);    
        \draw circle(4.9);
        \draw (0,2.2) circle(.5);
        \draw (1.55,2.2) circle(.6);
        \draw (-.8,-.5) circle(.68);
        \begin{scope}
            \clip circle(3.5);
            \fill[lightgray] (-1.3,-.3) ellipse(3.2 and 2);
        \end{scope}
        \draw circle(3.5);
        \draw (1.55,2.2) circle(.6);
        \draw (-.8,-.5) circle(.68);
    \end{tikzpicture}
\end{document}

Output:

enter image description here

1
  • Thanks to @Raffaele Santoro for a tikz solution. However, I am yet very much interested in knowing whether this is possible in pstricks. Commented Jan 18 at 14:35
1
\documentclass{article}
\usepackage{pstricks}
\begin{document}
\psset{xunit=1cm, yunit=1cm, algebraic= true}
\begin{pspicture}(-6,-7)(6,7)
    \pspolygon[showpoints = false, linearc = 0.2](5,6.2)(5,-6.2)(-5,-6.2)(-5, 6.2)
    \pscircle[](0,0){4.9} %outermost circle
    \pscircle[](0,2.2){.5} %tiny circle
    \pscircle[](1.55,2.2){.6} %another tiny circle
    \psclip{\pscircle(0,0){3.5}} %inner large circle
        \psellipse[fillstyle=solid, fillcolor=lightgray](-1.3,-.3)(3.2,2) %shaded ellipse
    \endpsclip
    \psellipse[fillstyle=solid, fillcolor=white](-.5,-.5)(1.5, 1.5) %circle within shaded ellipse
    \pscircle[](-.8,-.5){.68} 
    \pscircle[](0,0){3.5} % restoring portion of inner circle shaded over
    \uput{1.7}[180](-1.95,0){xxx}
\end{pspicture}
\end{document}

enter image description here

2
  • This worked perfectly. Thanks much to @user18702. Commented Jan 18 at 22:50
  • you should accept the answer. Otherwise your question will be marked as unanswered ...
    – user187802
    Commented Feb 3 at 18:57

You must log in to answer this question.

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