I have a problem which can be solved one of two ways:

  1. Typeset a given chunk of TeX in an "infinitely wide" space, then scale the result so that its width is the width of the page.

  2. Typeset a given chunk of TeX in an "infinitely wide" space, then set the page size to the width of the result.

Can anybody suggest how to do this with pdflatex? Unfortunately I can't use other TeXes like XeTeX, etc.

  • FWIW, my document consists of several display-mode math ($$xyz$$) elements which are extremely wide, and nothing else. This appears to make the problem more difficult: many of the packages designed for this purpose can't use math-mode stuff in the detection of the proper page dimensions.
    – Adam
    Apr 1, 2011 at 17:38

1 Answer 1

  1. can be done using the graphics package and \resizebox{\paperwidth}{!}{<content>}

  2. can be done using the preview package (or with the standalone class using it). You need to set the preview border to 0 for that. For overly large material use:


    to set the page size first to maximum.

  • Hrm, neither of these work if the contents are larger than the page size. For example, I tried \usepackage[paperwidth=200in,centering]{geometry}\usepackage[displaymath,tightpage,active]{preview}\begin{preview} and the page is still 200in wide. Removing the \usepackage{geometry} crops off the sides of my content.
    – Adam
    Apr 1, 2011 at 17:34
  • Perhaps I ought to mention that my document consists only of display-mode ("$$xyz$$") maths which are very wide, and nothing else. I need to set the page width based on the math -- there's no text body to use.
    – Adam
    Apr 1, 2011 at 17:37
  • @Adam: You should have mentioned that it is display math from the beginning. Have a look at tex.stackexchange.com/questions/13981/… and tex.stackexchange.com/questions/13213/…. Apr 1, 2011 at 17:52
  • Sorry! At the time I didn't know it made a difference.
    – Adam
    Apr 2, 2011 at 18:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .