64

First of all: don't forget that exactly 140 years ago, Albert Einstein was born; but exactly one year ago, Stephen William Hawking passed away. What a special day for science!


Question

How to draw the letter π not in the standard way (i.e. \pi)?

I mean "draw", not "type"! Today there will be no \pi, but there will be something like this

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (0,2)--(3,2);
\draw (1,0)--(1,2);
\draw (2,0)--(2,2);
\end{tikzpicture}
\end{document}

enter image description here

(inspired by David Carlisle – I draw this in TikZ just because I don't know how to use picture ;))

Or this

\documentclass[tikz]{standalone}
\usepackage{tikzducks}
\begin{document}
\begin{tikzpicture}
\duck
\duck[xshift=1cm,yshift=2cm]
\duck[xshift=1cm,yshift=4cm]
\duck[xshift=1cm,yshift=6cm]
\duck[xshift=0cm,yshift=8cm]
\duck[xshift=-2cm,yshift=7.5cm]
\duck[xshift=2cm,yshift=8cm]
\duck[xshift=4cm,yshift=8cm]
\duck[xshift=6cm,yshift=8cm]
\duck[xshift=8cm,yshift=8cm]
\duck[xshift=5cm,yshift=6cm]
\duck[xshift=5cm,yshift=4cm]
\duck[xshift=5.5cm,yshift=2cm]
\duck[xshift=6.5cm,yshift=0cm]
\duck[xshift=8cm,yshift=1cm]
\node[font=\huge] at (4,11) {Happy $\pi$ day with \verb|tikzducks|!};
\end{tikzpicture}
\end{document}

enter image description here

They are my proudest π drawings, and as today is Pi day, I'd like to see yours!


Well, why didn't I delay the time of asking the question by 8 minutes? I asked this at 1:51:31 UTC time, and the "Pi second" of this year is at 1:59:26 today!

  • 11
    Beat this one: ioccc.org/1989/roemer.c – user49915 Mar 14 at 2:55
  • @user49915 I don't think we can have the output and the code being exactly the same :)) – JouleV Mar 14 at 3:04
  • Though, I guess, a really useful one would be a sans-serif normalfont upright math capital Pi with xelatex and OTF fonts. You may ask "why", and the answer would be "since it's not a part of Unicode". As for for useless ones, I still see documentclass, begin, draw, tikz, linespread, ...; the output is all nice anyway, and I like all the solutions here. – user49915 Mar 14 at 3:05
  • You can probably have the code and the output close enough; you only have to pepper the Makefile compiling the code by suitable awk or sed scripts. In theory, you can have them exactly the same, since tex is Turing-complete (en.wikipedia.org/wiki/Quine_(computing)), but it's unlikely to print Pi in any sense of the word. – user49915 Mar 14 at 3:10
  • 1
    @JouleV your question and all the answers are wonderful. :-) – Sebastiano Mar 14 at 12:55

22 Answers 22

81

Here's one with \shapepar, with great thanks to flowframtk.

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{libertine}
\usepackage{shapepar}

\newcommand{\sep}{\discretionary{}{}{}}

\begin{document}

\small%
\shapepar[1.00375pt]{{137.821777}%
{0.0}b{27.0}%
\\{0.0}t{27.0}{249.0}%
\\{11.955168}t{14.0}{250.0}%
\\{23.910336}t{2.0}{249.0}%
\\{27.074219}t{0.0}{135.5}st{135.5}{111.5}%
\\{35.865504}t{57.0}{35.0}t{179.0}{35.0}%
\\{47.820672}t{56.0}{34.0}t{178.0}{34.0}%
\\{59.775841}t{55.0}{34.0}t{177.0}{34.0}%
\\{71.731009}t{53.0}{35.0}t{175.0}{35.0}%
\\{83.686177}t{52.0}{34.0}t{174.0}{34.0}%
\\{95.641345}t{51.0}{34.0}t{173.0}{34.0}%
\\{107.596513}t{49.0}{35.0}t{171.0}{35.0}%
\\{119.551681}t{48.0}{34.0}t{170.0}{34.0}%
\\{131.506849}t{47.0}{34.0}t{169.0}{34.0}%
\\{135.137695}t{46.0}{35.0}t{168.0}{35.0}%
\\{143.462017}t{45.0}{35.0}t{168.0}{34.0}%
\\{154.276367}t{44.0}{34.0}t{166.0}{35.0}%
\\{155.417186}t{44.0}{34.0}t{166.0}{35.0}%
\\{163.378906}t{43.0}{34.0}t{166.0}{34.0}%
\\{167.372354}t{43.0}{34.0}t{165.0}{35.0}t{256.0}{3.0}%
\\{171.936859}t{42.0}{34.0}t{165.0}{35.0}t{253.0}{8.0}%
\\{179.327522}t{41.0}{35.0}t{165.0}{35.0}t{248.0}{13.0}%
\\{182.050781}t{41.0}{34.0}t{165.0}{36.0}t{245.0}{15.0}%
\\{187.185547}t{40.0}{35.0}t{166.0}{36.0}t{240.0}{17.0}%
\\{191.28269}t{40.0}{34.0}t{166.0}{39.0}t{235.0}{19.0}%
\\{193.214996}t{40.0}{34.0}t{166.0}{40.0}t{232.0}{20.0}%
\\{197.688477}t{39.0}{35.0}t{167.0}{50.0}jt{217.0}{31.0}%
\\{198.388672}t{39.0}{35.0}t{167.0}{80.0}%
\\{203.237858}t{39.0}{34.0}t{169.0}{72.0}%
\\{207.880219}t{38.0}{34.0}t{171.0}{64.0}%
\\{207.958008}t{38.0}{34.0}t{171.0}{64.0}%
\\{215.193026}t{37.0}{19.0}t{175.0}{49.0}%
\\{215.660156}t{37.0}{18.0}t{176.0}{47.0}%
\\{222.195312}t{37.0}{2.0}t{186.0}{23.0}%
\\{222.195312}e{37.0}%
\\{223.362305}t{191.0}{13.0}%
\\{223.362305}e{191.0}%
}%
3\sep{}.\sep{}1\sep{}4\sep{}1\sep{}5\sep{}9\sep{}2\sep{}6\sep{}5\sep{}3\sep{}5\sep{}8\sep{}9\sep{}7\sep{}9\sep{}3\sep{}2\sep{}3\sep{}8\sep{}4\sep{}6\sep{}2\sep{}6\sep{}4\sep{}3\sep{}3\sep{}8\sep{}3\sep{}2\sep{}7\sep{}9\sep{}5\sep{}0\sep{}2\sep{}8\sep{}8\sep{}4\sep{}1\sep{}9\sep{}7\sep{}1\sep{}6\sep{}9\sep{}3\sep{}9\sep{}9\sep{}3\sep{}7\sep{}5\sep{}1\sep{}0\sep{}5\sep{}8\sep{}2\sep{}0\sep{}9\sep{}7\sep{}4\sep{}9\sep{}4\sep{}4\sep{}5\sep{}9\sep{}2\sep{}3\sep{}0\sep{}7\sep{}8\sep{}1\sep{}6\sep{}4\sep{}0\sep{}6\sep{}2\sep{}8\sep{}6\sep{}2\sep{}0\sep{}8\sep{}9\sep{}9\sep{}8\sep{}6\sep{}2\sep{}8\sep{}0\sep{}3\sep{}4\sep{}8\sep{}2\sep{}5\sep{}3\sep{}4\sep{}2\sep{}1\sep{}1\sep{}7\sep{}0\sep{}6\sep{}7\sep{}9\sep{}8\sep{}2\sep{}1\sep{}4\sep{}8\sep{}0\sep{}8\sep{}6\sep{}5\sep{}1\sep{}3\sep{}2\sep{}8\sep{}2\sep{}3\sep{}0\sep{}6\sep{}6\sep{}4\sep{}7\sep{}0\sep{}9\sep{}3\sep{}8\sep{}4\sep{}4\sep{}6\sep{}0\sep{}9\sep{}5\sep{}5\sep{}0\sep{}5\sep{}8\sep{}2\sep{}2\sep{}3\sep{}1\sep{}7\sep{}2\sep{}5\sep{}3\sep{}5\sep{}9\sep{}4\sep{}0\sep{}8\sep{}1\sep{}2\sep{}8\sep{}4\sep{}8\sep{}1\sep{}1\sep{}1\sep{}7\sep{}4\sep{}5\sep{}0\sep{}2\sep{}8\sep{}4\sep{}1\sep{}0\sep{}2\sep{}7\sep{}0\sep{}1\sep{}9\sep{}3\sep{}8\sep{}5\sep{}2\sep{}1\sep{}1\sep{}0\sep{}5\sep{}5\sep{}5\sep{}9\sep{}6\sep{}4\sep{}4\sep{}6\sep{}2\sep{}2\sep{}9\sep{}4\sep{}8\sep{}9\sep{}5\sep{}4\sep{}9\sep{}3\sep{}0\sep{}3\sep{}8\sep{}1\sep{}9\sep{}6\sep{}4\sep{}4\sep{}2\sep{}8\sep{}8\sep{}1\sep{}0\sep{}9\sep{}7\sep{}5\sep{}6\sep{}6\sep{}5\sep{}9\sep{}3\sep{}3\sep{}4\sep{}4\sep{}6\sep{}1\sep{}2\sep{}8\sep{}4\sep{}7\sep{}5\sep{}6\sep{}4\sep{}8\sep{}2\sep{}3\sep{}3\sep{}7\sep{}8\sep{}6\sep{}7\sep{}8\sep{}3\sep{}1\sep{}6\sep{}5\sep{}2\sep{}7\sep{}1\sep{}2\sep{}0\sep{}1\sep{}9\sep{}0\sep{}9\sep{}1\sep{}4\sep{}5\sep{}6\sep{}4\sep{}8\sep{}5\sep{}6\sep{}6\sep{}9\sep{}2\sep{}3\sep{}4\sep{}6\sep{}0\sep{}3\sep{}4\sep{}8\sep{}6\sep{}1\sep{}0\sep{}4\sep{}5\sep{}4\sep{}3\sep{}2\sep{}6\sep{}6\sep{}4\sep{}8\sep{}2\sep{}1\sep{}3\sep{}3\sep{}9\sep{}3\sep{}6\sep{}0\sep{}7\sep{}2\sep{}6\sep{}0\sep{}2\sep{}4\sep{}9\sep{}1\sep{}4\sep{}1\sep{}2\sep{}7\sep{}3\sep{}7\sep{}2\sep{}4\sep{}5\sep{}8\sep{}7\sep{}0\sep{}0\sep{}6\sep{}6\sep{}0\sep{}6\sep{}3\sep{}1\sep{}5\sep{}5\sep{}8\sep{}8\sep{}1\sep{}7\sep{}4\sep{}8\sep{}8\sep{}1\sep{}5\sep{}2\sep{}0\sep{}9\sep{}2\sep{}0\sep{}9\sep{}6\sep{}2\sep{}8\sep{}2\sep{}9\sep{}2\sep{}5\sep{}4\sep{}0\sep{}9\sep{}1\sep{}7\sep{}1\sep{}5\sep{}3\sep{}6\sep{}4\sep{}3\sep{}6\sep{}7\sep{}8\sep{}9\sep{}2\sep{}5\sep{}9\sep{}0\sep{}3\sep{}6\sep{}0\sep{}0\sep{}1\sep{}1\sep{}3\sep{}3\sep{}0\sep{}5\sep{}3\sep{}0\sep{}5\sep{}4\sep{}8\sep{}8\sep{}2\sep{}0\sep{}4\sep{}6\sep{}6\sep{}5\sep{}2\sep{}1\sep{}3\sep{}8\sep{}4\sep{}1\sep{}4\sep{}6\sep{}9\sep{}5\sep{}1\sep{}9\sep{}4\sep{}1\sep{}5\sep{}1\sep{}1\sep{}6\sep{}0\sep{}9\sep{}4\sep{}3\sep{}3\sep{}0\sep{}5\sep{}7\sep{}2\sep{}7\sep{}0\sep{}3\sep{}6\sep{}5\sep{}7\sep{}5\sep{}9\sep{}5\sep{}9\sep{}1\sep{}9\sep{}5\sep{}3\sep{}0\sep{}9\sep{}2\sep{}1\sep{}8\sep{}6\sep{}1\sep{}1\sep{}7\sep{}3\sep{}8\sep{}1\sep{}9\sep{}3\sep{}2\sep{}6\sep{}1\sep{}1\sep{}7\sep{}9\sep{}3\sep{}1\sep{}0\sep{}5\sep{}1\sep{}1\sep{}8\sep{}5\sep{}4\sep{}8\sep{}0\sep{}7\sep{}4\sep{}4\sep{}6\sep{}2\sep{}3\sep{}7\sep{}9\sep{}9\sep{}6\sep{}2\sep{}7\sep{}4\sep{}9\sep{}5\sep{}6\sep{}7\sep{}3\sep{}5\sep{}1\sep{}8\sep{}8\sep{}5\sep{}7\sep{}5\sep{}2\sep{}7\sep{}2\sep{}4\sep{}8\sep{}9\sep{}1\sep{}2\sep{}2\sep{}7\sep{}9\sep{}3\sep{}8\sep{}1\sep{}8\sep{}3\sep{}0\sep{}1\sep{}1\sep{}9\sep{}4\sep{}9\sep{}1\sep{}2\sep{}9\sep{}8\sep{}3\sep{}3\sep{}6\sep{}7\sep{}3\sep{}3\sep{}6\sep{}2\sep{}4\sep{}4\sep{}0\sep{}6\sep{}5\sep{}6\sep{}6\sep{}4\sep{}3\sep{}0\sep{}8\sep{}6\sep{}0\sep{}2\sep{}1\sep{}3\sep{}9\sep{}4\sep{}9\sep{}4\sep{}6\sep{}3\sep{}9\sep{}5\sep{}2\sep{}2\sep{}4\sep{}7\sep{}3\sep{}7\sep{}1\sep{}9\sep{}0\sep{}7\sep{}0\sep{}2\sep{}1\sep{}7\sep{}9\sep{}8\sep{}6\sep{}0\sep{}9\sep{}4\sep{}3\sep{}7\sep{}0\sep{}2\sep{}7\sep{}7\sep{}0\sep{}5\sep{}3\sep{}9\sep{}2\sep{}1\sep{}7\sep{}1\sep{}7\sep{}6\sep{}2\sep{}9\sep{}3\sep{}1\sep{}7\sep{}6\sep{}7\sep{}5\sep{}2\sep{}3\sep{}8\sep{}4\sep{}6\sep{}7\sep{}4\sep{}8\sep{}1\sep{}8\sep{}4\sep{}6\sep{}7\sep{}6\sep{}6\sep{}9\sep{}4\sep{}0\sep{}5\sep{}1\sep{}3\sep{}2\sep{}0\sep{}0\sep{}0\sep{}5\sep{}6\sep{}8\sep{}1\sep{}2\sep{}7\sep{}1\sep{}4\sep{}5\sep{}2\sep{}6\sep{}3\sep{}5\sep{}6\sep{}0\sep{}8\sep{}2\sep{}7\sep{}7\par
\end{document}
  • Could you explain, how to create the proper coordinates? It would be interesting to learn, how to do it for other symbols too. – Jonas Stein Mar 14 at 14:28
  • @JonasStein I used flowframtk (linked above) ! Typed the π symbol via "Insert symbol" (bit.ly/2F5Rhahl); set the desired font size and family; convert to path; then export the \shapepar (bit.ly/2O4Lgib) – LianTze Lim Mar 14 at 16:24
  • @LianTzeLim Simply amazing. I see you are capped at 200 rep. Today there should not be that rep cap for you: this answer deserves more than 200 rep. – JouleV Mar 14 at 17:26
  • 1
    @JouleV That's what bounties are for. And you could save your upvote for later. – Revetahw Mar 16 at 7:07
42

Writing π with the digits of π - using the verbatim environment.

enter image description here

\documentclass{article}
\linespread{0.7}
\begin{document}
\begin{verbatim}
     3.141592653589793238462643383279
   5028841971693993751058209749445923
  07816406286208998628034825342117067
  9821    48086         5132     
 823      06647        09384
46        09550        58223
17        25359        4081
          2848         1117
          4502         8410
          2701         9385
         21105        55964
         46229        48954
         9303         81964
         4288         10975
        66593         34461
       284756         48233
       78678          31652        71
      2019091         456485       66
     9234603           48610454326648
    2133936            0726024914127
    3724587             00660631558
    817488               152092096
\end{verbatim}
\end{document}

Based on ascii art drawing by Jorel - https://www.flickr.com/photos/jorel314/3352784321/

  • How did you format the code? By trial/error? – Sigur Mar 14 at 2:49
  • Nice. Though, not quite: you simply draw it rather than computing it :-). – user49915 Mar 14 at 3:04
41

Some tessellated pi...

enter image description here

This one is done in plain Metapost, so compile with mpost.

prologues := 3;
outputtemplate := "%j%c.eps";
input colorbrewer-rgb;
beginfig(1);
    path pi; numeric t; t = 13;
    pi = (origin -- (5,0) -- (5,1) -- (4,1) -- (4,4) -- (3,4) -- (3,1) -- (2,1) -- (2,4) -- (1,4) -- (1,1) -- up -- cycle) scaled t;

    for i=1 upto 48:
        for j=1 upto 48:
            fill pi                              shifted (4t*i-2t*j, t*i+5t*j) withcolor Spectral[7][i mod 7 + 1];
            fill pi rotated 180 shifted (4t, 5t) shifted (4t*i-2t*j, t*i+5t*j) withcolor Spectral[7][(3+i) mod 7 + 1];
       endfor
    endfor
    clip currentpicture to unitsquare scaled 100t shifted (0, 32t);
endfig;
end.

You will need to load Metapost Colorbrewer for the colours...

  • 1
    Wonderful!!!! Very nice for my opinion. – Sebastiano Mar 14 at 16:28
39

For Pi day, the tikzlings decided to go on holidays. Unfortunately, the snowman could not come with them, so they sent him a postcard:

enter image description here

\documentclass{standalone}
\usepackage{tikz}
\usepackage{tikzlings}

\newcommand{\palm}{%
    \foreach \x in {1.2,1.15,...,0} {
        \pgfmathsetmacro{\y}{0.2*\x*(1-\x)};
        \pgfmathsetmacro{\len}{0.3-0.11*\x};
        \pgfmathsetmacro{\angup}{-50-30*\x)};
        \pgfmathsetmacro{\angdown}{20+30*\x)};
        \fill[bottom color=green!80!black,top color=green!0!brown,shift={(\x,\y)},rotate=\angup] (0,0) -- (0.05,0) -- (0.025+0.015*rnd,\len+0.03*rnd) -- cycle;
        \fill[top color=green!80!black,bottom color=green!0!brown,shift={(\x,\y)},rotate=\angdown] (0,0) -- (0.05,0) -- (0.025+0.015*rnd,-\len+0.03*rnd) -- cycle;
    }
}
\newcommand{\palmtree}{%
    \foreach \y in {0,0.05,...,2} {
        \fill[inner color=brown!40!yellow,outer color=brown] (0.1*\y*\y,\y) ellipse({0.2-0.015*\y} and 0.1);
    }
    \foreach \angle in {-20,-10,0} {
        \begin{scope}[shift={(0.3,2)},rotate=\angle]
            \palm
        \end{scope}
        \begin{scope}[shift={(0.5,2)},rotate=-\angle,xscale=-1]
            \palm
        \end{scope}
    }
}

\begin{document}

\begin{tikzpicture}
    \pgfmathsetseed{1}
    \begin{scope}[shift={(0.7,0)}]
        \palmtree
    \end{scope}
    \begin{scope}[shift={(-0.7,0)},xscale=-1]
        \palmtree
    \end{scope}
    \bear[hat,xshift=-1.6cm,yshift=1.9cm,scale=0.25];
    \coati[tophat,xshift=-1.2cm,yshift=1.9cm,scale=0.25];
    \koala[beret,xshift=-0.8cm,yshift=1.9cm,scale=0.25];
    \marmot[strawhat,xshift=-0.4cm,yshift=1.9cm,scale=0.25];
    \moles[harlequin,xshift=-0.0cm,yshift=1.9cm,scale=0.25];
    \mouse[strawhat=blue,xshift=0.4cm,yshift=1.9cm,scale=0.25];
    \owl[beret=green!50!black,xshift=0.8cm,yshift=1.9cm,scale=0.25];
    \penguin[tophat=red,xshift=1.2cm,yshift=1.9cm,scale=0.25];
    \sloth[hat=brown!40!yellow,xshift=1.6cm,yshift=1.9cm,scale=0.25];
\end{tikzpicture}

\end{document}
  • 2
    I love this answer! – CarLaTeX Mar 14 at 18:32
35

We could extract the MetaPost paths for the glyph \pi from the font and draw it using LuaTeX.

\documentclass{article}

\usepackage{fontspec}
\setmainfont{latinmodern-math.otf}

\usepackage{luacode}
\begin{luacode*}
-- We need some utilities from ConTeXt
callbacks = callbacks or {}
callbacks.supported = callbacks.supported or {}
CONTEXTLMTXMODE = CONTEXTLMTXMODE or (status.obj_ptr == nil and 2 or 1)
dofile(kpse.find_file("util-fmt.lua"))
dofile(kpse.find_file("node-ini.lua"))
dofile(kpse.find_file("font-mps.lua"))
dofile(kpse.find_file("font-shp.lua"))

-- That's a simple reimplemetation of ConTeXt's \showshape macro
function outlinepaths(character)
    local fontid      = font.current()
    local shapedata   = fonts.hashes.shapes[fontid] -- by index
    local chardata    = fonts.hashes.characters[fontid] -- by unicode
    local shapeglyphs = shapedata.glyphs or { }

    character = utf.byte(character)
    local c = chardata[character]
    if c then
        if not c.index then
            return {}
        end
        local glyph = shapeglyphs[c.index]
        if glyph and (glyph.segments or glyph.sequence) then
            local units  = shapedata.units or 1000
            local factor = 100/units
            local paths  = fonts.metapost.paths(glyph,factor)
            return paths
        end
    end
end
\end{luacode*}

\usepackage{luamplib}
\everymplib{beginfig(0);}
\everyendmplib{endfig;}

\def\mpdefineoutlines#1{\directlua{
    local char = "\luaescapestring{#1}"
    local outlines = outlinepaths("#1")
    for i, path in ipairs(outlines) do
        tex.print("fill " .. path .. ";")
    end
  }}

\begin{document} 

\begin{mplibcode}

  \mpdefineoutlines{𝜋}

\end{mplibcode}

\end{document}

Instead of using luamplib, we could also simply print the path to the log file and copy it to a MetaPost file. With some additonal formatting we get:

prologues := 3;
outputformat := "pdf";

beginfig(1)
  fill (56.70,40.70)
    .. controls (56.70,43.10) and (54.60,43.10)
    .. (52.70,43.10)
    -- (19.20,43.10)
    .. controls (17,43.10) and (13.20,43.10)
    .. (8.80,38.40)
    .. controls (5.30,34.50) and (2.70,29.90)
    .. (2.70,29.40)
    .. controls (2.70,29.40) and (2.70,28.40)
    .. (3.90,28.40)
    .. controls (4.70,28.40) and (4.90,28.80)
    .. (5.50,29.60)
    .. controls (10.40,37.30) and (16.20,37.30)
    .. (18.20,37.30)
    -- (23.90,37.30)
    .. controls (20.70,25.20) and (15.30,13.10)
    .. (11.10,4)
    .. controls (10.30,2.50) and (10.30,2.30)
    .. (10.30,1.60)
    .. controls (10.30,-0.30) and (11.90,-1.10)
    .. (13.20,-1.10)
    .. controls (16.20,-1.10) and (17,1.70)
    .. (18.20,5.40)
    .. controls (19.60,10) and (19.60,10.20)
    .. (20.90,15.20)
    -- (26.50,37.30)
    -- (37.80,37.30)
    .. controls (34.50,22.50) and (33.60,18.20)
    .. (33.60,11.50)
    .. controls (33.60,10) and (33.60,7.30)
    .. (34.40,3.90)
    .. controls (35.40,-0.50) and (36.50,-1.10)
    .. (38,-1.10)
    .. controls (40,-1.10) and (42.10,0.70)
    .. (42.10,2.70)
    .. controls (42.10,3.30) and (42.10,3.50)
    .. (41.50,4.90)
    .. controls (38.60,12.10) and (38.60,18.60)
    .. (38.60,21.40)
    .. controls (38.60,26.70) and (39.30,32.10)
    .. (40.40,37.30)
    -- (51.80,37.30)
    .. controls (53.10,37.30) and (56.70,37.30)
    .. (56.70,40.70)
    -- cycle;
endfig;
end

Or you can even use the path with TikZ.

\documentclass{article}

\usepackage{tikz}

\begin{document} 

\begin{tikzpicture}[x=1pt,y=1pt]

  \fill (56.70,40.70)
    .. controls (56.70,43.10) and (54.60,43.10)
    .. (52.70,43.10)
    -- (19.20,43.10)
    .. controls (17,43.10) and (13.20,43.10)
    .. (8.80,38.40)
    .. controls (5.30,34.50) and (2.70,29.90)
    .. (2.70,29.40)
    .. controls (2.70,29.40) and (2.70,28.40)
    .. (3.90,28.40)
    .. controls (4.70,28.40) and (4.90,28.80)
    .. (5.50,29.60)
    .. controls (10.40,37.30) and (16.20,37.30)
    .. (18.20,37.30)
    -- (23.90,37.30)
    .. controls (20.70,25.20) and (15.30,13.10)
    .. (11.10,4)
    .. controls (10.30,2.50) and (10.30,2.30)
    .. (10.30,1.60)
    .. controls (10.30,-0.30) and (11.90,-1.10)
    .. (13.20,-1.10)
    .. controls (16.20,-1.10) and (17,1.70)
    .. (18.20,5.40)
    .. controls (19.60,10) and (19.60,10.20)
    .. (20.90,15.20)
    -- (26.50,37.30)
    -- (37.80,37.30)
    .. controls (34.50,22.50) and (33.60,18.20)
    .. (33.60,11.50)
    .. controls (33.60,10) and (33.60,7.30)
    .. (34.40,3.90)
    .. controls (35.40,-0.50) and (36.50,-1.10)
    .. (38,-1.10)
    .. controls (40,-1.10) and (42.10,0.70)
    .. (42.10,2.70)
    .. controls (42.10,3.30) and (42.10,3.50)
    .. (41.50,4.90)
    .. controls (38.60,12.10) and (38.60,18.60)
    .. (38.60,21.40)
    .. controls (38.60,26.70) and (39.30,32.10)
    .. (40.40,37.30)
    -- (51.80,37.30)
    .. controls (53.10,37.30) and (56.70,37.30)
    .. (56.70,40.70)
    -- cycle;

\end{tikzpicture}

\end{document}

The output is rather unspectacular.

enter image description here

  • 8
    I wonder (but don’t have anywhere near the TeX-fu to attack it myself): could one combine this answer with the Liantze Lim’s shapepar-based answer, to print the digits of pi (as there) in the shape of metafont’s actual pi (as used here), instead of with the shape input by hand (as it is there)? – Peter LeFanu Lumsdaine Mar 14 at 11:26
  • 4
    You can sort of do it with ConTeXt to calculate \parshape but \pi is too irregular to give good results (code, screenshot). – Henri Menke Mar 14 at 20:57
29

enter image description here

\documentclass[serif]{beamer}

\usepackage{pst-text,pst-eucl,pst-grad}
\usepackage[active,tightpage]{preview}
\PreviewBorder=0pt
\PreviewEnvironment{pspicture}


\DeclareFixedFont{\ps}{U}{psy}{m}{n}{12cm}% the symbol font
\DeclareFixedFont{\PS}{T1}{ptm}{m}{n}{11cm}% the times font
\DeclareFixedFont{\RM}{T1}{ptm}{b}{n}{2cm}

\def\x{3.43}

\psset
{
    PointName=none,
    PointSymbol=none,
    linestyle=none,
    fillstyle=gradient,
    gradlines=1500,
    gradangle=30,
    gradmidpoint=1,
}

\newrgbcolor{TopBegin}{0.027 0.6 0.254}
\newrgbcolor{TopEnd}{0.521 0.749 0.125}

\newrgbcolor{LeftBegin}{0 0.368 0.549}
\newrgbcolor{LeftEnd}{0 0.596 0.701}

\newrgbcolor{BottomBegin}{0.905 0.223 0.050}
\newrgbcolor{BottomEnd}{0.949 0.568 0.003}

\newrgbcolor{RightBegin}{0.513 0.117 0.380}
\newrgbcolor{RightEnd}{0.870 0.007 0.349}

\begin{document}
\begin{frame}
\begin{pspicture}[showgrid=false](-\x,\x)(\x,-\x)
    \pstGeonode(-\x,\x){TL}(-\x,-\x){BL}(\x,-\x){BR}(\x,\x){TR}
    \pstGeonode
        (-2.4,1.7){A}
        (-1.2,1.7){B}
        (-1.5,-2.2){C}
        (0.7,-2.3){D}
        (1.0,1.7){E}
    \only<6>{\psclip{\pscircle[linewidth=0,fillstyle=none]{\x}}}
        \only<1->{\pspolygon[gradbegin=TopBegin,gradend=TopEnd](TL)(A)(E)(TR)}
        \only<2->{\pspolygon[gradbegin=LeftBegin,gradend=LeftEnd](TL)(A)(B)(C)(BL)}
        \only<3->{\pspolygon[gradbegin=BottomBegin,gradend=BottomEnd](BL)(C)(B)(E)(D)(BR)}
        \only<4->{\pspolygon[gradbegin=RightBegin,gradend=RightEnd](BR)(D)(E)(TR)}
        \only<5->{\rput(-0.2,-0.45){\pscharpath[fillstyle=solid,fillcolor=white]{\ps p}}}
    \only<6>{\endpsclip}
\end{pspicture}
\end{frame}
\end{document}
  • 2
    Wow. It’s nice to see some nice color combination! – Ruixi Zhang Mar 14 at 20:32
28

Time for a bad joke...

\documentclass[margin=1cm]{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[y=0.80pt, x=0.80pt, yscale=-3.000000, xscale=3.000000, inner sep=0pt, outer sep=0pt]
  \path[scale=0.265,fill=black,nonzero rule,line width=0.175pt]
    (391.8613,471.7441) .. controls (391.0467,471.6791) and (390.9815,472.0037) ..
    (392.4473,472.7852) .. controls (393.4234,473.3051) and (394.2051,473.8288) ..
    (394.2051,473.8926) .. controls (394.2051,474.1541) and (390.1011,473.8291) ..
    (387.6895,473.3730) .. controls (385.9318,473.0476) and (385.6071,473.1103) ..
    (386.3887,473.6973) .. controls (387.1702,474.2842) and (386.5841,474.3488) ..
    (383.9141,474.0234) .. controls (380.1372,473.5034) and (369.0009,474.3487) ..
    (371.0840,474.9355) .. controls (371.8017,475.1302) and (369.9119,475.4546) ..
    (366.8496,475.6523) .. controls (361.9658,475.9778) and (361.5745,476.1090) ..
    (363.5938,476.6289) -- (365.8750,477.2168) -- (363.9180,477.9980) .. controls
    (362.8749,478.4542) and (361.1186,478.9102) .. (360.0117,478.9102) --
    (358.0566,479.0410) -- (360.3340,479.8867) -- (362.6133,480.7324) --
    (359.0312,480.9922) .. controls (355.7105,481.2537) and (355.5810,481.3193) ..
    (357.5332,481.7754) .. controls (360.6593,482.5569) and (359.4882,483.4694) ..
    (355.2520,483.5332) .. controls (351.6696,483.5971) and (351.6064,483.5968) ..
    (353.6895,484.3145) -- (355.8379,484.9648) -- (353.3633,486.1387) .. controls
    (351.0825,487.2456) and (351.0829,487.3091) .. (352.8438,486.9199) .. controls
    (355.3829,486.4638) and (354.2754,487.7660) .. (351.6055,488.4199) .. controls
    (350.1062,488.7453) and (349.8471,488.6806) .. (350.2363,487.9629) .. controls
    (350.6255,487.2452) and (350.5622,487.1813) .. (349.8477,487.8320) .. controls
    (349.3915,488.2882) and (347.6333,488.6777) .. (345.9395,488.6777) .. controls
    (342.3571,488.6777) and (341.1837,489.6533) .. (344.1152,490.2402) .. controls
    (345.4837,490.5018) and (345.9412,490.8909) .. (345.5488,491.4141) .. controls
    (345.2872,491.8702) and (345.1589,492.7822) .. (345.2227,493.3691) .. controls
    (345.4172,494.4760) and (343.9842,494.5410) .. (322.7520,494.5410) .. controls
    (310.3112,494.6049) and (298.0685,494.8661) .. (295.5293,495.1914) .. controls
    (291.8162,495.6476) and (289.9274,495.5178) .. (285.1074,494.4746) .. controls
    (279.7005,493.2369) and (278.4641,493.2360) .. (268.5020,493.8867) .. controls
    (240.4975,495.7752) and (229.8169,500.0763) .. (221.2168,512.7754) .. controls
    (215.4845,521.1777) and (209.3638,540.1922) .. (207.6699,554.3906) .. controls
    (206.7576,562.1390) and (206.4307,563.4438) .. (204.3477,567.2207) .. controls
    (201.0907,573.0168) and (195.1644,579.2050) .. (190.2168,581.8750) .. controls
    (186.3825,583.9580) and (185.7311,584.0879) .. (180.1934,584.0879) .. controls
    (172.7034,584.0879) and (171.7914,583.4375) .. (171.1406,577.8359) .. controls
    (170.7483,574.5790) and (170.3591,573.7349) .. (168.4707,572.0410) .. controls
    (166.5153,570.3471) and (165.6705,570.0840) .. (162.6113,570.0840) --
    (158.9629,570.0840) -- (159.1562,572.9492) .. controls (159.2870,574.5123) and
    (159.2213,575.6861) .. (158.9629,575.4883) .. controls (158.6375,575.3575) and
    (158.4414,575.4885) .. (158.4414,575.8809) .. controls (158.4414,576.2063) and
    (158.7684,576.7260) .. (159.0938,576.9238) .. controls (159.4861,577.1854) and
    (159.6119,577.6414) .. (159.3535,577.9668) .. controls (159.1590,578.3560) and
    (159.6156,579.3995) .. (160.4609,580.2481) .. controls (161.8294,581.7473) and
    (161.8934,581.8104) .. (160.7227,581.4180) .. controls (158.8342,580.7672) and
    (165.4767,586.7580) .. (168.5391,588.5156) .. controls (170.7529,589.7533) and
    (172.1209,589.9492) .. (177.3301,589.9492) .. controls (183.5824,589.8853) and
    (189.1832,588.9048) .. (192.5039,587.2109) .. controls (194.2616,586.2986) and
    (194.3285,586.3658) .. (193.6777,587.6035) .. controls (193.2854,588.3212) and
    (191.3982,590.2097) .. (189.5098,591.9004) -- (186.0566,594.8320) --
    (185.3398,603.8184) .. controls (184.8837,608.7021) and (184.7534,613.5219) ..
    (184.9512,614.4981) .. controls (185.1457,615.4742) and (184.6892,617.7561) ..
    (183.9746,619.7754) .. controls (182.7369,623.0323) and (182.6727,624.1382) ..
    (183.1289,631.4336) .. controls (183.2964,634.1191) and (183.4845,636.1229) ..
    (183.7188,637.6973) -- (170.7891,636.3867) -- (172.2559,647.7539) .. controls
    (175.2172,670.7066) and (187.6454,715.3502) .. (195.3809,730.8203) .. controls
    (202.2667,744.5919) and (204.4715,747.0422) .. (214.9453,752.5703) --
    (226.7500,758.8008) -- (383.2656,758.1445) -- (539.7812,757.4902) --
    (552.2402,751.3848) .. controls (575.3569,740.0606) and (587.7187,721.6392) ..
    (601.6914,677.7012) .. controls (606.4682,662.6826) and (611.0325,642.4057) ..
    (612.6113,630.8711) .. controls (620.8351,626.0502) and (626.1090,616.1553) ..
    (627.6914,610.5098) -- (623.9062,609.4492) .. controls (621.5253,616.5571) and
    (616.6045,620.7654) .. (609.1269,619.0098) .. controls (588.9114,613.6352) and
    (609.9961,581.0584) .. (618.5039,551.2246) -- (642.3906,558.0644) --
    (646.5371,542.7539) .. controls (547.2330,514.4010) and (560.4002,515.9883) ..
    (538.3301,543.9141) -- (541.9043,545.2070) .. controls (546.8886,541.9876) and
    (551.9234,529.7436) .. (573.5312,538.4727) .. controls (557.5158,592.4920) and
    (532.1226,591.5464) .. (530.4902,603.0918) .. controls (529.2630,609.5511) and
    (533.1780,614.8277) .. (538.5215,616.5684) .. controls (555.7617,620.7688) and
    (561.4494,597.5315) .. (583.0312,540.9902) -- (605.0625,547.1660) .. controls
    (598.1578,567.2929) and (589.2261,586.8502) .. (583.2461,606.7988) .. controls
    (581.5364,613.4114) and (582.1595,619.0459) .. (584.5039,623.4297) .. controls
    (579.0468,623.8935) and (573.0937,624.4395) .. (566.8867,625.0527) .. controls
    (518.1395,629.8680) and (404.6183,638.3535) .. (388.9492,638.3535) .. controls
    (384.6987,638.5117) and (380.5242,638.6445) .. (376.3848,638.7656) .. controls
    (376.2582,638.0879) and (375.9270,637.3749) .. (375.3828,636.6367) .. controls
    (373.1020,633.4468) and (372.1276,632.9238) .. (367.8945,632.9238) --
    (363.9219,632.9238) -- (362.1641,629.6660) .. controls (360.5372,626.7345) and
    (360.3398,625.7597) .. (360.3398,620.1582) .. controls (360.3398,613.6443) and
    (361.4471,608.1735) .. (365.1602,596.3867) .. controls (366.7870,591.3083) and
    (369.3284,587.6584) .. (369.9121,589.4160) .. controls (370.1067,589.9360) and
    (371.4123,590.2617) .. (373.3008,590.2617) .. controls (375.8400,590.2617) and
    (377.7955,590.9789) .. (384.5039,594.6250) .. controls (399.2893,602.5042) and
    (403.6531,605.3713) .. (403.8477,607.2598) .. controls (404.1092,609.2152) and
    (405.2163,610.3868) .. (409.7109,613.3184) .. controls (411.9917,614.8177) and
    (413.2924,616.3145) .. (414.7246,619.2461) .. controls (416.4823,622.7646) and
    (417.0061,623.2839) .. (420.2598,624.6523) .. controls (423.3221,625.8901) and
    (424.5573,626.0851) .. (428.7266,625.7598) .. controls (431.3965,625.4982) and
    (434.1324,625.1718) .. (434.7832,625.0410) .. controls (436.1517,624.6487) and
    (438.1708,620.8090) .. (438.7578,617.4883) .. controls (439.2778,614.4929) and
    (438.8219,614.0364) .. (429.4434,608.3711) .. controls (423.9726,605.0504) and
    (421.8227,603.2925) .. (418.5020,599.3848) .. controls (411.9243,591.7002) and
    (411.9235,591.6354) .. (402.8066,583.4277) .. controls (398.1174,579.1309) and
    (394.2109,575.4817) .. (394.2109,575.2871) .. controls (394.2109,575.0925) and
    (395.7091,572.6185) .. (397.4668,569.7539) .. controls (399.6168,566.3662) and
    (400.9859,563.3054) .. (401.5059,560.8301) .. controls (402.3512,556.7278) and
    (403.0043,556.1424) .. (403.9805,558.6816) .. controls (404.8928,561.0900) and
    (405.6756,560.6367) .. (405.4141,557.8359) -- (405.2188,555.4277) --
    (406.5195,557.0547) .. controls (407.2373,557.9670) and (407.8887,559.3982) ..
    (407.8887,560.3106) .. controls (407.8887,561.6121) and (408.0191,561.7425) ..
    (408.5391,560.9609) .. controls (408.8645,560.4410) and (408.9954,559.3994) ..
    (408.8008,558.6816) .. controls (408.4084,557.4439) and (408.4082,557.4434) ..
    (409.7129,558.7481) .. controls (410.4306,559.5296) and (411.1452,560.8312) ..
    (411.3398,561.6797) .. controls (411.5345,562.9174) and (411.6655,562.7219) ..
    (411.7324,561.0918) .. controls (411.7963,558.6164) and (412.9699,558.5539) ..
    (414.1406,560.8984) -- (414.9219,562.3965) -- (415.3789,561.0293) .. controls
    (415.8989,559.3355) and (417.0053,559.8551) .. (417.0723,561.8106) .. controls
    (417.1392,563.1120) and (417.2040,563.1114) .. (417.6602,561.6152) --
    (418.1797,559.9883) -- (418.3105,561.6152) .. controls (418.4413,563.2421) and
    (418.4418,563.2433) .. (419.2871,561.2910) .. controls (419.8071,560.1841) and
    (420.1979,559.7913) .. (420.2617,560.3144) .. controls (420.2617,561.0322) and
    (420.6522,560.8335) .. (421.5645,559.7266) -- (422.8652,558.2285) --
    (422.8652,560.1191) .. controls (422.8652,561.1622) and (422.3447,562.6593) ..
    (421.7578,563.5078) .. controls (421.1708,564.4201) and (421.0418,564.8748) ..
    (421.4980,564.6133) .. controls (421.9542,564.2879) and (422.8656,563.1817) ..
    (423.5801,562.0078) .. controls (424.9486,559.7940) and (425.2749,560.9649) ..
    (424.1680,563.8965) .. controls (423.7788,564.8726) and (423.7782,565.4588) ..
    (424.1035,565.1973) .. controls (424.4289,565.0026) and (425.0790,563.7650) ..
    (425.5352,562.3965) .. controls (426.3167,559.9211) and (428.5978,556.6004) ..
    (429.1816,556.9258) .. controls (429.3763,557.0566) and (429.7684,556.7960) ..
    (430.0938,556.3398) .. controls (431.1369,554.6460) and (431.3316,556.2750) ..
    (430.3555,558.5527) .. controls (428.8562,562.0712) and (429.8985,561.4840) ..
    (431.5254,557.8379) .. controls (432.3707,555.8824) and (432.9578,555.1683) ..
    (433.1523,555.8828) .. controls (433.2831,556.4698) and (433.0226,557.5765) ..
    (432.6973,558.2910) .. controls (431.8519,559.8541) and (431.7848,560.8297) ..
    (432.5664,559.9844) .. controls (432.8918,559.5952) and (433.4794,558.1608) ..
    (433.9355,556.7285) .. controls (434.6533,554.5785) and (434.8471,554.3208) ..
    (435.2363,555.4277) .. controls (435.6925,556.5346) and (435.8238,556.4021) ..
    (436.3438,554.5137) .. controls (437.2561,551.1259) and (438.4922,551.1935) ..
    (438.4922,554.5781) -- (438.5566,557.3789) -- (439.7305,554.4531) .. controls
    (440.3812,552.8263) and (441.4255,550.6134) .. (442.0762,549.5703) --
    (443.1816,547.6152) -- (442.8574,550.5469) .. controls (442.5320,553.2169) and
    (442.5949,553.3477) .. (443.4434,552.1738) .. controls (443.9633,551.4561) and
    (444.7463,549.6979) .. (445.1387,548.2656) .. controls (445.7894,545.8572) and
    (445.9188,545.7898) .. (446.2441,547.2891) .. controls (446.7003,548.8522) and
    (446.7015,548.8526) .. (447.5469,546.7695) .. controls (448.4592,544.5557) and
    (449.2398,544.1641) .. (449.7598,545.4688) .. controls (449.9544,545.9249) and
    (450.1523,545.7288) .. (450.1523,544.9473) .. controls (450.2162,543.7096) and
    (450.7384,543.5148) .. (455.1660,543.1894) .. controls (459.8552,542.8640) and
    (460.3117,542.6695) .. (462.6562,540.3887) .. controls (464.0247,539.0872) and
    (465.4579,537.0698) .. (465.9141,535.9629) .. controls (466.3702,534.8560) and
    (467.6718,533.0301) .. (468.8457,531.8594) .. controls (470.0834,530.6887) and
    (471.0586,529.1904) .. (471.0586,528.4727) .. controls (471.0586,527.7549) and
    (469.0392,524.9532) .. (466.5000,522.2832) .. controls (463.7630,519.2879) and
    (461.9434,516.8127) .. (461.9434,515.9004) .. controls (461.9434,515.1188) and
    (461.3552,513.8811) .. (460.6406,513.0996) .. controls (459.9261,512.3181) and
    (458.6227,509.9103) .. (457.7773,507.6934) .. controls (456.8650,505.4795) and
    (455.3017,502.4160) .. (454.2617,500.7891) .. controls (453.2186,499.2260) and
    (451.9796,496.8816) .. (451.5234,495.5801) .. controls (451.1343,494.3424) and
    (450.4816,493.1048) .. (450.1562,492.9102) .. controls (449.8308,492.6486) and
    (449.5684,491.3483) .. (449.5684,489.9160) .. controls (449.5684,486.9207) and
    (447.6793,483.5986) .. (444.0332,480.2109) .. controls (441.9502,478.3225) and
    (441.6264,478.1920) .. (442.0156,479.4297) .. controls (442.7334,481.5127) and
    (441.7525,481.1881) .. (438.5625,478.2598) .. controls (435.3726,475.2644) and
    (432.0492,473.4398) .. (428.7285,472.7891) -- (426.4473,472.3965) --
    (429.5098,474.2852) .. controls (433.7428,477.0221) and (434.0691,477.9983) ..
    (429.9668,475.9121) -- (426.4473,474.2168) -- (428.0742,475.9746) --
    (429.7012,477.8008) -- (427.0957,476.1055) .. controls (425.6634,475.1294) and
    (423.8395,474.3477) .. (422.9941,474.3477) .. controls (422.2126,474.3477) and
    (421.3657,473.8930) .. (421.1680,473.3730) .. controls (420.9064,472.8531) and
    (420.1917,472.3965) .. (419.4102,472.3965) .. controls (418.1724,472.3965) and
    (418.1085,472.4627) .. (419.2793,473.6973) .. controls (420.6478,475.2603) and
    (420.4505,475.2598) .. (417.5859,474.0859) .. controls (416.3482,473.6298) and
    (413.9400,473.0442) .. (412.2461,472.8496) -- (409.0566,472.5234) --
    (411.2695,474.4121) .. controls (413.8087,476.6259) and (413.5516,476.6926) ..
    (409.7715,475.0625) .. controls (406.9069,473.8248) and (400.2625,473.1071) ..
    (398.9609,473.8887) .. controls (398.6355,474.0833) and (397.2018,473.6936) ..
    (395.7695,473.0430) .. controls (394.2384,472.2630) and (392.6760,471.8091) ..
    (391.8613,471.7441) -- cycle(276.5215,566.2402) -- (279.3223,568.1973) ..
    controls (283.8807,571.3234) and (291.3057,574.5792) .. (296.1895,575.6191) ..
    controls (308.9556,578.2891) and (318.9856,577.3135) .. (328.5586,572.4297) ..
    controls (333.3786,569.9543) and (335.0047,569.4336) .. (338.0000,569.4336) ..
    controls (340.6062,569.4336) and (342.0383,569.7603) .. (343.2090,570.7363) ..
    controls (344.1213,571.4541) and (345.2300,572.0371) .. (345.6191,572.0371) ..
    controls (346.0083,572.0371) and (346.9867,572.5563) .. (347.8320,573.2070) ..
    controls (349.2643,574.3139) and (349.2652,574.4462) .. (348.2891,576.3984) ..
    controls (347.4437,578.0923) and (347.3126,581.0873) .. (347.4434,595.2188) ..
    controls (347.6379,611.4364) and (347.5729,612.2178) .. (346.1406,615.9277) --
    (344.6426,619.7676) -- (346.0098,621.2012) .. controls (346.9859,622.2443) and
    (347.3125,623.4809) .. (347.3125,625.9531) .. controls (347.3125,628.2339) and
    (347.8319,630.3806) .. (348.8750,632.4668) .. controls (349.7203,634.1606) and
    (350.7639,636.5703) .. (351.1562,637.8750) .. controls (351.3326,638.4122) and
    (351.5011,638.8830) .. (351.6797,639.3027) .. controls (335.5248,639.5443) and
    (320.0184,639.5715) .. (304.7266,639.5254) .. controls (305.7587,639.3505) and
    (306.2745,639.0478) .. (306.8691,638.5352) .. controls (307.7145,637.7536) and
    (308.9521,637.1660) .. (309.5391,637.1660) .. controls (310.1260,637.1660) and
    (310.7775,636.9719) .. (311.0391,636.7773) .. controls (311.6898,636.1266) and
    (308.3685,630.1331) .. (307.0000,629.3516) .. controls (305.0446,628.3755) and
    (301.5932,628.5691) .. (296.1895,630.0684) .. controls (290.1988,631.6953) and
    (290.9143,632.0231) .. (281.7305,623.0977) .. controls (275.4782,616.9762) and
    (275.1520,616.4541) .. (274.3066,612.7441) .. controls (273.1997,607.4042) and
    (273.2643,604.0163) .. (274.6328,597.1133) .. controls (275.4144,593.2726) and
    (275.9331,586.9538) .. (276.1309,578.7461) -- (276.5215,566.2402) --
    cycle(243.8203,570.0820) .. controls (244.0149,570.0820) and
    (245.6453,573.7951) .. (247.3359,578.3535) .. controls (249.0298,582.9789) and
    (251.9611,589.6208) .. (253.7188,593.2031) -- (256.9785,599.7188) --
    (256.8477,608.9023) .. controls (256.7839,614.1115) and (256.9794,619.2572) ..
    (257.4355,620.8203) .. controls (258.0225,623.1649) and (258.6725,623.7517) ..
    (262.8418,626.1602) .. controls (265.4480,627.6594) and (271.5023,631.2384) ..
    (276.3223,634.1699) -- (285.1152,639.4473) .. controls (255.9661,639.4473) and
    (227.5437,639.1752) .. (208.3731,638.7637) .. controls (208.1397,637.8716) and
    (207.5751,636.8804) .. (206.6387,635.7305) .. controls (204.8140,633.5167) and
    (204.2940,633.3228) .. (200.9062,633.1250) -- (197.1934,632.9297) --
    (197.2578,624.7891) .. controls (197.2578,617.2353) and (197.4514,616.2568) ..
    (199.3398,611.3731) .. controls (202.1406,604.2754) and (204.8119,600.4308) ..
    (209.1758,597.3047) .. controls (211.1950,595.8054) and (215.6221,592.2265) ..
    (219.0098,589.2949) .. controls (222.3975,586.3634) and (227.6701,582.1298) ..
    (230.7324,579.9160) .. controls (233.7948,577.7022) and (237.8974,574.5767) ..
    (239.8496,573.0137) .. controls (241.8050,571.3868) and (243.6257,570.0820) ..
    (243.8203,570.0820) -- cycle;
\end{tikzpicture}
\end{document}

Life of Pi

For a tiger, there's a lot of code, so it's available here. The output:

Life of Pi

  • 2
    I know this movie :) – samcarter Mar 14 at 17:36
  • 3
    I like the idea. Never heard of the book or the movie. I know the book with the tiger but the image shows (as far as I can see) a lion. – albert Mar 14 at 17:39
  • ooh you switched the tiger to Lions of TikZ :-) that really is a fun answer I'm sorry I put your name to my poor version – KJO Mar 14 at 18:16
  • 2
    I demand a tiger… Thanks for a good laugh ;-) @albert The movie was awesome, another masterpiece by Ang Lee. – Ruixi Zhang Mar 14 at 20:24
  • 1
    @albert, @ RuixiZhang, @KJO, @samcarter: updated. :) – Paulo Cereda Mar 14 at 22:16
27

Here is a slightly different visualization of π.

enter image description here

I re-drew this from my copy of Proofs without Words by Roger B. Nelsen. The original was published in Mathematics Magazine, 50.3, May 1977.

Here I have used Metapost using luamplib, so compile with lualatex.

\documentclass[border=5mm]{standalone}
\usepackage{luatex85}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(0);
    path C, C', S; numeric u; u=68;
    C = fullcircle rotated 90 scaled 2u;
    C' = C rotated 180 shifted (3.14159265359u ,0); 
    S = unitsquare rotated -90 
                   scaled 1.77245385091u
                   shifted point 0 of C'; 

    z0 = (xpart point 2 of C', ypart point 0 of C');
    fill C withcolor 7/8[blue,white]; 
    fill S withcolor 7/8[blue,white]; 

    drawoptions(dashed withdots scaled 1/2);
    draw point 4 of C shifted (-u,0) -- point 3 of S shifted (1/2u,0);
    draw halfcircle rotated 180 
                    scaled abs(point 4 of C - z0)
                    shifted 1/2[point 4 of C,z0];
    drawoptions();
    forsuffixes @=C,C':
        draw @; 
        draw point 0 of @ -- center @ -- point 2 of @ dashed evenly scaled 1/2;
        drawdot point 0 of @ withpen pencircle scaled 3;
    endfor 
    draw point 2 of C' -- z0 dashed evenly scaled 1/2;
    draw S;
    drawarrow subpath(-1/2,-3/2) of C scaled 1.2 withcolor 2/3 red;

    label.top("The Rolling Circle Squares Itself — Thomas Elsner", 
                    1/2[point 0 of C, point 4 of C'] shifted 20 up);
    label.bot("$\pi$", 1/2[point 4 of C, point 0 of C']);
    label.lft("$\sqrt\pi$", 1/2[point 1 of S, point 0 of C']);
    label.rt("$1$", 1/2 point 0 of C);
endfig;
\end{mplibcode}
\end{document}
  • Beautiful! I like that you showed what Pi is rather than the symbol. (You've also inspired me to learn luamplib.) – hackerb9 Mar 15 at 17:23
21

My contribuation for pi(e)-day:

enter image description here

The thieves were already there:

enter image description here

  • 8
    Did you use LaTeX to prepare the cake? :-) – gerrit Mar 14 at 8:21
  • 3
    @gerrit a bit - it was used to get a prototype for the pi and the ducks ;-) – Ulrike Fischer Mar 14 at 8:41
  • 2
    You staged it, right? There is no way the Baer is faster at the cake than the marmot. – marmot Mar 14 at 21:11
  • 2
    @marmot The marmot is rather cautious and sent the Bär to check the situation. – Ulrike Fischer Mar 14 at 21:58
20

One should also honor Euler a bit.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikzlings,amsmath}
\makeatletter
\tikzset{/thing/.cd,
 pie/.code=\thing@cheesetrue\def\thing@cheese{#1}, %<-pretend you didn't see that
 pie/.default=pink!70!red}
\makeatother                            
\begin{document}
\begin{tikzpicture}[font=\sffamily]
\marmot[pie,whiskers,teeth,shadow]
\node[anchor=east,scale=5,transform shape] at (-0.6,1) {$\pi\cdot\mathsf{e}=\text{\sffamily pie}$};
\end{tikzpicture}
\end{document}

enter image description here

  • Do marmots even eat pink cheese? Hahah. All the answers including the question are fantastic. – Sebastiano Mar 14 at 12:54
20

The obligatory forest solution:

\documentclass{standalone}

\usepackage[edges]{forest}
\usetikzlibrary{calc}
\forestset{
  forked edge'/.style={
    edge={rotate/.option=!parent.grow},
    edge path'={(!u.parent anchor)++(0pt,-30pt) -- (!u.parent anchor)++(0pt,30pt)  |- (.child anchor)},   
  }
}
\begin{document}
\Huge
\begin{forest}forked edges,for tree={edge={line width=4pt}}
[ [ ] [ ]]
\end{forest}
\end{document}

pi

  • 1
    Hah! I can't see the forest from the \pi's – morbusg Mar 14 at 19:56
19

A few mathematical representations:

\documentclass[10pt,a4paper]{article}
\begin{document}
    \[\int_{-\infty}^{\infty}\frac{\sin x}{x}dx\]
\end{document}

enter image description here

Honory representation: Ramanujan's equation

\documentclass[10pt,a4paper]{article}
\usepackage{amsmath}
\begin{document}
    \[\sqrt{6}\cdot\prod_{p~\text{prime}}^{\infty}\frac{p}{\sqrt{p^2-1}}\]
\end{document}

enter image description here

In a computer programmer's paradigm:

\documentclass[10pt,a4paper]{article}
\usepackage{amsmath}
\begin{document}
    \[4\cdot\arctan{1}\]
\end{document}

enter image description here

  • 3
    Don't forget the computer programmer's method for obtaining it as a double precision constant: pi = 4 atan(1). – Steven B. Segletes Mar 14 at 10:26
  • @StevenB.Segletes Another possibility :D – Raaja Mar 14 at 10:29
  • @Raaja Your answer, with Reda Drissi's answer, seem to be off-topic in this question :) (but don't worry, I like them all!) – JouleV Mar 14 at 14:16
  • @JouleV I know, therefore, I posted this answer as a community wiki ;). IMO, these are some of the must-to-be-added answers for the sake of \pi day ;), because, their scope is beyond TeX by itself. Nevertheless, thank you for liking the answer(s). And, I still owe you a pie from TikZ which, I am baking now. – Raaja Mar 14 at 14:28
  • @Raaja You made me hungry, and your comment makes me starving :)) – JouleV Mar 14 at 14:29
17
\def\Tau{\ooalign{%
  $\bigcirc$\cr
  \hskip.3em $^\circ$\cr
  \hskip.49em \vrule depth .5ex height .95ex width .4pt
}}
$$ \Tau\over 2 $$
\bye

enter image description here

  • 7
    Finally a relief from all those half-turn heretics! – Roman Odaisky Mar 14 at 20:02
  • +1. We should make June 28 a thing, too. – Ruixi Zhang Mar 14 at 20:28
  • ok so this is a reference to tau, but what's the robot got to do with it? – LarsH Mar 15 at 1:17
  • 2
    @LarsH it‘s a Tau unit miniature from the tabletop game Warhammer 40k. – morbusg Mar 15 at 11:56
15

This lua code shows how to use Monte Carlo simulation (MCS) to estimate π. Approach and Matlab solution is here.

\documentclass{article}
\usepackage{luacode}

\begin{document}
\luaexec{
tp=tex.print
N=5000000 --[[ the experiment event number ]]
r=1 --[[ the circle radius ]]
n=0 --[[ sucessful event number  ]]
for i = 1,N,1 
do 
   x=-r+2*r*math.random()
   y=-r+2*r*math.random()
   if ((x*x+y*y)<=r*r) then n = n+1  end
end
lua_pi = 4*n/N
tp("Estimated value of pi :")  tp(lua_pi)
}
\end{document}

enter image description here

  • 1
    I scrolled all the way down here to find a solution that uses the computational powers of tex to actually estimate pi, great! – HRSE Mar 15 at 9:22
15

In honor of Archimedes....

enter image description here

\documentclass{article}


\usepackage[svgnames]{xcolor}
\usepackage{tikz}

\pagestyle{empty}

\begin{document}
    \noindent
\foreach \x/\y in {6/Pink,12/Yellow,24/LightGreen,48/Orange,96/Magenta}
 {
\begin{tikzpicture}
\fill[White] (0,0) circle(3.2cm);
\draw[fill=\y] (0,0) circle(3cm);
\foreach \z in {1,...,\x}
 {
  \pgfmathsetmacro\rx{3*cos(360*(\z/\x))};
  \pgfmathsetmacro\ry{3*sin(360*(\z/\x))};
  \draw (0,0)--(\rx,\ry);
  \pgfmathsetmacro\rxp{3*cos(360*((\z-1)/\x))};
  \pgfmathsetmacro\ryp{3*sin(360*((\z-1)/\x))};
  \draw (\rxp,\ryp)--(\rx,\ry);
};
\end{tikzpicture} 
}
\raisebox{3cm}{Archimedes's algorithm for computing $\pi$}
\end{document}
14

A bit rough, but anyway.

pi image

\documentclass{standalone}
\def\pgfsysdriver{pgfsys-\Gin@driver}
\usepackage{pgfsys}
\usepackage{pgffor}
\usepackage{pgfmath}
\usepgflibrary{fpu}
\pgfkeys{
 /pgf/fpu=true,
 /pgf/fpu/output format=fixed
}
\def\pgfpt{\dimexpr\pgfmathresult pt\relax}
\begin{document}
\Large
\hspace{5mm}%
\foreach \i in {0,...,90}{%
 \pgfmathparse{-sin(\i) * 50}%
 \raisebox{\pgfpt}{.}%
 \pgfmathparse{(cos(\i) - cos(\i - 1)) * 5 - 4}%
 \hspace{\pgfpt}%
}\\
\hspace{-2mm}%
\foreach \i in {0,...,50}{.\hspace{-3pt}}\\
\hspace{-8mm}%
\foreach \i in {0,...,120}{%
 \pgfmathparse{-sin(\i) * 50}%
 \raisebox{\pgfpt}{.}%
 \pgfmathparse{(cos(\i) - cos(\i - 1)) * 5 - 3.7}%
 \hspace{\pgfpt}%
}%
\end{document}
14

Do you know what the value of π is? Here is an answer.

\documentclass[tikz]{standalone}
\newlength{\numheight}
\settoheight{\numheight}{1}
\begin{document}
\begin{tikzpicture}[x={\numheight/2},y={\numheight/2}]
\draw (-6,-.2)|-(-5,0) (-5.6,0)--(-5.75,-1) (-5.3,0)--(-5.3,-.875) arc (180:360:.125);
\draw (-4.5,.25) to[out=60,in=-120] (-3.5,.25) (-4.5,-.25) to[out=60,in=-120] (-3.5,-.25);
\draw (-3,0) arc (-90:90:1 and 0.5) (-3,0) arc (90:-90:1 and 0.5);
\draw (-1,-1) circle (.1pt);
\draw (.5,-1)|-(0,1) (0,-1)--(1,-1);
\draw (2,1)--(1.5,0)--(2.5,0) (2.5,1)--(2.5,-1);
\draw (3.5,-1)|-(3,1) (3,-1)--(4,-1);
\draw (5.5,1)-|(4.5,0) arc (90:-90:1 and 0.5);
\draw (6.5,0)-|(7,.5) arc (0:270:0.5) (7,0) arc (0:-90:1);
\draw (7.5,.5) arc (180:-60:0.5) to[out=210,in=90] (7.5,-1)--(8.5,-1);
\draw (9,-.5)|-(9.5,0) arc (90:-180:0.5) (9,0) arc (180:90:1);
\draw (11.5,1)-|(10.5,0) arc (90:-90:1 and 0.5);
\draw (12,0) arc (-90:90:1 and 0.5) (12,0) arc (90:-90:1 and 0.5);
\draw (13.5,-.5)|-(14,0) arc (90:-180:0.5) (13.5,0) arc (180:90:1);
\end{tikzpicture}
\end{document}

enter image description here

Don't worry about the spacing. This is supposed to be in a monospaced font :))

Without code...

enter image description here

13

My little litle litle...........contribution...with Mathcha.

enter image description here

\documentclass[10pt]{article}
\usepackage{tikz}
\begin{document}
\tikzset{every picture/.style={line width=0.75pt}}       
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
\draw[line width=2mm, violet] (221,106) .. controls (261,76) and (315.5,126) .. (355.5,96) ;
\draw[line width=1.5mm, violet] (254.5,98) -- (239.5,176) ;
\draw[line width=1.5mm, violet] (318,107) -- (335.5,179) ;
\end{tikzpicture}
\end{document}

or.....this

enter image description here

\documentclass[10pt]{article}
    \usepackage{tikz}
    \begin{document}
    \begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
    \draw[line width=3mm, orange] (200,103) .. controls (240,73) and (267.5,123) .. (307.5,93) ;
    \draw[line width=2.3mm, orange] (226.5,160) .. controls (244.5,158) and (235.5,136) .. (235.5,94) ;
    \draw[line width=2.3mm, orange]  (284.5,160) .. controls (276.5,152) and (276.5,140.75) .. (276.13,134.75) .. controls (275.75,128.75) and (276,122) .. (274.5,103) ;
    \end{tikzpicture}
    \end{document}

.....and for my students :-) this l(circle)(r)/(2r) = π


enter image description here

\documentclass[a4paper,12pt]{article}
\usepackage{tikz,amsmath,amssymb}
\begin{document}
\tikzset{every picture/.style={line width=0.75pt}}        
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
\draw   (125,142.25) .. controls (125,90.2) and (167.2,48) .. (219.25,48) .. controls (271.3,48) and (313.5,90.2) .. (313.5,142.25) .. controls (313.5,194.3) and (271.3,236.5) .. (219.25,236.5) .. controls (167.2,236.5) and (125,194.3) .. (125,142.25) -- cycle ;
\draw[|-|,red]   (219.25,142.25) -- (287.54,207.96) ;
\draw (248,184) node   {$r$};
\draw (325,92) node   {$\ell(\mathcal{C})$};
\end{tikzpicture}
\end{document}
  • Please show both of the Pis! – JouleV Mar 16 at 17:22
  • @JouleV What is Pis ( :-( ). I not know this word. – Sebastiano Mar 16 at 17:29
  • Hmm I use it as the plural of Pi :) – JouleV Mar 16 at 17:29
  • @JouleV Ahhh... You have the right and my authorization to edit my code :-) with two Pis :-). – Sebastiano Mar 16 at 17:31
  • 1
    @JouleV I'm sorry, I had to get out of the house before. That's it! – Sebastiano Mar 16 at 20:13
12

Happy \pi(less) day!!

enter image description here

\documentclass{report}
\begin{document}
\noindent%
\rule{30pt}{1pt}\\[-1pt]
\rule{8pt}{0pt}%
\rule{1pt}{30pt}%
\rule{12pt}{0pt}%
\rule{1pt}{30pt}
\end{document}
12

You can use different representations like :

 \documentclass[10pt,a4paper]{article}
 \usepackage{amsmath}
 \begin{document}
    \[\sqrt{6\sum\limits^{\infty}\frac{1}{n^2}}\]
 \end{document}

latex.codecogs representation

Or the gamma function :

 \documentclass[10pt,a4paper]{article}
 \usepackage{amsmath}
 \begin{document}
    \[\Gamma\left(\frac{1}{2}\right)^2\]
 \end{document}

enter image description here

You could also use Leibniz Wallis or BBP formula.

New contributor
Reda Drissi is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • 10
    while this is true, I think, the answer misses the purpose of the topic... – naphaneal Mar 14 at 14:11
  • 4
    @naphaneal, Yea, but it's a Pi Day post, so have an upvote. You too. – user1717828 Mar 15 at 12:07
11

My small contribution with some slagroom vlaai ;-) (I really think, we should not omit this one).

\documentclass{article}
\usepackage{graphicx}
\begin{document}
How can we forget this: $\pi$.

Anyway a happy pie day:

\includegraphics[height=2in, width=2in]{a}

\end{document}

enter image description here

  • 1
    I don't think \includegraphics qualifies as drawing. – Henri Menke Mar 14 at 9:32
  • @Henri Menke too bad that you didn't like/want the vlaai ;) – Raaja Mar 14 at 9:55
  • @Raaja We all want it :)) but I think Henri Menke wants a TikZified version :v – JouleV Mar 14 at 10:04
  • 1
    @Raaja Hope I can eat it soon :D – JouleV Mar 14 at 10:12
  • 1
    +1 for vlaai :D – Marijn Mar 14 at 12:10
11

OK here we go again, I usually get voted off as my answers are poor TeX because I plagiarise. However in the spirit of the day and as a result of yet another two down votes I have updated my avatar to include this code even though it took me all day to get here.

[Edit thanks to @Marmot] I Have removed some duplication and cleaned other code so it includes 3.14 pt

\documentclass[varwidth,11pt]{standalone}\begin{document}~\\\phantom{.}~\rule{55pt}{2pt}\\[-3.14pt]\huge{{~K~}\rule{2pt}{22pt}{~J~}\rule{2pt}{22pt}{~O~}}\\\end{document}

enter image description here

Previously I did modify this gif to try and help explain what pi truly represents.

enter image description here

As usual I can not really show off the level of my own TeX skill so have added another plagiarism courtesy of those well known TeX advocates

% Answer dedicated to David and Paulo
\documentclass{article}
\begin{document} \begin{picture}(100,100) \put(0,60){ooh Hapi pi dayz} \put(0,40){I CAN try, I can really try :-)} \put(10,0){ \line(0,1){20} } \put(0,20){ \line(1,0){30} } \put(20,0){ \line(0,1){20} } \put(60,0){[1] p.p. D. Carlisle and P. Cereda} \end{picture}
\end{document}

enter image description here

  • I think the challenge here is specifically about drawing a representation of pi using TeX - not about explaining what pi is. If this answer could be drawn using TeX it would be valid, but right now it seems to miss the point a bit. – Birjolaxew Mar 14 at 13:35
  • @Birjolaxew I have added a real TeX answer on behalf of the Master :-) – KJO Mar 14 at 13:57
  • 1
    Ohh I can see a picture answer at last :vv – JouleV Mar 14 at 14:16
  • 1
    @JouleV I was waiting in vain for David or an under-<strike>study</strike>ducky to answer PI-ctorially so for the past 24 hours have been learning how to draw using put line and now I CAN do three lines at a time – KJO Mar 14 at 14:34
  • 1
    @marmot OK I have cleaned up my logo but not sure that it is clearer since now its changed font, still learning :-) – KJO Mar 17 at 5:27

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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