Permission denied converting to PDF

dr
drmajorbob
Posts: 310
Joined: Sun Jul 01, 2012 1:38 am
Platform: Mac

Mon Feb 17, 2020 5:47 pm Post

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?

Screen Shot 2020-02-17 at 11.20.06.png
Screen Shot 2020-02-17 at 11.20.06.png (545.32 KiB) Viewed 711 times

User avatar
AmberV
Posts: 24116
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Ourense, Galiza
Contact:

Mon Feb 17, 2020 9:23 pm Post

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.
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

User avatar
nontroppo
Posts: 1190
Joined: Mon Mar 05, 2007 5:22 pm
Platform: Mac
Location: Airstrip One

Tue Feb 18, 2020 4:14 am Post

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:

Code: Select all

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:

Code: Select all

latexmk -pv -pdfxe -f  out.tex


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

Code: Select all

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.