Code Monkey home page Code Monkey logo

iandol / scrivomatic Goto Github PK

View Code? Open in Web Editor NEW
286.0 26.0 29.0 27.08 MB

A writing workflow using Scrivener's style system + Pandoc for output…

Home Page: https://iandol.github.io/scrivomatic/

License: GNU General Public License v3.0

Ruby 9.77% HTML 65.46% TeX 10.47% Batchfile 0.01% JavaScript 12.16% CSS 2.12%
scrivener pandoc pandocomatic paru writing-software writing-scientific-papers academic-writing scrivener-styles pandocomatic-templates pandoc-metadata

scrivomatic's Introduction

Scrivomatic: Scrivener & Pandoc*{omatic}*

For Scrivener & Quarto see the forum post here, and download the Scrivener template. Another Quarto template can be found here: ScrivQ.

TL;DR (simple summary)

This guide is a series of steps to integrate two useful tools: Scrivener and Pandoc. Scrivener is great for organized writing, while Pandoc can transform text into various formats. Although Scrivener already has MultiMarkDown support, I think using Pandoc offers more benefits and it's easy to install. Additionally, you can use Pandocomatic for flexible management of Pandoc settings directly from Scrivener.

  1. Install the latest pandoc and pandocomatic tools.
  2. Create one or more pandocomatic "recipes"; you can base them on the one shared below.
  3. In Scrivener, use a front-matter document with required settings and compile via MultiMarkdown format to generate Pandoc output.
  4. Scrivener will automatically trigger pandocomatic during post-processing, creating your final outputs for you..

As a sample of the fuller workflow, I've made a self-contained Scrivener project (you still need to install pandoc and pandocomatic first). This should give you a better idea of the various parts of the workflow, and you can look at the simultaneously produced PDF/HTML/DOCX/TXT outputs from the sample project to get an idea of the sort of end documents that are possible. I also provide a Scrivomatic.scrivtemplate if you prefer the more complete workflow.

Scrivener has many options, and to better understand the workflow outlined on this page, you should read at least sections §21 and §24 of the Scrivener user manual.

Table of Contents

Introduction

Scrivener (macOS / Windows) is a program for all types of writers, handling the structural organisation and constructive process of writing like nothing else. You write and manage text, ideas, figures and reference materials all in one place without having to worry about the final "look". The final "look" is handled by a process called compiling, where you choose the output format and select the contents with great flexibility. Though Scrivener uses rich text internally, it has excellent integration with plain text markdown. Compiling your Scrivener projects via markdown offers numerous advantages over rich text: it creates more structured, beautiful and flexible documents without lots of fussing in a Word processor or layout software. For example:

  • Binder headings are automatically converted into semantic heading levels (properly nested Headings 1-6).
  • Figures and figure captions get proper styling.
  • Semantically styled block quotes, code blocks (with full syntax highlighting), and many inline styles.
  • Mathematical equations are properly parsed to many output formats.
  • You can generate multiple outputs (PDF, LaTeX, DOCX, PPTX, ODT, EPub3, HTML etc.) simultaneously from a single compile; and trigger further tools to automate many workflows.
  • You can use a Microsoft Word/LibreOffice source file to provide all page setup (paper size / modified headers & footers etc.) and fully customised styles without any fussing in a word processor afterwards.
  • For academics, Pandoc enables generation of a full Bibliography using thousands of available publication styles.
  • For technical writers, you can add semantic custom block and span structures (warning or info boxes for example).
  • For LaTeX users, there is a lot of flexibility using rich templates and meta-data.

This all save you lots of time, especially if you compile regularly during collaborative editing.

Because of Pandoc's great flexibility, there are many possible settings to configure. To simplify this, you can run Pandoc using "template" tools like Pandocomatic. For each document output, the template specifies all the options in Scrivener front-matter and/or a seperate configuration file. Pandocomatic templates allow you to run pre– and post–processors for more complex workflows (i.e. you could automate moving a HTML file to a web server after Scrivener compile). To use the Pandocomatic templates with Scrivener, you specify their name in the front–matter or metadata, and all the settings are automated when Pandoc is run.

UPDATE:: In Pandoc V2.8+, you can create "sets" of Pandoc options: see some examples here. I still prefer pandocomatic (described below) as I can use metadata, processor scripts and gain more control, but I think this defaults system will be great for others who want a simpler setup. The workflow I use is just one of many ways of using Pandoc and Scrivener together…

Requirements

Apart from Scrivener (V3.x minimum required for this workflow), you should install Pandoc and Pandocomatic. This requires a small amount of typing into the macOS terminal. You can install pandoc directly, but IMO it is better to use Homebrew to install pandoc, as it can help keep everything up to date (pandoc receives regular automatic updates via homebrew). So first, follow the instructions to install Homebrew (info for the security conscious):

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

And then install pandoc using the brew command in the terminal (you can also add pandoc-crossref to the brew command if you want to use it):

brew install pandoc

If you already installed pandoc manually, but want to use brew from now on, then you can use brew link --overwrite ... instead of brew install ....

Getting Pandocomatic installed.

You use Ruby's gem command to install pandocomatic. If you are using macOS 10.15 or later and the built-in Ruby, you must put sudo at the start of the commands (i.e. use sudo gem install pandocomatic, if you've used brew or rbenv to install Ruby, then no sudo is required):

gem install paru pandocomatic 

macOS Mojave and earlier users: the latest versions of Pandocomatic are not compatible with the ancient version of Ruby in macOS Mojave and earlier (macOS Catalina is OK), and so you need to install a newer version of Ruby first. Read Installing Ruby for more details!

To keep both Pandoc and Pandocomatic up-to-date, you can run the update commands like so every week or so (paru is used by pandocomatic and is by the same author, it gets auto-installed when pandocomatic is installed):

gem update paru pandocomatic; brew update; brew upgrade

Remember if you use the built-in Ruby, you must add sudo to all gem commands...

Configuration

The most important folder for this workflow is the Pandoc data directory: since Pandoc V2.7 it is $HOME/.local/share/pandoc ($HOME is your user directory, for example /Users/johndoe/; previous to V2.7 the folder was found at $HOME/.pandoc). Though not required, it is recommended to organise all your templates, filters and other files within this folder (pandocomatic uses the Pandoc data directory by default). To create your $HOME/.local/share/pandoc folder:

> mkdir -p ~/.local/share/pandoc

All folders starting with a . are a hidden by default, but you can open them in Finder in two ways: 1) using the shortcut + SHIFT + G and typing the path, in this case ~/.local/share/pandoc; or 2) using the Terminal and typing:

> open ~/.local/share/pandoc

You can explore my working Pandoc folder here. It is comprised of a series of subfolders of files pandoc and pandocomatic use during converison. You can install my Pandoc folder by downloading it and unzipping its contents into your $HOME/.local/share/pandoc, or if you know how to use git you can just clone (or fork) it from Github (cloning offers the advantage that updating is a simple git pull).

pandocomatic uses a configuration file usually stored at the root of the Pandoc data directory: $HOME/.local/share/pandoc/pandocomatic.yaml. A simplified sample pandocomatic.yaml is viewable here; this won't work without customisation, but it gives you an idea of how pandocomatic-templates work (full documentation here). The basic idea is you create several pandocomatic-templates, and each pandocomatic-templates collects together a bunch of settings and configurations to produce a particular output. So I have docx pandocomatic-templates which is a basic Word conversion, but also a docx-refs which runs the bibliographic tools to generates a bibliography automatically for a docx file output.

For the rest of the files in the Pandoc data directory: all custom Pandoc templates reside in $HOME/.local/share/pandoc/templates, and Pandoc filters in $HOME/.local/share/pandoc/filters. For bibliographies, I symbolically link my Bibliography.bib into in $HOME/.local/share/pandoc and store my Journal style files in $HOME/.local/share/pandoc/csl. pandocomatic enables the use of pre– and post–processor scripts and these are stored in their own subfolders.

Writing in Scrivener

With Scrivener 3's new styles system (§15.5 user manual), there is a huge change to how you can write with markdown. You can use named paragraph styles (like "blockquote"), and named inline styles (like "emphasis" or "superscript") as you would writing in rich text (i.e. there is no need to add markdown syntax in the editor!) With the compile system (§23—user manual), Scrivener will add a prefix/suffix to create the required plain-text markdown. So for example, create an inline style called Strong, and in compile set the prefix to ** and suffix to ** and Scrivener automates conversion from the RTF style to markdown! You can even rebind ⌘I and ⌘B to trigger the Emphasis and Strong styles directly. I use Scrivener styles to visualise structure and generate the Pandoc markup itself:

Figure 1 — The cursor shows that both inline Strong and paragraph Caption styles are both active. Note whitespace is visualised and styles are used to give visual structure to the Scrivener writing environment. These will all be transformed into the correct markdown on compile…

There are two parts of this Styles setup: first you must create the editor's named paragraph & inline Styles, which you do using the Styles Panel (CTRL+s) or Format ⇨ Style menu . If you want to import some Styles from my sample project to get you started, open the Styles Panel ⇨ ⚙ Gear Icon menu ⇨ Import Styles… and select my Workflow.scriv project file. For the Compile Style rules, you can make these yourself in the Compile format editor, or more easily you can download my customised compile preset here. Install it (Compiler ⇨ Gear Icon ⚙ ⇨ Import Formats…) to get a flavour of how one can convert styles to markdown, and it now has the scrivomatic script built-in (needs Scrivener V3.03+).

Figure 2 — The Scrivener 3 Compile Format Scrivomatic.scrformat in the editor, showing how the inline style "Strong Emphasis" is converted into the correct markdown using prefix & suffix text. IMPORTANT TIP: for block/paragraph styles you will need to enter newlines directly into the prefix/suffix edit fields; you do this using option return.

Enable Show invisible characters

Because markdown is sensitive to whitespace (double return to delineate paragraphs, 4 spaces/1 tab to delineate code blocks etc.), you should aim to use whitespace consistently: for new paragraphs and between any blocks of content space space return return is optimal. Showing invisible characters in the Scrivener editor makes potential formatting issues when compiling simple to fix. Enable it using View ▶︎ Text Editing ▶︎ Show Invisibles, and change their colour in Preferences ▶︎ Appearance ▶︎ Textual Marks ▶︎ Invisible Characters. If you do not wish to use return return to delineate paragraphs in the Scrivener editor, you can use Scrivener's compile replacements, or Compile format Editor ▶︎ Transformations ▶︎ Convert to plain text ▶︎ Paragraph spacing (§24.13 user manual).

Use the Binder for all document structure

Try not to not use markdown # headings within text documents themselves but create documents at the correct level hierarchy in the Binder. Scrivener is great at compiling the levels of the Binder structure into the correct heading levels for you, and you benefit from being able to use the outlining and organisation tools within Scrivener.

Images

Scrivener can transform images that are embedded with a line of text (§21.4.1 user manual) into markup that generates proper semantic <figure> and <figcaption> elements. I now prefer to link images (Fig. 21.2—user manual) from the binder rather than by using the standard Pandoc markup: ![Figure caption](linked_image){.my_style}; in both cases (embedded or linked-from-binder) Scrivener will correctly export the image file into the compile folder. Scrivener 3 has a nice new feature where you can binder-link figures (Insert ▸ Image Linked to Document), they are not embedded but still visible in the document, to add a caption to these you can use a caption style or [] brackets around the caption (described at the end of §21.4.1—user manual).

Footnotes

Scrivener will automatically convert footnotes into Markdown format for you. But there is one caveat in that you are not allowed to use Scrivener's styles inside footnotes, and so if you want to use emphasis, strong or other character styles, you will have to use the Pandoc markup directly.

Scrivener Comments

Use comments and annotations freely. Scrivener 3 now allows you to transform comments to complex markup (§24.19.7—user manual) where the comment text <$cmt> AND the comment selection <$lnk> are both correctly exported). This can be set in compile ▶︎ annotations… — I use: <span class="comment" title="<$cmt>"><$lnk></span>. For export to DOCX, you can use <span class="comment-start" id="<$n>" author="<$author>" date="<$date>"><$cmt></span><$lnk><span class="comment-end" id="<$n>"></span>, which will transform into proper Word margin comments.

Cross-referencing

Out of habit, I prefer to use Scrivener links when cross-referencing documents / exporting figures, and Scrivener's placeholder tags to cross-reference figures and equations within the text. But for new users, Pandoc does have several cross-referencing filters (pandoc-crossref and pandoc-fignos for example) and you can also use these. The advantage of these systems is that they are more portable if you move your project out of Scrivener, the disadvantage being you will need to use markup directly. I have a quick crossref.scriv project available to show an example of using the pandoc-crossref filter.

Compiling your Project:

In Scrivener, I ensure to remove all compile–metadata specified in the compile user interface (see screenshot here) so it doesn't interfere with the custom metadata file. I create a document called something like Metadata containing the YAML configuration block right at the top (read more detailed documentation here). You can use Scrivener placeholder tags in this document, to insert the title or other data from Scrivener's extensive list (Help ▸ List of All Placeholders…).


IMPORTANT: Scrivener's autocorrect will "smarten" quotation marks and dashes and can capitalise keys like title or pandocomatic, which will make Pandocomatic and Pandoc error, so please check keys like title, author & pandocomatic are lowercase, straighten quotes and ensure the 3 hyphens are not converted into an em dash — also indentation in the metadata block must be spaces and not tabs.


In the example YAML below, three templates are specified, so pandocomatic will run Pandoc three times to generate a DOCX, HTML and plain TXT file from the same single Scrivener compile:

---
# Comment: make sure you use spaces not tabs, lower-case all keys and straighten quotes…
title: "<$projecttitle>"
author:
  - Joanna Doe
  - John Doe
keywords: 
  - test
  - pandoc
pandocomatic:
  use-template:
    - paper-with-refs-docx
    - paper-with-refs-html
    - paper-with-refs-text
---

The front matter should be the first document in the compile list and compiled as–is.

Figure 3 — I created a Project ▸ Project Settings… ▸ Section Type called "Frontmatter", assigned this Section Type to 'Pandoc metadata', set 'Pandoc metadata' as Front Matter in the Compiler options, and then assigned it the AS-IS Section Layout.

The Pandocomatic configuration template (pandocomatic.yaml) could contain something like the example below for the DOCX template specified above (generating a bibliography using the APA style (with linked citations) and a table of contents):

  paper-with-refs-docx:
    pandoc:
      from: markdown
      to: docx
      standalone: true
      filter: pandoc-citeproc
      bibliography: ./core.bib # ./ means same directory as markdown file
      citation-style: csl/apa.csl
      reference-docx: templates/custom.docx
      toc: true
    metadata: 
      notes-after-punctuation: false 
      link-citations: true

In Scrivener, you select Multimarkdown as the compile document output and select a compile format that configures a post-processing tool to run pandocomatic automatically.

Scrivomatic post-processing script

You can run pandocomatic directly from Scrivener's post-processing panel, but you may need to ensure the Environment path is set up so Scrivener can find all the files and the other tools properly. Scrivomatic is a small wrapper script (yes, welcome to the rabbit hole 🙃!) that handles this for you…

It adds the paths for tools installed via homebrew, MacTeX and Cabal; and if you've used rbenv, rvm or conda to install pandocomatic/panzer, it adds these paths too. It can also generate a detailed log file of the conversion (so you can check for missing references or other problems etc.). The easiest way to install it is to copy the raw code from here: scrivomatic, then you want to install it by pasting it into the Post-processing Edit Script edit field (leave Shell blank). You then configure the Arguments field (adding different flags to control scrivomatic, e.g. -l opens scrivomatic.log in Console automatically):

Figure 4 — Scrivener's processing panel in the compile preset.

You can also download the script to your Downloads folder, move it to a directory on your path, and make sure it can be executed like so:

mkdir -p $HOME/bin
mv $HOME/Downloads/scrivomatic $HOME/bin
chmod 755 $HOME/bin/scrivomatic

You can then run scrivomatic from terminal with the following command line options:

Usage: scrivomatic [additional options] FILE
    -i, --input FILE                 Input file
    -o, --output [file]              Output file. Optional for pandocomatic.
    -t, --to [format]                Pandoc Format. Optional for pandocomatic.
    -y, --yaml [file]                Specify which YAML file for pandocomatic.
    -c, --command [command]          Tool to use: [pandocomatic] | panzer
    -p, --path [dirpath]             Additional Path to Search for Commands.
    -b, --build                      For LaTeX output, run latexmk
    -B, --buildclean                 For LaTeX output, run latexmk and cleanup
    -d, --dry-run                    Dry run.
    -z, --data-dir [file]            Pandoc data dir.
    -v, --[no-]verbose               Verbose output.
    -l, --[no-]log                   View log in Console.app.
    -h, --help                       Prints this help!

Alfred Workflow

I also include an Alfred workflow so you can run scrivomatic directly from markdown files selected by Alfred:

Figure 5 — Alfred Workflow.

Writing tips for this Workflow

How-to use Custom Styles in Word and HTML

There are two recent features added to Pandoc, Fenced Divs and Custom Styles (see also bracketed spans), that when combined, enable any arbitrary custom Scrivener paragraph or character styles to be converted into Word styles or CSS classes. So for example, we can create an "Allegory" paragraph style in Scrivener, and in the Compiler style we use the fenced div syntax prefix=\n::: {custom-style="Allegory"} :::\n & suffix=\n:::\n (\n means enter a return, done using option+return in the edit box) which would generate a fenced div like so in the compiled Pandoc file:

::: {custom-style="Allegory"} :::
All animals are equal but a few are more equal than others
:::

Pandoc will then attach a word style named "Allegory" to that paragraph in the output DOCX. You can either edit the style in Word, or edit your reference.docx to include this custom style, so it already styled when you open the DOCX.

Binding ⌘B etc. to Scrivener Styles

Most people have ⌘B & ⌘I key bindings well memorised for bold and italic. A cool thing about Scrivener Styles and macOS is you can rebind these keys so they toggle the Strong and Emphasis styles rather than bold and italic itself. To do this you go to System Preferences ▸ Keyboard ▸ Shortcuts, click the [+] button, select Scrivener.app and enter the name and key to make the following:

Figure 6 — Rebinding macOS keys to use Scrivener Styles.

In the case of Strong and Emphasis, there is no need to enter the full menu path to the Style as the names are unique, but you can also use the complete Format->Style->Emphasis to make this entry explicit. More general instructions from Literature & Latte are available here. A 3rd-party tool that provides key rebinding and an incredible amount of additional control is BetterTouchTool. You would remap the keys in the following way in BTT:

Figure 7 — Rebinding macOS keys to Scrivener Styles in BTT.

Working with Bookends Reference Manager

Bookends is an excellent reference manager for macOS which can be configured to output temporary-citations for Scrivener in a format fully compatible with Pandoc. To export your references, the best way is to use the new feature in Bookends V14.0.1+ where Bookends creates and keeps a BibTeX file synced to your main database. To set this up I'd first follow the excellent tutorial here (from step 1):

BSAG » Bookends and Pandoc

Previous versions of Bookends can export BibTeX manually, or you could use this applescript to trigger an export from other tools (for example it is contained in Bookends Tools for Alfred).

A JSON bibliography file can be parsed about 3X faster than a BibTeX file by Pandoc, so if you want to speed up compilation, then you can create a launchd script to run BibTeX->JSON conversion on each update, see this forum post for more information.

Minimal LaTeX Install

I prefer to use the minimal LaTeX installer found here: BasicTeX Installer (I install with brew of course: brew install basictex) — and for Pandoc's templates to work I've determined the following additional packages are needed (installed easily with the command line tool tlmgr that comes with TeX, or with the TeX Live Utility):

sudo tlmgr install lm-math lualatex-math luatexja abstract \
latexmk csquotes pagecolor relsize ucharcat mdframed needspace sectsty \
titling titlesec preprint layouts glossaries tabulary soul xargs todonotes \
mfirstuc xfor wallpaper datatool substr ctablestack ifetex adjustbox collectbox \
footnotebackref fvextra

Troubleshooting

  • If you only get a HTML file out, it normally means that pandocomatic could not read the metadata or find the pandocomatic.yaml file. Make sure you have the Pandoc Data Directory properly set up, that your metadata at the top of the compiled markdown looks correct, and check for errors in the scrivomatic.log file that you should get every time you compile in Scrivener.
  • YAML metadata can be a bit fussy:
    • Metadata keys are lowercase: title not Title, pandocomatic not Pandocomatic etc.
    • You must use spaces for indentation, not tabs.
    • You should use "straight" not “curly” quotes for strings (use Scrivener's straighten quotes function).
    • Strings don't strictly need to be quoted, but it is normally safer (for example if there is a colon in the string you must quote).
    • You can validate your YAML online here, and read a quick tutorial of YAML here.
  • I use a Meta-data paragraph style to wrap --- around the Pandoc metadata front-matter, but you can just put it directly in the front matter yourself. Which ever way you do it, without --- around the metadata it will not be recognised, and you will again get a simple HTML output file.
  • Make sure there are no .ruby-version config files used by rbenv in the compile folder, or if there are that they are configured to use the correct Ruby version with pandocomatic installed...

scrivomatic's People

Contributors

iandol avatar marcolabreu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scrivomatic's Issues

How to add style to style pane?

Could you describe this process?

I could not understand the relationship between styles in specific format ( Multimarkdown for example ) and styles in style pane.

When I add style to format ( I dup Multimarkdown and rename it to Enhanced Multimarkdown ) at Styles section, these styles doesn't appear in styles pane.

Maybe I should set an option somewhere? ( Option to use specific format for document / text / folder? )

Thanks!

Failed to Run

I installed Scrivomatic, and it worked fine. I then installed the workflow, but here I am getting an error. It seems that the workflow is looking for Pandocomatic in /Library/TeX/texbin:$HOME/bin:/usr/local/bin, as evidenced by its citing V: Pandocomatic version 0.1.4.13. I have updated to 0.1.4.17, which is found instead at $HOME/.rvm/rubies/ruby-2.4.0/bin/.

I added that to the export Path in the script, but to no avail. Running Scrivomatic from the terminal continues to work. Am I missing something or is this a bug?

=== ##################################################### ===
=== Scrivomatic V1.0.8 Report @ 2017-09-15 10:48:00 +0100 ===
Running under Ruby 2.4.0
Working directory: $HOME/Desktop/scrivener-pandoc
====== Input Options: ======
#<struct Scrivomatic::OPT
 input="scrivener-pandoc.md",
 output=nil,
 to=nil,
 command="pandocomatic",
 envpath="/Library/TeX/texbin:$HOME/bin:/usr/local/bin",
 build=false,
 verbose=true>
====== Final ENV PATH: ======
/Library/TeX/texbin:$HOME/bin:/usr/local/bin:$HOME/.rvm/rubies/ruby-2.4.0/bin/:/Library/TeX/texbin:/usr/local/bin:$HOME/bin:$HOME/.pandoc:/usr/bin:/bin:/usr/sbin:/sbin
====== TOOL PATHS: ======
---pandoc: /usr/local/bin/pandoc | V: 1.19.2.1
---pandocomatic: /usr/local/bin/pandocomatic | V: Pandocomatic version 0.1.4.13
---panzer: 
---ruby: /usr/local/bin/ruby | V: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin17]
---python: /usr/bin/python
---rbenv: 
---xelatex: /Library/TeX/texbin/xelatex
 
running pandocomatic...
 
!!!---scrivomatic::runCommand() popen2e FAILED TO RUN /usr/local/bin/pandocomatic --debug scrivener-pandoc.md !!!

Scrivomatic only works with markdown files named .md

Hi Ian,

I've noticed in my testing that Scrivomatic only works with an input markdown file with a .md suffix. If I use a suffix such as .mdown, or no suffix at all (which is the default when exporting out of Scrivener) then Scrivomatic fails to find the resulting LaTeX file.

I'm not sure what the simplest way to handle this would be, without having to maintain a large list of possible suffixes. If it is possible to have Scrivomatic work without a suffix, that would be ideal.

Thanks,

Jerome

use Pandoc citeproc to convert [@citekey] to \cite{citekey} instead of hyperlink

In the workflow, pandoc citations [@citekey] are converted to something like this in LaTeX:

"Sint meis quo et, vis ad fæcete dolorem! Ad quøt moderatius elaboraret
eum(Crivellato \& Ribatti \protect\hyperlink{ref-crivellato2007}{2007}),
pro paulo ridens quaestio ut. 

Is it possible to convert [@citekey] to latex \cite{citekey} instead?

Thank you!

How does your template deal with Equations

Hello I download your example project and try to merge it with my workflow. Nevertheless, I do not find how you input math equations inside the scrivener project. Could you please give me some instructions?

Upon install: `parseInputs': undefined method `gsub' for nil:NilClass (NoMethodError)

I just downloaded the files, unzipped them, put them in ~/bin, and then ran chmod 755 scrivomatic.

Now, when I try to run scrivomatic, I get this error:

/Users/pk/bin/scrivomatic:130:in parseInputs': undefined method gsub' for nil:NilClass (NoMethodError)

I have no idea what it means.

I'm running macOS 10.13.4, and I just installed brew/pandoc/pandocomatic today, so they are the latest versions as of May 25.

Any help would be much appreciated.

Scrivomatic fails to process files with spaces in the name

Hi Ian,

I've noticed that Scrivomatic is not happy when passed an input file with a space in the name (e.g., My File.md). It doesn't matter if I escape the space with \, or enclose the name in double quotes. Either way, Scrivomatic fails with

!!!---Scrivomatic: could not find My\ File.tex

Is it possible to add support for file names with spaces?

! Paragraph ended before \FV@BeginScanning was complete

I am posting this for future reference.

There is no need to indent paragraphs (after the first one) in footnotes.
If you do, the following error will apear:

::: Pandoc responded with:
::: 
::: Error producing PDF.
::: ! Paragraph ended before \FV@BeginScanning was complete.
::: <to be read again> 
:::                    \par 
::: l.424 }

(Ian, thanks a lot for taking the time to put out Scrivomatic. It is really good and very well documented.)

Missing custom.docx

when running by hand
/usr/local/bin/pandocomatic -c pandocomatic.yaml --debug Workflow.md
in the workflow_mmd directory, it seems a custom.docx files seems missing.

havent found on workflow or github either.

01:02 $ /usr/local/bin/pandocomatic -c pandocomatic.yaml --debug Workflow.md
(4) + converting Workflow.md 3 times:
(3) - convert Workflow.md -> Workflow.docx
pandoc --from=markdown
--to=docx
--reference-doc=custom.docx
--filter=simplifyMetadata.rb
--filter=prependAll.rb
--standalone
--bibliography=workflow.bib
--csl=apa-workflow.csl
--output=/Users/luc_taesch/Desktop/workflow_mmd/Workflow.docx
pandoc: custom.docx: openBinaryFile: does not exist (No such file or directory)
Error running pandoc => error while running:

pandoc --from=markdown
--to=docx
--reference-doc=custom.docx
--filter=simplifyMetadata.rb
--filter=prependAll.rb
--standalone
--bibliography=workflow.bib
--csl=apa-workflow.csl
--output=/Users/luc_taesch/Desktop/workflow_mmd/Workflow.docx

Pandoc responded with:

pandoc: custom.docx: openBinaryFile: does not exist (No such file or directory)

✘-243 ~/Desktop/workflow_mmd

Request: add homebrew path to scrivomatic

The homebrew installation of pandoc is in /opt/homebrew/bin. If possible, could you please add that path to the list of paths in the environment which scrivomatic builds?

get it running

Hi Ian,

coming from the user side, I am a bit lost since I dont understand many of the things going on. I simply need to get my scrivener project to be convert in such a way that I can convert citekeys of bibdesk (or zotero) into a certain citation style.

On the one hand, I ran your 2018-test workflow that you posted back then. I get this error message:

=== ##################################################### ===
=== Scrivomatic V1.0.11 Report @ 2020-02-04 16:54:54 +0100 ===
Running under Ruby 2.6.3
Working directory: /Users/administrator/CLOUDSHARE/Doktorarbeit/Writings/#Dissertationsschrift/PRODUCTION_mmd
====== Input Options: ======
#<struct Scrivomatic::OPT input="'workflow.md'", output=nil, to=nil, command="pandocomatic", envpath="/Users/administrator/bin:/usr/local/bin", build=false, verbose=true, dry_run=false>
====== Final ENV PATH: ======
/Users/administrator/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
====== TOOL PATHS: ======
---pandoc: /usr/local/bin/pandoc | V: 2.9.1.1
---pandocomatic: /usr/local/bin/pandocomatic | V:
---ruby: /usr/bin/ruby | V: ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
---python: /usr/bin/python

… running pandocomatic, please wait …
====== COMMAND OUTPUT: ======
:: Running: /usr/local/bin/pandocomatic --debug 'workflow.md'
::: No such template: 'paper-with-refs-docx'.
:: exit status: pid 3213 exit 243
!!!---scrivomatic::runCommand() RETURN non-zero value: /usr/local/bin/pandocomatic --debug 'workflow.md' !!!!

On the other hand:

I try to follow your general setup, but the Post-Processing-Script-Stepdoes not work either, e.g. I try to make the script usable from terminal like this

chmod 755 $HOME/bin/scrivomatic
scrivomatic -h
and getting this:
-bash: scrivomatic: command not found

I generally wonder if a certain (la)tex setup or anything else except scrivener, MMD, pandoc and pandocomatic is neccessary to run your script.

** update: for this second thing: the scrivomatic script was saved as a .txt - is that a problem?

Question from guide: Blockquotes, escaping special characters, and blockquote prefix

I had a question about one part of your guide, though I don't know if this is pertinent specifically to Scrivomatic. I imported the compile/styles preset from your guide, and while it works well, for block quote-styled sections of my paper (e.g.), the prefixed > character in each block quote-styled paragraph gets escaped as \> . I currently have the 'escape characters' option set here:

Screen Shot 2019-05-17 at 4 40 19 PM

And currently the prefix for the block quote style:

Screen Shot 2019-05-17 at 5 01 16 PM

It seems like Scrivener escapes whatever is in the 'prefix' field, regardless if it's not supposed to be (I would think...). Any idea to turn off escaping for this, or will I just need to disable character escaping or any Markdown transformation for this style?

Failed to find template

Hi. I am getting the following error:

=== ##################################################### ===
=== Scrivomatic V1.0.11 Report @ 2018-01-19 23:38:20 +1100 ===
 Running under Ruby 2.3.3
 Working directory: /Users/atanas/Desktop/workflow_mmd
====== Input Options: ======
#<struct Scrivomatic::OPT input="'workflow.md'", output=nil, to=nil, command="pandocomatic", envpath="/Library/TeX/texbin:/Users/atanas/bin:/usr/local/bin", build=false, verbose=true, dry_run=false>
====== Final ENV PATH: ======
/Library/TeX/texbin:/Users/atanas/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
====== TOOL PATHS: ======
---pandoc: /usr/local/bin/pandoc | V: 2.1
---pandocomatic: /usr/local/bin/pandocomatic | V: Pandocomatic version 0.2.2.1
---ruby: /usr/bin/ruby | V: ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]
---rbenv: /usr/local/bin/rbenv
---python: /usr/bin/python
---xelatex: /Library/TeX/texbin/xelatex

 … running pandocomatic, please wait …
====== COMMAND OUTPUT: ======
:: Running: /usr/local/bin/pandocomatic --debug 'workflow.md' 
::: No such template: 'paper-with-refs-docx'.
:: exit status: pid 1486 exit 243
!!!---scrivomatic::runCommand() RETURN non-zero value: /usr/local/bin/pandocomatic --debug 'workflow.md' !!!

I am following the instruction in the Scrivener template you provided. I've run this multiple times, removing the paper-with-refs-docx and putting in line the paper-with-refs-odt, or just leaving the paper-with-refs-html in the template YAML metadata... but no joy.

Not sure what I am doing wrong. Any help would be greatly appreciated. Thanks in advance.

Paru doesn't recognise "lof:true" and "lot:true

Hi,

I'm playing around with your Workflow.md example and testet some options. If I want a listoffigures and listoftables I have to set these option in pandocomatic.yaml. So I extended your brief pandocomatic.yaml example with
" paper-with-refs-latex:
extends: ['refs'] #we can inherit from other templates
pandoc:
from: markdown
to: latex
template: ./custom.latex
toc: true
toc-depth: 4
lof: true
lot: true

base-header-level: 2
filter:
- './assimilateMetadata.rb' #regularise metadata fields so pandoc template can use it more easily
metadata:
CJKmainfont: 'PingFang SC'
lang: 'en-GB'
papersize: 'A4'
documentclass: 'article'
fontsize: '12pt'
linestretch: '1.75'
geometry: 'margin=2cm'
nonumberfigures: true
linkcolor: Mahogany
citecolor: Sepia
urlcolor: BrickRed
#########################################
pdf-refs:
extends: [paper-with-refs-latex]
pandoc:
to: pdf
pdf-engine: 'xelatex'
cleanup: ['latexmk -c']
"

And in the scrivomatic.log I get this:
"::: The pandoc option 'lof' (with value 'true') is not recognized by paru. This option is skipped.
::: The pandoc option 'lot' (with value 'true') is not recognized by paru. This option is skipped."

Any hints how to fix it?

Thanks and best regards
Andreas

Endnotes instead of footnotes (docx)

I fear this is an absolute newb question but how do I compile in a way that linked footnotes are turned into endnotes automatically using docx?
I found nothing in the Scrivener Format or in how to set up the pandocomatic yaml or template docx-files.

The Scrivener user manual speaks of the possibility of using inline and linked footnotes as separate streams, turning one into footnotes, the other into endnotes (page 536). How/where do I enable that "[^cf1]:" linked footnotes will be turned into endnotes when compiled for docx?

Thank you!

Pandoc-Citeproc Cannot decode byte '\x9f'

Hi, I hope someone might be able to help me.

I installed Scrivomatic this morning and so far I've had a consistent issue getting past the creation of .md files during the compile sequence – it appears pandoc thinks I'm using the wrong encoding somewhere. This is the despite the fact I've confirmed (to the best of my ability) that my .bib file is using UTF-8.

Googling seems to imply this is a common issue with pandoc conversions, but I can't figure out how any of the solutions apply to the Scrivomatic implementation of pandoc.

Is this something that's come up before as an issue? And is there a fix? Many thanks in advance.

Here's the debug log:

=== ------------------------------------------------------ ===
=== Scrivomatic V1.0.29 Report @ 2020-07-06 12:48:46 +0100 ===
=== ------------------------------------------------------ ===
Working directory: /Users/charliesmith/Desktop/CHS Draft Transfer.md
Initiating with Ruby 2.6.3
===------ Input Options: ------===
#<struct Scrivomatic::OPT input="CHS\ Draft\ Transfer.md", output=nil, to=nil, yaml=nil, command="pandocomatic", envpath="/Users/charliesmith/bin:/Library/TeX/texbin:/usr/local/bin", build=false, cleanup=false, verbose=true, dry_run=false, open_log=true, data_dir=nil>
===------ Final ENV PATH: ------===
/Users/charliesmith/bin:/Library/TeX/texbin:/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.9.2.1
---pandocomatic: /usr/local/bin/pandocomatic | V: 0.2.7.1
---ruby: /usr/bin/ruby | V: ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
---rbenv versions:
---gem: /usr/bin/gem
---python: /usr/bin/python
---xelatex: /Library/TeX/texbin/xelatex

… running pandocomatic, please wait …
===------ COMMAND OUTPUT: ------===
:: Running: /usr/local/bin/pandocomatic --debug CHS\ Draft\ Transfer.md
::: (4) + converting /Users/charliesmith/Desktop/CHS Draft Transfer.md/CHS Draft Transfer.md 3 times:
::: (3) - convert CHS Draft Transfer.md -> CHS Draft Transfer.docx
::: pandoc --from=markdown
::: --to=docx
::: --reference-doc=/Users/charliesmith/.local/share/pandoc/templates/custom.docx
::: --standalone
::: --filter=/usr/local/bin/pandoc-citeproc
::: --bibliography=/Users/charliesmith/.local/share/pandoc/Zotero\ Bib\ Library.bib
::: --csl=/Users/charliesmith/.local/share/pandoc/csl/apa.csl
::: --output=/Users/charliesmith/Desktop/CHS\ Draft\ Transfer.md/CHS\ Draft\ Transfer.docx
::: pandoc-citeproc: Cannot decode byte '\x9f': Data.Text.Internal.Encoding.decodeUtf8: Invalid UTF-8 stream
::: Error running filter /usr/local/bin/pandoc-citeproc:
::: Filter returned error status 1
::: Error running pandoc => error while running:
:::
::: pandoc --from=markdown
::: --to=docx
::: --reference-doc=/Users/charliesmith/.local/share/pandoc/templates/custom.docx
::: --standalone
::: --filter=/usr/local/bin/pandoc-citeproc
::: --bibliography=/Users/charliesmith/.local/share/pandoc/Zotero\ Bib\ Library.bib
::: --csl=/Users/charliesmith/.local/share/pandoc/csl/apa.csl
::: --output=/Users/charliesmith/Desktop/CHS\ Draft\ Transfer.md/CHS\ Draft\ Transfer.docx
:::
::: Pandoc responded with:
:::
::: pandoc-citeproc: Cannot decode byte '\x9f': Data.Text.Internal.Encoding.decodeUtf8: Invalid UTF-8 stream
::: Error running filter /usr/local/bin/pandoc-citeproc:
::: Filter returned error status 1
:::
:: exit status: pid 79231 exit 243

!!!---scrivomatic::runCommand() RETURN non-zero value: /usr/local/bin/pandocomatic --debug CHS\ Draft\ Transfer.md !!!

Only some headers properly formatting after .docx conversion

Hi Ian! I've had scrivomatic set up and working for over a year now (thank you for all the time saved!) but have recently reinstalled MacOS and run into an issue that I can't seem to troubleshoot.

On compiling to .docx, a few of my headings render out as expected whilst others render out like this:
Screenshot 2022-03-28 at 15 23 43

The same seems to happen with subscript. There doesn't seem to be much rhyme or reason to which ones are properly converted. H1, H2 and H3 all face this issue intermittently and I can't particularly discrern what could be causing the problems. In the same document, some will work and some won't. The log scrivomatic creates also doesn't seem to note anything related to this issue.

I should clarify that I don't use binder headings, preferring to instead have my titles appear in text. That said, they are styled properly, I believe, and look fine in the .md output. Yet in the .docx they often don't populate as styled headings.

Any ideas what might be going on here? Thank you in advance for any guidance you can offer!

Keywords in Pandoc 2

Hi,
thank you for your solution. It works for me. My question is:

  • In Pandoc 2.0 you can convert keywords from .md to .docx. Thus when in yaml you have keywords they will be shown in the docx after the conversion.
    My question is how I can set this in pandocmatic.yaml, thus it is followed during a conversion? Or there is another way, because I can not make it working.
    Thank you!

Figures and Tables in your Crossref examplae

Hi,

I used you crossref examplae, because I'm switching from pure Markdown with Typora as my editor back to Scrivener. Your setup works fine, but I have issue with figures and tables:

  1. In the markddown file the second figure with the [#fig:...] syntax isn't shown in Typora, because of the path to the figure is in square brackets. See attached screenshots.
  2. Both figures are shown in the Word .docx file but the captions are not recognized in Word, not for the figures and not for the tables. And no lists for figures and tables are generated automatically. If I try to insert a list of figures Word do not find any captions. See also the screenshot attached.
  3. In Word I get the message in the third screenshot if I open it. Are the issues maybe related to the message?

Any help is appreciated and thanks very much for your work during the last years

Andreas
CleanShot 2022-06-07 at 08 07 07@2x

CleanShot 2022-06-07 at 08 03 46@2x

CleanShot 2022-06-07 at 08 09 35@2x

pandomatic run by hand , not in script

(once template files are copied into the compile dir) , see #19

1/ the command runs ok by hand , but
2/ not in the compile scripts

extract of logs :

:: Running: /usr/local/bin/pandocomatic -c pandocomatic.yaml --debug Workflow.md
::: env: ruby_executable_hooks: No such file or directory
:: exit status: pid 73223 exit 127

!!!---scrivomatic::runCommand() RETURN non-zero value: /usr/local/bin/pandocomatic -c pandocomatic.yaml --debug Workflow.md !!!

when run by hand it works:

: -243 ~/Desktop/workflow_mmd
01:48 $ /usr/local/bin/pandocomatic -c pandocomatic.yaml --debug Workflow.md
(4) + converting Workflow.md 3 times:
(3) - convert Workflow.md -> Workflow.html
pandoc --standalone
--filter=/usr/local/bin/pandoc-citeproc
--bibliography=workflow.bib
--csl=apa-workflow.csl
(2) - convert Workflow.md -> Workflow.html
pandoc --from=markdown
--to=html5
--template=custom.html
--css=custom.css
--standalone
--section-divs
--self-contained
--toc
--toc-depth=4
--base-header-level=1
--filter=assimilateMetadata.rb
--bibliography=workflow.bib
--csl=apa-workflow.csl
(1) - convert Workflow.md -> Workflow.docx
pandoc --from=markdown
--to=docx
--reference-doc=custom.docx
--filter=simplifyMetadata.rb
--filter=prependAll.rb
--standalone
--bibliography=workflow.bib
--csl=apa-workflow.csl
--output=/Users/luc_taesch/Desktop/workflow_mmd/Workflow.docx
Pandocomatic needed 1.8 seconds to convert 'Workflow.md'.

ruby_executable_hooks: No such file or directory

i am running into a hook issue when trying the basic workflow file. any ideas what it could be ? ( just reinstall brew on mojave. note that I have rvm installed. see the path).

would you have a test file to make sure my prerequise are ok ? ( like a .spec for TDD)

===------ Final ENV PATH: ------===
/Users/luc_taesch/bin:/usr/local/bin:/Library/TeX/texbin:/Users/luc_taesch/.rbenv/shims:/Users/luc_taesch/.rvm/wrappers/default:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/Scrivener 3.app/Contents/Resources/MultiMarkdown/bin
===------ TOOL PATHS: ------===
---pandoc: /usr/local/bin/pandoc | V: 2.1.3
---pandocomatic: /usr/local/bin/pandocomatic | V:
---ruby: /usr/local/bin/ruby | V: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
---rbenv: /usr/local/bin/rbenv
---python: /usr/bin/python
---xelatex: /Library/TeX/texbin/xelatex

… running pandocomatic, please wait …
===------ COMMAND OUTPUT: ------===
:: Running: /usr/local/bin/pandocomatic -c pandocomatic.yaml --debug Workflow.md
::: env: ruby_executable_hooks: No such file or directory
:: exit status: pid 2835 exit 127

!!!---scrivomatic::runCommand() RETURN non-zero value: /usr/local/bin/pandocomatic -c pandocomatic.yaml --debug Workflow.md !!!

error trying to compile simple workflow: `require': cannot load such file -- paru/filter (LoadError)

I'm trying to follow the instructions in https://raw.githubusercontent.com/iandol/scrivomatic/master/Workflow.scriv.zip (downloaded from https://github.com/iandol/scrivomatic#tldr-simple-summary) and am having a problem that seems similar to #13 except I just installed all the software and everything should be up to date. Here's my scrivomatic log:

=== ------------------------------------------------------ ===
=== Scrivomatic V1.0.29 Report @ 2020-08-17 06:42:42 -0400 ===
=== ------------------------------------------------------ ===
 Working directory: /Volumes/workspace/sigfried/workflow-testing/workflow-mmd
 Initiating with Ruby 2.6.3
===------ Input Options: ------===
#<struct Scrivomatic::OPT input="Workflow.md", output=nil, to=nil, yaml="pandocomatic.yaml", command="pandocomatic", envpath="/Users/sigfried/bin:/Users/sigfried/.rbenv/shims:/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/2.7.0/bin:/Library/TeX/texbin:/usr/local/bin:/Users/sigfried/.local/bin", build=false, cleanup=false, verbose=true, dry_run=false, open_log=true, data_dir=nil>
===------ Final ENV PATH: ------===
/Users/sigfried/bin:/Users/sigfried/.rbenv/shims:/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/2.7.0/bin:/Library/TeX/texbin:/usr/local/bin:/Users/sigfried/.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.9.2.1
---pandocomatic: /usr/local/bin/pandocomatic | V: 0.2.7.2
---ruby: /Users/sigfried/.rbenv/shims/ruby | V: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
---rbenv versions:
---gem: /Users/sigfried/.rbenv/shims/gem
---python: /usr/local/bin/python
---xelatex: /Library/TeX/texbin/xelatex
---latexmk: /Library/TeX/texbin/latexmk

 … running pandocomatic, please wait …
===------ COMMAND OUTPUT: ------===
:: Running: /usr/local/bin/pandocomatic -c pandocomatic.yaml --debug Workflow.md 
::: The pandoc option 'base_header_level' (with value '1') is not recognized by paru. This option is skipped.
::: (5) + converting /Volumes/workspace/sigfried/workflow-testing/workflow-mmd/Workflow.md 4 times:
::: (4)   - convert Workflow.md -> Workflow.tex
::: pandoc	--from=markdown \
::: 	--to=latex \
::: 	--template=custom.latex \
::: 	--toc \
::: 	--toc-depth=4 \
::: 	--filter=assimilateMetadata.rb \
::: 	--standalone \
::: 	--bibliography=workflow.bib \
::: 	--csl=apa-workflow.csl
::: /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- paru/filter (LoadError)
::: 	from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
::: 	from ./assimilateMetadata.rb:22:in `<main>'
::: Error running filter assimilateMetadata.rb:
::: Filter returned error status 1
::: Error running pandoc => error while running:
::: 
::: pandoc	--from=markdown \
::: 	--to=latex \
::: 	--template=custom.latex \
::: 	--toc \
::: 	--toc-depth=4 \
::: 	--filter=assimilateMetadata.rb \
::: 	--standalone \
::: 	--bibliography=workflow.bib \
::: 	--csl=apa-workflow.csl
::: 
::: Pandoc responded with:
::: 
::: /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- paru/filter (LoadError)
::: 	from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
::: 	from ./assimilateMetadata.rb:22:in `<main>'
::: Error running filter assimilateMetadata.rb:
::: Filter returned error status 1
::: 
:: exit status: pid 67553 exit 243

!!!---scrivomatic::runCommand() RETURN non-zero value: /usr/local/bin/pandocomatic -c pandocomatic.yaml --debug Workflow.md !!!

Any ideas what I'm doing wrong?
Thanks!

Possible help with setting this up? Not an actual issue...

Hi,

I am sorry to bother you but I wondered if you could help me at all in setting up this workflow. I will try to explain where I am up to.

I have the up to date scrivener for mac. I have installed pandoc and pandocomatic. I downloaded and used the scrivomatic template and I have read through the scrivener document and successfully unpacked all of its contents to my desktop in a folder workflow_mmd. Generally it seems to work and I was able to compile and export the scrivener workflow document you made into new dox and html files etc like I think I was supposed to as a test.

Other info. I am using zotero pandoc inline citations in scrivener with the zotpick apple script. This all works and I use marked2 to see how it's looking as I go along.

I am trying to work collaboratively therefore I would like to produce a regular full output from scrivener into a perfectly formatted word document in an academic style.

When I try to compile my own project using your method and files it give me all outputs except from the docx. format which is the main one I need really.

Also would there be a way to make my pandoc citations produce a full bibliography using your method. Up until now I have been doing this by compiling from scrivener into plain text then putting a command through terminal which converts the plain text file into a docx. with a full bibliogrpahy. However, it didn't produce a document which looked nice and formatted well.

The formatting element to all of these methods is what I am struggling to get right you see.

Sorry if I am not being clear, I suppose that is because I am still trying to figure it all out in my head as it is.

Best wishes

Question -- styles vs convert markdown

Question: I noticed that Scrivener has an option to 'Convert Rich Text to Markdown' which basically attempts to do just that. Is there a benefit of using Styles, as you've indicated, over this option? Are there clear downsides to using this convert option? It seems both would export to the same markdown format.

I'm thinking about this because I plan to also use scrivener extensively on iOS, and while it seems that styles might sync across, it's not possible to bind keyboard shortcuts to styles, and might make writing on iOS more difficult.

Apologies if this is too far off the current repository.

Updating Ruby for Paru, Pandocomatic, and Scrivomatic

In trying to update paru and pandocomatic according to the instructions you provided here, I discovered that I have an outdated version of Ruby and that paru won't update because of that. Using some google-fu, I ended up finding your comment on a pandocomatic issue where you said that you would "change the advice [you] give to [users of your scrivener workflow], and suggest [we] upgrade via rbenv/homebrew..."

I haven't had any issues using Scrivomatic yet, but I'd like to find out how to update Ruby so I can update Paru, Pandocomatic, and Scrivomatic before I do run into issues.

Thanks for the work you have put into Scrivomatic!

Compiling from scrivener

I am trying to follow the directions for installing pandocomatic and scrivomatic in order to compile a scrivener manuscript containing equations to docx.

So far I can get the math to compile correctly and the figures are also inserted correctly, but I don't get the layout specified in the template (text justified, etc) or given in the scrivener file. There is also no scrivomatic.log file generated.

I suspect there is a problem with correct paths or folders, but I cannot find it. Any suggestions for where to look would be very much appreciated.

Thanks, Anja

How to create an updated log?

Hi,

Thanks a ton for creating scrivomatic. It's making my workflow so much easier. Love the customization options through pandocomatic.

As someone relatively new to programming, I'm having trouble creating a log of what has happened. Conversion works when it does, but when it doesn't it's up to me to figure out why. I've used the arguments in the screenshot you provide, but I don't get an accurate log. Sometimes console loads but often it displays an outdated log. Are there any resources that you know of that I can use to solve this problem?

Question—export to .pptx

Hi,

Great scripting—this has really helped my workflow so much!

I am having trouble exporting a slideshow. I cannot seem to get the pandoc_title_block to appear as would be expected when trying to go via the workflow.

I have used the template provided in the pandoc use manual (see the 'Producing slide shows with pandoc' section for the example habits.txt file).

Specifically, this appears at the top of the document:

% Habits
% John Doe
% March 22, 2005

The cli code provided in the manual is:

pandoc habits.txt -o habits.pptx

This works as expected (see habitsOk.pptx). Now, I have added the following to the pandocomatic.yaml file:

  pptx:
    extends: ['refs']
    pandoc:
      from: markdown
      to: pptx
      reference-doc: "_templates/uow_custom.pptx"  #templates/custom.docx

All other attributes print as normal, however the title block does not (see habitsNotOk.pptx). I'm not sure whether it is because when going through the workflow it is converting form markdown and not txt as per the pandoc provided example, or something else completely different.

Any ideas? Your help is greatly appreciated!

Cheers,
Atanas

TOC generation howto

As a new scrivener user I have your workflow up and running successfully. Thanks so much for sharing. I'm really excited about how this will help me with my study, less mucking around with formatting and references, more focus on my work!

My issue now revolves around customising and creating templates to suit my needs.

As an example. I'm attempting to create a format required for my essay submission that my institution requires. So far so good and have it as a docx with correct fonts and styling mostly in the correct format along with working integration for my referencing.

Where I'm really struggling is integrating of a Table of Contents on the correct page. How is this templated? From what I can see is Pandoc can generate a TOC with the --toc flag, however has can I define in scrivener, does it even need to be defined in scrivener?

Filter errors after update

Hallo!
A couple of days ago, I updated my system to macOS 12.0.1 (from Big Sur). I did not encounter any issues when compiling from Scrivener via scrivomatic. However, today I updated brew, pandocomatic etc. and since then, run into errors with the filters.
I downloaded the "working pandoc folder" again, updated the script in my Scrivener formats, tried to switch ruby versions with rbenv, and when that did not help, uninstalled brew and everything, re-installed following the instructions, but to no avail.
When I switch off the filters in the yaml-file, I receive another error, this time with pandocomatic itself.

Is there anything you can spot in the logs that would indicate what I can do to fix the issue?
Using the Workflow example results in the same errors.

Thank you for any hints!

1. With filters enabled:

=== ------------------------------------------------------ ===
=== Scrivomatic V1.0.30 Report @ 2021-11-11 15:51:26 +0900 ===
=== ------------------------------------------------------ ===
 Running shell: /bin/zsh
 Working directory: /Users/username/Desktop/OutputFile.md
 Initiating with Ruby 2.6.8
===------ Input Options: ------===
#<struct Scrivomatic::OPT input="OutputFile.md", output=nil, to=nil, yaml=nil, command="pandocomatic", envpath="/Users/username/bin:/Library/TeX/texbin:/usr/local/bin", build=true, cleanup=false, verbose=true, dry_run=false, open_log=false, data_dir=nil>
===------ Final ENV PATH: ------===
/Users/username/bin:/Library/TeX/texbin:/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.16.1
---pandocomatic: /usr/local/bin/pandocomatic | V: 0.2.7.7
---ruby: /usr/bin/ruby | V: ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.x86_64-darwin21]
---rbenv versions:
---gem: /usr/bin/gem
---python: /usr/bin/python
---xelatex: /Library/TeX/texbin/xelatex

 … running pandocomatic, please wait …
===------ COMMAND OUTPUT: ------===
:: Running: /usr/local/bin/pandocomatic --debug OutputFile.md 
::: pandoc	--from=markdown \
::: 	--to=html5 \
::: 	--standalone \
::: 	--section-divs \
::: 	--mathjax \
::: 	--lua-filter=/Users/username/.local/share/pandoc/filters/pagebreak.lua \
::: 	--filter=/Users/username/.local/share/pandoc/filters/assimilateMetadata.rb \
::: 	--template=/Users/username/.local/share/pandoc/templates/mytemplate.html \
::: 	--css=/Users/username/.local/share/pandoc/templates/mytemplate.css \
::: 	--toc \
::: 	--toc-depth=3 \
::: 	--verbose \
::: 	--citeproc \
::: 	--bibliography=/Users/username/.local/share/pandoc/bibs/mytemplate_2_Cthulhu.json \
::: 	--csl=/Users/username/.local/share/pandoc/csl/jrpg.csl \
::: 	--citation-abbreviations=/Users/username/.local/share/pandoc/cite-abbr.json \
::: 	--reference-links
::: [INFO] Loaded /Users/username/.local/share/pandoc/templates/mytemplate.html from /Users/username/.local/share/pandoc/templates/mytemplate.html
::: [INFO] Running filter /Users/username/.local/share/pandoc/filters/pagebreak.lua
::: [INFO] Completed filter /Users/username/.local/share/pandoc/filters/pagebreak.lua in 19 ms
::: [INFO] Running filter /Users/username/.local/share/pandoc/filters/assimilateMetadata.rb
::: /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/psych.rb:271:in `load': unknown keyword: permitted_classes (ArgumentError)
::: 	from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2.4/lib/paru/filter/metadata.rb:52:in `initialize'
::: 	from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2.4/lib/paru/filter.rb:279:in `new'
::: 	from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2.4/lib/paru/filter.rb:279:in `filter'
::: 	from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2.4/lib/paru/filter.rb:251:in `run'
::: 	from /Users/username/.local/share/pandoc/filters/assimilateMetadata.rb:77:in `<main>'
::: Error running filter /Users/username/.local/share/pandoc/filters/assimilateMetadata.rb:
::: Filter returned error status 1
::: Error running pandoc => error while running:
::: 
::: pandoc	--from=markdown \
::: 	--to=html5 \
::: 	--standalone \
::: 	--section-divs \
::: 	--mathjax \
::: 	--lua-filter=/Users/username/.local/share/pandoc/filters/pagebreak.lua \
::: 	--filter=/Users/username/.local/share/pandoc/filters/assimilateMetadata.rb \
::: 	--template=/Users/username/.local/share/pandoc/templates/mytemplate.html \
::: 	--css=/Users/username/.local/share/pandoc/templates/mytemplate.css \
::: 	--toc \
::: 	--toc-depth=3 \
::: 	--verbose \
::: 	--citeproc \
::: 	--bibliography=/Users/username/.local/share/pandoc/bibs/mybib.json \
::: 	--csl=/Users/username/.local/share/pandoc/csl/jrpg.csl \
::: 	--citation-abbreviations=/Users/username/.local/share/pandoc/cite-abbr.json \
::: 	--reference-links
::: 
::: Pandoc responded with:
::: 
::: [INFO] Loaded /Users/username/.local/share/pandoc/templates/mytemplate.html from /Users/username/.local/share/pandoc/templates/mytemplate.html
::: [INFO] Running filter /Users/username/.local/share/pandoc/filters/pagebreak.lua
::: [INFO] Completed filter /Users/username/.local/share/pandoc/filters/pagebreak.lua in 19 ms
::: [INFO] Running filter /Users/username/.local/share/pandoc/filters/assimilateMetadata.rb
::: /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/psych.rb:271:in `load': unknown keyword: permitted_classes (ArgumentError)
::: 	from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2.4/lib/paru/filter/metadata.rb:52:in `initialize'
::: 	from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2.4/lib/paru/filter.rb:279:in `new'
::: 	from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2.4/lib/paru/filter.rb:279:in `filter'
::: 	from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2.4/lib/paru/filter.rb:251:in `run'
::: 	from /Users/username/.local/share/pandoc/filters/assimilateMetadata.rb:77:in `<main>'
::: Error running filter /Users/username/.local/share/pandoc/filters/assimilateMetadata.rb:
::: Filter returned error status 1
::: 
:: exit status: pid 4936 exit 243

!!!---scrivomatic::runCommand() RETURN non-zero value: /usr/local/bin/pandocomatic --debug OutputFile.md !!!

===------ RUN LATEXMK on OutputFile.tex: ------===
!!!---Scrivomatic postBuild: could not find OutputFile.tex

2. Without filters:

=== ------------------------------------------------------ ===
=== Scrivomatic V1.0.30 Report @ 2021-11-11 15:53:22 +0900 ===
=== ------------------------------------------------------ ===
 Running shell: /bin/zsh
 Working directory: /Users/username/Desktop/OutputFile.md
 Initiating with Ruby 2.6.8
===------ Input Options: ------===
#<struct Scrivomatic::OPT input="OutputFile.md", output=nil, to=nil, yaml=nil, command="pandocomatic", envpath="/Users/username/bin:/Library/TeX/texbin:/usr/local/bin", build=true, cleanup=false, verbose=true, dry_run=false, open_log=false, data_dir=nil>
===------ Final ENV PATH: ------===
/Users/username/bin:/Library/TeX/texbin:/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.16.1
---pandocomatic: /usr/local/bin/pandocomatic | V: 0.2.7.7
---ruby: /usr/bin/ruby | V: ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.x86_64-darwin21]
---rbenv versions:
---gem: /usr/bin/gem
---python: /usr/bin/python
---xelatex: /Library/TeX/texbin/xelatex

 … running pandocomatic, please wait …
===------ COMMAND OUTPUT: ------===
:: Running: /usr/local/bin/pandocomatic --debug OutputFile.md 
::: An unexpected error has occurred. You can report this bug via https://github.com/htdebeer/pandocomatic/issues/new.
::: /Library/Ruby/Gems/2.6.0/gems/pandocomatic-0.2.7.7/lib/pandocomatic/configuration.rb:666:in `is_local_path?': undefined method `start_with?' for nil:NilClass (NoMethodError)
::: 	from /Library/Ruby/Gems/2.6.0/gems/pandocomatic-0.2.7.7/lib/pandocomatic/configuration.rb:554:in `update_path'
::: 	from /Library/Ruby/Gems/2.6.0/gems/pandocomatic-0.2.7.7/lib/pandocomatic/command/convert_file_command.rb:192:in `block (2 levels) in pandoc'
::: 	from /Library/Ruby/Gems/2.6.0/gems/pandocomatic-0.2.7.7/lib/pandocomatic/command/convert_file_command.rb:186:in `each'
::: 	from /Library/Ruby/Gems/2.6.0/gems/pandocomatic-0.2.7.7/lib/pandocomatic/command/convert_file_command.rb:186:in `block in pandoc'
::: 	from /Library/Ruby/Gems/2.6.0/gems/pandocomatic-0.2.7.7/lib/pandocomatic/command/convert_file_command.rb:184:in `chdir'
::: 	from /Library/Ruby/Gems/2.6.0/gems/pandocomatic-0.2.7.7/lib/pandocomatic/command/convert_file_command.rb:184:in `pandoc'
::: 	from /Library/Ruby/Gems/2.6.0/gems/pandocomatic-0.2.7.7/lib/pandocomatic/command/convert_file_command.rb:135:in `convert_file'
::: 	from /Library/Ruby/Gems/2.6.0/gems/pandocomatic-0.2.7.7/lib/pandocomatic/command/convert_file_command.rb:86:in `run'
::: 	from /Library/Ruby/Gems/2.6.0/gems/pandocomatic-0.2.7.7/lib/pandocomatic/command/command.rb:129:in `execute'
::: 	from /Library/Ruby/Gems/2.6.0/gems/pandocomatic-0.2.7.7/lib/pandocomatic/command/convert_file_multiple_command.rb:99:in `block in execute'
::: 	from /Library/Ruby/Gems/2.6.0/gems/pandocomatic-0.2.7.7/lib/pandocomatic/command/convert_file_multiple_command.rb:98:in `each'
::: 	from /Library/Ruby/Gems/2.6.0/gems/pandocomatic-0.2.7.7/lib/pandocomatic/command/convert_file_multiple_command.rb:98:in `execute'
::: 	from /Library/Ruby/Gems/2.6.0/gems/pandocomatic-0.2.7.7/lib/pandocomatic/pandocomatic.rb:105:in `run'
::: 	from /Library/Ruby/Gems/2.6.0/gems/pandocomatic-0.2.7.7/bin/pandocomatic:3:in `<top (required)>'
::: 	from /usr/local/bin/pandocomatic:23:in `load'
::: 	from /usr/local/bin/pandocomatic:23:in `<main>'
:: exit status: pid 5027 exit 1

!!!---scrivomatic::runCommand() RETURN non-zero value: /usr/local/bin/pandocomatic --debug OutputFile.md !!!

===------ RUN LATEXMK on OutputFile.tex: ------===
!!!---Scrivomatic postBuild: could not find OutputFile.tex

pandoc-citeproc install error

When I run brew install pandoc-citeproc, I receive the following error:

Error: pandoc-citeproc has been disabled because it is deprecated upstream!

Thanks.

Style settings

Can you please share your Scrivener 3 style settings which can be used with your already linked compile settings?

test file contribution

I would like to contribute " unit test file" which is also a demo file.

it is a scrivener file, that once compiles , test the unit features . like bold, italics, links , etc

  • it shows the do and dont when using scrivener ans scrivomatic:
    example : use the strong style , not the alt B native command.
  • it demonstrates the limits of scrivener-scrivomatic, so far
  • it helps with regression testing on unitary basic

it is so far not exhaustive, not fully fixed, however this is stand by for 3 month now, as I have reached a point that is good enough for me, so I prefer to share it in the current status, rather than perfect and ever.

ScrivoTests.scriv.zip

=== ------------------------------------------------------ ===
=== Scrivomatic V1.0.20 Report @ 2019-04-10 15:19:01 +0200 ===
=== ------------------------------------------------------ ===
Running under Ruby 2.3.7
Working directory: /Users/luctaesch/Dropbox/zkn/build_mmd
===------ Input Options: ------===
#<struct Scrivomatic::OPT input="ScrivoTests.md", output=nil, to=nil, yaml="./pandocomatic.yaml", command="pandocomatic", envpath="/Users/luctaesch/bin:/usr/local/bin:/Library/TeX/texbin:/Users/luctaesch/.rbenv/shims", build=false, cleanup=false, verbose=true, dry_run=false, open_log=true>
===------ Final ENV PATH: ------===
/Users/luctaesch/bin:/usr/local/bin:/Library/TeX/texbin:/Users/luctaesch/.rbenv/shims:/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.3.1
---pandocomatic: /Users/luctaesch/.rbenv/shims/pandocomatic | V: Pandocomatic version 0.2.3.0
---ruby: /Users/luctaesch/.rbenv/shims/ruby | V: ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18]
---rbenv: /usr/local/bin/rbenv
---python: /usr/bin/python
---xelatex: /Library/TeX/texbin/xelatex
---latexmk: /Library/TeX/texbin/latexmk

… running pandocomatic, please wait …
===------ COMMAND OUTPUT: ------===
:: Running: /Users/luctaesch/.rbenv/shims/pandocomatic -c ./pandocomatic.yaml --debug ScrivoTests.md
::: pandoc --from=markdown
::: --to=markdown_mmd
::: --bibliography=mybib.bib
::: --wrap=none
::: --filter=/usr/local/bin/pandoc-citeproc
::: --csl=/Users/luctaesch/.pandoc/csl/chicago-fullnote-bibliography-LTA2.csl.xml
::: Pandocomatic needed 0.6 seconds to convert 'ScrivoTests.md'.
:: exit status: pid 33316 exit 0

results in:
ScrivoTests.md.zip

Working solution?

Hi,

I play around with Scrivener 3 and scrivomatic, but I get bad results. As I'm total new to pandoc and so on, I can't configure pandocomatic.yaml properly, because I don't understand what I have to customize for my needs.
Example:
I get a "html" Output, but no "docx" output with your example front-matte entries and don't no why.

Do you have some additional advices or a Scrivener project with proper Settings to get a working solution?
I appreciate your help a lot.

Thank you and best regards
Andreas

Conversion to PDF: cleanup via latexmk not working

I would like to convert my Scrivener file to PDF via your pdf-refs template. Since I'm using the fixLaTeX postprocessor to replace missing glyphs, I also need to run latexmk, which produces the following error:

=== ------------------------------------------------------ ===
=== Scrivomatic V1.0.25 Report @ 2019-12-02 14:17:34 +0100 ===
=== ------------------------------------------------------ ===
 Running under Ruby 2.3.7
 Working directory: /Users/htv/Desktop/BIO_285_notes.md
===------ Input Options: ------===
#<struct Scrivomatic::OPT input="BIO_285_notes.md", output=nil, to=nil, yaml=nil, command="pandocomatic", envpath="/Users/htv/bin:/Users/htv/.rbenv/shims:/Library/TeX/texbin:/usr/local/bin:/Users/htv/.local/bin", build=false, cleanup=false, verbose=true, dry_run=false, open_log=true, data_dir=nil>
===------ Final ENV PATH: ------===
/Users/htv/bin:/Users/htv/.rbenv/shims:/Library/TeX/texbin:/usr/local/bin:/Users/htv/.local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
===------ TOOL PATHS: ------===
---pandoc: /usr/local/bin/pandoc | V: 2.7.2
---pandocomatic: /Users/htv/.rbenv/shims/pandocomatic | V: 
---ruby: /Users/htv/.rbenv/shims/ruby | V: ruby 2.6.2p47 (2019-03-13 revision 67232) [x86_64-darwin18]
---rbenv: /usr/local/bin/rbenv
---python: /usr/local/bin/python
---xelatex: /Library/TeX/texbin/xelatex
---latexmk: /Library/TeX/texbin/latexmk

 … running pandocomatic, please wait …
===------ COMMAND OUTPUT: ------===
:: Running: /Users/htv/.rbenv/shims/pandocomatic --debug BIO_285_notes.md 
::: (4) + converting /Users/htv/Desktop/BIO_285_notes.md/BIO_285_notes.md 3 times:
::: (3)   - convert BIO_285_notes.md -> BIO_285_notes.docx
::: pandoc	--from=markdown \
::: 	--to=docx \
::: 	--standalone \
::: 	--filter=/Users/htv/.local/share/pandoc/filters/removeHR \
::: 	--filter=/Users/htv/.local/share/pandoc/filters/simplifyMetadata \
::: 	--filter=/Users/htv/.local/share/pandoc/filters/prependAbstract \
::: 	--filter=/Users/htv/.local/share/pandoc/filters/prependAll \
::: 	--reference-doc=/Users/htv/.local/share/pandoc/templates/MyManuscriptReference.docx \
::: 	--output=/Users/htv/Desktop/BIO_285_notes.md/BIO_285_notes.docx
::: (2)   - convert BIO_285_notes.md -> BIO_285_notes.pdf
::: pandoc	--to=latex \
::: 	--pdf-engine=lualatex \
::: 	--standalone \
::: 	--filter=/usr/local/bin/pandoc-citeproc \
::: 	--filter=/Users/htv/.local/share/pandoc/filters/assimilateMetadata \
::: 	--bibliography=/Users/htv/switchdrive/COCB_Review/Literature/COCB_Review.json \
::: 	--csl=/Users/htv/.local/share/pandoc/csl/current-opinion.csl \
::: 	--from=markdown \
::: 	--template=/Users/htv/.local/share/pandoc/templates/custom.latex \
::: 	--base-header-level=2 \
::: 	--output=/Users/htv/Desktop/BIO_285_notes.md/BIO_285_notes.pdf
::: [WARNING] Missing character: There is no ⇒ (U+21D2) in font Palatino:mode=node;+tlig;!
::: [WARNING] Missing character: There is no ⇒ (U+21D2) in font Palatino:mode=node;+tlig;!
::: Script does not exist: ''.
:: exit status: pid 6348 exit 243

!!!---scrivomatic::runCommand() RETURN non-zero value: /Users/htv/.rbenv/shims/pandocomatic --debug BIO_285_notes.md !!!

If I produce the PDF via the latex template it works fine.
Do you have any idea what the problem is?

Thanks!

Pandocomatic unable to load config file

Hi, I'm not sure if this is a scrivomatic or pandocomatic issue but wanted to check with you.

I get the following error Unable to load config file: '/Users/bryanwest/.local/share/pandoc/pandocomatic.yaml'. :: exit status: pid 94975 exit 243 whether I run scrivomatic from Scrivener, the command line, or call pandocomatic directly from the command line. The directory /Users/bryanwest/.local/share/pandoc/ exists and is the location of pandocomatic.yaml, and I have set chmod 777 -R for the directory, so there shouldn't be permission issues.

I am able to compile your Workflow.scriv example in a local directory.

Logfile and YAML metadata used:

=== ------------------------------------------------------ ===
=== Scrivomatic V1.0.29 Report @ 2020-05-26 16:47:52 -0400 ===
=== ------------------------------------------------------ ===
 Working directory: /Users/bryanwest/Desktop/compile-mmd
 Initiating with Ruby 2.3.7
===------ Input Options: ------===
#<struct Scrivomatic::OPT input="test.mmd", output=nil, to=nil, yaml=nil, command="pandocomatic", envpath="/Users/bryanwest/bin:/Users/bryanwest/.rbenv/shims:/usr/local/lib/ruby/gems/2.7.0/bin:/Library/TeX/texbin:/usr/local/bin", build=false, cleanup=false, verbose=true, dry_run=false, open_log=true, data_dir=nil>
===------ Final ENV PATH: ------===
/Users/bryanwest/bin:/Users/bryanwest/.rbenv/shims:/usr/local/lib/ruby/gems/2.7.0/bin:/Library/TeX/texbin:/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.9.2.1
---pandocomatic: /Users/bryanwest/.rbenv/shims/pandocomatic | V: 
---ruby: /Users/bryanwest/.rbenv/shims/ruby | V: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin18]
---rbenv versions:
  system
* 2.7.1 (set by /Users/bryanwest/.rbenv/version)
---rbenv: /usr/local/bin/rbenv
---gem: /Users/bryanwest/.rbenv/shims/gem
---python: /usr/bin/python
---xelatex: /Library/TeX/texbin/xelatex
---latexmk: /usr/local/bin/latexmk

 … running pandocomatic, please wait …
===------ COMMAND OUTPUT: ------===
:: Running: /Users/bryanwest/.rbenv/shims/pandocomatic --debug test.mmd 
::: Unable to load config file: '/Users/bryanwest/.local/share/pandoc/pandocomatic.yaml'.
:: exit status: pid 94975 exit 243

!!!---scrivomatic::runCommand() RETURN non-zero value: /Users/bryanwest/.rbenv/shims/pandocomatic --debug test.mmd !!!

File I'm attempting to compile is using this YAML metadata:

---
# YAML Header
title: "<$projecttitle>"
subtitle: “<$abbr_projecttitle>”
author:
  - name: My Name
  - affiliation: 1
    correspondence: [email protected]
institute:
  - ^1^ Affiliation
keywords:
  - test1
  - test2
  - test3
abstract: Abstract text here.
wordcount: <$wc>
date: <$fulldate>
created: "<$createdDate>"
compiled: "<$shortdate>"
pandocomatic_:
  use-template: 
    - latex-scholar
---

Scrivomatic not finding tools in path

Hi,

first of all, tnx for this workflow. It's impressive and I really hope to make this working to me, as it would be totally mindchanging :)

I'm using your compile preset to use Scrivomatic but when I compile a script it seems it won't find the tools.

Have a look to this log as an example:

=== ------------------------------------------------------ ===
=== Scrivomatic V1.0.27 Report @ 2020-04-21 12:09:20 +0200 ===
=== ------------------------------------------------------ ===
 Working directory: ###############/Tutorial.md
 Initiating with Ruby 2.3.7
===------ Input Options: ------===
#<struct Scrivomatic::OPT input="Tutorial.md", output=nil, to=nil, yaml=nil, command="pandocomatic", envpath="###############/bin:/Library/TeX/texbin:/usr/local/bin", build=false, cleanup=false, verbose=true, dry_run=false, open_log=true, data_dir=nil>
===------ Final ENV PATH: ------===
###############/bin:/Library/TeX/texbin:/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.9.2.1
---pandocomatic:  | V: 
---ruby: /usr/bin/ruby | V: ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin17]
!--old ruby incompatible with newer pandocomatic, see https://github.com/iandol/scrivomatic/blob/master/Installing-Ruby.md
---rbenv: /usr/local/bin/rbenv
---python: /usr/local/bin/python
---xelatex: /Library/TeX/texbin/xelatex
---latexmk: /Library/TeX/texbin/latexmk

 … running pandocomatic, please wait …
===------ COMMAND OUTPUT: ------===
Tool doesn't exist!!!

!!!---scrivomatic::runCommand() Couldn't find  to run, please supply a proper path!
  1. the ruby interpreter used is the system one, but I'm using an updated one coming from homebrew and located at /usr/local/opt/ruby/bin/ruby

  2. pandocomatic was installed as a gem in /usr/local/lib/ruby/gems/2.7.0/bin/pandocomatic.

Both are in the path in .bash_profle, but they don't seem to be in ENV PATH in Scrivomatic

Any idea?

scrivomatic / pandocomatic problems after upgrade

Hi everyone. I have the following problem.

After upgrading to pandocomatic 0.2.5.0 my documents are not converted anymore. I followed all the general instructions here and the instructions to install ruby 2.6.2 via rbenv here. I migrated my pandoc data folder from ~/.pandoc to ~/.local/share/pandoc. Although all components seem to be in the right place my scrivener documents are not converted anymore. It seems that pandocomatic doesn't take the input.

Screenshot 2019-04-09 at 17 15 08

Interestingly, the Workflow.scriv works without any problems.

Screenshot 2019-04-09 at 17 16 34

Does anyone have an idea what I'm missing here? Thanks for any kind of help!

Character style vs. character format

When I compile to pandoc markdown using scrivomatic, none of the text I've italicized in my document is prefixed/suffixed with *. It seems like this comes down to a difference between character format (i.e. hitting cmd-i to italicize text), and character styles (i.e. selecting "emphasis" from the styles pane). Scrivomatic will only add prefixes/suffixes to the latter. But it is infinitely most intuitive while writing to hit cmd-i rather than stopping to highlight text, select the styles pane, and click "emphasis."

Another reason for the importance of converting character formats to pandoc markdown is that character styles cannot be selected when editing Scrivener footnotes. So, there is no way to italicize footnote text in scrivomatic's markdown output.

So, is there a way to pass character formats through any of these Scrivener compile filters?

I'm running into errors when I try to compile - log file pasted into the comment - thoughts?

=== ------------------------------------------------------ ===
=== Scrivomatic V1.0.29 Report @ 2020-10-26 16:55:28 -0400 ===
=== ------------------------------------------------------ ===
Working directory: /Users/tposen/Desktop/workflow-mmd
Initiating with Ruby 2.6.3
===------ Input Options: ------===
#<struct Scrivomatic::OPT input="Workflow.md", output=nil, to=nil, yaml="pandocomatic.yaml", command="pandocomatic", envpath="/Users/tposen/bin:/usr/local/bin", build=false, cleanup=false, verbose=true, dry_run=false, open_log=true, data_dir=nil>
===------ Final ENV PATH: ------===
/Users/tposen/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
===------ TOOL PATHS: ------===
---pandoc: /usr/local/bin/pandoc | V: 2.9.2.1
---pandocomatic: /usr/local/bin/pandocomatic | V: 0.2.7.3
---ruby: /usr/bin/ruby | V: ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
---rbenv versions:
---gem: /usr/bin/gem
---python: /usr/bin/python

… running pandocomatic, please wait …
===------ COMMAND OUTPUT: ------===
:: Running: /usr/local/bin/pandocomatic -c pandocomatic.yaml --debug Workflow.md
::: (5) + converting /Users/tposen/Desktop/workflow-mmd/Workflow.md 4 times:
::: (4) - convert Workflow.md -> Workflow.tex
::: pandoc --from=markdown
::: --to=latex
::: --template=custom.latex
::: --toc
::: --toc-depth=4
::: --filter=assimilateMetadata.rb
::: --standalone
::: --bibliography=workflow.bib
::: --csl=apa-workflow.csl
::: /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter/attr.rb:48:in []': odd number of arguments for Hash (ArgumentError) ::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter/attr.rb:48:in initialize'
::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter/table.rb:56:in new' ::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter/table.rb:56:in initialize'
::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter/node.rb:119:in new' ::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter/node.rb:119:in block in initialize'
::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter/node.rb:117:in each' ::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter/node.rb:117:in initialize'
::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter/document.rb:118:in initialize' ::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter/document.rb:85:in new'
::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter/document.rb:85:in from_JSON' ::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter.rb:336:in read_document'
::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter.rb:277:in filter' ::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter.rb:251:in run'
::: from ./assimilateMetadata.rb:74:in <main>' ::: Error running filter assimilateMetadata.rb: ::: Filter returned error status 1 ::: Error running pandoc => error while running: ::: ::: pandoc --from=markdown \ ::: --to=latex \ ::: --template=custom.latex \ ::: --toc \ ::: --toc-depth=4 \ ::: --filter=assimilateMetadata.rb \ ::: --standalone \ ::: --bibliography=workflow.bib \ ::: --csl=apa-workflow.csl ::: ::: Pandoc responded with: ::: ::: /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter/attr.rb:48:in []': odd number of arguments for Hash (ArgumentError)
::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter/attr.rb:48:in initialize' ::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter/table.rb:56:in new'
::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter/table.rb:56:in initialize' ::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter/node.rb:119:in new'
::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter/node.rb:119:in block in initialize' ::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter/node.rb:117:in each'
::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter/node.rb:117:in initialize' ::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter/document.rb:118:in initialize'
::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter/document.rb:85:in new' ::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter/document.rb:85:in from_JSON'
::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter.rb:336:in read_document' ::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter.rb:277:in filter'
::: from /Library/Ruby/Gems/2.6.0/gems/paru-0.4.2/lib/paru/filter.rb:251:in run' ::: from ./assimilateMetadata.rb:74:in

'
::: Error running filter assimilateMetadata.rb:
::: Filter returned error status 1
:::
:: exit status: pid 10953 exit 243

!!!---scrivomatic::runCommand() RETURN non-zero value: /usr/local/bin/pandocomatic -c pandocomatic.yaml --debug Workflow.md !!!

Incorrect version of Ruby Called?

My log output is stating that it's using system Ruby, though I installed latest version using rbenv. Hard to tell if scrivomatic is actually using the system Ruby, or just a reference to it in the log output, because it appears to complete just fine, which shouldn't be the case using 2.3.7, right?

Here's the output:

=== ------------------------------------------------------ ===
=== Scrivomatic V1.0.25 Report @ 2019-04-02 19:06:24 -0700 ===
=== ------------------------------------------------------ ===
 Running under Ruby 2.3.7
 Working directory: /Users/XXXXXXXXX/Library/Mobile Documents/com~apple~CloudDocs/FOLDERNAME
===------ Input Options: ------===
#<struct Scrivomatic::OPT input="DOCUMENT.md", output=nil, to=nil, yaml=nil, command="pandocomatic", envpath="/Users/XXXXXXXXX/bin:/Users/XXXXXXXXX/.rbenv/shims:/usr/local/bin", build=false, cleanup=false, verbose=true, dry_run=false, open_log=true, data_dir=nil>
===------ Final ENV PATH: ------===
/Users/XXXXXXXXX/bin:/Users/XXXXXXXXX/.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.1
---pandocomatic: /Users/XXXXXXXXX/.rbenv/shims/pandocomatic | V: Pandocomatic version 0.2.4.0
---ruby: /Users/XXXXXXXXX/.rbenv/shims/ruby | V: ruby 2.6.2p47 (2019-03-13 revision 67232) [x86_64-darwin17]
---rbenv: /usr/local/bin/rbenv
---python: /usr/local/bin/python

 … running pandocomatic, please wait …
===------ COMMAND OUTPUT: ------===
:: Running: /Users/XXXXXXXXX/.rbenv/shims/pandocomatic --debug DOCUMENT.md 
::: pandoc	
::: Pandocomatic needed 0.1 seconds to convert 'DOCUMENT.md'.
:: exit status: pid 1107 exit 0

This is on 10.13.6. iTerm is my main terminal, and just to make it a little more difficult, I'm using Fish for my system shell.

Thanks for all the work on Scrivomatic, this is really great!

Scrivener workflow example fails

Hi

Using your example Scrivener workflow, I'm having some problems. I've pasted the scrivener.log below. I'm afraid my knowledge of all this is very limited, so I'm not sure where to start.

From the scrivener.log, I see a couple of problems

::: The pandoc option 'reference_doc' (with value 'custom.docx') is not recognized by paru. This option is skipped.

and

::: pandoc: Error running filter authorSimplifyMetadata.rb
::: fd:3: hPutBuf: resource vanished (Broken pipe)
::: Error running pandoc => error while running:

On this second error: if I comment out the authorSimplifyMetadata.rb line in pandocomatic.yaml, I then get the same error in relation to prependall.rb. If I comment out them both, then the output files are generated with no apparent problems.

Any tips on what I'm doing wrong would be appreciated.

Kevin

=== ------------------------------------------------------ ===
=== Scrivomatic V1.0.16 Report @ 2018-04-21 21:01:28 +0100 ===
=== ------------------------------------------------------ ===
Running under Ruby 2.3.3
Working directory: /Users/kevin/Desktop/workflow_mmd
===------ Input Options: ------===
#<struct Scrivomatic::OPT input="workflow", output=nil, to=nil, yaml="pandocomatic.yaml", command="pandocomatic", envpath="/Users/kevin/.rbenv/shims:/Users/kevin/anaconda3/bin:/Library/TeX/texbin:/Users/kevin/bin:/usr/local/bin", build=false, verbose=true, dry_run=false, open_log=false>
===------ Final ENV PATH: ------===
/Users/kevin/.rbenv/shims:/Users/kevin/anaconda3/bin:/Library/TeX/texbin:/Users/kevin/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
===------ TOOL PATHS: ------===
---pandoc: /Users/kevin/anaconda3/bin/pandoc | V: 1.19.2.1
---pandocomatic: /usr/local/bin/pandocomatic | V: Pandocomatic version 0.2.2.1
---ruby: /Users/kevin/.rbenv/shims/ruby | V: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin17]
---rbenv: /usr/local/bin/rbenv
---python: /Users/kevin/anaconda3/bin/python
---xelatex: /Library/TeX/texbin/xelatex

… running pandocomatic, please wait …
===------ COMMAND OUTPUT: ------===
:: Running: /usr/local/bin/pandocomatic -c pandocomatic.yaml --debug workflow
::: The pandoc option 'reference_doc' (with value 'custom.docx') is not recognized by paru. This option is skipped.
::: (4) + converting workflow 3 times:
::: (3) - convert workflow -> workflow.docx
::: pandoc --from=markdown
::: --to=docx
::: --filter=authorSimplifyMetadata.rb
::: --filter=prependAll.rb
::: --standalone
::: --bibliography=workflow.bib
::: --csl=apa-workflow.csl
::: --output=/Users/kevin/Desktop/workflow_mmd/workflow.docx
::: pandoc: Error running filter authorSimplifyMetadata.rb
::: fd:3: hPutBuf: resource vanished (Broken pipe)
::: Error running pandoc => error while running:
:::
::: pandoc --from=markdown
::: --to=docx
::: --filter=authorSimplifyMetadata.rb
::: --filter=prependAll.rb
::: --standalone
::: --bibliography=workflow.bib
::: --csl=apa-workflow.csl
::: --output=/Users/kevin/Desktop/workflow_mmd/workflow.docx
:::
::: Pandoc responded with:
:::
::: pandoc: Error running filter authorSimplifyMetadata.rb
::: fd:3: hPutBuf: resource vanished (Broken pipe)
:::
:: exit status: pid 25102 exit 243

!!!---scrivomatic::runCommand() RETURN non-zero value: /usr/local/bin/pandocomatic -c pandocomatic.yaml --debug workflow !!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.