Factor Tree Examples#

This page demonstrates the factor-tree directive, which creates visual representations of prime factorization using tree diagrams.

Basic Usage#

Default factor tree for 68:

Different Numbers#

Factor tree for 24:

Factor tree for 120:

Factor tree for 84:

Custom Styling#

Wider angle (40 degrees) and longer branches:

Larger font size:

Custom Sizing#

Custom figure size (4x4 inches):

Custom display width:

Percentage width:

Alignment#

Left-aligned:

Right-aligned:

With Captions#

Fig. 26 Prime factorization of 144 showing the factor tree breakdown.#

YAML-Style Configuration#

Fig. 27 Factor tree for 180 using YAML-style configuration.#

Large Numbers#

Factor tree for 360:

Prime Numbers#

When the number is prime, it shows just a single node:

Features#

The factor tree directive:

  • Automatically calculates prime factorization

  • Creates visually appealing tree diagrams

  • Supports customizable angles, branch lengths, and font sizes

  • Generates responsive SVG graphics

  • Includes accessibility features (ARIA labels)

  • Uses content-based caching to avoid regeneration

  • Supports captions and cross-references