# Pascal's triangle in Tikz with symbols

I have a follow-up question to Pascal's triangle in tikz with row headers.

Is it possible to produce Mark's solution with symbols in Pascal's triangle? So, I could create the same figure, but instead of numbers, I would generate Pascal's triangle with ${\n \choose \k}$ at each node.

Thanks!

-

## 1 Answer

Load the amsmath package to enable \binom{}{}.

Making use of this answer here

\documentclass[tikz,border=5]{standalone}
\usepackage{amsmath}
\usepgflibrary{fpu}
\begin{document}
\def\N{10}
\tikz[x=0.75cm,y=0.5cm,
pascal node/.style={font=\footnotesize},
row node/.style={font=\footnotesize, anchor=west, shift=(180:1)}]
\path
\foreach \n in {0,...,\N} {
(-\N/2-1, -\n) node  [row node/.try]{Row \n:}
\foreach \k in {0,...,\n}{
(-\n/2+\k,-\n) node [pascal node/.try] {%
%            \pgfkeys{/pgf/fpu}%
%            \pgfmathparse{round(\n!/(\k!*(\n-\k)!))}%
%            \pgfmathfloattoint{\pgfmathresult}%
%            \pgfmathresult%
$\binom{\n}{\k}$
}}};
\end{document}


-
+1 You beat me by 12 seconds! –  Gonzalo Medina Jul 28 at 1:42
Thanks, Sigur and Gonzalo! You're the best! –  Natalya Jul 28 at 1:49