Skip to content

Latex macros starting with \n like \nabla don't work when present in $$ blocks (extras: latex, breaks) #674

@Julynx

Description

@Julynx

Describe the bug

All latex macros that start with \n, such as \nabla or \neg are not parsed correctly when present in $$...$$ blocks. (They work correctly in single $...$ blocks, though). I'm using extras latex and breaks.

To Reproduce

  1. Enable extras latex and "breaks": {"on_newline": True}

  2. Try converting the following Markdown to HTML:

    • $\nabla$ --> Works! (Produces the ∇ character)

    • However, $$\nabla$$ does not work (Produces <mrow><mi>a</mi><mi>b</mi><mi>l</mi><mi>a</mi></mrow>)

The source of the error is probably that the \n part of \nabla gets interpreted as a literal line break instead of as part of the latex macro. As shown above, this happens only in latex "blocks" $$...$$ and not with inline latex $...$.

Expected behavior

See below how Github markdown renderer succeeds at parsing the operator:

$$\nabla$$

(Text above is literal $$\nabla$$)

Same with neg:

$$\neg$$

(Text above is literal $$\neg$$)

Debug info
Version of library being used: 2.5.4

Any extras being used: latex, breaks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions