Added ability to generate with specific depth and a latex conversion function