markor icon indicating copy to clipboard operation
markor copied to clipboard

Display math environment fails to parse if contained an isolated equal sign

Open erratically opened this issue 5 months ago • 3 comments

⚠️ This issue respects the following points: ⚠️

  • [x] This is a bug. Not a question or feature request.
  • [x] The topic is not already reported at Issues. (I've searched it).
  • [x] Markor is up to date. See Releases for the latest version. Updates are available from F-Droid and GitHub.
  • [x] The bug is still present in the latest development version (git master). (Please download and try the test version of Markor, named Marder. Don't worry; Markor and Marder appear as completely separate applications. You can install both side-by-side, and Markor settings are not touched. In case the issue is resolved there, you don't need to create a bug report. The change will be part of the next Markor update.)

Description

In Markdown documents, in a display math environment (i.e. enclosed in a pair of $$) if an equal sign appears on a line by itself (possibly accompanied by whitespace characters only), the environment is not parsed correctly.

Steps to reproduce

Good

$$
(a + b )^2 = a^2 + b^2 + 2ab
$$

Bad

$$
(a + b )^2
\, =
a^2 + b^2 + 2ab
$$

Ugly

$$
(a + b )^2
=
a^2 + b^2 + 2ab
$$

Information

Android version: 15 Device: Samsung App Version: 2.14.1

Source

F-Droid

Format / File type

Markdown

Additional info / Log

Of course, one can avoid the issue by not placing the equal sign on a line of its own, but not all LLMs are there yet; and the issue is syntactic.

erratically avatar Aug 02 '25 15:08 erratically

Improvements are welcome. May be that KaTex, the library has an issue though.

gsantner avatar Aug 02 '25 16:08 gsantner

  1. This is also an issue for inline math (pairs of $ signs).
  2. Github's MathJax only parses the first example correctly, but on www.mathjax.org/#demo they all are parsed correctly.
  3. All examples are parsed correctly on the homepage of katex.org.

erratically avatar Aug 02 '25 16:08 erratically

You need to note it's embedded in Markdown, of course possible that it behaves differently in plain math syntax.

(as you noticed also on GitHub)

gsantner avatar Aug 02 '25 17:08 gsantner