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.

  • 2
    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
  • 1
    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

Well I manged to find a solution that works for me, although it may not help to everyone. So, the solution is not in the tex file but in the python script: After compiling the document ones with the default

\pdfpagewidth = 597pt


\pdfpageheight = 845pt

I scan the log file to see if there are Overfull \hbox or \vbox errors and if there are I change the width and height values in the tex file and compile it again.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.