I have the following code saved as ex.md

title: "Page Title"
subtitle: "Page sub-title"
author: "Author name"

# head 1
hmm $x \times \pi$

and I preview with C-c C-c p, which opens the link in a browser. So, markdown does not recognize math mode. What do I need to enable it?


  • I discovered that for html I need to enable mathjax somehow. But how do I get a pdf? The preview and export commands immediately output html and do not ask a question what I want.
    – Stephen
    Jan 30 at 15:09

1 Answer 1


In the browser, you need a markdown-viewer (search for a plugin for your browser). Alternatively, you could use impatient-mode (javascript, live-preview), markdown-soma (rust, live-preview), grip-mode (python) or any other markdown preview mode available on Melpa (there are many).

Here you can find various answers for how to convert markdown to pdf. You can use M-! to run these commands directly from Emacs, or configure the markdown-command as explained under 'Customization' here. For pandoc there is also pandoc-mode.

  • I do not have a problem when converting to pdf with pandoc. everything works. but I need to refer to mathjax somehow in my md file to make the html work. can you show me how?
    – Stephen
    Feb 1 at 15:10
  • From here, it looks like you simply have to include the --mathjax argument in the command, as the default value for that argument (when using it without URL) is a link to the Cloudflare CDN. However, when I try it, it does not seem to insert the CDN in the html. In that case you can manually copy it from here and insert it at the start of your html. Feb 1 at 21:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.