compile to docx using scrivomatic

Hi there

I might be missing something really obvious, so please excuse me.

But, I can’t get scivomatic to work as I need it:

a) automatically create a Word file. My script arguments are.

-i "<$inputfile>" -o "thesis.docx" -l -v 2>&1 >>scrivomatic.log -

I just get an html file not a .docx file.

b) nor can I use a template file, which is in the .local/share/Users/[username]/.local/share/pandoc/templates folder even when I run pandoc in a terminal window.

Ideally I want to be able to get scrivener to compile a word document, in the format specified by my template.

Any assistance greatly appreciated.

You need a “-t docx” somewhere in there, to specify which format to convert to. The default when no argument is supplied is to use HTML.

And for the template file, try putting it into ~/.pandoc as a file called “reference.docx”. That’s the setup I use, and when I compile from Scrivener the output conforms to that setup with no further configuration.

It sounds like pandocomatic cannot find the pandocomatic.yaml file it needs or cannot read your metadata sent from Scrivener (due to a typo or other problem), and defaults to the Pandoc default to output HTML. Using pandocomatic you don’t specify the output format on the commandline, as that is specified in the pandocomatic.yaml file for the template you are referencing in Scrivener’s metadata…

To really troubleshoot, look at the scrivomatic.log file that is generated upon compile; send it to me or paste it here…

I assume that is a typo, but the current default Pandoc data directory is /Users/[username]/.local/share/pandoc/

Thanks for your help,

yes, you were right, I made a typo, the pandoc folder is

OK, my Scrivomatic.log is as follows


=== ------------------------------------------------------ ===
=== Scrivomatic V1.0.25 Report @ 2019-07-06 10:13:36 +1200 ===
=== ------------------------------------------------------ ===
 Running under Ruby 2.3.7
 Working directory: /Users/immanuelkoks/Syncplicity Folders/PhD/Scrivener/drafts for reading/ chapter 2
===------ Input Options: ------===
#<struct Scrivomatic::OPT input="Chapter\\ 2\\ PDMWshort.md", output=nil, to=nil, yaml=nil, command="pandocomatic", envpath="/Users/immanuelkoks/bin:/Users/immanuelkoks/.rbenv/shims:/usr/local/bin", build=false, cleanup=false, verbose=true, dry_run=false, open_log=true, data_dir=nil>
===------ Final ENV PATH: ------===
/Users/immanuelkoks/bin:/Users/immanuelkoks/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/Scrivener.app/Contents/Resources/MultiMarkdown/bin
===------ TOOL PATHS: ------===
---pandoc: /usr/local/bin/pandoc | V: 2.7.3
---pandocomatic: /Users/immanuelkoks/.rbenv/shims/pandocomatic | V: 
---ruby: /Users/immanuelkoks/.rbenv/shims/ruby | V: ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
---rbenv: /usr/local/bin/rbenv
---python: /usr/bin/python

 … running pandocomatic, please wait …
===------ COMMAND OUTPUT: ------===
:: Running: /Users/immanuelkoks/.rbenv/shims/pandocomatic --debug Chapter\ 2\ PDMWshort.md 
::: pandoc	
::: Pandocomatic needed 0.3 seconds to convert '/Users/immanuelkoks/Syncplicity Folders/PhD/Scrivener/drafts for reading/ chapter 2/Chapter 2 PDMWshort.md' to 'Chapter 2 PDMWshort.html'.
:: exit status: pid 42690 exit 0

Thank you, once again, for looking at this.

Yes, so pandocomatic is running fine, but it cannot parse the metadata to extract the template name so is using the default. Can you show us the top part of your compiled MD file, I suspect there is an issue there. Problems with metadata can occur when, e.g. Scrivener auto capitalises “pandocomatic” to become “Pandocomatic”, or you use a colon in the title without quoting etc. I’m making a list of these potential issues with metadata here:

github.com/iandol/scrivomatic/b … leshooting

p.s. scrivomatic is up to V1.0.27, you are using V1.0.25 though that shouldn’t be the issue…

Thanks NonTroppo for your help

OK, so I realized that I had not set up the “Pandoc metadata” file ion scrivener as i needed to. :blush:

So I added that and the top of my Markdown file now Looks like.

[code]# Comment: make sure you use spaces not tabs, lower-case keys and straight quotes…
title: “PhD_Project”
author:

  • Immanuel Koks
    keywords:
  • test
  • pandoc
    pandocomatic:
    use-template:
    • paper-with-refs-docx
    • paper-with-refs-html
    • paper-with-refs-text

Common Human Experience #[/code]

I also copied the paper-with-refs-docx template, from the scrivomatic page on github into my yaml file.

This is now what i get in the log file

[code]=== ------------------------------------------------------ ===
=== Scrivomatic V1.0.25 Report @ 2019-07-06 22:06:59 +1200 ===
=== ------------------------------------------------------ ===
Running under Ruby 2.3.7
Working directory: /Users/immanuelkoks/Syncplicity Folders/PhD/Scrivener/drafts for reading/ chapter 2/Chapter 2 scrivomatic.md
===------ Input Options: ------===
#<struct Scrivomatic::OPT input=“Chapter\ 2\ scrivomatic.md”, output=nil, to=nil, yaml=nil, command=“pandocomatic”, envpath="/Users/immanuelkoks/bin:/Users/immanuelkoks/.rbenv/shims:/usr/local/bin", build=false, cleanup=false, verbose=true, dry_run=false, open_log=true, data_dir=nil>
===------ Final ENV PATH: ------===
/Users/immanuelkoks/bin:/Users/immanuelkoks/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/Scrivener.app/Contents/Resources/MultiMarkdown/bin
===------ TOOL PATHS: ------===
—pandoc: /usr/local/bin/pandoc | V: 2.7.3
—pandocomatic: /Users/immanuelkoks/.rbenv/shims/pandocomatic | V:
—ruby: /Users/immanuelkoks/.rbenv/shims/ruby | V: ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
—rbenv: /usr/local/bin/rbenv
—python: /usr/bin/python

… running pandocomatic, please wait …
===------ COMMAND OUTPUT: ------===
:: Running: /Users/immanuelkoks/.rbenv/shims/pandocomatic --debug Chapter\ 2\ scrivomatic.md
::: pandoc
::: [WARNING] Note with key ‘fn1’ defined at line 134 column 1 but not used.
::: [WARNING] Note with key ‘fn10’ defined at line 152 column 1 but not used.
::: [WARNING] Note with key ‘fn11’ defined at line 154 column 1 but not used.
::: [WARNING] Note with key ‘fn12’ defined at line 156 column 1 but not used.
::: [WARNING] Note with key ‘fn13’ defined at line 158 column 1 but not used.
::: [WARNING] Note with key ‘fn14’ defined at line 160 column 1 but not used.
::: [WARNING] Note with key ‘fn15’ defined at line 162 column 1 but not used.
::: [WARNING] Note with key ‘fn16’ defined at line 164 column 1 but not used.
::: [WARNING] Note with key ‘fn17’ defined at line 166 column 1 but not used.
::: [WARNING] Note with key ‘fn18’ defined at line 168 column 1 but not used.
::: [WARNING] Note with key ‘fn19’ defined at line 170 column 1 but not used.
::: [WARNING] Note with key ‘fn2’ defined at line 136 column 1 but not used.
::: [WARNING] Note with key ‘fn20’ defined at line 172 column 1 but not used.
::: [WARNING] Note with key ‘fn21’ defined at line 174 column 1 but not used.
::: [WARNING] Note with key ‘fn22’ defined at line 176 column 1 but not used.
::: [WARNING] Note with key ‘fn23’ defined at line 178 column 1 but not used.
::: [WARNING] Note with key ‘fn24’ defined at line 180 column 1 but not used.
::: [WARNING] Note with key ‘fn25’ defined at line 182 column 1 but not used.
::: [WARNING] Note with key ‘fn26’ defined at line 184 column 1 but not used.
::: [WARNING] Note with key ‘fn27’ defined at line 186 column 1 but not used.
::: [WARNING] Note with key ‘fn28’ defined at line 188 column 1 but not used.
::: [WARNING] Note with key ‘fn29’ defined at line 190 column 1 but not used.
::: [WARNING] Note with key ‘fn3’ defined at line 138 column 1 but not used.
::: [WARNING] Note with key ‘fn30’ defined at line 192 column 1 but not used.
::: [WARNING] Note with key ‘fn31’ defined at line 194 column 1 but not used.
::: [WARNING] Note with key ‘fn32’ defined at line 196 column 1 but not used.
::: [WARNING] Note with key ‘fn33’ defined at line 198 column 1 but not used.
::: [WARNING] Note with key ‘fn34’ defined at line 200 column 1 but not used.
::: [WARNING] Note with key ‘fn35’ defined at line 202 column 1 but not used.
::: [WARNING] Note with key ‘fn36’ defined at line 204 column 1 but not used.
::: [WARNING] Note with key ‘fn37’ defined at line 206 column 1 but not used.
::: [WARNING] Note with key ‘fn4’ defined at line 140 column 1 but not used.
::: [WARNING] Note with key ‘fn5’ defined at line 142 column 1 but not used.
::: [WARNING] Note with key ‘fn6’ defined at line 144 column 1 but not used.
::: [WARNING] Note with key ‘fn7’ defined at line 146 column 1 but not used.
::: [WARNING] Note with key ‘fn8’ defined at line 148 column 1 but not used.
::: [WARNING] Note with key ‘fn9’ defined at line 150 column 1 but not used.
::: Pandocomatic needed 0.1 seconds to convert ‘/Users/immanuelkoks/Syncplicity Folders/PhD/Scrivener/drafts for reading/ chapter 2/Chapter 2 scrivomatic.md/Chapter 2 scrivomatic.md’ to ‘Chapter 2 scrivomatic.html’.
:: exit status: pid 86879 exit 0[/code]

Unfortunately I am still only getting an html file, and not docx file. I really need the latter. However, I think I am getting closer with your help

thanks again for your help.

It is missing the opening , and metadata will not be recognised…

thank-you for your help.

It is now producing a word file. Now for the challange of getting the format right.

Good to hear, and good luck!