Filed under: Discovery

Writing LaTeX in Word

LaTeX is good for two reasons: (1) great layout in publication quality; (2) separation of content and formatting (just like HTML), making it easy to reuse existing content. However, writing directly in LaTeX is not so good in that it is quite “anti-creativity”, especially when the essay is subject to constant change and development. Lyx is designed to resolve this issue, but unfortunately the editor is poor. Can we use MS-Word instead, as our daily writing environment, and still generate LaTeX script very easily on demand? The answer is yes. Let me show you this in three typical scenarios along with a list of useful resources and tools dealing with LaTeX.

  • Writing Papers

To write papers in MS-Word, but still generate LaTeX scripts, the key is a software converting MS-Word formats to LaTeX scripts. Among many software of this kind, the most recommended is Word2TeX. It is recommended for these reasons: (1) Most common elements for papers are supported. (2) the generated script is very clean and abstract, without unnecessary formatting in the original word file.

When a script is converted by Word2TeX, we can wrap it using the template files given by a conference/journal, just copy and paste the generated script into the body part of the template. Since the generated script is clean and abstract, usually the wrapped LaTeX script can be compiled immediately without any manual work.

Formulas in word files input using MathType can be converted into the LaTeX script automatically. And this part is the major reason for using MS-Word as the editor, as mathtype is so “creativity-supporting”. If you remember some keyboard-shortcuts, blind typing of formulas in MathType is possible and is a great experience. Another thing worth noting is that copy-and-paste from-and-to mathtype can be in LaTeX format.

Headings in word (input using Ctrl-Alt-1 etc.) can be converted into sections, chapters or so. Everything is customizable and automatic. Using headings itself is a recommended experience of using word.

Tables, figures, and even figures embedded in tables are automatic too without any manual work. In particular, if you paste vectorized figures into word, they are stored as vectorized. When the word file is being converted to LaTeX scripts, these figures are by default rastarized, which is not good. Yet there is an option in Word2TeX to convert images to eps, provided that you have a virtual postscript printer. To install a virtual postscript printer, the instructions mentioned in this page works if you have Microsoft Publisher installed. After that, everything is automatic again.

For theorems and proofs, there 2 things to do. (1) In word, create a new paragraph style. First pick a paragraph with “normal” style, then use “Save Selection as a new Quick Style” to save it as new style and name it “Theorem”, then modify the style format such that it is “italic”, it has a new “numbering list” format, starting with “Theorem ” and appended with numbering. By this step, the theorem in word really looks like a theorem. (2) When converting to LaTeX, in the configuration dialog of Word2Tex, add a new translation for paragraph style, translating “Theorem” style such that it prefix with “\begin{theorem}”, ends with “\end{theorem}”. Make sure that “suppress additional formatting” is chosen (this ignores numbering list and italic style in word, as they will be redefined in LaTeX anyway). In the generated LaTeX script, append this before document body:

\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}

Now theorem works. Proofs and so on can be done in the same way. Reference to theorems in word will also be properly translated.

Citation and bibliography is the most tricky part. According to the document of Word2TeX, if we use EndNote in word to deal with citations and bibliography, things should be automatic too. However, my experience is that this approach does not work at all (I don’t know why). The generated citation are just formatted texts, not being converted to citation switches like “\cite”. So my solution is to keep track of a personal “.bib” file (which can be reused every time when you write a paper). When writing papers in MS-Word, use waved underline formatting as citation, e.g., if there is an entry named “Geman84″ in my “.bib” file, then I can write  citation in MS-Word. After that in Word2TeX option page, we can choose to let waved underline be converted to “\cite”. In this way, the converted script will contain something like “\cite{Geman84}”.

There are a lot of other elements supported in Word2TeX.

  • Writing Presentations / Reports

Formal academic presentations are better written in LaTeX and compiled to ppts. There are a lot of LaTeX templates to do that, e.g., The LaTeX Beamer Class is a good choice. Similar to the above experience of writing papers, we can do this too when writing presentations. Simply write in word using “Bullets” or “Numbered Items”, then the generated script will contain “itemized” or “enumerate”. After that, what the beamer class require is that each ppt is begin with “\begin{frame}” and end with “\end{frame}”. There is no direct support for this in Word2TeX. But we can do tricky things again. Simply put something like “BeginFrame” and “EndFrame” in your word file, and when converted, find and replace them to “\begin{frame}” and “\end{frame}”. This does not cost too much work.

If you are a graduate student like me, you will surely write a lot of reports to present to your adviser. Writing reports is more like a daily creative process, so having a visual environment is even more important. All the experiences above for writing papers works here. In addition, my experience is that reports can be written in a way the same as presentations. It then provide a skeleton for presenting to our advisors. And when necessary, a formal presentation ppt can be produced on demand immediately.

  • Writing Blogs

If you have a wordpress blog like mine, then posting academic stuff is very easy. Suppose by the above experience, you write in word and have generated LaTeX scripts, then there are many plugins of wordpress turning LaTeX into blog posts. Among them, the most recommended is WP QuickLaTeX. The best thing of this plugin is that you can put a whole LaTeX page to the blog post editor, then add one tag to the top of the blog post, then everything is done, provided that the page does not contain too complicated stuff. Things like formulas, references to formulas, can all be taken care of automatically. To deal with citations, we can use a plugin called papercite. It is very simple but powerful. Simply put your personal “.bib” in your web directory, then citation and bibliography is very easy with this plugin.

See this post for an example.

  •  Useful LaTeX Resources and Tools

In addition to the above listed tools, some others help a lot in improving the experience of using LaTeX and Word together.

Detextify: This webpage recognizes drawing of symbols and translate them into LaTeX commands. It has two usages. The first is when you want to write in LaTeX a certain symbol, but don’t know it’s name in LaTeX. The second is when you are reading maths books and don’t know the meaning of a certain symbol. Knowing it’s LaTeX name helps you search over the Internet for its meaning. Note that when you are writing formulas with MathType, if you don’t know how to input a symbol, you can use this page and paste the LaTeX command into the MathType editor.

SmartDraw: Great tool for producing and maintenance of very fancy charts and figures efficiently. It is much better than visio in my opinion. It also produces EPS files. For example, if you are working on “probabilistic graphical models”, a subarea of machine learning, you will find this very useful.

Adobe Illustrator: Great tool for editing EPS figures directly. Good for final revision of papers, when EPS figures are already generated.

BibEdit: Great tool for maintaining BibTex files visually and efficiently. One can maintain a single BibTex file for all papers possibly used in future writing. Use the next tool for converting BibTex to MS Word reference.

BibUtil: Tool for converting among different bib formats.

CTeX: This is originally developed for the purpose of Chinese tex writing, but it turns out that it is also a very comprehensive all-in-one LaTeX package. Everything you need to write LaTeX are there, from editor, compiler, to previewer.

Yet the final tool is certainly Google, when you don’t know how to write LaTeX. I don’t think learn LaTeX thoroughly is a good idea. Template + Google is probably the best solution.

Leave a Comment March 24, 2012

The Chamber of Secrets has been Opened

But where is the entrance?

It’s time to take a break.

Science fiction movies prefer to depict aliens as insect-like, which are commonly ugly, cold blooded, uncivilized, without fear of death etc. However, at the same time, they usually have technologies we can’t even imagine of (e.g. district 9, cowboy and aliens, etc.). So does it mean that those species, somehow, at some point, evolved into a certain state, that unconsciously they know how to let P = NP (or approximately, but with guarantee), such that there is no need to have a highly civilized society to support researches which are unpredictable, and inventions can just be done on demand?

Leave a Comment December 11, 2011

重看《黑客帝国》

一大早看了《加勒比海盗4》,虽说是一场视听盛宴,但总觉得还是缺乏内涵。回家又看了一遍《黑客帝国》。这部十多年来我看了无数遍的电影,每次看还是能有不少新的领悟。制衡是最终级的艺术,两个老头在构建和谐社会,探究终级文明的存在形式上孜孜不倦的追求,让人感动。很多东西和系统动力学,优化这些工程学的东西之间都有千丝万缕的联系,可以相互借鉴。最近对这些东西很有兴趣,学起来却总是心有余而力不足。继续干活。。

当然视听盛宴型的电影还是要看的,期待7月1号的变形金刚和7月15号的哈利波特。

4 Comments May 21, 2011

Is There a Way We Can Be Immortal?

It seems rather too far away for the biological science area to discover the mechanism of natural death and find out a way to make existing people immortal. It will probably take more than 50 years. So I’m not hoping to have that applicable to me. Another possible approach is to first develop true AI and hopefully by using large scale AI, this science discovery process can be accelerated. However, based on my current knowledge of AI, the true AI, when developed, has limitation on its scale, which intrinsically, will not exceed the level of human intelligence to a non-trivial extent. What only we can do to improve the capability of AI is to improve the connectivity of AI systems to the external world, and the communications among individual AI systems. But after all, that is no more than a group of well-collaborated scientists.

However, there is still hope. We can do something like this: When we know truly what AI is and how intelligence works in our human brain, which is not that difficult, then we can develop a artificial brain(AB) that is functionally the same as the biological brain(BB), except that it is implemented by man made techniques, and will never die. A further step we need to go through is to develop a method to connect AB to BB, let the artificial neurons and biological neurons work together, exchange information freely. We make sure that at first, the portion of AB is 0%. Then the portion of AB goes up gradually by substituting neurons in BB one by one, using neurons in AB. Finally, we get a AB that never dies, and it is you. At any time when the substituting is happening, you are still alive and have your complete, unique personality with the hybrid brain. Once you are 100% in AB, then you can base your body on whatever you want, thus you never die. This is not that difficult compared to the biological approach, and is hopefully possible in the near future. I’m looking forward to that.

If you watched the Tron movie, this makes a reasonable explanation to the fact that people can change their physical forms to the digital correspondences, and still maintains their complete personalities continuously.

Leave a Comment April 26, 2011

The Secret

I believe this is the spirit of America. The law of attraction.

YouTube Preview Image

 

Leave a Comment April 17, 2011

这俩人真好玩

前两天看到这个视频,感动得那个是旺。。。回想我爸我妈,我妈的五笔是我教会的,后来不知怎么地我爸我妈都会了。。。后来又都会用QQ了

My Parents on QQ

我给“爸爸”发了消息问有没有起床,结果是老妈回的,说还在睡 :D

1 Comment February 14, 2011

蒙特卡罗法批作业

今天批完495份作业以后,天地突然清静的一刹那,猛然间醒悟过来,其实我批作业用的是蒙特卡罗方法,随机踩点,以偏概全,如果“错误很多”的假设可以成立的话,就自适应地去增加踩点数,最后还根据已经批完的作业情况,增加后续随机踩点的准确率。从这个角度想来,今后如何提高批作业的效率呢,无非就是再多学点统计呀。

1 Comment January 30, 2011

Elevator

When I was waiting for the elevator today, I was thinking about given the condition that I had waited for a longer time, and a small constant $$\delta$$, the probability that the elevator arrives in $$\delta$$ time is getting higher. So I kept waiting. I was waiting with confidence. After a very long time I found that the elevator was broken.

2 Comments January 7, 2011

Standard Breakfast

看过这个贴以后知道好好吃早餐以及好好养生是一种负责任的态度。经过我一段时间来的实践,发现这样一个搭配很不错,省时省力省钱,而且营养好,可以一直吃:

橙汁,虾饺,杂粮粥

其中包括虾饺、杂粮粥、橙汁。虾饺可以在中国超市买到,4个1刀,还是不同种类的拼盘,一次吃4到8个差不多,用微波炉专用蒸笼可以在5分钟内搞定。杂粮粥用慢炖锅可以前一天晚上放上,第二天早上起来直接吃,不用花时间,而且粥里可以放皮蛋瘦肉笋尖做成“皮蛋瘦肉杂粮粥”,味道很不错。杂粮粥里的薏仁还是很好吃的。橙汁要数Minute Maid的最好喝。

这样整个算下来,一顿的成本在3刀左右。早上起来只要有10分钟的时间,就可以吃完。

Leave a Comment December 18, 2010

Snowman

风雨中前行的雪人

风雨中前行的雪人

Leave a Comment December 12, 2010

Previous page


Categories

Archives

Recent Comments

Meta