1. A method comprising: receiving from a user, by a processor, a plurality of example pages in which text and graphics have been laid out using a mixed text-and-graphics layout template; and, optimizing, by the processor, a plurality of hyper parameters of a probabilistic model for the mixed text-and-graphics layout template, based on the example pages.