注册 登录  
 加关注
查看详情
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

随机过程

http://superware.blog.163.com

 
 
 

日志

 
 

How to use LaTeX within xfig - Shell Script Option  

2012-04-20 11:16:37|  分类: Latex |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

From : http://www.eg.bucknell.edu/physics/ph329/xfig_latex.html

1Introduction

It is possible to set up xfig so that you can use LaTeX in any text you enter. There is a slight "cost" due to the fact that there is an additional step that is required to process the files made by xfig; you can't simply export figures made this way directly to an eps figure from within xfig. But if you need to include math in your label the extra step is worth it. There is also some initial setup required (see below). Additional information, including alternative methods, can be found on the LaTeX and Xfig page of the Xfig User Manual.

How to use LaTeX within xfig - Shell Script Option

(See below for Perl Option.)
  • Call xfig with the options below:

    % xfig -specialtext -latexfonts -startlatexFont default

    I use bash, so I have included these options in my .bashrc, where I also set the size of the xfig window and start up xfig with a metric grid. My .bashrc has the entry:

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

  • When entering text in xfig, simply use $ signs to indicate math mode.

  • When the figure is complete Export it to "Combined PS/LaTeX (both parts)." This creates two files: filename.pstexfilename.pstex_t and

  • At this point I use a script named xfig2eps:

    % xfig2eps filename

    This uses filename.pstex and filename.pstex_t to produce the figure filename.eps. (The script includes these files in an otherwise blank LaTeX page, compiles this page, and then extracts the eps figure; see below for details.)

  • Download the script xfig2eps, put it in a directory that is in your path, and make it executable.
  • 根据下一节的设置,这个文件有问题,需要修改,修改过的文件如下
  • #!/bin/bash

    cp $1.pstex_t ~/tmp/temp.pstex_t
    cp $1.pstex ~/tmp/
    cp ~/local/xfig_to_eps.tex ~/tmp/xfig_to_eps.tex
    cd ~/tmp

    latex xfig_to_eps.tex
    dvips -E -o $1.eps xfig_to_eps.dvi

    rm temp.pstex_t
    rm $1.pstex
    rm xfig_to_eps.aux
    rm xfig_to_eps.dvi
    rm xfig_to_eps.log
    rm xfig_to_eps.tex
    cd -
    mv ~/tmp/$1.eps ./

  • Download the file xfig_to_eps.tex. (The script xfig2eps is written assuming that xfig_to_eps.tex is in ~/local; modify as necessary.
  • %\documentstyle[aps,preprint,twoside]{revtex}
    %\documentstyle[12pt,twoside]{article}
    \documentclass[12pt,twoside]{article}
    \usepackage{amssymb,amsmath,graphics,epsfig,color}
    \pagestyle{empty}

    \begin{document}

    \begin{figure}
    \input{temp.pstex_t}
    \end{figure}
    \end{document}

  • Make a directory for temporary files. (The script xfig2eps is written assuming that this is ~/tmp; modify as necessary.)
  • The  epstopdf command can convert eps format to pdf as :  $epstopdf  filename

Example :

1.  Run xfig in you xterm, and input the following latex script with "T" tool

$\frac{\partial c}{\partial t} = \nabla\cdot M \nabla\frac{\delta F}{\delta c}$

2.  File --> Save the xfig file as the .fig format and name it as test.fig

3.  Then  File--> Export the file with "Combined PS/LaTeX (both parts)" option  in the XFig:Export menu table, then two files each named as test.pstex and test.pstext_t will be created

4.  run  xfig2eps test will create file test.eps

5.  running  epstopdf test.eps,  file formated .pdf named as test.pdf  will be generated in the present directroy. the following .pdf formated file is the final result.

How to use LaTeX within xfig - Shell Script Option - superware - 随机过程
是不是很酷!
 


2、应用举例

这是间隙原子扩散的示意图:

How to use LaTeX within xfig - Shell Script Option - superware - 随机过程
 


3、小结

       用 Xfig 画示意的草图比较方便,由于可以用 LaTeX 标注,因此可以把复杂的数学公式标注在图中。但 Xfig 也有不足之处,比如不能对图形和位置精确控制,这是 Asymptote、TiZ、Matapost 之类的强项。实际上,上图也可以用 Asymptote 和 Matapost 画出。
  评论这张
 
阅读(70)| 评论(0)
推荐

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018