Friday, August 26, 2005

How to make figures in xfig using latex fonts/equations

1. First, start xfig with some special arguments:

[fake_unix_prompt]$ xfig -specialtext -latexfont -startlatexFont default

2. Create your figure; to insert a math formula enter it as you would in latex (ie, $a = \alpha \beta$).

3. Export figure as ps/latex. write "test.pstex".

4. Two files will be created. One is a postscript file (.pstex), the other is a tex file (.pstex_t).

5. In the latex document you wish to include the figure from, add "\usepackage{graphicx}" and "\usepackage{color}" at the top of the file. To include the figure, use "\input{.pstex_t}".

6. Note: If you wish to save the figure to a different directory from your main latex file, you will need to edit .pstex_t to reflect the new location of the file. For example, suppose your main latex file is ~/paper/paper.tex and your newly created figure files are ~/paper/figures/figure.pstex and ~/paper/figures/figure.pstex_t. You will need to change the second line in figure.pstex_t from "\includegraphics{figure.pstex}" to "\includegraphics{figures/figure.pstex}".

http://louis.ucsd.edu/~nalldrin/xfig_latex_howto.php


If we want to change the size of the figure:

\scalebox{0.5}[1.5]{ % horizontal 0.5, vertical 1.5

\input{hi.pstex_t}}


or

\resizebox{3in}{1in}{

\input{hi.pstex_t}}


The following can deal with image:

Spacing - \vskip-2in \hskip4in

Scaling - \scalebox{horizontal factor}[vertical factor]{item scaled}

Resizing - \resizebox{horizontal factor}{vertical factor}{item resized}

Rotating - \rotatebox{angle of rotation}{item rotated}

Reflecting - \reflectbox{item reflected}

Centering - \begin{center} centered items \end{center}

No comments:

Post a Comment