<commit_before>
# LaTeX Math

With the flag `MD_FLAG_LATEXMATHSPANS`, MD4C enables extension for recognition
of LaTeX style math spans.

A math span is is any text wrapped in dollars or double dollars (`$...$` or
`$$...$$`).

```````````````````````````````` example
$a+b=c$ Hello, world!
.
<p><equation>a+b=c</equation> Hello, world!</p>
````````````````````````````````

If the double dollar sign is used, the math span is a display math span.

```````````````````````````````` example
This is a display equation: $$\int_a^b x dx$$.
.
<p>This is a display equation: <equation type="display">\int_a^b x dx</equation>.</p>
````````````````````````````````

Math spans may span multiple lines as they are normal spans.

```````````````````````````````` example
$$
\int_a^b f(x) dx
$$
<p><equation type="display">\int_a^b f(x) dx </equation></p>
````````````````````````````````

Note though that many (simple) renderers may output the math spans just as a
verbatim text. (This includes the HTML renderer used by the `md2html` utility.)

Only advanced renderers which implement LaTeX math syntax can be expected to
provide better results.<commit_msg>Fix the last test case in latex-math.txt.<commit_after>
# LaTeX Math

With the flag `MD_FLAG_LATEXMATHSPANS`, MD4C enables extension for recognition
of LaTeX style math spans.

A math span is is any text wrapped in dollars or double dollars (`$...$` or
`$$...$$`).

```````````````````````````````` example
$a+b=c$ Hello, world!
.
<p><equation>a+b=c</equation> Hello, world!</p>
````````````````````````````````

If the double dollar sign is used, the math span is a display math span.

```````````````````````````````` example
This is a display equation: $$\int_a^b x dx$$.
.
<p>This is a display equation: <equation type="display">\int_a^b x dx</equation>.</p>
````````````````````````````````

Math spans may span multiple lines as they are normal spans:

```````````````````````````````` example
$$
\int_a^b
f(x) dx
$$
.
<p><equation type="display">\int_a^b f(x) dx </equation></p>
````````````````````````````````

Note though that many (simple) renderers may output the math spans just as a
verbatim text. (This includes the HTML renderer used by the `md2html` utility.)

Only advanced renderers which implement LaTeX math syntax can be expected to
provide better results.
{'fraction_non_alphanumeric': 0.2622527944969905, 'fraction_numerical': 0.0017196904557179708, 'mean_word_length': 5.272237196765499, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2839452', 'n_tokens_mistral': 840, 'n_tokens_neox': 724, 'n_words': 269}