Skip to content

Instantly share code, notes, and snippets.

@hamen
Created June 25, 2009 18:29
Show Gist options
  • Save hamen/136064 to your computer and use it in GitHub Desktop.
Save hamen/136064 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand({
name: "latex",
description: "Write LaTex and render it with mimetex ",
help: "Write down some LaTex statement, i.e. \frac{1}{S^2 - 1}",
author: {name: "Ivan Morgillo", email: "imorgillo [at] sanniolug [dot] org"},
license: "GPL v3",
homepage: "http://hamen.org",
arguments: {object: noun_arb_text},
preview: function(pblock, args) {
var postdata = args.object.text;
var url = "http://operaez.net/mimetex/";
if(postdata != ""){
CmdUtils.previewGet(pblock, url, postdata, function(data){
pblock.innerHTML = "Get this image <table bgcolor='white'><tr><td><img src=http://operaez.net/mimetex/\\HUGE{" + postdata + "}></td></tr></table>http://operaez.net/mimetex/\\HUGE{" + postdata + "}";
});
}else{
pblock.innerHTML = "Write down some LaTex stuff";
}
},
execute: function(args) {
var postdata = args.object.text;
Utils.openUrlInBrowser("http://operaez.net/mimetex/\\LARGE{" + postdata + "}");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment