Loading [MathJax]/extensions/TeX/AMSsymbols.js

Wednesday, March 23, 2016

sed Converter for LaTeX Math Modes

In jupyter/iPython LaTeX markdown, I have many files that use the "$" and "$$" tags for math mode.

Sometimes, I liked to cut and paste stuff from there into Blogger. I have set my Blogger MathJax preferences to "slash-parentheses" and "slash-square-brackets" for "$" and "$$", respectively.

The following sed script lets me quickly do the conversion:

sed -r 's/\$\$([^$$]*)\$\$/\\[\1\\]/g' INPUTFILE | sed -r 's/\$([^$]*)\$/\\(\1\\)/g'
As as example consider the following:

No comments: