Emacs: AucTeX + Rubber + Sweave

I got rubber to work with AucTeX and Sweave (Rnw) files with the help of this.

Basically, combined with my other stuff, I tweaked my .emacs file to look like:

;;following is AucTeX with Sweave -- works
;;http://andreas.kiermeier.googlepages.com/essmaterials
(setq TeX-file-extensions
 '("Snw" "Rnw" "nw" "tex" "sty" "cls" "ltx" "texi" "texinfo"))
(add-to-list 'auto-mode-alist '("\\.Rnw\\'" . Rnw-mode))
(add-to-list 'auto-mode-alist '("\\.Snw\\'" . Snw-mode))
(add-hook 'Rnw-mode-hook
(lambda ()
(add-to-list 'TeX-command-list
'("Sweave" "R CMD Sweave %s"
TeX-run-command nil (latex-mode) :help "Run Sweave") t)
(add-to-list 'TeX-command-list
'("LatexSweave" "%l %(mode) %s"
TeX-run-TeX nil (latex-mode) :help "Run Latex after Sweave") t)
;; following 3 lines for rubber, taken from same site as next paragraph, http://www.nabble.com/sweave-and-auctex-td23492805.html, xpdf to open
(add-to-list 'TeX-command-list
'("RubberSweave" "rubber -d %s && open '%s.pdf'" 
TeX-run-command nil t) t) 
(setq TeX-command-default "Sweave")))

;; AucTeX with rubber
;;http://www.nabble.com/sweave-and-auctex-td23492805.html
(eval-after-load "tex"
 '(add-to-list 'TeX-command-list
 ;;'("Rubber" "rubber -d %t && xpdf '%s.pdf'" TeX-run-command nil t) t)) ;; change by vinh
 '("Rubber" "rubber -d %t && open '%s.pdf'" TeX-run-command nil t) t))

Now, when an Rnw file is open, I can press C-c C-c, select Sweave. Then repeat, select RubberSweave (or LatexSweave).

LaTeX in blogger, pt 2

In my previous post on this topic, I didn’t get LaTeX to work in Blogger because forkosh closed their mimetex service to the public. For LaTeX to work in blogs, I would either have to switch to wordpress or get my own host and install mimetex. The First option wasn’t too appealing as I’d like to keep everything google since a lot of my personal services are hosted here (yes, I’m not afraid of google having too much information about myself). Second option also wasn’t feasible. I found out from some more searching that codecogs is generous enough to host this kind of service. I updated wolverine’s script in firefox/greasemonkey with this, and now I have an UnLaTeX button as well! Really cool. To use, in compose mode in blogger, type dollar sign dollar sign LaTeX code dollar sign dollar sign, then hit the latex button. Bamm! To see original code, hit UnLatex. Here is an example.

http://www.codecogs.com/gif.latex?%5Csum_%7Bi=1%7D%5En%20%5Clog%20f(x_i%20;%20%5Ctheta)

Looks good ehh? Optimally I would like blogger to have a LaTeX feature, but this suffices for now. This is different than before because I now have an unlatex command. This is useful because when codecogs goes down I am able to recover the original LaTeX code.

Hopefully for “LaTeX in blogger, pt 3″ a native LaTeX feature in blogger will be available. UPDATE: forgot to mention that I found codeclogs on here first.

the next big thing from google: WAVE

Google just recently unveiled Google WAVE (keynote presentation at Google I/O 2009). I read it on the news, googled it, went to the blog, and watched the video.

The video is quite long (1+hr, 300+mb). I downloaded it and viewed it. Looks like it is Google’s next big product. Email has been invented for 40+ years. They are attempting to re-invent email as if it were invented in today’s time. As always, based on cloud computing (hosted by google), uses html5 as the platform. It combines email, photos, IM, discussion board, etc., all into one interface. The API is going to allow other sites to embed and use it as well. Super cool!

Open source graphics: GIMP + Inkscape + Graphviz

I just wanted to remind myself of some open source graphics programs that I use (or will/should use) from time to time:

  1. GIMP: analogous to Adobe photoshop, except it is open-source! I’m not artistic, so I only use it as a “Paint” program on steroids!
  2. Inkscape: mentioned this before, but it does vector graphics (as opposed to the raster / pixels-based graphics). Looks cool but haven’t really used it. I will use it someday since you can type LaTeX on the graphics!
  3. Graphviz: Downloaded this before and did try it out. Good for drawing graphs (point to point) and structural diagrams, like an organizational chart, a flow chart, and similar things.

All three deserve praise.

plots: chemical structure diagrams

For some reason I’ve been wanting to learn how to make chemical structure diagrams. I have no use for them, but I just want to know how to draw them on the computer. I found out the programs that make such diagrams are called “molecule editors.”

A quick search yielded a lot of proprietary software, but a few open source (free) software popped up as well. I like BKChem because it is python-based and hence platform-independent. Who knows, maybe I’ll teach/tutor chemistry one day, or maybe I’ll collaborate with a chemist. BKChem might come in handy then.

Google gadgets

One thing I’ve recently discovered about Google are the gadgets. I knew they existed, but I don’t use the iGoogle page that often for me to use them. However, I use gmail 24/7, so I added some there. They even have gadgets for Blogger.

Getting information and learning: google + wikipedia + wikibooks + wolfram alpha

When I want to find information, Google is my #1 resource. The syntax trick I use most which I learned in the research writing class (Writing 39C) at UCI is “The first word is the most important” (the first word narrows the search!). Some other tricks are “- Don’tWantThisWord” and ‘ “this quote exactly” .’ Google usually leads me to Wikipedia, an online collaborative encyclopedia, or Wikibooks, an online collection of collaborative textbooks, for my answers. These three resources are where a lot of my learning/review of statistics are found.

There is Google Knol but I don’t use it much (probably because my google search doesn’t yield these articles).

For academic articles, I search on google, but to restrict the results to just academic articles, I’ve been relying on Google Scholar.

Last but not least, Wolfram Alpha was recently released by Wolfram, the maker of Mathematica. Haven’t used it much, but it seems promising. The few reviews that I’ve read said that the search is a little tricky…you have to input the right words. Well, they’re not google afterall.

LaTeX in blogger

You can type and display LaTeX typesets in your blogs. See this, this, and this. Requirements: Firefox + Greasemonkey and the script from here.

Write LaTeX code, highlight it, and hit the LaTeX icon.

Example: http://www.forkosh.dreamhost.com/mimetex.cgi?sum_%7Bi=1%7D%5En

As can be seen, this doesn’t work because I am relying on the forkosh server to generate the gif image everytime it is called. Guess we are relying on his server. If you have your own server, you can install mimetex.cgi and have your server do the work. However, you have to maintain it for 24/7 uptime.

Another way is this and this (this is a very similar method). However, if this server goes down then my online LaTeX code will also be dead.

Example:

Hmmm, WordPress.com has LaTeX built in, but I’m already using Blogger. Guess I haven’t found a good, viable solution for me yet.

Sage (again): everything math

I blogged about Sage in the past and stated that I won’t be using it much since R is my language/environment of choice. This is still true, but I wanted to write a few more comments about Sage after toying with it a bit more.

Sage is based on Python (good!) and its mission statement is

Mission: Creating a viable free open source alternative to Magma, Maple, Mathematica and Matlab.

I like it. If I need to solve an equation, factor, do partial fraction decomposition, do Taylor expansions, find derivatives, integrate, and all else math, Sage is there for me. It’s both free (open-source) and easy to use. The learning curve is pretty low if you want to do basic things like create examples for teaching Calculus. Plotting is also great but R is superior in my opinion. Sage graphics outperforms R graphics in one respect: it can include and display LaTeX equations natively (uses matlibplot, which is based on GNU-plot, I think). Sage also displays the vertical and horizontal axes in the center of a plot, similar to the graphs in textbooks I grew up with. Sage graphics seems more geared towards teaching whereas R is geared towards professional publishing.

Personally, I’ll use Sage when I teach stuff like Calculus where I need plots with axes and all other math features that R isn’t built for.

There is a sage mode for emacs, however, is in alpha mode as of now, so the features aren’t comparable to ESS is for R.

Another great thing about Sage is it has a notebook GUI that allows it to be run inside a web browser. Therefore, you can run a Sage server that allows users run Sage interactively! See this for example. You can run notebook() on your own computer or create an account on the previous site to test it out