* math in parentheses
@ 2014-10-28 12:54 Andreas Leha
2014-10-28 15:50 ` Richard Lawrence
0 siblings, 1 reply; 12+ messages in thread
From: Andreas Leha @ 2014-10-28 12:54 UTC (permalink / raw)
To: emacs-orgmode
Hi,
I encounter a problem using $..$ expressions when they are enclosed
in parentheses.
This sample
--8<---------------cut here---------------start------------->8---
#+TITLE: Test Math
* Some math
This $T$ works, but ($T$) this does not.
--8<---------------cut here---------------end--------------->8---
exports to (relevant part)
--8<---------------cut here---------------start------------->8---
\section{Some math}
\label{sec-1}
This \(T\) works, but (\$T\$) this does not.
--8<---------------cut here---------------end--------------->8---
Is that expected behaviour?
(Note that \(...\) expressions work.)
I am on
- OS X 10.9.4
- GNU Emacs 24.4.50.1
- Org-mode version 8.3beta
Regards,
Andreas
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: math in parentheses
2014-10-28 12:54 math in parentheses Andreas Leha
@ 2014-10-28 15:50 ` Richard Lawrence
2014-10-28 16:03 ` Andreas Leha
0 siblings, 1 reply; 12+ messages in thread
From: Richard Lawrence @ 2014-10-28 15:50 UTC (permalink / raw)
To: emacs-orgmode
Hi Andreas,
Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
> I encounter a problem using $..$ expressions when they are enclosed
> in parentheses.
> This $T$ works, but ($T$) this does not.
>
> Is that expected behaviour?
>
> (Note that \(...\) expressions work.)
Yes, that is the expected behavior. Org is much pickier about when "$"
can be a math delimiter than "\( ... \)". The reason is that "$" can
also be used as a regular symbol in Org documents; when it is, it should
be *not* be exported as a math delimiter to LaTeX, and distinguishing
non-math-delimiting from math-delimiting uses of "$" is not a trivial
matter.
Thus, when in doubt, use "\( ... \)".
Best,
Richard
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: math in parentheses
2014-10-28 15:50 ` Richard Lawrence
@ 2014-10-28 16:03 ` Andreas Leha
2014-10-28 16:31 ` Rasmus
2014-10-28 17:14 ` Nick Dokos
0 siblings, 2 replies; 12+ messages in thread
From: Andreas Leha @ 2014-10-28 16:03 UTC (permalink / raw)
To: emacs-orgmode
Hi Richard,
Richard Lawrence <richard.lawrence@berkeley.edu> writes:
> Hi Andreas,
>
> Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>
>> I encounter a problem using $..$ expressions when they are enclosed
>> in parentheses.
>
>> This $T$ works, but ($T$) this does not.
>>
>> Is that expected behaviour?
>>
>> (Note that \(...\) expressions work.)
>
> Yes, that is the expected behavior. Org is much pickier about when "$"
> can be a math delimiter than "\( ... \)". The reason is that "$" can
> also be used as a regular symbol in Org documents; when it is, it should
> be *not* be exported as a math delimiter to LaTeX, and distinguishing
> non-math-delimiting from math-delimiting uses of "$" is not a trivial
> matter.
>
> Thus, when in doubt, use "\( ... \)".
>
Thanks for following that up. I do use \(...\) when I encounter
problems with $...$ (which is a lot nicer to type and read).
I am happy with using the fall-back \(...\) every now and then.
Just for me to understand: Is the problem the missing whitespace
around the $...$ expression?
Thanks,
Andreas
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: math in parentheses
2014-10-28 16:03 ` Andreas Leha
@ 2014-10-28 16:31 ` Rasmus
2014-10-28 16:57 ` Andreas Leha
2014-10-28 17:14 ` Nick Dokos
1 sibling, 1 reply; 12+ messages in thread
From: Rasmus @ 2014-10-28 16:31 UTC (permalink / raw)
To: emacs-orgmode
Hi,
Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
> Hi Richard,
> Just for me to understand: Is the problem the missing whitespace
> around the $...$ expression?
From (info "(org) LaTeX Fragments")
[a] 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
—Rasmus
--
C is for Cookie
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: math in parentheses
2014-10-28 16:31 ` Rasmus
@ 2014-10-28 16:57 ` Andreas Leha
2014-10-28 22:32 ` Rasmus
0 siblings, 1 reply; 12+ messages in thread
From: Andreas Leha @ 2014-10-28 16:57 UTC (permalink / raw)
To: emacs-orgmode
Hi Rasmus,
Rasmus <rasmus@gmx.us> writes:
> Hi,
>
> Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>
>> Hi Richard,
>> Just for me to understand: Is the problem the missing whitespace
>> around the $...$ expression?
>
> From (info "(org) LaTeX Fragments")
>
> [a] 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
>
Thanks for the pointer.
Given that there are 'exceptions' already I'd like to see that last
sentence extended to 'followed by whitespace, punctuation, a closing
parenthesis or a dash'.
Especially since the \(...\) notation is particularly hard to read when
enclosed in parentheses. For example (\(\frac{1}{2}\)) as opposed to
($\frac{1}{2}$)
But as I said earlier, this is a minor nuisance and I am happy to resort
to \(...\) whenever necessary.
Thanks,
Andreas
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: math in parentheses
2014-10-28 16:03 ` Andreas Leha
2014-10-28 16:31 ` Rasmus
@ 2014-10-28 17:14 ` Nick Dokos
2014-10-28 17:30 ` Andreas Leha
2014-10-29 12:24 ` Rasmus
1 sibling, 2 replies; 12+ messages in thread
From: Nick Dokos @ 2014-10-28 17:14 UTC (permalink / raw)
To: emacs-orgmode
Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
> Hi Richard,
>
> Richard Lawrence <richard.lawrence@berkeley.edu> writes:
>> Hi Andreas,
>>
>> Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>>
>>> I encounter a problem using $..$ expressions when they are enclosed
>>> in parentheses.
>>
>>> This $T$ works, but ($T$) this does not.
>>>
>>> Is that expected behaviour?
>>>
>>> (Note that \(...\) expressions work.)
>>
>> Yes, that is the expected behavior. Org is much pickier about when "$"
>> can be a math delimiter than "\( ... \)". The reason is that "$" can
>> also be used as a regular symbol in Org documents; when it is, it should
>> be *not* be exported as a math delimiter to LaTeX, and distinguishing
>> non-math-delimiting from math-delimiting uses of "$" is not a trivial
>> matter.
>>
>> Thus, when in doubt, use "\( ... \)".
>>
>
> Thanks for following that up. I do use \(...\) when I encounter
> problems with $...$ (which is a lot nicer to type and read).
>
> I am happy with using the fall-back \(...\) every now and then.
>
> Just for me to understand: Is the problem the missing whitespace
> around the $...$ expression?
>
See
http://tex.stackexchange.com/questions/510/are-and-preferable-to-dollar-signs-for-math-mode
for some arguments for and (mostly) against (although one of the "for"s
is Frank Mittelbach - which surely tilts the scale quite a lot). FWIW,
I've trained myself to use \(...\) and don't find it any harder to read
than $...$ - and I don't mind the extra typing either. The fact that
both org and MathJax deal better with \(...\) just reinforces that
choice.
Nick
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: math in parentheses
2014-10-28 17:14 ` Nick Dokos
@ 2014-10-28 17:30 ` Andreas Leha
2014-10-29 12:24 ` Rasmus
1 sibling, 0 replies; 12+ messages in thread
From: Andreas Leha @ 2014-10-28 17:30 UTC (permalink / raw)
To: emacs-orgmode
Hi Nick,
Nick Dokos <ndokos@gmail.com> writes:
> Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>
>> Hi Richard,
>>
>> Richard Lawrence <richard.lawrence@berkeley.edu> writes:
>>> Hi Andreas,
>>>
>>> Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>>>
>>>> I encounter a problem using $..$ expressions when they are enclosed
>>>> in parentheses.
>>>
>>>> This $T$ works, but ($T$) this does not.
>>>>
>>>> Is that expected behaviour?
>>>>
>>>> (Note that \(...\) expressions work.)
>>>
>>> Yes, that is the expected behavior. Org is much pickier about when "$"
>>> can be a math delimiter than "\( ... \)". The reason is that "$" can
>>> also be used as a regular symbol in Org documents; when it is, it should
>>> be *not* be exported as a math delimiter to LaTeX, and distinguishing
>>> non-math-delimiting from math-delimiting uses of "$" is not a trivial
>>> matter.
>>>
>>> Thus, when in doubt, use "\( ... \)".
>>>
>>
>> Thanks for following that up. I do use \(...\) when I encounter
>> problems with $...$ (which is a lot nicer to type and read).
>>
>> I am happy with using the fall-back \(...\) every now and then.
>>
>> Just for me to understand: Is the problem the missing whitespace
>> around the $...$ expression?
>>
>
> See
>
> http://tex.stackexchange.com/questions/510/are-and-preferable-to-dollar-signs-for-math-mode
>
> for some arguments for and (mostly) against (although one of the "for"s
> is Frank Mittelbach - which surely tilts the scale quite a lot).
Thanks. A very good read. These are arguments on the LaTeX end. My
question was more on the orgmode end, I guess.
> FWIW,
> I've trained myself to use \(...\) and don't find it any harder to read
> than $...$ - and I don't mind the extra typing either. The fact that
> both org and MathJax deal better with \(...\) just reinforces that
> choice.
I do not agree with the readability but I can live (quite happily) with
using \(...\). And maybe my perception of the readability changes over
time....
Regards,
Andreas
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: math in parentheses
2014-10-28 16:57 ` Andreas Leha
@ 2014-10-28 22:32 ` Rasmus
2014-10-29 9:55 ` Andreas Leha
0 siblings, 1 reply; 12+ messages in thread
From: Rasmus @ 2014-10-28 22:32 UTC (permalink / raw)
To: emacs-orgmode
Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
> Hi Rasmus,
>
> Rasmus <rasmus@gmx.us> writes:
>> Hi,
>>
>> Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>>
>>> Hi Richard,
>>> Just for me to understand: Is the problem the missing whitespace
>>> around the $...$ expression?
>>
>> From (info "(org) LaTeX Fragments")
>>
>> [a] 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
>>
>
> Thanks for the pointer.
>
> Given that there are 'exceptions' already I'd like to see that last
> sentence extended to 'followed by whitespace, punctuation, a closing
> parenthesis or a dash'.
Patches welcome :) but this does work $(x)$ BTW.
I guess the main function for export is
`org-element-latex-fragment-interpreter' but there's also
`org-inside-LaTeX-fragment-p'. . .
—Rasmus
--
When the facts change, I change my mind. What do you do, sir?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: math in parentheses
2014-10-28 22:32 ` Rasmus
@ 2014-10-29 9:55 ` Andreas Leha
0 siblings, 0 replies; 12+ messages in thread
From: Andreas Leha @ 2014-10-29 9:55 UTC (permalink / raw)
To: emacs-orgmode
Hi Rasmus,
Rasmus <rasmus@gmx.us> writes:
> Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>
>> Hi Rasmus,
>>
>> Rasmus <rasmus@gmx.us> writes:
>>> Hi,
>>>
>>> Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>>>
>>>> Hi Richard,
>>>> Just for me to understand: Is the problem the missing whitespace
>>>> around the $...$ expression?
>>>
>>> From (info "(org) LaTeX Fragments")
>>>
>>> [a] 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
>>>
>>
>> Thanks for the pointer.
>>
>> Given that there are 'exceptions' already I'd like to see that last
>> sentence extended to 'followed by whitespace, punctuation, a closing
>> parenthesis or a dash'.
>
> Patches welcome :) but this does work $(x)$ BTW.
Quite nice. This had not occurred to me.
[...]
Thanks,
Andreas
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: math in parentheses
2014-10-28 17:14 ` Nick Dokos
2014-10-28 17:30 ` Andreas Leha
@ 2014-10-29 12:24 ` Rasmus
2014-10-29 13:03 ` Nick Dokos
2014-10-31 18:09 ` Eric S Fraga
1 sibling, 2 replies; 12+ messages in thread
From: Rasmus @ 2014-10-29 12:24 UTC (permalink / raw)
To: emacs-orgmode
Hi,
Nick Dokos <ndokos@gmail.com> writes:
> See
>
> http://tex.stackexchange.com/questions/510/are-and-preferable-to-dollar-signs-for-math-mode
>
> for some arguments for and (mostly) against (although one of the "for"s
> is Frank Mittelbach - which surely tilts the scale quite a lot). FWIW,
> I've trained myself to use \(...\) and don't find it any harder to read
> than $...$ - and I don't mind the extra typing either. The fact that
> both org and MathJax deal better with \(...\) just reinforces that
> choice.
Note that,
(with-temp-buffer (insert "$x$") (require 'ox-latex)
(org-latex-export-as-latex nil nil nil t)) => \(x\)
Just out of curiosity, do you actually type \(·\) or have you somehow
remapped $·$ to insert \(·\)?
For me the biggest inconvenience of \(·\) is that it's tedious to
type. On my keyboard, M-< S-8 M-< gives me \(\), compare to M-4 M-4
(which I could probably limit to M-4 with electric-pair-mode). Thus,
I use $·$ by default.
I usually just rely on whether my expression get the colored by
org-latex-and-related. In most cases that's a good indicator, but it
does not work with ($x$).
—Rasmus
--
With monopolies the cake is a lie!
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: math in parentheses
2014-10-29 12:24 ` Rasmus
@ 2014-10-29 13:03 ` Nick Dokos
2014-10-31 18:09 ` Eric S Fraga
1 sibling, 0 replies; 12+ messages in thread
From: Nick Dokos @ 2014-10-29 13:03 UTC (permalink / raw)
To: emacs-orgmode
Rasmus <rasmus@gmx.us> writes:
> Just out of curiosity, do you actually type \(·\) or have you somehow
> remapped $·$ to insert \(·\)?
>
I type \(...\) - I don't do it often enough to worry about it.
--
Nick
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: math in parentheses
2014-10-29 12:24 ` Rasmus
2014-10-29 13:03 ` Nick Dokos
@ 2014-10-31 18:09 ` Eric S Fraga
1 sibling, 0 replies; 12+ messages in thread
From: Eric S Fraga @ 2014-10-31 18:09 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
On Wednesday, 29 Oct 2014 at 13:24, Rasmus wrote:
[...]
> Just out of curiosity, do you actually type \(·\) or have you somehow
> remapped $·$ to insert \(·\)?
I have been using the following for quite some time:
#+begin_src emacs-lisp
;; 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 (0xFFFCF67D), Emacs 24.3.1, Org release_8.3beta-372-gdd70cf
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2014-10-31 21:44 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-28 12:54 math in parentheses Andreas Leha
2014-10-28 15:50 ` Richard Lawrence
2014-10-28 16:03 ` Andreas Leha
2014-10-28 16:31 ` Rasmus
2014-10-28 16:57 ` Andreas Leha
2014-10-28 22:32 ` Rasmus
2014-10-29 9:55 ` Andreas Leha
2014-10-28 17:14 ` Nick Dokos
2014-10-28 17:30 ` Andreas Leha
2014-10-29 12:24 ` Rasmus
2014-10-29 13:03 ` Nick Dokos
2014-10-31 18:09 ` Eric S Fraga
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).