htdebeer / pandocomatic

Automate the use of pandoc

Home Page:https://heerdebeer.org/Software/markdown/pandocomatic/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Only some options in pandocomatic.yaml work

lyndondrake opened this issue · comments

With the following pandocomatic.yaml file, the LaTeX-specific options don't seem to get passed through to pandoc - or at least, they don't appear to have any effect on the tex file produced. If I copy and past the same YAML options into the top of the .md file, they take effect:

templates:
  general:
    pandoc:
      to: latex
      bibliography: /Users/lyndon/Documents/Writing/Workflow/bibliography.bib
      papersize: a4
      mainfont: Skolar PE
      mainfontoptions: Ligatures=TeX, Numbers=OldStyle
      fontsize: 10pt
      lang: en-GB
      otherlangs: [grc, he, syr]
      pdf-engine: lualatex

  academic-article:
    extends: ['general']
    pandoc:
      standalone: true
      csl: /Users/lyndon/Documents/Writing/Workflow/csl-styles/society-of-biblical-literature-fullnote-bibliography.csl
      documentclass: article
      numbersections: true

This is the correct behavior. In the pandoc property only pandoc command-line options such as to and bibliography take effect. To set template variables, you either have to use a) the metadata property or b) the metadata command-line option.

Option a: use the metadata property

templates:
  general:
    pandoc:
      to: latex
      bibliography: /Users/lyndon/Documents/Writing/Workflow/bibliography.bib
      pdf-engine: lualatex
    metadata:
      papersize: a4
      mainfont: Skolar PE
      mainfontoptions: "Ligatures=TeX, Numbers=OldStyle"
      fontsize: 10pt
      lang: en-GB
      otherlangs: "[grc, he, syr]"

Option b: use metadata command line option in the pandoc property

templates:
  general:
    pandoc:
      to: latex
      bibliography: /Users/lyndon/Documents/Writing/Workflow/bibliography.bib
      metadata: 
      - "papersize: a4"
      - "mainfont: Skolar PE"
      - "mainfontoptions: Ligatures=TeX, Numbers=OldStyle"
      - "fontsize: 10pt"
      - "lang: en-GB"
      - "otherlangs: [grc, he, syr]"
      pdf-engine: lualatex

Personally I prefer option a because it more clearly separates the pandoc command-line options from the document's metadata.

Does this solve your issue?

Yes, it does solve things. My apologies — I'm guessing this is in the documentation, and actually I really like the separation of command-line and metadata options.

I do understand the confusion: when using pandocomatic you have metadata at the document level, at the pandoc-invocation level, and at the pandocomatic-template level. That's quite an overload of the metadata concept.

Anyway, good to hear the issue has been resolved.