Test-driving MathJax with Write.as
One reason I chose Write.as as my blogging platform is great support for technical writing with Markdown and MathJax.
I use Markdown all the time but haven't played with MathJax much, which I may need for some occasional simple math. So this post is a quick overview of how I write MathJax and what it renders like.
Editing and previewing MathJax
I love Write.as, but it has a few rough edges that introduce friction when writing MathJax.
There's no post preview and the only workaround, publishing an anonymous post and moving it to my blog when satisfied, doesn't render MathJax. This forces to go blind. Until a post shows up on the blog and I can fix any formatting issues, in the few minutes since publication and prior to the newsletter and the RSS feed entry going out.
I came up with an alternate workflow. I edit the math in the Interactive LaTeX Editor. This nice little tool supports MathJax, renders as I type, and has no ads.
Once the LaTeX source looks good, I copy the code from the LaTeX editor and paste it into the Write.as editor. If some LaTeX symbols have meaning in Markdown, such as _
, *
, and \
, I have to go the extra step of escaping them with \
.
At this point I'm ready to publish the post and tweak the math as described earlier.
MathJax examples
Time to kick the tires.
Let's start with some inline big \(O\) notation, say an algorithm that's \(O(n \ln n)\). I also throw in some binary numbers such as \(10010101_2\) and \(11010111_2\), and a simple calculation like \(2^{16} = 65536\).
Here is a displayed logical operation:
$$00000101_2 \wedge 00001100_2 \Rightarrow 00000100_2$$
The quadratic formula renders like this:
$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}$$
Finally, the standard deviation:
$$\sigma = \sqrt{ \frac{1}{N} \sum_{i=1}^N (x_i -\mu)^2}$$
Discuss... Email | Reply @amoroso@fosstodon.org