The Living Thing / Notebooks :

Digital scientific workbooks

Literate coding for reality

The exploratory-algorithm-person’s IDE-equivalent. Literate coding-meets-science.

Let’s say I want to demonstrate my algorithm to my thesis advisor while he’s off at conference. I need an easily shareable demonstration. that’s why we have the internet, and scientific computation/documentation system such as knitr and Jupyter. Why do this? To belatedly fulfill the prophecy that the scientific paper is dead

See also text editors, citation management, academic writing workflow, python, cloud computing a.k.a. cloud wrangling, open notebook science, scientific computation workflows, build tools.

Contents

Editor/IDE support

Miscellaneous preview support scripts are given in the knitr documentation.

Atom

Atom supports a number of literate programming tools via language-weave package - you might also want a full typesetting experience via the latex or atom-latex package, which can be made to support literate coding of plain latex. It uses Hydrogen to provide code preview.

Setting up a latex toolchain in atom-latex is not too bad. E.g. here is one for knitr:

{
  "root": "path/to/my/file.Rnw",
  "toolchain": "Rscript -e \"library(knitr); knit('%DOC.%EXT')\" && latexmk -synctex=1 -interaction=nonstopmode -file-line-error -pdf %DOC",
  "latex_ext": [".Rnw"]
}

It would probably also work for pweave or Weave.jl.

Python

See also jupyter wherein there are some bonus notes about the technical details of this.

Pweave

Pweave, by Matti Pastell, is a clone of knitr:

Pweave is a scientific report generator and a literate programming tool for Python. It can capture the results and plots from data analysis and works well with numpy, scipy and matplotlib.

Max Masnick gives a detailed set up.

ipypubish

Chris Sewell has produced a scripted called ipypublish that eases some of the pain points in producing articles starting from jupyter. See the comments for some additional pro-tips for this.

Quibble: Some of his neat citation workflow (although not the whole package) depends on zotero version 4.0, which was replaced by 5.0. So the golden age this ushers in may be short-lived unless someone wants to step in to fix up the betterbibtex plugin.

Julia

weave.jl

# capturing code output

The code chunk wil be run with default options and the output captured.
<<>>==
using Gadfly
x = linspace(0, 2* pi)
println(x)
plot(x = x, y = sin(x)
@

R

knitr is the r-based entrant in the scientific workbook field.

Here are some guides:

For online web-friendly (e.g. teaching) purposes, you can do literate interactive coding using shiny and latex via shinytex.

MATLAB