I'm using VScode and trying to export PDF made with Markdown.
However, there are codes in the exported pdf file, such as $
and \int
etc.
I don't know why but headers #
are displayed correctly.
How can I fix this?
Situation:
Write .md code in VScode
Export PDF with MarkDown PDF
Exported PDF converts #
but doesn't same about $$
.
There are a number of open issues requesting first-class support for math in that extension, but at the moment it isn't supported out of the box.
There is some evidence that you can append some HTML to your source Markdown document to get math to work, even in the PDF export:
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: {inlineMath: [['$', '$']]}, messageStyle: "none" });
</script>
I'm not sure how that extension works internally, but the "Install" section of its README says that "Installing Chromium" will appear in the status bar during installation, and the "Special thanks" section credits Puppeteer.
That suggests that PDFs are generated from intermediate HTML. If that's the case, the MathJax snippet above would indeed have an opportunity to render math before the PDF is built.