Help with compiling Pandoc with citeproc from Processing pane

Hello. I have successfully set up the post-Processing pane to execute Pandoc. I am trying to use Pandoc with the defaults:

Path: /usr/local/bin/pandoc Arguments: -drefs -dlatex -dpdf-xelatex <$inputfile> -o <$outputname>.pdf Environment: /library/tex/texbin:/Users/NAME/.local/share/pandoc/

However, Scrivener fails to compile and hangs (spinning beachball) when the refs default file (called up by -drefs) includes:

verbosity: INFO

If I set verbosity: to ERROR or WARNING, Scrivener doesn’t hang and compiles fine.

However, if I run Pandoc form the Terminal command line with verbosity set to INFO, it produces the output correctly.

Any idea why this is happening?

1 Like

With INFO, pandoc returns content to stdout, and perhaps this causes problems for Scrivener… I also use INFO verbosity with pandoc but always redirect output to a log file from the Scrivener settings so I can catch all the useful outputs like missing references etc:

Arguments: "<$inputfile>" 2>&1 >>output.log

This appends all output to a log file…

Many thanks, Ian, for the help. You pointed me in the right direction, but to get it to work, I had to make a couple of modifications:

  1. putting <$inputfile> in quotes threw up an error.
  2. 2>&1 >> output.log produced an empty log.

What worked for me was:

Arguments: -drefs -dlatex -dpdf-xelatex <$inputfile> -o <$outputname>.pdf 2> output.log

From what I understand, this should only be outputting stderr and not stdout. But it looks like both to me, when I one the output.log. Not sure why this is, but at least I can check font problems and other errors.

Hm, quoting works for me and it seems strange this would be different for you, but whatever works!

Regarding redirection, actually the order matters[1] at least for bash so try this:

"<$inputfile>" >>output.log 2>&1 

redirects stdout to the file and 2>&1 redirects stderr to stdout, and why order matters I have no idea but shell scripting is a perpetual battle against flexible syntax and logic :laughing:

[1] the previous order works for me and perhaps this is a zsh vs. bash difference? I use zsh everywhere…

Excellent, this now works perfectly. I’m not sure if it is a bash vs zsh difference, as I am using the latter in my terminal. But what matters it is now working. Thank you.

Great, &> should also work and is a little bit less verbose:


-v -l "<$inputfile>" &> scrivomatic.log


-v -l "<$inputfile>" &>> scrivomatic.log

EDIT: actually Scrivener’s post-processor appears to use bash and while &> is supported and works, &>> does not:

/bin/bash: -c: line 0: syntax error near unexpected token `>' /bin/bash: -c: line 0: `/var/folders/pb/3zl9r9sn6bqb29yvxcc77v640000gn/T/my-script -v -l '' &>>scrivomatic.log'