shd101wyy / vscode-markdown-preview-enhanced

One of the "BEST" markdown preview extensions for Visual Studio Code
https://shd101wyy.github.io/markdown-preview-enhanced
Other
1.45k stars 173 forks source link

failed to run latex code #1630

Open Benature opened 6 years ago

Benature commented 6 years ago

sorry to border. i have already installed the texlive and add pdf2svg to PATH. but after i run the chunk,there will be a chunk like this

Unable to open file

what should i do ?

shd101wyy commented 6 years ago

Could you please paste your markdown code here? Thank you.

Benature commented 6 years ago

it is just your example:


```latex {cmd=true}
\documentclass{standalone}
\begin{document}
   Hello world!
\end{document}
kachkaev commented 6 years ago

@Benature what's your latexEngine?

Benature commented 6 years ago

the default one "pdflatex"

Benature commented 6 years ago

@kachkaev do u mean this? i did not change the setting. default

kachkaev commented 6 years ago

yep, this one. it might require installing pdflatex separately, i’m not sure. @shd101wyy might be able to clarify.

kachkaev commented 6 years ago

sorry - pressed the wrong button :–)

Benature commented 6 years ago

i changed the setting to xetex and run the latex code again, failed again but i found a texput.log in the dirt:

This is XeTeX, Version 3.14159265-2.6-0.99998 (TeX Live 2017/W32TeX) (preloaded format=xetex 2018.4.8)  12 APR 2018 23:32
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**d:/±¾-Benature/Solo_Learn/Markdown/Markdownwϰ/fhlqt2k7f_code_chunk.tex

! Emergency stop.
<*> ...rkdown/Markdownwϰ/fhlqt2k7f_code_chunk.tex

End of file on the terminal!

No pages of output.

don't know whether this will help or not P.S. there are some Chinese in the path

neighthan commented 5 years ago

(probably too late to this conversation, but since it's still open)

If you create a .tex file with the snippet above, are you able to convert that into a PDF using pdflatex or xetex from the command line (try using full paths and putting the sample .tex file in the same directory as your markdown file)? And to convert the generated PDF to an svg with pdf2svg? If both of these work, it might be something about the path that's giving you issues. I just submitted a PR to mume (which is where this conversion is done) about some other path issues, but I don't think you'd be experiencing them since you don't seem to have spaces in your path.

padronas commented 4 years ago

Try changing the permissions of the directory to allow writing. Running the latex code requires generating temporary .tex files. The ! Emergency stop. error is related to the latex engine not being able to find a file. I had encountered the same error

Unable to open file

and changing the permissions of the directory worked.

sirno commented 3 years ago

Try changing the permissions of the directory to allow writing. Running the latex code requires generating temporary .tex files. The ! Emergency stop. error is related to the latex engine not being able to find a file. I had encountered the same error

Which directory needs to be fixed? The one the markdown files are in? For which user group? I cannot find any logs, so I am kind of confused as to which directories the extension uses for caching...

sirno commented 3 years ago

Ok. Actually this was not a permission error. I had a missing semicolon, and the output was "Unable to open file" 🤷‍♀️

tecunningham commented 2 years ago

I've had the same problem a couple of times when there's a special character in the path (a space or a tilde). The code chunks will render fine when I move the file to a different directory.

Unfortunately I don't know of any way to get the extension to deal with these special characters, which are sometimes unavoidable (e.g. "iCloud~shared" or "Dropbox (Personal)", cannot be renamed easily).

My guess is that when pdftex is called the filenames aren't quoted & escaped. If true then fixing that would be a great feature.

ShugarSkull commented 1 year ago

I have the same problem here, when I try to run the code chunk:

PS : my .md is in my Desktop folder and the file is named test.md, so no bizarre special characters here (I think)