Attila Máté's home page



Producing PDF from TeX








    PDF files can be viewed by using Ghostview (see Ghostscript, Ghostview and GSview), Xpdf, or Acroread (see Adobe Acrobat). Among these, Ghostview can also be used to view PostScript files; the others cannot. A most useful feature of Ghostview is that it lists the PostScript coordinates of the mouse cursor when viewing a (PostScript or PDF) file. This is useful when editing (e.g., adding text to) a PostScript file. PostScript has an additive property: text can be added at a certain simply by specifying its coordinates, and one does not need to try to figure out how the rest of the page was produced. This feature of PostScript can be used to add figures to tax forms (distributed in the USA by the IRS in PDF form, which can be converted to PostScript by Acroread). Filling in tax forms manually this way is not that productive, but a program written in C or Perl to enter data is quite useful. It is fairly easy to write a program that calculates and enters all the data on a tax form provided the basic data needed for the calculation are given in a few text files.

    The sources for these PDF files were written in AmS-TeX, where AMS stands for the American Mathematical Society (see American Mathematical Society: Mathematics Research and Scholarship), and TeX (see TeX Users Group (TUG) home page) is the scientific typesetting system designed by Donald Knuth (see Don Knuth's Home Page). Fedora Core Linux (see Fedora Project, sponsored by Red Hat) operating system was used in all computer processing of these files. More about Linux can be read at Linux International; current Linux news can be read at Linux Today - Linux News On Internet Time.. The Perl programming language (see Perl Mongers) was used extensively in processing files in producing the AmS-TeX source files and the resulting PDF output.

    There are known issued involved in producing PDF output from TeX sources. The main issue is that the command dvips normally produces Type 3 PostScript fonts, but these are not properly supported by the current Acroread pdf reader, and when viewing these files with Acroread the fonts look jagged. Xpdf does not support Type 3 PostScript fonts at all, so files containing Type 3 PostScript fonts cannot be viewed by Xpdf at all. There is no problem when viewing files containing Type 3 PostScript fonts with Ghostview.

    To avoid these problems, one needs to produce PDF files with Type 1 PostScript fonts. The site PDF Output from LaTeX, among others, recommends the following commands (in Linux or Unix) to do this:

  tex myfile
  dvips -Ppdf -G0 myfile.dvi -o myfile.ps
  ps2pdf -sPAPERSIZE=letter -dMaxSubsetPct=100 -dCompatibilityLevel=1.2 \ 
    -dSubsetFonts=true -dEmbedAllFonts=true myfile.ps
This works most of the time, but in the output they produce, the small superscripts formula in Problem 6 of the Junior Exam of 2003 are not rendered properly in Acroread unless one uses a magnification of at least 200 %; Ghostview and Xpdf work properly. Interestingly, even Acroread works properly in rendering exactly the same formula at 100% of magnification, produced from the same TeX source, when viewing the solutions to the problems on both exams. In order to make even Acroread work correctly even on the Junior Exam of 2003, the commands
  tex myfile
  pdftex myfile
were used to produce all pdf files, using version
  pdfTeX (Web2C 7.3.1) 3.14159-0.13d
  kpathsea version 3.3.1
This version of pdfTeX is beta software, and we have experienced problems with it on certain complicated TeX files. It did produce a correct output for the pdf files mentioned here.


Last updated: Tue Mar 13 18:50:18 EDT 2007.



Attila Máté's home page