I am trying to export a PDF file from a Markdown document in VS Code. In VS Code’s preview pane I get a certain formatting (which I find desirable for my current task). However, when I export to PDF using the Markdown PDF extension, the resulting PDF looks slightly different than the preview. More importantly, it does not format mathematical expressions, and the raw math code is printed instead. (E.g. “$E = mc^2$” is printed instead of .)
The other alternative is to use pandoc. I exported the file with the following command:
pandoc "my_file.md" --pdf-engine=xelatex -o "my_file.pdf"
This will format mathematical expressions correctly, but result in very different formatting. Is there a way I can change the output formatting of preview and the exported PDF file to so they match, and, importantly, have the math expressions correctly formatted in the resulting PDF?