Search code examples
markdownpandocmathjax

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.


Solution

  • 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.