刪除 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}

在此輸入影像描述

相關內容