[OS X TeX] Creating a Sensible PDF Document

Jonathan Kew jonathan_kew at sil.org
Tue Feb 6 17:15:04 EST 2007


On 6 Feb 2007, at 9:04 pm, Jeffrey J Weimer wrote:

> I have been previewing the multitude of wonderful documentation on  
> font usage within LaTeX with the goal of determining HOW to achieve  
> one thing, namely, create a sensible PDF document file. I define  
> sensible by two parameters: document size (smaller is better) and  
> cross-platform printability (multi-platform is better). The  
> independent variable in my tests is font(s) within the document. A  
> constraint in my typesetting is, graphics should be included during  
> the processing directly from PDF formatted image files.
>
> Does the list below adequately summarize the three choices one has?

There are two major variants of your choice 3 (see below).

>
> 1. To Create the Most Sensible PDF Document
> \usepackage[T1]{fontenc}
> \usepackage{mathptmx, helvet}
> -> typeset w/ TeX + Ghostscript
> * pro: creates the smallest directly portable document
> * cons: all figures must be available in .eps format, requires  
> longer compile time compared to a pdftex option, and the two fonts  
> used may be aesthetically unpleasing/unacceptable to some for  
> quality documents
> * note: using pdftex for typesetting speeds up the compile time and  
> allows the use of .pdf images however it reduces the portability of  
> the document by moving away from the standard 35 PDF T1 fonts

Note that as document length increases, the benefit of using the  
standard fonts and avoiding any font embedding becomes negligible  
compared to the overall size of the document (and other aspects of  
the space-efficiency of the PDF code generated).

I just compared the results of latex+dvips+ps2pdf14 versus xelatex 
+xdvipdfmx (see below) and found that while a short (3-page) document  
generated a smaller PDF using your option (1), duplicating the text a  
number of times to make a 23-page version resulted in a much smaller  
PDF with (3b).

> 3. To Create a Sensible PDF Document using MacOS/TrueType/Unicode  
> Fonts
> %!TEX TS-program = xelatex
> %!TEX encoding = UTF-8 Unicode
> \usepackage{fontspec,xunicode}
> \setXXXfont{font family}
> ...
> -> typeset directly
> * pros: significant font variability possible and figures can be  
> in .pdf format
> * con: creates a larger PDF document (that has potential cross- 
> platform printing problems if glyphs are missing due to sub-setting  
> of embedded fonts???)
> * note: this is a less-error prone path to follow when compared to  
> the work needed to setup Font Packages

Let's call this (3a).

Then there's choice 3b: xelatex can be run (on Mac OS X) with either  
the default xdv2pdf output driver, or with xdvipdfmx (the portable  
driver also used on Linux/Windows/etc). The results can be  
dramatically different: in many cases, xdvipdfmx generates  
significantly more compact PDF. To do this, you call xelatex with the  
-output-driver option, e.g:

   xelatex -output-driver="xdvipdfmx -q -E" myfile.tex

(which can be put into a custom engine for TeXShop; this has been  
discussed a few times on the XeTeX mailing list).

Note that I have also seen some problems with PDF generated by  
xdv2pdf being rendered incorrectly on some PostScript devices. It's  
unclear whether this is due to bugs in Apple's PDF generation or in  
the printer drivers or PS interpreters, but I suspect that xdvipdfmx  
might produce more "robust" PDF. I'd recommend giving it a try.

(YMMV, of course.)

JK


------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/





More information about the MacOSX-TeX mailing list