GNU bug report logs - #63518
28.2; shr.el seems to break inline latex (mathjax) in html

Previous Next

Package: emacs;

Reported by: mousebot <mousebot <at> riseup.net>

Date: Mon, 15 May 2023 13:35:01 UTC

Severity: normal

Found in version 28.2

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: mousebot <mousebot <at> riseup.net>
Cc: 63518 <at> debbugs.gnu.org
Subject: bug#63518: 28.2; shr.el seems to break inline latex (mathjax) in html
Date: Mon, 15 May 2023 17:01:47 +0300
> Date: Mon, 15 May 2023 13:21:51 +0200
> From: mousebot <mousebot <at> riseup.net>
> 
> The fediverse client I maintain, mastodon.el, uses shr-render-region to render individual posts. Some instances, e.g. https://mathstodon.xyz, allow users to post inline latex using mathjax notation.
> 
> When shr.el renders inline latex, it often breaks it as it fills the text. It inserts a newline in between the two characters that open an inline latex block: `\(` or `\[`. Using normal fill commands to fill text (fill-region, fill paragraph) do not split latex in this way, from what I could gather.
> 
> When digging around and debugging a little, I found that in shr-find-fill-point, the check (shr-char-kinsoku-eol-p (following-char)) in the when condition returns t when point is in between \ and ( or [, meaning that shr-find-fill-point considers that position to be a breakable point. Commenting that single check seems to largely prevent the undesired splitting. (Behaviour confirmed by my checks and also by another mastodon.el user.)
> 
> I don't really understand the significance of the checks that shr-find-fill-point runs, nor whether they can be temporarily deactivated or worked around in some other way.

That function looks for a suitable place to break the line in two.

The question is whether we can reliably determine that we are inside
inline latex, so that we augment the conditions for a break point.
Turning that off unconditionally is not an option.  Do you happen to
know about some criteria to be applied to distinguish this special
case?

Thanks.




This bug report was last modified 2 years and 34 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.