2014年5月3日星期六

ns2 validate overall report: some tests failed

Ubuntu 12.04+ns2 2.35


After installing the ns2, I got some problem by validate (./validate).

validate overall report: some tests failed:
 ./test-all-newreno ./test-all-tcpOptions ./test-all-tcpVariants ./test-all-aimd  ./test-all-frto ./test-all-quickstart ./test-all-manual-routing ./test-all-links
to re-run a specific test, cd tcl/test; ./test-all-TEST-NAME



Solution: There are some missing packages. Type the following command to install them.

sudo apt-get install libx11-dev xorg-dev libxmu-dev libperl4-corelibs-per

sudo apt-get update

sudo apt-get install build-essential autoconf automake libxmu-dev

2013年3月30日星期六

[ZT] Installing ns-2.35 in Ubuntu 12.04 LTS

As you know Ubuntu 12.04 launched on 26th April 2012 and it is a Long Term Support OS. To install ns2 in Ubuntu 12.04, it refers the same step as done in 11.10 OS. For new users, here are the steps to install ns2.35


1. Download NS-23.5 from http://www.isi.edu/nsnam/ns/

2. Go to terminal and install the necessary updates using the command “sudo apt-get update” (without Quotes)
3. Then install the ns2 required libraries using the command “sudo apt-get install build-essential autoconf automake libxmu-dev” (without quotes)

4. Untar the downloaded ns-allinone-xxx.tar.gz file using the command “tar zxvf ns-allinone-2.35.tar.gz”

5. Execute the commands one by one as given below


cd ns-allinone-2.35

./install

(You get the PATH information if the installation was successful, upon succeeding set the PATH in the relevant file .bashrc)

Type ns and see a % symbol indicates that the installation of ns2 is successful and also try the command nam so that a network animator will be opened.

For any doubts, please raise a comment in the following column. I am there to help you. If you try to install ns2 which comes along with the synaptic package manager, you cannot write new modules and recompile it. In that case, you need to use the above method of installation


For the original post please refer to http://www.nsnam.com/2012/04/installing-ns-235-in-ubuntu-1204-lts.html

2012年9月22日星期六

[ZT] Install NS2 (ns-allinone-2.35) on Ubuntu 11.04 for beginners

Part I: Introduction
#======================

This installation guide is on Linux Ubuntu 11.04 (download from here), and  uses ns-allinone-2.35 source file for NS2. I assume that you have the skill to install Ubuntu, so I skip this process, and focus on the installation of NS2 (step-by-step with commands).

#========================
Part II: Installation
#========================

[Step 1]

Before install NS2, you have to install some essential softwares:

sudo apt-get install tcl8.5-dev tk8.5-dev
sudo apt-get install build-essential autoconf automake 
sudo apt-get install perl xgraph libxt-dev libx11-dev libxmu-dev

[Step 2]

Download NS2 source file  from from here.
Then you will get a file named “ns-allinone-2.35.tar.gz

[Step 3]

Unpack ns-allinone-2.35.tar.gz to your home directory. (/home/stan is my home directory, you SHOULD change it to your own!)

tar -zxvf ns-allinone-2.35.tar.gz -C /home/stan

[Step 4]

4.1) Modify the makefile (NOTICE: I use “vi” for an editor, you can use “gedit” instead)

vi /home/stan/ns-allinone-2.35/otcl-1.14/Makefile.in

4.2) Change CC = @CC@ to CC = @CC@ -V 4.5

(For changing this because the gcc complier in Ubuntu 11.04 is version 4.5, however NS2 only supports gcc-4.3 below. NOTICE the V is capital.)

[Step 5]

Install NS2:

cd /home/stan/ns-allinone-2.35
sudo ./install

[Step 6]

6.1) Modify  .bahrc

vi /home/stan/.bashrc

6.2) Go to the last line and add the scripts below:

export PATH=$PATH:/home/stan/ns-allinone-2.35/bin:/home/stan/ns-allinone-2.35/tcl8.5.10/unix:/home/stan/ns-allinone-2.35/tk8.5.10/unix
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/stan/ns-allinone-2.35/otcl-1.14:/home/stan/ns-allinone-2.35/lib
export TCL_LIBRARY=$TCL_LIBRARY:/home/stan/ns-allinone-2.35/tcl8.5.10/library 

6.3) Enable the path setting:

cd /home/stan  source .bashrc

#======================
# Part III: Verifying
#======================

which ns

If it shows /home/stan/ns-allinone-2.35/bin/ns,  it works!

For the original version of this article, please refer to http://stanjuly.wordpress.com/2011/12/22/install-ns2-ns-allinone-2-35-on-ubuntu-11-04-for-beginners/

2012年9月21日星期五

[ZT] Howto use the IEEEtran.cls Latex class file with Lyx on Ubuntu

Howto use the IEEEtran.cls Latex class file with Lyx on Ubuntu

With the help of several Ubuntu packages using the IEEE trans Latex class in the Lyx editor is very easy. To install use apt-get:

sudo apt-get install lyx texlive \
texlive-latex-extra \
texlive-math-extra \
texlive-science \
texlive-fonts-recommended \
texlive-publishers

And if you like confirm the required files are in the correct locations:

~/# find /usr/share/ | grep -i ieeetr
/usr/share/lyx/layouts/IEEEtran.layout
/usr/share/lyx/templates/IEEEtran.lyx
/usr/share/texmf-texlive/bibtex/bst/base/ieeetr.bst
...
/usr/share/texmf-texlive/tex/latex/IEEEtran/IEEEtran.cls

Then in the Lyx editor:
  1. Tools>Reconfigure
  2. Restart Lyx
  3. File>New from template
  4. choose the template /usr/local/share/lyx/templates/IEEEtran.lyx
Very easy once you know how! The template includes all the necessary magic ERT to get the IEEE class to work in Lyx.
 
For the original version, please refer to http://www.rrfx.net/2009/06/howto-use-ieeetrancls-latex-class-file.html

2012年9月20日星期四

[ZT] Using TeXstudio with SumatraPDF


Suma­traPDF is my favourite pdf reader and TeXs­tu­dio is my favourite LaTeX edi­tor. Here’s how to get them to work nicely together.
Go to Options/​Configure TeXs­tu­dio and click on “Com­mands”. Beside Pdf Viewer, untick “Inter­nal viewer” and add the fol­low­ing command:
"c:/Program Files/SumatraPDF/SumatraPDF.exe" -reuse-instance %.pdf
(If you have Suma­traPDF stored some­where other than the spec­i­fied paths, you will need to edit this accordingly.)
Then you need to tell Suma­traPDF how to jump to the cor­rect line in TeXs­tu­dio. From within Suma­traPDF, go to Settings/​Options and set the inverse search com­mand to
"C:\Program Files\TeXstudio\texstudio.exe" "%f" -line %l
Change the path to TeXs­tu­dio if necessary.
In order to go from the tex file to the cor­re­spond­ing loca­tion in the pdf, you can add a For­ward­Search com­mand within TeXs­tu­dio. Select “User” from the main menu, then “User com­mands” and “Edit User com­mands”. Then add a com­mand with the fol­low­ing definition:
dde://"C:/Program Files/SumatraPDF/SumatraPDF.exe":SUMATRA/control/
  [ForwardSearch("?am.pdf","?c:am.tex",@,0,0,1)]
(That should all be on one line with no space before [ForwardSearch. Again, edit the path for Suma­traPDF as nec­es­sary. Give the com­mand a name such as “For­ward­Search” and click “OK”. Now you should be able to jump to the cor­re­spond­ing part of the pdf file using “Alt-​​Shift-​​F1” (or what­ever key-​​combination is asso­ci­ated with your new command).
Being lazy, I pre­fer a sim­ple func­tion key. To map F2 to your new com­mand, select “Options/​Configure TeXs­tu­dio” and choose “Short­cuts”. Find your new com­mand under the User menu, dou­ble click to the right of it and select “F2” from the drop-​​down box. Pre­vi­ously F2 was mapped to LaTeX, but I never use LaTeX directly, so los­ing this func­tion is no problem.
Now you can dou­ble click on any part of the pdf from within Suma­traPDF and it should take you to the cor­re­spond­ing place in your tex file in TeXs­tu­dio. And then F2will take you back again.

For the original version of this article, please refer to  http://robjhyndman.com/researchtips/texstudio-sumatrapdf/

2012年3月6日星期二

MATLAB 图片参数设置

1. One column figure
position: width: 0.16; height: 0.34;
title font: 10
legend font: 9
mark size: 5
latex figure width: 7 cm

2. Three columns figure
position: width: 0.16; height: 0.34;
title font: 14
legend font: 12
axis font: 12
mark size: 6
line: 1.0
latex figure width: 18 cm

2011年6月8日星期三

Good bands

air
boston--augustana
blonde redhead
the cardigans
cocteau twins
the cranberries
eric clapton
flunk
iron and wine
jem
massive attack
maximilian hecker
moby
paolo nutini
the perishers
pink
the pogues
portishead
radiohead
razorlight
snow patrol
sting
tori ames
travis
elenore--the turtles
tori ames
travis
elenore--the turtles
vintage material

2011年6月2日星期四

[ZT] Fighting procrastination的重要工具 by Cher

Fighting procrastination的重要工具:陷入procrastination不是什么神秘不可解释的事情,每个procrastinator,都是因为被一些distorted thinking困扰,才会失去行动力的。有一些重要的工具,就是用来untwist这些distorted thinking,让我们重新行动起来的。

 1. "时间不够了,我肯定做不完了"。大部分procrastinator并不是因为一件事有太多时间去做,而恰好是因为它快临近deadline了,觉得自己根本做不完了,太痛苦以至于反而拖下去了。解决这种distorted thought的方法就是 replace "finish it" with "start it". 告诉自己,我不需要考虑是否能完成的问题,有一点可以肯定,如果我永远不开始,当然我肯定不能完成,好的,现在,我只需要start it! 就这么简单,我现在唯一需要的,就是start it!

 2. "我好像不想干活,等我想干的时候再干吧。"procrastinator都以为人本来就是应该等到想干活的时候才能干的,(大部分以'自己想干的时候效率高'为理由来justify这种想法),并且以为身边其他不procrastinate的人就是因为想干愿意干,跟自己不一样。其实很多活就是很 boring很缺乏instant reward的,也许是写论文,也许是反复修改论文,也许是做slides,也许是写proposal,也许是打扫,要等到想干它们的时候的结果就是,永远也等不到,越等越想逃避。解决这个的办法是action before motivation, 不要等待motivation,告诉自己,i don't need to feel motivated to start the project, 先做了再说,做的过程中,因为已经开始做了,并且有些小阶段成果,往往motivation会增加起来,让自己等有更多的action.

 3. "这个project太大了,根本不是我能完成的。"越大越远的目标,越容易让人Procrastinate,因为怎么看也不像是能一下子到达的。的确,不可能一下子到达,所以需要break down into small pieces。"写完一篇论文"这个目标看上去太大,别让它出现在你的计划中,这只会让你觉得frustrated,需要赶紧去上网闲逛一会儿消除痛苦。改为"写这篇论文的一段"是不是就不那么intimidating了?再进一步分解为"把过去写过的一点相关的东西先copy-paste到论文的文件上 "和"在此基础上修改以符合这个论文的内容"和"增加一些新东西",是否就更显得容易开动些了?不光在内容上要break down into small pieces,抽象的进步也需要这样,比如,你过去一个月很颓废,每天只能平均工作半小时,现在忽然下定决心,从今天起每天工作八小时,能行吗?一般来说不行,这种是self-defeating的目标,唯一结果就是发现没有做到,自己觉得又fail了自己, fail了大家,于是像以前很多次一样,缩回自责自我否定的壳子里去。把目标break down into small pieces,这周先试试每天平均工作一小时,如果能做到,下周继续坚持,还能做到的话,再下周试试每天两小时,这样循序渐进。

 4. "太晚了, 我又没做到,完蛋了"procrastinator往往在发现自己误过某个目标时就despair了,然后消沉下去,结果很显然,就是 procrastinate了更长时间。没有procrastinator是能够一旦设定目标,从此就一帆风顺的,fighting procrastination本来就是漫长而有反复的过程,为了能够螺旋形前进,要在进入低谷时告诉自己,better late than never。是的,的确比较晚,可是从来没有一个时间是"太晚了",现在就开始比现在不开始肯定要好些,它永远都是现在的最佳选择。

 5. 体育锻炼坚持体育锻炼不光对physical health有好处,还对改善情绪,走出抑郁有不可忽视的作用。心情好了,我们才有动力去fight procrastination. 就算时间少也没关系,可以就在楼里上下几分钟楼梯,或者如果在计算机前坐太久了,做一两分钟颈部操:颈部操:前点头,后仰头,左侧头,右侧头,向左转头,向右转头,左环转,右环转。八个动作,每个动作大概花一两秒时间,慢慢的,以不能再弯曲但是也不痛为底,重复大概四轮。

[ZT] 我的毕业答辩经以及其他 by 小萨

亲爱的同修们,上周我终于回到母校,通过毕业答辩,顺利毕业了~~~ [?]

我答应了要回来写一下自己的心路的,趁着今天有点时间,先来梳理一下思路,也希望我的这些经历对还在读博(特别是文科)、在找工作第一线的同修们有一点点帮助。

这里熟悉我的同修们都知道,就在不到一年前,我还是个博士读了N多年、毕业遥遥无期的大龄学生。那个时候的日子,我都不敢回头去看。读博期间我流的眼泪,可以漂起来一条大船。我那时最大的痛苦是对未来巨大的不确定感和自信心的丧失。由于读博比较盲目,所以读得超级痛苦。写论文阶段又是off campus,身边没有了能督促自己的导师,这下更是放了羊,于是一年一年地耽误下来。拖得越久,对自己越怀疑,找工作、写论文都完全丧失动力,但是内心的压力反而随着拖延与日俱增,每天都活得象在地狱里一样。我拖延最严重的时候,一年只写了一个chapter。

在MITBBS上看到了cher的帖子,加入这个小组,才知道我那叫拖延症,也才开始面对拖延的问题。时间所限,我还是把有限的篇幅集中在写论文和毕业答辩这些方面吧。我记得紫儿和Beehappy都有很好的总结,我自己总结几点体会:

*写论文*

1.毕业论文只是一个练习,不是最终目的,降低期待值。我觉得,期待值过高,是拖延症的一个根源。毕业论文本来就是一个巨大的project,需要很多的能动性,而且不是一时能看到曙光的,如果期待值再无限拔高,那几乎是mission impossible。当年一个老师告诉我,我应该集中精力*写完*论文,而不是写一个高质量的论文时,我一边若有所悟,一边感到一点屈辱,觉得她也有点太看不起人了。但事实证明,我给自己的期待太高,以至于overwhelmed了。每交一个chapter,我都希望听到我导师说“Wow,this is wonderful!"
但事实上,无论我自己觉得有多wonderful的chapter,最后还是需要根据导师的意见来修改,而且导师其实并不会期待我给他一个超水平的chapter。这些压力完全是我给我自己的。虽然写出来超一流的chapter也是很好的,但就整个毕业的流程来讲,这是plus, 而不是necessary的部分。

2. 客观看待写论文的难度。写论文很容易自我否定,把写不出来、写不好的一切原因都归结于”我很糟糕。“其实我们没那么糟糕。写论文本来就很难 。我们看到那些老师在讲台上滔滔不绝,看到他们写的论文那么华美,那是因为他们比我们早入行N多年,他们当年也是从我们这个阶段过去的。当然不否认有牛人的存在,但毕竟牛人很很少很少的一小撮。绝大部分人的资质都是差不多的。论文已经很难了,如果我们再不给自己credit,反而辱骂自己一番,那内心的小人绝对要罢工的。与其这样,不如静下心来分析一下论文的难度,试着想想怎么让这个很难的过程变得稍微容易一些。把大砖头拆成小砖头,小砖头拆成小小砖头,一天一小块儿往上垒。总有一天会小河汇成大河,大河汇成海洋。

3. 动手、现在就动手。机器人法则,每天计时劳动,每天给自己奖励,这些都是很重要的小肌肉。我的好几个chapter都是在这种看似很boring很无奈的小trick的帮助下写出来的。脑子里的”快做吧,快写吧,“和实际的动手,完全是天壤之别。要真的行动起来,进入状态,对拖延症患者来说,最好的办法就是机器人法则。我有个习惯是把每天计时的纸片(不好意思我用电子版的总不习惯)贴在书桌边的墙上,隔一段时间就会贴满一墙,密密麻麻都是工作时间的记录,觉得很有成就感呢。不管具体时间多少,能看到自己在用功就是个很大的宽慰。

4.建立自信。我很喜欢看功夫熊猫,里面的Master Wugui说:You just need to believe,我觉得这很有智慧。我曾经对英语有心理障碍,因为来美国前自认有语言天分,结果刚来美国自信心一下子没了,好多年都没恢复。每次要说英语,我都觉得象上刑场。我的专业还是对英文要求很高的那种文科。。。后来认识了我的language partner,她一针见血地指出来,我不是真的需要语言方面的辅导(当然,需要不断充实和提高),而是需要自信。真的,当我把注意力放在表达我自己,而不是去impress 别人的时候,我可以说流利的英语,别人听我说话也没问题。就是心理上一个小小的barrier,跨越它,生活质量真的差好多。

*找工作*

1. 不要被job ad上的高要求吓到。我记得当年pangpang给我打过气,说那些写ad的人自己都可能不知道要个什么样的人,先投了再说,不投永远没机会。我现在的工作,当初在ad上写的方向和我的expertise是在一个大方向内,但是小方向上完全不吻合。他们要我是因为他们想往我这个方向发展,但是在ad上完全没反映出来。可见,job ad误人啊!

2. 被拒不代表你不好。我身边这样的例子太多了,研究做得好、论文写得好、有publication却找不到工作的多得是。找到工作的,也不是每一个都那么优秀,有些是有牛导师开路,有些是有network,有些是运气好(我就是个例子),有些是正好吻合对方的需要。真的,找工作里面好多都不是看你的成绩、publication、grants有多好多好,这些硬件当然要有,越多越好,但是不代表你没有你就找不到工作。

3. 如果找学术界的工作,campus visit前,试讲非常非常重要。这不光是让你对材料和job
 talk的方式有个熟悉的机会,而且会让你从feedback里学到很多。朋友和老师的意见真的很有用,可以大幅度地提高你job talk的质量。尽量找一些友善、positive的朋友来听你试讲,那些喜欢把人家说得一钱不值的,少找几个没害处。

4. campus visit的时候,自信最重要,相信自己是这个领域的专家,相信自己是最好的。其实博士读到最后的人,研究能力这些都没问题了,job talk什么的一般不会有硬伤,而且一定会百分百尽力去做到最好,但是不能没有信心。有了信心,哪怕只有80分的内容也会变成100分。那些面试官也都是普通人而已,他们很多时候还是看第一印象的。一个有信心又reasonable的candidate,和一个紧张得说话都结结巴巴、做事看人眼色的candidate,要我也会选第一个。

5. 尽了全力,就要给自己credit。工作市场真的变幻莫测,不能用一时有没有工作来判断人生的成败。人生长着呢,而且人是有很多选择的。只要是尽了全力的,就不要给自己太多压力,更不要负面评价。

好像就能想到这么多了哈。如果我想到别的,再来补充吧。希望有点帮助。

自从答辩后,我的拖延毛病好像又回来了,呵呵,奇怪吧。而且最近这段时间人变得很uneasy,有种失重的感觉。可能跟我在transitional的状态有关吧。我决定要勤来组里报道,督促自己前进。

2011年5月24日星期二

[ZT] Fixes and Suggestions for Springer's Journal of Mathematical Biology


LaTeX Support :: Fixes and Suggestions for Springer's Journal of Mathematical Biology
BACKGROUND: The origins of this post are a Phase Portrait post, Preamble for Journal of Mathematical Biology. See that post for the history behind this issue.

UPDATE 4: The updated svglov2.clo and svglov3.clo are not needed if the preamble is used below (i.e., if the \RequirePackage{fix-cm} line is added before the documentclass line.

UPDATE 3: See the section that redefines \autoref. Changed definition to support starred commands that are unlinked.

UPDATE 2: See the section starting with the comment "%% Level 1 Subsections". It forces subsections to show up like sections in the PDF bookmarks; this is a (strange) JMB convention. In the comment I make some suggestions for improvements.

UPDATE 1: See the small commented section "%%%% Table Support". If the LaTeX code is uncommented there, there is no need for the \noalign{\smallskip} stuff around \hline horizontal table rules. It uses the tabls package to do this.

I've been trying to fix and modernize some of the Springer LaTeX support files for the Journal of Mathematical Biology (JMB). I've come up with these...
svglov2.clo - document class option for svjour2.cls. I used fix-cm to get rid of some of the warnings about not being able to scale the Computer Modern fonts. This is not needed if the preamble below is used (i.e., with the fix-cm line before the documentclass line).

svglov3.clo - document class option for svjour3.cls. I used fix-cm to get rid of some of the warnings about not being able to scale the Computer Modern fonts. This is not needed if the preamble below is used (i.e., with the fix-cm line before the documentclass line).

spmpsci.bst - BiBTeX bibliography style file for JMB. The original version of this did not reverse the first and last name of the editors as required; I fixed that.

spmpscinat.bst - natbib compatible BiBTeX bibliography style file for JMB. Be sure to include natbib with numbers and sort&compress options.
I recommend using a preamble like this one...
%%%% Journal of Mathematical Biology (JMB) setup

% Allow Computer Modern fonts to be scaled (must be before svjour3)
\RequirePackage{fix-cm}

% Use running heads
\documentclass[runningheads]{svjour3}

% The journal's name
\journalname{Journal of Mathematical Biology}

% use Times fonts
\usepackage{mathptmx}

% flush right qed marks (Halmos square),
% e.g., at end of proof
\smartqed

% Use natbib for \citet, \citep, etc.
% (JMB: numbered citations that are sorted and compressed)
\usepackage[numbers,sort&compress]{natbib}
%\bibliographystyle{spmpsci}
\bibliographystyle{spmpscinat}

%%%% Some useful packages

% Allow for smarter labeling of enumerations and itemizations
% (consider using enumitem instead)
\usepackage{paralist}

% Provides \labelformat, which changes how \ref references look
\usepackage{varioref}

% Mathematical symbols, etc.
\usepackage{amssymb,amsfonts,amsmath}

%%%% Table Support

% UNCOMMENT THE FOLLOWING LINES TO GET RID OF
% \noalign{\smallskip} STUFF AROUND \hline's IN
% TABLES
%
% % The following three lines remove the need for
% % the \noalign{\smallskip} around the \hline's
% % in the _Journal of Mathematical Biology_ LaTeX
% % template
% \usepackage{tabls}
% \addtolength\extrarulesep{\smallskipamount}
% \addtolength\extrarulesep{1pt}

%%%% Graphics and Figure Support

% Use subfig for subfigures
\usepackage[nearskip=-3pt,captionskip=4pt,
listofformat=subsimple,
labelformat=simple]{subfig}

% Make sure subfigures have parentheses around them everywhere
\renewcommand\thesubfigure{(\alph{subfigure})}

% Use graphicx for including graphics
\usepackage{graphicx}

% When picture environments are used, use
% pict2e for better resolution and flexibility
\usepackage{pict2e}

%%%% Hyperlink and Autoreference Support

%% Level 1 Subsections
%
% JMB does this weird thing where all subsection-level PDF
% bookmarks are displayed as section-level bookmarks.
% Strangely, they do *NOT* turn on the ``bookmarksnumbered''
% hyperref option. I think their articles would be MUCH more
% readable with all level-1 bookmarks if they were prefixed
% by their section number. I'm sure they'd argue that since the
% sections are linked within the document, this is not needed.
%
% (note: another option is to set tocdepth=2 and turn on
% the ``bookmarksopen'' hyperref option)
%
% Anyway, the following redefines \addcontents line to setup
% the bookmarks like JMB articles. Must do this after hyperref
% because it redefines \addcontentsline Therefore, just use an
% AtBeginDocument.
%
\AtBeginDocument{\let\orgaddcontentsline\addcontentsline
\renewcommand{\addcontentsline}[3]{
\ifthenelse{\equal{#1}{toc}}
{\ifthenelse{\equal{#2}{subsection}}
{\orgaddcontentsline{#1}{section}{#3}}
{\orgaddcontentsline{#1}{#2}{#3}}}
{\orgaddcontentsline{#1}{#2}{#3}}}}

% Include hyperref for link support
%\usepackage[dvipdfmx, % If need dvipdfmx
%\usepackage[dvips, % If need dvips
\usepackage[% % Fine in most cases
pdfpagelabels,hypertexnames=true,
plainpages=false,
naturalnames=false]{hyperref}

% Configure the hyperlink color
\usepackage{color}
\definecolor{darkblue}{rgb}{0,0.1,0.5}
\hypersetup{colorlinks,
linkcolor=darkblue,
anchorcolor=darkblue,
citecolor=darkblue}

% In the future, it would be nice to use the package
%
% cleveref
%
% Right now, it breaks svjour3 and svjour2, so we just have to use
% autoref and labelformat :(.

% Make sure \autoref puts parentheses around
% equations and enumeration items (similar to \eqref)
% NOTE: This allows us to use \ref instead of \eqref
\labelformat{equation}{\textup{(#1)}}
\labelformat{enumi}{\textup{(#1)}}

% Make sure equations are numbered by section
\numberwithin{equation}{section}

%% We need to redefine \autoref. We should use
%% abbreviations inside the sentence and full names
%% at the beginning of sentences. Additionally,
%% need to handle the plural cases.

% \Autoref is for the beginning of the sentence
\let\orgautoref\autoref
\providecommand{\Autoref}
{\def\equationautorefname{Equation}%
\def\figureautorefname{Figure}%
\def\subfigureautorefname{Figure}%
\def\sectionautorefname{Section}%
\def\subsectionautorefname{Section}%
\def\subsubsectionautorefname{Section}%
\def\Itemautorefname{Item}%
\def\tableautorefname{Table}%
\orgautoref}

% \Autorefs is plural for the beginning of the sentence
\providecommand{\Autorefs}
{\def\equationautorefname{Equations}%
\def\figureautorefname{Figures}%
\def\subfigureautorefname{Figures}%
\def\sectionautorefname{Sections}%
\def\subsectionautorefname{Sections}%
\def\subsubsectionautorefname{Sections}%
\def\Itemautorefname{Items}%
\def\tableautorefname{Tables}%
\orgautoref}

% \autoref is used inside a sentence
% (this is a renew of the standard)
\renewcommand{\autoref}
{\def\equationautorefname{Eq.}%
\def\figureautorefname{Fig.}%
\def\subfigureautorefname{Fig.}%
\def\sectionautorefname{Sect.}%
\def\subsectionautorefname{Sect.}%
\def\subsubsectionautorefname{Sect.}%
\def\Itemautorefname{item}%
\def\tableautorefname{Table}%
\orgautoref}

% \autorefs is plural for inside a sentence
\providecommand{\autorefs}
{\def\equationautorefname{Eqs.}%
\def\figureautorefname{Figs.}%
\def\subfigureautorefname{Figs.}%
\def\sectionautorefname{Sects.}%
\def\subsectionautorefname{Sects.}%
\def\subsubsectionautorefname{Sects.}%
\def\Itemautorefname{items}%
\def\tableautorefname{Tables}%
\orgautoref}


This lets you do cool things like... (hyperlinks depicted in blue)
\ref{eq:1} produces linked "(1)"
\ref*{eq:1} produces unlinked "(1)"
\autoref{eq:1} produces linked "Eq. (1)"
\autoref*{eq:1} produces unlinked "Eq. (1)"
\Autoref{eq:1} produces linked "Equation (1)"
\autoref{sec:2} produces linked "Sect. 2.1"
\Autoref{sec:2} produces linked "Section 2.1"
\Autorefs{sec:1} and \ref{sec:2} produces linked "Sections 1 and 2.1"
\autorefs{sec:1} and \ref{sec:2} produces linked "Sects. 1 and 2.1"
\autoref{item:1} produces linked "item (i)"
\autorefs{item:1} and \ref{item:2} produces linked "items (i) and (ii)"
\citep{SK86} produces linked "[61]"
\citep[p.~41]{SK86} produces linked "[61, p. 41]"
\citep{Cha76,SK86} produces linked "[14, 61]"
\citep[e.g.,][]{SK86,Cha76} produces linked "[e.g., 14, 61]"
\citeauthor{SK86} produces linked "Stephens and Krebs"
\citet{SK86} produces linked "Stephens and Krebs [61]"





Original page (see http://www.tedpavlic.com/post_preamble_for_journal_of_math_bio.php).

2011年1月7日星期五

[ZT] ubuntu下使用latex:XeTeX+Lyx

早就听说Latex了,据说排版规范漂亮,今天就在ubuntu下安装配置了一下,方法如下:
1、安装Latex 在ubuntu下直接就可以从软件管理中安装texlive,再安装上texlive-xetex
2、编辑latex文件,保存为tex格式即可,举例如下,其中STKaiti要换成你系统中已经有的字体,可以在终端中通过fc-list命令查看字体名称。
\documentclass[12pt,a4paper]{article}
\usepackage{fontspec,xunicode,xltxtra}
\setmainfont{STKaiti}
\begin{document}
\title{试验}
\maketitle
\section{ 简介}
\end{document}
3.编译 在终端中执行 “xelatex 文件名.tex” 命令
由于xetex那些语法比较恶心,你可以使用所见即所得工具lyx,直接apt-get install安装即可。需要中文支持的话还要进行一些设置,使得lyx支持xetex编译,方法如下:
1.第一次启动Lyx后运行”工具-重配置”,让Lyx检查TeX系统装在哪,有哪些包可用,结束后退出;
2.在 ~/.lyx/preferences结尾添加两行(如果没有preferences这个文件的话,在工具-首选项中任意设置一下就有了,貌似新建一个也可以,没有尝试):
\format pdf4 pdf “PDF (xetexpdf)” “” “” “” “document,vector” \converter pdflatex pdf4 “xelatex $i” “latex”
3.在文档-首选项-语言中,编码选择Unicode(Xetex)(utf8)即可,注意不要选错了。语言选择Chinese simplified即可,貌似别的也可以,主要是编码。
4.在上面步骤的首选项菜单的Latex序中填写下列内容:
%%%%%%%%%%%%%%%%%%
\usepackage{fontspec}
\setmainfont[Mapping=tex-text]{文泉驿正黑} %这里是字体名
%中文断行
\XeTeXlinebreaklocale “zh”
\XeTeXlinebreakskip = 0pt plus 1pt
%%%%%%%%%%%%%%%%%%%%%%%
5 然后就可以通过菜单视图-pdf(xetexpdf)获得pdf输出了。要想获得pdf文件可以通过文件菜单中的导出选择pdf(xetexpdf)即可!
贴图一张:

2010年12月28日星期二

Add shortcut to Lyx

I want to add two shortcut in Lyx: one for View->View [PDF(pdflatex)] and one for View->Update [PDF(pdflatex)].

1. Find menus.bind in ~/lyx/bind (in my system is in ./usr/local/share/lyx/bind).

2. Modify access privilege: sudo chmod 777 menus.bind

3. Open menus.bind and add

\bind "C-k" "buffer-view pdf2"
\bind "C-u" "buffer-update pdf2"

save and close menus.bind. Here, "C-k" means "Ctrl + k" which can be specified as any unused one.

4. Run the menus.bind in terminal.

2010年10月31日星期日

Matlab 生成 pdf

在用Matlab生成pdf的时候,一个一个的保存pdf非常麻烦和费时。特别是图很多的时候,特别痛苦。 现在介绍一个方法可以自动生成pdf。代码如下:

%set the width and heigth of figure
set(gcf, 'PaperUnits', 'points');

%set(gcf, 'paperposition', [xLeft yTop Width Heigth])
set(gcf, 'PaperPosition', [100 100 300 500]);

% you can change fileName to the name you want
print -dpdf -loose fileName.pdf
Publish Post

2010年10月6日星期三

Lyx algorithm

Lyx 自带的algorithm不好用。后来在网上发现了一个比较好的algorithm package。 可以从这里下载http://bgu.perso.libertysurf.fr。
下载包后发现往往不能使用,可以用一下步骤解决:

1、在..\LyX 2.0alpha5\Resources\layouts中找到需要添加algorithm package的layout,然后用写字板打开,在其中加入input algorithm.inc,保存。

2、在Lyx中tool——》Reconfig 就ok了。

3、Bibtex style只需将splncs.bst放入文档所在文件夹,用browser找到即可。

2010年9月26日星期日

【收藏】LyX中IEEEtran中Figure变Fig.的方法

LyX中提供的IEEEtran模 板为向IEEE投稿提供了便利。但使用过程中发现图片和表格的Caption与期刊要求的不一致,期刊要求的格式为 Fig. 1. 和 TABLE I等,但用IEEEtran模板写成的论文输出(DVI或PDF)后显示的却是 Figure 1 和 Table 1。经过网络搜索(这里)和向CTEX论坛的高手请教终于找的了解决的办法:

第一种方法:

LyX-Tools-Preferences-Language Settings,取消选中 Use babel

第二种方法:

    1. 在光标定位于用IEEEtran模板建立的文档最前端,Insert-Tex code 或者直接按快捷键Ctr+L;
    2. 将下列代码粘贴进去

% Redefine string definitions overwritten by babel (maybe not all are used)
\def\contentsname{Contents}
\def\listfigurename{List of Figures}
\def\listtablename{List of Tables}
\def\refname{References}
\def\indexname{Index}
\def\figurename{Fig.}
\def\tablename{TABLE}
\def\partname{Part}
\def\appendixname{Appendix}
\def\abstractname{Abstract}


上面两种方法可以任选一种。应用上述方法后,虽然在LyX中图片和表格的Caption仍显示为Figure和Table,但此时输出后的文档中已经可以正确显示了。

2010年9月22日星期三

Lyx layout problem

在使用lyx的时候,经常会碰到document class unavailable的情况。以前要写Springer LCNS 的文章的时候,就发现Springer的layout svjour3不能使用。今天晚上睡不着,跑起来尝试解决这个问题,居然把这个一直头疼的问题给解决了。方法如下:
1. 当想使用svjour3 template的时候lyx提示找不到svjour3.cls和svglov3.clo。上google找到下载到用户文件夹。这里要注意,这个用户文件夹的路径如下:
  • Linux and other Unix-like systems: usually found at ~/.lyx, where ~ is your home directory.
  • Mac OS X: ~/Library/Application Support/LyX-/
  • Windows Vista / Windows 7: usually at C:\Users\[your username]\AppData\Roaming\lyx\ (note: this is if you installed LyX for all users)
  • Windows 2000/XP: usually at C:\Documents and Settings\[your username]\Application Data\lyx\
  • Windows 95/98/ME: C:\Program Files\lyx\Resources\lyx\ (note: needs to be confirmed - this looks a bit like the SystemDir)
我用的是XP,所以路径是C:\Documents and Settings\Yi\Application Data\lyx20,找到后将svjour3.cls和svglov3.clo这两个文件拷入。

2. 生成svjour3.layout。 因为系统中没有svjour3.layout文件,所以我们要自己做一个。在lyx的安装路径下找到..\LyX 2.0\Resources\layouts 文件夹。可以找到一个svjour.inc的文件,如果找到了,就按照步骤3生成。

3. 在\LyX 2.0\Resources\layouts中找到一个article.layout文件,用notepad将其打开,在Input stdclass.inc下加入Input svjour.inc,另存为svjour3.layout。

4. 将新生成的svjour3.layout 和 svjour3.inc这两个文件一起拷入到用户文件夹。

5. 在lyx中,Tools>Reconfigure。重启lyx后就可以在Lyx->Document->Document Setting->Layout>Document>Document-Class drop-down list中找到了。

6. 有时候在生成文档的时候,lyx还会提示找不到svjour3.cls和svjour3.clo文件,这个时候只要将这两个文件拷到文档所在的文件夹即可。

2010年9月9日星期四

How to connect Lyx and SumatraPDF

Sumatra PDF is a lightweight and open source PDF reader. Lyx is a good Latex editor and easier to use.

To connect Lyx and Sumatra, the processes is as follows:
1. Open Lyx, Tools-->Preferences-->File Handling-->File formats-->Format-->PDF (pdflatex)-->Viewer-->Custom, paste the path of SumatraPDF into the textbox (e.g., "D:\Program Files\SumatraPDFPortable\SumatraPDFPortable.exe"). Note that "" is very important on the path.

2008年10月24日星期五

OPNET 单词注释

altitude海拔
Animation
动画
annotate
注释
Antenna
天线
Antenna Pattern
天线模型
APAccess Point,
接入点
Access Point
接入点
Application
应用
association
关联
attribute
属性
bandwidth
带宽
begsim intrpt
仿真开始中断
BER
误比特率
Bit Error Rate
误比特率
Bit-range
比特范围
Bkpt
断点
breakpoint
断点
blocking
停滞,一般指进程在非强制状态中运行中断
Bulk size
包大小的校验值
boresight point
天线的基准点
Breakpoint
断点
BSS
基本服务子集
Basic Service Set
基本服务子集
bucket
桶状收集,结果收集模式的一种
Capture Mode
收集模式
channel match
信道匹配
child
子对象
child process
子进程
closure
物理可达性,链路闭锁
Compile
编译
Connectivity
连接关系
connector
连接器,用来连接两个对象(如包流或链路)
console
控制台
Coordinate
坐标系
data rate
数据传输率

dbu
总线管道阶段文件的缺省前缀
default bus
总线管道阶段文件的缺省前缀
delivery
传递
demand
背景流
destroy
销毁
devOPNET
仿真核心的一种,能够产生调试信息
developmentOPNET
仿真核心的一种,能够产生调试信息
discover
一般指协议发现,通常在协议注册之后完成
discrete event driven
离散事件驱动
dpt
点对点管道阶段文件的缺省前缀
default point ts point
点对点管道阶段文件的缺省前缀
dra
无线管段阶段文件的缺省前缀
default radio
无线管段阶段文件的缺省前缀
Elapsed time
逝去时间
EMA
外部模型访问
External Model Access
外部模型访问
endsim intrpt
仿真结束中断
Enter Execs
状态入口执行代码
Enter Executives
状态入口执行代码
ESS
扩展服务子集
External Service Set
扩展服务子集
event
事件
Event List
时间列表
Event Scheduler
事件调度器
Evhandle
事件句柄
event handle
事件句柄
Exit Execs
状态出口执行代码
Exit Executives
状态出口执行代码
export
导出
external file
外部文件
Fan-in
群收
Fan-out
群发
FIFO
先入先出
First In First Out
先入先出
flow
流量
flush
刷新,针对队列的一种操作
forced state
强制状态
formatted
有格式的,是包的另一种类型

Free Space
自由空间模型,计算空间传播损耗模型的一种
full range
缓存队列的总比特量
gain
增益,一般指天线增益或处理机增益
glitch removal
过滤毛刺,结果收集模式的一种
global statistics
全局统计量
header block
头块
HLA
高层体系架构
High Level Architecture
高层体系架构
ICI
接口控制信息
Interface Control Information
接口控制信息
IMA
内部模型访问
Internal Model Access
内部模型访问
Import
导入
individual statistics
单独显示,是结果显示模式的一种
input stream
输入流
install
绑定,安装
installation
绑定,安装
interface
接口
interrupt
中断
intrpt code
中断码
intrpt mode
中断模式
jammer
干扰机
KP
核心函数, Kernel Procedure核心函数
Kernel Procedure
核心函数
label
标签
latitude
纬度
Link
链路
Load
负载
Local Statistics
本地统计量
longitude
经度
Longley-RiceLongley
Rice两个学者提出,计算空间传播损耗模型的一种
MAC
信道接入控制层
model
模型
module
模块
Multi-tier
多端,指业务发送须经过多台服务器
Normalize
归一化
object palette
物件拼盘,对象模板
Objid
对象识别号
object ID
对象识别号
ODB OPNET Debugger OPNET
调试器
OPNET Debugger OPNET
调试器
optoptimize
优化的仿真核心
optimize
优化的仿真核心
orbit
轨道
Orindate
纵坐标
output stream
输出流
Overlaid
重叠,结果显示模式的一种
packet
封包,包,分组
packet field
包域
packet header
包头
Parallel simulation
并行仿真
parent
父对象
parent process
父进程
Path
路径
path loss
路径损耗
payload
净荷
PDF
概率分布函数
performance
网络性能
pipeline stage
管道阶段
plane

Platte
面板
pmo pooled memory
池内存,用来标识核心函数类别的前缀
pooled memory
池内存,用来标识核心函数类别的前缀
power lock
功率锁
preference
属性,一般指OPNET 环境属性
prg programming
编程,用来标识核心函数类别的前缀
programming
编程,用来标识核心函数类别的前缀
Probe
探针
Process
进程
process tag
进程标记
processorprocess module
进程模块
process module
进程模块
Profile
业务主询,业务规格
prohandle
进程句柄
Project
工程,项目
promote
提升
propagation delay
传播延时
queue module
队列模块,也可称为进程模块
reassembly
组装
receiver
收信机
reference point
天线的参考点
register
注册
root process
根进程
Round Robin
轮循
rxgroup
接收主询,收信机组
sample
采样,结果收集模式的一种
satellite
卫星
sbhandle
分段缓存句柄
scalar
标量
Scenario
场景
schedule
调度
seed
仿真种子
segment
包段
segmentation
分段
signal lock
信号锁
Simulation Kernel
仿真核心
Simulation time
仿真时间
SLA Service Level Agreements
服务等级
Service Level Agreements
服务等级
slice

Smooth
平滑
SNR Signal-to-Noise Ratio
信噪比
Signal-to-Noise Ratio
信噪比
Spreadsheet
数据表
stacked statistics
统计量合并显示,是结果显示模式的一种
state variables block
状态变量块
statistic wire
状态线
stream
包流
stream index
流索引,或流端口号
subnet
子网
subq subqueue,
子队列
subqueue
子队列
SV State Vriables
状态变量
State Vriables
状态变量
swap
交换,一般指队列中两个包的位置互换
TD Tranmission Data,
传输数据
Tranmission Data
传输数据
TDATranmission Data Attributes
传输数据属性,用于管道阶段参数计算的传递信息
Tranmission Data Attributes
传输数据属性,用于管道阶段参数计算的传递信息
temporary variables block
临时变量块
throughout
吞吐量
topology
拓扑
trace
跟踪信息
Traffic
业务
traffic profile
业务规格
Trajectory
轨迹
transceiver
收发信机
transimission delay
传输延时
transimitter
发信机
transition
状态转移线
TV Temp Vriables,
临时变量
Temp Vriables
临时变量
unforced state
非强制状态
unformatted
无格式的,相对于formatted 是包的一种类型
unresolved externals
无法定位的外部函数
user id
用户识别号,节点模型的一个属性
utility
物件拼盘中的特殊物件组合
value vector
值向量,包类型的一种
Vector
矢量
Wireless domain
无线区域,用来划分接收主询
WLANWireless Local Area Network
无线局域网
Wireless Local Area Network
无线局域网