I have struggled to make a simple way to compile my Scrivener project and references contained in a .bib file to a docx file. I have read about the pandocomatic workflow, but for me I would like a really easy and simple way with not too much configuration (may be that can’t be done?). I am constantly changing between a macBook and an iMac and would like to keep my bibliography and csl in a Dropbox folder.
I am experimenting with a file with only this reference in the text
Ball [@ball_toward_2003;@ball_content_2008;@hill_unpacking_2008] bla bla bla
I try to compile it with these arguments
That just creates this error message
I am terribly sorry as I know this must be a part of my lacking knowledge, but I cannot manage to get this right. The bib file is ok as I have used it regularly with Marked 2. Then I used almost the same configuration, but with Scrivener 3, and problems with the current issue of Marked 2 and Scrivener 3, I would like to find my own way.
Another problem: When I started experimenting I could choose to open the file in either Word, Preview or TextEdit. Now I only have the possibility to open in programs which can open bib files? That is also the case if I remove the last part of the arguments with the bibliography.
Any help would be greatly appreciated.
Hi pergo, don’t worry, I think you are very close to get this working. I suspect the problem is you are using ~/ in your path, and you should be using an absolute path like /Users/pergo/Dropbox/pandoc/mybib.bib — the reason is Scrivener runs the commands directly so shell expansion like ~ does not work. $HOME may work, I haven’t tried it though…
I have run pandoc directly like this from Scrivener 3 and it works fine. Remember you can also put these setting into the Frontmatter metadata and Pandoc will be able to use that. Then you can use different frontmatter files to trigger different pandoc options. This is what pandocomatic does, it makes it easier to manage multiple sets of pandoc options…
Regarding the second problem, the docx file opens fine for me as long as the -o <$outputname>.docx is clearly specified. What programs are set to open docx files on your system?
Thanks a lot for your reply. Unfortunately I get the same error message when I replace the ~ with the proper path.
The possibility to place the arguments as front end metadata seems good. I have to look into how that can be done. I guess there are some examples to find?
As to the other problem: I have both Word and TextEdit associated with docx. Scrivener used to suggest one of them, but that changed at one point when i played with the pandoc arguments.
Hm, I’ve now tested explicitly with Pandoc + pandoc-citeproc directly and it works for me ($HOME seems to work btw):
-t docx --bibliography=$HOME/.pandoc/Core.bib --csl=$HOME/.pandoc/csl/apa.csl --reference-doc=$HOME/.pandoc/templates/custom.docx -o <$outputname>.docx
Please try with another BIB and CSL file.
I was wrong when I suggested options could go in the metadata, they cannot which is why pandocomatic is so useful…
As for which file gets opened, perhaps there is a logic, but I don’t clearly see it, it sometimes opens the DOCX and other times the .md file…
The problem was that my version of pandoc and the version of pandoc-citeproc was not compatible. When I updated citeproc all works fine (even with tilde ~ in the path)
Thanks again for the kind help
Sorry to get back to this, but I can’t seem to get it to work as pergo did.
In Marked 2 I am using the following settings
--filter pandoc-citeproc --biblio /Users/norbert/Documents/eBooks/pandoc/zotero.bib --csl /Users/norbert/Documents/eBooks/pandoc/apa.csl --metadata link-citations=true
And previewing my Scrivener document there works like a charm, including the linked citations.
Now I wanted to follow your path in Scrivener (since Marked doesn’t do the numbered headlines) and if I input the same arguments there it doesn’t work.
I tried changing it according to your suggestions above to this:
-t docx -o <$outputname>.docx --bibliography=/Users/norbert/Documents/eBooks/pandoc/zotero.bib --csl=/Users/norbert/Documents/eBooks/pandoc/apa.csl
When I don’t enter a file type in the export, it doesn’t add the .docx with the settings above. If I take those settings and add the ending .docx manually during export Word throws an error that the file is damaged/corrupted and can’t be opened.
If I leave out the
-t docx -o <$outputname>.docx
bit and add the .docx in the export it does the same. If I let it export to .txt and open it, it doesn’t throw that error, but the citations aren’t rendered either.
My settings don’t show the “Path” field, but I assume that’s not the issue here? Or if so, what am I doing wrong to not have that option?
Any hints are highly appreciated.
I’m using Scrivener 3.0.3 on macOS 10.13.6. with pandoc 188.8.131.52 and pandoc-citeproc 0.14.3.1. (Word version 16.16)
As you allude to, in your screenshot you are using the new Script: option — that is only used if you are running your own customised script. If you just want to run pandocdirectly you should ensure you have the Path: option set — click on the arrow next to Script: and select path and enter your pandoc path…
Thank you so much! Now it works (not with my Marked 2 settings, but the ones adapted from your above discussion).
I feel incredibly stupid for not trying that Script drop down, when I literally tried every other button…
At the same time I am just incredible happy that it works now
Many thanks for your quick reply nontroppo!