emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Exporting Source Blocks with Symbols


From: Michael Gauland
Subject: Re: [O] Exporting Source Blocks with Symbols
Date: Sun, 17 Jan 2016 20:10:55 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Just following up with my solution, in case anyone else is interested
(thanks to John Kitchin for pointing me in the right direction). First, I
should note that 'µ' exported correctly because I was using the unicode
element 'MICRO SYMBOL' instead of 'GREEK SMALL LETTER MU' (which looks the
same, but doesn't export).

The 'listings' package can only handle 8-bit characters, but you can tell it
to escape to LaTeX. The code block below adds a hook to escape the
characters I'm interested in, and adds the listing option to identify the
escape character (a symbol I've never used for anything else).

This code could certainly be improved, but it serves my needs, and may be
useful as a starting point for anyone trying to do something similar.
--Michael Gauland

#+BEGIN_SRC emacs-lisp :session :results value silent :exports none
;; Set up a filter to preserve greek symbols in code blocks
(setq org-export-filter-src-block-functions
      (list
        (lambda (text backend info)
           (replace-regexp-in-string "\\([σβ]\\)" "§$\\1$§" text))))
           
(setq org-latex-listings-options '(("escapechar" "§")))
#+END_SRC


reply via email to

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