emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Lei Zhe <lzhes43@gmail.com>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: How can I wrap the subscript into a math environment in Org-mode?
Date: Sun, 22 Nov 2015 17:51:40 +0900	[thread overview]
Message-ID: <CALjq+LZzXKDs0b3g6uZxaXEZzLuxwudtqdCbn3uFQs+oudqOoA@mail.gmail.com> (raw)

I have some subscripts in my org file like B_25, B_30. These
subscripts can be exported to LaTeX like B_{25}, B_{30}. However, I
want part of the subscripts like B to be exported as italic /B/. As
one solution for this, I can wrap these thing into a math environment
like \(B_{25}\). But since my file contains large numbers of these
subscripts, I would like to implement this in a programmable way.

I found a subscript filter function in org-mode, so I tried to use it
to wrap the subscripts by

(defun wrap-subscript-with-math-environment (contents backend info)
  (when (eq backend 'latex)
   (format "\\(%s\\)" contents)))

(add-to-list 'org-export-filter-subscript-functions
'wrap-subscript-with-math-environment)
However, the results exported are like B\($_{\text{25}}$ \). It seems
like the subscript filter contents only contain _25 part. Does anyone
have some solutions about this?

             reply	other threads:[~2015-11-22  8:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-22  8:51 Lei Zhe [this message]
2015-11-22 13:54 ` How can I wrap the subscript into a math environment in Org-mode? John Kitchin

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=CALjq+LZzXKDs0b3g6uZxaXEZzLuxwudtqdCbn3uFQs+oudqOoA@mail.gmail.com \
    --to=lzhes43@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).