* Exponents / subscripts @ 2014-10-19 15:28 Fabrice Popineau 2014-10-19 17:08 ` Nicolas Goaziou 0 siblings, 1 reply; 13+ messages in thread From: Fabrice Popineau @ 2014-10-19 15:28 UTC (permalink / raw) To: emacs-orgmode@gnu.org [-- Attachment #1: Type: text/plain, Size: 387 bytes --] Hi, A minor issue and I haven't check if it has already been raised in the past. Currently something like \(a^nb^n\) is the org-mode buffer as \(a^{nbn}\). IE it starts exponent mode and stops it at the next space. Could it be made to behave more like LaTeX, i.e. only the next char except if braces ? Or is it something beyond the Org parser / syntax ? Regards, -- Fabrice Popineau [-- Attachment #2: Type: text/html, Size: 547 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Exponents / subscripts 2014-10-19 15:28 Exponents / subscripts Fabrice Popineau @ 2014-10-19 17:08 ` Nicolas Goaziou 2014-10-19 19:52 ` Fabrice Popineau 0 siblings, 1 reply; 13+ messages in thread From: Nicolas Goaziou @ 2014-10-19 17:08 UTC (permalink / raw) To: Fabrice Popineau; +Cc: emacs-orgmode@gnu.org Hello, Fabrice Popineau <fabrice.popineau@supelec.fr> writes: > A minor issue and I haven't check if it has already been raised in the past. > Currently something like \(a^nb^n\) is the org-mode buffer > as \(a^{nbn}\). IE it starts exponent mode and stops it at the next space. > Could it be made to behave more like LaTeX, i.e. only the next char > except if braces ? Or is it something beyond the Org parser / syntax ? This is not beyond anything. It is (historically) meant to be that way. Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Exponents / subscripts 2014-10-19 17:08 ` Nicolas Goaziou @ 2014-10-19 19:52 ` Fabrice Popineau 2014-10-20 9:43 ` Nicolas Goaziou 0 siblings, 1 reply; 13+ messages in thread From: Fabrice Popineau @ 2014-10-19 19:52 UTC (permalink / raw) To: Fabrice Popineau, emacs-orgmode@gnu.org [-- Attachment #1: Type: text/plain, Size: 725 bytes --] 2014-10-19 19:08 GMT+02:00 Nicolas Goaziou <mail@nicolasgoaziou.fr>: > Hello, > > Fabrice Popineau <fabrice.popineau@supelec.fr> writes: > > > A minor issue and I haven't check if it has already been raised in the > past. > > Currently something like \(a^nb^n\) is the org-mode buffer > > as \(a^{nbn}\). IE it starts exponent mode and stops it at the next > space. > > Could it be made to behave more like LaTeX, i.e. only the next char > > except if braces ? Or is it something beyond the Org parser / syntax ? > > This is not beyond anything. It is (historically) meant to be that way. > > Given that it is only a matter of presentation, does that mean it could be changed ? If yes, I can try to give it a shot. Fabrice [-- Attachment #2: Type: text/html, Size: 1222 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Exponents / subscripts 2014-10-19 19:52 ` Fabrice Popineau @ 2014-10-20 9:43 ` Nicolas Goaziou 2014-10-20 22:23 ` Rasmus 0 siblings, 1 reply; 13+ messages in thread From: Nicolas Goaziou @ 2014-10-20 9:43 UTC (permalink / raw) To: Fabrice Popineau; +Cc: emacs-orgmode@gnu.org Hello, Fabrice Popineau <fabrice.popineau@supelec.fr> writes: > Given that it is only a matter of presentation, does that mean it could be > changed ? > If yes, I can try to give it a shot. If you mean that a^bc should be equivalent to a^{b}c, then I think it is superior in its current state. Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Exponents / subscripts 2014-10-20 9:43 ` Nicolas Goaziou @ 2014-10-20 22:23 ` Rasmus 2014-10-21 16:34 ` Nicolas Goaziou 0 siblings, 1 reply; 13+ messages in thread From: Rasmus @ 2014-10-20 22:23 UTC (permalink / raw) To: emacs-orgmode Hi, Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: > Fabrice Popineau <fabrice.popineau@supelec.fr> writes: > >> Given that it is only a matter of presentation, does that mean it could be >> changed ? >> If yes, I can try to give it a shot. > > If you mean that a^bc should be equivalent to a^{b}c, then I think it is > superior in its current state. As I understand Fabrice's mail, it's only about display of scripts in Org buffers (when org-pretty-entities-include-sub-superscripts is non-nil). So rather than displaying (+) \(a^nb^n\) as \(aⁿᵇⁿ\) it would be displayed as (*) \(aⁿbⁿ\) Of course, it /only/ makes sense to change how it is displayed in math-mode, for which (*) is the more accurate depiction of (+). If what was indeed what Fabrice had in mind I think it makes sense. But I also have been bothered by how (+) is displayed in the past. . . —Rasmus -- I hear there's rumors on the, uh, Internets. . . ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Exponents / subscripts 2014-10-20 22:23 ` Rasmus @ 2014-10-21 16:34 ` Nicolas Goaziou 2014-10-21 20:06 ` Rasmus 0 siblings, 1 reply; 13+ messages in thread From: Nicolas Goaziou @ 2014-10-21 16:34 UTC (permalink / raw) To: Rasmus; +Cc: emacs-orgmode Hello, Rasmus <rasmus@gmx.us> writes: > Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: > >> Fabrice Popineau <fabrice.popineau@supelec.fr> writes: >> >>> Given that it is only a matter of presentation, does that mean it could be >>> changed ? >>> If yes, I can try to give it a shot. >> >> If you mean that a^bc should be equivalent to a^{b}c, then I think it is >> superior in its current state. > > As I understand Fabrice's mail, it's only about display of scripts in > Org buffers (when org-pretty-entities-include-sub-superscripts is > non-nil). So rather than displaying > > (+) \(a^nb^n\) > > as > > \(aⁿᵇⁿ\) > > it would be displayed as > > (*) \(aⁿbⁿ\) > > Of course, it /only/ makes sense to change how it is displayed in > math-mode, for which (*) is the more accurate depiction of (+). If we're talking about math mode, then I think no overlay should be added on them, and let `org-toggle-inline-images' display them correctly. IOW, \(a^nb^n\) should be displayed as \(a^nb^n\). It is, IMO, a bug in the current fontification, in which sub/superscript handling leaks over math snippets. Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Exponents / subscripts 2014-10-21 16:34 ` Nicolas Goaziou @ 2014-10-21 20:06 ` Rasmus 2014-10-22 9:13 ` Nicolas Goaziou 0 siblings, 1 reply; 13+ messages in thread From: Rasmus @ 2014-10-21 20:06 UTC (permalink / raw) To: emacs-orgmode Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: > Rasmus <rasmus@gmx.us> writes: > >> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: >> >>> Fabrice Popineau <fabrice.popineau@supelec.fr> writes: >>> >>>> Given that it is only a matter of presentation, does that mean it could be >>>> changed ? >>>> If yes, I can try to give it a shot. >>> >>> If you mean that a^bc should be equivalent to a^{b}c, then I think it is >>> superior in its current state. >> >> As I understand Fabrice's mail, it's only about display of scripts in >> Org buffers (when org-pretty-entities-include-sub-superscripts is >> non-nil). So rather than displaying >> >> (+) \(a^nb^n\) >> >> as >> >> \(aⁿᵇⁿ\) >> >> it would be displayed as >> >> (*) \(aⁿbⁿ\) >> >> Of course, it /only/ makes sense to change how it is displayed in >> math-mode, for which (*) is the more accurate depiction of (+). > > If we're talking about math mode, then I think no overlay should be > added on them, and let `org-toggle-inline-images' display them > correctly. IOW, \(a^nb^n\) should be displayed as \(a^nb^n\). > > It is, IMO, a bug in the current fontification, in which sub/superscript > handling leaks over math snippets. I disagree. org-toggle-inline-images and fontification of *scripts is are complements at best. org-toggle-inline-images is slow and inconvenient for anything but finished documents. Had preview-latex supported Org I'd maybe agree, but I disagree strongly at this time. sub/superscript works well with entities and makes it very easy to edit math and get approximate live feedback. IOW and IMO, the "bug", if any, is the fontification of superscript in math. —Rasmus -- To err is human. To screw up 10⁶ times per second, you need a computer ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Exponents / subscripts 2014-10-21 20:06 ` Rasmus @ 2014-10-22 9:13 ` Nicolas Goaziou 2014-10-22 9:54 ` Rasmus 2014-10-22 13:19 ` Fabrice Popineau 0 siblings, 2 replies; 13+ messages in thread From: Nicolas Goaziou @ 2014-10-22 9:13 UTC (permalink / raw) To: Rasmus; +Cc: emacs-orgmode Hello, Rasmus <rasmus@gmx.us> writes: > Had preview-latex supported Org I'd maybe agree, but I disagree > strongly at this time. Patch welcome. > sub/superscript works well with entities and makes it very easy to > edit math and get approximate live feedback. Unfortunately, some users complain about the approximation. OTOH, I'm pretty sure that most LaTeX users can parse sub/superscript LaTeX code without any fontification at all. > IOW and IMO, the "bug", if any, is the fontification of superscript in > math. This is not Org's job since you're talking about a non-compatible syntax. I think it should be done in a different library (i.e., not "org.el"), if at all. You want to implement a subset of Auctex. Either you delegate it to that major mode (à la Babel), at the price of some slowdown, or you duplicate code from it (i.e., `font-latex-match-script'). In both cases, you need to know when point is on a math snippet or environment, which should rely on `org-element-context' if you're serious about it. This doesn't solve the leak of Org's fontification on math snippets and environments. Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Exponents / subscripts 2014-10-22 9:13 ` Nicolas Goaziou @ 2014-10-22 9:54 ` Rasmus 2014-10-23 19:16 ` Nicolas Goaziou 2014-10-22 13:19 ` Fabrice Popineau 1 sibling, 1 reply; 13+ messages in thread From: Rasmus @ 2014-10-22 9:54 UTC (permalink / raw) To: emacs-orgmode Hi, Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: > Rasmus <rasmus@gmx.us> writes: > >> Had preview-latex supported Org I'd maybe agree, but I disagree >> strongly at this time. > > Patch welcome. Cf. a recent thread on emacs.devel it's pretty non-trivial to make preview-latex work outside of AUCTeX. >> sub/superscript works well with entities and makes it very easy to >> edit math and get approximate live feedback. > > Unfortunately, some users complain about the approximation. OTOH, I'm > pretty sure that most LaTeX users can parse sub/superscript LaTeX code > without any fontification at all. Of course they can, but it takes more effort. Compare: (1) \beta E_{t}[\sum_{j=t}^{T} z_{j}^{e}] (2) βE_{t}[∑_{j=t}^{T} z_{j}^{e}] (3) βEₜ[∑ⱼ₌ₜᵀzⱼᵉ] (3) takes no effort to read, whereas the barebone (1) and the entities-only (2) still take considerable amount of effort to parse IMO. >> IOW and IMO, the "bug", if any, is the fontification of superscript in >> math. > > This is not Org's job since you're talking about a non-compatible > syntax. I think it should be done in a different library (i.e., not > "org.el"), if at all. An external library is ideal (had it existed), but where to stop? Are entities wrapped in math "supported syntax"? E.g. "$\alpha\beta\gamma\delta$". > You want to implement a subset of Auctex. Either you delegate it to that > major mode (à la Babel), at the price of some slowdown, or you duplicate > code from it (i.e., `font-latex-match-script'). > In both cases, you need to know when point is on a math snippet or > environment, which should rely on `org-element-context' if you're > serious about it. So your strategy would be to disable fontification within math (since the syntax is not org), and delegate it to a separate library, say tex-fold.el (which also doesn't work out-of-the-box in Org-buffers)? In theory it's ideal, but consistency (e.g. supported entities) and comparability is probably issues. I know nothing on the technical level of fortification so I'm not sure I could work on this issue efficiently. > This doesn't solve the leak of Org's fontification on math snippets and > environments. But it would if you can delegate parsing of math to a separate library, no? —Rasmus -- To err is human. To screw up 10⁶ times per second, you need a computer ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Exponents / subscripts 2014-10-22 9:54 ` Rasmus @ 2014-10-23 19:16 ` Nicolas Goaziou 2014-10-23 21:32 ` Rasmus 0 siblings, 1 reply; 13+ messages in thread From: Nicolas Goaziou @ 2014-10-23 19:16 UTC (permalink / raw) To: Rasmus; +Cc: emacs-orgmode Hello, Rasmus <rasmus@gmx.us> writes: > An external library is ideal (had it existed), but where to stop? Are > entities wrapped in math "supported syntax"? > E.g. "$\alpha\beta\gamma\delta$". No. What is inside a math snippet/environment is a black box for Org. Entities are a different beast that do not require a math environment (e.g., "\alpha" is not considered to be LaTeX code). > So your strategy would be to disable fontification within math (since > the syntax is not org), and delegate it to a separate library, say > tex-fold.el (which also doesn't work out-of-the-box in Org-buffers)? > In theory it's ideal, but consistency (e.g. supported entities) and > comparability is probably issues. I don't think so. No fontification at all on LaTeX code is a decent default in an Org buffer. Additional, exact, fontification for it is a nice bonus. >> This doesn't solve the leak of Org's fontification on math snippets and >> environments. > > But it would if you can delegate parsing of math to a separate > library, no? No it wouldn't, because Org would still have to fontify sub/superscript outside math snippets. Of course, dedicated fontification could override leaked one, but I think this would be troublesome in some occasions. At some point, I hope to introduce the parser in the fontification process, which would some the problem. Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Exponents / subscripts 2014-10-23 19:16 ` Nicolas Goaziou @ 2014-10-23 21:32 ` Rasmus 2014-10-23 21:44 ` Nicolas Goaziou 0 siblings, 1 reply; 13+ messages in thread From: Rasmus @ 2014-10-23 21:32 UTC (permalink / raw) To: emacs-orgmode Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: > Hello, > > Rasmus <rasmus@gmx.us> writes: > >> An external library is ideal (had it existed), but where to stop? Are >> entities wrapped in math "supported syntax"? >> E.g. "$\alpha\beta\gamma\delta$". > > No. What is inside a math snippet/environment is a black box for Org. > Entities are a different beast that do not require a math environment > (e.g., "\alpha" is not considered to be LaTeX code). Bur surely the fact that $\beta$ is displayed $β$ is a consequence of org-entities.el? Whether desirable or not. >> So your strategy would be to disable fontification within math (since >> the syntax is not org), and delegate it to a separate library, say >> tex-fold.el (which also doesn't work out-of-the-box in Org-buffers)? >> In theory it's ideal, but consistency (e.g. supported entities) and >> comparability is probably issues. > > I don't think so. No fontification at all on LaTeX code is a decent > default in an Org buffer. Additional, exact, fontification for it is > a nice bonus. I would like to agree, but I get too much joy from the current imprecise implementation. From a practical perspective the current state is OK and much preferable over the alternative. IOW and IMO, let's not touch it unless we've got something better! >>> This doesn't solve the leak of Org's fontification on math snippets and >>> environments. >> >> But it would if you can delegate parsing of math to a separate >> library, no? > > No it wouldn't, because Org would still have to fontify sub/superscript > outside math snippets. Of course, dedicated fontification could override > leaked one, but I think this would be troublesome in some occasions. > > At some point, I hope to introduce the parser in the fontification > process, which would some the problem. Just out of curiosity, can you mention a couple of (org) function to look at to see how fontification works? —Rasmus -- m-mm-mmm-mmmm bacon! ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Exponents / subscripts 2014-10-23 21:32 ` Rasmus @ 2014-10-23 21:44 ` Nicolas Goaziou 0 siblings, 0 replies; 13+ messages in thread From: Nicolas Goaziou @ 2014-10-23 21:44 UTC (permalink / raw) To: Rasmus; +Cc: emacs-orgmode Rasmus <rasmus@gmx.us> writes: > Bur surely the fact that $\beta$ is displayed $β$ is a consequence of > org-entities.el? Whether desirable or not. That's the leak I'm talking about. You can also insert "\beta" in an example block. > Just out of curiosity, can you mention a couple of (org) function to > look at to see how fontification works? `org-set-font-lock-defaults', `org-do-emphasis-faces', `org-raise-scripts'... and basically every function with a single LIMIT argument. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Exponents / subscripts 2014-10-22 9:13 ` Nicolas Goaziou 2014-10-22 9:54 ` Rasmus @ 2014-10-22 13:19 ` Fabrice Popineau 1 sibling, 0 replies; 13+ messages in thread From: Fabrice Popineau @ 2014-10-22 13:19 UTC (permalink / raw) To: Rasmus, emacs-orgmode@gnu.org [-- Attachment #1: Type: text/plain, Size: 735 bytes --] 2014-10-22 11:13 GMT+02:00 > > > Unfortunately, some users complain about the approximation. OTOH, I'm > pretty sure that most LaTeX users can parse sub/superscript LaTeX code > without any fontification at all. > If there is no easy way to fix it, I may prefer to disable this fontification, because it displays something which is wrong (also the superscript is too small in my opinion, sometimes the character is unreadable). The current \(a^nb^n\) is actually displayed as \(a^{nbn}\) which is misleading. This is what bothered me first. OTOH, I have set up preview of formulas (actually I did it for tikz diagrams) and it works well. It is slower, and I use it for complicated formulas only, but at least it is exact. Fabrice [-- Attachment #2: Type: text/html, Size: 1146 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2014-10-23 21:44 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-10-19 15:28 Exponents / subscripts Fabrice Popineau 2014-10-19 17:08 ` Nicolas Goaziou 2014-10-19 19:52 ` Fabrice Popineau 2014-10-20 9:43 ` Nicolas Goaziou 2014-10-20 22:23 ` Rasmus 2014-10-21 16:34 ` Nicolas Goaziou 2014-10-21 20:06 ` Rasmus 2014-10-22 9:13 ` Nicolas Goaziou 2014-10-22 9:54 ` Rasmus 2014-10-23 19:16 ` Nicolas Goaziou 2014-10-23 21:32 ` Rasmus 2014-10-23 21:44 ` Nicolas Goaziou 2014-10-22 13:19 ` Fabrice Popineau
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).