all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Richard Lawrence <wyley.r@gmail.com>
To: gutin <jkabrg@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: Bug: Math mode doesn't work if followed by a dash [9.4 (nil @ /home/gutin/.emacs.d/.local/straight/build/org-mode/)]
Date: Mon, 28 Sep 2020 20:42:25 +0200	[thread overview]
Message-ID: <87zh59agku.fsf@aquinas> (raw)
In-Reply-To: <e119937a866c6ec4903b122321eec58b561a7175.camel@gmail.com>

Hi Gutin,

gutin <jkabrg@gmail.com> writes:

> What I meant is that if you type
>
>   $*$-algebra
>
> and hit C-c C-x C-l, then the "$*$" doesn't get replaced with a
> mathematical image. A similar problem happens when you export to Latex:
> The dollar signs get escaped.

I believe this is intentional. There are too many other uses of dollar
signs that people might want to use in Org documents that might be
broken if Org treated them as math mode delimiters; so the regexp that
matches math mode delimiters is deliberately limited in scope.

The recommended workaround is to use the \(...\) style of delimiter for
math mode instead, which is much less ambiguous. Here is a function that
makes this easy, by inserting these delimiters when you type "$". It's
been posted on this mailing list before, and I use a version of it
myself; it's very useful!

   ;; from Nicolas Richard <theonewiththeevillook@yahoo.fr>
   ;; Date: Fri, 8 Mar 2013 16:23:02 +0100
   ;; Message-ID: <87vc913oh5.fsf@yahoo.fr>
   (defun yf/org-electric-dollar nil
     "When called once, insert \\(\\) and leave point in between.
   When called twice, replace the previously inserted \\(\\) by one $."
          (interactive)
          (if (and (looking-at "\\\\)") (looking-back "\\\\("))
              (progn (delete-char 2)
                     (delete-char -2)
                     (insert "$"))
            (insert "\\(\\)")
            (backward-char 2)))
   (define-key org-mode-map (kbd "$") 'yf/org-electric-dollar

Hope that helps!

-- 
Best,
Richard


  parent reply	other threads:[~2020-09-28 18:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-27 18:48 Bug: Math mode doesn't work if followed by a dash [9.4 (nil @ /home/gutin/.emacs.d/.local/straight/build/org-mode/)] gutin
2020-09-28 17:59 ` Richard Lawrence
     [not found] ` <875z7xbxns.fsf@aquinas>
     [not found]   ` <e119937a866c6ec4903b122321eec58b561a7175.camel@gmail.com>
2020-09-28 18:42     ` Richard Lawrence [this message]
2020-09-29 16:42       ` Berry, Charles via General discussions about Org-mode.
2020-09-29 18:53         ` Richard Lawrence
2020-09-29 22:06           ` Berry, Charles via General discussions about Org-mode.

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

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

  git send-email \
    --in-reply-to=87zh59agku.fsf@aquinas \
    --to=wyley.r@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jkabrg@gmail.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.