Open tecunningham opened 4 years ago
Hi @tecunningham could you please send me a piece of the markdown code that caused the issue so we can debug easier. Thank you!
Hi I noticed this issue. I have the same problem and have provided an example code which you can use to reproduce it. It’s under issue number 365.
Thanks Yiyi -- I did some investigation last night and found that it only occurs when I'm generating a file from certain subfolders, which have parentheses in them:
works: ~/test.md fails: ~/Dropbox (personal)/test.md
So I think the problem is that the paths aren't being escaped, when the images are being generated for PDFs.
I figured it out because I get the same problem when generating a gnuplot chunk (as given in the documentation), which throws an error "syntax error near unexpected token `('".
So I guess it's the same problem for LaTeX chunks as for Gnuplot chunks, but that it's just failing silently.
Just for completeness here's a minimal example. I can generate Pandoc fine only if I do not "Run" the code-chunk first.
---
output: pdf_document
---
# Test Latex Chunk
```latex {cmd=true, hide=true}
\documentclass{standalone}
\begin{document}
Hello world!
\end{document}
Hi @tecunningham , I am using Ubuntu and I just tried your example in your latest comment.
It seems to be working fine. I installed texlive
, texlive-latex-extra
and librsvg2-bin
.
I am using pandoc 2.9.2.1
Of course the path issue you mentioned previously is a problem. I will investigate soon. Thank you
Oh wait, I just tried to export a md file at Dropbox (personal)
directory after executing code chunks and it seems to be working fine as well.
Could you please upgrade your pandoc and try again? Thank you
Thanks so much for looking into this! I updated Pandoc and still get the same problem with 2.9.2.1.
Very strange -- I will do some more investigation later today.
OK I may have figured it out. I tried running Pandoc with and without quotes for the output file:
With quotes it works:
> pandoc -f markdown+tex_math_single_backslash -o "/Users/tomcunningham/Dropbox (Personal)/prussia/2020-05-30-markdown-tikz-test.pdf" --pdf-engine=pdflatex < "/Users/tomcunningham/Dropbox (Personal)/prussia/2020-05-30-markdown-tikz-test.md"
Without quotes it fails (and this is the command that MPE executes):
> pandoc -f markdown+tex_math_single_backslash -o /Users/tomcunningham/Dropbox (Personal)/prussia/2020-05-30-markdown-tikz-test.pdf --pdf-engine=pdflatex < "/Users/tomcunningham/Dropbox (Personal)/prussia/2020-05-30-markdown-tikz-test.md"
Error message:
"zsh: no matches found: (Personal)/prussia/2020-05-30-markdown-tikz-test.pdf"
So I wonder whether you could add quotes to the Pandoc call in MPE?
UPDATE: Actually there's still a puzzle: if this was the problem, then you'd expect Pandoc to fail even if there were no code chunks. OK I need to think more.
In fact, when it fails on my machine:
So I think it's failing when MPE does the stitching-together of the code-chunk-PDFs into the markdown source. Does it call an external program to do that?
When I export to PDF with Pandoc and I have a LaTeX code chunk it will never finish.
More details:
I guess that Pandoc is silently hanging, but I don't know how to see the command-line being used to call Pandoc. Is there a log/debug option that I can use to figure that out?