Sunday, January 12, 2014

Tools/procedures for generating high-quality PDF/EPS files with LaTex math

Without using pricey licensed softwares, you can generate high-quality PDF/EPS files with LaTex math expressions, as shown in the following. Other procedures may work as well, but the following have been tested and may save some time.

1. Drawing tools and procedures

To make your own figures with LaTex math, you may use LibreOffice Draw. To enable LaTex, in Tools --- Extension Manager..., add TexMaths (http://roland65.free.fr/texmaths).

You may also use Inkscape. For math expressions, use Extensions --- Render --- LaTex formula ...

Both LibreOffice Draw and Inkscape are free.

On the other hand, if you have MS Office, you may use Powerpoint to draw, with TexPoint ($30~$45) or IguanaTex (free) for math expressions.

After drawing, export or save as a PDF file and embed all fonts. Converting to other file formats may be not preserve all formats/information.


2. PDF tools and procedures

This PDF file should have all fonts embedded. To check, use:
pdffonts a.pdf

to make sure all fonts are embedded correctly.

To generate an EPS file with a bounding box or a PDF file with only the drawing area kept, do:
pdfcrop a.pdf b.pdf

This removes the white space around the drawing area in a.pdf and generates an output file b.pdf.

If EPS format is desirable, perform:
pdftops -eps b.pdf

This is generate b.eps with the bounding box.

If Adobe Acrobat Professional is available, you may also crop the pdf using it, and save as another PDF file or save as an EPS file.

3. Include the drawing file in LaTex document

The b.pdf file or b.eps file can be included in a LaTex document using e.g.:

\begin{figure}[h]
\begin{center}
\subfigure[]{\scalebox{.6}{\includegraphics{b1}}}
\subfigure[]{\scalebox{.6}{\includegraphics{b2}}}
\end{center}
\end{figure}


If no file extension is specified, PDFLaTex will look for b1.pdf, b2.pdf, etc., and LaTex will look for b1.eps, b2.eps, etc.


If LaTex --> dvi2ps --> ps2pdf procedure is to be followed, make sure the option
-Ppdf 
is used for dvips, and the options
-dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress 
are used for ps2pdf.

If PDFLaTex or the like is to be used used, set the following option:
updmap --setoption pdftexDownloadBase14 true 


The produced PDF file should have all fonts embedded and high-quality figures. You may use pdffonts to verify.


No comments:

Post a Comment