删除 pstricks 中的区域阴影

删除 pstricks 中的区域阴影

我的代码基本上如下。

\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}

它生成下图

阴影图片

这正是我想要的,但有一个例外:大内圆外的椭圆区域和标记为 xxx 的区域应该不加阴影,其他部分不做任何更改。有没有直接的方法可以做到这一点?提前致谢。

答案1

以下是代码tikz(您的代码缺少椭圆内第二个圆的位置和尺寸):

\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}

输出:

在此处输入图片描述

答案2

\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}

在此处输入图片描述

相关内容