Generalizing the classical theorems of Max Noether and Petri, we describe generators and relations for the canonical ring of a stacky curve, including an explicit Gröbner basis. We work in a general algebro-geometric context and treat log canonical and spin canonical rings as well. As an application, we give an explicit presentation for graded rings of… (More)