Rasmus <ras...@gmx.us> writes:

> Rafael <rvf0...@gmail.com> writes:
>
>> I'm trying to publish some beamer presentations with mathematical
>> content as pages in octopress. I think I'm on my way to get a working
>> setup, but I would like some help to achieve the following:
>>
>> With an up-to-date org (from git), define some functions that, when
>> exporting to markdown with ox-md, automatically replace all instances of
>> \(, \), \[ and \] with $$.
>>

> You want to look into filters, probably
> org-export-filter-latex-fragment-functions and
> org-export-filter-latex-environment-functions.  They are listed in
> ox.el.  It should be fairly easy to deal with in your case with
> regexp.

Thanks, I finally came up with:

(defun my-math-replacement (contents backend info)
  (when (eq backend 'md)
    (replace-regexp-in-string "\\\\(\\|\\\\)\\|\\\\\\[\\|\\\\\\]" "$$" contents)
    ))

(add-to-list 'org-export-filter-latex-fragment-functions
     'my-math-replacement)

Too bad the backend is not named "'markdown" (I suffered a lot with my
filters not working because of this! ;-) )

Reply via email to