Thursday, April 7, 2011

TexShop MacTex US letter PDFs

By default when you install MacTex and use TexShop for writing and compiling latex you will get PDFs with page size A4. This is all fine for most cases but some conferences require you to submit in US letter format and do not accept A4. This is where the problem begins and all sorts of solutions are proposed on the Web and most require you changing your entire latex configuration to produce US letter size (at least temporary until you revert those changes back to A4). Naturally, I tried those solutions (giving up the hope of finding a solution that can do this paper size change per document basis as it should be and not for the entire latex system) but failed. So I adopted the following command line approach and it works like a charm even without having to modify a single configuration file.

So I thought I would share this solution with the rest of the world.


  1. First things first. Write your document using TexShop (producing A4 size PDFs as it is done by default) and concentrate on the content of the document. At the end of the day that is what matters most. :-)
  2. Now open a Terminal and type the following command to produce a dvi file.
    /usr/texbin/latex mypaper.tex
    Of course, the path to latex (/usr/texbin/latex) depends on your MacTex installation and this is the default installation path. This will produce the 'mypaper.dvi' file.
  3. Now we can convert this dvi to a PDF with suitable page size (US letter in this case) using the following command.
    /usr/texbin/dvipdfm -p letter mypaper.dvi
    This command will produce the 'mypaper.pdf' with the US letter paper size. By the way the dimensions for those two sizes are as follows.
    US letter: 215.9mm x 279.4mm
    A4: 210mm x 297mm source is Wikipedia.
  4. This does the trick! Of course you can also produce a postscript (ps) file if you want to. (Some publishers ask for this one as well.)
    /usr/texbin/dvips -t letter mypaper.dvi -o mypaper.pdf
    Another option to generate a pdf is from this ps file. You can use Acrobat distiller for this purpose. But then why would need to do that when you can do that directly using dvipdfm from the dvi file.
Well, at the end of the day there is no alternative to the power of the command line.... :-)

Additional Note
If you are using pdflatex and do not want to go through the above tex->dvi->pdf routine OR you are compiling with sig-alternate class in the ACM template, creating US letter size PDFs might be difficult.
A good reference is here.
The solution proposed in that reference is to put the following page size modifying lines in the preamble of the document (where you would put \usepackage commands and is prior to \begin{document} is called the preamble in a tex document.).

\setlength{\pdfpagewidth}{8.5in}
\setlength{\pdfpageheight}{11in}



This indeed works!

No comments:

Post a Comment

Continuously monitor GPU usage

 For nvidia GPUs do the follwing: nvidia-smi -l 1