Saturday, June 23, 2012

Generating latex-style figures using gnuplot

In a figure, it would be nice that the fonts and formula styles are consistent with the main text. For my case, the main text is in LaTeX, and the plot is generated using gnuplot. Here is how to:

Wednesday, June 6, 2012

PDF annotation in Okular

Finally it arrived. With the Okular coming with KDE SC 4.9 (currently in beta status) and poppler 0.20, annotations in PDF can now saved in Okular and shared with other PDF readers (tested in acroread).

Previously, I knew I could use wine applications; I knew I could use complicated tools like pdfedit; I knew I could edit PDF as drawings and then export; I knew on Evince PDF can be annotated (limited support, cannot remove, sometimes annotations can get lost). But this is the first time that PDF annotation is available for real usage on Linux.

For me, this was the last thing (except gaming) that one could easily do in Windows and not in Linux. Now the gap is filled :)

Thursday, May 31, 2012

See which papers gain new citations

Used an hour to write a 93-line python code, parsing inspires to see which papers got new citations since last check. Works like this:
1 ( 2 )  Quasi-Single Field Inflation with Large Mass
2 ( 2 )  Odd-dimensional de Sitter Space is Transparent
3 ( 2 )  Chain Inflation Reconsidered
4 ( 8 )  Angular 21 cm Power Spectrum of a Scaling Distribution of Co
5 ( 111 )  Dark Energy

... ...
39 ( 12 )  Inflation with High Derivative Couplings

Papers with citations:  39 ;  Citations:  1083

110  =>  111  in  Dark Energy
Save citations (default yes, type n otherwise)?
Citations saved.

Monday, April 16, 2012

Move personal bindings to Hyper- in emacs

I guess everybody who heavily use emacs has a number of his / her own key-bindings. Unfortunately, personal key-bindings (if not too long) could conflict with system ones. If not in one mode, it would happen in another mode.

Now I am happy with my solution: I map left alt to Hyper, and  then bind everything personal to Hyper. The mapping can be done in xmodmap: create a file, say, .Xmodmap, with
clear Mod1
add Mod1 = Alt_L
add Mod3 = Hyper_L
add Mod4 = Super_L
keycode 108 = Hyper_L
Then run xmodmap .Xmodmap (and put it to startup applications so it runs every time when login).

Then in .emacs, set every key-binding you like with Hyper (I set a lot of them. Here are only some samples):
(global-set-key (kbd "H-g") 'goto-line)
(global-set-key (kbd "H-l") 'forward-char)
(global-set-key (kbd "H-h") 'backward-char)
(global-set-key (kbd "H-j") 'next-line)
(global-set-key (kbd "H-k") 'previous-line)
(global-set-key (kbd "H-\\") 'math-eval)
(global-set-key (kbd "H-p") 'my-org-screenshot)
(global-set-key (kbd "<H-SPC>") 'save-buffer)
(global-set-key (kbd "<H-escape>") '(lambda ()   (interactive)   (kill-buffer (current-buffer))))
Another advantage is that I press left alt using thumb. Thumb is much stronger than little figure for frequent use :)

Monday, March 26, 2012

Run mathematica commands in emacs

I would like the following feature: When writing a document in emacs (say, a LaTeX paper), I can write the original expression in a comment line, then execute and get the answer. The idea is to send a string from emacs to a shell script, which runs Mathematica kernel

Here is the realisation:

Monday, March 12, 2012

Cosmic inflation is a form of life?

Cosmic inflation (more precisely, the Hubble patch which is undergoing inflation) is a form of life? Clearly not in common sense. However, according to Wikipedia: Life is a characteristic of organisms that exhibit all or most of the following 7 phenomena: