S L
S L

Reputation: 14318

pandoc error converting inline mathjax in markdown document

I have a markdown document with mathjax. I want to convert it into pdf. I encounter an error

! Missing $ inserted.
<inserted text> 
                $
l.67 \] Set (R\_2 \to

pandoc: Error producing PDF

I believe it is generated by inline mathjax $R_2 \to R_2 + 2R_1$. If I wrap it with $$ ... mathjax ... $$ it gives proper result. How do I enable inline math with pandoc.

Upvotes: 1

Views: 1201

Answers (2)

Louis R
Louis R

Reputation: 1790

FWIW, I got the same error when trying to convert a Jupyter Notebook to PDF with xeLatex and nbconvert.
I had a space in the name of my notebook. It worked when I removed it.

Upvotes: 1

S L
S L

Reputation: 14318

I found the problem was the space between $ and the latex code. For example, $ R\_2 \to R\_2 + 2R\_1 $ was interpreted as \$ R\_2 \to R\_2 + 2R\_1 \$ so removing space between solved the problem i.e. $R\_2 \to R\_2 + 2R\_1$ worked out.

Upvotes: 3

Related Questions