<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%\immediate\write18{tex penrose_code.dtx}
\documentclass{ltxdoc}
\usepackage[T1]{fontenc}
\usepackage{trace}
\usepackage{lmodern}
\usepackage{morefloats}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{penrose}
\usepackage[numbered]{hypdoc}
\definecolor{lstbgcolor}{rgb}{0.9,0.9,0.9} 
 
\usepackage{listings}
\lstloadlanguages{[LaTeX]TeX}
\lstset{
  breakatwhitespace=true,
  breaklines=true,
  language=[LaTeX]TeX,
  basicstyle=\small\ttfamily,
  keepspaces=true,
  columns=fullflexible
}

\usepackage{fancyvrb}

\newenvironment{example}
  {\VerbatimEnvironment
   \begin{VerbatimOut}{example.out}}
  {\end{VerbatimOut}
   \begin{center}
   \setlength{\parindent}{0pt}
   \fbox{\begin{minipage}{.9\linewidth}
     \lstinputlisting[]{example.out}
   \end{minipage}}

   \fbox{\begin{minipage}{.9\linewidth}
     \centering
     \input{example.out}
   \end{minipage}}
\end{center}
}

\newenvironment{justexample}
  {\VerbatimEnvironment
   \begin{VerbatimOut}{example.out}}
  {\end{VerbatimOut}
   \begin{center}
   \setlength{\parindent}{0pt}
   \fbox{\begin{minipage}{.9\linewidth}
     \lstinputlisting[]{example.out}
   \end{minipage}}
\end{center}
}

\colorlet{thinRhombus}{DarkOrchid}
\colorlet{thickRhombus}{DarkSlateGray}
\colorlet{circleArc}{RosyBrown}
\colorlet{longArc}{LawnGreen}

\colorlet{kite}{HotPink}
\colorlet{dart}{Fuchsia}

\colorlet{goldenTriangle}{Gold}
\colorlet{reverseGoldenTriangle}{Magenta}
\colorlet{goldenGnomon}{Cyan}
\colorlet{reverseGoldenGnomon}{LimeGreen}

\makeatletter
\tikzset{
  tint fill colour/.code={%
    \edef\@temp{%
      \def\noexpand\tikz@fillcolor{\tikz@fillcolor!#1}%
      \noexpand\tikz@addoption{\noexpand\pgfsetfillcolor{\tikz@fillcolor!#1}}%
    }%
    \@temp
  }
}
\makeatother

\providecommand*{\url}{\texttt}
\GetFileInfo{tikzlibrarypenrose.code.tex}

\title{The \textsf{Penrose} Package: Documentation}
\author{Andrew Stacey\texorpdfstring{\\ \url{loopspace@mathforge.org}}{}}
 \date{\fileversion~from \filedate}

\begin{document}
\maketitle

\tableofcontents
  
\section{Introduction}

The \textsf{Penrose} package is a TikZ library for drawing Penrose tiles.
It currently supports natively the kite/dart, rhombus, and pentagon tile sets, but has provision for defining new tiles.
There are two main methods for their placement: one that automatically generates a tiling, and one that allows for ``by hand'' placement.
Furthermore, the tiles themselves can be deformed and will still (hopefully!) fit together in the correct fashion.

\section{Initialisation}

To use this package, load the \Verb+tikz+ package and load \Verb+penrose+ as a TikZ library.
Specifically, your preamble should contain:

\begin{verbatim}
\usepackage{tikz}
\usetikzlibrary{penrose}
\end{verbatim}

\section{Usage}

Using this package splits into several components.
There are the two main ways of getting tiles on to the page, and then there are the ways of deforming or styling the tiles once they are there.

\subsection{Placing Tiles ``By Hand''}

It is possible to use the tiles as \Verb+pic+s.
These are mini-drawings introduced in TikZ3.0 that are node-like in style, but a little more geared towards repeatable \emph{drawings} than boxes containing text.
This package defines several \Verb+pic+ types:

\tikzset{
  every Penrose pic/.style={draw,ultra thick},
  every circle arc/.style={draw,thin},
  every long arc/.style={draw,thin},
}

\begin{itemize}
\item Kite \tikz[baseline=-.5ex] \pic[draw,kite];
\item Dart \tikz[baseline=-.5ex] \pic[draw,dart];
\item Thin Rhombus \tikz[baseline=-.5ex] \pic[draw,thin rhombus];
\item Thick Rhombus \tikz[baseline=-.5ex] \pic[draw,thick rhombus];
\item Pentagon \tikz[baseline=-.5ex] \pic[draw, pentagon 5];
(Actually, there are three pentagons: \Verb+pentagon 5+, \Verb+pentagon 3+, and \Verb+pentagon 2+.
The number signifies how many pentagons it goes next to.)
\item Pentagram \tikz[baseline=-.5ex] \pic[draw, pentagram];
\item Boat \tikz[baseline=-.5ex] \pic[draw, boat];
\item Diamond \tikz[baseline=-.5ex] \pic[draw, diamond];
\item Golden Triangle \tikz[baseline=-.5ex] \pic[draw,golden triangle];
\item Reverse Golden Triangle \tikz[baseline=-.5ex] \pic[draw,reverse golden triangle];
\item Golden Gnomon \tikz[baseline=-.5ex] \pic[draw,golden gnomon];
\item Reverse Golden Gnomon \tikz[baseline=-.5ex] \pic[draw,reverse golden gnomon];
\end{itemize}

The main tiles can have arcs drawn on them to illustrate the matching rules.
The triangles and gnomon are not true Penrose tiles but rather can be used to build tilings so they do not have the arcs.
The two types of each triangle and gnomon are actually different in that they have different matching rules.
This is best illustrated by deforming the paths (see Section~\ref{sec:pathdeform}).

There are two ways in TikZ to specify the \Verb+pic+ type: either as the ``contents'' of the pic or as the argument to the \Verb+pic type+ key.
Each of the tiles comes with a shorthand key which specifies the \Verb+pic type+ and also invokes the key \Verb+every Penrose tile+.
That is, the key \Verb+dart+ calls the \Verb+every Penrose tile+ key and specifies the \Verb+pic type+ as \Verb+dart+.

The tiles can be placed using standard TikZ methods.
One important thing to note is that by default, \Verb+pic+s are like \Verb+nodes+ in that they only respond to ambient translations, and not to rotations and scaling.
To make them notice this, use the key \Verb+transform shape+ or specify the transformation to the \Verb+pic+ directly.
If the shortcut keys are used to specify the tiles, this can be put in the \Verb+every Penrose pic+ style.

TikZ \Verb+pic+s can be named, using the \Verb+name=&lt;name&gt;+ key.
When a Penrose tile has been named then it can be used for positioning other tiles.
Each edge is assigned a label from \Verb+a b c d e A B C D E+ and a new tile can be aligned with an old one along a matching edge (\Verb+a+ matches with \Verb+A+ and so on).

The edge labels are as follows.
For the \Verb+pentagon 5+, for example, the edges are all the same and the numbers are used to distinguish between them.

\foreach \tile/\edges in {
  kite/{a,A,c,C},
  dart/{a,A,c,C},
  thin rhombus/{a,A,b,B},
  thick rhombus/{a,A,b,B},
  pentagon 5/{a1,a2,a3,a4,a5},
  pentagon 3/{A,b1,a1,a2,b2},
  pentagon 2/{d,A1,c1,c2,A2},
  pentagram/{C1,C2,C3,C4,C5,C6,C7,C8,C9,C10},
  boat/{C1,C2,C3,C4,B1,D,B2},
  diamond/{D1,B1,B2,D2},
  golden triangle/{a,b,c},
  reverse golden triangle/{A,B,C},
  golden gnomon/{A,b,C},
  reverse golden gnomon/{a,B,c}} {

\begin{tikzpicture}
\pic[draw,\tile,name=tile];
\foreach \e in \edges {
    \path (tile-edge \e\space start) -- node {\e} (tile-edge \e\space end);
}
\end{tikzpicture}

}

To align a tile with an existing one, use the following key:
%
\begin{verbatim}
align with=&lt;tile&gt; along &lt;edge&gt;
\end{verbatim}
%
where \Verb+&lt;tile&gt;+ is the name given to an existing tile, and \Verb+&lt;edge&gt;+ is the label on the existing tile.
If the tile being placed has edges that are identical (for example, \Verb+pentagon 5+), this syntax extends to
%
\begin{verbatim}
align with=&lt;tile&gt; along &lt;edge&gt; using &lt;number&gt;
\end{verbatim}
%
to specify which of the edges on the new tile to use.

\begin{example}
\begin{tikzpicture}
\pic[kite,name=tile];
\pic[dart,align with=tile along c];
\pic[pentagon 5,name=ptile,at={(3,0)}];
\pic[pentagon 3,align with=ptile along a1 using 2];
\end{tikzpicture}
\end{example}

With judicious use of loops, quite complicated pictures can be rendered using simple code.
(Note that the \Verb+transform shape+ is \emph{not} needed to apply the transformations needed to place a tile using this syntax.)

\begin{example}
\begin{tikzpicture}[
  every rhombus/.style={
    draw=black,
    ultra thick,
  },
  every thin rhombus/.style={
    every rhombus/.try,
    fill=thinRhombus,
  },
  every thick rhombus/.style={
    every rhombus/.try,
    fill=thickRhombus,
  },
  every circle arc/.style={
    draw=circleArc
  },
  every long arc/.style={
    draw=longArc
  }
]
\pic[rotate=18,thick rhombus,name=a0];
\foreach[evaluate=\k as \kmo using int(\k-1)] \k in {1,...,4} 
{
  \pic[thick rhombus,name=a\k,align with={a\kmo} along A];
}
\foreach \k in {0,...,4} 
{
  \pic[thin rhombus,name=b\k,align with={a\k} along B];
  \pic[thick rhombus,name=c\k,align with={b\k} along A];
  \pic[thick rhombus,name=d\k,align with={b\k} along a];
  \pic[thick rhombus,name=e\k,align with={c\k} along A];
  \foreach \l/\a in {{0/b},{1/B}}
    \pic[thin rhombus,name=f\k\l,align with={e\k} along \a];
}
\pic[thin rhombus,name=g0,align with={f10} along a];
\pic[thin rhombus,name=g1,align with={f21} along A];
\foreach \l/\a in {{0/a},{1/A}}
  \pic[thick rhombus,name=h\l,align with={g\l} along \a];
\pic[thick rhombus,name=i,align with=g0 along B];
\foreach \l/\a in {{0/a},{1/A}}
  \pic[thick rhombus,name=j\l,align with=i along \a];
\end{tikzpicture}
\end{example}

The tiles can be styled, either directly or using various keys.
Each tile has the following styles applied (in this order):
%
\begin{enumerate}
\item \Verb+every Penrose Tile+
\item \Verb+every &lt;name&gt;+
\item \Verb+pic actions+
\end{enumerate}
%
The \Verb+pic actions+ are any actions given directly to the tile, as in \Verb+\pic[draw,thin rhombus];+.
The kite, dart, and rhombus tiles also have arcs drawn on them and these are styled as \Verb+every circle arc+ and \Verb+every long arc+.
The names come from the way the arcs look on the rhombus shapes.

One other point is important to note about the tiles.
They are actually clipped against themselves.
This ensures that the tiles do not overstep their bounds and so when placed alongside each other then they do not go over each other.
In practical terms, this means that if drawn then the line width is half that which might be expected (but when placed next to another tile, the two halves combine to the expected width).

\subsection{Placing Tiles Automatically}

There is a way to specify a Penrose tiling using \emph{Lindenmayer systems}.
In brief, this takes a golden triangle or gnomon (or one of the reverse ones) and repeatedly decomposes it into smaller triangles and gnomon.
Once a desired level has been reached, the resulting triangles and gnomon are glued together in pairs to create either darts and kites or rhombuses (of both types).
This library contains an implementation of this for each of the tilings.

The user command is:
%
\begin{verbatim}
\PenroseDecomposition{&lt;type&gt;}{&lt;level&gt;}{&lt;seed&gt;}
\end{verbatim}
%
where \Verb+&lt;type&gt;+ is one of:
%
\begin{itemize}
\item \Verb+kite+ for the kite and dart tiling,
\item \Verb+rhombus+ for the rhombus tiling,
\item \Verb+pentagon+ for the pentagon tiling.
\item \Verb+ktriangle+ for the triangular decomposition used to form the kite and dart tiling but with the individual triangles
\item \Verb+rtriangle+ for the triangular decomposition used to form the rhombus tiling but with the individual triangles.
\end{itemize}

The \Verb+&lt;seed&gt;+ is a ``word'' that will be used to initiate the Lindenmayer system.
The key letters in the alphabet for the kite/darts and rhombuses are \Verb+T+, \Verb+t+, \Verb+G+, and \Verb+g+.
These actually correspond to the two triangles and two gnomons.
For the pentagons, the key letters are \Verb+P+, \Verb+Q+, \Verb+R+, \Verb+G+, \Verb+B+, \Verb+D+.
These correspond to the three pentagons, the pentagram, the boat, and the diamond.
Other permitted letters are \Verb+[+, \Verb+]+, \Verb+s+, \Verb+f+, \Verb!+!, \Verb+*+, \Verb+-+, \Verb+_+, \Verb+&gt;+.
These refer to various transformations (for details, see the implementation).

The \Verb+&lt;level&gt;+ controls how far to take the iteration.
The code is not particularly optimised for speed, and once \Verb+&lt;level&gt;+ gets to about \(5\) or \(6\) then we are at the ``make a cup of tea while compiling'' stage, depending on the processor.

\begin{example}
\begin{tikzpicture}[
  every Penrose tile/.style={draw},
  Penrose step=2cm,
]
\PenroseDecomposition{kite}{0}{T}
\end{tikzpicture}
\end{example}

The same styling keys as for the \Verb+pic+ tiles apply, together with some additional ones.
These allow styling the tiles by their number: a count is kept of the number of tiles and each tile knows its own number.
Specifically, two keys are tried:
%
\begin{enumerate}
\item \Verb+Penrose tile &lt;number&gt;+, and
\item \Verb+Penrose tile={&lt;number&gt;}{&lt;total&gt;}+
\end{enumerate}
%
A word of warning is in order on the second of these.
The \Verb+&lt;total&gt;+ is not guaranteed to be correct.
It is done by a quick count at the start of the process and counts those letters which \emph{might} result in a rendered tile.
Not every letter in the resulting word actually does.
Nevertheless, this can be used to style a tile based on what proportion of tiles have been rendered.

Lastly, \Verb+Penrose step+ is used to control the size of the resulting picture.

\begin{example}
\begin{tikzpicture}[
  every Penrose tile/.style={draw},
  Penrose step=4cm,
  Penrose tile/.code 2 args={
    \pgfmathsetmacro\tint{100*#1/#2}
    \pgfkeysalso{fill=black!\tint}
  }
]
\PenroseDecomposition{rhombus}{3}{T}
\end{tikzpicture}
\end{example}

\section{Deforming Paths}
\label{sec:pathdeform}

This package provides the ability to deform the various tiles.
The various tiles can be built from four paths (labelled \Verb+a+, \Verb+b+, \Verb+c+, and \Verb+d+) together with their reverses.
By changing these paths, one can get a wide variety of different tiles with the same fundamental matching rules.
Indeed, by using asymmetric paths, the matching rules can be enforced without the need for additional decoration.

Internally, the \Verb+penrose+ library uses the \Verb+spath3+ package for storing and manipulating the paths.

To create a new edge path, use the key \Verb+save Penrose path=&lt;edge&gt;+ where \Verb+&lt;edge&gt;+ is a symbol used in the edge description of a tile.
There are no constraints on the size of the path as all paths are scaled and transformed to fit the tiles.
Once the edge paths have been specified, they are welded together into the tiles using the following command:
%
\begin{verbatim}
\BakePenroseTile{&lt;name&gt;}
\end{verbatim}
%
Here, \Verb+&lt;name&gt;+ is one of the names of the tiles.
This has global effect, as does the definition of the edge paths.
Paths, both sides and tiles, can be cloned via:
%
\begin{verbatim}
\tikzset{clone Penrose side path={target}{source}
\tikzset{clone Penrose tile path={target}{source}
\end{verbatim}
%
and restored with the same command (but names switched).

The initial version of this package used \Verb!\MakePenroseTile! for this command.
That command is still available for backwards compatibility.

\begin{example}
\begin{tikzpicture}
\pic[draw,dart,name=dart];
\pic[draw,kite,align with=dart along c];
\pic[draw,kite,align with=dart along C];
\tikzset{clone Penrose tile path={original kite}{kite}}
\tikzset{clone Penrose tile path={original dart}{dart}}
\path[save Penrose path=a] (0,0) to[out=-30,in=100] (1,0);
\path[save Penrose path=c] (0,0) to[out=-40,in=140] (1,0);
\BakePenroseTile{kite}
\BakePenroseTile{dart}
\pic[xshift=2cm,draw,dart,name=dart];
\pic[draw,kite,align with=dart along c];
\pic[draw,kite,align with=dart along C];
\tikzset{clone Penrose tile path={kite}{original kite}}
\tikzset{clone Penrose tile path={dart}{original dart}}
\pic[xshift=4cm,draw,dart,name=dart];
\pic[draw,kite,align with=dart along c];
\pic[draw,kite,align with=dart along C];
\end{tikzpicture}
\end{example}

With deformed tiles, there is no guarantee that the inner arcs will match up perfectly.

\section{Defining New Tiles}

This package includes the capability to define new tiles.
The command to do this is:
%
\begin{verbatim}
\DefineTile{&lt;name&gt;}{&lt;sides&gt;}{&lt;coordinates&gt;}
\end{verbatim}
%
For example,
%
\begin{verbatim}
\DefineTile {square}{a A a A}
{
  {0,0}
  {1,0}
  {1,1}
  {0,1}
}
\end{verbatim}
%
The \Verb!&lt;sides&gt;! is a list of sides for matching rules.
Each letter used matches against its opposite case (so it is possible to create a side that matches against itself by using a symbol that \TeX\ regards as having the same upper as lower case; not all symbols work, I've used \Verb+!+ successfully).
These are also used in path replacing, both a letter and its opposite case are replaced by the corresponding path (but in opposite directions) when the tile is ``baked''.
The coordinates are passed to the \Verb!fp! module of \LaTeX3 so can involve complicated expressions.
Note that the trigonometric functions for angles in degrees are \Verb!cosd!, \Verb!sind!, and \Verb!tand!.

Note that the tile must be baked via the command \Verb!\BakePenroseTile! before it can be used.

The new tile can be used with all the same features as the pre-defined Penrose tiles, except for the Lindenmayer systems. 

\begin{example}
\DefineTile {square}{a A a A}
{
  {0,0}
  {1,0}
  {1,1}
  {0,1}
}

\begin{tikzpicture}
\path[save Penrose path=a] (0,0) to[out=45,in=135] (1,0);
\BakePenroseTile{square}
\pic[square,name=A,fill=green];
\pic[square,align with=A along a1 using 2,name=B,fill=red];
\pic[square,align with=A along A1 using 2,fill=red];
\pic[square,align with=A along A2 using 1,fill=red];
\pic[square,align with=B along a1 using 2,fill=green];
\pic[square,align with=B along a2 using 1,fill=green];
\end{tikzpicture}
\end{example}

\section{More Examples}

Let's set some aesthetically pleasing shapes.

\begin{justexample}
\begin{tikzpicture}
\path[save Penrose path=a] (0,0) to[out=-30,in=100] (1,0);
\path[save Penrose path=b] (0,0) to[out=0,in=140] (1,0);
\path[save Penrose path=c] (0,0) to[out=-40,in=140] (1,0);
\BakePenroseTile{thin rhombus}
\BakePenroseTile{thick rhombus}
\BakePenroseTile{golden triangle}
\BakePenroseTile{reverse golden triangle}
\BakePenroseTile{golden gnomon}
\BakePenroseTile{reverse golden gnomon}
\BakePenroseTile{kite}
\BakePenroseTile{dart}
\end{tikzpicture}
\end{justexample}

\begin{tikzpicture}
\path[save Penrose path=a] (0,0) to[out=-30,in=100] (1,0);
\path[save Penrose path=b] (0,0) to[out=0,in=140] (1,0);
\path[save Penrose path=c] (0,0) to[out=-40,in=140] (1,0);
\BakePenroseTile{thin rhombus}
\BakePenroseTile{thick rhombus}
\BakePenroseTile{golden triangle}
\BakePenroseTile{reverse golden triangle}
\BakePenroseTile{golden gnomon}
\BakePenroseTile{reverse golden gnomon}
\BakePenroseTile{kite}
\BakePenroseTile{dart}
\end{tikzpicture}


Styling the first tile.
Note that as the pattern is formed by repeating two different initial seeds \(5\) times, there are \(10\) ``first tiles'' in each overall pattern.

\begin{example}
\begin{tikzpicture}[
  every Penrose tile/.style={draw},
  Penrose tile 1/.style={fill=yellow},
]
\foreach \tp/\pos in {rhombus/0cm,rtriangle/2.5cm,kite/5cm,ktriangle/7.5cm}
{
\begin{scope}[xshift=\pos]
\foreach[evaluate=\k as \mk using {\k+Mod(\k,2)},evaluate=\k as \ax using {Mod(\k,2) == 0 ? "T" : "t"}] \k in {0,...,9} {
  \begin{scope}[rotate=\mk*36]
  \PenroseDecomposition{\tp}{1}{\ax}
  \end{scope}
}
\end{scope}
}
\end{tikzpicture}
\end{example}

A more detailed decomposition, with more and more tinting applied to teach tile.
Roughly half of the counted tiles are rendered, and the ordering in which they are rendered is not at first an obvious one (though it is in general from ``outside in'').

Note that the key \Verb+tint fill colour+ is not a TikZ native.
It is defined as:

\begin{verbatim}
\makeatletter
\tikzset{
  tint fill colour/.code={%
    \edef\@temp{%
      \def\noexpand\tikz@fillcolor{\tikz@fillcolor!#1}%
      \noexpand\tikz@addoption{%
        \noexpand\pgfsetfillcolor{\tikz@fillcolor!#1}%
      }%
    }%
    \@temp
  }
}
\makeatother
\end{verbatim}

\begin{example}
\begin{tikzpicture}[
  every Penrose tile/.style={draw},
  every kite/.style={fill=reverseGoldenTriangle},
  every dart/.style={fill=goldenTriangle},
  Penrose tile/.code 2 args={
    \pgfmathsetmacro\tint{100*(1 - 1.5*#1/#2))}
    \pgfkeysalso{tint fill colour=\tint}
  }
]
\foreach[evaluate=\k as \mk using {\k+Mod(\k,2)},evaluate=\k as \ax using {Mod(\k,2) == 0 ? "T" : "t"}] \k in {0,...,9} {
  \begin{scope}[rotate=\mk*36]
  \PenroseDecomposition[Penrose step=5cm]{kite}{4}{\ax}
  \end{scope}
}
\end{tikzpicture}
\end{example}

An example with ``manual placement''.

\begin{example}
\begin{tikzpicture}[
  every Penrose pic/.style={
    draw=black,
    ultra thick,
  },
  every kite/.style={
    fill=kite,
  },
  every dart/.style={
    fill=dart,
  },
  every circle arc/.style={
    draw=circleArc
  },
  every long arc/.style={
    draw=longArc
  }
]
\pic[dart,name=a0];
\foreach[evaluate=\k as \kmo using int(\k-1)] \k in {1,...,4} {
  \pic[dart,name=a\k,align with={a\kmo} along a];
}
\foreach \k in {0,...,4} {
  \foreach \l/\e/\ee in {0/c/a,1/C/A} {
    \pic[kite,name=b\l\k,align with={a\k} along \e];
    \pic[dart,name=c\l\k,align with={b\l\k} along \ee];
    \pic[kite,name=d\l\k,align with={c\l\k} along \e];
  }
  \pic[kite,name=e\k,align with={c0\k} along C];
  \pic[dart,name=f\k,align with={c0\k} along a];
  \foreach \e in {c,C} {
    \pic[kite,name=g\k,align with={f\k} along \e];
  }
}
\end{tikzpicture}
\end{example}


The decomposition rules for the Lindenmayer system can be illustrated by drawing each tile together with the result of one decomposition superimposed on top.

\begin{example}
\foreach \ax in {T,t,G,g} {

\begin{tikzpicture}
\foreach \tp/\pos in {rhombus/0cm,rtriangle/2cm,kite/4cm,ktriangle/6cm}
{
\begin{scope}[xshift=\pos]
  \PenroseDecomposition[every path/.style={draw=red,ultra thick}]{\tp}{0}{\ax}
  \PenroseDecomposition[every path/.style={fill=gray!50,fill opacity=.5,draw=black}]{\tp}{1}{\ax}
\end{scope}
}
\end{tikzpicture}

}
\end{example}

The tiles can make interesting forms by themselves.

\begin{example}
\begin{tikzpicture}[
  scale=2,
  every Penrose pic/.style={
    transform shape,
  },
  every golden triangle/.style={
    draw=black,
    ultra thick,
    fill=goldenTriangle,
  },
  every reverse golden triangle/.style={
    draw=black,
    ultra thick,
    fill=reverseGoldenTriangle,
  },
  every golden gnomon/.style={
    draw=black,
    ultra thick,
    fill=goldenGnomon,
  },
  every reverse golden gnomon/.style={
    draw=black,
    ultra thick,
    fill=reverseGoldenGnomon,
  },
]
\pic[golden triangle,name=a];
\pic[reverse golden triangle,align with=a along a];
\pic[reverse golden triangle,align with=a along b];
\pic[reverse golden triangle,align with=a along c];
\begin{scope}[xshift=2cm]
\pic[reverse golden triangle,name=a];
\pic[golden triangle,align with=a along A];
\pic[golden triangle,align with=a along B];
\pic[golden triangle,align with=a along C];
\end{scope}
\begin{scope}[yshift=-3cm]
\pic[golden gnomon,name=a];
\pic[reverse golden gnomon,align with=a along C];
\pic[reverse golden gnomon,align with=a along b];
\pic[reverse golden gnomon,align with=a along A];
\begin{scope}[xshift=2cm]
\pic[reverse golden gnomon,name=a];
\pic[golden gnomon,align with=a along c];
\pic[golden gnomon,align with=a along B];
\pic[golden gnomon,align with=a along a];
\end{scope}
\end{scope}
\end{tikzpicture}
\end{example}

\begin{example}
\begin{tikzpicture}[
  every rhombus/.style={
    draw=black,
    ultra thick,
  },
  every thin rhombus/.style={
    every rhombus/.try,
    fill=thinRhombus,
  },
  every thick rhombus/.style={
    every rhombus/.try,
    fill=thickRhombus,
  },
  every circle arc/.style={
    draw=circleArc
  },
  every long arc/.style={
    draw=longArc
  }
]
\pic[rotate=18,thick rhombus,name=a0];
\foreach[evaluate=\k as \kmo using int(\k-1)] \k in {1,...,4} 
{
  \pic[thick rhombus,name=a\k,align with={a\kmo} along A];
}
\foreach \k in {0,...,4} 
{
  \pic[thin rhombus,name=b\k,align with={a\k} along B];
  \pic[thick rhombus,name=c\k,align with={b\k} along A];
  \pic[thick rhombus,name=d\k,align with={b\k} along a];
  \pic[thick rhombus,name=e\k,align with={c\k} along A];
  \foreach \l/\a in {{0/b},{1/B}}
    \pic[thin rhombus,name=f\k\l,align with={e\k} along \a];
}
\pic[thin rhombus,name=g0,align with={f10} along a];
\pic[thin rhombus,name=g1,align with={f21} along A];
\foreach \l/\a in {{0/a},{1/A}}
  \pic[thick rhombus,name=h\l,align with={g\l} along \a];
\pic[thick rhombus,name=i,align with=g0 along B];
\foreach \l/\a in {{0/a},{1/A}}
  \pic[thick rhombus,name=j\l,align with=i along \a];
\end{tikzpicture}
\end{example}

Lastly, here's an example that generates full page patterns.

\begin{justexample}
\foreach \tp/\lvl in {rhombus/5,rhombus/6,kite/5,kite/6}
{
\begin{tikzpicture}[
  every Penrose tile/.style={draw},
  remember picture,
  overlay,
  scale=20
]
\coordinate (a) at (current page.center);
\begin{scope}[shift={(a)}]
\foreach[evaluate=\k as \mk using {\k+Mod(\k,2)},evaluate=\k as \ax using {Mod(\k,2) == 0 ? "T" : "t"}] \k in {0,...,9} {
  \begin{scope}[rotate=\mk*36]
  \PenroseDecomposition{\tp}{\lvl}{\ax}
  \end{scope}
}
\end{scope}
\end{tikzpicture}
\newpage
}
\end{justexample}

\begin{tikzpicture}
\path[save Penrose path=a] (0,0) -- (1,0);
\path[save Penrose path=b] (0,0) -- (1,0);
\path[save Penrose path=c] (0,0) -- (1,0);
\BakePenroseTile{thin rhombus}
\BakePenroseTile{thick rhombus}
\BakePenroseTile{golden triangle}
\BakePenroseTile{reverse golden triangle}
\BakePenroseTile{golden gnomon}
\BakePenroseTile{reverse golden gnomon}
\BakePenroseTile{kite}
\BakePenroseTile{dart}
\end{tikzpicture}

\newpage

\foreach \tp/\lvl in {rhombus/5,rhombus/6,kite/5,kite/6}
{
\begin{tikzpicture}[
  every Penrose tile/.style={draw},
  remember picture,
  overlay,
  scale=20
]
\coordinate (a) at (current page.center);
\begin{scope}[shift={(a)}]
\foreach[evaluate=\k as \mk using {\k+Mod(\k,2)},evaluate=\k as \ax using {Mod(\k,2) == 0 ? "T" : "t"}] \k in {0,...,9} {
  \begin{scope}[rotate=\mk*36]
  \PenroseDecomposition{\tp}{\lvl}{\ax}
  \end{scope}
}
\end{scope}
\end{tikzpicture}
\newpage
}


%% \foreach \lvl in {5,6}
%% {
%% \begin{tikzpicture}[
%%   every Penrose tile/.style={draw},
%%   remember picture,
%%   overlay,
%%   scale=180
%% ]
%% \coordinate (a) at (current page.center);
%%   \PenroseDecomposition{pentagon}{\lvl}{D}
%% \end{tikzpicture}
%% \newpage
%% }


\end{document}

% Local Variables:
% tex-output-type: "pdf18"
% End:
</pre></body></html>