emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Faulty SVG width in default HTML export style
@ 2022-03-03  8:11 Yuchen Guo
  2022-03-28 12:36 ` Bastien
  2022-03-28 19:41 ` Rudolf Adamkovič
  0 siblings, 2 replies; 12+ messages in thread
From: Yuchen Guo @ 2022-03-03  8:11 UTC (permalink / raw)
  To: emacs-orgmode


Currently the style specified for SVG images
in `org-html-style-default' variable is the following:

    .org-svg { width: 90%; }

This causes a single image (math formula) to occupy almost the width of
the entire page, rendering the page unreadable.

In my experiment removing this line fixed the issue.

Two PNG screenshots demostrating the issue is available under the
following links:

https://w.wiki/4uQd
https://w.wiki/4uQe

-- 
Yuchen Guo


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

* Re: Faulty SVG width in default HTML export style
  2022-03-03  8:11 Faulty SVG width in default HTML export style Yuchen Guo
@ 2022-03-28 12:36 ` Bastien
  2022-03-28 19:41 ` Rudolf Adamkovič
  1 sibling, 0 replies; 12+ messages in thread
From: Bastien @ 2022-03-28 12:36 UTC (permalink / raw)
  To: Yuchen Guo; +Cc: emacs-orgmode

Hi,

Yuchen Guo <Guoyuc@students.uni-marburg.de> writes:

> Currently the style specified for SVG images
> in `org-html-style-default' variable is the following:
>
>     .org-svg { width: 90%; }
>
> This causes a single image (math formula) to occupy almost the width of
> the entire page, rendering the page unreadable.
>
> In my experiment removing this line fixed the issue.

Indeed, thanks for spotting and reporting this, fixed in the bugfix
branch.

-- 
 Bastien


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

* Re: Faulty SVG width in default HTML export style
  2022-03-03  8:11 Faulty SVG width in default HTML export style Yuchen Guo
  2022-03-28 12:36 ` Bastien
@ 2022-03-28 19:41 ` Rudolf Adamkovič
  2022-03-29 14:48   ` Yuchen Guo
  1 sibling, 1 reply; 12+ messages in thread
From: Rudolf Adamkovič @ 2022-03-28 19:41 UTC (permalink / raw)
  To: Yuchen Guo, emacs-orgmode

Yuchen Guo <Guoyuc@students.uni-marburg.de> writes:

> In my experiment removing this line fixed the issue.

Thank you for reporting this!  I now wonder if anyone knows how to fix
the misaligned baselines of inline LaTeX fragments (as shown in the
second screenshot).  If we could somehow fix that, MathJax-less export
could become usable in practice *and* it would also unlock full LaTeX
power, including TikZ and beyond!  (It would also put Emacs ahead of the
pack in the world of LaTeX-capable editors because virtually every other
modern editor, including the proprietary ones, can just use MathJax.)

Rudy
-- 
"Mathematics takes us still further from what is human into the region
of absolute necessity, to which not only the actual world, but every
possible world, must conform."
-- Bertrand Russell, 1902

Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia


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

* Re: Faulty SVG width in default HTML export style
  2022-03-28 19:41 ` Rudolf Adamkovič
@ 2022-03-29 14:48   ` Yuchen Guo
  2022-04-03 16:34     ` Rudolf Adamkovič
  0 siblings, 1 reply; 12+ messages in thread
From: Yuchen Guo @ 2022-03-29 14:48 UTC (permalink / raw)
  To: Rudolf Adamkovič; +Cc: emacs-orgmode


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

> I now wonder if anyone knows how to fix the misaligned baselines of
> inline LaTeX fragments (as shown in the second screenshot).

I think we can solve this issue by looking at how Wikipedia does the
alignment of text and LaTeX snippets.  A cursory look at

  https://en.wikipedia.org/wiki/Normal_distribution

... shows that they use something like this:

  <img src="..." style="vertical-align: -0.838ex; width:5.663ex; height:2.676ex;">

The alignment parameters are also dependent on the snippet itself.

> If we could somehow fix that, MathJax-less export
> could become usable in practice *and* it would also unlock full LaTeX
> power, including TikZ and beyond!  (It would also put Emacs ahead of the
> pack in the world of LaTeX-capable editors because virtually every other
> modern editor, including the proprietary ones, can just use MathJax.)

For me, Emacs using MathJax as default came across as an unpleasant
surprise: any person aware of the free/libre software movement knows
that one should never allow Javascript to run in their browser: (ref
https://www.gnu.org/philosophy/javascript-trap.html ).

MathJax is not even compatible with LibreJS and loads script from
a bunch of 3rd-party servers like Cloudflare.  This enables those 3rd
parties to track visitors to your website.

Also, by loading external scripts, author of an website essentially puts
the website and its visitors under the mercy of the script: the script,
if malicious, can just sabotage the entire website.

Sadly it seems that there aren't enough people using Orgmode with SVG:
this CSS bug is at least present since 2020, according to git logs.
Rendering SVG images is also painfully slow: I can export the document
as PDF much faster than as HTML+SVG.  Then there is the alignment issue.

> @me.com

Unrelated but I think its best to not use Apple dis-services: it has a
record of kowtowing to government requests such as moving email account
to surveillance-friendly regimes:
https://en.wikipedia.org/wiki/ICloud#China

Not to mention its utter contempt of Software Freedom such as forbidding
GNU GPL on their program distribution platform.
-- 
Yuchen Guo


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

* Re: Faulty SVG width in default HTML export style
  2022-03-29 14:48   ` Yuchen Guo
@ 2022-04-03 16:34     ` Rudolf Adamkovič
  2022-04-04  2:57       ` Ihor Radchenko
  0 siblings, 1 reply; 12+ messages in thread
From: Rudolf Adamkovič @ 2022-04-03 16:34 UTC (permalink / raw)
  To: Yuchen Guo; +Cc: emacs-orgmode, rms

Yuchen Guo <Guoyuc@students.uni-marburg.de> writes:

Hi Yuchen!

> I think we can solve this issue by looking at how Wikipedia does the
> alignment of text and LaTeX snippets.  [...] The alignment parameters
> are also dependent on the snippet itself.

Good idea!

> For me, Emacs using MathJax as default came across as an unpleasant
> surprise: any person aware of the free/libre software movement knows
> that one should never allow Javascript to run in their browser: (ref
> https://www.gnu.org/philosophy/javascript-trap.html ).
>
> MathJax is not even compatible with LibreJS and loads script from
> a bunch of 3rd-party servers like Cloudflare.  This enables those 3rd
> parties to track visitors to your website.

How did that get through the FSF/RMS strict ethical requirements for
Emacs?  As soon as the user adds a simple "$1 + 1 = 2$" to their Org
document, the HTML export from Emacs/Org becomes quietly tracked by an
American company.  Emacs should never do that, IMO.

[I decided to CC RMS on this issue.]

(On a related note, the Emacs/Org manual mentions, "if you are following
a system like David Allen's GTD", implicitly promoting a book that the
publisher distributes just with mandatory DRM [1].)

[1] https://orgmode.org/manual/Stuck-projects.html

Agreed 100 percent with everything else you said.  Further, in addition
to the ethical issues, MathJax also makes the website render slower.
With SVG, mathematics appears instantly, like on Wikipedia.

> Unrelated but I think its best to not use Apple dis-services: [...]

Definitely, and thank you for the reminder.  The address dates back to
when I still used Apple services.  These days, I do not use them for
personal purposes anymore, except for their IMAP server to fetch the
messages.  That said, I do plan to address the issue for sure.

Rudy
-- 
"Thinking is a momentary dismissal of irrelevancies."
-- Richard Buckminster Fuller, 1969

Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia


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

* Re: Faulty SVG width in default HTML export style
  2022-04-03 16:34     ` Rudolf Adamkovič
@ 2022-04-04  2:57       ` Ihor Radchenko
  2022-04-04  4:38         ` Yuchen Guo
  0 siblings, 1 reply; 12+ messages in thread
From: Ihor Radchenko @ 2022-04-04  2:57 UTC (permalink / raw)
  To: Rudolf Adamkovič; +Cc: Yuchen Guo, emacs-orgmode, rms

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

>> For me, Emacs using MathJax as default came across as an unpleasant
>> surprise: any person aware of the free/libre software movement knows
>> that one should never allow Javascript to run in their browser: (ref
>> https://www.gnu.org/philosophy/javascript-trap.html ).
>>
>> MathJax is not even compatible with LibreJS and loads script from
>> a bunch of 3rd-party servers like Cloudflare.  This enables those 3rd
>> parties to track visitors to your website.
>
> How did that get through the FSF/RMS strict ethical requirements for
> Emacs?  As soon as the user adds a simple "$1 + 1 = 2$" to their Org
> document, the HTML export from Emacs/Org becomes quietly tracked by an
> American company.  Emacs should never do that, IMO.

1. MathJax is not the default export option. See org-html-with-latex
2. We use MathJax script from
https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js It is
licenced under Apache 2.0, which is GPL-compatible according to
https://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses

> (On a related note, the Emacs/Org manual mentions, "if you are following
> a system like David Allen's GTD", implicitly promoting a book that the
> publisher distributes just with mandatory DRM [1].)
>
> [1] https://orgmode.org/manual/Stuck-projects.html

Emm. No? One can simply read
https://en.wikipedia.org/wiki/Getting_Things_Done and free references
from there. The fact that GTD methodology is described in some
DRM-protected book does not imply that one must use that particular book
to learn GTD. It would only be an issue if Org manual contained a direct
link to David's book.

Best,
Ihor


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

* Re: Faulty SVG width in default HTML export style
  2022-04-04  2:57       ` Ihor Radchenko
@ 2022-04-04  4:38         ` Yuchen Guo
  2022-04-04  5:20           ` Ihor Radchenko
  0 siblings, 1 reply; 12+ messages in thread
From: Yuchen Guo @ 2022-04-04  4:38 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Rudolf Adamkovič, emacs-orgmode, rms


Ihor Radchenko <yantar92@gmail.com> writes:

> 1. MathJax is not the default export option. See org-html-with-latex

Maybe I'm getting confused here, but as of the latest commit
(cbe3f2d697a973a41a412b826ab9435d5523f3d0):

- in ox-html.el, `org-html-with-latex' is defined as
  `org-export-with-latex', with the comment that:

  `mathjax', t:  Do MathJax preprocessing and arrange for MathJax.js to
                 be loaded.

- in ox.el, `org-export-with-latex' is defined as `t'.

Therefore, MathJax is the default export option for math snippets in
HTML exports.

> 2. We use MathJax script from
> https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js It is
> licenced under Apache 2.0, which is GPL-compatible according to
> https://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses

Yes.  But it is still problematic because:

- The license is not declared in the script and therefore not compatible
  with LibreJS.

- It is not trivial to `control your computing', as in `modifying the
  script and run your modified copy instead.'

  Maybe LibreJS can provide us the facility to do so.

-- 
Yuchen Guo


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

* Re: Faulty SVG width in default HTML export style
  2022-04-04  4:38         ` Yuchen Guo
@ 2022-04-04  5:20           ` Ihor Radchenko
  2022-04-04  7:24             ` Ethical problems with MathJax as default - Was: Faulty SVG width Yuchen Guo
  0 siblings, 1 reply; 12+ messages in thread
From: Ihor Radchenko @ 2022-04-04  5:20 UTC (permalink / raw)
  To: Yuchen Guo; +Cc: emacs-orgmode, Rudolf Adamkovič, rms

Yuchen Guo <Guoyuc@students.uni-marburg.de> writes:

> Maybe I'm getting confused here, but as of the latest commit
> (cbe3f2d697a973a41a412b826ab9435d5523f3d0):
>
> - in ox-html.el, `org-html-with-latex' is defined as
>   `org-export-with-latex', with the comment that:
>
>   `mathjax', t:  Do MathJax preprocessing and arrange for MathJax.js to
>                  be loaded.
>
> - in ox.el, `org-export-with-latex' is defined as `t'.
>
> Therefore, MathJax is the default export option for math snippets in
> HTML exports.

My fault. You are right. I missed that `org-export-with-latex' is a
variable, not a symbol. If you think that we need to change the default,
feel free to open a new thread proposing an alternative.

>> 2. We use MathJax script from
>> https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js It is
>> licenced under Apache 2.0, which is GPL-compatible according to
>> https://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses
>
> Yes.  But it is still problematic because:
>
> - The license is not declared in the script and therefore not compatible
>   with LibreJS.

The license is declared in the script. You can see it by following the
script url. It is right on top.

The other question is why LibreJS does not recognise the license.
Maybe LibreJS can fix it on LibreJS side or maybe we can indicate that
MathJax is GPL-compatible on the html page itself
(https://www.gnu.org/software/librejs/manual/html_node/Setting-Your-JavaScript-Free.html)
For the latter, patches are welcome.

> - It is not trivial to `control your computing', as in `modifying the
>   script and run your modified copy instead.'

I am not sure what is the problem here. Apache licence does not restrict
modifications and you can use your modified MathJax source by
customising org-html-mathjax-options.

Best,
Ihor



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

* Ethical problems with MathJax as default - Was: Faulty SVG width
  2022-04-04  5:20           ` Ihor Radchenko
@ 2022-04-04  7:24             ` Yuchen Guo
  2022-04-04  8:00               ` Ihor Radchenko
  2022-04-06  4:12               ` Richard Stallman
  0 siblings, 2 replies; 12+ messages in thread
From: Yuchen Guo @ 2022-04-04  7:24 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Rudolf Adamkovič, emacs-orgmode, rms


Ihor Radchenko <yantar92@gmail.com> writes:

> The license is declared in the script. You can see it by following the
> script url. It is right on top.

True. My fault.  The problem is that the declaration is not
machine-readable by LibreJS.

On the other hand, I think it is more preferable and more
privacy-conscious to forbid loading from Cloudflare and use a local copy
of MathJax embedded in LibreJS instead:

- One can not trust Cloudflare.
- Even if it is trusted, Cloudflare would still (at least)
  log the IP address.

> I am not sure what is the problem here. Apache licence does not restrict
> modifications and you can use your modified MathJax source by
> customising org-html-mathjax-options.

Oh, I meant the freedom of the website visitor replacing MathJax with a
modified version on-the-fly, not of the website authors.  That is not
trivial.

Thanks for the tip!  I will certainly use a local copy of MathJax when
necessary.

-- 
Yuchen Guo


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

* Re: Ethical problems with MathJax as default - Was: Faulty SVG width
  2022-04-04  7:24             ` Ethical problems with MathJax as default - Was: Faulty SVG width Yuchen Guo
@ 2022-04-04  8:00               ` Ihor Radchenko
  2022-04-06  4:12                 ` Richard Stallman
  2022-04-06  4:12               ` Richard Stallman
  1 sibling, 1 reply; 12+ messages in thread
From: Ihor Radchenko @ 2022-04-04  8:00 UTC (permalink / raw)
  To: Yuchen Guo; +Cc: emacs-orgmode, Rudolf Adamkovič, rms

Yuchen Guo <Guoyuc@students.uni-marburg.de> writes:

>> The license is declared in the script. You can see it by following the
>> script url. It is right on top.
>
> True. My fault.  The problem is that the declaration is not
> machine-readable by LibreJS.

I understand the problem, however I do not see why LibreJS could not
whitelist MathJax. It is a technical limitation of current LibreJS
implementation, not the problem of software freedom.

> On the other hand, I think it is more preferable and more
> privacy-conscious to forbid loading from Cloudflare and use a local copy
> of MathJax embedded in LibreJS instead:
>
> - One can not trust Cloudflare.
> - Even if it is trusted, Cloudflare would still (at least)
>   log the IP address.

To clarify, software freedom has little to do with privacy. Currently,
ox-html does comply with
https://www.gnu.org/prep/standards/standards.html

Of course, it does not mean that privacy should be ignored. If you have
any ideas or patches that can improve the current situation with
the mathjax coudflare link, feel free to share them.

>> I am not sure what is the problem here. Apache licence does not restrict
>> modifications and you can use your modified MathJax source by
>> customising org-html-mathjax-options.
>
> Oh, I meant the freedom of the website visitor replacing MathJax with a
> modified version on-the-fly, not of the website authors.  That is not
> trivial.

greasemonkey script? I guess that one can just replace all the scripts
linking to .+/MathJax.js with local script references.

Best,
Ihor



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

* Re: Ethical problems with MathJax as default - Was: Faulty SVG width
  2022-04-04  8:00               ` Ihor Radchenko
@ 2022-04-06  4:12                 ` Richard Stallman
  0 siblings, 0 replies; 12+ messages in thread
From: Richard Stallman @ 2022-04-06  4:12 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode, Guoyuc, salutis

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

In general, being free software does not automatically assure that the
program has no malicious features.

What it does is assure that the users can check the source code for
any malicious features, and fix any that are spotted.

  > I understand the problem, however I do not see why LibreJS could not
  > whitelist MathJax. It is a technical limitation of current LibreJS
  > implementation, not the problem of software freedom.

Perhaps it should do that.

I think we could use more help to maintain LibreJS.
Anyone who would like to help, please write to maintainers@gnu.org.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)




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

* Re: Ethical problems with MathJax as default - Was: Faulty SVG width
  2022-04-04  7:24             ` Ethical problems with MathJax as default - Was: Faulty SVG width Yuchen Guo
  2022-04-04  8:00               ` Ihor Radchenko
@ 2022-04-06  4:12               ` Richard Stallman
  1 sibling, 0 replies; 12+ messages in thread
From: Richard Stallman @ 2022-04-06  4:12 UTC (permalink / raw)
  To: Yuchen Guo; +Cc: emacs-orgmode, salutis, yantar92

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > On the other hand, I think it is more preferable and more
  > privacy-conscious to forbid loading from Cloudflare and use a local copy
  > of MathJax embedded in LibreJS instead:

I agree.  Perhaps GNU/Linux distros should start packaging MathJax
for local installation, so that the local copy will be used instead.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)




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

end of thread, other threads:[~2022-04-06  4:14 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03  8:11 Faulty SVG width in default HTML export style Yuchen Guo
2022-03-28 12:36 ` Bastien
2022-03-28 19:41 ` Rudolf Adamkovič
2022-03-29 14:48   ` Yuchen Guo
2022-04-03 16:34     ` Rudolf Adamkovič
2022-04-04  2:57       ` Ihor Radchenko
2022-04-04  4:38         ` Yuchen Guo
2022-04-04  5:20           ` Ihor Radchenko
2022-04-04  7:24             ` Ethical problems with MathJax as default - Was: Faulty SVG width Yuchen Guo
2022-04-04  8:00               ` Ihor Radchenko
2022-04-06  4:12                 ` Richard Stallman
2022-04-06  4:12               ` Richard Stallman

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 read-only IMAP folder(s) and NNTP newsgroup(s).