* Latex single dollar math delimiter question
@ 2019-08-04 5:31 Jarmo Hurri
2019-08-04 12:07 ` Fraga, Eric
0 siblings, 1 reply; 7+ messages in thread
From: Jarmo Hurri @ 2019-08-04 5:31 UTC (permalink / raw)
To: emacs-orgmode
Greetings.
Org manual says that
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.
Can someone explain why the single '$' characters below are not
recognized as math delimiters?
a /complex number/ $z = a + ib,$ where
Thanks in advance.
Jarmo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Latex single dollar math delimiter question
2019-08-04 5:31 Latex single dollar math delimiter question Jarmo Hurri
@ 2019-08-04 12:07 ` Fraga, Eric
2019-08-05 8:58 ` Jarmo Hurri
0 siblings, 1 reply; 7+ messages in thread
From: Fraga, Eric @ 2019-08-04 12:07 UTC (permalink / raw)
To: Jarmo Hurri; +Cc: emacs-orgmode@gnu.org
On Sunday, 4 Aug 2019 at 08:31, Jarmo Hurri wrote:
> Can someone explain why the single '$' characters below are not
> recognized as math delimiters?
>
> a /complex number/ $z = a + ib,$ where
What are you expecting? What happens if you export the file to PDF?
By the way, you might be interested in the following configuration
snippet which makes org insert \(\) when you type a single $ (and a $ if
you type 2 of them in a row).
#+begin_src emacs-lisp :tangle "esf-org.el"
;; 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)
#+end_src
--
Eric S Fraga via Emacs 27.0.50, Org release_9.2.4-399-g4e6222
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Latex single dollar math delimiter question
2019-08-04 12:07 ` Fraga, Eric
@ 2019-08-05 8:58 ` Jarmo Hurri
2019-08-05 10:35 ` Nicolas Goaziou
2019-08-05 11:04 ` Fraga, Eric
0 siblings, 2 replies; 7+ messages in thread
From: Jarmo Hurri @ 2019-08-05 8:58 UTC (permalink / raw)
To: emacs-orgmode
"Fraga, Eric" <e.fraga@ucl.ac.uk> writes:
> On Sunday, 4 Aug 2019 at 08:31, Jarmo Hurri wrote:
>> Can someone explain why the single '$' characters below are not
>> recognized as math delimiters?
>>
>> a /complex number/ $z = a + ib,$ where
>
> What are you expecting? What happens if you export the file to PDF?
Sorry, I assumed incorrectly that my question was self-explanatory. When
I export the file to PDF, the dollar characters are not regonized as
math delimiters.
Based on the manual I would have expected math delimiters. Referring
again to the manual: "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."
Since the equation in my example contains no line breaks, is directly
attached with no whitespace in between the equation and the dollar
signs, and the closing '$' is followed by whitespace, I would expect
math delimiter behaviour.
Removing all whitespace, that is, $z=a+ib,$ does not help.
> By the way, you might be interested in the following configuration
> snippet which makes org insert \(\) when you type a single $ (and a $
> if you type 2 of them in a row).
That is a nice little tool.
I have gotten used to writing '\(' and '\)' instead of '$' for a long
time. I was doing it for the millionth time and decided to take a look
at what the manual says. Hence this post.
Hope this clarifies my question.
Jarmo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Latex single dollar math delimiter question
2019-08-05 8:58 ` Jarmo Hurri
@ 2019-08-05 10:35 ` Nicolas Goaziou
2019-08-05 11:04 ` Fraga, Eric
1 sibling, 0 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2019-08-05 10:35 UTC (permalink / raw)
To: Jarmo Hurri; +Cc: emacs-orgmode
Hello,
Jarmo Hurri <jarmo.hurri@iki.fi> writes:
> Based on the manual I would have expected math delimiters. Referring
> again to the manual: "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."
>
> Since the equation in my example contains no line breaks, is directly
> attached with no whitespace in between the equation and the dollar
> signs, and the closing '$' is followed by whitespace, I would expect
> math delimiter behaviour.
The manual is inaccurate. Here is the current check for $ math
delimiters:
(and (not (memq (char-after (1+ (point)))
'(?\s ?\t ?\n ?, ?. ?\;)))
(search-forward "$" nil t 2)
(not (memq (char-before (match-beginning 0))
'(?\s ?\t ?\n ?, ?.)))
(looking-at-p
"\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|'\\|$\\)"))
See also: https://orgmode.org/worg/dev/org-syntax.html#Entities_and_LaTeX_Fragments
I don't know if there's a way to express it in a non-boring way in the
manual.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Latex single dollar math delimiter question
2019-08-05 8:58 ` Jarmo Hurri
2019-08-05 10:35 ` Nicolas Goaziou
@ 2019-08-05 11:04 ` Fraga, Eric
1 sibling, 0 replies; 7+ messages in thread
From: Fraga, Eric @ 2019-08-05 11:04 UTC (permalink / raw)
To: Jarmo Hurri; +Cc: emacs-orgmode@gnu.org
On Monday, 5 Aug 2019 at 11:58, Jarmo Hurri wrote:
[...]
> Since the equation in my example contains no line breaks, is directly
> attached with no whitespace in between the equation and the dollar
> signs, and the closing '$' is followed by whitespace, I would expect
> math delimiter behaviour.
>
> Removing all whitespace, that is, $z=a+ib,$ does not help.
I can confirm this. What does work, however, is if you remove the ","
that is within the $...$ delimiters. Simply move the , to after the
second $.
You might wish to file a bug report.
--
Eric S Fraga via Emacs 27.0.50, Org release_9.2.4-399-g4e6222
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Latex single dollar math delimiter question
@ 2019-08-08 17:00 emanuel.charpentier
2019-08-09 8:56 ` Fraga, Eric
0 siblings, 1 reply; 7+ messages in thread
From: emanuel.charpentier @ 2019-08-08 17:00 UTC (permalink / raw)
To: e.fraga; +Cc: emacs-orgmode
On Sun, 4 Aug 2019, Eric S Fraga had the gall to write :
> By the way, you might be interested in the following configuration
> snippet which makes org insert \(\) when you type a single $ (and a $
> if you type 2 of them in a row).
>
> #+begin_src emacs-lisp :tangle "esf-org.el"
> ;; from Nicolas Richard <address@hidden>
> ;; Date: Fri, 8 Mar 2013 16:23:02 +0100
> ;; Message-ID: <address@hidden>
> (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)
> #+end_src
A bitt too much reminescent of this xkcd [horror](
https://www.xkcd.com/1806/)...
HTH(BASIWn't)
--
Emmanuel Charpentier
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Latex single dollar math delimiter question
2019-08-08 17:00 emanuel.charpentier
@ 2019-08-09 8:56 ` Fraga, Eric
0 siblings, 0 replies; 7+ messages in thread
From: Fraga, Eric @ 2019-08-09 8:56 UTC (permalink / raw)
To: emanuel.charpentier@gmail.com; +Cc: emacs-orgmode
> A bitt too much reminescent of this xkcd [horror](
:-)
Yes, anybody who has used Emacs for any significant amount of time is no
longer using the same Emacs as anybody else!
--
Eric S Fraga via Emacs 27.0.50, Org release_9.2.4-399-g4e6222
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-08-09 8:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-04 5:31 Latex single dollar math delimiter question Jarmo Hurri
2019-08-04 12:07 ` Fraga, Eric
2019-08-05 8:58 ` Jarmo Hurri
2019-08-05 10:35 ` Nicolas Goaziou
2019-08-05 11:04 ` Fraga, Eric
-- strict thread matches above, loose matches on Subject: below --
2019-08-08 17:00 emanuel.charpentier
2019-08-09 8:56 ` Fraga, Eric
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.