# Ferrer's Graph Implementation

https://en.wikipedia.org/wiki/Pentagonal_number_theorem

Hello. I would like to implement the Ferrer's graphs in the Wikipedia article above into LaTex. I have tried using arrays with \bullet but I can't seem to get more than two in a row to look decent. Also, how would I color one bullet red?

Could someone provide me an example of how to do the first Ferrer's graph so I can better understand the LaTex code? Thank you!

• Welcome to TeX.SX! Your question leaves all the effort to our community, even typing the essentials of a TeX document such as \documentclass{}...\begin{document} etc. As it is, most of our users will be very reluctant to touch your question, and you are left to the mercy of our procrastination team who are very few in number and very picky about selecting questions. You can improve your question by adding a minimal working example (MWE) that shows your current efforts and will help us help you! – ebosi Apr 6 '16 at 13:43

Maybe this? Here I introduce \ferrer[<red dots at end>]{<total dots>}, which are to be placed, in math mode, inside a \ferrerstack{} (with \cr delimiters).

I have made it centered about the math axis, but one could make it baseline aligned by eliminating the \vcenter{\hbox{}}:

\documentclass{article}
\usepackage{ifthen,xcolor,lipsum,amssymb}
\newcounter{fcount}
\newcommand\ferrer[2][0]{\noindent%
\setcounter{fcount}{0}%
\whiledo{\thefcount < #2}{%
\stepcounter{fcount}%
\ifnum\thefcount >\numexpr#2-#1\relax%
\textcolor{red}{\LARGE$\bullet\mkern2mu$}\else
\textcolor{gray}{\LARGE$\bullet\mkern2mu$}\fi
}\hfill\mbox{}%
}
\newcommand\ferrerstack[1]{\vcenter{\hbox{\shortstack{#1}}}}
\begin{document}
\lipsum[1]
$\mathcal{X} \leadsto \ferrerstack{% \ferrer[1]{7}\cr \ferrer[1]{6}\cr \ferrer{4}\cr \ferrer{3}\cr \ferrer[2]{2}}$
\lipsum[2]
\end{document}