[pstricks] almost closed c with pstricks

Michael Sharpe msharpe at ucsd.edu
Sat Jul 17 07:00:01 CEST 2010


On Jul 16, 2010, at 8:00 PM, mathias legrand wrote:

> Hi all,
> 
> is there a specific known manner to create example 53 (beginfig(53))
> of the following webpage : http://zoonek.free.fr/LaTeX/Metapost/metapost.html
> with pstricks. I know how to draw it with some personal tricks but I feel
> there is much better.

The version below works for (almost) arbitrary choices of radii and linewidth, without performing calculations other that the correct radii for clipping.

\documentclass[dvips]{minimal}
\usepackage[dvipsnames]{pstricks}
\begin{document}
\begin{pspicture}(-2.5,-2.5)(2.5,2.5)
\newdimen\lw\lw=2pt\relax
\newdimen\halflw\halflw=\lw \divide\halflw 2\relax
\newdimen\outerr\outerr=2cm\relax
\newdimen\innerr\innerr=.5cm\relax
\newdimen\outerclipr\outerclipr=\outerr
\advance\outerclipr\halflw
\newdimen\innerclipr \innerclipr=\innerr\advance\innerclipr-\lw
\pscircle*[linewidth=0pt,linecolor=black!20](0,0){\the\outerr}% gray filled circle
\psset{linewidth=\lw}
\pscircle(0,0){2}% outer circumference in black
\pscircle(0,0){.5}% inner circumference in black
\psclip{\pscircle[linestyle=none](0,0){\the\outerclipr}}
\psframe[fillstyle=solid,fillcolor=white](0,-.1)(2.5,.1)\endpsclip
\pscircle*[linecolor=white](0,0){\the\innerclipr}
\end{pspicture}
\end{document}

Michael




More information about the PSTricks mailing list