vscode-markdown-pdf icon indicating copy to clipboard operation
vscode-markdown-pdf copied to clipboard

Problem with Latex

Open yukiumi13 opened this issue 5 years ago • 5 comments

This extension cannot convert latex

yukiumi13 avatar Oct 04 '20 14:10 yukiumi13

you need to add mathjax code in the header of markdown files , then you can convert markdown file to pdf with latex correctly.

JackeyLea avatar Oct 13 '20 13:10 JackeyLea

How do I add the MathJax code in the header of my markdown file? I tried adding the mathjax.js framework like this inside the file:

<script>
// content from https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js
...
...
</script>
# Test
## This is a test
Testing for latex support: $\sqrt{5^{n+1}}$

Unfortunately this doesn't work...

felbinger avatar Oct 21 '20 12:10 felbinger

I add those content to my file on line 1.

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

then i can export pdf file with latex format.

The attachment file is an example for vscode1.50.1 and Markdown PDF1.4.4 test.zip

JackeyLea avatar Oct 21 '20 14:10 JackeyLea

There is this pull request #198 that would solve this.

There are 3 open (and a closed) practically identical issues already, @MechanicModel (and @bhomaidan1990, and @icheft) you are not helping by opening another.

@JackeyLea thanks, but that script is a half solution only, not inlined formulas are not supported by this. I much prefer this globally set solution - which I found in the exisiting #21 issue's timeline, by the way: another point for search before filing an issue...

Samonitari avatar Dec 31 '20 14:12 Samonitari

Thanks, it works!

Kuo-TingKai avatar Jul 18 '22 11:07 Kuo-TingKai