element-hq / element-android

A Matrix collaboration client for Android.
https://element.io/
Apache License 2.0
3.31k stars 702 forks source link

Cannot send Latex, but receive on Android #5883

Open MultiCoreNop opened 2 years ago

MultiCoreNop commented 2 years ago

Steps to reproduce

  1. Send a formula (e.g. $$x$$)
  2. Receive such a formula

Outcome

What did you expect?

Both formulas are rendered as TeX.

What happened instead?

Only the one sent from element-desktop is being correctly rendered.

On another (Android 11) device it does work.

Your phone model

Samsung s6 / Oneplus 5

Operating system version

Android 12 / Android 10

Application version and app store

1.4.13 from Play Store (OLM 3.2.10)

Homeserver

matrix.org

Will you send logs?

No

MultiCoreNop commented 2 years ago

Sent from element-desktop, the message source is:

{
  "type": "m.room.message",
  "content": {
    "org.matrix.msc1767.message": [
      {
        "body": "$$3+x$$",
        "mimetype": "text/plain"
      },
      {
        "body": "<div data-mx-maths=\"3+x\"><code>3+x</code></div>",
        "mimetype": "text/html"
      }
    ],
    "body": "$$3+x$$",
    "msgtype": "m.text",
    "format": "org.matrix.custom.html",
    "formatted_body": "<div data-mx-maths=\"3+x\"><code>3+x</code></div>"
  }
}

Sent from Android 12:

{
  "content": {
    "body": "* $$3+x$$",
    "m.new_content": {
      "body": "$$3+x$$",
      "msgtype": "m.text"
    },
    "msgtype": "m.text"
  },
  "room_id": "!yMWVBahpRfpGyHnxsG:matrix.org",
  "type": "m.room.message"
}
bmarty commented 2 years ago

You have to enable LaTeX rendering from the labs settings and restart the app.

Please re-open the issue if it still does not work.

MultiCoreNop commented 2 years ago

As I mentioned, I tested it on multiple devices, while it does work on a single one, but not on the others. So I obviously enabled the labs feature (and restarted). ;)

tobiasBora commented 2 years ago

I can confirm this bug, but running Android 11 (Samsung XCover 4s).

Message sent from Android 11:

{
  "content": {
    "body": "Test with one dollar $f(\\alpha)$ and two dollars $$f(x)$$.",
    "msgtype": "m.text"
  },
  "room_id": "!bEWaaXUfDxSzypZbfG:matrix.org",
  "type": "m.room.message"
}

Sent from https://develop.element.io (note that surprisingly, the doubled dollar is displayed in the android version but not on the web version, despite the fact that mathjax is not used here) .

{
  "type": "m.room.message",
  "content": {
    "org.matrix.msc1767.message": [
      {
        "body": "Test with one dollar $f(\\alpha)$ and two dollars $$f(x)$$.",
        "mimetype": "text/plain"
      },
      {
        "body": "Test with one dollar <span data-mx-maths=\"f(\\alpha)\"><code>f(\\alpha)</code></span> and two dollars $$f(x)$$.",
        "mimetype": "text/html"
      }
    ],
    "body": "Test with one dollar $f(\\alpha)$ and two dollars $$f(x)$$.",
    "msgtype": "m.text",
    "format": "org.matrix.custom.html",
    "formatted_body": "Test with one dollar <span data-mx-maths=\"f(\\alpha)\"><code>f(\\alpha)</code></span> and two dollars $$f(x)$$."
  }
}
dinojr commented 2 years ago

Same problem here with a Google Pixel 3a, running Android 12. I'm on the beta program of Element.

LaifsV1 commented 1 year ago

Came from the merging with Gitter. Same issue. I am able to enable the LaTeX rendering on Labs in Settings. I can see others type LaTeX, but my own messages appear as plain text.

HammyHavoc commented 8 months ago

Came from the merging with Gitter. Same issue. I am able to enable the LaTeX rendering on Labs in Settings. I can see others type LaTeX, but my own messages appear as plain text.

Yes, came here to report the same.

Stranger still, on Element Desktop on Linux, I can't see the rendered output, only what I give it, e.g., $$ V_i=\frac{1}{\overline{U D_i}+R D_i} $$.