Re: [O] math in parentheses
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 theonewiththeevill...@yahoo.fr ;; Date: Fri, 8 Mar 2013 16:23:02 +0100 ;; Message-ID: 87vc913oh5@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
Re: [O] math in parentheses
Hi Rasmus, Rasmus ras...@gmx.us writes: Andreas Leha andreas.l...@med.uni-goettingen.de writes: Hi Rasmus, Rasmus ras...@gmx.us writes: Hi, Andreas Leha andreas.l...@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
Re: [O] math in parentheses
Hi, Nick Dokos ndo...@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 fors 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!
Re: [O] math in parentheses
Rasmus ras...@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
Re: [O] math in parentheses
Hi Andreas, Andreas Leha andreas.l...@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
Re: [O] math in parentheses
Hi Richard, Richard Lawrence richard.lawre...@berkeley.edu writes: Hi Andreas, Andreas Leha andreas.l...@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
Re: [O] math in parentheses
Hi, Andreas Leha andreas.l...@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
Re: [O] math in parentheses
Hi Rasmus, Rasmus ras...@gmx.us writes: Hi, Andreas Leha andreas.l...@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
Re: [O] math in parentheses
Andreas Leha andreas.l...@med.uni-goettingen.de writes: Hi Richard, Richard Lawrence richard.lawre...@berkeley.edu writes: Hi Andreas, Andreas Leha andreas.l...@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 fors 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
Re: [O] math in parentheses
Hi Nick, Nick Dokos ndo...@gmail.com writes: Andreas Leha andreas.l...@med.uni-goettingen.de writes: Hi Richard, Richard Lawrence richard.lawre...@berkeley.edu writes: Hi Andreas, Andreas Leha andreas.l...@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 fors 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
Re: [O] math in parentheses
Andreas Leha andreas.l...@med.uni-goettingen.de writes: Hi Rasmus, Rasmus ras...@gmx.us writes: Hi, Andreas Leha andreas.l...@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?