From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rafael Subject: Re: How to replace \( by $$ and such when exporting to markdown Date: Tue, 18 Feb 2014 22:42:50 -0600 Message-ID: <86txbv4ss5.fsf@gmail.com> References: <867g9mpcei.fsf@gmail.com> <87ob2yxl74.fsf@gmx.us> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59137) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFyzr-0003jl-Ro for emacs-orgmode@gnu.org; Tue, 18 Feb 2014 23:43:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WFyzm-0003lj-1b for emacs-orgmode@gnu.org; Tue, 18 Feb 2014 23:42:59 -0500 Received: from mail-pd0-x230.google.com ([2607:f8b0:400e:c02::230]:51677) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFyzl-0003lX-Qj for emacs-orgmode@gnu.org; Tue, 18 Feb 2014 23:42:53 -0500 Received: by mail-pd0-f176.google.com with SMTP id w10so17134508pde.7 for ; Tue, 18 Feb 2014 20:42:52 -0800 (PST) Received: from lahp ([189.142.3.198]) by mx.google.com with ESMTPSA id sx8sm157009446pab.5.2014.02.18.20.42.50 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 18 Feb 2014 20:42:51 -0800 (PST) In-Reply-To: <87ob2yxl74.fsf@gmx.us> (rasmus@gmx.us's message of "Mon, 27 Jan 2014 02:33:35 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Rasmus writes: > Rafael 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! ;-) )