|Sunday, November 24, 2013||(Comment)|
Using MathJax with a ‘Classic’ Blogger template
The LVRG Blog, like
this one, uses a “Classic” Blogger™ template. The
and Pigou: crypto-Georgists” (LVRG Blog, Sep.19,
2013) uses MathJax to render
mathematical symbols and equations. These are written
in LaTeX commands mixed with the HTML source file, except
that the delimiters for inline equations are
\(’ and ‘
because dollar signs are not accepted in the default mode. The usual
delimiters for displayed equations also work. All LaTeX
commands must be enclosed in such delimiters, even if they would not
be so enclosed in a pure LaTeX source file.
The first script enables automatic numbering of equations (although
in the post in question, because the equations are all quoted, I've
chosen to number them manually with the
command).* The second script specifies that the input is
in TeX/LaTeX and the output in HTML/CSS
options are available, but I find the HTML/CSS output more
That's all there is to it!
The above code can be inserted anywhere in the page. But inserting it just before it is needed will allow earlier parts of the page to be displayed with minimum delay, and later parts with minimum jitter.
It is also possible to include the necessary code in the blog template — at the top of the <head> tag — making the scripts available in every post. I have not done it that way, for the following reasons:
- Because my main page is limited to a table of contents, inserting the code in multiple posts will not cause it to be loaded multiple times on the main page.
- By inserting the code only in the posts in which it is needed, I avoid any risk of interference with older posts that don't use MathJax.
- If I want to see the equations while composing a post on the local hard drive, I need the scripts in the post itself; so I might as well leave them there.
N.B.: The above remarks are applicable to Blogger™ with “Classic” templates. They are not necessarily applicable to newer templates or other blogging platforms.
* Update (9 December 2013): For a more thorough demonstration, with automatically numbered equations referenced by labels, see “A self-contained derivation of Kepler's laws from Newton's laws”.
|Tweet||Return to Contents|