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
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
be the space of functions over
Boolean inputs. Each
is a
-dimensional vector. Attach to the 
. For Boolean functions 
, where
is the Hamming distance over binary vectors. Let the weight of each
to be set as 1. Let
be defined as the Geodesic distance over
. Then the discrete Laplacian operator is defined as
, define a function
as
,
, such that
, we have![Rendered by QuickLaTeX.com \begin{equation*} \small \begin{array}{l} \left\langle {\phi_{a} ,\phi_{b} } \right\rangle =\frac{1}{2^{n}}\sum\limits_{x\in \left\{ {0,1} \right\}^{n}} {\phi_{a} \left( x \right)\phi_{b} \left( x \right)} \\ =\frac{1}{2^{n}}\sum\limits_{x\in \left\{ {0,1} \right\}^{n}} {\left[ {\left( {-1} \right)^{\sum\limits_{i=1}^n {x_{i} a_{i} } }} \right]\left[ {\left( {-1} \right)^{\sum\limits_{i=1}^n {x_{i} b_{i} } }} \right]} \\ =\frac{1}{2^{n}}\sum\limits_{x\in \left\{ {0,1} \right\}^{n}} {\left( {-1} \right)^{x_{j} a_{j} +x_{j} b_{j} }\left[ {\left( {-1} \right)^{\sum\limits_{i\ne j} {x_{i} a_{i} } }} \right]\left[ {\left( {-1} \right)^{\sum\limits_{i\ne j} {x_{i} b_{i} } }} \right]} \\ =\frac{1}{2^{n}}\sum\limits_{x\in \left\{ {0,1} \right\}^{n},x_{j} =0} {\left( {+1} \right)\left[ {\left( {-1} \right)^{\sum\limits_{i\ne j} {x_{i} a_{i} } }} \right]\left[ {\left( {-1} \right)^{\sum\limits_{i\ne j} {x_{i} b_{i} } }} \right]} \\ +\frac{1}{2^{n}}\sum\limits_{x\in \left\{ {0,1} \right\}^{n},x_{j} =1} {\left( {-1} \right)\left[ {\left( {-1} \right)^{\sum\limits_{i\ne j} {x_{i} a_{i} } }} \right]\left[ {\left( {-1} \right)^{\sum\limits_{i\ne j} {x_{i} b_{i} } }} \right]} \\ =0 \\ \end{array} \end{equation*}](http://www.shaoyuanlong.com/wp-content/ql-cache/quicklatex.com-e3085f6dfea74b2afad7c9a465c60ade_l3.png)
. So the set
is orthonormal, with cardinality
. So the set
forms an orthonormal basis of 

is an eigenfunction of
, with eigenvalue
, which is two times the number of 0′s in
. So there are in total
different eigenvalues of
corresponding eigenvectors.
is finite, there exists amatrix notation
of the Laplacian operator such that
