emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Inequalities in math blocks
@ 2021-10-03 11:04 Rudolf Adamkovič
  2021-10-03 12:19 ` Max Nikulin
  2021-10-06  7:39 ` Inequalities in math blocks Rudolf Adamkovič
  0 siblings, 2 replies; 22+ messages in thread
From: Rudolf Adamkovič @ 2021-10-03 11:04 UTC (permalink / raw)
  To: emacs-orgmode

The following Org markup does not render properly in HTML export:

- foo $a<b$ bar foo $b>a$ bar 

In Emacs, I see no signs of problems, such as broken math 
highlighting. Further, when I export to LaTeX, the inequalities 
render properly. Does one have to use \lt and \gt instead of < and 
> all the time? If so, why allow < and > characters in math 
blocks? I ask because, when I reorganize my Org document, it 
breaks math "at random" when I use < and > and Emacs does not tell 
me about it.

R+
-- 
Logic is a science of the necessary laws of thought, without which 
no employment of the understanding and the reason takes place. -- 
Immanuel Kant, 1785  Rudolf Adamkovič <salutis@me.com> 
Studenohorská 25 84103 Bratislava Slovakia  [he/him]


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Inequalities in math blocks
  2021-10-03 11:04 Inequalities in math blocks Rudolf Adamkovič
@ 2021-10-03 12:19 ` Max Nikulin
  2021-10-03 13:12   ` Timothy
                     ` (2 more replies)
  2021-10-06  7:39 ` Inequalities in math blocks Rudolf Adamkovič
  1 sibling, 3 replies; 22+ messages in thread
From: Max Nikulin @ 2021-10-03 12:19 UTC (permalink / raw)
  To: emacs-orgmode

On 03/10/2021 18:04, Rudolf Adamkovič wrote:
> The following Org markup does not render properly in HTML export:
> 
> - foo $a<b$ bar foo $b>a$ bar
> In Emacs, I see no signs of problems, such as broken math highlighting. 
> Further, when I export to LaTeX, the inequalities render properly. Does 
> one have to use \lt and \gt instead of < and
>> all the time? If so, why allow < and > characters in math 
> blocks? I ask because, when I reorganize my Org document, it breaks math 
> "at random" when I use < and > and Emacs does not tell me about it.

I had another reason to look into the manual today, so I noticed:

https://orgmode.org/manual/Math-formatting-in-HTML-export.html

> (131)
> 
> Please note that exported formulas are part of an HTML document, and
> that signs such as ‘<’, ‘>’, or ‘&’ have special meanings. See MathJax
> TeX and LaTeX support.

The link is broken however.

http://docs.mathjax.org/en/latest/input/tex/html.html#html-special-characters

> Usually, it is sufficient simply to put spaces around these symbols to
> cause the browser to avoid them, so
> 
> ... when $x < y$ we have ...

Though I am a bit surprised that Org did not replace characters to &lt; 
and &gt; during export. Perhaps, it is possible to define a filter.



^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Inequalities in math blocks
  2021-10-03 12:19 ` Max Nikulin
@ 2021-10-03 13:12   ` Timothy
  2021-10-05  7:55     ` Rudolf Adamkovič
  2021-10-03 13:14   ` Rudolf Adamkovič
  2021-10-03 16:17   ` [PATCH] org-manual.org: Update links to MathJax docs Max Nikulin
  2 siblings, 1 reply; 22+ messages in thread
From: Timothy @ 2021-10-03 13:12 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 441 bytes --]

Hi Rudolf and Max,

>> Usually, it is sufficient simply to put spaces around these symbols to
>> cause the browser to avoid them, so
>> … when x < y we have …
>
> Though I am a bit surprised that Org did not replace characters to &lt; and &gt;
> during export. Perhaps, it is possible to define a filter.

You’re going to be much better off if you just use LaTeX math delimiters, i.e. `\(
... \)'.

All the best,
Timothy

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Inequalities in math blocks
  2021-10-03 12:19 ` Max Nikulin
  2021-10-03 13:12   ` Timothy
@ 2021-10-03 13:14   ` Rudolf Adamkovič
  2021-10-12  1:11     ` Nick Dokos
  2021-10-03 16:17   ` [PATCH] org-manual.org: Update links to MathJax docs Max Nikulin
  2 siblings, 1 reply; 22+ messages in thread
From: Rudolf Adamkovič @ 2021-10-03 13:14 UTC (permalink / raw)
  To: Max Nikulin, emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

> Though I am a bit surprised that Org did not replace characters 
> to &lt;  and &gt; during export. Perhaps, it is possible to 
> define a filter. 

That makes sense, and thank you for the explanation. Ignoring the 
dead link in the Org manual, I wonder how this bug can even exist 
in Org after 15+ years of development. Some people, including the 
author of TeX himself, write TeX without unnecessary whitespace. 
Strange! Either way, rearranging bullet points should never break 
math without any visual sign inside of Emacs. Thus, this 
represents a bug in Org. 

R+

-- 
I love deadlines. I love the whooshing noise they make as they go 
by. -- Douglas Adams, The Salmon of Doubt  Rudolf Adamkovič 
<salutis@me.com> Studenohorská 25 84103 Bratislava Slovakia 
[he/him]


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH] org-manual.org: Update links to MathJax docs
  2021-10-03 12:19 ` Max Nikulin
  2021-10-03 13:12   ` Timothy
  2021-10-03 13:14   ` Rudolf Adamkovič
@ 2021-10-03 16:17   ` Max Nikulin
  2 siblings, 0 replies; 22+ messages in thread
From: Max Nikulin @ 2021-10-03 16:17 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 862 bytes --]

On 03/10/2021 19:19, Max Nikulin wrote:
> 
> https://orgmode.org/manual/Math-formatting-in-HTML-export.html
> 
>> (131)
>>
>> Please note that exported formulas are part of an HTML document, and
>> that signs such as ‘<’, ‘>’, or ‘&’ have special meanings. See MathJax
>> TeX and LaTeX support.
> 
> The link is broken however.
> 
> http://docs.mathjax.org/en/latest/input/tex/html.html#html-special-characters 
> 
>> Usually, it is sufficient simply to put spaces around these symbols to
>> cause the browser to avoid them, so
>>
>> ... when $x < y$ we have ...
> 
> Though I am a bit surprised that Org did not replace characters to &lt; 
> and &gt; during export. Perhaps, it is possible to define a filter.

Let's fix at least the link. Old one gives 404 error.

P.S. Curiously outside of math snippets "<>" are properly exported to 
"&lt;&gt;"


[-- Attachment #2: 0001-org-manual.org-Update-links-to-MathJax-docs.patch --]
[-- Type: text/x-patch, Size: 1628 bytes --]

From be815b1476b5119db6c83363e1c7b2034b692ca6 Mon Sep 17 00:00:00 2001
From: Max Nikulin <manikulin@gmail.com>
Date: Sun, 3 Oct 2021 23:12:11 +0700
Subject: [PATCH] org-manual.org: Update links to MathJax docs

* doc/org-manual.org (Footnotes): Fix links to particular sections in
MathJax manual.

Scheme is not changed to https: since the site prefers http:

    curl -I https://docs.mathjax.org/
    HTTP/2 302
    date: Sun, 03 Oct 2021 16:04:15 GMT
    location: http://docs.mathjax.org/en/latest/
---
 doc/org-manual.org | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index b25da7889..52306caa6 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -22121,9 +22121,9 @@ semantic relevance.
 
 [fn:130] Please note that exported formulas are part of an HTML
 document, and that signs such as =<=, =>=, or =&= have special
-meanings.  See [[http://docs.mathjax.org/en/latest/tex.html#tex-and-latex-in-html-documents][MathJax TeX and LaTeX support]].
+meanings.  See [[http://docs.mathjax.org/en/latest/input/tex/html.html#tex-and-latex-in-html-documents][MathJax TeX and LaTeX in HTML documents]].
 
-[fn:131] See [[http://docs.mathjax.org/en/latest/tex.html#tex-extensions][TeX and LaTeX extensions]] in the [[http://docs.mathjax.org][MathJax manual]] to learn
+[fn:131] See [[http://docs.mathjax.org/en/latest/input/tex/extensions.html#tex-and-latex-extensions][TeX and LaTeX extensions]] in the [[http://docs.mathjax.org][MathJax manual]] to learn
 about extensions.
 
 [fn:132] If the classes on TODO keywords and tags lead to conflicts,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Inequalities in math blocks
  2021-10-03 13:12   ` Timothy
@ 2021-10-05  7:55     ` Rudolf Adamkovič
  2021-10-05  7:58       ` Timothy
  2021-10-05 12:00       ` Max Nikulin
  0 siblings, 2 replies; 22+ messages in thread
From: Rudolf Adamkovič @ 2021-10-05  7:55 UTC (permalink / raw)
  To: emacs-orgmode

Timothy <tecosaur@gmail.com> writes:

> You’re going to be much better off if you just use LaTeX math 
> delimiters, i.e. `\( ... \)'.

Interesting. It works, but I do not understand why! Do we consider 
inequalities in $$ breaking HTML export expected behavior? Or, do 
we consider it a bug? I suppose there exists no formal 
specification, executable or not, to answer the question? I ask 
because if $…$ breaks basic mathematics, I should either return 
back to LaTeX for any serious notes or replace every $…$ with 
\(…\) in all my Org files to avoid accidental breakage of 
mathematics in the future. Thank you!

R+ 

-- 
Programming reliably --- must be an activity of an undeniably 
mathematical nature [...] You see, mathematics is about thinking, 
and doing mathematics is always trying to think as well as 
possible. -- Edsger W. Dijkstra (1981)  Rudolf Adamkovič 
<salutis@me.com> Studenohorská 25 84103 Bratislava Slovakia 
[he/him]


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Inequalities in math blocks
  2021-10-05  7:55     ` Rudolf Adamkovič
@ 2021-10-05  7:58       ` Timothy
  2021-10-05 12:19         ` Eric S Fraga
  2021-10-05 12:00       ` Max Nikulin
  1 sibling, 1 reply; 22+ messages in thread
From: Timothy @ 2021-10-05  7:58 UTC (permalink / raw)
  To: Rudolf Adamkovič; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1295 bytes --]

Hi  Rudolf,

>> You’re going to be much better off if you just use LaTeX math delimiters, i.e.
>> `...’.
>
> Interesting. It works, but I do not understand why! Do we consider inequalities
> in $$ breaking HTML export expected behavior? Or, do we consider it a bug? I
> suppose there exists no formal specification, executable or not, to answer the
> question?

Just considering the general situation, $ is hard for Org because it needs to do
“double duty” as both a currency symbol in text, and math delimiters. This means
that it can’t be consistent with how LaTeX works. However, `\( ... \)' doesn’t and
so Org can be much more consistent with LaTeX here. Besides which `$ ... $' is a
TeX-ism and `\( ... \)' is the /proper/ way of doing inline maths in LaTeX, so
really you should be reaching for those anyway.

> I ask because if … breaks basic mathematics, I should either return
> back to LaTeX for any serious notes or replace every … with … in all my
> Org files to avoid accidental breakage of mathematics in the future. Thank you!

I’d just use `\( ... \)' in future, and that way you’ll be fine in LaTeX and Org
🙂. You might be able to use `org-element-map' to robustly convert from $ … $=
to `\( ... \)'.

All the best,
Timothy

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Inequalities in math blocks
  2021-10-05  7:55     ` Rudolf Adamkovič
  2021-10-05  7:58       ` Timothy
@ 2021-10-05 12:00       ` Max Nikulin
  2021-10-05 12:50         ` Rudolf Adamkovič
  1 sibling, 1 reply; 22+ messages in thread
From: Max Nikulin @ 2021-10-05 12:00 UTC (permalink / raw)
  To: emacs-orgmode

On 05/10/2021 14:55, Rudolf Adamkovič wrote:
> Timothy writes:
> 
>> You’re going to be much better off if you just use LaTeX math 
>> delimiters, i.e. `\( ... \)'.
> 
> Interesting. It works, but I do not understand why!

Did you inspect HTML file? Playing with export, I do not see real 
difference. Result is "\(1<2\)" even for $1<2$.

info "(org) LaTeX fragments" https://orgmode.org/manual/LaTeX-fragments.html
highlight some issues with $:
>  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. For the other delimiters, there is no such
> restriction, so when in doubt, use ‘\(...\)’ as inline math delimiters.

> Do we consider 
> inequalities in $$ breaking HTML export expected behavior? Or, do we 
> consider it a bug? I suppose there exists no formal specification, 
> executable or not, to answer the question?

Tom Gillespie mentioned in another thread yesterday:

https://orgmode.org/worg/dev/org-syntax.html#Entities_and_LaTeX_Fragments
>     It would introduce incompatibilities with previous Org versions, but
> support for $...$ (and for symmetry, $$...$$) constructs ought to be
> removed.
> 
>     They are slow to parse, fragile, redundant and imply false
> positives. — ngz




^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Inequalities in math blocks
  2021-10-05  7:58       ` Timothy
@ 2021-10-05 12:19         ` Eric S Fraga
  0 siblings, 0 replies; 22+ messages in thread
From: Eric S Fraga @ 2021-10-05 12:19 UTC (permalink / raw)
  To: Timothy; +Cc: emacs-orgmode, Rudolf Adamkovič

Slightly off-topic but, just in case anybody is interested, here is some
code I use to allow me to easily get \(...\) by typing $:

#+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

Typing two $ in a row inserts a single $.
-- 
: Eric S Fraga via Emacs 28.0.60, Org release_9.5-30-g9e71df
: Latest paper written in org: https://arxiv.org/abs/2106.05096


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Inequalities in math blocks
  2021-10-05 12:00       ` Max Nikulin
@ 2021-10-05 12:50         ` Rudolf Adamkovič
  0 siblings, 0 replies; 22+ messages in thread
From: Rudolf Adamkovič @ 2021-10-05 12:50 UTC (permalink / raw)
  To: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

> On 05/10/2021 14:55, Rudolf Adamkovič wrote: 
>> Timothy writes:  
>>> You’re going to be much better off if you just use LaTeX math 
>>> delimiters, i.e. `\( ... \)'. 
>> 
>> Interesting. It works, but I do not understand why! 
> 
> Did you inspect HTML file? Playing with export, I do not see 
> real  difference. Result is "\(1<2\)" even for $1<2$. 

Oops! I spoke too soon. I re-tried \( and \) with "1" and "2" 
instead of "a" and "b", but that does not break HTML rendering in 
Firefox. When I use "a" and "b" instead, like I did in my original 
post, it does break rendering with both $$ and \( and \).

- \(a>b\) \(b<a\)  $a>b$ $b<a$  I could still use \gt and \lt 
- everywhere, but ugh.   R+ 

-- 
Logic is a science of the necessary laws of thought, without which 
no employment of the understanding and the reason takes place. -- 
Immanuel Kant, 1785  Rudolf Adamkovič <salutis@me.com> 
Studenohorská 25 84103 Bratislava Slovakia  [he/him]


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Inequalities in math blocks
  2021-10-03 11:04 Inequalities in math blocks Rudolf Adamkovič
  2021-10-03 12:19 ` Max Nikulin
@ 2021-10-06  7:39 ` Rudolf Adamkovič
  2021-10-07 11:30   ` Greg Minshall
  1 sibling, 1 reply; 22+ messages in thread
From: Rudolf Adamkovič @ 2021-10-06  7:39 UTC (permalink / raw)
  To: emacs-orgmode

Rudolf Adamkovič <salutis@me.com> writes:

FYI: I have just discovered that this bug screwed up a paper I submitted to university this week. In the paper, I wrote the following: "[…] every term $t\in{}q$ with $idf(t)>c$ for some constant $c$ […]", and the "idf(t) > c" part got exported as "idf(t)". I cannot fix the paper at this point. Uh-oh!

R+

-- 
"Logic is a science of the necessary laws of thought, without which no employment of the understanding and the reason takes place." -- Immanuel Kant, 1785

Rudolf Adamkovič <salutis@me.com>
Studenohorská 25
84103 Bratislava
Slovakia

[he/him]


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Inequalities in math blocks
  2021-10-06  7:39 ` Inequalities in math blocks Rudolf Adamkovič
@ 2021-10-07 11:30   ` Greg Minshall
  2021-10-07 11:33     ` Timothy
  2021-10-07 12:53     ` Rudolf Adamkovič
  0 siblings, 2 replies; 22+ messages in thread
From: Greg Minshall @ 2021-10-07 11:30 UTC (permalink / raw)
  To: Rudolf =?utf-8?Q?Adamkovi=C4=8D?=; +Cc: emacs-orgmode

Rudolf,

> FYI: I have just discovered that this bug screwed up a paper I
> submitted to university this week. In the paper, I wrote the
> following: "[…] every term $t\in{}q$ with $idf(t)>c$ for some constant
> $c$ […]", and the "idf(t) > c" part got exported as "idf(t)". I cannot
> fix the paper at this point. Uh-oh!

oof.  \(...\) is the way to go.

cheers, Greg


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Inequalities in math blocks
  2021-10-07 11:30   ` Greg Minshall
@ 2021-10-07 11:33     ` Timothy
  2021-10-07 12:13       ` Greg Minshall
  2021-10-07 12:53     ` Rudolf Adamkovič
  1 sibling, 1 reply; 22+ messages in thread
From: Timothy @ 2021-10-07 11:33 UTC (permalink / raw)
  To: Greg Minshall; +Cc: emacs-orgmode, Rudolf =?utf-8?Q?Adamkovi=C4=8D?=

[-- Attachment #1: Type: text/plain, Size: 310 bytes --]

Hi Greg,

> oof.  ... is the way to go.

I’m thinking we should perhaps update the docs to more strongly recommend `\( ... \)'
over `$ ... $'. So that someone coming from say, Markdown + $-math or
(not-La)TeX doesn’t just go “cool, $ works, I’ll keep on using that”.

All the best,
Timothy

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Inequalities in math blocks
  2021-10-07 11:33     ` Timothy
@ 2021-10-07 12:13       ` Greg Minshall
  0 siblings, 0 replies; 22+ messages in thread
From: Greg Minshall @ 2021-10-07 12:13 UTC (permalink / raw)
  To: Timothy
  Cc: Rudolf =?us-ascii?Q?=3D=3Futf-8=3FQ=3FAdamkovi=3DC4=3D8D=3F=3D?=,
	emacs-orgmode

Timothy,

> I’m thinking we should perhaps update the docs to more strongly
> recommend `\( ... \)' over `$ ... $'. So that someone coming from say,
> Markdown + $-math or (not-La)TeX doesn’t just go “cool, $ works, I’ll
> keep on using that”.

i think that would be a helpful change.

cheers, Greg


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Inequalities in math blocks
  2021-10-07 11:30   ` Greg Minshall
  2021-10-07 11:33     ` Timothy
@ 2021-10-07 12:53     ` Rudolf Adamkovič
  2021-10-07 13:05       ` Timothy
  2021-10-08 12:37       ` Greg Minshall
  1 sibling, 2 replies; 22+ messages in thread
From: Rudolf Adamkovič @ 2021-10-07 12:53 UTC (permalink / raw)
  To: Greg Minshall; +Cc: emacs-orgmode

Greg Minshall <minshall@umich.edu> writes:

> oof.  \(...\) is the way to go.

I do not understand. As Max pointed out, inequalities break HTML export in \( and \) as well.

Example:

- \(a<b\)
- \(b>a\)

Org should rewrite < and > to &lt; and &gt; to avoid broken HTML, or as \lt{} and \rt{} in general.

R+
-- 
"'Contrariwise,' continued Tweedledee, 'if it was so, it might be; and if it were so, it would be; but as it isn't, it ain't. That's logic.'" -- Lewis Carroll, Through the Looking Glass

Rudolf Adamkovič <salutis@me.com>
Studenohorská 25
84103 Bratislava
Slovakia

[he/him]


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Inequalities in math blocks
  2021-10-07 12:53     ` Rudolf Adamkovič
@ 2021-10-07 13:05       ` Timothy
  2021-10-07 15:05         ` Max Nikulin
  2021-10-07 19:25         ` Rudolf Adamkovič
  2021-10-08 12:37       ` Greg Minshall
  1 sibling, 2 replies; 22+ messages in thread
From: Timothy @ 2021-10-07 13:05 UTC (permalink / raw)
  To: Rudolf Adamkovič; +Cc: Greg Minshall, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 746 bytes --]

Hi Rudolf,

> I do not understand. As Max pointed out, inequalities break HTML export in and as well.
>
> Example:
>
> - a<b
> - b>a
>
> Org should rewrite < and > to &lt; and &gt; to avoid broken HTML, or as < and  in general.

I think we’ve drifted a bit to the differences in processing (where the `\( ... \)'
vs `$ ... $' comments are most pertinent), but as you say for valid HTML < and >
should be rewritten. I don’t think I’ve seen an issue because MathJax seems to
take care of it, but it looks like MathJax is also fine with &lt; and &rt;.

As the maintainer for ox-html, I’ll take a look at this. I am exceptionally busy
over the next few weeks though, so there may be a brief delay.

All the best,
Timothy

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Inequalities in math blocks
  2021-10-07 13:05       ` Timothy
@ 2021-10-07 15:05         ` Max Nikulin
  2021-10-07 19:48           ` Rudolf Adamkovič
  2021-10-07 19:25         ` Rudolf Adamkovič
  1 sibling, 1 reply; 22+ messages in thread
From: Max Nikulin @ 2021-10-07 15:05 UTC (permalink / raw)
  To: emacs-orgmode

On 07/10/2021 20:05, Timothy wrote:
>> Org should rewrite < and > to &lt; and &gt; to avoid broken HTML, or as < and  in general.
> 
> I think we’ve drifted a bit to the differences in processing (where the `\( ... \)'
> vs `$ ... $' comments are most pertinent), but as you say for valid HTML < and >
> should be rewritten. I don’t think I’ve seen an issue because MathJax seems to
> take care of it, but it looks like MathJax is also fine with &lt; and &rt;.

"<" and ">" characters are valid only markup elements in HTML (part of 
tags, comments). MathJax interprets text content. Normally, to add text 
"<" or ">", "&lt;" or "&gt;" should be used in HTML sources. Browsers 
may pass "<" and ">" from source to text content if they are totally 
confused by invalid markup that does not resemble tags or something 
else. I do not think, it should be abused.

I cited MathJax docs just to show a temporary workaround till the bug 
will be fixed in Org. It is quite strange that Org properly converts 
"<>&" to entities in text but leaves them as is in math snippets. Unsure 
whether git history might clarify some reasons of such behavior.

On 06/10/2021 14:39, Rudolf Adamkovič wrote
> I wrote the following: "[…] every term $t\in{}q$ with $idf(t)>c$ for
> some constant $c$ […]", and the "idf(t) > c" part got exported as
> "idf(t)". I cannot fix the paper at this point. Uh-oh!

If you submitted HTML file, you might suggest to open sources to make it 
obvious that the mistake was not intentional.

"$idf(t)>c$" means "i*d*f(t) > c". A bit more markup required to make 
"idf" typed in straight font instead of italics and to avoid additional 
space between characters.

It is matter of taste, but "{}" after "\in" looks a bit strange for me. 
"$t\in q$ is even shorter, "$t \in q$", having the same length, is more 
readable from my point of view.



^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Inequalities in math blocks
  2021-10-07 13:05       ` Timothy
  2021-10-07 15:05         ` Max Nikulin
@ 2021-10-07 19:25         ` Rudolf Adamkovič
  1 sibling, 0 replies; 22+ messages in thread
From: Rudolf Adamkovič @ 2021-10-07 19:25 UTC (permalink / raw)
  To: emacs-orgmode

Timothy <tecosaur@gmail.com> writes:

> […] MathJax seems to take care of it […]

From what I understand, MathJax does nothing, for it expects to exit inside of valid HTML.

> […] but it looks like MathJax is also fine with &lt; and &rt;. […]

Not that I know how ox-html works internally, but FYI, we can also use TeX's native \lt{} and \gt{}.

> As the maintainer for ox-html, I’ll take a look at this.

Thank you so much in advance!

Rudy
-- 
"Logic is a science of the necessary laws of thought, without which no employment of the understanding and the reason takes place." -- Immanuel Kant, 1785

Rudolf Adamkovič <salutis@me.com>
Studenohorská 25
84103 Bratislava
Slovakia

[he/him]


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Inequalities in math blocks
  2021-10-07 15:05         ` Max Nikulin
@ 2021-10-07 19:48           ` Rudolf Adamkovič
  0 siblings, 0 replies; 22+ messages in thread
From: Rudolf Adamkovič @ 2021-10-07 19:48 UTC (permalink / raw)
  To: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

> If you submitted HTML file, you might suggest to open sources to make it obvious that the mistake was not intentional.

One day! The university system switches to a read-only mode at the end of every week, and I cannot open-source anything for two years after the submission. I ended up posting an "errata" comment.

> […] "idf" typed in straight font instead of italics and to avoid additional space between characters.

Yes, the three letters denote a function name, not a product of three variables. I simplified the snippet for the mailing list. In reality, I typed $\mathrm{idf}(t)>c$, as one should. Thank you for caring!

> It is matter of taste, but "{}" after "\in" looks a bit strange for me. "$t\in q$ is even shorter, "$t \in q$", having the same length, is more readable from my point of view.

Ha-ha! Yeah, I avoid spaces because they make me think for much too long about where to put them. Knuth would write $t\in q$, like you said, but that looks "unbalanced" to me. Of course, $t \in q$ looks best, but that sends me to back to the "whitespace paralysis" mode. Help wanted.

Rudy
-- 
"'Contrariwise,' continued Tweedledee, 'if it was so, it might be; and if it were so, it would be; but as it isn't, it ain't. That's logic.'" -- Lewis Carroll, Through the Looking Glass

Rudolf Adamkovič <salutis@me.com>
Studenohorská 25
84103 Bratislava
Slovakia

[he/him]


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Inequalities in math blocks
  2021-10-07 12:53     ` Rudolf Adamkovič
  2021-10-07 13:05       ` Timothy
@ 2021-10-08 12:37       ` Greg Minshall
  1 sibling, 0 replies; 22+ messages in thread
From: Greg Minshall @ 2021-10-08 12:37 UTC (permalink / raw)
  To: Rudolf Adamkovič; +Cc: emacs-orgmode

Rudolf,

> I do not understand. As Max pointed out, inequalities break HTML
> export in \( and \) as well.

my apologies for not having understood where we were in the discussion!

cheers, Greg


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Inequalities in math blocks
  2021-10-03 13:14   ` Rudolf Adamkovič
@ 2021-10-12  1:11     ` Nick Dokos
  2021-10-12 12:02       ` Max Nikulin
  0 siblings, 1 reply; 22+ messages in thread
From: Nick Dokos @ 2021-10-12  1:11 UTC (permalink / raw)
  To: emacs-orgmode

Rudolf Adamkovič <salutis@me.com> writes:

> Max Nikulin <manikulin@gmail.com> writes:
>
>> Though I am a bit surprised that Org did not replace characters to
>> &lt;  and &gt; during export. Perhaps, it is possible to define a
>> filter. 
>
> That makes sense, and thank you for the explanation. Ignoring the dead
> link in the Org manual, I wonder how this bug can even exist in Org
> after 15+ years of development. Some people, including the author of
> TeX himself, write TeX without unnecessary whitespace. Strange! Either
> way, rearranging bullet points should never break math without any
> visual sign inside of Emacs. Thus, this represents a bug in Org. R+

No, it does not. Org mode just passes LaTeX directly to MathJax
without changing anything. If you want to blame somebody, you can
blame HTML for choosing < and > as its delimiters: see

   http://docs.mathjax.org/en/latest/input/tex/html.html#html-special-characters

-- 
Nick



^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Inequalities in math blocks
  2021-10-12  1:11     ` Nick Dokos
@ 2021-10-12 12:02       ` Max Nikulin
  0 siblings, 0 replies; 22+ messages in thread
From: Max Nikulin @ 2021-10-12 12:02 UTC (permalink / raw)
  To: emacs-orgmode

On 12/10/2021 08:11, Nick Dokos wrote:
> Rudolf Adamkovič writes:
>> Max Nikulin writes:
>>
>>> Though I am a bit surprised that Org did not replace characters to
>>> &lt;  and &gt; during export. Perhaps, it is possible to define a
>>> filter.
>>
>> That makes sense, and thank you for the explanation. Ignoring the dead
>> link in the Org manual, I wonder how this bug can even exist in Org
>> after 15+ years of development. Some people, including the author of
>> TeX himself, write TeX without unnecessary whitespace. Strange! Either
>> way, rearranging bullet points should never break math without any
>> visual sign inside of Emacs. Thus, this represents a bug in Org. R+
> 
> No, it does not. Org mode just passes LaTeX directly to MathJax
> without changing anything. If you want to blame somebody, you can
> blame HTML for choosing < and > as its delimiters: see
> 
>     http://docs.mathjax.org/en/latest/input/tex/html.html#html-special-characters

Nick, I am sorry, but I do not see your point. Do you know any reason 
why Org properly escapes "<>&" in text but transparently passes them to 
HTML inside LaTeX fragment? Does escaping them everywhere lead to problems?

 From the referenced document (I posted this link on 2021-10-03):

> you need to be careful that your mathematics doesn’t look like HTML tags
> to the browser, which parses the page before MathJax gets to see it.
...
> you can use the HTML entities &lt;, &gt; and &amp; to encode these
> characters so that the browser will not interpret them, but MathJax will.

I fail to see any reason to blame HTML. Any text markup language 
requires some easily typed special characters. Org has one set of them, 
HTML another one. Export backend should just respect delimeters of the 
target format.

I understand expectations and thus complains of Rudolf. In my opinion he 
has reasons to be disappointed (and maybe even angry to some degree). It 
looks like a bug in Org that should be fixed. Workarounds exist but Org 
should be more reliable.





^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2021-10-12 12:09 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-03 11:04 Inequalities in math blocks Rudolf Adamkovič
2021-10-03 12:19 ` Max Nikulin
2021-10-03 13:12   ` Timothy
2021-10-05  7:55     ` Rudolf Adamkovič
2021-10-05  7:58       ` Timothy
2021-10-05 12:19         ` Eric S Fraga
2021-10-05 12:00       ` Max Nikulin
2021-10-05 12:50         ` Rudolf Adamkovič
2021-10-03 13:14   ` Rudolf Adamkovič
2021-10-12  1:11     ` Nick Dokos
2021-10-12 12:02       ` Max Nikulin
2021-10-03 16:17   ` [PATCH] org-manual.org: Update links to MathJax docs Max Nikulin
2021-10-06  7:39 ` Inequalities in math blocks Rudolf Adamkovič
2021-10-07 11:30   ` Greg Minshall
2021-10-07 11:33     ` Timothy
2021-10-07 12:13       ` Greg Minshall
2021-10-07 12:53     ` Rudolf Adamkovič
2021-10-07 13:05       ` Timothy
2021-10-07 15:05         ` Max Nikulin
2021-10-07 19:48           ` Rudolf Adamkovič
2021-10-07 19:25         ` Rudolf Adamkovič
2021-10-08 12:37       ` Greg Minshall

Code repositories for project(s) associated with this 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 NNTP newsgroup(s).