20060117

pdflatex and letter paper

One of the slight irritations in my life was getting pdflatex to output on US letter paper. For some reason, whatever I did, setting [letterpaper] options in the documentclass settings, trying to edit the pdf configuration files and so on, I didn't seem to have much luck. Eventually I found a fix: putting the lines
\setlength{\pdfpagewidth}{8.5in}
\setlength{\pdfpageheight}{11in}

in the preamble seemed to work, but seemed a bit clunky.

Then today, I found a new fix: putting
\usepackage{graphicx}
in the preamble seems to fix the paper size. I have no idea why. In the event, I seem to have this line in a lot of tex files I write since it's used to include graphics. That explains why it's only in a few cases that I've struggled with this problem. It's funny, in all the searching I've done for this problem, I've never seen anyone suggest this solution, so I'll post this here on the offchance that it helps someone else. Or rather, for next time I have the same problem and can't rememeber what I did last time to fix it...

Edit June 06: It seems to have broken again on my system, and the graphicx trick doesn't seem to work anymore. I tried something called 'texconfig', but this didn't seem to make any difference. So, back to the tried and tested pdfpagelength technique. (This seems to partly be a problem with the ACM's sig-alternate style, I think, since it was working fine till I switched class files.

Edit November 06: Here's a slightly cleaner way that means that people still living in the past and using latex -> dvips -> ps2pdf can still compile the same file: include
\usepackage{ifpdf}
\ifpdf
\setlength{\pdfpagewidth}{8.5in}
\setlength{\pdfpageheight}{11in}
\else
\fi

Of course, then you need ifpdf, but it's part of most modern tex distributions (as indeed is pdflatex, which rather renders the whole effort redundant, but means that I can just send people the ifpdf file to get it to compile if they don't have it).

Edit April 2008:
Another thing to remember: when compiling with the ACM style files, remove all use of the 'fullpage' package (and probably other packages that play around with the page size, such as geometry). Otherwise, for some reason, LaTeX creates a never-ending stream of blank pages.

13 comments:

Anonymous said...

!!!!!!!!!!
i lost 2 hours before read your blog

gracias gracias gracias

Anonymous said...

Thanks man, you saved me a lot of searching.

Oscar Levin said...

I too was having this problem, but I solved it as follows. In a terminal I typed "sudo texconfig-sys paper letter"
After that, things worked well.

IT Grease Monkey said...

This all works great. Kudos to Scar and his terminal wizardry. The only weird thing that results from all this is that, if you look at the properties in, say, evince, it lists the format as U.S. letter/paper, but also labels the format as landscape. I find this to be very perplexing. The document prints out normally in portrait. So I guess it must just be a bug with latex. The document is clearly not in landscape format, but in portrait. Just something weird I thought I'd bring up.

Viliam said...

There is "texconfig" utility which allows you to change default paper size. Works perfectly for me.

Anonymous said...

This problem seems to be exclusively with the sig-alternate style, at least on my setup.

Anonymous said...
This comment has been removed by a blog administrator.
Micha said...

If letterpaper is a global option, you may include the `geometry' package, which does the job just fine.

Anonymous said...

Thanks for the tip, saved me a lot of time and anger!

Anonymous said...

Thanks that helped. Strangely the acm style seems to ignore page size options.

Aaron Bramson said...

Thank you so much. A very easy solution to an elusive problem since, like you, most of my documents have graphicx anyway. And then all of the sudden...what is this?

Anonymous said...

Here is another solution that I found that works for me with miktex 2.9:

http://tex.stackexchange.com/questions/117816/using-us-letter-within-an-acm-paper

Note: The solution is the second entry, not the question at the top.

Anonymous said...

thank you. In an internet full of hints to the geometry style, which unfortunately breaks the ACM style formating, your blog entry is a life saver.