Graphics, Figures & TablesPolygon inside a Circle

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Polygon inside a Circle

Post by coachbennett1981 »

Hello,

I am trying to put a regular polygon in to a circle. The endpoints of the pentagon should be on my circle. Is there a way I can do this? I have found a method, but is there an easier way? I had to use GeoGeobra and manual put in points. Here is the code I used.

Code: Select all

\documentclass{article}
\usepackage{pst-eucl}
\usepackage{pst-poly}
\usepackage{pstricks-add}

\begin{document}
  \pstGeonode[PointName=none,CurveType=polygon,PointSymbol=none,fillstyle=solid,fillcolor=gray](-0.31,1.9){I}(-1.9,0.32){D}(-0.89,-1.69){E}(1.34,-1.34){F}(1.69,0.88){J}	
  \pstCircleABC[PointName=none]{I}{D}{E}{F}{O}
\end{document}

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Polygon inside a Circle

Post by localghost »

Since this question is quite old and thus not of interest anymore, the below solution is probably only for the record and for others with the same or a similar problem.

Simply browsing the manual of the pst-poly package (which you are already loading) and the PSTricks base manual gives me this.

Code: Select all

% !TeX program = pdflatex
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{pst-poly,pstricks-add}
\usepackage{auto-pst-pdf}  % allow PSTricks with pdfLaTeX

\begin{document}
  \begin{pspicture}[showgrid=false](-3,-3)(3,3)
    \pscircle (0,0){3}
    \rput(0,0){\PstPolygon[unit=3,PolyRotation=18,fillcolor=gray!25,fillstyle=solid]}
  \end{pspicture}
\end{document}
Reading manuals of the packages you use can't do any harm.


Thorsten
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Polygon inside a Circle

Post by cgnieder »

Hi coachbennett,

Please don't take these jokes personally! I'm sorry if they offended you! I merely responded to Thorsten's comment about manuals. But that's no reason calling people names, is it? He was right, though: before I answer any question I always open the needed package manuals to make sure I don't tell wrong stuff. Even for my own packages!

Let's rather go back to the topic: did the TeXnical side of Thorsten's answer help you?

Regards
site moderator & package author
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: Polygon inside a Circle

Post by Stefan Kottwitz »

Hello,

I removed some posts, because they were offtopic and could be misunderstood. I hope that's ok.

Stefan
LaTeX.org admin
Post Reply