Hi, Habr.
The question of the native display of formulas on Habré has been around for a long time (I myself wrote to tech support with this question not so long ago, I received an answer that I have plans, but so far everything is very uncertain), and today (or, more precisely, already yesterday) was raised in the comments to "The
Magic of Tensor Algebra: Reboot ". And if you look at the
LaTeX hub , then immediately the last 2 articles are about the design of formulas in habr articles.
The most interesting thing is that, in principle, to connect TeX / LaTeX support to any site is a matter of a couple of minutes and a couple of lines of code: you just need to connect MathJax, which has become almost standard in the task of displaying formulas in the browser.
')
Traditionally, for formulas on Habré, images are used, but all of the above suggests a well-defined idea that there is another type of crutches. On the one hand, less convenient, on the other - more.
...
Here he is:
v=document.createElement('script');v.type='text/x-mathjax-config';v.textContent="MathJax.Hub.Config({tex2jax:{inlineMath:[['$tex','$']],displayMath:[['$$tex','$$']]},asciimath2jax:{delimiters:[['$asc','$']]}});";s=document.createElement('script');s.src='//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML&locale=ru';document.head.appendChild(v);document.head.appendChild(s);
Ctrl + C, F12 and Ctrl + V.
If you wish, you can use it as a bookmarklet by adding `javascript:` at the beginning
The audience of habr is not the kind of people who can be frightened by the browser console or bookmarklet, right?
Inline TeX is inserted into
$tex ...$
, a separate paragraph is inserted into
$$tex ... $$
, and in addition there is support for
AsciiMath in
$asc ... $
.
Well, living examples of course:
$$ tex \ frac {1} {\ pi} = \ frac {2 \ sqrt 2} {9801} \ sum_ {k = 0} ^ {\ infty} \ frac {(4k)! (1103 + 26390k)} { (k!) ^ 4 396 ^ {4k}} $$
Or here is the inline formula: $ tex e ^ {\ frac {d} {dt}} = 1 + \ frac {1} {1!} \; \ frac {d} {dt} + \ frac {1} {2!} \; \ frac {d ^ 2} {dt ^ 2} + \ frac {1} {3!} \; \ frac {d ^ 3 } {dt ^ 3} + \ cdots $.
The disadvantages of all this are no less obvious, and, in truth, make one doubt the viability of the idea, but at least as an experiment, it is interesting, IMHO. What do you think?