Discrepancy between handling of math blocks in live preview and reading view

Steps to reproduce

Write a note like so:

We then clearly have that $$
e^{\pi i} + 1 = 0
$$  which completes the proof. Q.E.D.

# Sample Text

Expected result

Either both live preview and reading view should agree that this renders as
or they should agree that it renders as

Actual result

The live preview renders as the first image, and the reading view renders as the second image.


  • Operating system: Windows 11
  • Debug info:
    Obsidian version: v0.15.9
    Installer version: v0.15.9
    Operating system: Windows 10 Pro 10.0.22622
    Login status: logged in
    Catalyst license: none
    Insider build toggle: off
    Live preview: on
    Legacy editor: off
    Base theme: dark
    Community theme: Minimal
    Snippets enabled: 1
    Restricted mode: off
    Plugins installed: 13
    Plugins enabled: 11
    1: Latex Suite v1.5.0
    2: Obsidian Graphviz v1.0.4
    3: Excalidraw v1.7.22
    4: Quick Switcher++ v2.0.7
    5: Extended MathJax v0.3.0
    6: TikZJax v0.5.1
    7: Minimal Theme Settings v5.3.2
    8: Better footnote v1.0.1
    9: Contextual Typography v2.2.4
    10: Outliner v3.0.0
    11: Zoom v1.0.1

Custom theme: for cosmetic issues, please first try updating your theme to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community theme and snippets.
Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.

Additional information

For this to display correctly, reading view actually requires a newline immediately before the first $$ and immediately after the second $$.

Thanks, the reader is correct.

Thanks (although I kind of wish it was the other way 'round). The bug seems kind of minor, but as a new user who uses Obsidian for math notes and didn’t pay attention to the reader view, it was really annoying when I realized that basically all my notes with equations had to be fixed because none would display properly.

I don’t use MathJax, but it seems really weird for Live Preview to render it more fully than Reading View.

@nomai , I think this or something related came up on Discord recently. I don’t remember the details but I think it has something to do with how the dollar signs were distributed across lines. Try formatting it so they’re all on the same line, or so the last ones aren’t on their own line.

The problem is not that reader view doesn’t render it (I’d def prefer if it did but it’s probably not a bug that it doesn’t), the problem is that live preview does, which makes it easy to accidentally write notes that look fine in the live preview but are unreadable in reader mode.

Yes, I know. The 2 views render things differently, so it’s possible that writing it a little differently may get reader view to recognize it, eliminating the discrepancy. Obviously that’s only a workaround and it’d be better if the discrepancy didn’t exist. It’s really surprising that live preview is doing more rendering than reading view.

Yeah, my point is just that this particular discrepancy can result in writing notes that are completely unreadable, and having to fix each one individually. I might actually write a feature request to change the reader rendering so that it works like the live preview does – I don’t see how it would break anything, and I actually think that it would solve a lot of other problems / annoyances with the way Obsidian handles math if you could basically just write display math inline.

Yeah, it’s definitely a UX bug (which the devs classify as feature requests).

Okay actually I’ve been playing around with this and it’s really weird? Like there doesn’t seem to be a consistent rule for when it renders correctly and when it does not:

Maybe this actually is just a bug? Not sure exactly what the intended behavior is so it’s unclear.

1 Like

I am not sure I can repro.
Can you attach a file where this happens?

Is the file on this post any use (or a different issue)?

Could it really be classified as a bug if live preview and reading view disagrees on how they treat something which is against the syntax?

In other words, is it a bug when they handle erroneous syntax differently?

yes, it is. Sometime it’s out of our hands because it depends on third party parsers, but ideally LP and reader should agree on how things are parsed.

Hi, I encountered seemingly the same issue:

A sequence $(u_i)_i$ converges to $v$ if  $$
\forall \epsilon > 0 : \exists N \in \mathbb{N} : \forall n \ge N : \lvert u_n - v \rvert < \epsilon.

Live preview:

Reading view:

This is the sandbox vault with no plugins enabled.