Permission denied converting to PDF

I’m at step one or two trying to use Pandoc with my project, and it’s a nightmare so far.

Pandoc reported an “inputenc” error reporting the character U+0004. I removed and rewrote the line, and got the error again. The same line appeared later, so I removed that too.

Along the way, Pandoc suggested using --pdf-engine=xelatex, which I did (between the two errors mentioned above), and now the problem seems to be permissions. Below is a shot of the zsh terminal.

Any advice, please?

I wonder if maybe this error message is misleading. It looks like in line one you took your .md file and converted it to PDF, writing it out over the input file itself. So then on the second line you’d be trying to have Pandoc take a PDF file (called ‘kell.md’) and converted it into a PDF file via LaTeX. That’s bound to fail one way or another.

I get a different error if I try that, but that may be a difference in versions.

And of course chmod ug+rw if you need to.

(Oh with bad characters, use Scrivener’s Edit ▸ Text Tidying ▸ Zap Gremlins command. I run into these now and then; the text engine seems to be buggy in that it inserts garbage characters now and then that throw a wrench in processing.) Run it on bulk selections if you want, it is safe to use as it only discards things you definitely don’t want.

As Ioa mentioned, you seem to have rewritten your markdown file, which certainly would cause all sorts of problems. The errors are not actually Pandoc errors, but TeX errors.

In general for debugging it is better to do this in steps at first, generating a tex file first:

pandoc --to=latex --standalone --output=out.tex compile.md

Solve any problems you have here, and you can then convert it to a PDF with xelatex using latexmk:

latexmk -pv -pdfxe -f  out.tex

Then when you think it is all OK, you can try to do it all-in-one:

pandoc --verbose --pdfengine=xelatex --to=pdf --standalone --output=out.pdf compile.md

Use --verbose mode so you can see some intermediate information. In scrivomatic, I always choose to use latexmk when making a PDF (i.e. pandoc only ever generates TeX) as it allows me to get all the log information directly and keep a TeX file which can be helpful when solving LaTeX problems.