PascalTriangle is a \LaTeX{} package that provides a simple and highly customizable way to generate and visualize Pascal's triangle using TikZ. It supports both rectangular and hexagonal layouts, modular coloring patterns, and factorial display.
📦 Repository: https://github.com/HubertMisonia/PascalTriangle
You can install PascalTriangle.sty by downloading it directly into your project folder (no move needed):
curl -O https://raw.githubusercontent.com/HubertMisonia/PascalTriangle/main/PascalTriangle.styor
wget https://raw.githubusercontent.com/HubertMisonia/PascalTriangle/main/PascalTriangle.styInvoke-WebRequest -Uri "https://raw.githubusercontent.com/HubertMisonia/PascalTriangle/main/PascalTriangle.sty" -OutFile "PascalTriangle.sty"Then, in your .tex file:
\usepackage{PascalTriangle}- Draw Pascal’s triangle in rectangular or hexagonal form
- Highlight divisibility patterns using modular arithmetic
- Show factorial formulas for each binomial coefficient
- Fully configurable style: radius, margin, font size, etc.
All options are passed to the \PascalTriangle command as key-value pairs:
| Option | Type | Description |
|---|---|---|
rows |
integer | Number of rows to render (default: 6) |
radius |
float | Size of each hexagon or rectangle (default: 1.0) |
fontSize |
float | Text scaling factor (default: 0.7) |
margin |
float | Inner spacing inside shapes (default: 0) |
nodeType |
string | hex or rect (default: hex) |
pattern |
string | none or divisibility (default: none) |
divisor |
integer | Used when pattern=divisibility to color entries divisible by this number |
showFormula |
boolean | true or false — whether to show binomial formula below each value |
⚠️ Note: To avoid parsing errors, all options must be written on the same line. Do not use line breaks or trailing commas.
\PascalTriangle\PascalTriangle[rows=6, nodeType=rect, radius=0.8, margin=0.08, fontSize=0.7]\PascalTriangle[pattern=divisibility, divisor=3, radius=0.9, margin=0.04, fontSize=0.7, showFormula=true]\PascalTriangle[rows=13, pattern=divisibility, divisor=5, radius=0.5, margin=0.03, fontSize=0.7]This project is currently not under any license. Please contact Hubert Misonia before using it for commercial or redistribution purposes.
Hubert Misonia — @HubertMisonia on GitHub









