fig2pstricks - convert xfig to pstricks


Source: Version 0.7.2 (33KB, tar.gz). You need a C compiler.
MS-DOS binary: Version 0.7.1 (90KB, compiled by MinGW). Version 0.7.2 is not available as I don't have MinGW with me now.
If you like it, drop me a line at chirok(dot)han(at)gmail(dot)com.

News (2013-01-21)

Version 0.7.2 released (changelog.txt).

News (2011-02-04)

The web site is back.

News (2009-02-18)

Version 0.7.1 released.
A minor bugfix and feature enhancement

What is fig2pstricks

Fig2pstricks converts a xfig or equivalently a fig file to pstricks. Current version works with FIG 3.2. I wrote it for my personal purpose of teaching econometrics. It's not bad to use it to process an xfig (or fig) file generated by the xfig() device of R.

Go to Freshmeat project page.


Here is a sample R file which generates leastsq.fig file. Then the fig file is processed by fig2pstricks to produce leastsq.tex (command: fig2pstricks leastsq.fig -o leastsq.tex -c --prosper -d -T "A Simulation"). You can run 'latex leastsq' (twice if necessary), followed by 'dvips leastsq' and 'ps2pdf'. Here is the resulting pdf file.


A screenshot for the pdf slide generated by R and fig2pstricks with Prosper is found here. The pdf file is here. The R source is here (with data from Ramanathan, Introductory Econometrics with Applications).


README, Changelog.

No manual page is available. (I have no time to write it.) But you can use "--help" (or "-h") option for help. Here is the output of fig2pstricks --help:

$ fig2pstricks --help
fig2pstricks: A fig to pstricks converter
Usage: fig2pstricks [options] [input_file]
    -o FILE           Set output file to FILE, default=stdout
    -c                Produce complete latex file
    -u UNIT           Specify unit, (default=1cm)
       or ux,uy       xunit is ux, yunit is uy (eg 1in,2.54cm)
                      use in, cm or mm (default=cm)
                      unit is unit*scale (cm)
    -s SCALE          Scale factor is SCALE (default=0.8)
       or sx,sy       x scale factor is sx, y scale factor is sy
                      unit is unit*scale (cm).
    -12               Add '12pt' in the document option.
                      effective only when used with -c.
    -11               Similar to -12 except that it adds '11pt'
    -p PADDING        Padding in fraction of unit (default=0.5)
    --prosper         Output with full Prosper support.
    -T title          Set the slide title to title in prosper.
                      Ignored in non-prosper mode
    -F format         Prosper style format (default=default).
                      One of frames, lignesbleues, azure, troispoints,
                      contemporain, nuancegris, darkblue, alien glow,
                      autumn, gyom, rico and default.
                      Ignored in non-prosper mode.
    -d, --use-dot     Convert ellipses to dots instead of ellipses
    -m, --math-label  Use math (enclosed by two $'s) for labels
    --empty           Append \thispagestyle{empty} when -c is enabled
                      This option is good for producing eps and pdf files
    --latex-symbols   Convert characters to latex commands
    --ignore-specials Ignore depth change specials
                      See --depth-help option.
    --depth-help      Help on bringing forward or sending backward objects.
    -v, --version     Show version
    -h, --help        Show this help

How to create nicely bounded eps and pdf for latex and pdflatex

Xfig (fig2dev) converts xfig files to eps and pdf format. (See man fig2dev.) But they don't take care of math symbols. We can use the --empty option to hide the page number so dvips, ps2epsi and epstopdf can create proper graphic files. This is sometimes handy. See the following example.

$ fig2pstricks -c --empty input.fig -o output.tex
  ### try scaling with the -s option
$ latex output
$ dvips output
$ ps2epsi output.eps
$ epstopdf output.eps

If you don't use the --empty option, then the created eps and pdf files will contain the page number as well, resulting in a strange graphic.

Copyright, excuses, porting

Fig2pstricks is released under GPL version 2.0. It may contain errors. Please do not expect any beauty in the program logic for I am just a novice amature programmer and I wrote this solely for my personal purpose.

There may be out there some good ones. But I had no time to search, and decided to write one myself.

It's written on Linux. I think no OS specific codes are included, so it should compile on other operating systems.

{ 4610 visitors since 19 July 2007 }

Warning: fopen(./access.log): failed to open stream: Permission denied in /Users/chirokhan/Sites/fig2pstricks/index.php on line 236