# WordPressing scientific stuff

I found two things today:
1. You can highlight code on WordPress. Here’s the guide and an example -the pythonic HelloWorld:

print "Hello world!"


2. You can write LaTeX in you WordPress blog in order to publish nice little equations (paraphrasing Jonathan Geffen in his poem “Thunders and Lightnings”, you seldom get to meet nice big equations). Here’s the guide and an example – the famous Fisher’s fundamental theorem of natural selection:

$\frac{d\bar{\omega}}{dt} = Var(\omega)$

###### P.S

If you need a tool for experimenting with LaTeX, Texify is very useful.

# Search Google Scholar using a bookmarklet

This bookmarklet* allows you to search Google Scholar, one of the leading search engines for academic manuscripts and publications.

To use it, you simply highlight some text in your browser and click the bookmarklet, and the next thing you know you’re looking at a Scholar page with the highlighted text as a search query.

I wanted to simply give you a link that you drag to your bar, but WordPress won’t allow JavaScript in links.

So, there are two options left to get the bookmarklet:

1. Go to this web page and grab the bookmarklet from there.
2. Create a new bookmark in your browser, give is whatever name you’d like (I use Search Scholar) and paste the following in the bookmark address (note this might be an older version of the bookmarklet):
javascript:q=document.getSelection();if(!q)void(q=prompt('Keywords:',''));if(q)location.href='http://scholar.google.com/scholar?as_q='+escape(q);


*If you don’t know what a bookmarket is, you should RTFM it right now, seriously.

I’ll show you how to create an RSS feed to get alerts when your favorite scientist publishes new papers (this might only work for life sciences publications).

1. First decide which scientist you want to follow. For my example I will use Richard E. Lenski – he’s an evolutionary biologist that does really cool stuff.
2. Now go to PubMed – that’s an aggregator/indexer of life science and medicine publications.
3. In the search box at the top, type, including the apostrophes: "Lenski RE"[Author] and press Search.
4. You’ll get a list of Lenski’s publications, recent first.
5. Now click the  icon at the top, just below the search box.
6. Choose the maximum number of item in the drop down menu (100).
8. Now right-click the  icon, and choose Copy Address or something like that (Copy Link?). Alternatively, you can just left-click the  icon, go to the new tab that opened, select the URL address and copy it.
10. Click the Subscribe button (if it’s not Google Reader, you’d have to RTFM to find out how to subscribe to a new feed).
11. Paste the URL you copied from PubMed.
12. Now you can rename the feed and put it in some folder – I name it Lenski RE and place it under Paper Alert folder.
That’s it, you’ll never again miss a paper by your favorite authors. That’s a relief.

I imagine this procedure can be adapted for other scientific publications aggregators (Mendeley? Google Scholar?) but if you’ll want to do that you’ll have to RTFM.

# Adding a scale label to an axis in Mathematica

This is a trick that eluded me for a few days but finally I managed to RTFM it.

There’s no built-in option for this but it is easy to do once you know how.

Normally you would do this with AxesLabel->{"xlabel","ylabel"}.

But what do you do when you use a frame (Frame->True)? Which is what you would do when you prepare a good looking figure…

FrameLabel->{"xlabel","ylabel","x2label","y2label"} appear in the middle of the axes, as they should as they tell you what the axes are about.

But if you also want an axis scale, like 10^4 or 10^-5 then you need to use the following (for a y-axis label):

Show[ Plot[ E^x, {x,0,10}, PlotStyle->Black, BaseStyle->{FontSize->12,FontWeight->Plain,FontFamily->"Calibri"}, Frame->True, FrameLabel->{"Time","Distance"}, FrameTicks->{Automatic,{0,{2000,"2"},{4000,"4"},{6000,"6"},{8000,"8"}},None,None}, Epilog->Inset["10^3", ImageScaled[{0.03,0.97}]], PlotRangeClipping->False ],ImageSize->400] 

The important commands are in red.

FrameTicks allows you to choose which ticks are labeled but also HOW they are labeled – 2 instead of 2000, etc.

Epilog allows you to add some graphics to the plot.

Inset is… well here it allows you to add some text.

ImageScaled is a clever way to position the text. Usually you just give a couple of coordinates based on the plot axes (like 0,0 for something that will appear on the origin). But with ImageScaled you can position something on the whole image, and not just inside the plot area.

PlotRangeClipping is an important option to use, because it allows things outside of the plot area to be displayed instead of clipped.

Here’s the result:

Fig. 1 – The exponential function

All the options and functions used (marked as code) can be easily RTFMed in Mathematica’s online documentation.

I’ve used Mathematica 8 so I’m not sure how these things respond to older versions.