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.

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!

share|improve this question

1 Answer 1

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}

enter image description here

share|improve this answer
2  
+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

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.