emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Berry, Charles" via "General discussions about Org-mode." <emacs-orgmode@gnu.org>
To: Richard Lawrence <wyley.r@gmail.com>
Cc: gutin <jkabrg@gmail.com>, org-mode mailing list <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: Tue, 29 Sep 2020 22:06:18 +0000	[thread overview]
Message-ID: <DE4E07CC-8EB0-4203-B6E8-223650337390@health.ucsd.edu> (raw)
In-Reply-To: <87r1qk9zyq.fsf@aquinas>

See below.

> On Sep 29, 2020, at 11:53 AM, Richard Lawrence <wyley.r@gmail.com> wrote:
> 
> "Berry, Charles" <ccberry@health.ucsd.edu> writes:
> 
>> The case Gutin describes conforms to the documentation, viz. `$x\beta$-` should produce math mode LaTeX as I read the next paragraph. 
>> 
>> From (info "(org) LaTeX fragments"):
>> 
>>   • Text within the usual LaTeX math delimiters.  To avoid conflicts
>>     with currency specifications, single ‘$’ characters are only
>>     recognized as math delimiters if the enclosed text contains at most
>>     two line breaks, is directly attached to the ‘$’ characters with no
>>     whitespace in between, and if the closing ‘$’ is followed by
>>     whitespace, punctuation or a dash.
> 
> Hmm, good point.
> 
> It looks to me like the relevant function is
> org-element-latex-fragment-parser, and the code for that hasn't changed
> much in several years (last change was 2017). (Also, I was wrong,
> parsing latex fragments is not done with just a regexp.) I can confirm
> that this function parses "$foo" in "$foo$ bar" as a latex fragment, but
> not in "$foo$-bar"
> 
> Not sure if the problem here is the code or the documentation. Perhaps
> the documentation should be updated to reflect the current behavior?
> 

Using 

"\\(-\\|\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|'\\|$\\)"

as the regexp for the `looking-at-p` seems to resolve this. To save you some eyestrain, there is "-\\|" added near the beginning right after "\\(" to match the trailing dash.

Per (info (elisp) "Syntax Class Table"), neither \\s. nor \\s- include the dash. \\s_ includes dash, but also $, so that seems like trouble. 

Caveat: I've not run `make test`, so am unsure if there is a subtle gotcha hidden here.

HTH,

Chuck

      reply	other threads:[~2020-09-29 22:07 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
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. [this message]

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=DE4E07CC-8EB0-4203-B6E8-223650337390@health.ucsd.edu \
    --to=emacs-orgmode@gnu.org \
    --cc=ccberry@health.ucsd.edu \
    --cc=jkabrg@gmail.com \
    --cc=wyley.r@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 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).