- Conversion Tools and Pandoc: After switching from MathJax to MathML on ANIAT, the author tried various conversion utilities and libraries but found them limited. Eventually, started using Pandoc. It's easy to use with single equations like
pandoc --mathml <<<'$$T = \frac{1}{2} v_x^2$$'
. Single dollar signs generate MathML withdisplay="inline"
. - Handling Different Equations: All converters handled simple equations well, but more complicated stuff like multiline equations was troublesome. Pandoc handled multiline equations easily, such as the piecewise function definition. It can also handle matrices like
k = EAL\[1−1−11\]
. - Bug in Pandoc Conversion: Found a small bug in Pandoc's conversion from LaTeX to MathML. For a formula with both summation and limit, the limit was formatted incorrectly. The
n→∞
part was not under thelim
as it should be. Removing an empty<mo></mo>
element after<mi>lim</mi>
fixed the issue. - Adding MathML to Blog Posts: Uses Markdown's ability to mix HTML with regular text. Writes equations in LaTeX, selects them, and runs a Keyboard Maestro to replace with MathML equivalent. Includes a Python script to run Pandoc for conversion and clean up output. The script gets LaTeX from stdin, passes it through Pandoc, parses the HTML with BeautifulSoup, and removes unnecessary elements and attributes.
- Improvement Areas: Not happy with the need to select the equation before conversion. Thinks to use BBEdit's AppleScript library to control the cursor and make selection before sending text to the Python script, but not sure about cursor position.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。