Q:

How to create a Sierpinski triangle in LaTeX?

I have been trying to recreate the following image in LaTeX

and for me personally it has to be done with pdflatex. Although answers using pst-fractals
From Jake I got a good start which led to the following code
\documentclass{standalone}
\usepackage{tikz}
\def\level{5}
\usetikzlibrary{lindenmayersystems}

\begin{document}
\begin{tikzpicture}[l-system={step=5pt, order=\level, angle=120},rotate=180]
    \pgfdeclarelindenmayersystem{Sierpinski triangle}{
    \symbol{X}{\pgflsystemdrawforward}
    \symbol{Y}{\pgflsystemdrawforward}
    \rule{X -> X-Y+X+Y-X}
    \rule{Y -> YY}
    }
    \draw [black] (3,2) l-system
    [l-system={Sierpinski triangle, axiom=X, anchor=north east},fill=white];
\end{tikzpicture}

\end{document}

There are however two problems with the code.

I layer a black triangle behind the lindenmayersystem?
How do I keep the size of the triangle consistent with different number of recursion levels. 

A:

The width of the background triangles is 2^order*stepsize, so you can calculate the step size as a function of the desired overall width:

\documentclass[border=5mm]{standalone}
\usepackage{tikz}

\usetikzlibrary{lindenmayersystems}

\begin{document}%
\def\trianglewidth{2cm}%
\pgfdeclarelindenmayersystem{Sierpinski triangle}{
    \symbol{X}{\pgflsystemdrawforward}
    \symbol{Y}{\pgflsystemdrawforward}
    \rule{X -> X-Y+X+Y-X}
    \rule{Y -> YY}
}%
\foreach \level in {0,...,3}{%
\tikzset{
    l-system={step=\trianglewidth/(2^\level), order=\level, angle=-120}
}%
\begin{tikzpicture}
    \fill [black] (0,0) -- ++(0:\trianglewidth) -- ++(120:\trianglewidth) -- cycle;
    \draw [draw=none] (0,0) l-system
    [l-system={Sierpinski triangle, axiom=X},fill=white];
\end{tikzpicture}
}%
\end{document}

A:

An alternative way using decorations. It's a bit dependent on how the initial triangle is drawn (i.e., the direction of the path), and the nesting of decorations has to be done manually.
\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations}

% Not sure this follows any proper defition of 
% Sirpinksi triangle. It just works.
\pgfdeclaredecoration{quasi-sirpinski}{do}{%
    \state{do}[width=\pgfdecoratedinputsegmentlength, next state=do]{%
        \pgfpathmoveto{\pgfpointpolar{-60}{\pgfdecoratedinputsegmentlength/2}}%
        \pgfpathlineto{\pgfpointorigin}%
        \pgfpathlineto{\pgfpoint{\pgfdecoratedinputsegmentlength/2}{0pt}}%
        \pgfpathclose%
    }
}

\begin{document}

\tikz
    \fill (0,0) -- ++(60:3) -- ++(-60:3) -- cycle;

\tikz[decoration=quasi-sirpinski]
    \fill decorate { (0,0) -- ++(60:3) -- ++(-60:3) -- cycle };

\tikz[decoration=quasi-sirpinski]
    \fill decorate { decorate { 
        (0,0) -- ++(60:3) -- ++(-60:3) -- cycle } };

\tikz[decoration=quasi-sirpinski]
    \fill decorate { decorate { decorate { 
        (0,0) -- ++(60:3) -- ++(-60:3) -- cycle } } };

\tikz[decoration=quasi-sirpinski]
    \fill decorate { decorate { decorate {  decorate {
        (0,0) -- ++(60:3) -- ++(-60:3) -- cycle } } } };

\end{document}

A:

\documentclass[pstricks]{standalone}
\usepackage{pst-fractal}
\begin{document}

\multido{\iA=1+1}{5}{%
 \begin{pspicture}(3,2.8)
 \psSier[linecolor=blue!70,fillcolor=red!40](0,0){3cm}{\iA}
 \end{pspicture}}

 \multido{\iA=1+1}{5}{%
   \begin{pspicture}(3,2.7)\psSier(0,0){3cm}{\iA} \end{pspicture}} 

\end{document}

