1. A method comprising: receiving from a first 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, by employing an expectation-maximization approach, wherein the probabilistic model is based on a first probabilistic distribution specifying an extent to which a layout allocation fits a page height-wise and width-wise and a second probabilistic distribution specifying an extent to which the layout allocation is aesthetically pleasing by determining the hyper parameters based on a mean of a distribution of parameter vectors determined from the example pages, and an inverse of a covariance matrix of the parameter vectors, parameters of the parameter vectors weighted according to an extent to which the parameters are closed to the parameter vectors; receiving text and graphics from a second user, by the processor; laying out the text and the graphics received from the second user on a page, by the processor using the probabilistic model for the mixed text-and-graphics layout template for which the hyper parameters have been optimized; and outputting the page.