Getting pdflatex to embed all fonts

It’s camera ready submission time!  You know what that means: reading over hastily written notes by publishers about how to correctly generate a PDF file for their system., trying to guess how they apply to your modern system, and figuring out how to check the things that require the full Adobe Creative Suite in Linux.

My latest adventure was in getting all fonts embedded into a pdflatex file.  There are two problems that arise:

  1. pdflatex embedding its fonts
  2. pdflatex embedding pdf files that do NOT contain their fonts.

Case 1 is now standard on modern latex distributions.  See the post below and check your latex distribution.

Case 2 is more interesting.  The issue: gnuplot and R generate eps output.  If this output is converted to pdf using epstopdf, then the pdf files do NOT contain embedded fonts.  pdflatex does not add these fonts when it processes your tex.  Thus, you must recreate the embedded pdf files WITH fonts.

The website http://techlogbook.wordpress.com/2009/10/14/how-to-embed-fonts-when-using-pdflatex-and-gnuplot/ explains one way to do this.  However, that method involves editing a script used by Ghostscript.  However, this site mentioned the utility “pdffonts” to generate a report on the fonts included in your document.  That’s handy and avoids checking the file with Acrobat.  While changing Ghostscript’s options is reasonable, there is a better way to go about this task.

Namely: Use GS_OPTIONS and epstopdf!  (See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=411651 for the origin of this solution.)  GS_OPTIONS is a global environment variable that ghostscript reads for extra options.  Thus, we can simply set

export GS_OPTIONS="-dEmbedAllFonts=true -dPDFSETTINGS=/printer"
# and run
epstopdf myfile.eps
...

Voila!  All the new pdf files for figures contain embedded fonts.  Running pdflatex

New insights:

  • a2ping.pl is a new variant of epstopdf I did not know about.
  • I always seem to forget about GS_OPTIONS when I need it as above.
  • pdffonts is a handy way to check this issue.

References:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=411651

http://techlogbook.wordpress.com/2009/10/14/how-to-embed-fonts-when-using-pdflatex-and-gnuplot/

http://users.cecs.anu.edu.au/~luke/embedded_fonts.html

This entry was posted in Latex. Bookmark the permalink.

3 Responses to Getting pdflatex to embed all fonts

  1. Suha says:

    Thank you! That was really useful!!

  2. Thanks, David! This was really helpful.

  3. Pingback: IEEE Camera Ready 格式检查 | Here Comes the Sun

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s