emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Michael Gauland <mikelygee@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Exporting Source Blocks with Symbols
Date: Sun, 17 Jan 2016 20:10:55 +0000 (UTC)	[thread overview]
Message-ID: <loom.20160117T210253-562@post.gmane.org> (raw)
In-Reply-To: loom.20160114T053828-815@post.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	other threads:[~2016-01-17 20:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-14  4:45 Exporting Source Blocks with Symbols Michael Gauland
2016-01-17 20:10 ` Michael Gauland [this message]
2016-01-20  2:26   ` Grant Rettke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20160117T210253-562@post.gmane.org \
    --to=mikelygee@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).