web123456

VSCode in MarkDown output PDF can not contain LaTeX formula solution

Installation of the export plug-in

The export PDF plug-in used is "MarkDown PDF".

Export method

  • Go to the MarkDown file screen
  • F1
  • Enter export search operations, select export (pdf) or other formats
  • Enter

After exporting, I found that the formulas could not be displayed

method settle an issue

  • Go to the folder of the extension plugin

Mac's location is

/Users/username/.vscode/extensions/yzane.markdown-pdf-1.4.1/template/template.html
  • 1

Windowssimilar position

C://Users/username/.vscode/extensions/yzane.markdown-pdf-1.4.1/template/template.html
  • 1
  • Add the following two lines of code to the end
<script type="text/javascript" src="/mathjax/latest/?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$', '$']]}, messageStyle: "none" });</script>
  • 1
  • 2

When added, the shape of the

<!DOCTYPE html>
<html>
<head>
<title>{{{title}}}</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
{{{style}}}
<script>
  {{{mermaid}}}
</script>
</head>
<body>
  <script>
    mermaid.initialize({
      startOnLoad: true,
      theme: document.body.classList.contains('vscode-dark') || document.body.classList.contains('vscode-high-contrast')
          ? 'dark'
          : 'default'
    });
  </script>
{{{content}}}
</body>
<script type="text/javascript" src="/mathjax/latest/?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$', '$']]}, messageStyle: "none" });</script>
</html>

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25

Export PDF again