From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lei Zhe Subject: How can I wrap the subscript into a math environment in Org-mode? Date: Sun, 22 Nov 2015 17:51:40 +0900 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33143) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0QNh-0005Mi-RM for emacs-orgmode@gnu.org; Sun, 22 Nov 2015 03:52:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a0QNh-0008DZ-0J for emacs-orgmode@gnu.org; Sun, 22 Nov 2015 03:52:21 -0500 Received: from mail-io0-x229.google.com ([2607:f8b0:4001:c06::229]:36838) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0QNg-0008D9-S9 for emacs-orgmode@gnu.org; Sun, 22 Nov 2015 03:52:20 -0500 Received: by iofh3 with SMTP id h3so162310984iof.3 for ; Sun, 22 Nov 2015 00:52:20 -0800 (PST) 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" 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?