[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] How to replace \( by $$ and such when exporting to markdown

From: Rafael
Subject: Re: [O] How to replace \( by $$ and such when exporting to markdown
Date: Tue, 18 Feb 2014 22:42:50 -0600
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3 (gnu/linux)

Rasmus <address@hidden> writes:

> Rafael <address@hidden> 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

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]