Home Contact Research Tools LaTeX

fig2pdf Manual Page


fig2pdf (version 2011/06/01) - converts FIG files to EPS and PDF


fig2pdf [options] figfile(s)

The shell script fig2pdf converts the FIG files specified on the command line to an EPS file and a PDF file. The files to be converted must have the extension .fig, but you do not have to specify the extension on the command line explicitly. File names containing spaces will cause an error. By default, text objects in the input file foo.fig that have the special flag on, are included in the output file foo.eps by running latex, dvips and pdflatex. Alternatively, when the -t or -T option is used, fig2pdf will not include the special text objects in the output files, but instead produce separate tex code to include the EPS file and overlay it with the special text objects in a LaTeX document.



This option makes fig2pdf assume that \unitlength is equal to 1bp (instead of 1pt) when you're using the -t or -T option.


If you have an older version of dvips, the Bounding Box of the generated EPS file might not be right. This option tells fig2pdf to let Ghostscript fix the Bounding Box.

-c class

With this option you can specify the document class to be used when the script invokes latex. The document class must be specified as follows: any class options must be given first as a comma-separated list between square brackets, and the class options must be followed immediately by a (optional) class name (no space between the right bracket and the class name). If you leave out the class name, the default class article will be used with the specified options.


If you want to produce color output, use this option. This will include the color package and reproduce any colors specified in the FIG file(s) in the output. However, colors may come out wrong or not at all with some versions of transfig.

-d res

Normally, fig2pdf uses Ghostscript as a distiller to generate small EPS files. This option specifies the resolution used by the distiller (in dots per inch). A resolution of 0 dpi will suppress the use of the distiller, which can result in a much larger EPS file. However, this will also suppress the conversion of fonts to bitmaps, which can be useful for Type 1 fonts.


Equivalent to -d 0, suppresses the Ghostscript distiller.


Force fig2pdf to overwrite existing files, instead of pausing and prompting you.


This causes fig2eps to respect the font sizes specified in the FIG file, which are normally ignored in favour of the LaTeX fonts specified by the document class and packages.

-i "tex code"

Use this option to insert tex code into the document preamble before the latex run. You can use more than one instance of -i if you like. The code is inserted in the order given on the command line, and after any code specified in the FIG2EPS_CODE or FIG2PDF_CODE environment variable (see below).


Keep temporary files created by fig2eps for debugging.

-l level

Sets the PDF compatibility level. Here the level must be either 1.2, 1.3 or 1.4. The default level is 1.3.

-p packages

This tells the script which packages you would like it to include when running latex. This allows you to change the document fonts, use your personal LaTeX macros, etcetera. The packages must be specified as a comma-separated list. Package options can be specified directly in front of the package name to which they apply, as a comma-separated list between square brackets (similarly to the syntax of the -c class option discussed above). Fig2eps always includes the graphicx package, and it includes the package color if you use the -C option.

-r res

This specifies the font resolution used by dvips to generate the EPS file. A warning message will report missing fonts.


This will make fig2pdf produce EPS and PDF files without embedded special text objects. Instead, LaTeX code is sent to the terminal which can be copied into a LaTeX document to include the EPS or PDF file and overlay it with the special text objects.


Similar to -t above, except that the LaTeX code is sent to a TEX file which can then be \input into a LaTeX document.

Environment Variables

You can use the FIG2EPS_CODE and FIG2PDF_CODE environment variables to include extra tex code in the document preamble before the latex or pdflatex run. The expansion of FIG2EPS_CODE will be used in the creation of the EPS file, and the expansion of FIG2PDF_CODE will be used for the PDF file. Additional tex code specified with the -i option will be inserted after the code of the environment variable, and can be used to override this code.


When an error occurs, fig2pdf tries to trap this error and return an error report. Common mistakes like forgotten dollar signs and forgotten braces detected during the latex run can easily be corrected this way. Beware that fig2pdf does not check for the correct syntax of the arguments to the -c and -p options.


Suppose that you are preparing a document which uses the txfonts at a size of 12pt. You have several FIG files in the current working directory containing figures for this document. Suppose that the special text in these files contains some macros that are defined in your own package mysty.sty, that should be included with the options one and two. Then you would type

fig2pdf -c [12pt] -p txfonts,[one,two]mysty *.fig

to convert all these FIG files to EPS and PDF, using the correct fonts and macros.

If you quickly want to change the fonts of your figures to sans-serif, you could type

fig2pdf -i "\renewcommand{\familydefault}{\sfdefault}" *.fig