The mathematics of creasing