# A general method for a document to extend as much as needed in order to fit the content of the document

I have a python script that automatically creates a LaTex document for a given input. In this document, I have a lot of proof trees (created using the bussproofs package), though it doesn't really matter what are these proof trees. The point is that in some cases the resulted proof trees are either too long horizontally or too long vertically and that result in the proof trees not fitting in the page and making erros. So, I would like to adjust the page width or height if needed in order for all the content to fit inside the page. The problem is that I can't just put some maximal value for the page width and height.

So, I would like to put a few commends so that the page width and height would extend sufficiently in order to fit any content whatsoever.

I should note that here an answer for how to extend the page width in order to fit one line of text of arbitrary length was given, if that helps someone to come with a solution.

• Maybe the standalone document class can help? – frougon Mar 5 at 10:50
• I'm not familiar with this document class what is it used for? – Michael Novak Mar 5 at 10:53
• The site is full of examples, e.g. here. It is typically used with one tikzpicture inside the document environment, and the output is then an automatically-sized PDF file by default, but you can put one minipage or one varwidth environment inside the document environment if you have something more text-like, IIRC. – frougon Mar 5 at 11:07
• For the height tex.stackexchange.com/questions/19237/… could work. – Marijn Mar 5 at 18:35
• @frougon I tried your suggestion, but it isn't useful for me, because it only works if the content is not too wide or too long, so it's not really different from using a normal article class document. – Michael Novak Mar 5 at 19:42

\pdfpagewidth = 597pt
\pdfpageheight = 845pt