emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to replace \( by $$ and such when exporting to markdown
@ 2014-01-26 23:10 Rafael
  2014-01-27  1:33 ` Rasmus
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael @ 2014-01-26 23:10 UTC (permalink / raw)
  To: Emacs-orgmode list


Hi all,

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 $$.

Thanks in advance for any help.

Rafael

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to replace \( by $$ and such when exporting to markdown
  2014-01-26 23:10 How to replace \( by $$ and such when exporting to markdown Rafael
@ 2014-01-27  1:33 ` Rasmus
  2014-02-19  4:42   ` Rafael
  0 siblings, 1 reply; 3+ messages in thread
From: Rasmus @ 2014-01-27  1:33 UTC (permalink / raw)
  To: emacs-orgmode

Rafael <rvf0068@gmail.com> writes:

> Hi all,
>
> 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 $$.
>
> Thanks in advance for any help.

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.

–Rasmus

-- 
Together we'll stand, divided we'll fall

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to replace \( by $$ and such when exporting to markdown
  2014-01-27  1:33 ` Rasmus
@ 2014-02-19  4:42   ` Rafael
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael @ 2014-02-19  4:42 UTC (permalink / raw)
  To: emacs-orgmode

Rasmus <rasmus@gmx.us> writes:

> Rafael <rvf0068@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! ;-) )

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-19  4:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-26 23:10 How to replace \( by $$ and such when exporting to markdown Rafael
2014-01-27  1:33 ` Rasmus
2014-02-19  4:42   ` Rafael

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).