Scrivener Win ( beta) - Scrivomatic

Hi everyone,

I’ve been using the Scrivener-Pandoc-Pandocomatic-Scrivomatic-workflow to convert citation placeholders on my Mac. Since I have to swin, so I aim trying to transfer this over there. However, the script does not work, since no log is made and only an .md is generated.

In my (user) understanding, pandoc and the two scripts work in principle in a windows environment. I have now Scrivener Windows beta, Multimarkdown 6.5.1 for windows, Pandoc 2.9 .2.1 and through ruby 2.6.6. installed Pandocomatic- and downloaded Scrivomatic with the Github-Desktop-App. I added the path of the Scrivomatic skript (it has not the normal .rb-extension, but adding it makes no differences) to the Scrivomatic-format in the Scrivener compilation.

Pandocomatic says to place “the following file, pandocomatic.yaml, in pandoc’s data directory”. Using in terminal “pandoc --v”, I found that it is C:\Users<username>\AppData\Roaming\pandoc - a folder that did not exist. I cannot find a command to verify if it is really working directory. (at the same time, pandoc and pandoc-citeprof are located in C:\Users<username>\AppData\local\Pandoc.)

Scrivomatic tutorial says ( one should put the stylesheet, library and template in the same folder. I did so and have the paths changed in the YAML accordingly; absolute paths.

My guess is still that it is a path-problem, meaning that Scrivener or something subsequent in this chain cant find something. Now, I really need some help and hope for your suggestions.

@nontroppo, what say you?

Yes, I’m almost certain that this is a path problem, as scrivomatic searches for several other tools (like rbenv, homebrew etc) to ensure it adds all the correct location to the path to ensure pandocomatic and pandoc run. All paths assume a posix like OS, and Windows is certainly not. The other potential caveat is that I use Ruby’s popen3 method to run pandocomatic, it should work on Windows but there may also be some subtle platform differenc?. There shouldn’t be anything else that could cause an issue, scrivomatic is just a thin wrapper to build the path before pandocomatic is run.

I do have to use Windows occasionally, but never for writing which is why I never tried to update scrivomatic to be compatible with Windows. It is hard to convince my collaborators who do use Windows to move to Scrivener for writing, which would be the other incentive for me to make it work. I did have a licence for Windows V1.x but probably gave it away to someone, not sure I can even run V2.9.beta (does it require a 1.x licence?). So far there hasn’t been a post-processing panel in the beta, though I assume that has recently been implemented?

Windows now offers WSL (Windows subsystem for Linux[1]), and this would provide a posix like environment (you can even install homebrew for linux) and thus a much more consistent environment to macOS’s shell. You could use e.g. Ubuntu+apt and install Ruby/Pandoc etc. But I don’t know if WSL scripts can be called from Windows. Any windows geeks here who know if WSL can be called from Windows command-line?

More generally, how does the Win Scrivener beta implement post-processing and paths, is the path a default system one, a user path or something different? If it can find the installed ruby and pandoc (i.e. uses the user’s path), perhaps scrivomatic is unnecessary on Windows?

[1] hard to believe how MS has embraced OSS, but the proof is in the pudding. I’ve used WSL to run ZSh scripts, I can almost set it up like I would my macOs terminal. Very cool.

Dear @nontroppo,

thank you! However, you won’t follow your advice, because it only adds more layers of programs and integrations issues I am technically not able to handle. I have to export my dissertation in the end once, no further workflow needed. Would you recommend Pandoc Scholar or the new lua filter? I have read a bit but am not sure whether to go with it.

I crosspost this to the developer forum.

I made my own pandoc command line on Scrivener 3 in MacOS where it works, while the same line does not work in Windows. No Output, even with a simplified commands. Path to Pandoc “C:\Users<username>\AppData\Local\Pandoc” is correct.

Hi lindows,

Neither of the forums you’ve posted in are the ‘developer’ forum. If you’re on the Windows Beta, then you should post in the Windows Beta forum.

You may want to PM a mod to move this thread there.


There are two separate issues here, the first is whether Win Scrivener can run a post-processing script and what the environment will be that it runs in; this is a beta question so I think the crosspost should be where we follow that up.

The second question is about your workflow independent of Scrivener, can pandocomatic manage Pandoc to compile your work — the answer is I presume assuredly yes; but Windows paths are different enough that we will need to work out what is being called where, and what we need to edit to fix the problem. My knowledge of Windows is rudimentary.

In my tutorial, I include a Scrivener project that is “self-contained” so that all files are kept in the Scrivener compile folder. You can run this way and it works. My personal preference however is to use the Pandoc data directory to manage my files, and reference everything relative to that folder. You will first need to commit to whether you use the compile folder or Pandoc data directory; and I’m not entirely clear from your description which you chose?

What happens if you include absolute paths to these files, does pandoc the compile? What happens if you also pass the --verbose option, do you get some more logging?

Dear Ian,

Pandoc does work, only Scrivener does not except its commands. In detail:

Regarding that I tried to run a pure pandoc command, you suggested to do absolute paths for my library etc. Even the simple "-w docx -o default-layout.docx " command does not work, even I refer to the correct Pandoc-Folder, which is in Windows C:\Users<username>\AppData\Local\Pandoc. Pandoc does work though, I tried that as well as the above posted citation-commands using Powershells to steer Pandoc. it works.

Second, your workflow-example does not work either. in detail:

I have tried your self-contained workflow and I only get an .MD and no log or anything. A couple of things in your workflow that don’t work, too:
[] runme.bash does not work either in windows command line or in powershell (both says no app there or named to do it).
] Thus, I copied the templates into the same folder as well as into the Resources folder as you noted. no effect.
[] I noticed that the path is set to “User/Ian/Desktop/workflow_mmd/scrivomatic.rb”, so the script itself is suited to your work. changed it to my path (see (1) above), no effect either.
] in windows, the Projektname.Scriv is a folder, not a file like in MacOS, thus the file to open is one level lower. Anyhow, moving it had no effect either.

No log with --verbose either. (when running with pure pandoc). did not try absolute paths, see (1) above.

You say Scrivener, but do you mean scrivomatic?

So, I had a quick test with Windows 10 — I used scoop to install ruby and pandoc and then gem to install pandocomatic. I symlinked my pandoc data directory files to c:\Users\name\AppData\Roaming\pandoc and then tested whether pandoc and pandocomatic work – both work fine with a simple test document without any custom setting.

When testing my compile templates, I realised first that Windows doesn’t support the shebang (#!) and so my custom filters do not run properly on Windows. Also even when I rename them to be identified as ruby files, there were some errors on the commandline.

Scrivomatic itself fails because I run POSIX commands to find the various executables to create the path, and Windows doesn’t support this. It will need to be rewritten to check what OS is running then call the appropriate syntax…

As I also have WSL installed I tried that – and got a simple compile to work without faffing. But there is a different error in that windows line endings for wsl ruby in pandocomatic.yaml causes a failure to read the file. But this worked much better overall. I then ran out of time.

Summary: pandocomatic + pandoc do work, but require quite a few tweaks, many more so in Powershell than in WSL. At least I now know what work needs to be done…

No, I meant Scrivener by itself.

Well then. Good luck working! I will wait for any improvement and work my around when needed. Thanks!

A small update: I have now tested using Powershell and WSL, and in Powershell, pandocomatic can process Scrivener output using a full range of filters and templates just fine. Scrivomatic requires WSL, but also works fine. I ran into one impossible-to-solve Powershell+pandocomatic bug that affected one Windows machine but not another.

But as posted in the beta thread, as far as I can test, the Post-processing panel in the latest Scrivener beta does not yet work properly. I have tried redirecting all output (*>&1) to a log but the log is always empty. Therefore at the moment you simply need to manually run the scrivomatic/pandocomatic/pandoc conversion after you compile in Scrivener. There are several other bugs that will totally break compilation without manual intervention (for example, Scrivener beta keeps adding its own metadata even if you delete it in the compiler). But everything else seems to work (I didn’t test LaTeX output but no reason why it wouldn’t work).

Dear Ian,

thank you so much. Great that we figured this out so the guys need to know where to dig.