天天看點

VScode帶公式的markdown轉PDF

環境

  • VScode
  • Markdown All in One
  • Markdown PDF

常見問題

要輸出成HTML或PDF時,公式無法正常渲染。

解決方法

在.md文檔末尾加入

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

其他

因為直接導出pdf有頁眉,是以可以先導出為html,再ctrl+p列印成pdf

參考

[1] https://www.cnblogs.com/Axi8/p/12592545.html

[2] https://github.com/yzane/vscode-markdown-pdf/issues/21

繼續閱讀