Graphics, Figures & TablesPSTricks | Properly closed Path

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

PSTricks | Properly closed Path

Post by svend_tveskaeg »

Hi all.

Consider the following MWE:

Code: Select all

\documentclass{article}

\usepackage{auto-pst-pdf,pstricks-add}

\begin{document}

\begin{figure}
\centering
\def\radius{21.65}
\def\faktor{0.33333333}
\pstFPmul\RelRadius\faktor{\radius}
 \psset{unit=0.35cm,linecolor=red}
  \begin{pspicture}(-0.2,-0.2)(15,17)
   \pnode(0,0){A}
   \pnode(!0 \RelRadius){B}
   \pnode(!2 \RelRadius\space mul \RelRadius){C}
   \pnode(!2 \RelRadius\space mul 0){D}
   \pnode(!\RelRadius\space dup){E}
   \pscustom[linewidth=3pt,dimen=inner]{%
     \psline(A)(D)\psarc(E){\RelRadius}{0}{180}\psline(B)(A)
   }
  \end{pspicture}
\end{figure}

\end{document}
As can be seen (when the code in compiled and the resulting PDF file viewed), the red curve is not properly closed at the bottom left corner.

How do I fix this?

Of course I can draw a small square at the bottom left corner but that is not exactly elegant. :D Furthermore, I would also like to use something like this for a path that closes at a non-90 degree angle, i.e, it is not good with a square.

Thank you in advance!
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

PSTricks | Properly closed Path

Post by CrazyHorse »

svend_tveskaeg wrote:How do I fix this?

Of course I can draw a small square at the bottom left corner but that is not exactly elegant. :D Furthermore, I would also like to use something like this for a path that closes at a non-90 degree angle, i.e, it is not good with a square.

Code: Select all

   \pscustom[linewidth=3pt,dimen=inner]{%
     
     \psline(A)(D)\psarc(E){\RelRadius}{0}{180}\psline(B)(A)
     
     \closepath

   }
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Re: PSTricks | Properly closed Path

Post by svend_tveskaeg »

Thank you, Herbert!
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
Post Reply