<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8909074830238091680</id><updated>2026-05-07T16:57:52.595+10:00</updated><category term="R"/><category term="SPSS"/><category term="LaTeX"/><category term="Writing"/><category term="Sweave"/><category term="blogging"/><category term="correlation"/><category term="opinion"/><category term="reproducible research"/><category term="teaching"/><category term="mathematics"/><category term="results"/><category term="scales"/><category term="videos"/><category term="Excel"/><category term="causation"/><category term="factor analysis"/><category term="make"/><category term="references"/><category term="statistics"/><category term="Endnote"/><category term="Inquisit"/><category term="Word"/><category term="computers"/><category term="design"/><category term="literature review"/><category term="Article Deconstruction"/><category term="Eclipse"/><category term="JabRef"/><category term="SEM"/><category term="academia"/><category term="general advice"/><category term="introduction"/><category term="markup"/><category term="multiple regression"/><category term="programming"/><category term="random"/><category term="repeated measures"/><category term="social network analysis"/><category term="software"/><category term="statistical consulting"/><category term="tables"/><category term="tests"/><category term="vim"/><category term="APAStyle"/><category term="BibTeX"/><category term="I/O Psych"/><category term="RSS"/><category term="bootstrapping"/><category term="experiments"/><category term="markdown"/><category term="mediation"/><category term="nonlinear regression"/><category term="presentations"/><category term="psychology"/><category term="reliability"/><category term="summary post"/><category term="version_control"/><category term="Australia"/><category term="Beamer"/><category term="CFA"/><category term="Literate programming"/><category term="StatET"/><category term="basic analyses"/><category term="data mining"/><category term="data sharing"/><category term="internet"/><category term="logistic regression"/><category term="market research"/><category term="matrix algebra"/><category term="method"/><category term="modelling"/><category term="moderation"/><category term="personality"/><category term="power"/><category term="reaction time"/><category term="surveys"/><category term="thinking"/><category term="validity"/><category term="GEE"/><category term="Jing"/><category term="Journal Article Deconstruction"/><category term="OpenMX"/><category term="Twitter"/><category term="WinEdt"/><category term="ability"/><category term="bayesian"/><category term="binary variable"/><category term="book review"/><category term="calculus"/><category term="cluster analysis"/><category term="descriptive statistics"/><category term="difference scores"/><category term="discriminant function analysis"/><category term="dyads"/><category term="focus groups"/><category term="formatting"/><category term="fun"/><category term="ggplot2"/><category term="interviews"/><category term="jags"/><category term="job satisfaction"/><category term="linux"/><category term="measurement"/><category term="meta-analysis"/><category term="metadata"/><category term="missing data"/><category term="multilevel"/><category term="normality"/><category term="ordinal variables"/><category term="outliers"/><category term="pandoc"/><category term="path analysis"/><category term="polychoric"/><category term="probability"/><category term="publishing"/><category term="qualitative research"/><category term="regular expressions"/><category term="reroducible research"/><category term="sampling"/><category term="selection and recruitment"/><category term="skill acquisition"/><category term="stackexchange"/><category term="tetrachoric"/><title type='text'>Jeromy Anglim&amp;#39;s Blog: Psychology and Statistics</title><subtitle type='html'>Posts on statistics, study design, statistical computing, R, and more with a focus on research applications in psychology.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jeromyanglim.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/-/LaTeX'/><link rel='alternate' type='text/html' href='http://jeromyanglim.blogspot.com/search/label/LaTeX'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>jeromyanglim</name><uri>http://www.blogger.com/profile/12949204812496382042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>21</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8909074830238091680.post-3701350170539785240</id><published>2012-07-23T23:20:00.000+10:00</published><updated>2012-07-23T23:20:42.143+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX"/><category scheme="http://www.blogger.com/atom/ns#" term="make"/><category scheme="http://www.blogger.com/atom/ns#" term="markdown"/><category scheme="http://www.blogger.com/atom/ns#" term="pandoc"/><title type='text'>Beamer presentations using pandoc, markdown, LaTeX, and a makefile</title><content type='html'>&lt;p&gt;This post discusses the creation of beamer presentations using a combination of
markdown, pandoc, and LaTeX. This workflow offers the potential to reduce typing
and increase readability of beamer presentation source code. Source code for an example
presentation is provided containing markdown and LaTeX source code along with
a makefile for building the beamer PDF. &lt;/p&gt;

&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;

&lt;h3&gt;Motivation&lt;/h3&gt;

&lt;p&gt;I&#39;ve used beamer quite a lot to prepare slides for both research and teaching
purposes (e.g., 
&lt;a href=&quot;https://github.com/jeromyanglim/RMeetup_Workflow&quot;&gt;this 2010 presentation on R Workflow&lt;/a&gt;). 
I&#39;ve also written up a 
&lt;a href=&quot;http://jeromyanglim.blogspot.com.au/2010/08/getting-started-with-beamer-tips-and.html&quot;&gt;guide to getting started with beamer&lt;/a&gt; and 
&lt;a href=&quot;http://jeromyanglim.blogspot.com.au/2010/08/simple-beamer-template-for-getting.html&quot;&gt;a simple beamer template&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Nonetheless, for some time I&#39;ve been concerned about the high ratio of markup to
content in beamer presentations. I even asked a question on TeX.SE on &lt;a href=&quot;http://tex.stackexchange.com/questions/1264/typing-and-editing-beamer-presentations&quot;&gt;strategies
for dealing with this
issue&lt;/a&gt;.
I find that beamer markup is a burden. It interferes with content creation.
Creating, editing, and re-arranging slides is more difficult than it needs to
be. The high quantity of markup also interferes with readability.&lt;/p&gt;

&lt;p&gt;Several ways of dealing with this.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://tex.stackexchange.com/questions/4106/what-are-a-good-set-of-macros-for-writing-beamer-presentations?lq=1&quot;&gt;Use LaTeX macros&lt;/a&gt;: I.e., to shorten common environments. 
However, this reduces readability if it is ad hoc.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://tex.stackexchange.com/a/1303/151&quot;&gt;Org Mode in Emacs&lt;/a&gt;. This sounds
good, but I&#39;m more experienced with Vim.&lt;/li&gt;
&lt;li&gt;Code Snippets. Code snippets partially solve the typing issue, but they don&#39;t
solve the readability issue.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the end, I decided to explore the combination of pandoc, markdown, and LaTeX
to create a beamer presentation.
The reasons for this included that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://daringfireball.net/projects/markdown/&quot;&gt;Markdown&lt;/a&gt; is a really intuitive
markup format that is easy to read and easy to modify.&lt;/li&gt;
&lt;li&gt;When pandoc converts markdown to LaTeX, any LaTeX is passed straight through. Thus,
it is possible to obtain customisation beyond the basic options provided by
markdown.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Existing resources on combining Beamer, markdown and pandoc&lt;/h3&gt;

&lt;p&gt;John MacFarlane, author of pandoc, has some &lt;a href=&quot;http://johnmacfarlane.net/pandoc/demo/example9/producing-slide-shows-with-pandoc.html&quot;&gt;relevant documentation on slide
production&lt;/a&gt;
Important points:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The basic compilation command is: &lt;code&gt;pandoc -t beamer my_source.md -o my_beamer.pdf&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;The post explains the slide separation rules. &lt;/li&gt;
&lt;li&gt;You can have incremental lists by pre-pending dot points with the greater than symbol &lt;/li&gt;
&lt;li&gt;Beamer Themes can be used via the &lt;code&gt;-V&lt;/code&gt; option e.g., (&lt;code&gt;-V theme:Warsaw&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;It shows how the first few lines of the file pre-pended by &lt;code&gt;%&lt;/code&gt; are incorporated into the title slide&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Stephen Sinclair &lt;a href=&quot;http://www.music.mcgill.ca/~sinclair/content/blog/using_markdown_for_beamer_presentations&quot;&gt;has a tutorial&lt;/a&gt;.
Relevant points include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Latex gets passed directly through
&lt;ul&gt;
&lt;li&gt;Equations can be passed directly through&lt;/li&gt;
&lt;li&gt;Image size and placement can be controlled in detail with latex e.g., &lt;code&gt;\centerline{\includegraphics[height=2in]{my_image.pdf}}&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;You can use bibtex for citations&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;He also mentions a number of other options for compiling the document
involving templates, regular expressions, and so on. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;My approach&lt;/h3&gt;

&lt;p&gt;My approach involved running a makefile which converted a markdown file into
a tex file, which was then incorporated into another tex file and then converted
into a pdf. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The repository containing all files is available on github:
&lt;a href=&quot;https://github.com/jeromyanglim/rmarkdown-rmeetup-2012/tree/master/talk&quot;&gt;https://github.com/jeromyanglim/rmarkdown-rmeetup-2012/tree/master/talk&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The &lt;a href=&quot;https://github.com/jeromyanglim/rmarkdown-rmeetup-2012/blob/master/talk/main.pdf?raw=true&quot;&gt;presentation PDF&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To use the approach you would need the following software:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;LaTeX distribution with beamer package&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://johnmacfarlane.net/pandoc/&quot;&gt;pandoc&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;support for &lt;code&gt;make&lt;/code&gt;: On Linux, make is installed by default; on Windows, you may
need something like &lt;a href=&quot;http://www.cygwin.com/&quot;&gt;cygwin&lt;/a&gt; or
&lt;a href=&quot;http://cran.r-project.org/bin/windows/Rtools/&quot;&gt;Rtools&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;makefile&lt;/h4&gt;

&lt;p&gt;The makefile was as follows:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;pdf:
    pandoc talk.md --slide-level 2 -t beamer -o talk.tex
    pdflatex main.tex
    pdflatex main.tex
    -xdg-open main.pdf
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;pandoc&lt;/code&gt; converted &lt;code&gt;talk.md&lt;/code&gt; into a beamer latex file &lt;code&gt;talk.tex&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--slide-level 2&lt;/code&gt; meant that level 1 markdown headings (i.e., lines preceded
with a single hash: &lt;code&gt;# Section name&lt;/code&gt;) represented section headings used in the
presentation, and level 2 headings (i.e., lines preceded with two hashes &lt;code&gt;##
Slide Title&lt;/code&gt;) represented new slides and their title.&lt;/li&gt;
&lt;li&gt;The line &lt;code&gt;-xdg-open main.pdf&lt;/code&gt; opens the resulting pdf file on Linux, but
&lt;code&gt;xdg-open&lt;/code&gt;
could be replaced by the name of pdf viewer (e.g., on a different operating system).&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Preamble LaTeX file: &lt;code&gt;main.tex&lt;/code&gt;&lt;/h4&gt;

&lt;p&gt;I had a main LaTeX file (&lt;code&gt;main.tex&lt;/code&gt;) as follows: &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;\documentclass[t]{beamer}  
\usetheme{Berkeley}                 
\setbeamertemplate{navigation symbols}{}
\title{MY_TALK_TITLE}
\subtitle{MY_TALK_SUBTITLE}
\author{MY_NAME}
\institute{MY_INSTITUTION}
\date{DATE_OF_MY_TALK}

% more preamble...

\begin{document}
\begin{frame}
\titlepage
\end{frame}

\begin{frame}
\frametitle{Outline}
\tableofcontents
\end{frame}

\input{&quot;talk.tex&quot;}

\end{document}
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;The file is completely in latex and includes the preamble the document
environment, some opening slides with particular features, and the input
command which reads in the file &lt;code&gt;talk.tex&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;talk.tex&lt;/code&gt; is generated by pandoc from &lt;code&gt;talk.md&lt;/code&gt; and contains all the
individual content slides.&lt;/li&gt;
&lt;li&gt;I prefer to exclude navigation symbols.&lt;/li&gt;
&lt;li&gt;Naturally, &lt;code&gt;usetheme&lt;/code&gt; could be altered to some other theme (see the &lt;a href=&quot;http://www.hartwork.org/beamer-theme-matrix/&quot;&gt;beamer
theme matrix&lt;/a&gt;), such as &lt;code&gt;default&lt;/code&gt;. &lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Body markdown slide file: &lt;code&gt;talk.md&lt;/code&gt;&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;talk.md&lt;/code&gt; contained all the individual markdown slides.&lt;/p&gt;

&lt;p&gt;For example a basic slide might look as follows:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# NAME OF A SECTION
## SLIDE TITLE
* Some point to make
    * Another point
    * Another point
* Some point to make
    * Another point
    * Another point
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;The first line adds a section title. This is not part of the slide, but can be
used to generate table of contents, and in slide navigation.&lt;/li&gt;
&lt;li&gt;The second line starts a new slide with the content to the right of the double
hash constituting the slide title.&lt;/li&gt;
&lt;li&gt;And then subsequent lines generate a two-level list represented in LaTeX using
the &lt;code&gt;itemize&lt;/code&gt; environment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In general, markdown is converted by pandoc into sensible beamer content. See the &lt;a href=&quot;https://raw.github.com/jeromyanglim/rmarkdown-rmeetup-2012/master/talk/talk.md&quot;&gt;actual
markdown file talk.md&lt;/a&gt;
and resulting &lt;a href=&quot;https://raw.github.com/jeromyanglim/rmarkdown-rmeetup-2012/master/talk/talk.tex&quot;&gt;tex file talk.tex&lt;/a&gt;.
However, pandoc passes any LaTeX through as is, and this is sometimes required.&lt;/p&gt;

&lt;p&gt;For incorporating images, I found the default markdown image command led to an
excessively large image.
Thus, I used LaTeX for images. 
I&#39;d like to think that there is a way of making default images work well, but
I didn&#39;t work it out.
Thus, instead, I used commands like the following:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;## SLIDE TITLE
\includegraphics[width=4in]{FIGURE_FILE_NAME.PNG}
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;I often had to tweak the image width to get it the right size.&lt;/li&gt;
&lt;li&gt;I also read about some other options, which I &lt;a href=&quot;https://github.com/jeromyanglim/rmarkdown-rmeetup-2012/issues/4#issuecomment-6952495&quot;&gt;discuss
here&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Obviously there are many reasons that you might want to fall back to LaTeX.
In my talk, I tried to keep things simple, so the main instances were:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Images as shown above&lt;/li&gt;
&lt;li&gt;Small text for footnotes often with a url inside: e.g., &lt;code&gt;\tiny{some text and
a link: \url{http://jeromyanglim.blogspot.com}}&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Large text at the end of the talk: e.g., &lt;code&gt;\begin{center} \LARGE{Questions?} \end{center}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;Overall, there were pros and cons to the approach I adopted. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;By incorporating markdown and pandoc, there was an extra layer of complexity
to think about to ensure that the conversion process had the desired effect.
Error messages were sometimes more difficult to diagnose. &lt;/li&gt;
&lt;li&gt;There were a lot of situations where you might want to have more control
over slide content than what you get by default with Markdown. &lt;/li&gt;
&lt;li&gt;There is an argument to suggest that slide creation is best in a WYSIWIG
environment where you can manually tweak image positioning and layout. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Nonetheless, I really liked how easy it was to create, edit, and read dot points,
nested dot points, frames, sections, and basic formatting, and in general it was
relatively easy to incorporate LaTeX when required.
I also like the idea of where possible using open plain-text file formats to
take advantage of easier programmability, version control, incorporating into
a powerful text editor, simpler conversion, and so on.&lt;/p&gt;

&lt;h3&gt;Other aspects&lt;/h3&gt;

&lt;p&gt;The following are a few other aspects that might interest some readers,
particularly Vim users.&lt;/p&gt;

&lt;h4&gt;Syntax highlighting of markdown+LaTeX in Vim&lt;/h4&gt;

&lt;p&gt;There is a Vim plugin for pandoc that provides many features including syntax
highlighting for documents that combine multiple markups including markdown and
LaTeX. I found it best to install the latest version available on github:
&lt;a href=&quot;https://github.com/vim-pandoc/vim-pandoc&quot;&gt;https://github.com/vim-pandoc/vim-pandoc&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;Code folding of markdown-Beamer&lt;/h4&gt;

&lt;p&gt;I also have the following script in my &lt;code&gt;.vimrc file&lt;/code&gt;. 
The great thing about it is that it allows code folding if you use hash style
markdown headings.
It is setup to only fold on headings 1 and 2. 
This corresponds to sections and slides in my pandoc setting for beamer markdown documents.
To increase the level, change it to &lt;code&gt;MarkdownLevel(3)&lt;/code&gt;, etc.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;function! MarkdownLevel(maxlevel)
    if a:maxlevel &amp;gt;= 1 &amp;amp;&amp;amp; getline(v:lnum) =~ &#39;^# .*$&#39;
        return &quot;&amp;gt;1&quot;
    endif
    if a:maxlevel &amp;gt;= 2 &amp;amp;&amp;amp; getline(v:lnum) =~ &#39;^## .*$&#39;
        return &quot;&amp;gt;2&quot;
    endif
    if a:maxlevel &amp;gt;= 3 &amp;amp;&amp;amp; getline(v:lnum) =~ &#39;^### .*$&#39;
        return &quot;&amp;gt;3&quot;
    endif
    if a:maxlevel &amp;gt;= 4 &amp;amp;&amp;amp; getline(v:lnum) =~ &#39;^#### .*$&#39;
        return &quot;&amp;gt;4&quot;
    endif
    if a:maxlevel &amp;gt;= 5 &amp;amp;&amp;amp; getline(v:lnum) =~ &#39;^##### .*$&#39;
        return &quot;&amp;gt;5&quot;
    endif
    if a:maxlevel &amp;gt;= 6 &amp;amp;&amp;amp; getline(v:lnum) =~ &#39;^###### .*$&#39;
        return &quot;&amp;gt;6&quot;
    endif
    return &quot;=&quot; 
endfunction

au BufEnter *.md  setlocal foldexpr=MarkdownLevel(2)  
au BufEnter *.md  setlocal foldmethod=expr     
au BufEnter *.md  setlocal autoindent
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then the following Vim commands in normal model make folding, navigation, and
getting a sense of structure really easy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;zx&lt;/code&gt; show current line and necessary headings; close other headings&lt;/li&gt;
&lt;li&gt;&lt;code&gt;zc&lt;/code&gt; close heading&lt;/li&gt;
&lt;li&gt;&lt;code&gt;zj&lt;/code&gt; and &lt;code&gt;zk&lt;/code&gt; to move down and up headings&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Showing backticks and single quotes properly in code&lt;/h4&gt;

&lt;p&gt;I often need to show code, and backticks and single quotes weren&#39;t showing
properly.
The following code in my LaTeX preamble drawn from &lt;a href=&quot;http://tex.stackexchange.com/questions/63353/&quot;&gt;this TeX.SE
question&lt;/a&gt; solved the problem:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;% enables straight single quote
\makeatletter
\let \@sverbatim \@verbatim
\def \@verbatim {\@sverbatim \verbatimplus}
{\catcode`&#39;=13 \gdef \verbatimplus{\catcode`&#39;=13 \chardef &#39;=13 }} 
\makeatother

% enables backticks in verbatim
\makeatletter
{\catcode`\`=13
\xdef\@verbatim{\unexpanded\expandafter{\@verbatim}\chardef\noexpand`=18 }
}
\makeatother
&lt;/code&gt;&lt;/pre&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/3701350170539785240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/3701350170539785240'/><link rel='alternate' type='text/html' href='http://jeromyanglim.blogspot.com/2012/07/beamer-pandoc-markdown.html' title='Beamer presentations using pandoc, markdown, LaTeX, and a makefile'/><author><name>jeromyanglim</name><uri>http://www.blogger.com/profile/12949204812496382042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-8909074830238091680.post-3259543894656380636</id><published>2012-06-10T00:20:00.000+10:00</published><updated>2012-07-17T16:44:40.637+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JabRef"/><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX"/><category scheme="http://www.blogger.com/atom/ns#" term="R"/><category scheme="http://www.blogger.com/atom/ns#" term="reproducible research"/><category scheme="http://www.blogger.com/atom/ns#" term="Sweave"/><title type='text'>Converting Sweave LaTeX to knitr LaTeX: A case study</title><content type='html'>&lt;p&gt;The following post documents the steps I needed to take in order to convert a
project using Sweave LaTeX into one using knitr LaTeX.&lt;/p&gt;

&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;

&lt;h4&gt;Additional Resources&lt;/h4&gt;

&lt;p&gt;It is fairly straightforward to convert a document from Sweave LaTeX to knitr
LaTeX. &lt;a href=&quot;http://yihui.name/&quot;&gt;Yihui Xie&lt;/a&gt; on the knitr website provides the
following useful resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://yihui.name/knitr/demo/sweave/&quot;&gt;Transition to Sweave from knitr&lt;/a&gt;: This
document describes knitr specifically from the perspective of what is the same
as Sweave and what is different from Sweave.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://yihui.name/knitr/options&quot;&gt;knitr options&lt;/a&gt;: This includes discussion of
the many R code chunk options in knitr. Many are the same as Sweave, but there
are some new ones, and some modifications.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://yihui.name/knitr/demo/minimal/&quot;&gt;knitr minimal examples&lt;/a&gt;: These are
useful for getting started with different types of knitr document including
LaTeX.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;My conversion from Sweave to knitr&lt;/h3&gt;

&lt;p&gt;The following documents the steps I needed to do in order to convert a journal
article that was in Sweave LaTeX into a knitr LaTeX document.
Most of this was documented in the above mentioned links on the knitr website,
but there were still a few little surprises.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Rnw to tex conversion&lt;/strong&gt;: Convert &lt;code&gt;R CMD Sweave myfile.rnw&lt;/code&gt; to &lt;code&gt;Rscript -e
&quot;library(knitr); knit(&#39;myfile.nw&#39;)&quot;&lt;/code&gt; in makefile (&lt;a href=&quot;http://stackoverflow.com/a/10943794/180892&quot;&gt;see this SO
question&lt;/a&gt; ).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;global options&lt;/strong&gt;: Replace &lt;code&gt;\SweaveOpts{echo=FALSE}&lt;/code&gt; with
&lt;code&gt;\Sexpr{opts_chunk$set(echo=FALSE)}&lt;/code&gt;; This needed to appear before the first
R code chunk in order to affect all code chunks in the file. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;case on R code chunk options&lt;/strong&gt;: Update &lt;code&gt;true&lt;/code&gt; and &lt;code&gt;false&lt;/code&gt; to &lt;code&gt;TRUE&lt;/code&gt; and
&lt;code&gt;FALSE&lt;/code&gt; in r code chunk options. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;results option&lt;/strong&gt;: Update &lt;code&gt;results=tex&lt;/code&gt; to &lt;code&gt;results=&#39;asis&#39;&lt;/code&gt; and in general ensure that text
values in R code chunks are surrounded by quotation marks.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;message option&lt;/strong&gt;: I needed to prevent the display of messages when certain
packages were loaded using &lt;code&gt;\Sexpr{opts_chunk$set(message=FALSE}}&lt;/code&gt;. &lt;br /&gt;
These messages did not previously display under sweave.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;hiding output&lt;/strong&gt;: I had some R code chunks with options &lt;code&gt;print=FALSE,
term=FALSE&lt;/code&gt;; I replaced this with &lt;code&gt;results=&#39;hide&#39;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;methods package&lt;/strong&gt;: I had a &lt;code&gt;densityplot()&lt;/code&gt; (i.e., a lattice plot) that
didn&#39;t display properly.  It instead showed an error: &lt;code&gt;Error using packet 1
could not find function &quot;hasArg&quot;&lt;/code&gt;; apparently this is caused by the fact that
the methods package doesn&#39;t load by default when using &lt;code&gt;Rscript&lt;/code&gt;; thus I
needed to put &lt;code&gt;require(methods)&lt;/code&gt; in the first R code chunk. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sweave.sty&lt;/strong&gt;: I removed &lt;code&gt;Sweave.sty&lt;/code&gt; from my project directory and removed
the line &lt;code&gt;\usepackage{Sweave}&lt;/code&gt; from my rnw file as both things are not needed
in knitr.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;caching&lt;/strong&gt;: Although there are packages for enabling caching, I&#39;d never
adopted any of them. knitr makes caching very simple. I just added
&lt;code&gt;cache=TRUE&lt;/code&gt; to the global chunk options (i.e.,
&lt;code&gt;\Sexpr{opts_chunk$set(echo=FALSE, message=FALSE, cache=TRUE)}&lt;/code&gt;. This reduced
the time to build the PDF from around 5 seconds to 1 second. I&#39;m also planning
to incorporate some Bayesian analyses with JAGS and rjags, where I&#39;m expecting
analyses will take several minutes or longer to run. At that point, I&#39;ll
really appreciate the speed benefits of caching.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;to make or not to make&lt;/strong&gt;: I had a custom makefile on the project that kept
everything neat and tidy, copying source files into a build directory, running
all necessary commands to convert from rnw to tex and then to pdf, and then
opening the pdf in a viewer. This still works well. However, the default
&quot;Compile to PDF&quot; option in RStudio was also quite good (after setting tools -
options - Sweave - Weave Rnw files using knitr). In particular, I liked the
synctex support for Sweave that allows you to move from a position in the source
to the corresponding position in the PDF viewer. Also, RStudio in combination
with knitr seems to do a reasonable job of keeping the main project directory
tidy. A few auxiliary files are added, but not too many. I also appreciate the
simplicity that a simple button brings to getting started with analyses.
However, a makefile does make things more portable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My main conclusion from this process is that converting an ongoing Sweave LaTeX
document to knitr LaTeX is fairly straightforward, and there are a number of
useful benefits that arise. In particular, I really appreciate simple caching
and not having to worry about Sweave.sty. Great work Yihui Xie!&lt;/p&gt;

&lt;h3&gt;Additional Resources&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://feeds.feedburner.com/jeromyanglim&quot;&gt;RSS Subscription options&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://jeromyanglim.blogspot.com.au/2012/06/how-to-convert-sweave-latex-to-knitr-r.html&quot;&gt;Convert Sweave LaTEx to knitr R
Markdown&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;
http://jeromyanglim.blogspot.com.au/2012/05/getting-started-with-r-markdown-knitr.html&quot;&gt;Getting started with R Markdown&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://jeromyanglim.blogspot.com.au/2009/06/learning-r-for-researchers-in.html&quot;&gt;Getting started with R&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://jeromyanglim.blogspot.com.au/2010/05/videos-on-data-analysis-with-r.html&quot;&gt;R Videos&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://jeromyanglim.blogspot.com.au/2010/11/makefiles-for-sweave-r-and-latex-using.html&quot;&gt;Sweave and
makefiles&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/3259543894656380636'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/3259543894656380636'/><link rel='alternate' type='text/html' href='http://jeromyanglim.blogspot.com/2012/06/converting-sweave-latex-to-knitr-latex.html' title='Converting Sweave LaTeX to knitr LaTeX: A case study'/><author><name>jeromyanglim</name><uri>http://www.blogger.com/profile/12949204812496382042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-8909074830238091680.post-6254402501596748604</id><published>2011-05-23T16:14:00.000+10:00</published><updated>2011-05-23T16:14:56.455+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="computers"/><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="make"/><category scheme="http://www.blogger.com/atom/ns#" term="vim"/><title type='text'>Transition to Linux and Ubuntu: The Experience of a Quantitative Social Scientist</title><content type='html'>&lt;p&gt;This post discusses my experience migrating to Ubuntu from Windows from the
perspective of a quantitatively oriented researcher in psychology.
It discusses (a) my general transition to open source tools for doing research;
(b) examination of Cygwin;
(c) choosing a Linux distribution;
(d) preparing for installation of Ubuntu;
(e) initial reflections on installing Ubuntu; and
(f) a long list of various solutions to specific problems that I encountered
whilst getting started with Ubuntu.&lt;/p&gt;

&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;

&lt;h3&gt;Context of transition&lt;/h3&gt;

&lt;p&gt;Anyone following this blog for a while will know that I&#39;ve been progressively
migrating to using open source software for doing research.
My first foray into open source started in 2007 when I decided 
to replace SPSS with R.&lt;/p&gt;

&lt;p&gt;As is the case with many open source tools, they have a habit of mutually
reinforcing each other.
The path went something like this (with links pointing to associated blog
posts):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;
http://jeromyanglim.blogspot.com/search/label/LaTeX&quot;&gt;LaTeX&lt;/a&gt; replaced Word as my
scientific document format.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;
http://jeromyanglim.blogspot.com/2010/11/getting-started-with-markdown-benefits.html
&quot;&gt;Markdown replaced Word&lt;/a&gt;
as my document format for note taking and informal documents.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;
http://jeromyanglim.blogspot.com/2010/03/export-from-endnote-to-bibtex-jabref.html
&quot;&gt;Bibtex, Jabref&lt;/a&gt;, and other tools replaced Endnote as a bibliographic reference
management system.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;
http://jeromyanglim.blogspot.com/2011/01/reasons-for-transitioning-to-vim.html&quot;&gt;Vim replaced a host of other IDEs&lt;/a&gt;, 
and text editors; it even replaced MS Word, in that it became the editor for
the plain text file formats (e.g., LaTeX, Sweave, Markdown, etc.) that I use the
most.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;
http://jeromyanglim.blogspot.com/2010/11/getting-started-with-git-egit-eclipse.html
&quot;&gt;git&lt;/a&gt; replaced ad hoc version control systems.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;
http://jeromyanglim.blogspot.com/2010/11/makefiles-for-sweave-r-and-latex-using.html
&quot;&gt;&lt;code&gt;make&lt;/code&gt;&lt;/a&gt;
replaced various manual processes for building final products.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a general summary of this workflow (albeit, prior to the adoption of Vim),
&lt;a href=&quot;
http://jeromyanglim.blogspot.com/2010/12/video-of-reproducible-research-with-r.html
&quot;&gt;see this video that I gave at Melbourne R Users in late 2010&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;However, I still needed to cut ties from Windows, the operating system I&#39;d been
using for 15 years.
I&#39;d been putting off adopting Linux for several reasons.
I was concerned about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;hardware support for my main computer,&lt;/li&gt;
&lt;li&gt;the temporary drop in performance that results from adopting a new operating
system,&lt;/li&gt;
&lt;li&gt;difficulties collaborating with other researchers operating in the Windows
world,&lt;/li&gt;
&lt;li&gt;lack of support for various key programs (e.g., Outlook; Inquisit), and&lt;/li&gt;
&lt;li&gt;the possibility that some tasks would be less efficient under Linux.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Despite these concerns, I decided to finally dive in.&lt;/p&gt;

&lt;h3&gt;Initial foray into Cygwin&lt;/h3&gt;

&lt;p&gt;About a month prior to making the switch I&#39;d installed
&lt;a href=&quot;http://www.cygwin.com/&quot;&gt;Cygwin&lt;/a&gt; on Windows.
This gave me access to many Linux command-line programs.
However, ultimately, while Cygwin whet my appetite, it failed to satisfy.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;By default, Cygwin does not always play nicely with non-Cygwin programs.
File paths often get confused.
If it can&#39;t play nicely with Windows programs, I might as well go all the way.&lt;/li&gt;
&lt;li&gt;There are issues of where to store files (Cygwin home or Windows user home).&lt;/li&gt;
&lt;li&gt;Some Linux programs are not included.&lt;/li&gt;
&lt;li&gt;The speed of the terminal and shell was often poor.&lt;/li&gt;
&lt;li&gt;In general, interacting with other programs was a frustrating experience.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While some of these challenges probably could have been overcome, it felt silly
investing time in learning the idiosyncrasies of a system that only goes
half-way to creating a genuine unix experience.&lt;/p&gt;

&lt;h3&gt;Choosing a Linux distribution&lt;/h3&gt;

&lt;p&gt;The first decision involved choosing a Linux distribution.
I decided on Ubuntu for several reasons.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It&#39;s a popular Linux distribution.&lt;/li&gt;
&lt;li&gt;It seems like a good distribution for people new to Linux.&lt;/li&gt;
&lt;li&gt;Hardware support looked encouraging.&lt;/li&gt;
&lt;li&gt;I&#39;d heard it was well suited as a personal desktop&lt;/li&gt;
&lt;li&gt;I&#39;d also heard that ultimately Linux is configurable and thus, the
distribution does not provide major constraints; furthermore basic unix
command-line programs should work in all distributions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Preparing to install Ubuntu&lt;/h3&gt;

&lt;p&gt;I approached the installation of Ubuntu with trepidation.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I read a lot about partitioning and dual-booting on &lt;a href=&quot;
https://help.ubuntu.com/community/HowtoPartition&quot;&gt;Ubuntu documentation&lt;/a&gt; and &lt;a href=&quot;
http://www.psychocats.net/ubuntu/partitioning&quot;&gt;psychocats&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;I backed up my data (of course) before starting installation.&lt;/li&gt;
&lt;li&gt;I thought a lot about setting up my partitions. 
In the end I decided on a dual-boot partition.
I have a solid state drive which is really fast, but capacity is not that high
(only 120gb).
Thus, I had to be careful with assigning space.
I gave 40gb to Windows and 80gb to Ubuntu.
This required the removal of many unwanted files from the Windows partition.&lt;/li&gt;
&lt;li&gt;I created and trialled the Ubuntu Live USB to check for hardware support, and
everything seemed to be working surprisingly well on my Dell Latitude laptop.&lt;/li&gt;
&lt;li&gt;I then installed Ubuntu, letting the Ubuntu installer handle the hard drive
partitioning.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To my pleasant surprise, the installation was smooth, involving minimal choices.
The Ubuntu installation successfully partitioned my hard drive, and the core
features of my laptop still worked (sleep, hibernate, wifi, volume buttons,
graphics card, and so on).
Furthermore, I was still able to boot into Windows for when I really needed to
use Windows-only software.&lt;/p&gt;

&lt;h3&gt;Reflection on the installation&lt;/h3&gt;

&lt;p&gt;Switching operating systems is painful even when the new operating system
is better than the old one.
Many little tasks that were once automatic need to be automated in a new way.
Furthermore, to fully grok the new system, it is often necessary to do more than
map the old workflow onto the new system.&lt;/p&gt;

&lt;p&gt;For the most part the switch to Ubuntu has been smoother than I was expecting.
The first week involved dealing with a wide range of fundamental issues related
to software installation and system configuration.
However, in general, these issues have been resolved by a few Internet searches
and asking questions on &lt;a href=&quot;http://askubuntu.com/&quot;&gt;Ask Ubuntu&lt;/a&gt; (a Stack
Exchange Q+A site).&lt;/p&gt;

&lt;p&gt;The following were some of the main issues I encountered:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Linking with my university email / calendar Exchange server has been painful.
After two weeks, this still remains my biggest pain; The email program
Evolution basically works, but is painfully slow at times, often freezes, and
often produces errors.&lt;/li&gt;
&lt;li&gt;Configuring the Unity desktop (the default behaviour of the 11.04 launcher
is awful) took a bit of searching.&lt;/li&gt;
&lt;li&gt;Configuring so that I could move between laptop monitor configurations
required some fiddling.&lt;/li&gt;
&lt;li&gt;Configuring my &lt;code&gt;vimrc&lt;/code&gt; took some work. I had a number of file format issues
related to text files having inappropriate line feeds (i.e., Windows text
files instead of Unix text files).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Despite these issues I&#39;m really enjoying using Ubuntu.
Adopting a Vim + command-line workflow is so much easier, and I&#39;m gradually
incorporating some of the great Linux tools into my workflow.&lt;/p&gt;

&lt;h3&gt;Some reading&lt;/h3&gt;

&lt;p&gt;As part of the transition, I&#39;ve also been reading a few books:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Harley Hahn&#39;s guide to Unix and Linux - Harley Hahn
&lt;ul&gt;
&lt;li&gt;This one was quite pedagogical in flavour and a bit wordy at times, but
did provide a helpful introduction to Linux.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;UNIX power tools - Jerry Peek, Tim O&#39;Reilly, Mike Loukide
&lt;ul&gt;
&lt;li&gt;This book is massive. &lt;/li&gt;
&lt;li&gt;It provides heaps of short articles outlining useful tricks for getting
more out of Unix / Linux.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Learning the bash Shell - Cameron Newham, Bill Rosenblatt&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Looking forward&lt;/h3&gt;

&lt;p&gt;As I get settled into the new operating system I&#39;m looking forward to 
really incorporating the tools available into my research workflow.&lt;/p&gt;

&lt;p&gt;Some of the things I&#39;m looking forward to (which I may blog about at some point,
&lt;a href=&quot;
http://feeds.feedburner.com/jeromyanglim&quot;&gt;see here for Blog RSS subscription options&lt;/a&gt;)
include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Writing some bash scripts and Vim commands to enable me to link bibtex
citations to stored pdfs of journal articles;&lt;/li&gt;
&lt;li&gt;Taking advantage of the command-line for file manipulation, running R,
creating LaTeX documents, and more; and&lt;/li&gt;
&lt;li&gt;Dabbling in sed, awk, Python for better text manipulation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now with the first two weeks of initial adjustment out of the way, the subtler
phase of tweaking and refinement begins.
If you&#39;ve made the switch to Linux particularly within the context of research
and data analysis, I&#39;d be keen to hear your experience.&lt;/p&gt;

&lt;h3&gt;Assorted Resolved Issues&lt;/h3&gt;

&lt;h4&gt;Overview&lt;/h4&gt;

&lt;p&gt;The rest of this post documents a wide range of problems that I encountered when
getting started with Ubuntu and the solutions that I adopted.
The caveat applies that I&#39;m pretty new to Ubuntu, so the solutions may not
be best practice.
Furthermore, they may not make for interesting reading unless perhaps you&#39;ve
stumbled onto this post through Google searching for the specific problem.&lt;/p&gt;

&lt;h4&gt;Overhaul file system&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;What are the implications of Linux for how my file system should be organised?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;p&gt;I used the transition to Linux to overhaul my file system.
I was keen to use the terminal to access files.
Good file names for terminal access are different to that for a point-and-click
environment.&lt;/p&gt;

&lt;p&gt;Some general principles that guided the new file system&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Remove spaces from file names 
&lt;ul&gt;
&lt;li&gt;It&#39;s a pain to have to escape spaces (&lt;code&gt;\&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;I replaced spaces with hyphen &quot;-&quot;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Convert file names to lower case where possible
&lt;ul&gt;
&lt;li&gt;Linux is case sensitive&lt;/li&gt;
&lt;li&gt;It&#39;s quicker to type lower case&lt;/li&gt;
&lt;li&gt;Consistency reduces confusion&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Prefer file and folder names unique in the first few letters
&lt;ul&gt;
&lt;li&gt;This facilitates tab completion&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Prefer short, descriptive, and memorable file names&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I also found it particularly useful to do a general reflection on my file
structure.
I cleaned up the hierarchy so that all my core activities had a location in the
file system.&lt;/p&gt;

&lt;h4&gt;Accessing Windows Drive from Ubuntu&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Are there any issues with accessing the Windows OS partition from Ubuntu?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;It&#39;s easy.
It shows up as a mounted drive called &quot;OS&quot;.
It&#39;s path was &lt;code&gt;/media/OS&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Monitoring processes and use of system resources&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;What is the Ubuntu equivalent of &lt;code&gt;Ctrl+Alt+Delete&lt;/code&gt; for viewing active
processes and memory and processor usage?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;There is a program called &quot;System Monitor&quot;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Command prompt for terminal colour&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;It seems to me that it might be useful to make the command prompt a different
colour to help make it clear where one command starts and output begins a little
clearer.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How can this be done?&lt;/li&gt;
&lt;li&gt;What are good colour options?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Sites discussing the issue
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix/&quot;&gt;cyberciti&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://wiki.archlinux.org/index.php/Color_Bash_Prompt&quot;&gt;archlinux wiki&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;.bashrc&lt;/code&gt; file that came with Ubuntu had a setting that could be enabled to
have a colour prompt.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Opening common binary files from command-line&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;How can common binary files (e.g., PDF, Word, Excel, PowerPoint) be opened
from the command line?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gnome-open&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;This command can be followed by filenames, web addresses, directories, and
will typically do some appropriate default action.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;gnome-open .&lt;/code&gt; opens the current directory in Nautilus&lt;/li&gt;
&lt;li&gt;&lt;code&gt;alias go=’gnome-open’&lt;/code&gt; or equivalent may be useful&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Keyboard shortcuts for size window left or right half of screen&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;I tend to work on a large monitor with space for Windows on the left and right
side of the screen.
I like to have a keyboard shortcut which sizes a window to the left or right of
the screen.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How can this be done on Ubuntu?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Ubuntu does support half Desktop sizing by dragging a window with the mouse to
the left or right most side of the desktop.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;keyboard shortcuts&lt;/code&gt; offers some options for moving windows, including
maximise vertically or maximise horizontally, but no option for positioning
window on left half of screen.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Ctrl+Alt+NumPad Key&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I learnt the &lt;a href=&quot;
http://askubuntu.com/questions/39740/is-there-a-unity-compiz-shortcut-key-to-move-a-window-to-your-other-monitor-no&quot;&gt;following on
askubuntu&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;By default Ubuntu supports shortcut keys for window manipulation (e.g.,
&lt;code&gt;Ctrl+Alt+NumPad4&lt;/code&gt; maximises a window vertically on the left half of the
screen and &lt;code&gt;Ctrl+Alt+NumPad6&lt;/code&gt; does the same but to the right.&lt;/li&gt;
&lt;li&gt;The main annoying aspect of this is that these keys are not suitable for
touch typing.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Solution&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install Advanced Desktop Effects settings (Compiz with Compiz Config)&lt;/li&gt;
&lt;li&gt;Start CompizConfig&lt;/li&gt;
&lt;li&gt;Go to Window Manager - Grid&lt;/li&gt;
&lt;li&gt;Change the key bindings (I chose the following, which have a certain
consistency with Vim movement keys)
&lt;ul&gt;
&lt;li&gt;Super + h (left)&lt;/li&gt;
&lt;li&gt;Super + L (right)&lt;/li&gt;
&lt;li&gt;Super + K (maximise)&lt;/li&gt;
&lt;li&gt;Super + J (restore)&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Shortcut key to initiate web search&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;On windows I had a global shortcut key (Windows+Z) to initiate a Google search.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How can this be done on Ubuntu?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;googlizer&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;This can be used to create command line programs for searching.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Chrome
&lt;ul&gt;
&lt;li&gt;Start chrome&lt;/li&gt;
&lt;li&gt;Type search term in address bar&lt;/li&gt;
&lt;li&gt;Making &lt;code&gt;google.com&lt;/code&gt; the home page can speed this up&lt;/li&gt;
&lt;li&gt;Evaluation: 
&lt;ul&gt;
&lt;li&gt;The responsiveness of this is not adequate (a search box is instant;
chrome takes around 1 second to start up)&lt;/li&gt;
&lt;li&gt;It results in the loss of the default Chrome homepage&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;AutoKey
&lt;ul&gt;
&lt;li&gt;A program modelled on AutoHotKey might provide the desired functionality.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;I asked the &lt;a href=&quot;
http://askubuntu.com/questions/42398/shortcut-key-to-simple-textbox-to-perform-google-search
&quot;&gt;question on askubuntu&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;Google Desktop Search with Desktop search disabled was a good choice.&lt;/li&gt;
&lt;li&gt;I changed the default shortcut key to &lt;code&gt;Ctrl+F12&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Using a laptop with multiple external monitors&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;How can a laptop monitor be disabled and an external monitor enabled?&lt;/li&gt;
&lt;li&gt;I use two external monitors, one at home, and one at work.
How can Ubuntu be configured to automatically detect which one is connected?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;When I configure to just use my external monitor and not my laptop monitor and
then unplug the external monitor, the laptop monitor is not activated.
Thus, I can&#39;t use the mouse to reactivate the laptop monitor.
It would be good if Ubuntu could automatically detect the removal of the
external monitor, or alternatively I could have a shortcut key to activate
laptop only mode.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.ubuntugeek.com/enable-ctrl-alt-backspace-in-ubuntukubuntu-10-04lucid-lynx.html&quot;&gt;ubuntugeek&lt;/a&gt;
describes configuring Ubuntu so that &lt;code&gt;Ctrl+Alt+Backspace&lt;/code&gt; can force a restart
of X&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A user asks about automatic switching of monitor configurations on &lt;a href=&quot;
http://ubuntuforums.org/showthread.php?t=1712863&quot;&gt;Ubuntu
forums&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://ubuntuforums.org/showthread.php?t=1074137&quot;&gt;More suggestions&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I asked the question on
&lt;a href=&quot;&quot;http://askubuntu.com/questions/42390/one-click-shutdown-ubuntu-and-load-into-alternative-bootup&quot;&gt;askubuntu&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I added my answer to the question&lt;/li&gt;
&lt;li&gt;Essentially it involves using a program called &lt;code&gt;disper&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;disper -s&lt;/code&gt; and &lt;code&gt;disper -S&lt;/code&gt; activate primary and secondary monitors
respectively. 
I&#39;ve configured these commands to be triggered by shortcut keys using
CompizConfig.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Launching programs with keyboard shortcuts&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;What is a good strategy for launching programs from keyboard shortcuts?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;CompizConfig makes it easy to create commands and assign shortcut keys.&lt;/li&gt;
&lt;li&gt;The Unity Launcher enables shortcut keys combining the Super key and a number
or typing the Super key and typing a key word.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Restart to Windows&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;My bootloader defaults to Ubuntu.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is there a way to shutdown Ubuntu and boot to Windows without having to make a
selection from the bootloader?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;I asked &lt;a href=&quot;
http://askubuntu.com/questions/42390/one-click-shutdown-ubuntu-and-load-into-alternative-bootup&quot;&gt;the question on Ask Ubuntu&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;I received a good answer, and I added further details on AskUbuntu.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Default terminal size&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;What is a good default Terminal size?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;p&gt;I can always press F11 to get a full-screen terminal.
However, sometimes it is useful to be able to have a reasonable size terminal
come up that does not take over the whole screen.&lt;/p&gt;

&lt;p&gt;I&#39;ve configured the default profile to be 95 columns by 40 rows.
I would choose more rows, but I want the setup to work on my smallest monitor
(i.e., my laptop).&lt;/p&gt;

&lt;h4&gt;Prevent Unity menu from showing&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;At first I thought the Unity menu was okay.
However, I don&#39;t like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the screen real estate that launcher consumes&lt;/li&gt;
&lt;li&gt;the way that it defaults to placing left aligned windows indented with space
to the launcher&lt;/li&gt;
&lt;li&gt;The size of the launcher icons (although at least this can be reduced)&lt;/li&gt;
&lt;li&gt;The way that it stays in focus sometimes for a period of time &lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;p&gt;I asked &lt;a href=&quot;
http://askubuntu.com/questions/42473/how-to-make-unity-launcher-menu-be-almost-always-hidden-and-not-influence-window&quot;&gt;the question on askubuntu&lt;/a&gt; and received a good suggestion.&lt;/p&gt;

&lt;p&gt;In Compix Config set Unity - Hide Launcher to Auto-hide.&lt;/p&gt;

&lt;h4&gt;Configuring Ubuntu for running basic scripts&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;What is a basic strategy for running scripts in Ubuntu?&lt;/li&gt;
&lt;li&gt;How do permanently add the custom script to the path?&lt;/li&gt;
&lt;li&gt;Where should I store throw-away scripts?&lt;/li&gt;
&lt;li&gt;What is a good way to run custom scripts?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;There is a &lt;a href=&quot;http://ubuntuforums.org/showthread.php?t=654612&quot;&gt;discussion of where to store scripts here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;A common place seems to be &lt;code&gt;~/bin&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I did the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;mkdir ~/bin&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;added &lt;code&gt;export PATH=&quot;$PATH:~/bin&quot;&lt;/code&gt; to &lt;code&gt;.bashrc&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Find file by name&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;How can I find a file by a name or part of its name within a specified
directory (or subdirectories)?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Cyberciti provides &lt;a href=&quot;
http://www.cyberciti.biz/tips/linux-findinglocating-files-with-find-command-part-1.html&quot;&gt;a page explaining several options&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;find&lt;/code&gt; command&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The following command would find all files with the &lt;code&gt;txt&lt;/code&gt; extension in &lt;code&gt;~/dir&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;find ~/dir -name &quot;*.txt&quot;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Accessing Ubuntu drive from Windows on dual-boot machine&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;I store my data on my Ubuntu drive.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How can I access my Ubuntu drive from Windows?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;p&gt;This &lt;a href=&quot;
http://www.psychocats.net/ubuntu/partitioning&quot;&gt;page has three options&lt;/a&gt;, the last of which, looks like
what I want.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ext2 Installable File System for Windows
&lt;ul&gt;
&lt;li&gt;This did not work on Windows 7 (perhaps this will change in the future)&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;DiskInternals Linux Reader
&lt;ul&gt;
&lt;li&gt;Evaluation
&lt;ul&gt;
&lt;li&gt;This worked adequately&lt;/li&gt;
&lt;li&gt;This has both the benefit and the problem that it does not alter the
Linux partition&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;How did it work?
&lt;ul&gt;
&lt;li&gt;Start Windows 7&lt;/li&gt;
&lt;li&gt;Install and Start DiskInternals&lt;/li&gt;
&lt;li&gt;Save selected Linux partition files onto Windows partition (I had a
special section)&lt;/li&gt;
&lt;li&gt;View, edit, and change files&lt;/li&gt;
&lt;li&gt;Restart Ubuntu and copy files from Windows partition back into
appropriate location &lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Script fur renaming files in folder&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;I sometimes download files sent to me and want to convert the file names into
more appropriate ones.&lt;/p&gt;

&lt;p&gt;The main conversions that I&#39;d like to see are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;replace spaces with dashes (&quot;-&quot;)&lt;/li&gt;
&lt;li&gt;replace uppercase with lower case&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Others may arise as time goes by.&lt;/p&gt;

&lt;p&gt;The script should take a list of file names.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How can this be done?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;p&gt;I wrote the following script and called it &lt;code&gt;cleannames&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/bash
for file in * ; do mv &quot;$file&quot; `echo &quot;$file&quot; | sed &#39;s/ /-/g&#39;`; done
for file in * ; do mv &quot;$file&quot; `echo &quot;$file&quot; | sed &#39;s/.*/\L&amp;amp;/g&#39;`; done
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;Minimise current window with keyboard shortcut&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;What is the keyboard shortcut to minimise a Window?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Alt+F9 minimises&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Alt+F10 maximise&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Launcher - System Settings - Shortcuts allows for custom shortcut keys&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Terminator Terminal&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Should I adopt Terminator Terminal?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;At present I&#39;m using Gnome Terminal.&lt;/li&gt;
&lt;li&gt;Various reviews suggest that Gnome terminal is a reasonable option in terms of
speed and features.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Preventing automatic shading when watching flash videos&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;I had an ABC video on full screen and after a few minutes, Ubuntu shaded the
screen.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How can this be prevented?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Power Management&lt;/code&gt; has some options&lt;/li&gt;
&lt;li&gt;I disabled the screensaver. That seemed to fix the problem.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Batch renaming of files&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;Unix is case sensitive.
It also encourages substantially greater use of the command-line.
As such, it is useful to adopt file naming conventions that make it easier to
work with files on the command-line.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How can I batch rename files
&lt;ul&gt;
&lt;li&gt;replace underscore with dash&lt;/li&gt;
&lt;li&gt;replace upper case letter with corresponding lower case letter&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Some options
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;KRename&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;for&lt;/code&gt; loop
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;
http://lab.artlung.com/unix-batch-file-rename/&quot;&gt;Tutorial on using for loops&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rename&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Convert underscore to dash:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;`for file in * ; do mv $file `echo $file | sed &#39;s/_//&#39;` ; done`
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Convert upper case letter
&lt;a href=&quot;http://www.ubuntu4life.com/lowercase_files_and_directories&quot;&gt;This tutorial shows&lt;/a&gt;
how to use the convmv command.&lt;/p&gt;

&lt;h4&gt;Kill a program&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;Windows has Ctrl+Alt+Delete which facilitates killing a process.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What does Ubuntu involve?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;The system monitor lists processes and enables killing processes&lt;/li&gt;
&lt;li&gt;Ctrl+Alt+Backspace kills X (once this feature is activated)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Better console / terminal colours&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;The default background for Ubuntu terminal is a type of dark purple.
While it&#39;s &quot;pretty&quot;, I find the contrast to be relatively low.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What are better settings?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;p&gt;I applied the following settings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Edit - Preferences: 
&lt;ul&gt;
&lt;li&gt;Colors - Built-in schemes= white on black&lt;/li&gt;
&lt;li&gt;Background = solid colour&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;export TERM=&quot;xterm-256color&quot;&lt;/code&gt; enables better colour support for Vim&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Problems displaying full screen video&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;I find that full screen video on YouTube seems to freeze.
How can this be fixed?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;p&gt;There is a &lt;a href=&quot;
http://www.youtube.com/watch?v=SeO8YytqEKE&quot;&gt;tutorial on YouTube&lt;/a&gt; on how to fix this.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo mkdir /etc/adobe
sudo su
sudo echo &quot;OverrideGPUValidation = 1&quot; &amp;gt;&amp;gt; /etc/adobe/mms.cfg&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;Reducing Grub loader times&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;p&gt;I think it would be useful to reduce the default grub display time to something
like 1 or 2 seconds.
I almost always boot to Ubuntu, and if I want to boot to Windows, I have a
command from within Ubuntu that changes the default boot for one occasion.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is this a good idea?&lt;/li&gt;
&lt;li&gt;How can I do this?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;I think 2 seconds would make sense as this is long enough to easily enter
manual mode if I am watching carefully.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;sudo vim/etc/default/grub&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;I modified the value of &lt;code&gt;GRUB_TIMEOUT&lt;/code&gt; and made it &lt;code&gt;GRUB_TIMEOUT=2&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sudo update-grub&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Set up git on Ubuntu&lt;/h4&gt;

&lt;h5&gt;Question&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;How do I configure git on Ubuntu?&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;Discussion&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;General information on configuring git and github on Linux is &lt;a href=&quot;http://help.github.com/linux-set-up-git/&quot;&gt;available
here&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/6254402501596748604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/6254402501596748604'/><link rel='alternate' type='text/html' href='http://jeromyanglim.blogspot.com/2011/05/transition-to-linux-and-ubuntu.html' title='Transition to Linux and Ubuntu: The Experience of a Quantitative Social Scientist'/><author><name>jeromyanglim</name><uri>http://www.blogger.com/profile/12949204812496382042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-8909074830238091680.post-3721897032784687047</id><published>2010-12-13T23:40:00.002+11:00</published><updated>2013-04-27T18:17:14.816+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Australia"/><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX"/><category scheme="http://www.blogger.com/atom/ns#" term="make"/><category scheme="http://www.blogger.com/atom/ns#" term="R"/><category scheme="http://www.blogger.com/atom/ns#" term="Sweave"/><category scheme="http://www.blogger.com/atom/ns#" term="version_control"/><title type='text'>Video of Reproducible Research with R: Melbourne R Users 1st Dec 2010</title><content type='html'>&lt;p&gt;As &lt;a href=&quot;http://jeromyanglim.blogspot.com/2010/12/r-workflow-slides-from-talk-at.html&quot;&gt;previously
mentioned&lt;/a&gt;
I gave a talk at Melbourne R Users Group titled &quot;Reproducible Research
and R Workflow&quot;. It covered technologies including LaTeX, Sweave, R,
make, Eclipse, and git. This post shares the video. &lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I&#39;d like to thank Pedro Olaya for filming the session, and &lt;a href=&quot;http://www.drewconway.com/zia/&quot;&gt;Drew
Conway&lt;/a&gt; for preparing, uploading, and
hosting the video along with the many other &lt;a href=&quot;http://www.vcasmo.com/user/drewconway&quot;&gt;great existing videos from
R User Groups from around the
world&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you follow Drew&#39;s Blog &lt;a href=&quot;http://www.drewconway.com/zia/&quot;&gt;ZIA&lt;/a&gt; you
may have already seen the video. If you don&#39;t follow his blog, you
should definitely check it out. Here are three of my favourite posts by
Drew:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.drewconway.com/zia/?p=2378&quot;&gt;Data Science Venn Diagram&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://blog.yhathq.com/posts/10-R-packages-I-wish-I-knew-about-earlier.html&quot;&gt;Must have R Packages for Social
Scientists&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://drewconway.com/zia/2013/3/27/ten-reasons-why-grad-students-should-blog&quot;&gt;Ten Reasons Why Grad Students Should
Blog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;For those who did not catch Drew&#39;s &lt;a href=&quot;http://www.drewconway.com/zia/?p=2549&quot;&gt;original
post&lt;/a&gt;, the videos are shown
below.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; The videos were taken down so I&#39;ve replaced them with YouTube version.&lt;/p&gt;

&lt;h3&gt;My Talk&lt;/h3&gt;

&lt;p&gt;For a copy of the slides, R Code, and more see the &lt;a href=&quot;http://jeromyanglim.blogspot.com/2010/12/r-workflow-slides-from-talk-at.html&quot;&gt;previous
post&lt;/a&gt;.
The video is embedded below (If you are viewing this post in a feed
reader, and the embedded video is not displaying &lt;a href=&quot;http://jeromyanglim.blogspot.com/2010/12/video-of-reproducible-research-with-r.html&quot;&gt;click
here&lt;/a&gt;
to go to the original post):&lt;/p&gt;

&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/bbaPSJechgY?list=PL2E4B515A6ED513B0&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;


&lt;h3&gt;Geoff&#39;s Talk&lt;/h3&gt;

&lt;p&gt;The other talk from the session was by Geoff Robinson who discussed
several useful strategies for working with R.&lt;/p&gt;

&lt;p&gt;The
&lt;a href=&quot;http://files.meetup.com/1685538/R%20Workflow%20slides%20Geoff%20Robinson.ppt&quot;&gt;slides&lt;/a&gt;
and &lt;a href=&quot;http://files.meetup.com/1685538/R%20Workflow%20script%20Geoff%20Robinson.R&quot;&gt;R
Script&lt;/a&gt;
are available for download.&lt;/p&gt;

&lt;p&gt;The talk is embedded below:&lt;/p&gt;

&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/DK1pdGhYRa8?list=PL2E4B515A6ED513B0&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;


&lt;h3&gt;Melbourne R User Group&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://www.meetup.com/MelbURN-Melbourne-Users-of-R-Network/members/12349115/&quot;&gt;Yuval
Marom&lt;/a&gt;
kindly asked me to become a co-organiser of the &lt;a href=&quot;http://www.meetup.com/MelbURN-Melbourne-Users-of-R-Network/&quot;&gt;Melbourne R user Group
(MelbURN)&lt;/a&gt;.
While most people who read this blog are from overseas, if you are in
Melbourne, feel free to &lt;a href=&quot;http://www.meetup.com/MelbURN-Melbourne-Users-of-R-Network/&quot;&gt;join the
group&lt;/a&gt;.
If you know something about R, are passing through Melbourne, and would
like to give a talk on R, let Yuval or me know (see the &lt;a href=&quot;%20http://www.meetup.com/MelbURN-Melbourne-Users-of-R-Network/&quot;&gt;Contact Us
Button&lt;/a&gt;),
and we&#39;ll see if we can organise something.&lt;/p&gt;

&lt;h3&gt;Related Resources&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://jeromyanglim.blogspot.com/2010/05/videos-on-data-analysis-with-r.html&quot;&gt;R
Videos&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://jeromyanglim.blogspot.com/search/label/Sweave&quot;&gt;R and
Sweave&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/jeromyanglim&quot;&gt;Code from the talk on jeromyanglim @
github&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/3721897032784687047'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/3721897032784687047'/><link rel='alternate' type='text/html' href='http://jeromyanglim.blogspot.com/2010/12/video-of-reproducible-research-with-r.html' title='Video of Reproducible Research with R: Melbourne R Users 1st Dec 2010'/><author><name>jeromyanglim</name><uri>http://www.blogger.com/profile/12949204812496382042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/bbaPSJechgY/default.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-8909074830238091680.post-2454464486960253630</id><published>2010-12-02T00:03:00.000+11:00</published><updated>2010-12-02T00:03:00.626+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX"/><category scheme="http://www.blogger.com/atom/ns#" term="make"/><category scheme="http://www.blogger.com/atom/ns#" term="presentations"/><category scheme="http://www.blogger.com/atom/ns#" term="R"/><category scheme="http://www.blogger.com/atom/ns#" term="Sweave"/><category scheme="http://www.blogger.com/atom/ns#" term="version_control"/><title type='text'>R Workflow: Slides from a Talk at Melbourne R Users (1st Dec 2010)</title><content type='html'>I gave a presentation at 
&lt;a href=&quot;
http://www.meetup.com/MelbURN-Melbourne-Users-of-R-Network/&quot;&gt;Melbourne R Users&lt;/a&gt;
on the topic of R Workflow.
The presentation covered R code organisation,
and useful R related tools including Eclipse, StatET, Git, make, Sweave
and LaTeX.
Also, the slides from the presentation
 provide links to four complete examples of using R, 
 Sweave, LaTeX, and make.

&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;

&lt;h3&gt;PDF of Slides&lt;/h3&gt;

&lt;p&gt;A PDF of the slides
 is available in &lt;a href=&quot;
 https://github.com/jeromyanglim/RMeetup_Workflow/raw/master/backup/Rmeetup_Workflow_fullscreen.pdf&quot;&gt;fullscreen&lt;/a&gt;
 and &lt;a href=&quot;
https://github.com/jeromyanglim/RMeetup_Workflow/raw/master/backup/Rmeetup_Workflow_handout.pdf&quot;&gt;four-to-a-page handout&lt;/a&gt;
format.
Most slides contain links to resources for learning more.
Thus, it should be possible to understand the main ideas of the talk just 
by just reading the slides and reading the links.&lt;/p&gt;

&lt;h3&gt;Video&lt;/h3&gt;

&lt;p&gt;A video of both my talk and the previous talk
by Geoff Robinson will hopefully be made available in the not
too distant future (I&#39;ll post when it is available).&lt;/p&gt;

&lt;h3&gt;Github Repository&lt;/h3&gt;

&lt;p&gt;If you want to learn more about &lt;code&gt;beamer&lt;/code&gt;, &lt;code&gt;LaTeX&lt;/code&gt; and &lt;code&gt;make&lt;/code&gt;,
you can check out the source code used to produce the PDF of the presentation.
The repository is available on GitHub:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/jeromyanglim/RMeetup_Workflow&quot;&gt;https://github.com/jeromyanglim/RMeetup_Workflow&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Thanks&lt;/h3&gt;

&lt;p&gt;I&#39;d like to thank &lt;a href=&quot;http://www.meetup.com/MelbURN-Melbourne-Users-of-R-Network/members/12349115/&quot;&gt;Yuval Marom&lt;/a&gt;
 for all the work he has put into
kickstarting and organising the &lt;a href=&quot;
http://www.meetup.com/MelbURN-Melbourne-Users-of-R-Network/&quot;&gt;Melbourne R User Group&lt;/a&gt;
and Deloitte for providing such a great venue.&lt;/p&gt;

&lt;h3&gt;Links Presented in the Talk&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;
http://blog.revolutionanalytics.com/2010/10/a-workflow-for-r.html&quot;&gt;David Smith on R Workflow&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;
http://stackoverflow.com/questions/1429907/workflow-for-statistical-analysis-and-report-writing/1434424&quot;&gt;StackOverflow Question on R Workflow&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;
http://www.johnmyleswhite.com/notebook/2010/08/26/projecttemplate/&quot;&gt;John Myles White&#39;s ProjectTemplate&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;
http://www.walware.de/goto/statet&quot;&gt;StatET Official Site&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;
http://www.splusbook.com/RIntro/RCourseMaterial.html&quot;&gt;Useful StatET Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;
http://jeromyanglim.blogspot.com/2010/02/getting-started-with-sweave-r-latex.html&quot;&gt;My Guide to Getting Started with Eclipse, StatET and Sweave&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;
http://jeromyanglim.blogspot.com/2010/11/getting-started-with-git-egit-eclipse.html&quot;&gt;Git, Egit, and Eclipse&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;
http://jeromyanglim.blogspot.com/2010/11/makefiles-for-sweave-r-and-latex-using.html&quot;&gt;Makefiles, Sweave, and R&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;
http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-using-sweave-r-and-make.html&quot;&gt;Sweave Tutorial 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;
http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-2-individual.html&quot;&gt;Sweave Tutorial 2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;
http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-3-console-input-and.html&quot;&gt;Sweave Tutorial 3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;
https://github.com/jeromyanglim/Sweave_Winter_Olympics&quot;&gt;GitHub Repository of what will be Sweave Tutorial 4&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/2454464486960253630'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/2454464486960253630'/><link rel='alternate' type='text/html' href='http://jeromyanglim.blogspot.com/2010/12/r-workflow-slides-from-talk-at.html' title='R Workflow: Slides from a Talk at Melbourne R Users (1st Dec 2010)'/><author><name>jeromyanglim</name><uri>http://www.blogger.com/profile/12949204812496382042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-8909074830238091680.post-5212348335923420306</id><published>2010-11-30T22:23:00.000+11:00</published><updated>2010-11-30T22:23:55.892+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX"/><category scheme="http://www.blogger.com/atom/ns#" term="R"/><category scheme="http://www.blogger.com/atom/ns#" term="Sweave"/><title type='text'>Sweave Tutorial 3: Console Input and Output - Multiple Choice Test Analysis</title><content type='html'>This post provides an example of using Sweave
 to perform an item analysis of a multiple choice test.
It is designed as a tutorial for learning more about 
 using Sweave in a mode where console input and output is displayed.
Copies of all source code and the final PDF report is provided.

&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;

&lt;h3&gt;Overview&lt;/h3&gt;

&lt;p&gt;The repository with all source files is available at:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/jeromyanglim/Sweave_Item_Analysis/&quot;&gt;https://github.com/jeromyanglim/Sweave_Item_Analysis/&lt;/a&gt;.&lt;!--_--&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A copy of the resulting PDF can be viewed &lt;a href=&quot;
https://github.com/jeromyanglim/Sweave_Item_Analysis/raw/master/.backup/Item_Analysis_Report.pdf&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For general information on program requirements and running the code
 see &lt;a href=&quot;
 http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-using-sweave-r-and-make.html&quot;&gt;this earlier post&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;Sweave Documents that Display Console Input and Output&lt;/h3&gt;

&lt;p&gt;I find it useful to distinguish between different kinds of 
Sweave documents. One key distinction is between &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;reports that display the console and reports 
that do no display the console.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Reports that display the console are suited to distinct applications,
 including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;R tutorials&lt;/li&gt;
&lt;li&gt;Personal analyses&lt;/li&gt;
&lt;li&gt;Analyses provided to experts who understand R and the Project&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It would be further possible to distinguish between 
reports that do and do not show the console input (&lt;code&gt;echo=true&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Developing Sweave reports that display the console
still benefit from thoughtful variable names, 
selective display of output and so forth.
However, naturally less time is invested in 
putting the polish on figures, tables, and inline text.&lt;/p&gt;

&lt;p&gt;The previous Sweave Tutorials were examples
 of Sweave documents that do not display the console.
&lt;a href=&quot;
http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-using-sweave-r-and-make.html&quot;&gt;Tutorial 1 was a data driven document&lt;/a&gt;
&lt;a href=&quot;
http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-2-individual.html&quot;&gt;Tutorial 2 was a set of batch polished reports&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The present tutorial is an example of
a Sweave document that displays console input and output.&lt;/p&gt;

&lt;p&gt;The remainder of the post discusses various aspects of the 
 source code.&lt;/p&gt;

&lt;h3&gt;Source Code&lt;/h3&gt;

&lt;h3&gt;Folder and File Structure&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.gitignore&lt;/code&gt; records the folder where derived files are stored by &lt;code&gt;make&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;makefile&lt;/code&gt; is similar to that explained and used in &lt;a href=&quot;
http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-using-sweave-r-and-make.html&quot;&gt;Sweave Tutorial 1&lt;/a&gt;.
This similarity has been obtained through 
(a) the use of variables in the &lt;code&gt;makefile&lt;/code&gt; 
(b) the fact that both projects are driven by the &lt;code&gt;Rnw&lt;/code&gt; file;
thus, make calls Rnw, which in turn imports data, and so forth.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;README.md&lt;/code&gt; is a file in &lt;a href=&quot;
http://jeromyanglim.blogspot.com/2010/11/getting-started-with-markdown-benefits.html&quot;&gt;markdown&lt;/a&gt;.
Markdown is the markup language used on Github.
The file is automatically displayed on the repository home page.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;data&lt;/code&gt;: This folder contains a file with the responses to the 50
multiple choice questions.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;meta&lt;/code&gt;: This folder contains a file with information
about each of the 50 multiple choice questions including the text,
response options, and the supposedly correct response.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;backup&lt;/code&gt;: This folder contains a copy of the resulting PDF.
Although this is a derived file and as such should not generally be monitored
by Git, it&#39;s helpful to include a copy for easy access.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Sweave.sty&lt;/code&gt;: I find it easier and more portable to just include this
LaTeX style file required by Sweave in with the project.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Item_Analysis_Report.Rnw&lt;/h3&gt;

&lt;h4&gt;Library loading and data import&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;&amp;lt;initial_settings, echo=false&amp;gt;&amp;gt;=
options(stringsAsFactors=FALSE)
options(width=80)
library(psych) # used scoring and alpha
library(CTT) # used for spearman brown prophecy
@


&amp;lt;&amp;lt;import_data, echo=false&amp;gt;&amp;gt;=
cases &amp;lt;- read.delim(&quot;data/cases.tsv&quot;)
items &amp;lt;- read.delim(&quot;meta/items.tsv&quot;)
items$variable &amp;lt;- paste(&quot;item&quot;, items$item, sep=&quot;&quot;)
@
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;options(width=80)&lt;/code&gt; ensures that the console width is suitable
for the printed page&lt;/li&gt;
&lt;li&gt;&lt;code&gt;options(stringsAsFactors=FALSE)&lt;/code&gt; means that character variables
imported using &lt;code&gt;read.delim&lt;/code&gt; are left as character variables 
and not converted into &lt;code&gt;factors&lt;/code&gt;.
In general I find this a more useful default behaviour.
In particular I often use the actual text, particularly in metadata, 
to generate variable names, print text and so forth.
Leaving variables as character is better for this.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Using data before it has apparently been generated&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;...
The example involves performing an item analysis of 
responses of \Sexpr{nrow(cases)} students 
to a set of \Sexpr{nrow(items)} multiple choice test items.
...

&amp;lt;&amp;lt;&amp;gt;&amp;gt;=
&amp;lt;&amp;lt;initial_settings&amp;gt;&amp;gt;
&amp;lt;&amp;lt;import_data&amp;gt;&amp;gt;
@
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;In the above code I wanted to be able to write the number
of cases before showing the code for importing settings and data.
Thus, I first ran the code chunks with &lt;code&gt;echo=false&lt;/code&gt; to prevent display.
Then, afterwards, these code chunks were rerun inside a code chunk
using the syntax &lt;code&gt;&amp;lt;&amp;lt;name_of_code_chunk&amp;gt;&amp;gt;&lt;/code&gt; &lt;!--_--&gt;
(i.e., without the &lt;code&gt;=&lt;/code&gt; sign at the end of the opening.
This time they were displayed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Scoring multiple choice tests&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;&amp;lt;score_test&amp;gt;&amp;gt;=
itemstats &amp;lt;- score.multiple.choice(key = items$correct, 
            data = cases[,items$variable])
@
&lt;/code&gt;&lt;/pre&gt;

&lt;!--_--&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;score.multiple.choice&lt;/code&gt; is a function in the &lt;code&gt;psych&lt;/code&gt; package
for scoring multiple choice tests.
&lt;code&gt;key&lt;/code&gt; is a vector of integers representing the correct response.
&lt;code&gt;data&lt;/code&gt; is a matrix or data.frame of responses from a 
set of respondents.&lt;/li&gt;
&lt;li&gt;the example shows how metadata can be used to simplify code.
&lt;code&gt;items$variable&lt;/code&gt; includes the name of the 50 personality test items
&lt;code&gt;items$correct&lt;/code&gt; includes the vector of correct responses.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;...&lt;/p&gt;

&lt;h3&gt;Figures in Sweave&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;&amp;lt;plot_mean_by_r, fig=true&amp;gt;&amp;gt;=
plot(r ~ mean , itemstats$item.stats, type=&quot;n&quot;)
text(itemstats$item.stats$mean, itemstats$item.stats$r, 1:50)
abline(h=.2, v=c(.5, .9))
@
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;Code chunks can produce single figures.
the &lt;code&gt;fig=true&lt;/code&gt; key-value pair is required.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;type=&quot;n&quot;&lt;/code&gt; is used to not show points
and then &lt;code&gt;text(...)&lt;/code&gt; is used to plot the item numbers on the plot.&lt;/li&gt;
&lt;li&gt;Because the document is an informal document
designed to display the console,
the figure is not wrapped in a figure float.
A float would involve more typing and might even be annoying if
it moved around the document.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;...&lt;/p&gt;

&lt;h3&gt;Using Sweave to Better follow the DRY (Don&#39;t Repeat Yourself) Principle&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;&amp;lt;flag_bad_items&amp;gt;&amp;gt;=
rules &amp;lt;- list(
        tooEasy = .95,
        tooHard = .3,
        lowR = .15)
oritemstats$item.stats$tooEasy &amp;lt;- 
    oritemstats$item.stats$mean &amp;gt; rules$tooEasy
...
@

\begin{itemize}
\item \emph{Too Easy}: mean correct $&amp;gt;$
\Sexpr{rules$tooEasy}.
\Sexpr{sum(oritemstats$item.stats$tooEasy)}
items were bad by this definition.
... 
\end{itemize}
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;The above abbreviated version of the actual code highlights 
how Sweave can be used to prevent repetition
and facilitate modifiability.&lt;/li&gt;
&lt;li&gt;The code flags items as too easy if more than 95% of participants
get the item correct.
This value (&lt;code&gt;.95&lt;/code&gt;) is stored in a variable.
It&#39;s then subsequently used both in the code to flag
items as too easy and also used in the text where the
rule is described in plain text (i.e., &lt;code&gt;\Sexpr{rules$tooEasy}&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;This is a particularly powerful use of Sweave whereby any text
in a document that might be repeated or any text that describes
details of a data analytic algorithm is a good candidate for simplification
using Sweave.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;...&lt;/p&gt;

&lt;h4&gt;\Sexpr{} and formatting&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;The formula suggests  that in order to obtain
an alpha of \Sexpr{sbrown$targetAlpha},
\Sexpr{round(sbrown$multiple, 2)} times as many items are required.
Thus, the final scale would need around
\Sexpr{ceiling(sbrown$refinedItemCount)} items.
Assuming a similar number of good and bad items,
this would require an initial pool of around
\Sexpr{ceiling(sbrown$totalItemCount)} items.
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;The above code highlights a couple of examples of how inline
formatting of numbers can be done, and is often required
when including inline text.
In this case, &lt;code&gt;ceiling&lt;/code&gt; and &lt;code&gt;round&lt;/code&gt; functions were used.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Sweave Tutorial Series&lt;/h3&gt;

&lt;p&gt;This post is the third installment in a Sweave Tutorial Series:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;
http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-using-sweave-r-and-make.html&quot;&gt;Using Sweave, R, and Make to Generate a PDF of Multiple Choice Questions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;
http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-using-sweave-r-and-make.html&quot;&gt;Batch Individual Personality Reports using R, Sweave, and LaTeX&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Related Posts&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://jeromyanglim.blogspot.com/2010/02/getting-started-with-sweave-r-latex.html&quot;&gt;Getting Started with Sweave&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://jeromyanglim.blogspot.com/2010/02/getting-started-with-sweave-r-latex.html&quot;&gt;makefiles for Sweave, R and LaTeX using Eclipse on Windows&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/5212348335923420306'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/5212348335923420306'/><link rel='alternate' type='text/html' href='http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-3-console-input-and.html' title='Sweave Tutorial 3: Console Input and Output - Multiple Choice Test Analysis'/><author><name>jeromyanglim</name><uri>http://www.blogger.com/profile/12949204812496382042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-8909074830238091680.post-8639315527477758240</id><published>2010-11-29T17:48:00.001+11:00</published><updated>2010-11-29T17:50:36.271+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX"/><category scheme="http://www.blogger.com/atom/ns#" term="make"/><category scheme="http://www.blogger.com/atom/ns#" term="personality"/><category scheme="http://www.blogger.com/atom/ns#" term="R"/><category scheme="http://www.blogger.com/atom/ns#" term="Sweave"/><title type='text'>Sweave Tutorial 2: Batch Individual Personality Reports using R, Sweave, and LaTeX</title><content type='html'>&lt;p&gt;
This post documents an example of using Sweave
to generate individualised personality reports based on 
responses to a personality test.
Each report provides information on both the responses of the general 
sample and responses of the specific respondent.
All source code is provided, and selected aspects are discussed,
including &lt;code&gt;makefiles&lt;/code&gt; use of &lt;code&gt;\Sexpr&lt;/code&gt;, figures, and LaTeX tables using Sweave.

&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;

&lt;h3&gt;Overview&lt;/h3&gt;

&lt;p&gt;All source code is available on GitHub:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/jeromyanglim/Sweave_Personality_Reports&quot;&gt;https://github.com/jeromyanglim/Sweave_Personality_Reports&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Three examples of compiled PDF reports can be viewed as follows: 
&lt;a href=&quot;https://github.com/jeromyanglim/Sweave_Personality_Reports/raw/master/.backup/Report_Template_ID1.pdf&quot;&gt;ID1&lt;/a&gt;
&lt;a href=&quot;https://github.com/jeromyanglim/Sweave_Personality_Reports/raw/master/.backup/Report_Template_ID2.pdf&quot;&gt;ID2&lt;/a&gt;
and &lt;a href=&quot;
https://github.com/jeromyanglim/Sweave_Personality_Reports/raw/master/.backup/Report_Template_ID4.pdf&quot;&gt;ID4&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The resulting report is a simple proof of concept example.&lt;/p&gt;

&lt;h3&gt;Discussion of Source Code&lt;/h3&gt;

&lt;h3&gt;makefile&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;outputDir = .output
backupDir = .backup

test:
    -mkdir $(outputDir)
    Rscript --verbose run1test.R  

test5:
    -mkdir $(outputDir)
    Rscript --verbose run5test.R  


runall:
    -mkdir $(outputDir)
    Rscript --verbose runAll.R  

clean:
    -rm $(outputDir)/*

backup:
    -mkdir $(backupDir)
    cp $(outputDir)/Report_Template_ID*[0123456789].pdf --target-directory=$(backupDir)
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;outputDir&lt;/code&gt; stores the name of the folder used to store derived files 
(e.g., tex files, images, and compiled document PDFs)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;backupDir&lt;/code&gt; stores the name of the folder where document PDFs are to be stored&lt;/li&gt;
&lt;li&gt;&lt;code&gt;test:&lt;/code&gt; is the default goal.
Running make in the project directory will run &lt;code&gt;run1test.R&lt;/code&gt; which will 
build one report.&lt;/li&gt;
&lt;li&gt;the &lt;code&gt;--verbose&lt;/code&gt; option shows the progress of R when run as a script.
It&#39;s useful for seeing progress and debugging.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;test5:&lt;/code&gt; compiles five reports.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;runall:&lt;/code&gt; compiles all reports.
Further information on each of the &lt;code&gt;Run... .R&lt;/code&gt; files can be obtained by inspecting these files. In general they source &lt;code&gt;Run.R&lt;/code&gt; and specify which ids to run reports on.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;clean:&lt;/code&gt; removes all the files from the output directory 
(i.e., all the derived files)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;backup:&lt;/code&gt; copies reports to the backup folder; i.e., it separates the finished documents from all the other derived files.&lt;/li&gt;
&lt;li&gt;To run &lt;code&gt;test5&lt;/code&gt;, &lt;code&gt;runnall&lt;/code&gt; etc., type &lt;code&gt;make test5&lt;/code&gt; or &lt;code&gt;make runnall&lt;/code&gt; etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h3&gt;main.R&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;main.R&lt;/code&gt; loads external functions and packages, imports data,
imports metadata and processes the data.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# Import Data
ipip &amp;lt;-read.delim(&quot;data/ipip.tsv&quot;)
ipipmeta &amp;lt;-read.delim(&quot;meta/ipipmeta.tsv&quot;)
ipipscales &amp;lt;- read.delim(&quot;meta/ipipscales.tsv&quot;)
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;When importing the data, I have adopted the useful convention 
(which I observed from &lt;a href=&quot;
http://www.johnmyleswhite.com/notebook/2010/08/26/projecttemplate/&quot;&gt;John Myles White&#39;s ProjectTemplate Package&lt;/a&gt;) 
of naming objects and data file names the same.
The file extension also clearly indicates the file format (i.e., tab-separated-values).&lt;/li&gt;
&lt;li&gt;I often have separate &lt;code&gt;data&lt;/code&gt; and &lt;code&gt;meta&lt;/code&gt; folders.
Importing metadata often makes for more manageable code than when
incorporating metadata by hard coding it into the R script.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Test scores are calculated using the function &lt;code&gt;score.items&lt;/code&gt;.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ipipstats &amp;lt;- psych::score.items(ipipmeta[,ipipscales$scale], 
        ipip[,ipipmeta[,&quot;variable&quot;]],
        min = 1, max = 5)
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;psych&lt;/code&gt; package has a number of useful functions for psychological research.
&lt;code&gt;score.items&lt;/code&gt; is particularly good.
It enables the creation of means and totals for multiple scales.
It handles item reversal.
It also returns information related to the reliability of the scales.&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h3&gt;Run.R&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;source(&quot;main.R&quot;, echo = TRUE)
id &amp;lt;- NULL
exportReport &amp;lt;- function(x) {
    id &amp;lt;&amp;lt;- x
    fileStem &amp;lt;- &quot;Report_Template&quot;
    file.copy(&quot;Report_Template.Rnw&quot;,
            paste(&quot;.output/&quot;, fileStem, &quot;_ID&quot;, id, &quot;.Rnw&quot;, sep =&quot;&quot;),
            overwrite = TRUE)
    file.copy(&quot;Sweave.sty&quot;, &quot;.output/Sweave.sty&quot;, overwrite = TRUE)
    setwd(&quot;.output&quot;)
    Sweave(paste(fileStem, &quot;_ID&quot;, id, &quot;.Rnw&quot;, sep =&quot;&quot;))
    tools::texi2dvi(paste(fileStem, &quot;_ID&quot;, id, &quot;.tex&quot;, sep =&quot;&quot;), pdf = TRUE)
    setwd(&quot;..&quot;)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;The above code provides the function to run Sweave on each
individualised report&lt;/li&gt;
&lt;li&gt;the code is a little bit messy, contains a few hacks, 
and is not especially robust.&lt;/li&gt;
&lt;li&gt;the &lt;code&gt;exportReport&lt;/code&gt; function takes an &lt;code&gt;id&lt;/code&gt; value as an argument &lt;code&gt;x&lt;/code&gt;. 
Note the use of the alternative assignment operator.
(&lt;a href=&quot;http://stat.ethz.ch/R-manual/R-patched/library/base/html/assignOps.html&quot;&gt;See ?assignOps&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;The code is designed to keep derived files away from source files
by copying files into the &lt;code&gt;.output&lt;/code&gt; folder and
even changing the working directory to that directory.&lt;/li&gt;
&lt;li&gt;The code creates an individualised copy of the Rnw file; 
Runs &lt;code&gt;Sweave&lt;/code&gt; on the report to produce a &lt;code&gt;tex&lt;/code&gt; file,
and then runs &lt;code&gt;texi2dvi&lt;/code&gt; with &lt;code&gt;pdf=TRUE&lt;/code&gt; to produce the final &lt;code&gt;pdf&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h3&gt;Report_Template.Rnw&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;Rnw&lt;/code&gt; file contains interspersed chunks of LaTeX and R code.&lt;/li&gt;
&lt;li&gt;Because the &lt;code&gt;Rnw&lt;/code&gt; file is called from within R, 
all the R objects and data processing code does not need to be called 
at the start of the Rnw file.
This approach is one way of reducing the time it takes to run
a set of Sweave reports all based on a common data source.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;\Sexpr{}&lt;/code&gt; command is used to incorporate in-line text.
(&lt;code&gt;... sample of \Sexpr{nrow(ipip)} students ...&lt;/code&gt;). 
In the example above, it prints the actual number of cases
into the &lt;code&gt;ipip&lt;/code&gt; data.frame (i.e., the sample size).&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Incorporating a figure using Sweave&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;\begin{figure}
&amp;lt;&amp;lt;plot_scale_distributions, fig=true&amp;gt;&amp;gt;=
plotScale &amp;lt;- function(ipipscale) {
    ggplot(ipip, aes_string(x=ipipscale[&quot;scale&quot;])) + 
        scale_x_continuous(limits=c(1, 5),
            name = ipipscale[&quot;name&quot;]) +
        scale_y_continuous(name = &quot;&quot;, labels =&quot;&quot;,   breaks = 0) +
        geom_density(fill=&quot;green&quot;, alpha = .5) +
        geom_vline(xintercept = ipip[ipip$id %in% id, ipipscale[&quot;scale&quot;]],
                size=1) 
}


scaleplots &amp;lt;-   apply(ipipscales, 1, function(X) plotScale(X))

arrange(scaleplots[[1]], 
        scaleplots[[2]],
        scaleplots[[3]],
        scaleplots[[4]],
        scaleplots[[5]],
        ncol=3)
@
\caption{Figures show distributions of scores of each personality factor
in the norm sample.
Higher scores mean greater levels of the factor. 
The black vertical line indicates your score.}
\end{figure}
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;The first R code chunk produces a figure using &lt;code&gt;ggplot2&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The code above takes a while to run (perhaps around 10 seconds on my machine).
But the resulting plot is more attractive than what I could easily get with 
&lt;code&gt;base&lt;/code&gt; graphics.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;&amp;lt;plot_scale_distributions, fig=true&amp;gt;&amp;gt;=&lt;/code&gt; indicates the start of 
an R code chunk. 
&lt;code&gt;fig=true&lt;/code&gt; lets Sweave know that it has to produce code to include a figure.&lt;/li&gt;
&lt;li&gt;The R code chunk is substituted with
&lt;code&gt;\includegraphics{Report_Template_ID10-plot_scale_distributions}&lt;/code&gt;
in the &lt;code&gt;tex&lt;/code&gt; file and the &lt;code&gt;pdf&lt;/code&gt; and &lt;code&gt;eps&lt;/code&gt; figures are created.
Thus, if you want a float with captions and labels,
you have to add them around the R code chunk.&lt;/li&gt;
&lt;li&gt;the &lt;code&gt;plotScale&lt;/code&gt; function is used to generate a ggplot2 figure
of the distribution of scores on each personality scale along with 
a marking of the respondent&#39;s score on each scale.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;arrange&lt;/code&gt; function is used to layout multiple ggplot2 figures
on a single plot. 
The source code is in the &lt;code&gt;lib/vp.layout.R&lt;/code&gt; and was taken from 
a [post by Stephen Turner(
http://gettinggeneticsdone.blogspot.com/2010/03/arrange-multiple-ggplot2-plots-in-same.html)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Preparing a formatted table in R for LaTeX&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;&amp;lt;prepare_table&amp;gt;&amp;gt;=
ipiptable &amp;lt;- list()
ipiptable$colnames &amp;lt;- c(&quot;item&quot;, &quot;scaleF&quot;, &quot;text&quot;, &quot;meanF&quot;,
        &quot;sdF&quot;, &quot;is1F&quot;, &quot;is2F&quot;, &quot;is3F&quot;, &quot;is4F&quot;, &quot;is5F&quot;)
ipiptable$cells &amp;lt;- ipipsummary[,ipiptable$colnames ]
ipiptable$cells$item &amp;lt;- paste(ipiptable$cells$item, &quot;.&quot;, sep=&quot;&quot;)

# assign actual respones to table
ipiptable$cells[,c(&quot;is1F&quot;, &quot;is2F&quot;, &quot;is3F&quot;, &quot;is4F&quot;, &quot;is5F&quot;)] &amp;lt;-
        sapply(1:5, function(X)
        ifelse(as.numeric(ipip[ipip$id %in% id, ipipmeta$variable]) == X, 
                paste(&quot;*&quot;, ipiptable$cells[[paste(&quot;is&quot;, X, &quot;F&quot;, sep =&quot;&quot;)]], sep =&quot;&quot;),
                ipiptable$cells[[paste(&quot;is&quot;, X, &quot;F&quot;, sep =&quot;&quot;)]]))


ipiptable$cellsF &amp;lt;- as.matrix(ipiptable$cells) 

ipiptable$cellsF &amp;lt;- ipiptable$cellsF[order(ipiptable$cellsF[, &quot;scaleF&quot;]), ]

ipiptable$row1 &amp;lt;- c(&quot;&quot;, &quot;Scale&quot;, &quot;Item Text&quot;, 
        &quot;M&quot;, &quot;SD&quot;, &quot;VI\\%&quot;, &quot;MI\\%&quot;, &quot;N\\%&quot;, &quot;MA\\%&quot;, &quot;VA\\%&quot;)

ipiptable$table &amp;lt;- rbind(ipiptable$row1, ipiptable$cellsF)
ipiptable$tex &amp;lt;- paste(
        apply(ipiptable$table, 1, function(X) paste(X, collapse = &quot; &amp;amp; &quot;)), 
        &quot;\\\\&quot;)
for(i in c(41, 31, 21, 11, 1)) {
    ipiptable$tex &amp;lt;- append(ipiptable$tex, &quot;\\midrule&quot;, after=i)
}
ipiptable$tex1 &amp;lt;- ipiptable$tex[c(1:34)]
ipiptable$tex2 &amp;lt;- ipiptable$tex[c(1,35:56)]
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;I often find it useful to split R code chunks for 
table preparation and table presentation.
In general this allows any text that appears before the table to include
&lt;code&gt;\Sexpr{}&lt;/code&gt; commands incorporating figures from the analyses which 
generate the table.
In the present case, it was useful because the table was split over two pages.&lt;/li&gt;
&lt;li&gt;The code shows some of the general logic I use for customised table creation.
In hindsight I could probably refactor it into a function so that I don&#39;t have to always type &lt;code&gt;ipiptable&lt;/code&gt; which would make things a little more concise&lt;/li&gt;
&lt;li&gt;The general process of table creation involves:
(a) extracting information on cells with cells often grouped into types which will receive common formatting treatment
(b) formatting cells (e.g., rounding, decimals, and so on)
(c) assembling the cells typically using a combination of the functions 
&lt;code&gt;rbind&lt;/code&gt; and &lt;code&gt;cbind&lt;/code&gt;
(d) Inserting tex column and end of row separators with something like:
&lt;code&gt;paste(apply(x, 1, function(X) paste(X, collapse = &quot; &amp;amp; &quot;)), &quot;\\\\&quot;)&lt;/code&gt;
where &lt;code&gt;x&lt;/code&gt; is the matrix of table cells.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Don&#39;t Repeat Yourself Principle using R and Sexpr{}&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;ipiptable$caption &amp;lt;-
        &quot;Response options were 
1 = (V)ery (I)naccurate, 
2 = (M)oderately (I)naccurate,
3 = (N)either Inaccurate nor Accurate, 
4 = (M)oderately (A)ccurate
5 = (V)ery (A)ccurate.
Thus, VI\\\\% indicates the percentage of the norm sample 
        giving a response indicating that the item is a Very Inaccurate
description of themselves.
Your response is indicated with an asterisk (*).&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;This text was used in both tables.
Thus, this text can then be called using &lt;code&gt;\Sexpr{ipiptable[[&quot;caption&quot;]]}&lt;/code&gt;.
This follows the DRY principle (Don&#39;t Repeat Yourself).
Thus, if the caption needs to be modified, it only needs to be modified in one place.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Incorporating the tex formatted table using R Code chunks&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;\begin{table}
\begin{adjustwidth}{-1cm}{-1cm}
\caption{Table of results for (A)greeableness, (C)onscientiousness
and (E)motional (S)tability items.
\Sexpr{ipiptable[[&quot;caption&quot;]]}} 
\begin{center}
\begin{tabular}{rrp{4cm}rrrrrrr}
\toprule
&amp;lt;&amp;lt;table_part1, results=tex&amp;gt;&amp;gt;=
cat(ipiptable$tex1, sep=&quot;\n&quot;) 
@
\bottomrule
\end{tabular}
\end{center}
\end{adjustwidth}
\end{table}
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;The tables are then incorporated into the &lt;code&gt;tex&lt;/code&gt; file.&lt;/li&gt;
&lt;li&gt;The R code only generated some of the required &lt;code&gt;tex&lt;/code&gt; for the table.
Thus all the other desired elements such as the table environment and captions
are written either side of the R code chunk.&lt;/li&gt;
&lt;li&gt;the R code chunk uses the option &lt;code&gt;results=tex&lt;/code&gt; in order to enter
the output from the &lt;code&gt;cat&lt;/code&gt; function verbatim into the resulting tex file.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cat(ipiptable$tex1, sep=&quot;\n&quot;)&lt;/code&gt; includes a vector of &lt;code&gt;tex&lt;/code&gt;.
With the newline separator simply making the resulting &lt;code&gt;tex&lt;/code&gt; more readable.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Additional Resources&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;
http://jeromyanglim.blogspot.com/2010/02/getting-started-with-sweave-r-latex.html&quot;&gt;Getting Started with Sweave&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;
http://jeromyanglim.blogspot.com/2009/06/learning-r-for-researchers-in.html&quot;&gt;Getting Started with R&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;
http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-using-sweave-r-and-make.html&quot;&gt;Sweave Tutorial: Using Sweave, R, and Make to Generate a PDF of Multiple Choice Questions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/8639315527477758240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/8639315527477758240'/><link rel='alternate' type='text/html' href='http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-2-individual.html' title='Sweave Tutorial 2: Batch Individual Personality Reports using R, Sweave, and LaTeX'/><author><name>jeromyanglim</name><uri>http://www.blogger.com/profile/12949204812496382042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-8909074830238091680.post-1408227657154734343</id><published>2010-11-29T13:55:00.000+11:00</published><updated>2010-11-29T13:55:42.199+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX"/><category scheme="http://www.blogger.com/atom/ns#" term="R"/><category scheme="http://www.blogger.com/atom/ns#" term="version_control"/><title type='text'>Getting Started with Git, EGit, Eclipse, and GitHub: Version Control for R Projects</title><content type='html'>This post provides information on &lt;br /&gt;
(a) installing Git using the Eclipse plugin Egit.
(b) uploading repositories to GitHub, and
(c) links to resources on Git, Git and LaTeX, and Git and R.
The focus is on version control for people working on R, Sweave, and LaTeX
related projects.

&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;

&lt;h3&gt;Overview&lt;/h3&gt;

&lt;p&gt;Version control works really well with R, Sweave, and LaTeX projects.&lt;/p&gt;

&lt;h4&gt;Benefits of Version Control&lt;/h4&gt;

&lt;p&gt;There are many benefits to version control for the data analyst. 
Version control allows you to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Rewind a project or a file to a previous state,
which in turn encourages experimentation&lt;/li&gt;
&lt;li&gt;Ensure there is a record of changes&lt;/li&gt;
&lt;li&gt;Facilitate collaboration&lt;/li&gt;
&lt;li&gt;Facilitate backup&lt;/li&gt;
&lt;li&gt;Show changes between files&lt;/li&gt;
&lt;li&gt;Facilitate code sharing and reproducibility&lt;/li&gt;
&lt;li&gt;and much more...
See this question on &lt;a href=&quot;
http://stackoverflow.com/questions/2712421/r-and-version-control-for-the-solo-data-analyst&quot;&gt;StackOverflow&lt;/a&gt;
for further discussion.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I also found that adopting version control 
facilitated several conceptual benefits.
It encouraged greater consideration of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the distinction between source and derived files&lt;/li&gt;
&lt;li&gt;the nature of dependencies: 
&lt;ul&gt;&lt;li&gt;dependencies between elements of code&lt;/li&gt;
&lt;li&gt;dependencies between files within a project&lt;/li&gt;
&lt;li&gt;and dependencies with files and programs external to the repository&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;the nature of a repository and how repositories should be divided&lt;/li&gt;
&lt;li&gt;the nature of committing and documenting changes and project milestones&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Choosing a Version Control System and Workflow&lt;/h3&gt;

&lt;h4&gt;Why Git?&lt;/h4&gt;

&lt;p&gt;There are many version control systems (see &lt;a href=&quot;http://codicesoftware.blogspot.com/2010/11/version-control-timeline.html&quot;&gt;Plastic SCM&lt;/a&gt; for a discussion).
I&#39;ve chosen to use Git for the following reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Git can work well with Eclipse and Windows using Egit and 
&lt;a href=&quot;http://stackoverflow.com/questions/157476/what-guis-exist-for-git-on-windows&quot;&gt;many other tools&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Git is one of the popular version control systems&lt;/li&gt;
&lt;li&gt;Git enables uploading to Github&lt;/li&gt;
&lt;li&gt;Git has good documentation and support material&lt;/li&gt;
&lt;li&gt;Experts, who know a lot more about version control than I do, use Git
(e.g., &lt;a href=&quot;https://github.com/hadley&quot;&gt;Hadley Wickham&lt;/a&gt;);
the designer of Git is &lt;a href=&quot;http://www.youtube.com/watch?v=4XpnKHJAok8&quot;&gt;Linus Torvalds&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Finally, the big difference is between using a version control system 
and not using a version control system.&lt;/p&gt;

&lt;h4&gt;Why EGit?&lt;/h4&gt;

&lt;p&gt;EGit is a Git plugin for Eclipse.
I use Eclipse and StatET to write R code and Sweave documents.
I found EGit a particularly easy tool for getting started with Git 
and version control.
The documentation is straightforward and the interface is easily integrated into
my Eclipse workflow.&lt;/p&gt;

&lt;h3&gt;Getting Started with EGit and Git in Eclipse&lt;/h3&gt;

&lt;p&gt;There are many ways to interact with Git.&lt;/p&gt;

&lt;p&gt;Installing EGit in eclipse involves using the update manager.
&lt;a href=&quot;
http://www.vogella.de/articles/EGit/ar01s02.html&quot;&gt;Vogella.de has a tutorial&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To get started with your first Git repository in Eclipse, check out the
&lt;a href=&quot;http://wiki.eclipse.org/EGit/User_Guide&quot;&gt;EGit user Guide&lt;/a&gt;. &lt;!--_--&gt;
When I was first getting started I used
a simple R project rather than a Java Hello World application.&lt;/p&gt;

&lt;h3&gt;GitHub&lt;/h3&gt;

&lt;p&gt;GitHub is one of several sites for sharing git repositories 
(for example, see Hadley Wickham&#39;s &lt;a href=&quot;https://github.com/hadley/data-baby-names&quot;&gt;baby names analysis&lt;/a&gt;, or
my own example of using &lt;a href=&quot;http://jeromyanglim.blogspot.com/2010/11/makefiles-for-sweave-r-and-latex-using.html&quot;&gt;Sweave to write Multiple Choice Questions&lt;/a&gt;).
It also has many useful social networking features.&lt;/p&gt;

&lt;h4&gt;Uploading a repository to GitHub from Eclipse&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Set up a free account on &lt;a href=&quot;https://github.com/&quot;&gt;https://github.com/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Work through the tutorial on &lt;a href=&quot;
http://wiki.eclipse.org/EGit/User_Guide#Create_Repository_at_GitHub&quot;&gt;creating a repository at GitHub&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While the above tutorial briefly mentions &lt;a href=&quot;
http://wiki.eclipse.org/EGit/User_Guide#Eclipse_SSH_Configuration&quot;&gt;SSH Configuration&lt;/a&gt;, &lt;!--_--&gt; 
it does not go into detail.
When setting up my SSH key, I did the following:  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;code&gt;Eclipse -- Window -- Preferences -- General -- Network Connections -- SSH2 -- Key Management&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Click on Generate DSA Key&lt;/li&gt;
&lt;li&gt;Type in a passphrase (i.e., a long and robust password)&lt;/li&gt;
&lt;li&gt;Click &lt;code&gt;Save Private Key&lt;/code&gt; (I saved it to a new folder under my user account)&lt;/li&gt;
&lt;li&gt;Go to this new folder and open &quot;id_dsa.pub&quot; &lt;!--_--&gt; 
as a plain text file and copy the contents of the file to the clipboard.&lt;/li&gt;
&lt;li&gt;Go to &lt;code&gt;github.com -- Account Settings -- SSH Public Keys&lt;/code&gt; 
and click &lt;code&gt;Add another public key&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Paste the public key into the box and give it a name&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;Using gist.github&lt;/h4&gt;

&lt;p&gt;Gists provide a quick way to get started with GitHub.
Gists are useful for storing and sharing snippets of code.
The result can be embedded into blog posts.
To get formatted R code, 
 give the file name a &quot;.r&quot; file extension (e.g., &quot;test.r&quot;) 
 (thanks to &lt;a href=&quot;http://support.github.com/discussions/feature-requests/171-syntax-highlighting-for-r&quot;&gt;Hadley Wikham&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;A simple example of an embedded gist is shown below:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/706557.js?file=hello_world.r&quot;&gt;&lt;/script&gt;

&lt;h4&gt;Interesting R GitHub repositories&lt;/h4&gt;

&lt;p&gt;Good examples of people sharing R projects on GitHub include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/hadley/&quot;&gt;Hadley Wickham&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://gist.github.com/diegovalle&quot;&gt;Diego Valle&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/johnmyleswhite&quot;&gt;John Myles White&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/drewconway/&quot;&gt;Drew Conway&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;See the suggestions &lt;a href=&quot;http://stats.stackexchange.com/questions/4429/who-to-follow-on-github-to-learn-about-best-practice-in-data-analysis&quot;&gt;on Stats.SE&lt;/a&gt;.
I also have &lt;a href=&quot;https://github.com/jeromyanglim/&quot;&gt;an account&lt;/a&gt;
in case you are interested. &lt;/p&gt;

&lt;h3&gt;Additional Resources&lt;/h3&gt;

&lt;h4&gt;General Git&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www-cs-students.stanford.edu/~blynn/gitmagic/&quot;&gt;Gitmagic tutorial&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://progit.org/blog.html&quot;&gt;Progit blog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.gitready.com/&quot;&gt;Gitready&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.youtube.com/watch?v=8dhZ9BXQgc4&amp;amp;feature=channel&quot;&gt;Video of Google Tech Talk on Git&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Git and LaTeX&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;
http://www.academicproductivity.com/2008/revision-control-for-latex-in-search-of-an-answer/&quot;&gt;Discussion on the Academic Productivity Blog&lt;/a&gt; 
on the topic of version control and LaTeX&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://tex.stackexchange.com/search?tab=relevance&amp;amp;q=git&quot;&gt;Tex.SE&lt;/a&gt; 
has several questions on LaTeX and git&lt;/li&gt;
&lt;li&gt;Article on &lt;a href=&quot;
http://www.tug.org/pracjourn/2007-3/henningsen/henningsen.pdf&quot;&gt;tools for collaborative writing of scientific latex documents&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ctan.org/tex-archive/support/vc/vc-manual.pdf&quot;&gt;vc package&lt;/a&gt; on CTAN supports Git&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Git and R&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://stackoverflow.com/questions/2712421/r-and-version-control-for-the-solo-data-analyst&quot;&gt;Benefits of version control for the solo data analysist&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://permut.wordpress.com/2010/04/21/revision-control-statistics-bleg&quot;&gt;Revision control and statistics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.kieranhealy.org/files/misc/workflow-apps.pdf&quot;&gt;Thoughts on version control by Kieran Healy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://stackoverflow.com/questions/2286831/how-do-you-combine-revision-control-with-workflow-for-r&quot;&gt;Revision Control, Workflow, and R&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/1408227657154734343'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/1408227657154734343'/><link rel='alternate' type='text/html' href='http://jeromyanglim.blogspot.com/2010/11/getting-started-with-git-egit-eclipse.html' title='Getting Started with Git, EGit, Eclipse, and GitHub: Version Control for R Projects'/><author><name>jeromyanglim</name><uri>http://www.blogger.com/profile/12949204812496382042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-8909074830238091680.post-1120662403227628927</id><published>2010-11-27T00:31:00.006+11:00</published><updated>2010-12-08T16:25:18.652+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX"/><category scheme="http://www.blogger.com/atom/ns#" term="make"/><category scheme="http://www.blogger.com/atom/ns#" term="R"/><category scheme="http://www.blogger.com/atom/ns#" term="Sweave"/><category scheme="http://www.blogger.com/atom/ns#" term="teaching"/><title type='text'>Sweave Tutorial 1: Using Sweave, R, and Make to Generate a PDF of Multiple Choice Questions</title><content type='html'>In this post I present an example of using Sweave to prepare a PDF of formatted multiple choice questions.
More broadly the example shows how to use Sweave to incorporate elements of a database
into a formatted  LaTeX document.
It aims to be useful to anyone wanting to learn more about the almost magical powers of &lt;code&gt;make&lt;/code&gt;, &lt;code&gt;Sweave&lt;/code&gt;, and &lt;code&gt;R&lt;/code&gt;.

&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;

&lt;h3&gt;Overview&lt;/h3&gt;

&lt;p&gt;The repository with all source files is available at:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/jeromyanglim/Sweave_MCQ&quot;&gt;https://github.com/jeromyanglim/Sweave_MCQ&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The repository allows you to download all files as an archive or view the files individually on the web.
A copy of the final PDF generated from the process is available 
&lt;a href=&quot;https://github.com/jeromyanglim/Sweave_MCQ/raw/master/.backup/Sweave_MCQ.pdf&quot;&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I ran the code on Windows with the following programs installed.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.r-project.org/&quot;&gt;R&lt;/a&gt;: For the R code&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.murdoch-sutherland.com/Rtools/&quot;&gt;Rtools&lt;/a&gt;: For &lt;code&gt;make&lt;/code&gt; and the &lt;code&gt;sh&lt;/code&gt; commands in Make and for Sweave to run on the command line&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://miktex.org/&quot;&gt;MikTeX&lt;/a&gt;: For compilation of the PDF using &lt;code&gt;texify&lt;/code&gt; and the default downloading of the &lt;code&gt;exam&lt;/code&gt; document class&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It should run on MAC and Linux with appropriate R, make, and LaTeX tools installed.&lt;/p&gt;

&lt;p&gt;Assuming you have the above installed, to run the code&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Download the &lt;a href=&quot;https://github.com/jeromyanglim/Sweave_MCQ&quot;&gt;repository from github&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Uninstall to a directory&lt;/li&gt;
&lt;li&gt;Open the shell in that directory&lt;/li&gt;
&lt;li&gt;Type: &lt;code&gt;make&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The remainder of this post explains the code in each of the main files in the repository.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;The Makefile&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;makefile&lt;/code&gt; is used to build the PDF from the Rnw Source.
It also performs other useful tasks.
A copy of the makefile is shown below:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;output = .output
rnwfile = Sweave_MCQ
backup = .backup

all:
    R CMD Sweave $(rnwfile).Rnw
    -mkdir $(output)
    -cp *.sty $(output)
    -mv *.tex *.pdf *.eps $(output)
    cd $(output); texify --run-viewer --pdf $(rnwfile).tex 

tex:
    cd $(output); texify --run-viewer --pdf $(rnwfile).tex

clean:
    -rm $(output)/*

backup:
    -mkdir $(backup)
    cp  $(output)/$(rnwfile).pdf $(backup)/$(rnwfile).pdf
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I recently &lt;a href=&quot;http://jeromyanglim.blogspot.com/2010/11/makefiles-for-sweave-r-and-latex-using.html&quot;&gt;posted on the benefits of makefiles when developing Sweave documents.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;make&lt;/code&gt; file starts with three variables.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;output&lt;/code&gt; stores the name of the folder where where all derivative files are placed.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rnwfile&lt;/code&gt; stores the name of the Rnw source file without the &lt;code&gt;.Rnw&lt;/code&gt; extension. 
This is also the base of the resulting &lt;code&gt;.tex&lt;/code&gt; and &lt;code&gt;.pdf&lt;/code&gt; files.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;backup&lt;/code&gt; stores the name of the folder where a copy of the pdf is placed if this is desired.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The file then has four goals.&lt;/p&gt;

&lt;p&gt;The default goal is called &lt;code&gt;all:&lt;/code&gt;.
If &lt;code&gt;make&lt;/code&gt; is called without argument from the command line in the project directory, the recipe immediately below &lt;code&gt;all:&lt;/code&gt; is run. Note that all apparent indentations are tab indentations (a set of spaces would cause an error).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The first line runs Sweave on the &lt;code&gt;Rnw&lt;/code&gt; file from the command line.
On windows this &lt;code&gt;R CMD Sweave&lt;/code&gt; requires installation of &lt;a href=&quot;http://www.murdoch-sutherland.com/Rtools/&quot;&gt;Rtools&lt;/a&gt;
Note how &lt;code&gt;$(rnwfile).Rnw&lt;/code&gt; will actually be &lt;code&gt;Sweave_MCQ.Rnw&lt;/code&gt; after variable substitution.&lt;/li&gt;
&lt;li&gt;The second line creates a directory that corresponds to the value in the variable &lt;code&gt;output&lt;/code&gt;. 
The hyphen at the start of the line ensures that any errors, such as if the folder already exists, do not stop &lt;code&gt;make&lt;/code&gt; from running.
Note that commands such as &lt;code&gt;mkdir&lt;/code&gt;, &lt;code&gt;cp&lt;/code&gt;, &lt;code&gt;cd&lt;/code&gt;, and &lt;code&gt;rm&lt;/code&gt; are based on the &lt;code&gt;sh&lt;/code&gt; shell.
These commands are supported on Windows if you have &lt;code&gt;Rtools&lt;/code&gt; installed.&lt;/li&gt;
&lt;li&gt;The third line copies &lt;code&gt;Sweave.sty&lt;/code&gt; into the &lt;code&gt;output&lt;/code&gt; folder.&lt;/li&gt;
&lt;li&gt;The fourth line copies &lt;code&gt;tex&lt;/code&gt;, &lt;code&gt;pdf&lt;/code&gt; and &lt;code&gt;eps&lt;/code&gt; files (i.e., those generated by the Sweave command) into the &lt;code&gt;output&lt;/code&gt; folder.
This is done to ensure that the root directory only includes source files.
This has several benefits. 
(a) It makes version control easier; &lt;br /&gt;
(b) it makes it easy to see the source files and
(c) it reduces the risk of accidentally deleting source files when deleting derived files.&lt;/li&gt;
&lt;li&gt;the fifth line changes the home directory to the &lt;code&gt;output&lt;/code&gt; directory and then runs
&lt;code&gt;texify&lt;/code&gt; on the &lt;code&gt;tex&lt;/code&gt; file generated from Sweave. 
The flags ensure that a pdf is generated and that the default viewer is initiated.
This command could be modified to something like &lt;code&gt;pdflatex&lt;/code&gt; or some other &lt;code&gt;latex&lt;/code&gt; program.&lt;/li&gt;
&lt;li&gt;By changing the directory, all the derived latex files are kept in the output folder.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;code&gt;tex:&lt;/code&gt; goal can be called by running &lt;code&gt;make tex&lt;/code&gt; at the command line.
I use it in case I want there is an error in the when compiling the pdf from the tex file.
Sometimes its easier to work out where the bug is by manipulating the intervening tex file.
Of course once the problem has been identified, it needs to be incorporated into the Rnw source.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;clean:&lt;/code&gt; goal removes all files in the output directory (i.e., all the derived files)&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;backup:&lt;/code&gt; goal copies the resulting pdf into the &lt;code&gt;backup&lt;/code&gt; folder.
I figured this might be useful in order to include a copy of the final product in the repository.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;.gitignore&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;/.output
.project
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The .&lt;code&gt;gitignore&lt;/code&gt; file prevents all files in the &lt;code&gt;/.output&lt;/code&gt; directory (i.e., the derived files) and the file &lt;code&gt;.project&lt;/code&gt; from being placed under version control in git.&lt;/p&gt;

&lt;p&gt;I&#39;m preparing a post on version control, git, and github which will be posted shortly.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3&gt;Sweave_MCQ.Rnw&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;Sweave_MCQ.Rnw&lt;/code&gt; is the R noweb file that contains chunks of LaTeX and R code.
When Sweave is run on this file, the R code chunks are converted into &lt;code&gt;tex&lt;/code&gt; and, potentially, image files are generated.&lt;/p&gt;

&lt;h4&gt;LateX Preamble&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;\documentclass[12pt, a4paper]{exam}
\usepackage[OT1]{fontenc}
\usepackage{Sweave}
\SweaveOpts{echo=FALSE}
\usepackage{hyperref}            
\hypersetup{pdfpagelayout=SinglePage} % http://www.tug.org/applications/hyperref/ftp/doc/manual.html
\setkeys{Gin}{width=0.8\textwidth}
\pagestyle{headandfoot} % every page has a header and footer
\header{}{Sample Multiple Choice Questions}{}
\footer{}{Page \thepage\ of \numpages}{}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The latex preamble is mostly general code that ensures proper display of the reuslting document.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;exam&lt;/code&gt; document class is great for writing a variety of exam style documents in LaTeX.
See &lt;a href=&quot;http://www.ctan.org/tex-archive/macros/latex/contrib/exam/&quot;&gt;CTAN - exam&lt;/a&gt;
for documentation.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;hyperref&lt;/code&gt; is used to display hyperlinks and allows the resulting pdf to open in &lt;code&gt;SinglePage&lt;/code&gt; format.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;\setkeys...&lt;/code&gt; controls the width of Sweave figures relative to the paragraph width. There are no figures in this documents; so it is not really required.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;\pagestyle{headerandfoot}...&lt;/code&gt; These three lines ensure the display of header and footer information on each page.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;First R Code Chunk&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;&amp;lt;prepare_data&amp;gt;&amp;gt;=
items &amp;lt;- read.csv(&quot;data/items.csv&quot;, stringsAsFactors = FALSE)

writeQuestion &amp;lt;- function(x){
    c(&quot;\\filbreak&quot;,
            paste(&quot;\\question\n&quot;, x[&quot;itemText&quot;]),
            &quot;\\begin{choices}&quot;,
            paste(&quot;\\choice&quot;, x[&quot;optionA&quot;]),
            paste(&quot;\\choice&quot;, x[&quot;optionB&quot;]),
            paste(&quot;\\choice&quot;, x[&quot;optionC&quot;]), 
            paste(&quot;\\choice&quot;, x[&quot;optionD&quot;]), 
            &quot;\\vspace{10 mm}&quot;,
            &quot;\\end{choices}\n\n&quot;)
}

itemText &amp;lt;- apply(items, 1, function(X)  writeQuestion(x = X))

answers &amp;lt;- paste(items$item, &quot;=&quot;,
        LETTERS[as.numeric(items$correctAnswer)],
        sep =&quot;&quot;)
answersText &amp;lt;- paste(answers, collapse = &quot;; &quot;)
@
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;R code chunks in Sweave are commenced by &lt;code&gt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;=&lt;/code&gt; and ended by &lt;code&gt;@&lt;/code&gt;. 
These need to appear in the first column of the text file.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;&amp;lt;prepare_data&amp;gt;&amp;gt;=&lt;/code&gt;: The first non-keyword placed in the opening tags provides a name for the R code chunk. 
A short descriptive title is useful both when reading the source and when debugging Sweave compilation.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;items...&lt;/code&gt;: this line reads in a csv file into a data frame with 40 cases. 
Each case is a multiple choice question with fields such as the question text, the text for the four response options, and the correct answer.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;writeQuestion...&lt;/code&gt;: This is a function which is designed to take a row of data from the &lt;code&gt;items&lt;/code&gt; data frame and return a latex formated character vector, where each element is ultimately be printed on its own line of the tex file.
Note how in order to produce one backslash in LaTeX, two backslashes, need to be written.
The &lt;code&gt;\question&lt;/code&gt;, &lt;code&gt;\choices&lt;/code&gt;, and &lt;code&gt;\choice&lt;/code&gt; commands are part of the &lt;code&gt;exam&lt;/code&gt; document class and are used for formatting multiple choice questions.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;apply...&lt;/code&gt; takes the &lt;code&gt;items&lt;/code&gt; data frame and for each row (1=rows) runs the function &lt;code&gt;writeQuestion&lt;/code&gt; on the row.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;answers...&lt;/code&gt; and &lt;code&gt;answersText&lt;/code&gt; create a formatted string that shows item numbers and letters for correct answers, all drawn from the &lt;code&gt;items&lt;/code&gt; data frame.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Remaining code&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;\begin{questions}
&amp;lt;&amp;lt;print_items, results=tex&amp;gt;&amp;gt;=
cat(itemText, sep = &quot;\n&quot;)
@
\newpage
\section*{Answers}
&amp;lt;&amp;lt;print_answers, results=tex&amp;gt;&amp;gt;=
cat(answersText) 
@

\end{questions}
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;The second R code chunk has a descriptive name &lt;code&gt;print_items&lt;/code&gt;.
It uses the key-value pair &lt;code&gt;results=tex&lt;/code&gt;. 
This ensures that Sweave interprets the text outputed using &lt;code&gt;cat&lt;/code&gt; as raw &lt;code&gt;tex&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cat...&lt;/code&gt; prints the long character vector &lt;code&gt;itemText&lt;/code&gt; containing all the latex for the questions. 
&lt;code&gt;sep=&quot;\n&quot;&lt;/code&gt; means that each element is printed on a new line 
which makes the resulting &lt;code&gt;tex&lt;/code&gt; file easier to read. &lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h3&gt;Summary and Related Resources&lt;/h3&gt;

&lt;p&gt;The combination of &lt;code&gt;make&lt;/code&gt;, &lt;code&gt;R&lt;/code&gt;, &lt;code&gt;Sweave&lt;/code&gt;, and &lt;code&gt;LaTeX&lt;/code&gt; is tremendously powerful.
Hopefully, this post encourages a few more people to have a play.
To learn more check out some of the following posts and pages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;
http://jeromyanglim.blogspot.com/2010/02/getting-started-with-sweave-r-latex.html&quot;&gt;Getting Started with Sweave&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;
http://jeromyanglim.blogspot.com/2010/11/makefiles-for-sweave-r-and-latex-using.html&quot;&gt;makefiles for Sweave, R and LaTeX using Eclipse on Windows&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://stats.stackexchange.com/questions/1980/complete-substantive-examples-of-reproducible-research-using-r&quot;&gt;Question on Stats.SE &#39;Complete substantive examples of reproducible research using R&#39;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; After posting this article on my blog, 
&lt;a href=&quot;http://www.aliquote.org/&quot;&gt;Christophe Lalanne&lt;/a&gt; 
let me know about a paper by Bettina Grün and Achim Zeileis called 
&lt;a href=&quot;http://www.jstatsoft.org/v29/i10/&quot;&gt;&#39;Automatic Generation of Exams in R&#39;&lt;/a&gt; in JSS. 
It also uses Sweave, LaTeX, and the exams document class.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/1120662403227628927'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/1120662403227628927'/><link rel='alternate' type='text/html' href='http://jeromyanglim.blogspot.com/2010/11/sweave-tutorial-using-sweave-r-and-make.html' title='Sweave Tutorial 1: Using Sweave, R, and Make to Generate a PDF of Multiple Choice Questions'/><author><name>jeromyanglim</name><uri>http://www.blogger.com/profile/12949204812496382042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-8909074830238091680.post-3400252866070924695</id><published>2010-11-23T16:09:00.003+11:00</published><updated>2010-11-25T21:20:57.207+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX"/><category scheme="http://www.blogger.com/atom/ns#" term="R"/><category scheme="http://www.blogger.com/atom/ns#" term="Sweave"/><title type='text'>makefiles for Sweave, R and LaTeX using Eclipse on Windows</title><content type='html'>This post provides a brief introduction to &lt;code&gt;make&lt;/code&gt; and &lt;code&gt;makefiles&lt;/code&gt;.
In particular it describes how to set up &lt;code&gt;make&lt;/code&gt; on Windows with an emphasis on using &lt;code&gt;make&lt;/code&gt; in Eclipse on projects involving R, Sweave, and LaTeX.

&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;

&lt;h3&gt;Overview&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;make&lt;/code&gt; is software that uses &lt;code&gt;makefiles&lt;/code&gt; to build projects.
&lt;code&gt;make&lt;/code&gt; has many benefits.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One click build&lt;/li&gt;
&lt;li&gt;Reliable build (always build derived files that need to be built; i.e., ensure build is up to date)&lt;/li&gt;
&lt;li&gt;Fast build (i.e., don&#39;t build things that don&#39;t need to be built)&lt;/li&gt;
&lt;li&gt;Clean up a project&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;make&lt;/code&gt; has won the &lt;a href=&quot;http://en.wikipedia.org/wiki/ACM_Software_System_Award&quot;&gt;ACM Software System Award&lt;/a&gt;.
It shares this honour with two of my other favourite tools: &lt;code&gt;TeX&lt;/code&gt; and &lt;code&gt;S&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;make&lt;/code&gt; has also encouraged me to think more about dependencies, one-click builds, and project file structures.
Specifically, I use &lt;code&gt;make&lt;/code&gt; in conjunction with R, Sweave, LaTeX, and other command line tools to build reproducible research output.
I&#39;ll post some examples in the near future. &lt;/p&gt;

&lt;h3&gt;Installation on Windows&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Option 1: Install &lt;a href=&quot;http://www.cygwin.com/&quot;&gt;Cygwin&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Option 2: Install &lt;a href=&quot;http://www.murdoch-sutherland.com/Rtools/&quot;&gt;Rtools&lt;/a&gt;
and add Rtools to the Windows path (installation can do this for you);&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In order to run Sweave on the command line on Windows using: &lt;code&gt;R CMD Sweave foo.Rnw&lt;/code&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add R binaries to the Windows Path (e.g., &lt;code&gt;C:\Program Files\R\R-2.11.1\bin&lt;/code&gt;;
&lt;a href=&quot;http://www.computerhope.com/issues/ch000549.htm&quot;&gt;see here for instructions&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Have Rtools installed&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href=&quot;http://cran.r-project.org/doc/manuals/R-intro.html#Scripting-with-R&quot;&gt;Introduction to R&lt;/a&gt; has more information about running R at the command line.  &lt;/p&gt;

&lt;h3&gt;Running makefiles in Eclipse&lt;/h3&gt;

&lt;p&gt;I use Eclipse to edit R and Sweave files.
To configure &lt;code&gt;make&lt;/code&gt; in Eclipse: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Run - External Tools - External Tools Configurations&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;New
&lt;ul&gt;&lt;li&gt;&lt;em&gt;Name:&lt;/em&gt; make&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Location:&lt;/em&gt; location of make file; e.g., &lt;code&gt;C:\Program Files\GnuWin32\bin\make.exe&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Working Directory:&lt;/em&gt; &lt;code&gt;${Project_loc}&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thus, with a &lt;code&gt;makefile&lt;/code&gt; in the root directory of a project, &lt;code&gt;Run - External Tools - Make&lt;/code&gt; runs the &lt;code&gt;makefile&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Also note:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Whenever a directory is added to the Windows Path, Eclipse needs to be restarted for this to take effect.
Sometimes it seems that Windows itself has to be restarted.&lt;/li&gt;
&lt;li&gt;Editing makefiles in Eclipse requires the use of tabs. The following setting enables tabs instead of space substitution (&lt;code&gt;Window - Preferences - General - Editors - Text Editors - Insert Space for Tables (uncheck)&lt;/code&gt;); or edit the &lt;code&gt;makefile&lt;/code&gt; in another text editor such as &lt;code&gt;notepad&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;For LaTeX I have MikTeX installed; this should be on the Windows path&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Resources for Getting Started with makefiles for Sweave&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Ross Ihaka has a quick introduction to &lt;a href=&quot;http://www.stat.auckland.ac.nz/~stat782/downloads/make-tutorial.pdf&quot;&gt;makefiles focusing on Sweave, R, and LaTeX&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Charlie Gibbons wrote a document with &lt;a href=&quot;http://cgibbons.berkeley.edu/Research/Papers/MakefileTutorial.pdf&quot;&gt;LaTeX, Sweave, and Beamer examples of makefiles&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Gregor Gorjanc shows an &lt;a href=&quot;http://ggorjan.blogspot.com/2009/01/using-makefile-to-ease-repeated.html&quot;&gt;example Sweave make file&lt;/a&gt; using his custom Sweave command&lt;/li&gt;
&lt;li&gt;Documentation on &lt;a href=&quot;http://www.gnu.org/software/make/manual/make.html&quot;&gt;GNU Make&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://jeromyanglim.blogspot.com/2010/03/running-command-line-programs-in.html&quot;&gt;Running command line programs in Windows&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://jeromyanglim.blogspot.com/2010/02/getting-started-with-sweave-r-latex.html&quot;&gt;Getting Started with Sweave: R, LaTeX, Eclipse, StatET, &amp;amp; TeXlipse&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/3400252866070924695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/3400252866070924695'/><link rel='alternate' type='text/html' href='http://jeromyanglim.blogspot.com/2010/11/makefiles-for-sweave-r-and-latex-using.html' title='makefiles for Sweave, R and LaTeX using Eclipse on Windows'/><author><name>jeromyanglim</name><uri>http://www.blogger.com/profile/12949204812496382042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-8909074830238091680.post-5377788322197178241</id><published>2010-10-23T20:22:00.000+11:00</published><updated>2010-10-23T20:22:27.150+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX"/><category scheme="http://www.blogger.com/atom/ns#" term="mathematics"/><title type='text'>Getting Started with Writing Mathematics in LaTeX</title><content type='html'>LaTeX and mathematics go well together. 
At the risk of preaching to the converted, this post sets out
(a) reasons to learn to write mathematics in LaTeX,
(b) a few free internet guides on learning to write mathematics in LaTeX,
(c) several internet resources which can facilitate writing mathematics
 in LaTeX. 

&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;


&lt;h3&gt;Reasons to Learn to Write Mathematics in LaTeX&lt;/h3&gt;
There are many good reasons to learn how to write mathematics in LaTeX.
&lt;ul&gt;
&lt;li&gt;LaTeX encourages mathematical writing.
    It&#39;s just plain text.
    It&#39;s easy to write, copy, and paste formulas.
    That which is easy gets done.&lt;/li&gt;
&lt;li&gt;Many websites such as Wikipedia, Stackexchange, Wordpress blogs, and so on use LaTeX to render mathematics.
    Thus, learning mathematics and LaTeX pays dividends 
    in many places.&lt;/li&gt;
&lt;li&gt;LaTeX demystifies the complexity of mathematical texts.
    Before learning LaTeX, my mind boggled at the apparent complexity of mathematical documents. All the numbering, cross-references, and symbols that appeared so complex, appear relatively straightforward from the perspective of LaTeX.&lt;/li&gt;
&lt;li&gt;LaTeX fosters skills in verbalising mathematics.
    The markup is similar to verbalised mathematics.
    Along with 
    &lt;a href=&quot;http://jeromyanglim.blogspot.com/2009/05/pronunciation-guides-for-mathematical.html&quot;&gt;
    pronunciation guides&lt;/a&gt;
    and 
    &lt;a href=&quot;http://jeromyanglim.blogspot.com/2009/05/online-mathematics-video-courses-for.html&quot;&gt;
    mathematical video courses&lt;/a&gt;, writing LaTeX 
    can be particularly useful
    for the self-taught social scientist.&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;Getting Started&lt;/h3&gt;
If you&#39;re completely new to LaTeX, check out &lt;a href=&quot;http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/&quot;&gt;this guide&lt;/a&gt; by David R. Wilkins.
In regards to getting started with writing mathematics in LaTeX, 
the internet is filled with resources.
The following are two goods guides:
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;ftp://ftp.ams.org/pub/tex/doc/amsmath/short-math-guide.pdf&quot;&gt;
        Short Math Guide to LaTeX&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://en.wikibooks.org/wiki/LaTeX/Mathematics&quot;&gt;
    Chapter on Mathematics in the LaTeX Wikibook&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;Setting up a Learning Environment&lt;/h3&gt;
The following links provide an environment of
 rapid feedback useful when learning to write mathematics in LaTeX.
&lt;ul&gt;
&lt;li&gt;A text editor that provides lists of mathematical symbols:
    I use WinEdt, which has a GUI for many mathematical symbols.
    But many text editors provide such support.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.codecogs.com/latex/eqneditor.php&quot;&gt;
    Codecogs&lt;/a&gt; has a real time online LaTeX equation editor.&lt;/li&gt;
&lt;li&gt;Uni Colorado provides a quick to load
    &lt;a href=&quot;http://amath.colorado.edu/documentation/LaTeX/Symbols.pdf&quot;&gt;extensive list of symbols&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Scott Pakin provides a big download with 
    &lt;a href=&quot;http://www.ctan.org/tex-archive/info/symbols/comprehensive/symbols-a4.pdf&quot;&gt;
    a comprehensive list of LaTeX symbols&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://detexify.kirelabs.org/classify.html&quot;&gt;
    DeTeXify&lt;/a&gt; allows you to draw the desired symbol online
    and the program attempts to guess the LaTeX symbol.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://tex.stackexchange.com/&quot;&gt;
    Tex.SE&lt;/a&gt; is a great site for getting answers to LaTeX related questions.&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;Basic Working LaTeX file&lt;/h3&gt;
The following provides the simplest of working environments which can be useful when first learning.
&lt;pre&gt;
\documentclass{article}
\usepackage{amsmath}
\begin{document}

\end{document}
&lt;/pre&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/5377788322197178241'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/5377788322197178241'/><link rel='alternate' type='text/html' href='http://jeromyanglim.blogspot.com/2010/10/getting-started-with-writing.html' title='Getting Started with Writing Mathematics in LaTeX'/><author><name>jeromyanglim</name><uri>http://www.blogger.com/profile/12949204812496382042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-8909074830238091680.post-693486981465900570</id><published>2010-08-25T22:26:00.001+10:00</published><updated>2010-08-26T12:24:35.623+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Beamer"/><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX"/><category scheme="http://www.blogger.com/atom/ns#" term="presentations"/><title type='text'>Getting Started with Beamer: Tips and Tricks for LaTeX Presentations</title><content type='html'>&lt;!--Getting Started with Beamer--&gt;
This post provides a guide to getting started with
 Beamer, a popular LaTeX package for preparing slide presentations.
The post:
(a) Lists some of the benefits of Beamer in comparison to PowerPoint;
(b) Links to tutorials and suggestions for learning
    Beamer for both people who do and do not know LaTeX;
(c) Documents problems that I encountered when learning
    to use Beamer and the solutions that I developed
    to overcome them.

&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;


&lt;h3&gt;Overview Of Beamer&lt;/h3&gt;
&lt;h4&gt;Benefits of Beamer&lt;/h4&gt;
In contrast to Microsoft PowerPoint, the following are some of the benefits of
 Beamer:

&lt;ul&gt;
&lt;li&gt;Outputs to PDF which allows for consistent appearance
    across versions and Operating systems&lt;/li&gt;
&lt;li&gt;Free as in no cost and free as in the ability to view and modify the source code&lt;/li&gt;
&lt;li&gt;Simple generation of slide navigation tools&lt;/li&gt;
&lt;li&gt;Robust incorporation of mathematical formulas&lt;/li&gt;
&lt;li&gt;Text based format enables programmatic incorporation of slides
    and use of text manipulation tools to alter presentation&lt;/li&gt;
&lt;li&gt;Easier to create different versions of slides
    for handouts, articles, and the main presentation&lt;/li&gt;
&lt;li&gt;As with LaTeX in general, it is easier to create reproducible research&lt;/li&gt;
&lt;li&gt;Encourages good practice in slide construction and formatting
    (e.g., consistent formatting; useful defaults;
    strong support for navigation; encourages a focus on content
    rather than fancy effects;  etc.)&lt;/li&gt;
&lt;li&gt;Sequencing and highlighting of presentation text is easy (i.e., overlays)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Getting Started&lt;/h3&gt;
The starting point for learning Beamer depends on whether you
 already know LaTeX.

&lt;h4&gt;If you don&#39;t know LaTeX:&lt;/h4&gt;
Then you&#39;ll want to learn about LaTeX before getting
 started with Beamer.
You&#39;ll need:
&lt;br /&gt;
(a) A text editor. I currently use
    &lt;a href=&quot;http://jeromyanglim.blogspot.com/2010/04/winedt-60-for-latex-features.html&quot;&gt;
    WinEdt 6.0&lt;/a&gt;,
    which integrates with MikTeX particularly well.
    TeXnicCenter also integrates with MikTeX well.
    See this discussion on &lt;a href=&quot;http://stackoverflow.com/questions/270121/best-latex-editor-for-windows&quot;&gt;
    StackOverflow regarding good LaTeX editors&lt;/a&gt;.
&lt;br /&gt;
(b) A LaTeX distribution. I use &lt;a href=&quot;http://miktex.org/&quot;&gt;MikTeX&lt;/a&gt;.
MikTeX appears to be a popular option on Windows.
It does a good job of automatically downloading packages, such as &lt;code&gt;beamer&lt;/code&gt;.
&lt;br /&gt;&lt;br /&gt;
Then spend a couple of weeks learning LaTeX by reading materials
 about LaTeX and applying the ideas to a document you are currently working on.
There&#39;s heaps of good materials online, such as:
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://en.wikibooks.org/wiki/LaTeX/&quot;&gt;LaTeX Wikibook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ctan.org/tex-archive/info/lshort/english/lshort.pdf&quot;&gt;
    The Not So Short Introduction to LaTeX 2e&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
If you have the money or a good library, its worth reading
 a &lt;a href=&quot;http://www.macrotex.net/texbooks/&quot;&gt;few books&lt;/a&gt;.


&lt;h4&gt;If you already know LaTeX:&lt;/h4&gt;
If you already know LaTeX but you don&#39;t know Beamer, I&#39;d suggest the following steps.

&lt;h5&gt;1. Get Started:&lt;/h5&gt;
This &lt;a href=&quot;http://www.math-linux.com/spip.php?article77&quot;&gt;tutorial on Math-Linux&lt;/a&gt; shows a very basic beamer presentation.
Run the code in your text editor to ensure your installation is working.
Get a flavour for the essential elements of a Beamer document.

&lt;h5&gt;2. Get Oriented:&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;Charles Batts has a &lt;a href=&quot;http://www.uncg.edu/cmp/reu/presentations/Charles%20Batts%20-%20Beamer%20Tutorial.pdf&quot;&gt;
    Beamer Tutorial&lt;/a&gt;.
    It introduces many important ideas.
    It also has the benefits of being in Beamer
&lt;/li&gt;
&lt;li&gt;Sascha Frank has provided
    &lt;a href=&quot;http://www.informatik.uni-freiburg.de/~frank/ENG/latex-course/latex-course-3/latex-course-3_en.html&quot;&gt;
    a set of eight example slides&lt;/a&gt;
    showing LaTeX source and PDF.
    Reverse engineering these slides is a good way to learn how Beamer works.&lt;/li&gt;
&lt;li&gt;Norm Matloff also has a useful &lt;a href=&quot;http://heather.cs.ucdavis.edu/~matloff/beamer.html&quot;&gt;
    quick tutorial on Beamer&lt;/a&gt;.
&lt;li&gt;If you like videos, you might also want to check out GM-RAM&#39;s
    &lt;a href=&quot;http://www.wekaleamstudios.co.uk/posts/creating-a-presentation-with-latex-beamer-getting-started/&quot;&gt;
    introductory videos on Beamer&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;3. Learn the detail&lt;/h5&gt;
The &lt;a href=&quot;http://www.ctan.org/tex-archive/macros/latex/contrib/beamer/doc/beameruserguide.pdf&quot;&gt;
Beamer user guide&lt;/a&gt; is excellent.
It is over 200 pages.
It&#39;s worth reading in its entirety.


&lt;h5&gt;More tips, if you want them&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://tex.stackexchange.com/questions/tagged/beamer&quot;&gt;
    tex.stackexchange.com&lt;/a&gt; is a great place to ask latex-related questions
    including Beamer questions.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://robjhyndman.com/researchtips/giving-a-research-seminar/&quot;&gt;
    Rob Hyndman&lt;/a&gt; gives some tips for beamer conference presentations.&lt;/li&gt; He also shares many examples of &lt;a href=&quot;http://robjhyndman.com/publications/talks/&quot;&gt;well structured beamer presentations&lt;/a&gt;.
&lt;li&gt;&lt;a href=&quot;http://www.math.umbc.edu/~rouben/beamer/quickstart.html&quot;&gt;
    Rouben Rostamian&lt;/a&gt; has a great Beamer guide.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://zrno.fsb.hr/katedra/download/materijali/1082.pdf&quot;&gt;
    Krzysztof Fleszar&lt;/a&gt; has a beamer tutorial that has
    lots of examples highlighting the effect of particular code.&lt;/li&gt;
&lt;li&gt;Matthias Pospiech presents an &lt;a href=&quot;http://www.matthiaspospiech.de/latex/vorlagen/beamer/content/beamer-examples/&quot;&gt;
    extensive beamer example&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;General Reflections&lt;/h3&gt;
I&#39;ve used the transition to Beamer to reflect on my slide
 creation strategies. 


&lt;ul&gt;
&lt;li&gt;Use sections and subsections wisely.
Think of the document in terms of a hierarchical structure.&lt;/li&gt;
&lt;li&gt;Incorporate Tables of contents to show the outline of the talk.
In long talks remind the audience of where you are in the structure.&lt;/li&gt;
&lt;li&gt;In longer talks, use the visual section display tools&lt;/li&gt;
&lt;li&gt;Use slide text to support the talk, not supplement the talk.
Only include extended passages of text, where the exact wording
 is particularly important, such as for quotes and definitions.
If extended passages of text are important enough to include, 
 they should generally be read out verbatim, so that the audience
 is not conflicted between whether to listen to the speaker&#39;s words or
 read the slides.
Most of the time, extended passages of text should be avoided.
The words of the talk should extend the text displayed on the screen.&lt;/li&gt;
&lt;li&gt;If a more comprehensive handout is required such as for future reference or for people who did not attend the talk, a separate document should be prepared.
Beamer makes this relatively easy with handout and article modes.&lt;/li&gt;
&lt;li&gt;Prefer more slides to fewer slides with too much information.
If there are a large number of points on a slide,
the slide should be split into multiple slides.&lt;/li&gt;
&lt;/ul&gt;



&lt;h3&gt;Challenges Resolved&lt;/h3&gt;
The following reflects a few of the problems that I encountered
 when first learning Beamer and the solutions I adopted.
Many of the solutions were generated by reading the
 &lt;a href=&quot;http://www.ctan.org/tex-archive/macros/latex/contrib/beamer/doc/beameruserguide.pdf&quot;&gt;
 Beamer User Guide&lt;/a&gt;.

&lt;h4&gt;1. Fitting text on a slide&lt;/h4&gt;
&lt;b&gt;Problem:&lt;/b&gt;
PowerPoint automatically adjusts the size of text to fit on a slide.
What is the Beamer approach to this problem?

&lt;br /&gt;&lt;br /&gt;
&lt;b&gt;Solution:&lt;/b&gt;
Users of Beamer and LaTeX actively discourage such ad hoc adjustment of font sizes.
In such situations the slide should be restructured.
However, &lt;code&gt;shrink=5&lt;/code&gt; can be added
 as a frame option (see &lt;a href=http://www.math.umbc.edu/~rouben/beamer/quickstart-Z-H-23.html&quot;&gt;UMBC&lt;/a&gt;).
Alternatively, the &lt;code&gt;allowframebreaks&lt;/code&gt; is an option
 of the frame environment.
It can be used to extend text over multiple slides.


&lt;h4&gt;2. Handouts with only a subset of slides&lt;/h4&gt;
&lt;b&gt;Problem:&lt;/b&gt; When I create presentations, I often include slides that
 I don&#39;t want included in the handout.
For example, I may wish to include a series of photos in the presentation,
 but leave them out of the handout.

&lt;br /&gt;&lt;br /&gt;
&lt;b&gt;Solution:&lt;/b&gt;
See &lt;a href=&quot;http://old.nabble.com/Hiding-frames-td22008369.html&quot;&gt;nabble&lt;/a&gt;
 for a discussion.
I add &lt;code&gt;handout:0&lt;/code&gt; to the frame as follows:
&lt;pre&gt;
\begin{frame}&amp;lt;handout:0&amp;gt;{Title of Frame}
&lt;/pre&gt;

To print handouts the document class is changed as follows:
&lt;pre&gt;
\documentclass[handout, t]{beamer}
&lt;/pre&gt;

&lt;br /&gt;
A second option is to add a line in the preamble like this:
&lt;pre&gt;
\includeonlyframes{handout}
&lt;/pre&gt;
Then each frame that is to be included in this version should
 have the additional label.
&lt;pre&gt;
\begin{frame}[label=handout]
&lt;/pre&gt;

&lt;h4&gt;3. Full Screen Images&lt;/h4&gt;
&lt;b&gt;Problem:&lt;/b&gt;
How do you create slides with full screen images?

&lt;br /&gt;&lt;br /&gt;
&lt;b&gt;Solution:&lt;/b&gt;
It is useful to know that the default frame size is 128mm (width)
    by 96mm (height).
One solution is suggested
 on &lt;a href=&quot;http://newsgroups.derkeiler.com/Archive/Comp/comp.text.tex/2008-11/msg00945.html&quot;&gt;
 this news group&lt;/a&gt;.
The beamer user guide also mentions the &lt;code&gt;textpos&lt;/code&gt; package
 as a tool for positioning figures absolutely.

&lt;br /&gt; &lt;br /&gt;
The following strategy worked, but not when I had &lt;code&gt;\mode*&lt;/code&gt;
 in operation.
&lt;pre&gt;
{
\usebackgroundtemplate{\includegraphics[width=\paperwidth]{figure}}
\begin{frame}[plain]
\end{frame}
}
&lt;/pre&gt;

&lt;br /&gt;&lt;br /&gt;
The following seems to work when I have &lt;code&gt;\mode*&lt;/code&gt; operating
 in the document.
&lt;pre&gt;
\mode&amp;lt;all&amp;gt;
{
\usebackgroundtemplate{\includegraphics[width=\paperwidth]{figure}}
\begin{frame}[plain]
\end{frame}
}
\mode&amp;lt;all&amp;gt;{\usebackgroundtemplate{}}
\mode*
&lt;/pre&gt;


&lt;h4&gt;4. Incorporating Notes&lt;/h4&gt;
&lt;b&gt;Problem:&lt;/b&gt;
In general, when I prepare a presentation, I like to write out the main
 points that I want to make.
When it comes time to giving the presentation, I don&#39;t read the notes,
 but the act of writing the notes, ensures that I have thought about the
 points that I want to make.
If I need to give the presentation a second time, I&#39;ll read over the notes again.
In some settings, I&#39;ll make a copy of the presentation available
 that includes both the slides and the notes.
Thus, in Beamer I was looking for a good system that
 (a) enabled the writing of notes in an around the latex source for each slide
 (b) enabled easy toggling between PDF versions of the presentation
    with and without notes.

&lt;br /&gt;&lt;br /&gt;
&lt;b&gt;Solutions:&lt;/b&gt;&lt;br /&gt;
A. Beamer does allow for the &lt;code&gt;\notes&lt;/code&gt; command.

&lt;br /&gt;&lt;br /&gt;
B. However, my preferred solution is to type normal sentences
 after each slide; i.e., after &lt;code&gt;\end{frame}&lt;/code&gt;.
I then add &lt;code&gt;\mode*&lt;/code&gt; just after &lt;code&gt;\begin{document}&lt;/code&gt;.
In general this means that text outside frames is not displayed in the presentation.
The benefit of this approach are that
(a) these notes can easily be converted into a written text
    using the &lt;code&gt;article&lt;/code&gt; mode; and
(b) text can be written in a natural way without the need
    to enclose it in a particular environment or command.
More information about &lt;code&gt;\mode*&lt;/code&gt; and
 &lt;code&gt;\mode&lt;/code&gt; is available in the beamer user guide.
The user guide also has advice (21.2.2 Workflow) on how
 to manage the production of an article and a presentation version
 of a document.


&lt;h4&gt;5. Hyperlinks within the document&lt;/h4&gt;
&lt;b&gt;Problem:&lt;/b&gt;
How do you set up buttons and links from one slide to another?

&lt;br /&gt;&lt;br /&gt;
&lt;b&gt;Solution:&lt;/b&gt;
&lt;ul&gt;
&lt;li&gt;Section 11 of the
 &lt;a href=&quot; http://www.ctan.org/tex-archive/macros/latex/contrib/beamer/doc/beameruserguide.pdf&quot;&gt;
 Beamer user guide&lt;/a&gt;
 has a section on Adding Hyperlinks and Buttons.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.math.umbc.edu/~rouben/beamer/quickstart-Z-H-15.html&quot;&gt;
    UMBC&lt;/a&gt; has a simple example of using hyperlink buttons.&lt;/li&gt;
&lt;/ul&gt;


&lt;h4&gt;6. Removing Superfluous materials&lt;/h4&gt;
&lt;b&gt;Problem:&lt;/b&gt;
Many of the standard templates include many extra lines above and below
 the slide that reduce the space available for slide content.
How should this be dealt with?

&lt;br /&gt;&lt;br /&gt;
&lt;b&gt;Solution:&lt;/b&gt;
The advice on most beamer-related websites regarding navigation is as follow.
If the presentation is short and simple, don&#39;t include navigation.
If the presentation is long or complex, include navigation.
The loss of slide-space to navigational elements is worth it.
Material can be restructured to use more slides.

&lt;br /&gt;&lt;br /&gt;
Similarly, the footlines are typically used to put things like
 presenter&#39;s name, institutional affiliation, title, page number, and so on.
The general advice on beamer-related websites is that if your
 audience knows all this information already (e.g., lecture in a university subject), then don&#39;t included it.
If your audience doesn&#39;t know this information (e.g., conference presentation)
 include it.

&lt;br /&gt;&lt;br /&gt;
It is possible to temporarily remove remove headlines, footlines and sidebars by
 using the &lt;code&gt;[plain]&lt;/code&gt; option in the frame environment.
This is particularly useful for slides that show a single large image.

&lt;br /&gt;&lt;br /&gt;
The following code in the preamble can be used in order to create a sparse
 style:
&lt;pre&gt;\usetheme{default} &lt;/pre&gt;


&lt;h4&gt;7. Forward and Inverse Search with PDF&lt;/h4&gt;
&lt;b&gt;Problem:&lt;/b&gt;
I&#39;d previously been using latex and a DVI viewer for compiling documents.
I decided to make the transition to pdflatex.
pdflatex makes it easier to work with graphics
 supporting png, jpg, and pdf, as opposed to latex which supports eps.
Unfortunately, Adobe Acrobat does not support forward and inverse search which
 makes it a lot easier to edit latex source.

&lt;br /&gt;&lt;br /&gt;
&lt;b&gt;Solution:&lt;/b&gt;
I downloaded and installed &lt;a href=&quot;http://blog.kowalczyk.info/software/sumatrapdf/index.html&quot;&gt;Sumatra PDF&lt;/a&gt;.
Configuring was simple in WinEdt 6.0.
&lt;pre&gt;Options - Execution Modes - PDF Viewier - Sumatra PDF&lt;/pre&gt;
There is further discussion
    &lt;a href=&quot;http://william.famille-blum.org/blog/static.php?page=static081010-000413&quot;&gt;
here.&lt;/a&gt;

&lt;br /&gt;&lt;br /&gt;
In WinEdt the default keys are:
&lt;code&gt;Ctrl+Shift+R&lt;/code&gt; to show PDF, and
&lt;code&gt;Shift+F8&lt;/code&gt; to do forward search.
Double clicking in the PDF goes to the latex source.



&lt;h4&gt;8. Improving the WinEdt 6.0 Tree View&lt;/h4&gt;
&lt;b&gt;Problem:&lt;/b&gt;
WinEdt 6.0 has a tree view which by default shows various
 aspects of the structure of latex documents, such as sections
 and subsections.
I wanted to be able to see frames underneath sections and subsections.
This would allow me to navigate more easily to particular slides.
It would also help in seeing where I was in the hierarchical structure
 of the presentation.


&lt;br /&gt;&lt;br /&gt;
&lt;b&gt;Solution:&lt;/b&gt;
I added the following code to &lt;code&gt;tree.ini&lt;/code&gt;.
I simply adapted it from an existing example.
It works, but I am not sure what all the lines of code are doing.
It also does not work with some less common frame declarations.

&lt;pre&gt;
  ITEM=&quot;\begin{frame}{?}&quot;
    MODE=&quot;TeX&quot;
    CASE_SENSITIVE=1
    BEGINNING_OF_LINE_ONLY=1
    CURRENT_DOCUMENT_ONLY=1
    ALL_OPENED_DOCUMENTS=0
    COMPLETE_PROJECT_TREE=1
    ICON=&quot;Paragraph&quot;
    LEVEL=26
    CAPTION=&quot;%?&quot;
    BALANCED=&quot;{}\&quot;
    MAX_LINE_SPAN=3
    ON_CTRL_CLICK=&quot;GlobalMark;TreeTrack(2);&quot;
    ON_CTRL_DBL_CLICK=&quot;Relax;&quot;
    ON_CLICK=&quot;TreeTrack(2,1);&quot;
    ON_DBL_CLICK=&quot;TreeTrack(2,2);&quot;
    ACTION=&quot;Find&quot;
      IMAGE=&quot;Find&quot;
      MACRO=&quot;TreeTrack(2);&quot;
    SUBSTITUTION=&quot;\label{*}&quot;
      SUB_FIND=&quot;\\label\{*\}&quot;
      SUB_REPLACE=&quot;&quot;
      SUB_REG_EX=1
      SUB_CASE_SENSITIVE=1
    SUBSTITUTION=&quot;  &quot;
      SUB_FIND=&quot; +{ }&quot;
      SUB_REPLACE=&quot; &quot;
      SUB_REG_EX=1
      SUB_CASE_SENSITIVE=1
    SUBSTITUTION=&quot;\ldots&quot;
      SUB_FIND=&quot;\ldots&quot;
      SUB_REPLACE=&quot;...&quot;
      SUB_REG_EX=0
      SUB_CASE_SENSITIVE=1
&lt;/pre&gt;


&lt;h4&gt;9. Hyperlink Navigation within a Presentation&lt;/h4&gt;
&lt;b&gt;Problem:&lt;/b&gt;
How can hyperlinks be included which
 can be clicked in order to navigate between slides.

&lt;b&gt;Solution:&lt;/b&gt;
The beamer user guide discusses this.
Matthias Pospiech presents
 &lt;a href=&quot;http://www.matthiaspospiech.de/latex/vorlagen/beamer/content/beamer-examples/&quot;&gt;
 a few examples of using buttons and hyperlinks&lt;/a&gt;.
Go to the page and search for &quot;hyperlink&quot;.

&lt;br /&gt;&lt;br /&gt;
A simple option is to add a label to the target frame.
E.g.,
&lt;pre&gt;
\begin{frame}[label=thetargetlabel]
...
&lt;/pre&gt;
Then add within the linking frame
&lt;pre&gt;
\hyperlink{thetargetlabel}{\beamergotobutton{Button Text}}
&lt;/pre&gt;
Then press &lt;code&gt;Alt+Left&lt;/code&gt; to navigate back to the linking frame
 if viewing the slide show in Adobe Acrobat.


&lt;h4&gt;10.Creating handouts&lt;/h4&gt;
&lt;b&gt;Problem:&lt;/b&gt;
Handouts are typically supplied with multiple slides per page.
How is this effect achieved in Beamer?


&lt;br /&gt;&lt;br /&gt;
&lt;b&gt;Solution:&lt;/b&gt;&lt;br /&gt;
A. &lt;code&gt;pdfnup&lt;/code&gt;
 is meant to be well suited to the task of placing &lt;code&gt;n&lt;/code&gt;, &lt;code&gt;pdf&lt;/code&gt;
 pages &lt;code&gt;up&lt;/code&gt; onto one page.


&lt;br /&gt;&lt;br /&gt;
B. I&#39;m currently using the &lt;code&gt;pgfpages&lt;/code&gt; package to do the job.
I quite like the results that I get from four per page (i.e., 2 by 2)
 in landscape mode using the code below.
&lt;pre&gt;
\mode&amp;lt;handout&amp;gt;{
\usepackage{pgfpages}
\pgfpagesuselayout{4 on 1}[a4paper, border shrink=5mm, landscape]
}
&lt;/pre&gt;

The code
&lt;pre&gt;\mode&amp;lt;handout&amp;gt;{...}&lt;/pre&gt;
 requires the &lt;code&gt;documentclass&lt;/code&gt; to have the &lt;code&gt;handout&lt;/code&gt; option to
 be specified like this:
&lt;code&gt;\documentclass[handout, t]{beamer}&lt;/code&gt;



&lt;h4&gt;11. Minimising Typing&lt;/h4&gt;
&lt;b&gt;Problem:&lt;/b&gt;
The markup for beamer is quite verbose.
All the frame, block, columns, and itemize environments and the need to
 add &lt;code&gt;item&lt;/code&gt; to the start of each dot point leads to a lot of non-content related typing.

&lt;br /&gt;&lt;br /&gt;
&lt;b&gt;Solutions&lt;/b&gt;&lt;br /&gt;
I received some helpful suggestions when I asked the &lt;a href=&quot;http://tex.stackexchange.com/questions/1264/typing-and-editing-beamer-presentations&quot;&gt;
    question about minimising typing on tex.stackexchange.com&lt;/a&gt;.

&lt;br /&gt;&lt;br /&gt;
A. There are several shorthand notations to make creating
 beamer presentations simpler.
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www-user.tu-chemnitz.de/~mren/wiki2beamer/doku.php&quot;&gt;
    wiki2beamer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://sourceforge.net/projects/ezbm/&quot;&gt;Easy Beamer (ezbm)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
However, I&#39;m reluctant to adopt these approaches.
Using non-standard notation often introduces compatibility issues.

&lt;br /&gt;&lt;br /&gt;
B. I have also set up template text of the most common types
 of slides.
I place these in a separate file, which I can copy and paste into
 the main presentation file as required.
I&#39;m considering using some form of code snippet system.
I present this template in a &lt;a href=&quot;http://jeromyanglim.blogspot.com/2010/08/simple-beamer-template-for-getting.html&quot;&gt;
    separate post&lt;/a&gt;.





&lt;h4&gt;12. Preventing Beamer markup from interfering with thinking&lt;/h4&gt;
&lt;b&gt;Problem:&lt;/b&gt;
Beamer formatting tags are fairly verbose.
For example, you have to remember to open and close environments
 and for each dot point its necessary to write &quot;\item&quot;.
Thus, producing a slide involves a fair amount of typing.
Similarly, modifying a slide also takes time.
When the content of the slide is still being refined,
 prematurely entering formatting can be a waste of time.
In contrast to LaTeX documents, the markup to text ratio
 in Beamer presentations is particularly high.
I found that writing Beamer markup often interfered with the content
 creation process.

&lt;br /&gt;&lt;br /&gt;
&lt;b&gt;Solution:&lt;/b&gt;&lt;br /&gt;
A. With practice, the markup becomes more natural.
In addition, there are tricks for using slide templates
 to speed up the process of entering markup.

&lt;br /&gt;&lt;br /&gt;
B. There are also various wiki-like markup languages which aim
 to make the markup less verbose.

&lt;br /&gt;&lt;br /&gt;
C. Initially I found it useful to use my own loose markup style
 when writing the draft of the presentation.
My process involved entering the details of the slide text on a first
 draft and then going over the slides in a second iteration
 to put in the markup.
My basic markup looked like this:
&lt;pre&gt;\section{This is the first section}
* Slide 1 Title text
- point 1 on slide 1
- point 2 on slide 1

* Slide 2 Title text
% insert someImageFileName
&lt;/pre&gt;



&lt;br /&gt;&lt;br /&gt;
D. In general over time I&#39;ve found that typing basic beamer commands
    becomes a lot quicker and less distracting with practice.
    I&#39;ve also found that I do a fair amount of initial brainstorming
    of the structure and content of a presentation
    in a separate outlining tool such as Outline View in Word.

&lt;h4&gt;13. Resolving Beamer Error Messages&lt;/h4&gt;
&lt;b&gt;Problem:&lt;/b&gt;
Beamer error messages can be particularly mysterious.
What are common error messages?
What strategies speed up diagnosis and resolution of error messages?

&lt;br /&gt;&lt;br /&gt;
&lt;b&gt;Solution:&lt;/b&gt;&lt;br /&gt;
Common errors include:
&lt;ul&gt;
&lt;li&gt;Forgetting to include the end environment. e.g., &lt;code&gt;\end{block}&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Problems with braces &lt;code&gt;}&lt;/code&gt;: e.g., forgetting to include a brace; typing the wrong character, such as a parenthesis; problems with nested braces, etc.
&lt;li&gt;Forgetting to add at least one &lt;code&gt;\item&lt;/code&gt; in an &lt;code&gt;itemize&lt;/code&gt; environment&lt;/li&gt;
&lt;li&gt;Forgetting to add a title to a block environment&lt;/li&gt;
&lt;li&gt;Typographical mistakes in common command names (e.g., &lt;code&gt;ietm&lt;/code&gt; or &lt;code&gt;iteM&lt;/code&gt;
    instead of &lt;code&gt;item&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Putting &lt;code&gt;begin&lt;/code&gt; where &lt;code&gt;end&lt;/code&gt; should be placed and vice versa.
&lt;li&gt;Forgetting to escape (i.e., &quot;\&quot;) special characters such as the ampersand, dollar sign, and percentage sign
    particularly when pasting text from another source&lt;/li&gt;
&lt;/ul&gt;

General strategies for debugging:
&lt;ul&gt;
&lt;li&gt;In some instances, the error message will indicate the text that is related
 to the error.&lt;/li&gt;
&lt;li&gt;The LaTeX compiling information often indicates the number of the slide at which
    an error occurred. e.g., you will see [1][2][3]...&lt;/li&gt;
&lt;li&gt;In other situations progressively move the &lt;code&gt;\end{document}&lt;/code&gt; command around the document.
    The document will only compile up to that point.
    This should isolate the slide where the error is occurring.&lt;/li&gt;
&lt;li&gt;Frequently compile, especially when first learning, to minimise the possible
    error locations.&lt;/li&gt;
&lt;li&gt;Once the probable frame has been identified, look for common errors in the frame
    as mentioned above.&lt;/li&gt;
&lt;li&gt;Use an editor that flags common errors such as non-matching environments
    or mistyped command names&lt;/li&gt;
&lt;/ul&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/693486981465900570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/693486981465900570'/><link rel='alternate' type='text/html' href='http://jeromyanglim.blogspot.com/2010/08/getting-started-with-beamer-tips-and.html' title='Getting Started with Beamer: Tips and Tricks for LaTeX Presentations'/><author><name>jeromyanglim</name><uri>http://www.blogger.com/profile/12949204812496382042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-8909074830238091680.post-4623431473467531666</id><published>2010-08-25T21:18:00.001+10:00</published><updated>2010-11-01T21:33:27.690+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Beamer"/><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX"/><category scheme="http://www.blogger.com/atom/ns#" term="presentations"/><title type='text'>Simple Beamer Template for Getting Started and Reducing Typing</title><content type='html'>For those who don&#39;t already know, Beamer is a useful package in LaTeX
 for preparing slide presentations.
I have a Beamer template of preamble and slide templates.
I found having a template was useful:
(a) when first learning Beamer commands, and
(b) in order to save typing.
Thus, this post shares and explains the template in case it was of interest to others.
It includes both my standard preamble and templates for individual slides.
It is designed so that it is easy to compile both a presentation and
    a 2 x 2 handout.

&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;
&lt;h3&gt;Overview of Using the Code&lt;/h3&gt;
At the risk of stating the obvious,
 I use the template as follows.
&lt;ol&gt;
&lt;li&gt;When beginning a new presentation three text files are created (substituting the word &quot;content&quot; for the name of the talk):
 (a) handout_content.tex, (b) presentation_content.tex; (c) content.tex.
&lt;ul&gt;
&lt;li&gt;presentation_content.tex contains just the two lines as shown under (1) below.&lt;/li&gt;
&lt;li&gt;handout_content.tex contains just the two lines as shown under (2) below.&lt;/li&gt;
&lt;li&gt;content.tex contains the preamble as shown under (3) below.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;The slide templates under (4) are copied and pasted into content.tex
 as needed to prepare the presentation.&lt;/li&gt;
&lt;li&gt;presentation_content.tex is compiled while preparing the talk.
    handout_content.tex is compiled only once the presentation is finalised.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;The Beamer Template Code&lt;/h3&gt;
&lt;pre style=&quot;font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%&quot;&gt;&lt;code&gt;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1. Presentation header file (in separate file)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[t]{beamer}
\input{texfile} % replace texfile with main content file name

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 2. Handout header file (in separate file)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[handout, t]{beamer}
\input{texfile} % replace texfile with main content file name




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 3. Main content preamble and opening slides
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\mode&amp;lt;beamer&amp;gt;{
\usetheme{Frankfurt}
\setbeamertemplate{navigation symbols}{}
}
\mode&amp;lt;handout&amp;gt;{
\usepackage{pgfpages}
\pgfpagesuselayout{4 on 1}[a4paper, border shrink=10mm, landscape]
\usetheme{default}
}

\title{}
\subtitle{}
\author{}
\institute{}
\date{}

\begin{document}
\mode*
\begin{frame}
\titlepage
\end{frame}

\begin{frame}
\frametitle{Outline}
\tableofcontents
\end{frame}


\end{document}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 4. Templates for individual slide types
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Slide at the beginning of a section
\begin{frame}{Outline}
\tableofcontents[currentsection]
\end{frame}


% Simple slide
\begin{frame}{}
\begin{itemize}
\item
\end{itemize}
\end{frame}


% Slide with a block
\begin{frame}{}
\begin{block}{}
\begin{itemize}
\item
\end{itemize}
\end{block}
\end{frame}


% Slide with example (different colour to Block)
\begin{frame}{}
\begin{example}
\begin{itemize}
\item
\end{itemize}
\end{example}
\end{frame}


% Slide with two columns
% (0.5 can be adjusted but should generally sum to 1.0)
\begin{frame}{}
\begin{columns}
\begin{column}{0.5\textwidth}
\end{column}
\begin{column}{0.5\textwidth}
\end{column}
\end{columns}
\end{frame}


% Verbatim
\begin{frame}[fragile]{}
\begin{verbatim}
% code
\end{verbatim}
\end{frame}

% slide with title and figure
\begin{frame}{}
\begin{center}
\includegraphics[width=11cm]{files/figure}
%\caption
\end{center}
\end{frame}


% Full screen image
\mode&amp;lt;all&amp;gt;
{\usebackgroundtemplate{\includegraphics[width=\paperwidth]
{files/figure}} %replace files/figure with file path and name
\begin{frame}[plain]
\end{frame}}
\mode&amp;lt;all&amp;gt;{\usebackgroundtemplate{}}
\mode*


% Basic centred table with alternating colour rows
% \usepackage{xcolor}
% \documentclass[xcolor=pdftex,dvipsnames, table]{beamer}
% adapted from http://www.tug.org/TUGboat/Articles/tb26-1/mertz.pdf
\begin{frame}{}
\begin{center}
\rowcolors{1}{\RoyalBlue!20}{\RoyalBlue!5}
\begin{tabular}{lll}\hline
A &amp;amp; B &amp;amp; C \\
\end{tabular}
\end{center}
\end{frame}


% Frame with incrementally displayed dot points with an alert
\begin{frame}{}
\begin{itemize}[&amp;lt;+-&amp;#124; alert@+&amp;gt;]
\item
\end{itemize}
\end{frame}
&lt;/code&gt;&lt;/pre&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/4623431473467531666'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/4623431473467531666'/><link rel='alternate' type='text/html' href='http://jeromyanglim.blogspot.com/2010/08/simple-beamer-template-for-getting.html' title='Simple Beamer Template for Getting Started and Reducing Typing'/><author><name>jeromyanglim</name><uri>http://www.blogger.com/profile/12949204812496382042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-8909074830238091680.post-8688047297406538612</id><published>2010-04-21T23:06:00.000+10:00</published><updated>2010-04-21T23:06:45.354+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX"/><category scheme="http://www.blogger.com/atom/ns#" term="WinEdt"/><title type='text'>WinEdt 6.0 for LaTeX: Features, Configuration, and Resources</title><content type='html'>This post discusses my experience with WinEdt 6.0 as a text editor
 for writing documents in LaTeX.
In this post I outline:
(a) Why I have chosen to use WinEdt;
(b) The role of WinEdt in my workflow;
(c) Various customisations of WinEdt which I have found useful;
(d) links to additional resources for getting the most out of WinEdt.

&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;


&lt;h3&gt;Overview&lt;/h3&gt;
I&#39;ve recently been examining a number of text editors for writing LaTeX documents
 in a Windows Environment.
These include TeXnicCenter (v1.0), Texlipse for Eclipse, and Notepad++.
I read a discussion on Stack Overflow discussing
 &lt;a href =&quot;http://stackoverflow.com/questions/270121/best-latex-editor-for-windows&quot;&gt;
    the Best LaTeX editor for Windows&lt;/a&gt;.
Each editor that I tried had good features.
Each was free.
However, as I tried to get the configuration I wanted,
 I frequently felt that I was having to implement a lot of custom configurations.
Also, while these programs had many great features, 
    there were always features missing.
I did not feel that I would be truly comfortable working with these editors
 for extended periods of time on complex documents.

&lt;br /&gt;&lt;br /&gt;
As a side point, Emacs/Xemacs and Vi/vim are also meant to be very good
 for editing LaTeX documents.
I think the text editing shortcut keys in these programs are superior to
 those on Windows.
In particular, I would like to never have to let my fingers leave the home keys
 in order to edit text.
I can also see the benefit of having a single text editor that you use for
 all programming, emailing, and document creation tasks.
It&#39;s also great to have an open source text editor supported by
 a huge community of technical users.
However, the shortcut keys used in these programs are completely different 
 to those used in other Windows programs.
When working with both Windows programs and editors like Emacs,
 there is a negative transfer which disrupts automaticity.
Thus, until I&#39;m willing to adopt Linux, 
 I&#39;m not inclined to learn these editors.

&lt;br /&gt;&lt;br /&gt;
In particular I wanted usability.
I wanted to be able to navigate my document comfortably.
I wanted the display to reinforce the document structure.
I wanted the program to support my workflow organising my task related comments.
I wanted to be able to easily compile and 
 debug my LaTeX source in a comfortable way.
I wanted intelligent defaults with the option to 
 customise if a default annoyed me.
I wanted the program to have thought about usability issues
 that I hadn&#39;t thought about.


&lt;br /&gt;&lt;br /&gt;
I&#39;m currently using WinEdt 6.0.
It looks like it will be the editor for me.
It has been designed with someone like me in the mind:
A researcher who wants to write technical documents.
It&#39;s not free, but it&#39;s not expensive.






&lt;h3&gt;Features that I like&lt;/h3&gt;
In particular there were several Features in WinEdt that I liked at first glance:

&lt;ul&gt;
  &lt;li&gt;Tree View can be customised&lt;/li&gt;
  &lt;li&gt;Automatically display your current location in TOC&lt;/li&gt;
  &lt;li&gt;Colour coding that aids usability&lt;/li&gt;
  &lt;li&gt;Intelligent defaults&lt;/li&gt;
  &lt;li&gt;Options to customise almost anything&lt;/li&gt;
  &lt;li&gt;Easy configuration interface with MikTeX&lt;/li&gt;
  &lt;li&gt;One click build process for LaTeX documents&lt;/li&gt;
  &lt;li&gt;Intuitive default shortcut keys and intuitive alt menu letters&lt;/li&gt;
  &lt;li&gt;Ctrl+Up and Ctrl+Down navigates between paragraphs.&lt;/li&gt;
&lt;/ul&gt;

The remainder of this post discusses: configuration, features, and set up ideas.


&lt;h3&gt;Configuration&lt;/h3&gt;
The following sets out a few alterations to the default WinEdt 6.0 configuration
 that I have found useful.

&lt;h4&gt;Configuring Inverse Search with Yap&lt;/h4&gt;
WinEdt includes
&lt;a href =&quot; http://www.winedt.com/tex.html&quot;&gt;
        documentation&lt;/a&gt;
on how to configure Inverse search in Yap.


&lt;h4&gt;Configuring with JabRef&lt;/h4&gt;
In JabRef, I changed the following:

&lt;br /&gt;Preferences - External Programs - WinEdt: 
    I had to change the default file location.
&lt;br /&gt;Once this was set, Ctrl+L sends 
 the selected citation to WinEdt and returns focus to WinEdt.


&lt;h4&gt;Changing Settings&lt;/h4&gt;
The method of changing settings in WinEdt 6.0 differs from most Windows programs.
The configuration is based on a large number of *.ini files.
Ini files are arranged categorically.
&lt;br /&gt;To make changes:
&lt;br /&gt;(1) edit the ini file,
&lt;br /&gt;(2) save the ini file, and
&lt;br /&gt;(3) then click the &quot;load current script&quot; button.

&lt;br /&gt;&lt;br /&gt;
The options are reasonably self-documenting.
In particular:
&lt;br /&gt;0 = No or Off or False
&lt;br /&gt;1 = Yes or On or True

&lt;br /&gt;&lt;br /&gt;
You can backup and restore your settings. 
This is particularly useful if you corrupt your ini files.



&lt;h4&gt;Spelling&lt;/h4&gt;
I needed to customise Australian spelling.
This meant enabling a number of dictionaries (e.g., &quot;colour&quot;, &quot;ise&quot;, &quot;yse&quot;, 
 &quot;centre&quot;) and disabling the corresponding American spellings.



&lt;h4&gt;Dual Monitor Issues&lt;/h4&gt;
Some dialog boxes default to the top-left of the primary monitor
 (e.g., Forward Search, spelling).
I have a dual monitor setup where the main monitor I work on 
 is the secondary monitor.
My Start Menu is displayed vertically from top-left to 
 bottom-left of my primary monitor.
When several dialog boxes display, they are obscured by the Start Menu.
I still have not resolved this issue for several dialog boxes.
However, for some dialog boxes, settings like the following work:

&lt;pre&gt;
Incremental Search:
LOCKED_POSITION=0
&lt;/pre&gt;


&lt;h4&gt;Word Wrapping&lt;/h4&gt;
Word wrapping is an important topic.
It&#39;s also a matter of personal preference.
WinEdt provides many options for word wrapping.
Wrapping can be turned off and on each document by clicking on the status bar.
I&#39;m still thinking about the best configuration for this.

&lt;br /&gt;&lt;br /&gt;
A freedom of writing in HTML and LaTeX is that you can 
 arrange you have greater freedom in how text
 is arranged on the page.
The following command does a reasonable job of creating new lines at the 
 end of each sentence.
Find: &quot;[.] &quot;
Replace: &quot;.&amp;lt;&quot;
Regular Expressions enabled



&lt;h4&gt;Disable Sound Effects&lt;/h4&gt;
I work in an office. 
Thus, dings and dongs are unwanted.

&lt;pre&gt;
Sound Effects:
DISABLE_SOUND_EFFECTS=1
&lt;/pre&gt;



&lt;h4&gt;Auto Saving&lt;/h4&gt;
My main aim was to customise the setting to ensure frequent auto-saving 
 (e.g., at least every 5 minutes).

I like my backup files in a separate folder as opposed 
 to cluttering the primary folder.
&lt;br /&gt;&lt;br /&gt;
backup.ini
&lt;code&gt;BACKUP_FILENAME=&quot;c:\temp\%n%t.bak&quot;&lt;/code&gt;

&lt;br /&gt;&lt;br /&gt;
AutoSave.ini
&lt;code&gt;AUTO_SAVE_FILENAME=&quot;c:\temp\%n%t.sav&quot;&lt;/code&gt;



&lt;h4&gt;Error Processing in LaTeX&lt;/h4&gt;
When in draft stages of preparing large document, 
 I find warnings related to &quot;overfull and underfull boxes&quot; to be distracting. 
Thus, I disabled their bookmarked Inclusion in the Error log. 
They are still shown in the log, 
 but clicking &quot;Next&quot; or &quot;Previous&quot; does not go to them.

&lt;pre&gt;
TYPE=&quot;Type II:  ?...&amp;lt;From&amp;gt;--&amp;lt;To&amp;gt;&quot;
  WARNING=0
  ENABLED=0
  FILTER=&quot;TeX&quot;
    TRIGGER=&quot;Overfull \&quot;
    TRIGGER=&quot;Underfull \&quot;
&lt;/pre&gt;


&lt;h4&gt;Fonts and such&lt;/h4&gt;
I modified the display of HTML (Font Schemes - Fonts.ini).
I prefer a fixed-width font for writing HTML, such as &quot;Courier New&quot;.
I also modified the TAB_LENGTH to 4 instead of 8.

&lt;pre&gt;
FONT_SCHEME=&quot;HTML Documents&quot;
  MODE=&quot;HTML|HHC;XWE&quot;
  USE_IN_DIALOGS=1 // Use in Spelling or Complete Dialogs...
  FONT_NAME=&quot;Courier New&quot;
  FONT_SIZE=10
  FONT_BOLD=0
  FONT_ITALIC=0
  FONT_CHARSET=1
  EXTRA_LINE_SPACING=1
  EXTRA_CHAR_SPACING=0
  TAB_LENGTH=4
  TAB_OPT_LEADING=0
  TAB_OPT_NON_LEADING=0
  FREE_CARET=0
&lt;/pre&gt;


&lt;h4&gt; Display&lt;/h4&gt;
As far as I can tell, 
 all the standard toolbar buttons are available through menus.
And the combination of the Alt Key 
 and appropriate keyboard accelerators is quicker than using the mouse.
Thus, I right clicked around the toolbars to hide toolbars. 
This has the benefit of creating additional space to view text.



&lt;h3&gt;Getting Things Done&lt;/h3&gt;
&lt;h4&gt;Getting a sense of Context&lt;/h4&gt;
&lt;b&gt;The importance of context&lt;/b&gt;
When working with large documents it is important to have a sense of context.
I want to know where I am in the hierarchical structure of a document.
In projects with multiple files, I want to know which file I am in.

&lt;br /&gt;&lt;br /&gt;
The following two commands are great for providing context:
&lt;br /&gt;Project - Auto-Select TOC Branch
&lt;br /&gt;Project - Auto-Select Tree Files



&lt;h4&gt;Navigation within Document&lt;/h4&gt;
&lt;h5&gt;Basic Cursor Movement&lt;/h5&gt;
&lt;b&gt;Between Paragraphs&lt;/b&gt;
&lt;br /&gt;Ctrl+Up and Ctrl+Down: Move cursor between paragraphs (a nice feature for a coding editor).

&lt;h5&gt;Standard Windows Editing Keys&lt;/h5&gt;
Most standard text editing keys work like you would expect,
 if you have grown up in a Windows world.
e.g., 
Ctrl+Delete; Ctrl+Backspace; PageUp; PageDown;
Ctrl+Left; Ctrl+Right


&lt;h5&gt;Tree View&lt;/h5&gt;
Tree View provides: Files, TOC, Bibliography, and Labels
The mouse can be used to select objects
 (note my frustration at the absence of keyboard navigation).
There&#39;s also a slight problem with keeping the tree current 
 (particularly the TOC).
It can be manually refreshed by:
&lt;br /&gt;(a) clicking the &quot;Build Tree&quot; button; or
&lt;br /&gt;(b) opening the main file of the project,
    which in a single file project should already be opened,
    and selecting Project - Set Main File (Alt, p, e)



&lt;h4&gt;Navigating Between Files&lt;/h4&gt;
&lt;h5&gt;Open File&lt;/h5&gt;
Ctrl+O Brings Up an Open File Box.
It tends to be in the folder of the main project file.
The file name of the tex file can then be entered.

&lt;h5&gt;Next and Previous Window&lt;/h5&gt;
Ctrl+Comma and Ctrl+Shift+Comma move to the next or previous open document 
 based on the order of the tabs (tab-order).
This is in contrast to MDI-order which is based 
 on the order that the windows have bene last accessed.
When opening a document, 
 the new tab is added after the tab for the current open document.
Tabs can be rearranged using drag and drop.
By opening a set of documents for a project in a particular order 
 (e.g., main, preamble, chapter1, chapter2, chapter3, etc.) 
 the tab-order shortcut keys can be used to navigate through the files 
 that make up the sections of your document.
The tree view also provides a tool to open and close all files in a project 
 or at a given heading level.


&lt;h5&gt;Open Input and include documents&lt;/h5&gt;
Double click on an &lt;code&gt;input&lt;/code&gt; or &lt;code&gt;include&lt;/code&gt; command to go to
 the file referenced by the command.
Double clicking hyperlinks in HTML files open the link in the default web browser.


&lt;h5&gt;Global Mark and Global Return&lt;/h5&gt;
Ctrl+F10 sets a mark in an open document.
Ctrl+Shift+F10 returns the cursor to this mark.
This works even if you are working in a document other than the marked document.
Thus, it is useful when editing multiple documents.


&lt;h5&gt;Bookmarks&lt;/h5&gt;
The &quot;Search - Bookmarks&quot; sub-menu lists a number of 
 options for working with bookmarks.
They appear to be only effective within a file.
If you want to use bookmarks to navigate between files, you need to
 use the Global Mark option.
Up to 9 separate bookmarks can be set using 
    Ctrl+Shift+1, Ctrl+Shift+2, etc to set the bookmark,
    and Ctrl+1, Ctrl+2, etc to go to the bookmark.

&lt;br /&gt;&lt;br /&gt;
When should you use bookmarks?
If you are writing at line X, but need to check something in line Y:
&lt;br /&gt;(1) bookmark line X, Ctrl+Shift+1
&lt;br /&gt;(2) go to line Y,
&lt;br /&gt;(3) bookmark line Y Ctrl+Shift+2
&lt;br /&gt;(4) check whatever you wanted to check in line Y
&lt;br /&gt;(5) return to line X, Ctrl+1
&lt;br /&gt;If you then need to check line Y again, Ctrl+2


&lt;b&gt;Macros for navigation&lt;/b&gt;
I would like to be able to navigate the outline in the Tree View 
 using keyboard short cuts.
It seems that the macro language might be the best course of action.
Tree and Gather Macro Interfaces are provided.

&lt;b&gt;Scroll Lock Navigation&lt;/b&gt;
In &quot;editor.ini&quot;, the following setting turns the cursor keys into a 
 tool to navigate when Scroll Lock is activated.
&lt;code&gt;ENABLE_SCROLL_LOCK_KEY=1&lt;/code&gt;



&lt;h4&gt;Customised Tree View&lt;/h4&gt;
&lt;h5&gt;Paragraph descriptions in Outline&lt;/h5&gt;
When I write LaTeX documents, I often write what I call paragraph descriptions
 above each paragraph.
Paragraph descriptions are typically less than the length of a line and
 state summarise the contents of the paragraph.
They are useful for highlighting and checking the structural flow of a document.
I incorporate them in latex using a custom command that does not print in the PDF.
The syntax that I use for the command is &lt;code&gt;\pd{Text describing title}&lt;/code&gt;
A particular appealing feature of WinEdt is that these paragraph descriptions
 can be added to the Table of Contents Outline.
To enable this I Added the following option. 
It is a copy of the &quot;\paragraph&quot; item with a couple of changes 
 (e.g., level is deeper)

&lt;pre&gt;
  ITEM=&quot;\pd{?}&quot;
    MODE=&quot;TeX&quot;
    CASE_SENSITIVE=1
    BEGINNING_OF_LINE_ONLY=1
    CURRENT_DOCUMENT_ONLY=1
    ALL_OPENED_DOCUMENTS=0
    COMPLETE_PROJECT_TREE=1
    ICON=&quot;Paragraph&quot;
    LEVEL=26
    CAPTION=&quot;%?&quot;
    BALANCED=&quot;{}\&quot;
    MAX_LINE_SPAN=3
    ON_CTRL_CLICK=&quot;GlobalMark;TreeTrack(2);&quot;
    ON_CTRL_DBL_CLICK=&quot;Relax;&quot;
    ON_CLICK=&quot;TreeTrack(2,1);&quot;
    ON_DBL_CLICK=&quot;TreeTrack(2,2);&quot;
    ACTION=&quot;Find&quot;
      IMAGE=&quot;Find&quot;
      MACRO=&quot;TreeTrack(2);&quot;
    SUBSTITUTION=&quot;\label{*}&quot;
      SUB_FIND=&quot;\\label\{*\}&quot;
      SUB_REPLACE=&quot;&quot;
      SUB_REG_EX=1
      SUB_CASE_SENSITIVE=1
    SUBSTITUTION=&quot;  &quot;
      SUB_FIND=&quot; +{ }&quot;
      SUB_REPLACE=&quot; &quot;
      SUB_REG_EX=1
      SUB_CASE_SENSITIVE=1
    SUBSTITUTION=&quot;\ldots&quot;
      SUB_FIND=&quot;\ldots&quot;
      SUB_REPLACE=&quot;...&quot;
      SUB_REG_EX=0
      SUB_CASE_SENSITIVE=1
&lt;/pre&gt;


There are many further possibilities for customisation.
&lt;b&gt;includegraphics:&lt;/b&gt; I also added a level value to the
 &lt;code&gt;\includegraphics&lt;/code&gt; command in the tree.




&lt;h4&gt;Spelling&lt;/h4&gt;
I disabled:
&lt;br/&gt;Confirm Deletion
&lt;br/&gt;Confirm Addition
&lt;br/&gt;Confirm Capital Addition

&lt;br/&gt;&lt;br/&gt;
When first starting with a new text editor, 
 there are lots of words that I use that are not spelling mistakes.
Thus, the following steps can be applied to a word incorrectly classified as a spelling error:
&lt;br/&gt;Ctrl+Enter, Alt+A, or
&lt;br/&gt;Right Mouse Click, Alt+A



&lt;h4&gt;Customising Gather&lt;/h4&gt;
In my workflow, I have a number of custom commands where
 it would be useful if these could be incorporated into the gather functionality.


&lt;!--Rethinking the workflow based on the Gather View.
Gather View could be used to guide workflow.
Gather View provides a list of things that need to be done.
Thus, the key to an effective Gather View is display, filtering, and sorting.
--&gt;

&lt;!--\cite
This needs to be customised in order to include APA&#39;s citeA command. Or I could stop using this command.--&gt;


&lt;b&gt;\todo{...}&lt;/b&gt;
I use the todo command from the todo package to list 
 tasks that in the document.
Navigating this list is useful way of working through a todo list.
&lt;pre&gt;
PAGE=&quot;todo&quot;
  // Change Mode from TeX to ? to disable this item
  PAGE_MODE=&quot;TeX|DTX;INS;STY&quot;
  PAGE_SORTED=0
  PAGE_CASE_SENSITIVE=1
  PAGE_IGNORE_COMMENTS=1
  PAGE_BEFORE_BUILD=&quot;Relax;&quot;
  PAGE_AFTER_BUILD=&quot;Relax;&quot;
  PAGE_ON_ACTIVATE=&quot;GlobalMark;&quot;
  PAGE_ON_SHOW=&quot;GlobalMark;&quot;
  PAGE_ON_ENTER=&quot;GDIKillFocus;&quot;
  PAGE_ON_CANCEL=&quot;GlobalReturn;GDIKillFocus;&quot;

  ITEM=&quot;\todo{?}&quot;
    MODE=&quot;TeX&quot;
    CASE_SENSITIVE=1
    BEGINNING_OF_LINE_ONLY=0
    CURRENT_DOCUMENT_ONLY=1
    ALL_OPENED_DOCUMENTS=0
    COMPLETE_PROJECT_TREE=1
    RETURN_AT_EOF=0
    ICON=&quot;ArrowOrange&quot;
    LEVEL=0
    CAPTION=&quot;%!?&quot;
    MAX_LINE_SPAN=2
    ON_CLICK=&quot;GDITrack;&quot;
    ON_DBL_CLICK=&quot;GDIKillFocus;&quot;
    ACTION=&quot;Find&quot;
      IMAGE=&quot;Find&quot;
      MACRO=&quot;GDITrack;&quot;
&lt;/pre&gt;




&lt;h4&gt;Word Counts&lt;/h4&gt;
Document - Word Count (Alt, D, W) can be used to estimate the number of words
 in a *.tex file.
If you select text

&lt;br /&gt;&lt;br /&gt;
&lt;b&gt;Excluding text from word count&lt;/b&gt;
If you have custom commands that you use often 
 that do not print text, you may wish to
 exclude them from word counts.
For example, I use the &lt;code&gt;\todo&lt;/code&gt; command to
 store tasks that need to be done.
I use my own &lt;code&gt;\pd&lt;/code&gt; command to store a non-printing paragraph descriptions.
I use my own &lt;code&gt;\OUTPUT&lt;/code&gt; command to indicate where
 I need to insert a specific table, figure, or results text.
These commands and their contents can be excluded from word counts by
 editing the WordCount.ini file (Options - Options - Formatting - Word Count).
The built-in examples make it pretty clear 
 what needs to be done to add additional tags.

&lt;pre&gt;
WORD_COUNT_SET=&quot;TeX&quot;
   ...
  SKIP=&quot;\pd{?}&quot;
  SKIP=&quot;\todo{?}&quot;
  SKIP=&quot;\OUTPUT{?}&quot;
&lt;/pre&gt;

&lt;br /&gt;&lt;br /&gt;
&lt;b&gt;Other word count options&lt;/b&gt;
Note that the word count option does not work for multi-file projects.
Other options exist for word count calculation:
&lt;ul&gt;
    &lt;li&gt;&lt;a href=&quot;http://folk.uio.no/einarro/Comp/texwordcount.html&quot;&gt;
        TeXcount&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://www.tex.ac.uk/cgi-bin/texfaq2html?label=wordcount&quot;&gt;
        Discussion of UK TeX FAQ&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://www.proz.com/forum/translator_resources/44923-how_can_i_count_words_in_pdf_files.html&quot;&gt;
        Discussion of creating a PDF and calculating word count&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
    
The main challenge with word counts in both MS Word, in LaTeX, and in PDFs is that
 many word count limits imposed in academic writing exclude various forms of content.
For example, the word count for a thesis might exclude:
 references,  tables, figures, appendices, headers, footers.



&lt;h4&gt;LaTeX Build Profiles&lt;/h4&gt;
Configuring various LaTeX build options is really easy with WinEdt.
Under Options - Execution Modes, I have the following options selected:
&lt;br /&gt;Process Flow: Wait for execution to finish; Start Viewer; Forward search; No interaction [Apply to All]
&lt;br /&gt;I generally use TeXify to automatically determine how many times the document needs to be built.



&lt;h4&gt;Using Template Text&lt;/h4&gt;
WinEdt can facilitate the insertion of template text.
For example, there is a template for inserting a figure.
The template use a character that looks like &quot;*&quot; for information
 that needs to be replaced by the user.
Next Bullet (Ctrl+Space) and Previous Bullet (Ctrl+Shift+Space)
 can be used to navigate between bullets.

&lt;br /&gt;&lt;br /&gt;
You can even create your own templates using Ctrl+Alt+Space
 and whatever surrounding template text is required.
You may want to create a set of common templates and store it in a separate file.
&lt;!--
comment about configuring and adding templates within the WinEdt interface
--&gt;






&lt;h3&gt;Problems with WinEdt 6.0&lt;/h3&gt;
The following represents frustrations that I have experienced
 with WinEdt 6.0.
WinEdt has many customisation options.
Thus, in some cases, perceived problems may represent my lack of knowledge
 about how to configure WinEdt to operate in the way that I wish.



&lt;h4&gt;No keyboard access to certain features&lt;/h4&gt;
There are some commands which do not appear to be accessible to the keyboard, including:
 TOC View, File View, Gather View, 
 Toolbar Buttons, Find in Files, LaTeX Error View.

I find this very frustrating.
These are fundamental navigational tools that are frequently used.
They should not require the mouse.
There may be workarounds using macros.


&lt;h4&gt;The placement of some dialog boxes&lt;/h4&gt;
Some dialog boxes are not well-placed if you use a dual monitor configuration
 and work principally on your second monitor.
Hopefully this will be corrected in future versions.




&lt;h3&gt;Resources&lt;/h3&gt;
&lt;h4&gt;Using Macros&lt;/h4&gt;
WinEdt provides good support for macros.
Here is an
&lt;a href=&quot;http://www.winedt.org/Macros/install.php&quot;&gt;
    Introductory guide to marcos&lt;/a&gt;


&lt;b&gt;Programs that interest me:&lt;/b&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href =&quot;http://www.winedt.org/Config/Tree/Todo.php&quot;&gt;Todo Tree Interface&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href =&quot;http://cran.r-project.org/web/packages/RWinEdt/index.html&quot;&gt;RWinEdt&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href =&quot;http://www.winedt.org/Config/modes/R-Sweave.php&quot;&gt;R-Sweave&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;h4&gt;www.winedt.org&lt;/h4&gt;
There are a great set of resources on 
 &lt;a href=&quot;http://www.winedt.org/&quot;&gt;http://www.winedt.org/&lt;/a&gt;.
These are a few things that have interested me that I haven&#39;t yet tried.



&lt;h5&gt;Macros&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.winedt.org/Macros/LaTeX/uncommand.php&quot;&gt;uncommand: &lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.winedt.org/Macros/LaTeX/eps2pdf.php&quot;&gt;eps2pdf: &lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.winedt.org/Macros/LaTeX/Choice.php&quot;&gt;Choice: &lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.winedt.org/Macros/recentDirectories.php&quot;&gt;Recent Directories&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h5&gt;Plug-ins&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.winedt.org/Plugins/TeXtab.php&quot;&gt;
    TeXtab&lt;/a&gt;&lt;/li&gt;
&lt;/uL&gt;

&lt;b&gt;Add-ons&lt;/b&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.winedt.org/Config/menus/RCS.php&quot;&gt;
    RSC Version Control: &lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.dessci.com/en/products/MathType/&quot;&gt;
    MathType: &lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.winedt.org/Plugins/&quot;&gt;
    Various Add-ons for creating graphics files: &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h4&gt;Additional Resources&lt;/h4&gt;
&lt;a href = &quot;http://ysumathstat.org/faculty/wakefield/Week%207/Week_7_LatexInstall_F09.pdf&quot;&gt;
        Additional Configuration ideas for LaTeX and WinEdt&lt;/a&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/8688047297406538612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/8688047297406538612'/><link rel='alternate' type='text/html' href='http://jeromyanglim.blogspot.com/2010/04/winedt-60-for-latex-features.html' title='WinEdt 6.0 for LaTeX: Features, Configuration, and Resources'/><author><name>jeromyanglim</name><uri>http://www.blogger.com/profile/12949204812496382042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-8909074830238091680.post-5155858819053838315</id><published>2010-04-12T17:33:00.001+10:00</published><updated>2010-04-12T17:42:02.402+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Excel"/><category scheme="http://www.blogger.com/atom/ns#" term="JabRef"/><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX"/><category scheme="http://www.blogger.com/atom/ns#" term="references"/><title type='text'>Exporting PDFs from JabRef using a Batch File</title><content type='html'>If you do research,
 &lt;a href=&quot;http://jabref.sourceforge.net/&quot;&gt;
 JabRef&lt;/a&gt;
  is a great tool for managing a personal repository of PDFs.
JabRef allows you to link your citations with full text PDFs.
This post discusses one way of exporting a subset of your PDF repository using
 JabRef, Excel, and a Windows Batch file.
This is useful (copyright permitting) in many situations. 
&lt;br /&gt;For example: 
&lt;br /&gt;(a) You need to extract a subset of references for a subject you are teaching.
&lt;br /&gt;(b) You need to give a colleague or research student a subset of your references.
&lt;br /&gt;(c) You want to transfer a subset of your references to another device or computer.

&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;

&lt;h3&gt;Option 1: Open and Save As&lt;/h3&gt;
When there are fewer than five PDFs, it is quicker just to open the PDFs individually 
 and save them in the desired location.

&lt;h3&gt;Option 2: Batch File Export&lt;/h3&gt;
When there are more than five PDFs, it may be quicker to adopt a procedure like the following.
The procedure involves creating a batch file to copy specified PDFs to a designated export folder.
&lt;br /&gt;The procedure is as follows:

&lt;br/&gt;&lt;br/&gt;1. In JabRef, Select PDFs of References that you want to export (see Figure 1).

&lt;br/&gt;&lt;br/&gt;2. In JabRef, Copy Selection (Edit - Copy)

&lt;br/&gt;&lt;br/&gt;3. In Excel, Paste into first column.
Note: You could use a different Spreadsheet application, such as Open Office Calc.

&lt;br/&gt;&lt;br/&gt;4. In Excel, Sort the column alphabetically

&lt;br/&gt;&lt;br/&gt;5. In Excel, Highlight cells beginning with the word &quot;file&quot;.
Note: the &quot;file&quot; field is where JabRef stores the relative path for the PDF.

&lt;br/&gt;&lt;br/&gt;6. In Excel, Text to columns delimited by &quot;:&quot;
Note: JabRef separates the data into file name, path name, and file type
 separated by colons. This step extracts the path name into it&#39;s own cell.
If your repository does not include subfolders, file name will be equivalent to path name.

&lt;br/&gt;&lt;br/&gt;7. In Excel, Create the string to copy the batch file (see Figure 2).
&lt;br/&gt;7.a create the string &quot;copy filePath destinationFolder&quot;
e.g., =&quot;copy &quot;&amp;B24&amp;&quot; c:\temp&quot;, where B24 is the cell with the path name
&lt;br/&gt;7.b copy and paste this formula for the remainder of the cells.

&lt;br/&gt;&lt;br/&gt;8. In text editor, Create the batch file (see Figure 3).
&lt;br/&gt;8.a Open Notepad or another text editor
&lt;br/&gt;8.b the first line changes the directory to the root folder of your PDF repository.
e.g., &lt;code&gt;cd /d D:\My Documents\2Repository\filed&lt;/code&gt;
&lt;br/&gt;8.c Copy and paste the copy commands from Step 7 below this line.
&lt;br/&gt;8.d Save as a .bat file (e.g., copyPDFs.bat)

&lt;br/&gt;&lt;br/&gt;9. In Windows Explorer, Run the batch file.
i.e., just double click the batch file.


&lt;br/&gt;&lt;br/&gt;
&lt;b&gt;Figure 1. Screen Shot of JabRef showing references with connected PDFs&lt;/b&gt;
&lt;br/&gt;&lt;img src=&quot;http://web.psych.unimelb.edu.au/jkanglim/images/Using_PDFs_with_JabRef3.jpg&quot; /&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;b&gt;Figure 2. Screen Shot of Excel showing Formula for creating copy command&lt;/b&gt;
&lt;br/&gt;&lt;img src=&quot;http://web.psych.unimelb.edu.au/jkanglim/images/Using_PDFs_with_JabRef1.jpg&quot; /&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;b&gt;Figure 3. Screen Shot of Notepad showing example of complete batch file&lt;/b&gt;
&lt;br/&gt;&lt;img src=&quot;http://web.psych.unimelb.edu.au/jkanglim/images/Using_PDFs_with_JabRef2.jpg&quot; /&gt;


&lt;!-- 
see Also:
Linking_Existing_Article_PDFs_with_JabRef.html
Add BibTeX Reference after Finding PDF.html
File_System_For_Journal_Articles.html
--&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/5155858819053838315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/5155858819053838315'/><link rel='alternate' type='text/html' href='http://jeromyanglim.blogspot.com/2010/04/exporting-pdfs-from-jabref-using-batch.html' title='Exporting PDFs from JabRef using a Batch File'/><author><name>jeromyanglim</name><uri>http://www.blogger.com/profile/12949204812496382042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-8909074830238091680.post-6449394783667317782</id><published>2010-03-19T22:16:00.000+11:00</published><updated>2010-03-19T22:16:02.037+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX"/><title type='text'>TeXnicCenter Customisations</title><content type='html'>Over the last few weeks I&#39;ve been exploring text editors for writing LaTeX documents.
I wrote these notes when I was using TeXnicCenter (version 1.0).
I have since switched to using WinEdt for writing LaTeX documents. 
If you do any substantial writing in LaTeX and you are choosing between 
free TeXnicCenter and shareware WinEdt, buy WinEdt. 
I&#39;m planning a post soon on WinEdt.
Nonetheless, I thought I&#39;d post these rather rough notes I made while playing around with TeXnicCenter in case they are of interest.

&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;


&lt;h3&gt;Shortcut Keys&lt;/h3&gt;
&lt;p&gt;I added the following keyboard customisations to the default set.
The keys were chosen with the aim of (1) being consistent with other programs,
 and (2) not conflicting with existing shortcut keys.
&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Find Next: Ctrl+PageDown &lt;/li&gt;
  &lt;li&gt;Find Previous: Ctrl+PageDown &lt;/li&gt;
  &lt;li&gt;Navigation Items - Go to: Ctrl+Shift+D &lt;/li&gt;
  &lt;li&gt;Window - Close: Ctrl+Shift+W &lt;/li&gt;
  &lt;li&gt;Find in Files: Ctrl+Shift+F &lt;/li&gt;
  &lt;li&gt;Select Output Profile: F12 &lt;/li&gt;
  &lt;li&gt;Tools - Windows Explorer: Ctrl+Shift+E&lt;/li&gt;
&lt;/ul&gt;



&lt;h3&gt;Document navigation&lt;/h3&gt;
The following are some strategies that can be used to facilitate document navigation in TeXnicCenter.
&lt;br /&gt;&lt;br /&gt;

&lt;strong&gt;Structure, Objects, Files&lt;/strong&gt;
&lt;br /&gt;
Press one of the following keys, then navigate to the target, and press Ctrl+Shift+D (requires prior shortcut).
&lt;ul&gt;
  &lt;li&gt;Activate Structure: Ctrl+G &lt;/li&gt;
  &lt;li&gt;Activate Objects: Ctrl+U &lt;/li&gt;
  &lt;li&gt;Activate Files: Ctrl+D &lt;/li&gt;
&lt;/ul&gt;

&lt;strong&gt;Incremental Search&lt;/strong&gt;
&lt;br /&gt;
1. Ctrl+I
&lt;br /&gt;
2. Get to target by typing identifying letters
 or combine semi-identifying letters with additional Ctrl+I or Ctrl+Shift+I
&lt;br /&gt;
3. Enter
&lt;br /&gt;
4. To remove selection: Movement key or Ctrl+I Enter
&lt;br /&gt;
&lt;br /&gt;

&lt;strong&gt;Variant on Incremental Search&lt;/strong&gt;
&lt;br /&gt;
1. Highlight Text
&lt;br /&gt;
2. Ctrl+F Esc
&lt;br /&gt;
3. Find Next or Find Previous (F3 and Shift+F3; or Ctrl+PageUp and Ctrl+PageDown with my modified short cut keys)
&lt;br /&gt;




&lt;h3&gt;Getting an overview&lt;/h3&gt;
&lt;strong&gt;Structure View&lt;/strong&gt;
&lt;p&gt;
TeXnicCenter has Structure View.
It shows heading titles down to the &lt;code&gt;subsubsection&lt;/code&gt; level.
It shows tables and figures in floats and separated equations.
Ctrl+G activates Structure View.
Double clicking or using a shortcut can take you to the corresponding location in tex source.
Left, Right, Up, and Down serve navigational purposes
&lt;/p&gt;
&lt;p&gt;
One frustrating element is that pressing Ctrl+G when in tex source,
 does not take you to the corresponding location in the Structure View.
Thus, if you are trying to get a sense of where you are in the structure,
 you need to navigate to the location.
&lt;/p&gt;
&lt;p&gt;
A second frustration is that you can&#39;t control how the Structure View is displayed.
It is not possible to expand all headings.
It is not possible to show a given depth.
It is not possible to add custom tags.
&lt;/p&gt;
&lt;strong&gt;Note: I&#39;ve since discovered that WinEdt supports these features.&lt;/strong&gt;



&lt;h3&gt;Spelling&lt;/h3&gt;
To download a dictionary in a language other than US English (i.e., Australian English)
&lt;ol&gt;
  &lt;li&gt;Download a dictionary from from:
    &lt;a href=&quot;http://wiki.services.openoffice.org/wiki/Dictionaries&quot;&gt;Open Office&lt;/a&gt;
    &lt;/li&gt;
  &lt;li&gt;Copy unzipped dictionary files into the &amp;quot;Language&amp;quot; folder of your TeXnicCenter Installation.
    e.g., &amp;quot;C:\Program Files\TeXnicCenter\Language&amp;quot;.
    &lt;/li&gt;
&lt;/ol&gt;
I also set up a custom dictionary in a suitable location.
&lt;br /&gt;



&lt;h3&gt;Working on two files&lt;/h3&gt;
&lt;p&gt;It is sometimes useful to be able to work on two *.tex files at the same time.
For example, I may be in Chapter 2 citing a reference in Appendix C.
Thus, I&#39;ll have both chapter2.tex and appendix3.tex open.
I achieve this effect by:
&lt;/p&gt;
1. While in one of the files (e.g., chapter2.tex): Window - Close all but Active
&lt;br/&gt;
2. Window - Open the other desired File (e.g., appendix3.tex)
&lt;br/&gt;
3. Window - Tile Vertically
&lt;br/&gt;&lt;br/&gt;



&lt;h3&gt;Window Layout&lt;/h3&gt;
On a 24 inch monitor I have the left two-thirds of the monitor with TeXnicCenter
and the right one-third of the monitor with Yap.

&lt;h3&gt;Work Flow:&lt;/h3&gt;

&lt;p&gt;When learning to write in LaTeX, it is important to make
repetitive tasks efficient.
&lt;/p&gt;

&lt;strong&gt;Edit-Build-Check-Edit Cycle:&lt;/strong&gt;
&lt;br /&gt;
1. Build Output: Ctrl+F5 in TeXnicCenter:
&lt;br /&gt;
2. Show LaTeX source in TeXnicCenter using Inverse Search: E-Key in Yap or Double click on document;
&lt;br /&gt;
It can be useful to show source links so that it is clear where the cursor will go when you activate inverse search.
(in Yap: Options - User Interface - Show source links).
Double clicking on one of the circles overlaid by Yap
 tends to return the cursor to a specific expected location.3.
 &lt;br /&gt;
 &lt;br /&gt;
 
Return Focus to TeXnicCenter
&lt;br /&gt;
Several options exist:
&lt;br /&gt;
(a) Close Yap (q)
&lt;br /&gt;
(b) Use mouse to select TeXnicCenter
&lt;br /&gt;
(c) Alt+Tab
&lt;br /&gt;
(d) Use an AutoHotKey Script:
I set up a script using AutoHotKey that toggles between TeXnicCenter and Yap.
&lt;br/&gt;
&lt;code&gt;; Script toggles focus between Yap and TeXnicCenter&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;;Script assumes both are open &lt;/code&gt;&lt;br /&gt;
&lt;code&gt;;and that only one copy is open&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;#1:: ;Windows+1 is a shortcut key&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;if WinActive, TeXnicCenter  &lt;/code&gt;&lt;br /&gt;
&lt;code&gt;WinActivate, Yap &lt;/code&gt;&lt;br /&gt;
&lt;code&gt;else  &lt;/code&gt;&lt;br /&gt;
&lt;code&gt;WinActivate, TeXnicCenter&lt;/code&gt;&lt;br /&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/6449394783667317782'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/6449394783667317782'/><link rel='alternate' type='text/html' href='http://jeromyanglim.blogspot.com/2010/03/texniccenter-customisations.html' title='TeXnicCenter Customisations'/><author><name>jeromyanglim</name><uri>http://www.blogger.com/profile/12949204812496382042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-8909074830238091680.post-5834116911486034190</id><published>2010-03-15T17:29:00.000+11:00</published><updated>2010-03-16T17:36:21.039+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="APAStyle"/><category scheme="http://www.blogger.com/atom/ns#" term="BibTeX"/><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX"/><category scheme="http://www.blogger.com/atom/ns#" term="references"/><title type='text'>APA Style References in LaTeX</title><content type='html'>&lt;p&gt;This post discusses my experience getting APA style references in LaTeX. This includes both in-text citations and the end of document references list. It focuses on the use of the &lt;code&gt;apacite&lt;/code&gt; package.&lt;/p&gt; &lt;a name=&#39;more&#39;&gt;&lt;/a&gt;  &lt;h3&gt;Setting up a BibTeX Bibliographic Database&lt;/h3&gt;  &lt;p&gt;Regardless of what citation style you want, you need to have your references formatted in BibTeX format. &lt;a href=&quot;http://jabref.sourceforge.net/&quot;&gt;JabRef&lt;/a&gt; is a powerful reference manager for working with a BibTeX database. Also, see my previous post for migrating an &lt;a href=&quot;http://jeromyanglim.blogspot.com/2010/03/export-from-endnote-to-bibtex-jabref.html&quot;&gt;Endnote database into BibTeX format and migrating a Word Document with Endnote references into LaTeX format&lt;/a&gt;.  &lt;/p&gt;  &lt;b&gt;APA Style References&lt;/b&gt; Several options exist:   &lt;ul&gt;   &lt;li&gt;&lt;code&gt;apalike&lt;/code&gt; style in &lt;a href=&quot;http://merkel.zoneo.net/Latex/natbib.php&quot;&gt;natbib&lt;/a&gt; &lt;/li&gt;   &lt;li&gt;&lt;code&gt;apacite&lt;/code&gt; package: See the &lt;a href=&quot;http://www.ctan.org/tex-archive/biblio/bibtex/contrib/apacite/apacite.pdf&quot;&gt;PDF documentation&lt;/a&gt; for details. &lt;/li&gt; &lt;/ul&gt; &lt;p&gt; From my initial examination &lt;code&gt;apacite&lt;/code&gt; looks like   it has more features and is more compatible with the nuances of APA style.  However, &lt;code&gt;natbib&lt;/code&gt; is somewhat of a standard in LaTeX.  Thus, using &lt;code&gt;natbib&lt;/code&gt; citation commands may enable easier conversion between citation styles.  The remainder of this post focuses on my experience with the &lt;code&gt;apacite&lt;/code&gt; package.  &lt;/p&gt; &lt;h3&gt;Using apacite&lt;/h3&gt;  &lt;p&gt;For comprehensive information on using apacite,  see the &lt;a href=&quot;http://www.ctan.org/tex-archive/biblio/bibtex/contrib/apacite/apacite.pdf&quot;&gt;documentation&lt;/a&gt;.  The following sets out some basic details:  &lt;/p&gt;  &lt;p&gt;1. Ensure that you have a BibTeX database for the document.  Your document will be more portable if the database is placed  in either the same folder as the LaTeX files or in a subfolder of the LaTeX files.  &lt;/p&gt;  &lt;p&gt;However, you may prefer to maintain a general Bibliographic database that can be used across documents.  If you wish to have a general database, you can use absolute file references to the database.  Then when you need to share the BibTeX database, copy the database into a LaTeX project folder  or subfolder and change the file reference in the &lt;code&gt;bilbiography&lt;/code&gt; command .  &lt;/p&gt;  &lt;p&gt;2. Reference the apacite package in the preamble.  &lt;/p&gt;  &lt;p&gt; &lt;code&gt;\usepackage{apacite}&lt;/code&gt; &lt;/p&gt;  &lt;p&gt;3. Place the bibliography in the desired location in the document (usually after the main text) using the following code:  &lt;/p&gt;   &lt;code&gt; \bibliographystyle{apacite} &lt;br /&gt; %http://www.ctan.org/tex-archive/biblio/bibtex/contrib/apacite/apacite.pdf &lt;br /&gt; \bibliography{bibtex/thesis} % database is &amp;quot;thesis.bib&amp;quot; located in a &amp;quot;bibtex&amp;quot; subfolder &lt;br /&gt; &lt;/code&gt;   &lt;p&gt;4. To insert citations in the text &lt;code&gt;apacite&lt;/code&gt; has a range of commands  (see &lt;a href=&quot;http://www.ctan.org/tex-archive/biblio/bibtex/contrib/apacite/apacite.pdf#page=10&quot;&gt;&amp;quot;The citation commands&amp;quot; in the Manual&lt;/a&gt;).  Table 1 in the manual lists some of the main commands.  I find myself using the following ones most often:  &lt;/p&gt; &lt;ul&gt;   &lt;li&gt;&lt;code&gt;cite&lt;/code&gt;: This inserts the author names and years in brackets. This is the standard methods. E.g., &amp;quot;(Anglim, 2002)&amp;quot;. &lt;/li&gt;   &lt;li&gt;&lt;code&gt;citeA&lt;/code&gt;: Inserts the author names in the text and years in brackets. I use this to insert the authors names in the text e.g., &amp;quot;Anglim (2002)&amp;quot;. &lt;/li&gt;   &lt;li&gt;&lt;code&gt;citeyear&lt;/code&gt;: inserts just the years in brackets. This is useful when I want to include the author&#39;s names in the text in a non-standard way. E.g., I&#39;ve already written &amp;quot;Anglim&#39;s&amp;quot; then citeyear will insert &amp;quot;(2002)&amp;quot;. &lt;/li&gt; &lt;/ul&gt; &lt;p&gt;Each command takes a BibTeX reference as an argument and can have pre- and post- text. For example:  &lt;/p&gt;   &lt;code&gt;cite&amp;lt;e.g.,&amp;gt;{Ackerman1990JoEPLMaC}&lt;/code&gt; &lt;br /&gt;  &lt;p&gt;displays as &amp;quot;(e.g., Ackerman, 1990)&amp;quot;&lt;/p&gt;  &lt;p&gt; 5. To produce the document with references included, the document typically needs to be built three times in order for all updates to occur.  &lt;/p&gt;  &lt;h3&gt;Additional Challenges and Resolutions&lt;/h3&gt;  &lt;b&gt;French formatting&lt;/b&gt;  &lt;br /&gt; &lt;b&gt;Problem: &lt;/b&gt;For some reason my document was using a French language version of apacite. This resulted in many unwanted&amp;#160; customisations, such as the French word for references (Références) being displayed at the start of the reference list.  &lt;br /&gt; &lt;b&gt;Solution: &lt;/b&gt;I inserted the following code into the preamble to restore the English mode of &lt;code&gt;apacite&lt;/code&gt;:   &lt;p&gt; &lt;code&gt;\usepackage[english]{babel}&lt;/code&gt; &lt;/p&gt;  &lt;h3&gt;Additional Resources&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href=&quot;http://www.personality-project.org/revelle/syllabi/205/apa.style.html&quot;&gt;William Revelle&#39;s notes&lt;/a&gt; on configuring LaTeX for APA style. &lt;/li&gt;   &lt;li&gt;Ista Zahn&#39;s document &lt;a href=&quot;http://www.scribd.com/doc/6451985/Learning-to-Sweave-in-APA-Style&quot;&gt;Learning To Sweave in APA style&lt;/a&gt;. &lt;/li&gt; &lt;/ul&gt;  </content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/5834116911486034190'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/5834116911486034190'/><link rel='alternate' type='text/html' href='http://jeromyanglim.blogspot.com/2010/03/apa-style-references-in-latex.html' title='APA Style References in LaTeX'/><author><name>jeromyanglim</name><uri>http://www.blogger.com/profile/12949204812496382042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-8909074830238091680.post-2762826784824749409</id><published>2010-03-15T17:01:00.001+11:00</published><updated>2010-03-15T21:14:47.841+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX"/><category scheme="http://www.blogger.com/atom/ns#" term="Word"/><title type='text'>Converting a Microsoft Word Document into a LaTeX Document</title><content type='html'>This post discusses my experience converting a large MS Word document into a LaTeX document using Word-to-LaTeX. Along the way I encountered several challenges. I thought I&#39;d document them in case it may be of interest to others.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;Overview of Options&lt;/b&gt;&lt;/div&gt;
Having a good conversion method is important when transitioning existing Word documents to LaTeX and when colloborating with others who are not familiar with LaTeX.&amp;nbsp;Wilfred Hennings provides a great page that summarises options for converting documents from &lt;a href=&quot;http://www.tug.org/utilities/texconv/pctotex.html&quot;&gt;PC Wordprocessors to LaTeX&lt;/a&gt;. The page list options and provides recommendations. Wilfred&#39;s&amp;nbsp;&lt;a href=&quot;http://www.tug.org/utilities/texconv/pc2txtbl.html&quot;&gt;Quick Comparison List&lt;/a&gt; is particularly useful.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;My Experience with Word-To-LaTeX:&lt;/b&gt;&lt;/div&gt;
I started my conversion journey with Michal Kerbt&#39;s&amp;nbsp;&lt;a href=&quot;http://wordtolatex.sourceforge.net/&quot;&gt;Word-to-LaTeX (Word-to-XML) Convertor&lt;/a&gt;. It&#39;s free software but Michal accepts &lt;a href=&quot;http://wordtolatex.sourceforge.net/donations&quot;&gt;donations&lt;/a&gt;. I used it in it&#39;s stand alone form. It provides many options for converting documents. While it generally worked well, the following discusses various challenges in the conversion process with a description of what I did in response.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Convert *.docx to *.doc format:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Problem&lt;/b&gt;: The convertor did not appear to work with Word 2007 files (*.docx).&lt;br /&gt;
&lt;b&gt;Solution&lt;/b&gt;: Save As Word 97 (*.doc) format.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Set up a PostScript printer:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Problem&lt;/b&gt;: In order to convert graphics files a postscript printer needs to be setup.&lt;br /&gt;
&lt;b&gt;Solution&lt;/b&gt;: (&lt;b&gt;Warning&lt;/b&gt;: I&#39;ve had some problems with the EPS files generated; I&#39;m not sure if its related to this printer setup)&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;b&gt;Install a postcript printer:&lt;/b&gt;&amp;nbsp;Adobe sets out one way to set up a virtual printer. I followed&amp;nbsp;&lt;a href=&quot;http://kb2.adobe.com/cps/328/328620.html&quot;&gt;these instructions&lt;/a&gt;.&amp;nbsp;Here is a direct link to the&amp;nbsp;&lt;a href=&quot;http://www.adobe.com/support/downloads/product.jsp?product=44&amp;amp;platform=Windows&quot;&gt;downloads&lt;/a&gt;. In short it involves installing a PostScript printer driver with a PPD specification.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Specify in Word-to-LaTeX: &lt;/b&gt;This printer is then specified in the Word-to-LaTeX configuration: Figures/Eq/Documents - Figures - PostScript printer.&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;Big complex documents:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Problem&lt;/b&gt;: Long and complex documents can take a while to run (e.g., 15 minutes for a 60,000 word document with many styles and tables on a 2007 laptop).&lt;br /&gt;
&lt;b&gt;Solution: &lt;/b&gt;Hey. Who cares! Just let it run. It&#39;s quicker than trying to do it manually.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Security Alert Over Macros:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Problem&lt;/b&gt;: The program installs a macro in the Word Startup folder. My version of Word (Word 2007) disabled this by default.&lt;br /&gt;
&lt;b&gt;Solution:&lt;/b&gt; It is possible to enable all macros. However, this is not particularly safe. I decided to delete the file from: &quot;C:\Program Files\Microsoft Office\Office12\STARTUP&quot; and just run the program through its stand-alone desktop interface.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Tidying Up&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Problem: &lt;/b&gt;The *.tex document was not exactly what I wanted.&lt;br /&gt;
&lt;b&gt;Solution: &lt;/b&gt;Several options presented themselves.&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;b&gt;Change input&lt;/b&gt;: I could alter the Word document. I could remove styles, remove unwanted fonts, and so on.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Change process&lt;/b&gt;:&amp;nbsp;Word-to-LaTeX presents many configuration options which I could play with.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Post-process&lt;/b&gt;: I could apply various replacement operations on the *.tex created by Word-to-LaTeX.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
The solution I adopted combined all three approaches. For example, I converted hidden text in the Word document to a particular style. This meant that it was enclosed in a command in *.tex that was easy to find and replace in post-processing.&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Start Up Problem&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Problem: &lt;/b&gt;When I ran Word-to-LaTeX, I obtained the following error:&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;Conversion started.
Fatal error: Call was rejected by callee.
   at Word.DocumentClass.Activate()
   at WordToLatex.WLConvertor.Convert()
   at WordToLatex.Bin.WLApplication.Main(String[] args)
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt; Solution &lt;/b&gt; I closed Word-to-LaTeX. I closed Word. I then pressed control+alt+delete and ended any WINWORD processes that were running. I then restarted Word-to-LaTeX. As an additional point it was sometimes necessary to close Word-to-LaTeX&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Conversion Problem&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Problem: &lt;/b&gt;I obtained the following error.&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;Converting document fields.
Unknown error: Object reference not set to an instance of an object.
   at WordToLatex.WLProcessFields.FieldHyperlink(Field field)
   at WordToLatex.WLProcessFields.ProcessField(Field field)
   at WordToLatex.WLProcessFields.ProcessAllFields()
   at WordToLatex.WLConvertor.ConvertInner()
   at WordToLatex.WLConvertor.Convert()
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;Solution:&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Divide and conquer: &lt;/b&gt;Dividing a long document into smaller parts to identify which parts could be processed was one strategy. If you do this, it may be good to put the files in separate folders, otherwise image files from one subdocument may be overridden by a latter subdocument.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Paste into Fresh Document: &lt;/b&gt;Another trick that worked for me was to copy and paste the contents of the document into a new document. I&#39;m not sure why this worked. Perhaps it worked because it removed a number of custom styles I had.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;Problems importing EPS files&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Problem: &lt;/b&gt;I let Word-to-LaTeX convert the images to EPS. I could view these images in an editor and they had indeed been converted. However, when I added them in LaTeX, only white space was shown.&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Solution: &lt;/b&gt;For pictures derived from R I just created them again, this time using the postscript driver.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
Opening the image in Adobe Acrobat Professional and saving as EPS was one option for the other pictures.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/2762826784824749409'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/2762826784824749409'/><link rel='alternate' type='text/html' href='http://jeromyanglim.blogspot.com/2010/03/converting-microsoft-word-document-into.html' title='Converting a Microsoft Word Document into a LaTeX Document'/><author><name>jeromyanglim</name><uri>http://www.blogger.com/profile/12949204812496382042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-8909074830238091680.post-3626110146924167492</id><published>2010-03-15T16:47:00.002+11:00</published><updated>2010-09-01T13:44:22.969+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="BibTeX"/><category scheme="http://www.blogger.com/atom/ns#" term="Endnote"/><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX"/><category scheme="http://www.blogger.com/atom/ns#" term="references"/><category scheme="http://www.blogger.com/atom/ns#" term="Writing"/><title type='text'>Export from Endnote to BibTeX, JabRef, and LaTeX</title><content type='html'>This post sets out a procedure that I used to migrate a large set of Endnote references in a Word Document to a Latex document with BibTeX references in JabRef. 
In particular, it sets out 
(1) how to export an Endnote database into BibTeX format ready for inclusion in a LaTeX document; and 
(2) how to modify an existing document with Endnote citations into a document that cites the BibTeX database.
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;

&lt;h3&gt;Exporting Endnote database into BibTeX format&lt;/h3&gt;
&lt;a href=&quot;http://fundamentalthinking.blogspot.com/2009/03/exporting-references-from-endnote-to.html&quot;&gt;
 Josh explains how to do this using JabRef&lt;/a&gt;. 
However, if you want to alter a document with a large number of existing Endnote citations, you may want to adopt a modified procedure. 
Below I set out the procedure that I adopted. However, I don&#39;t claim it to be the most elegant procedure. Nonetheless, it may give you some ideas.

&lt;h3&gt;Changing Endnote Citations to BibTeX format&lt;/h3&gt;
If you already have a document with Endnote citations, you are going to need to convert these citations to BibTeX format. If the document only includes a few citations, this conversion can be done manually with little effort. However, if you have a book or thesis with several hundred citations, you may want a quicker and more reliable method. The remainder of this post sets out a procedure that I adopted to transition my own Word document with around 500 unformatted Endnote citations to BibTeX format.

&lt;br /&gt;&lt;br /&gt;
This post assumes that:
&lt;ul&gt;
&lt;li&gt;you have exported your document from a word processor into some preliminary LaTeX format.&lt;/li&gt;
&lt;li&gt;you have unformatted Endnote citations in the document&lt;/li&gt;
&lt;li&gt;you have &lt;a href=&quot;http://jabref.sourceforge.net/&quot;&gt;JabRef&lt;/a&gt;&amp;nbsp;installed&lt;/li&gt;
&lt;li&gt;you have some understanding of how Endnote, LaTeX, JabTeX, and BibTeX work.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Background&lt;/h3&gt;
An unformatted Endnote citation typically looks like this:
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Single Author and Year:&lt;/b&gt; {Author, Year #Record Number} : e.g., {Anglim, 2008, #231}&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Multiple Author and Year: &lt;/b&gt;{Author, Year #Record Number;&amp;nbsp;Author, Year #Record Number} : e.g.,&amp;nbsp;{Anglim, 2008, #231; Smith, 2009, #100}&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Just Year:&lt;/b&gt; {, Year #Record Number} : e.g.,&amp;nbsp;{, 2008, #231}&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Author and Year with preceding text:&lt;/b&gt; {introductory text \Author, Year #Record Number} : e.g., {see \Anglim, 2008, #231}&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Author and Year with following text: &lt;/b&gt;{Author, Year #Record Number, following text} : e.g., &amp;nbsp;{Anglim, 2008, #231, p.73}&lt;/li&gt;
&lt;/ul&gt;

The key in the Endnote database is called a record number. 
A BibTeX key is a text string which it is typically some automatically generated function of the record such as AuthorYear (e.g., &quot;Anglim2008&quot;).
The first step to any updating procedure is to ensure that there is database that matches the Endnote key with the BibTeX key.

&lt;h3&gt;Importing Endnote Record Numbers into JabRef&lt;/h3&gt;
&lt;h4&gt;Step 1.&lt;/h4&gt;
Read  &lt;a href=&quot;http://fundamentalthinking.blogspot.com/2009/03/exporting-references-from-endnote-to.html&quot;&gt;
Josh&lt;/a&gt;&#39;s protocol but don&#39;t follow it just yet.
The problem with this procedure is that it does not export the Record Number.

&lt;h4&gt;Step 2.&lt;/h4&gt;
Instead of following &lt;a href=&quot;http://fundamentalthinking.blogspot.com/2009/03/exporting-references-from-endnote-to.html&quot;&gt;Josh&lt;/a&gt;&#39;s
  protocol exactly, the following modifies the protocol to include exporting of the Endnote Record Number.
Create a copy of &quot;BibTeX Export to JabRef.ens&quot; and name it &quot;BibTeX Export to JabRef RecordNumbers.ens&quot;

&lt;h4&gt;Step 3.&lt;/h4&gt; 
Modify the output style:
&lt;ol&gt;
&lt;li&gt;In Endnote go into edit this style &quot;BibTeX Export to JabRef RecordNumbers.ens&quot;.&lt;/li&gt;
&lt;li&gt;Go to bibliography templates.&lt;/li&gt;
&lt;li&gt;For each Reference Type (e.g., Journal, Book, etc.) add an extra line with the following text:&lt;code&gt;`endnotekey = {`Record Number`},`&lt;/code&gt;
&lt;li&gt;Paste the above text just after the &quot;URL&quot; line is one option. E.g., it might look something like this in the area around the pasting:&lt;br /&gt;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;`Abstract = {`Abstract`},`
&amp;nbsp;&amp;nbsp;&amp;nbsp;`Note = {`Notes`},`
&amp;nbsp;&amp;nbsp;&amp;nbsp;`URL = {`URL`},`
&amp;nbsp;&amp;nbsp;&amp;nbsp;`endnotekey = {`Record Number`},`
&amp;nbsp;&amp;nbsp;&amp;nbsp;`EndNoteRefType = {Journal Article},`
&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;Step 4.&lt;/h4&gt;
Return to Josh&#39;s protocol but use &quot;BibTeX Export to JabRef RecordNumbers.ens&quot; to export from Endnote. I.e.,
&lt;ol&gt;
&lt;li&gt;Highlight all rows of your Endnote Database and Export the references&lt;/li&gt;
&lt;li&gt;Use &quot;BibTeX Export to JabRef RecordNumbers.ens&quot; and File Export&lt;/li&gt;
&lt;li&gt;after exporting change the file extension of the exported file to &quot;.bib&quot;.&lt;/li&gt;
&lt;li&gt;open the bib file in JabRef&lt;/li&gt;
&lt;/ol&gt;


&lt;h4&gt;Step 5.&lt;/h4&gt;
After opening the BibTeX file in JabRef, add &quot;endnotekey&quot; as a field:
&lt;ol&gt;
&lt;li&gt;Menu: Options - Set General Fields&lt;/li&gt;
&lt;li&gt;Add the following to the end of the line that starts with &quot;General: &quot;
&lt;code&gt;&quot;;endnotekey&quot;&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;Step 6.&lt;/h4&gt;
To enable you to see the Endnote Record Number in the main viewing table in JabRef:
&lt;ol&gt;
&lt;li&gt;Options - Preferences Menu&lt;/li&gt;
&lt;li&gt;Entry table columns&lt;/li&gt;
&lt;li&gt;Add (Plus)&lt;/li&gt;
&lt;li&gt;add the field &quot;endnotekey&quot;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;Step 7.&lt;/h4&gt;
Auto-generate a BibTeX key for all the imported references.
In a previous post I discuss some of the issues regarding &lt;a href=&quot;http://jeromyanglim.blogspot.com/2010/03/choosing-auto-generation-pattern-for.html&quot;&gt;choosing a BibTeX auto-generation key&lt;/a&gt;.


&lt;h3&gt;Manually Update Endnote Citations&lt;/h3&gt;
At this point each unformatted endnote reference could be manually updated so that it refers to the appropriate BibTeX key.
E.g., If you had an unformatted Endnote citation with Endnote Record Number like: &lt;code&gt;{Bryan, 1897 #1366}&lt;/code&gt;, you could do the following:
&lt;ol&gt;
&lt;li&gt;Search for this record number in JabRef&lt;/li&gt;
    &lt;ol&gt;&lt;li&gt;Control + F (to open Search in JabRef)&lt;/li&gt;
    &lt;li&gt;&quot;endnotekey=1366&quot; (to get the specific article)
    OR simply &quot;1366&quot; (this may not always be unique but saves a little typing)&lt;/li&gt;
    &lt;/ol&gt;
&lt;li&gt;Copy the BibTexKey: 
 Control + K would copy to the clipboard:
&lt;code&gt;\cite{Bryan1897}.&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Paste over the unformatted Endnote citation in your LaTeX document.&lt;/li&gt;
&lt;/ol&gt;


&lt;h3&gt;Automatically Update Endnote Citations to BibTeX format&lt;/h3&gt;
A more advanced alternatively involves automatically replacing 
&lt;code&gt;[endnotekey]&lt;/code&gt; with &lt;code&gt;[bibtexkey]&lt;/code&gt;
  throughout the LaTeX document. 
There are many ways that this could be done. 
The following is a fairly inelegant method using a combination of Excel and Word (see the bottom of this post for alternatives). 
The post assumes that the hash symbol (#) followed by a number only occur in relation to Endnote citations.

&lt;h4&gt;1. Create a copy of your &quot;.bib&quot; file&lt;/h4&gt;
&lt;ol&gt;&lt;li&gt;call it &quot;copy.bib&quot;&lt;/li&gt;&lt;/ol&gt;

&lt;h4&gt;2. Copy the &quot;endnotekey&quot; field into the &quot;note&quot; field.&lt;/h4&gt;
This is required because the &quot;endnotekey&quot; field is not included in a standard export.
&lt;ol&gt;
&lt;li&gt;Open &quot;copy.bib&quot;&lt;/li&gt;
&lt;li&gt;Tools - Set/Clear/Rename Fields&lt;/li&gt;
&lt;li&gt;Field name: &quot;endnotekey&quot; and Rename field to &quot;note&quot;&lt;/li&gt;
&lt;li&gt;OK&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;3. Export the JabRef Database to a Spreadsheet readable format.&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;File - Export&lt;/li&gt;
&lt;li&gt;File of type: &quot;OpenOffice CSV (*.csv); let&#39;s call it &quot;bib.csv&quot;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;4. Open &quot;bib.csv&quot; in Excel&lt;/h4&gt;
The following steps would presumably work in most other spreadsheet programs like Open Office, perhaps with some modification to the function.

&lt;h4&gt;5. Create in Excel the code required for the VBA Word Procedure&lt;/h4&gt;
The general format of the procedure is:
&lt;pre&gt;
ReplaceEndnoteRef EndnoteKey, BibtexKey&lt;/pre&gt;
where &lt;code&gt;ReplaceEndnoteRef&lt;/code&gt; is the name of the procedure, 
&lt;code&gt;EndnoteKey&lt;/code&gt; is the number of the endnote key, 
 and &lt;code&gt;BibtexKey&lt;/code&gt; is the BibtexKey.
For example, this could be:
&lt;pre&gt;ReplaceEndnoteRef 724, &quot;Smith2008&quot;&lt;/pre&gt;

&lt;ol&gt;
&lt;li&gt;To create this in your spreadsheet (with bib.csv) enter the following function in an extra column (it assumes that the &quot;note&quot; field is in column M and the bibtex identifier is in column C):&lt;/li&gt;
&lt;pre&gt;=&quot;ReplaceEndnoteRef &quot;&amp;amp;M2&amp;amp;&quot;, &quot;&amp;amp;CHAR(34)&amp;amp;C2&amp;amp;CHAR(34)&lt;/pre&gt;
This should result in one cell that looks something like this:
&lt;pre&gt;ReplaceEndnoteRef 1294, &quot;Abraham1992AoDPS&quot;&lt;/pre&gt;&lt;/li&gt;

&lt;li&gt;Copy and paste the function so that it applies to all rows.&lt;/li&gt;

&lt;li&gt;Sort all rows by the &quot;note&quot; field in descending order.
The code needs to be run in this order to avoid inappropriate replacements.&lt;/li&gt;

&lt;li&gt;Paste a copy of the LaTeX text into a New Word Document.
&lt;b&gt;WARNING:&lt;/b&gt; do not run this macro on your document without a backup.&lt;/li&gt;
&lt;li&gt;Apply a macro in Word&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;Paste your latex text into a new word document&lt;/li&gt;
&lt;li&gt;Open up the Visual Basic Editor and paste the function below (insert a new module if needed)
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;Sub ReplaceEndnoteRef(EndnoteKey, BibtexKey)
    EndnoteKey = &quot;#&quot; &amp;amp; EndnoteKey
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = EndnoteKey
        .Replacement.Text = BibtexKey
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
End Sub
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;

&lt;li&gt;Create a new procedure and paste the commands from Excel.
Here are the first few lines of such a procedure&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;Sub ReplaceRefs()
ReplaceEndnoteRef 1495, &quot;Sternberg1979AP&quot;
ReplaceEndnoteRef 1494, &quot;Thoresen2004JoAP&quot;
ReplaceEndnoteRef 1493, &quot;Lievens2002MEa&quot;
ReplaceEndnoteRef 1492, &quot;Lievens2002ME&quot;
ReplaceEndnoteRef 1491, &quot;Goldberg2006JoRiP&quot;
ReplaceEndnoteRef 1490, &quot;Carroll1865&quot;
ReplaceEndnoteRef 1489, &quot;Walsh2009CP&quot;
ReplaceEndnoteRef 1488, &quot;Zimbardo1973NYTM&quot;
ReplaceEndnoteRef 1487, &quot;Anglim2000&quot;
ReplaceEndnoteRef 1486, &quot;Fry&quot;
ReplaceEndnoteRef 1485, &quot;Anglim2007&quot;
ReplaceEndnoteRef 1484, &quot;Zou2007PM&quot;
&#39; And many more references
end sub
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;

&lt;li&gt;run the ReplaceRefs() procedure on your document.
F5 is a shortcut key when the cursor is in the procedure.
This should automatically replace endnotekeys with bibtexkeys.

&lt;br /&gt;&lt;br /&gt;
This still leaves a fair amount of text in the citation to tidy up, but it is at least a reasonable start. In addition the remaining text is likely to be relevant to how the text should appear (i.e., whether there is preceding text, or following text, and whether the authors names should appear).

&lt;br /&gt;&lt;br /&gt;
If you continue to use this version of the database you may want to clear the &quot;note&quot; field so that the endnote key is no longer present. Otherwise it may appear in references. This can be done using the Tools - Set/Clear/Rename Fields menu option in JabRef.&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;

&lt;h3&gt;ALTERNATIVE OPTIONS&lt;/h3&gt;
After devising the above procedure, I discovered &lt;a href=&quot;http://www.unc.edu/~nghoffma/resources/useEndnote/useEndnote.pdf&quot;&gt;Noah Hoffman&#39;s Approach involving Python Scripts&lt;/a&gt;. It might also be worth a look.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/3626110146924167492'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/3626110146924167492'/><link rel='alternate' type='text/html' href='http://jeromyanglim.blogspot.com/2010/03/export-from-endnote-to-bibtex-jabref.html' title='Export from Endnote to BibTeX, JabRef, and LaTeX'/><author><name>jeromyanglim</name><uri>http://www.blogger.com/profile/12949204812496382042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-8909074830238091680.post-5375772835254421354</id><published>2010-03-08T22:08:00.005+11:00</published><updated>2010-03-08T22:16:33.016+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JabRef"/><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX"/><title type='text'>Choosing an Auto Generation Pattern for BibTeX Keys in JabRef</title><content type='html'>This post discusses the issue of choosing a default pattern for the BibTex key generator in JabRef.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;b&gt;THE CONTEXT&lt;/b&gt;&lt;/div&gt;If you haven&#39;t already heard,&amp;nbsp;&lt;a href=&quot;http://jabref.sourceforge.net/&quot;&gt;JabRef&lt;/a&gt;&amp;nbsp;is an open source reference manager built on Java, and &lt;a href=&quot;http://www.bibtex.org/&quot;&gt;BibTeX&lt;/a&gt;&amp;nbsp;is a file format for storing references.&amp;nbsp;I&#39;ve recently been making the transition from Word to LaTeX and from Endnote to BibTeX and&amp;nbsp;&lt;a href=&quot;http://jabref.sourceforge.net/&quot;&gt;JabRef&lt;/a&gt;&amp;nbsp;(although you can use &lt;a href=&quot;http://www.medicalnerds.com/how-to-use-jabrefbibtex-with-microsoft-word-2003/&quot;&gt;JabRef with MS Word&lt;/a&gt;).&lt;br /&gt;
&lt;br /&gt;
Once I had imported my references from Endnote into JabRef, I needed to generate Bibtexkeys. These keys could then be used to link references in the BibTeX database to citations in a document. &amp;nbsp;Jabref facilitates the task using an&amp;nbsp;&lt;a href=&quot;http://jabref.sourceforge.net/help/LabelPatterns.php&quot;&gt;auto key generator&lt;/a&gt;. This generator takes information from references to create the keys. A typical key pattern might be [auth][year] which might create a key like &quot;Smith2000&quot; for an article by Smith in the year 2000.&lt;br /&gt;
&lt;br /&gt;
However, this presented a challenge. Once created, keys should not be changed. If the choice of key mattered and I chose a poor key, it would be a big issue&amp;nbsp;once I had many documents integrated with many citations all using these key formats. The key can also be used to link article PDFs if you rename your files to match the key. Thus, I decided to think about whether the choice of key mattered and if so, what makes a good key?&lt;br /&gt;
&lt;br /&gt;
The remainder of this post discusses my thoughts and sets out the auto-key generation pattern that I adopted.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;b&gt;DECIDING ON A KEY&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;A good key is:&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Unique&lt;/b&gt;: Within the database a key must be unique in order to link citations to the appropriate reference.&amp;nbsp;While Jabref &amp;nbsp;automatically appends letters to duplicates in the database (i.e., Smith2000a, Smith2000b), if you need to combine two databases from two different researchers, it would be better if there were no identical keys.&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;b&gt;Short&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;: Short references are easier to type. They take up less space when cited in LaTeX source.&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;b&gt;Readable in LaTeX:&amp;nbsp;&lt;/b&gt;If the key suggests the reference, this can make the LaTeX text more readable. It also means that if the database is lost, damaged, or not available, a reasonable guess can be made about what was the intended citation, at least if you know the area of research.&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;b&gt;Excludes problematic characters: &lt;/b&gt;Certain characters would prevent the key from being used in LaTeX or prevent it from being used as a file name. Using only letters and numbers and starting with a letter seems like a safe option.&lt;br /&gt;
&lt;b&gt;Never Changes: &lt;/b&gt;A good key never changes. If it were to change, connections to the reference in documents and files would also need to be updated.&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;Decision:&lt;/b&gt;&lt;br /&gt;
In the end I adopted the following algorithm&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;[auth][year][journal:abbr]:&lt;br /&gt;
This key prints first author, year and initials of the journal.&amp;nbsp;It is of moderate length&amp;nbsp;(perhaps 10 to 20 characters), quite highly unique, and quite recognisable. It also represents how I file articles in my head. The choice may also reflect my training in &lt;a href=&quot;http://owl.english.purdue.edu/owl/resource/560/02/&quot;&gt;APA format&lt;/a&gt;, which adopts an author-year style of citation. Thus, when speaking to others about an article, I might refer to it as &quot;Smith 2000&quot; or &quot;Smith&#39;s 2000 JAP article&quot;.&lt;br /&gt;
&lt;br /&gt;
I also had to overcome one extra issue:&lt;/div&gt;&lt;/div&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;div style=&quot;display: inline !important; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;div style=&quot;display: inline !important; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;div style=&quot;display: inline !important;&quot;&gt;&lt;b&gt;Avoiding Problematic Characters&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;div style=&quot;display: inline !important; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;div style=&quot;display: inline !important; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;div style=&quot;display: inline !important;&quot;&gt;&lt;b&gt;Problem:&amp;nbsp;&lt;/b&gt;I found that some of my journal names included Ampersands (&amp;amp;) (e.g., Memory &amp;amp; Cognition; Journal of Personality &amp;amp; Social Psychology). This led to Bibtexkeys with Ampersands (&amp;amp;), which is problematic for LaTeX.&amp;nbsp;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;b&gt;Solution:&amp;nbsp;&lt;/b&gt;I changed the journal names to use &quot;and&quot; instead of &quot;&amp;amp;&quot;. For example,&amp;nbsp;&quot;Memory and Cognition&quot; replaced &quot;Memory &amp;amp; Cognition&quot;. I also added a field to the replace regular expression in JabRef.&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;Replace (regular expression): \&amp;amp;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;by:&amp;nbsp;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;i.e., the replacement was the &quot;&amp;amp;&quot; preceded by an escape character and the &quot;by&quot; field was left blank indicating that such a character should be removed.&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;display: inline !important; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;Here&#39;s a screen shot of my BibTex key generator preferences:&lt;/div&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdK3nBXIbZC7JpnBQ1w7Qo-1ZtpL8maxnAQoZbmuxt5tCsmxD-Bu7wI_gw8d_wKMDG_DyLUQrEn09ta2zik3UblPKlBBqHxSD5i6WzWtLFhGneau-Bjt_gN2Ed6aN98DqF8nHnhItkGA/s1600-h/bibtexkey1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;281&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdK3nBXIbZC7JpnBQ1w7Qo-1ZtpL8maxnAQoZbmuxt5tCsmxD-Bu7wI_gw8d_wKMDG_DyLUQrEn09ta2zik3UblPKlBBqHxSD5i6WzWtLFhGneau-Bjt_gN2Ed6aN98DqF8nHnhItkGA/s400/bibtexkey1.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;What happens if the details of the reference change?&lt;/b&gt;&lt;br /&gt;
Once a key has been generated it should almost never change. Thus, even if a field in the reference used to generate the key was incomplete or had a typographical error, the key should not be regenerated. Similarly when references are imported that use a different key, they should not be altered.&amp;nbsp;&lt;b&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;br /&gt;
In short, I think its better to not have to think about it too much. &amp;nbsp;In JabRef I also specify &quot;Do not overwrite existing keys&quot; to further prevent the loss of keys.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;b&gt;LOOKING UP THE KEY&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;I have JabRef open while I edit my documents. My procedure:&lt;br /&gt;
1. alt-tab to bring up JabRef&lt;br /&gt;
2. Control + F (Find) type identifying information e.g., author year&lt;br /&gt;
3. Control + Shift + E (Focus entry table)&lt;br /&gt;
4. Down Key (to highlight first reference)&lt;br /&gt;
5. Control + Shift + K (to copy BibTex key) (or Control + K to include the \cite{...} text)&lt;br /&gt;
6. Alt + Tab to return to text editor&lt;br /&gt;
7. paste citation into text editor&lt;br /&gt;
&lt;br /&gt;
I believe some editors have even better integration with JabRef than the one that I use.&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/b&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/5375772835254421354'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/5375772835254421354'/><link rel='alternate' type='text/html' href='http://jeromyanglim.blogspot.com/2010/03/choosing-auto-generation-pattern-for.html' title='Choosing an Auto Generation Pattern for BibTeX Keys in JabRef'/><author><name>jeromyanglim</name><uri>http://www.blogger.com/profile/12949204812496382042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdK3nBXIbZC7JpnBQ1w7Qo-1ZtpL8maxnAQoZbmuxt5tCsmxD-Bu7wI_gw8d_wKMDG_DyLUQrEn09ta2zik3UblPKlBBqHxSD5i6WzWtLFhGneau-Bjt_gN2Ed6aN98DqF8nHnhItkGA/s72-c/bibtexkey1.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-8909074830238091680.post-7337823434311736628</id><published>2010-02-23T17:30:00.011+11:00</published><updated>2010-11-02T19:40:35.735+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="LaTeX"/><category scheme="http://www.blogger.com/atom/ns#" term="Literate programming"/><category scheme="http://www.blogger.com/atom/ns#" term="R"/><category scheme="http://www.blogger.com/atom/ns#" term="reproducible research"/><category scheme="http://www.blogger.com/atom/ns#" term="results"/><category scheme="http://www.blogger.com/atom/ns#" term="Sweave"/><title type='text'>Getting Started with Sweave: R, LaTeX, Eclipse, StatET, &amp; TeXlipse</title><content type='html'>Being able to press a single button that runs all your statistical analyses and integrates the output into your final report is a beautiful thing. If you have not already heard, this is what Sweave can do for you. However, getting your computer to run Sweave can be a little bit fiddly. 
Thus, this post: 
 (1) sets out the benefits of Sweave; 
 (2) sets out how to install and configure R, Sweave, and Eclipse on Windows; 
 (3) lists resources for people wanting to learn more about how to use LaTeX and Sweave; and 
 (4) lists some specific resources relevant to researchers in psychology wanting to use these tools.
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;

&lt;h3&gt;OVERVIEW&lt;/h3&gt;
&lt;h4&gt;What is Sweave?&lt;/h4&gt;
To Sweave is to weave in S. To weave is to combine data analysis code and standard formatted text into a single self-describing document. R is a dialect of S. Thus, if you use R to do your statistical analyses and you want to automate the importation of analyses in R into your reports, Sweave may be the tool for you. For a longer description, see Friedrich Leisch&#39;s (2002) &lt;i&gt;&lt;a href=&quot;http://www.statistik.lmu.de/~leisch/Sweave/Sweave-compstat2002.pdf&quot;&gt;Sweave: Dynamic Generation of Statistical Reports Using Literate Data Analysis&lt;/a&gt;.&lt;/i&gt;

&lt;h4&gt;Why Sweave?&lt;/h4&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;b&gt;Reproducibility&lt;/b&gt;: The most important reason to adopt a tool like Sweave is to make your research more reproducible. The R code sets out exactly how the raw data is transformed into publication output. The Sweave document links this R output with the final report. &lt;/li&gt;
 &lt;li&gt;&lt;b&gt;Efficiency: &lt;/b&gt;Statistical output is automatically incorporated into your report. There is no need to copy and paste output from your statistical analysis program into your report. If your data or analyses change, you can update your report with a single click instead of having to manually update every table and figure.&lt;/li&gt;
 &lt;li&gt;&lt;b&gt;Reliability: &lt;/b&gt;The integration of analyses with the report reduces the chance of errors entering in through copying and pasting of statistical output into documents.&lt;/li&gt;
 &lt;li&gt;&lt;b&gt;Education &amp;amp; Communication: &lt;/b&gt;By providing data analysis code for a report, this teaches others how to do similar analyses.&lt;/li&gt;
 &lt;li&gt;For an extended discussion, see Anthony Rossini and Friedrich Leisch&#39;s (2003) working paper &lt;i&gt;&lt;a href=&quot;http://www.bepress.com/cgi/viewcontent.cgi?article=1017&amp;amp;context=uwbiostat&quot;&gt;Literate Statistical Practice&lt;/a&gt;.&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Common Use Cases&lt;/h4&gt;
&lt;ul&gt;
 &lt;li&gt;Statistics Instructional Materials&lt;/li&gt;
 &lt;li&gt;Empirical reports, journal articles, book chapters, theses, etc.&lt;/li&gt;
&lt;/ul&gt;

Data sharing, literate programming, reproducible research, weaving: This is future of data analysis. Why not get on board now?

&lt;h3&gt;MY SWEAVE INSTALLATION AND CONFIGURATION&lt;/h3&gt;
A strength of R, Sweave, and LaTeX is that they are cross platform tools that can be integrated together to support powerful data analytic workflows. These tools run on Windows, Linux, and Mac OS with a range of text editors and command line options. However, the flexibility in configurations presents a challenge. There is no single click installation file like &quot;setup.exe&quot;. The tools need to be assembled. This section sets out how to install and configure a system for writing Sweave documents based around the Eclipse IDE and a Windows Operating System. It&#39;s not the only way to assemble a system to support Sweave, but for someone entrenched in the Windows world, I think its a good start.


&lt;h4&gt;1. Download and install R&lt;/h4&gt;
&lt;a href=&quot;http://www.r-project.org/index.html&quot;&gt;R Project&lt;/a&gt;. 
I&#39;m assuming you already use R, but if not you may wish to read my post on &lt;a href=&quot;http://jeromyanglim.blogspot.com/2009/06/learning-r-for-researchers-in.html&quot;&gt;Getting Started with R&lt;/a&gt;.

&lt;h4&gt;2. Download and install a Latex distribution&lt;/h4&gt;
There are several LaTeX distributions. I installed 
 &lt;a href=&quot;http://miktex.org/2.8/setup&quot;&gt; MikTex&lt;/a&gt;. 
 
&lt;h4&gt;3.a Download and install Eclipse and the StatET and TeXlipse plugins&lt;/h4&gt;
See the &lt;a href=&quot;http://www.walware.de/it/statet/installation.html&quot;&gt;StatET Installation page&lt;/a&gt; 
for instructions on how to install StatET and Eclipse.&lt;br /&gt;
&lt;a href=&quot;http://jeromyanglim.blogspot.com/2009/03/user-interface-for-r-statet-and-eclipse.html&quot;&gt;See also the links under &quot;Getting Started&quot; with StatET and Eclipse.&lt;/a&gt;

&lt;h4&gt;3.a Download and install Eclipse&lt;/h4&gt;
See &lt;a href=&quot;http://www.walware.de/it/statet/installation.html&quot;&gt;StatET Installation page&lt;/a&gt;; This assumes you have Java installed.

&lt;h4&gt;3.b Install the StatET plugin and the TeXlipse plugin&lt;/h4&gt;
See &lt;a href=&quot;http://www.walware.de/it/statet/installation.html&quot;&gt;StatET Installation page&lt;/a&gt;

&lt;h4&gt;3.c Configure the StatET plugin&lt;/h4&gt;
See &lt;a href=&quot;http://www.splusbook.com/RIntro/R_Eclipse_StatET.pdf&quot;&gt;Longhow Lam&#39;s Eclipse and the R plug-in StatET&lt;/a&gt;


&lt;h4&gt;3.d Configure the TeXlipse plugin&lt;/h4&gt;
The &lt;a href=&quot;http://texlipse.sourceforge.net/manual/configuration.html&quot;&gt;TeXclipse homepage&lt;/a&gt; lists general information. 
See specifically, 
 the &lt;a href=&quot;http://texlipse.sourceforge.net/manual/configuration.html&quot;&gt;configuration page&lt;/a&gt;.
 
My configuration could be abbreviated to: Go to Window - Preferences in Eclipse; Then, TeXlipse - Builder Settings; Then, enter the appropriate directory for your Bin directory of TeX distribution. In my case this was &quot;D:\MiKTeX 2.8\miktex\bin&quot; .

&lt;h4&gt;3.e Configure Sweave&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
 &lt;b&gt;Sweave.sty: &lt;/b&gt;Sweave is a built-in function in R. 
 However, when you run Sweave, your LaTeX distribution needs to be able to find a file called &quot;Sweave.sty&quot;. The file is stored in your R program files (e.g., &quot;C:\Program Files\R\R-2.9.1\share\texmf&quot;). A quick way to make it accessible is to place the file in your Eclipse project folder where the Rnw file is located. 
See &lt;a href=&quot;https://stat.ethz.ch/pipermail/r-help/2004-February/046302.html&quot;&gt;this R-Help post for tips.&lt;/a&gt; 
&lt;a href=&quot;http://www.stat.umn.edu/~charlie/Sweave/&quot;&gt;UMN has some additional tips&lt;/a&gt;. 
(&lt;b&gt;UPDATE:&lt;/b&gt; &lt;a href=&quot;http://blog.berndweiss.net/&quot;&gt;Bernd&lt;/a&gt; referred me to some additional material on linking &lt;a href=&quot;http://www.murdoch-sutherland.com/Rtools/miktex.html&quot;&gt;Sweave.sty with MikTeX&lt;/a&gt;.
&lt;/li&gt;

&lt;li&gt;
 &lt;b&gt;External Tools&lt;/b&gt;: Go to Run -- External Tools - External Tools configurations;&lt;br /&gt;
Sweave Document Processing (R/LaTeX); Click New Button; Give it a name like &quot;Sweave-PDF&quot;&lt;br /&gt;
Under the LaTeX tab change output format to pdf build commands pdflatex.exe&lt;br /&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;LEARNING LATEX&lt;/h3&gt;
Using Sweave assumes that you know how to use LaTeX. 
If you just want to write LaTeX documents using Eclipse (without R code), you can go to File - New Project (Texlipse - LaTeX Project). 
Once you have a basic working environment, it&#39;s easy to experiment with all the details of LaTeX. 
Here are some web guides among the many that are available. 
&lt;ul&gt;
 &lt;li&gt;&lt;a href=&quot;http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/&quot;&gt;David Wilkins&#39; Guide to Getting Started with LaTeX&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;http://frodo.elon.edu/tutorial/tutorial/&quot;&gt;Jeff Clark&#39;s Latex Tutorial&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;LEARNING SWEAVE&lt;/h3&gt;
Sweave is fairly straightforward. 
In Eclipse you can start a new R Project and add an *.Rnw file to write your Sweave document. 
Then use the Document menu to convert the Sweave file to a TEX file, PDF file, etc. 
There are many more general resources on Sweave:

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.statistik.lmu.de/~leisch/Sweave/&quot;&gt;Friedrich Leisch&#39;s Resources Page&lt;/a&gt;: This includes an overview of Sweave, &lt;a href=&quot;http://biosun1.harvard.edu/courses/individual/bio271/lectures/L7/Sweave-manual-20021007.pdf&quot;&gt;Sweave documentation&lt;/a&gt;; example Sweave documents, and discussion of literate programming&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;http://www.tug.org/pracjourn/2008-1/zahn/zahn.pdf&quot;&gt;Learning to Sweave in APA Style&lt;/a&gt;: A useful introduction for those new to LaTeX, Sweave, and R.&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;http://stat.epfl.ch/webdav/site/stat/shared/Regression/EPFL-Sweave-powerdot.pdf&quot;&gt;Nicola Sartori&#39;s Sweave demo&lt;/a&gt;: 30 slide presentation introducing Sweave.&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;https://www.uzh.ch/cmsssl/biostat/teaching/beratungsseminar/20090205_SRH_SweaveTemplates.pdf&quot;&gt;Sarah Haile&#39;s Overview&lt;/a&gt;: 17 slide introduction to Sweave.&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;http://www.stat.umn.edu/~charlie/Sweave/foo.pdf&quot;&gt;Charles J. Geyer&#39;s Demonstration&lt;/a&gt;: Tutorial and notes with examples on using Sweave.&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;http://www.ics.uci.edu/~vqnguyen/talks/SweaveSeminaR.pdf&quot;&gt;Vinh Q. Nguyen&#39;s UCI Seminar on Sweave&lt;/a&gt;: Slides introducing Sweave: Note particularly, the discussion of the &lt;code&gt;cacheSweave &lt;/code&gt; package for computationally intensive code that you don&#39;t want to re-run every time you refresh your document.&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;http://people.biology.ufl.edu/bolker/emdbook/&quot;&gt;Benjamin Bolker&#39;s website&lt;/a&gt; for his book &lt;i&gt;Ecological Models and Data in R&lt;/i&gt;. The site has earlier drafts from his book and problem exercises in pdf and Sweave-ready format (see the Rnw files).&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;http://www.drewconway.com/zia/&quot;&gt;Drew Conway&lt;/a&gt; referred me to &lt;a href=&quot;http://malecki.wustl.edu/&quot;&gt;Michael Malecki&lt;/a&gt;&#39;s &lt;a href=&quot;http://malecki.wustl.edu/sweaveTemplate.Rnw&quot;&gt;Sweave Template&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;LATEX, SWEAVE, AND PSYCHOLOGY&lt;/h3&gt;
Adopting LaTeX and Sweave presents several challenges related to somewhat discipline specific needs. These pertain particularly to the various style conventions expected for journal submission. The following are some useful resources:
&lt;ul&gt;
 &lt;li&gt;&lt;b&gt;Introduction: &lt;/b&gt;&lt;a href=&quot;http://www.tug.org/pracjourn/2008-1/zahn/zahn.pdf&quot;&gt;Learning to Sweave in APA Style&lt;/a&gt; is A useful introduction if you are new to LaTeX, Sweave, and R from the perspective of a psychology researcher.&lt;/li&gt;
 &lt;li&gt;&lt;b&gt;APA Style:&lt;/b&gt; William Revelle provides a page on &lt;a href=&quot;http://www.personality-project.org/revelle/syllabi/205/apa.style/apa.style.html&quot;&gt;Writing a research methods paper in APA style using LaTeX&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;APA Style assumes &lt;b&gt;decimal point alignment&lt;/b&gt; in tables: &lt;a href=&quot;http://www.tex.ac.uk/tex-archive/macros/latex/required/tools/dcolumn.pdf&quot;&gt;dcolumn &lt;/a&gt;may be useful.&lt;/li&gt;
 &lt;li&gt;&lt;b&gt;Reference Manager&lt;/b&gt; for latex: &lt;a href=&quot;http://www.bibtex.org/&quot;&gt;bibtex&lt;/a&gt; is the tool; &lt;a href=&quot;http://ctan.unsw.edu.au/help/Catalogue/entries/apacite.html&quot;&gt;apacite&lt;/a&gt; provides APA style instructions to bibtex.&lt;/li&gt;
 &lt;li&gt;&lt;b&gt;Slide Creation&lt;/b&gt;: &lt;a href=&quot;http://latex-beamer.sourceforge.net/&quot;&gt;beamer&lt;/a&gt; is a commonly used tool to produce slides using LaTeX&lt;/li&gt;
 &lt;li&gt;&lt;b&gt;Spell checker&lt;/b&gt; for LaTeX in Eclipse: &lt;a href=&quot;http://www.homik.de/think/index.php/2008/01/08/latex-with-eclipse-on-windows/&quot;&gt;Martin Homik provides some suggestions.&lt;/a&gt;&lt;b&gt;&lt;br /&gt;
 &lt;/b&gt;&lt;/li&gt;
 &lt;li&gt;&lt;b&gt;R and Psychology&lt;/b&gt;: My post on &lt;a href=&quot;http://jeromyanglim.blogspot.com/2009/06/learning-r-for-researchers-in.html&quot;&gt;Getting Started with R&lt;/a&gt; for researchers in Psychology&lt;/li&gt;
 &lt;li&gt;&lt;b&gt;Options for Collaborating with Non Latex Users: &lt;/b&gt;&lt;/li&gt;
  &lt;ul&gt;
  &lt;li&gt;Export Sweave document to HTML (e.g., R2HTML). &lt;/li&gt;
  &lt;li&gt;Use &lt;a href=&quot;http://cran.r-project.org/web/packages/odfWeave/index.html&quot;&gt;odfWeave&lt;/a&gt;. It&#39;s like Sweave, but it&#39;s for Open Office. &lt;/li&gt;
  &lt;li&gt;Convert LaTeX generated pdf to HTML.&lt;/li&gt;
  &lt;/ul&gt;
&lt;/ul&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/7337823434311736628'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8909074830238091680/posts/default/7337823434311736628'/><link rel='alternate' type='text/html' href='http://jeromyanglim.blogspot.com/2010/02/getting-started-with-sweave-r-latex.html' title='Getting Started with Sweave: R, LaTeX, Eclipse, StatET, &amp; TeXlipse'/><author><name>jeromyanglim</name><uri>http://www.blogger.com/profile/12949204812496382042</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry></feed>