Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
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 '11 at 17:38
add comment

1 Answer

up vote 4 down vote accepted
  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:

    \usepackage[paperwidth=\maxdimen,paperheight=\maxdimen]{geometry}
    

    to set the page size first to maximum.

share|improve this answer
    
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,tightp‌​age,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 '11 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 '11 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/…. –  Martin Scharrer Apr 1 '11 at 17:52
    
Sorry! At the time I didn't know it made a difference. –  Adam Apr 2 '11 at 18:18
    
Worked perfectly, thank you so much! –  Adam Apr 2 '11 at 22:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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