Skip to content

Clarification of tex_math_dollars extension, and parsing limitations/possible bug #1677

@gpoore

Description

@gpoore

In the docs, it is clearly explained that the opening $ for TeX math must be followed by a non-space character, and the closing $ must be preceded by a non-space character.

The amsmath package defines a \text macro that allows normal text, including $-delimited math, to be included within equations. So, for example,

$a = b_\text{c $d$ e}$

yields
math
As might be expected from the description of Pandoc's dollar parsing, Pandoc won't parse this correctly. It might be useful to mention explicitly in the docs that Pandoc isn't compatible with amsmath's \text macro, and that \mathrm can generally be used as a less powerful alternative. Or just mention explicitly that $ inside equations can cause things to break.

When the above code is sent through Pandoc in markdown mode, it returns the HTML

<p>$a = b_$</p>

This is problematic because the subscript was completely eliminated--fragments don't even remain outside the math. Also, the final LaTeX is now invalid. It would be nice if the parsing failure could be more graceful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions