Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

TikZ allows regular polygons with specified number of sides for nodes. I'm using PGF though and want similar features and to be able to create my own custom shapes.

See percusse's answer for example code:

Tikz scale vs pgf scale

and

http://www.texample.net/tikz/examples/node-shapes/

for the polygons.

What I would like is to be able to create a reference shape like rpoly7 that is simply a regular polygon with 7 sides that uses the TikZ shapes but can be passed to PGF like I do with the other shapes.

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

The regular polygon shape is not a "TikZ shape" (and neither are any of the other predefined shapes), they're all "PGF shapes". General rule: If the relevant keys in the pgfmanual include the /pgf directory, they're PGF keys. To set the parameters like regular polygon sides, you have to call \pgfkeys{/pgf/<option>=<value}:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}

\begin{document}
\begin{tikzpicture}
\pgfkeys{/pgf/regular polygon sides=6,/pgf/minimum size=0.75cm}
\pgfnode{regular polygon}{center}{}{}{}
\pgfusepath{draw}
\pgftransformshift{\pgfpoint{1cm}{0pt}}
\pgfkeys{/pgf/regular polygon sides=3}
\pgfnode{regular polygon}{center}{}{}{}
\pgfusepath{draw}
\end{tikzpicture}
\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.