You are hereBlogs / David Grant's blog / Creating Pretty PDF Files From Latex

Creating Pretty PDF Files From Latex


By David Grant - Posted on 30 July 2006

To create good PDF files which look good in Adobe Acrobat even at maximum zoom levels:

  1. First run latex as many times as you need to resolve all references. This will produce your final *.dvi file. Let's assume it's called myfile.dvi.

    latex myfile.tex

  2. Now that we have our myfile.dvi file, we need to convert it to postscript. This is the safest step for most applications. For example some Latex features will not appear in the document unless the *.dvi file is first converter to a Postscript (*.ps) file. One example is shading, by using the Latex shading package (available on CTAN). The "other" method I am elluding to is by converting directly to PDF by using dvipdfm or pdflatex. This usually works fine, however, I recommend going to Postscript first using dvips. You need to provide two key arguments: a) the paper size, and b) a PDF option. The paper size option is usually necessary because dvips is set up for A4 paper by default. Note, even if your postscript file looks like it fits on the page properly, it may not once you convert it to a PDF! The PDF option is necessary so that dvips includes outline fonts instead of bitmap fonts in the Postscript document. This is what will make our fonts look pretty in the final PDF document, and will allow the fonts to scale themselves when we zoom in. So the command we need to run is:

    dvips -t letter -Ppdf myfile.dvi

    This should produce some output similar to that shown below:

    This is dvips(k) 5.86e Copyright 2001 Radical Eye Software (www.radicaleye.com) TeX output 2003.03.04:0123' -> myfile.ps
          <tex.pro><alt-rule.pro><texc.pro><texps.pro><special.pro>. <cmr8.pfb>
          <cmti10.pfb><cmbx10.pfb><cmbx12.pfb><cmsy10.pfb><cmr10.pfb>[1] [2] [3]

    If we had of just run:

    dvips -t letter myfile.dvi

    we would have gotten the following output:

    This is dvips(k) 5.86e Copyright 2001 Radical Eye Software (www.radicaleye.com)
          ' TeX output 2003.03.04:0123' -> resume.ps
          <texc.pro><special.pro>. [1] [2] [3]
     
          The *.pfb files are font files, and they are now being included

  3. After running the above command, a myfile.ps file will have been created. It will appear larger than it did before because it will have some fonts embedded inside the document itself. Now the last step is easy. We need to run ps2pdf:

    ps2pdf myfile.ps

    This should produce a myfile.pdf file. Opening the file up with Adobe Acrobat should show that the fonts are now *pretty* and will appear very nice at 400% zoom and upwards.

Tags

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <s> <img> <h2> <h3>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. The supported tag styles are: <foo>, [foo].
  • Insert Google Map macro.
  • Images can be added to this post.
  • You may use [inline:xx] tags to display uploaded files or images inline.
  • You may use [view:name=display=args] tags to display views.

More information about formatting options

CAPTCHA
Sorry I had to add this test to combat the spam problem.
a
8
d
U
k
8
Enter the code without spaces and pay attention to upper/lower case.