Blog 1

Random Talk on Random Thoughts

MathJax and RSS

| Comments |

Motivation

In the past, I used double dollar signs $$ to enclose block equations. As a result, readers couldn’t see them in Firefox.

old

How can these missing parts be put back to the RSS feeds?

Method

I didn’t know how to use

  1. typeset curly brackets {} using MathJax without using $$ to surround the brackets. If only one $ was used, then it would fail. For example, $\{a_k\}$ wouldn’t work.
  2. inline display mode for summation, limit, etc.
  3. \[ and \] to surround block equations in Octopress.

Now, I know that kramdown parses the Markdown source code for a post before MathJax does. Therefore, to mean a backslash ‘\’, one needs to “double the effort”. (i.e. use \\{a_k\\} for $\{a_k\}$) Moreover, I have to use backslash ‘\’ to escape askterisks * and underscores _.

Before I upgraded to Ruby 2 and updated my Octopress source code1, $\displaystyle \lim_{k \to \infty} \frac{1}{k} = 0$ didn’t work. Now, I can insert inline display equations like $\displaystyle \lim_{k \to \infty} \frac{1}{k} = 0$.

With reference to an example on the MathJax CDN, I’ve learnt to use begin{equation} just like what $\rm \LaTeX$ users do.2 When using it, there’s no need to use $$ to surround it.

Viewing MathJaxLocal.js on DrZ.ac, I know why I couldn’t use \[ for a block equation—I didn’t add it to the corresponding list of delimiters in displayMath. Actually, at that line, the whitespace character between two square brackets [ aren’t necessary.3

While editing a multi-line block equation in a post about the Contraction Mapping Principle, I encountered a technical problem: there’s no newline character in the equation. I could just see one very long line. To see how the code was interpreted, I made a screenshot of Firefox before MathJax loaded.

interpreted MathJax code

It was evident that putting four backslashes at the end of lines for a line break wasn’t enough. Therefore, I put two more backslashes there. This time, the page for an individual post was OK, but the contents in the blog index page and those under folder /posts/ wasn’t. I viewed the “$\rm \TeX$ Commands” from the popup menu, and saw that in the page for an individual post, two backslashes were found; at /posts/* and the blog index page, only one backslash was found.

By trial, I finally used eight backslashes in the Markdown source files for a post for a line break.

Result

new

The source code for a block equation can now be seen in RSS feeds.


  1. See Updated Octopress Source Code in Blog 1 for details. 

  2. View the source of A Test of Equation Numbering for details. 

  3. See $\rm \TeX$ and $\rm \LaTeX$ math delimiters in MathJax Documentation for details. 

Comments