Skip to content

Instantly share code, notes, and snippets.

@nozma
Created May 7, 2011 17:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nozma/960665 to your computer and use it in GitHub Desktop.
Save nozma/960665 to your computer and use it in GitHub Desktop.
はてダのtex記法をgoogle chart apiを使った数式表現に変換&逆変換
;; latex数式をgoogle chart apiを使った数式表現に変換
(defun latex-to-google-chart-api ()
(interactive)
(replace-regexp "\\[tex:\\(.*?\\)\\]"
(query-replace-compile-replacement
"<img src=\"http://chart.apis.google.com/chart?cht=tx&chl=\\,(url-hexify-string \\1)\"/>" t) nil (point-min) (point-max)))
(global-set-key "\C-c\C-l\C-t" 'latex-to-google-chart-api)
;; 逆変換
(defun google-chart-api-to-latex ()
(interactive)
(replace-regexp "<img src=\"http://chart.apis.google.com/chart\\?cht=tx&chl=\\(.*?\\)\"/>"
(query-replace-compile-replacement
"[tex:\\,(url-unhex-string \\1)]" t) nil (point-min) (point-max)))
(global-set-key "\C-c\C-t\C-l" 'google-chart-api-to-latex)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment