Code display in scholarly journals

Code in journals, that is, code you would type to do some programmatic operation in say R or Python, is kind of a mess to say the least. Okay, so you can SEE code in papers, but code is not formatted in a way that facilites reuse. If an author in a paper writes out some code for software they create, or an analysis they do in the paper, wouldn’t it be nice for a reader to be able to copy and paste that code directly into whatever environment that code should execute in, and actually work. Of course there is dependencies, etc. for that software to worry about, but here I am just concerned with the code formatting in articles. Code is displayed as an image in some cases (gasp!). Additionally, there’s this thing called the internet, and we can use color, so let’s highlight code already. At least in one of our recent rOpenSci papers in F1000 Research, they do use syntax highlighting - w00t! ...

October 25, 2013 · 2 min · Scott Chamberlain