Friday, September 3, 2010

How to use Latex formulas with xfig

Source :

  • Use the normal method in xfig for adding text, but set the "special text" mode using the "Text flags" menu at the bottom of the screen for math mode.
  • To input LaTex set the "special text" mode using the "Text flags" menu at the bottom of the screen.
  • Then use text tool and write $...$ to switch to math-mode. 
  • Type the equation.
  • Export the figure from xfig : using the format "Combined PS/LaTeX (PS part)".
  • Two files would be created: foo.pstex and foo.pstex_t
  • Now save the following as some file, say create-xfig-eps and make it executable -

    cp $1.pstex_t temp.pstex_t
    cp $1.pstex .temp.pstex
    echo "\documentclass{article}
    \end{document}" > temp.tex
    latex temp.tex
    dvips -E temp.dvi -o $1.eps
    rm temp.*

  • cp the files file.pstex* in the same directory and run the create-xfig-eps script as

    create-xfig-eps foo

    No extension is needed. But it doesn't check also whether foo exists. So be careful and copy the file before otherwise the rm might erase else.
  • The foo.eps is the file needed.
To make xfig experience more pleasurable add the following alias to .bashrc so that xfig environment is set to use grids etc. on startup.

alias xfig='xfig -geometry 950x700+50+20 -metric -startgridmode 3 -specialtext -latexfonts -startlatexFont default'

    No comments:

    OK GOOGLE on Samsung Galaxy S7 doesn’t work

    To make Ok Google detection work on Galaxy S7 (Galaxy series phones) we need to perform a couple of steps. 1. As long as Samsung S vo...