thoughts in plain text

my thoughts about software engineering, startups, science and people

Scientific Octopress: Writing LaTeX Formulas and R Code

I like blogging platform Octopress, the product is very flexible and also could be hosted even on Github. For my old posts, I’ve added different custom changes to support variety of types of contents and to have a nice design. Basically, for programming posts it’s enough, you could even easily use Github gist for hosting code snippets from posts and lots of other interesting features. But, honestly, it’s only for the programming part of me.

From another side, I do like to read some nice researches and every nice research has solid math behind, that make that paper even more elegant. So my task for today is to be able to share some ideas with possible math proofs of them or even some based papers.


To render markdown, Octopress uses the rdiscount library, but it doesn’t support LaTeX. I decided to use kramdown library to parse TeX code. For this we need to add

gem 'kramdown'

into our Gemfile. Also in _config.yml markdown interpretator option must ben replace with

markdown: kramdown

And the last step, we need to add JavaScript library to render our math formulas. MathJax is a good library to render such LaTeX and MathML. We need to add next code into source_layouts\default.html

Now we could write things like this

That would be transformed into this

Figures and formulas from R code

With automatic generation of figures and blog posts based on R code, I’d like to postpone. Because with my current Windows machine it doesn’t sounds like fun. I’m going to post another update with configuration of such environment, based on R, knitr and a couple more scripts. Stay tuned!