harto ocio y otras cosas

Algunas pocas cosas

Nibbleblog plugin mathjax

05 junio, 2015 | Código

I have created a plugin for nibbleblog that let you write $\LaTeX$ code on your page or post based on this 3 links you can access at the end of this page.

Explanation

Its very simple, using (1) i created a plugin called mathjax where i use the code of reference (2) and finally i added the snip code that hide loading message of mathjax using reference (3).

code in plugin.bit

public function blog_head()
{
$url_mathjax ='<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>';
$code_mathjax = '<script type="text/javascript">
MathJax.Hub.Config({
extensions: ["tex2jax.js","TeX/AMSmath.js","TeX/AMSsymbols.js"],
jax: ["input/TeX", "output/HTML-CSS"],
tex2jax: {
inlineMath: [ [\'$\',\'$\'], ["\\(","\\)"] ],
displayMath: [ [\'$$\',\'$$\'], ["\\[","\\]"] ],
processEscapes: true
},
HTML-CSS: { availableFonts: ["TeX"]},
messageStyle: "none"
});
</script>';

return $url_mathjax.$code_mathjax;
}

this add the js file and script inside the header tag. 

You can see the complete code here https://github.com/felipinbombin/nibbleblog/tree/master/plugins/mathjax

Future updates

if you have one that you like to see in the future, send me an email :-) (look at the botton)

References:

  1. http://docs.nibbleblog.com/post/creating-a-simple-hello-world-plugin/
  2. http://tberg.dk/post/how-to-use-latex-on-nibbleblog/
  3. http://www.mathjax.org/

Comentarios

comments powered by Disqus