tomduck / pandoc-eqnos

A pandoc filter for numbering equations and equation references.
GNU General Public License v3.0
220 stars 27 forks source link

How and where do I include the filter `pandoc-eqnos` in a default file #56

Closed kleinbottle closed 3 years ago

kleinbottle commented 3 years ago

I used to invoke pandoc-eqnos as a command line filter and it worked..

Now, I am using a default file with YAML metadata/variables following the example on the Pandoc Manual page.

I am also using citeproc.

How exactly do I invoke both pandoc-eqnos and citeproc in my default file?

I have tried this

filters:
- pandoc-eqnos
- citeproc

and I get an error that goes away if I delete the - pandoc-eqnos line.

I am using pandoc 2.11.0.4 Compiled with pandoc-types 1.22, texmath 0.12.0.3, skylighting 0.10, citeproc 0.1.1, ipynb 0.1.0.1

Thanks.

tomduck commented 3 years ago

Hi, @kleinbottle. Thanks for your report. The following test works for me. Can you give it a try? Cheers, Tom.

demo.md:

---
title: Test
eqnos-cleveref: True
xnos-capitalise: True
references:
- type: article-journal
  id: WatsonCrick1953
  author:
  - family: Watson
    given: J. D.
  - family: Crick
    given: F. H. C.
  issued:
    date-parts:
    - - 1953
      - 4
      - 25
  title: 'Molecular structure of nucleic acids: a structure for
    deoxyribose nucleic acid'
  title-short: Molecular structure of nucleic acids
  container-title: Nature
  volume: 171
  issue: 4356
  page: 737-738
  DOI: 10.1038/171737a0
  URL: https://www.nature.com/articles/171737a0
  language: en-GB
...

$$ y = mx + b $${#eq:1}

Ref. to @eq:1.  Ref. to @WatsonCrick1953.

defaults.yaml:

filters:
- pandoc-eqnos
- citeproc

pandoc command:

 pandoc demo.md -d defaults -o demo.pdf
kleinbottle commented 3 years ago

https://github.com/tomduck/pandoc-eqnos/issues/56#issuecomment-735498334

Thanks @tomduck.

Your demo file works.

I use a .bib file and that works too.

I now have three questions.

  1. Where, in my defaults.yaml file, may I include the declarations:
eqnos-cleveref: True
xnos-capitalise: True

Since these are standard, I want to keep them in a defaults file.

  1. Do I need to install pandoc-xnos as well?

  2. There is terminal output when I compile with pandoc. Is this intentional as some sort of explanatory message/warning? If I am doing script-based compilation, do I need to suppress this output? See below for what I get:

pandoc-eqnos: Wrote the following blocks to header-includes.  If you
use pandoc's --include-in-header option then you will need to manually
include these yourself.

<!-- pandoc-eqnos: equation style -->
    <style>
      .eqnos { display: inline-block; position: relative; width: 100%; }
      .eqnos br { display: none; }
      .eqnos-number { position: absolute; right: 0em; top: 50%; line-height: 0; }
    </style>

Thanks.

tomduck commented 3 years ago
  1. Where, in my defaults.yaml file, may I include the declarations:
eqnos-cleveref: True
xnos-capitalise: True

Since these are standard, I want to keep them in a defaults file.

You can write the following into your defaults file:

variables:
  eqnos-cleveref: True
  xnos-capitalise: True
filters:
- pandoc-eqnos
- citeproc
  1. Do I need to install pandoc-xnos as well?

No. Pandoc-xnos is a dependency of pandoc-eqnos, and as such you will find that it is already installed.

  1. There is terminal output when I compile with pandoc. Is this intentional as some sort of explanatory message/warning? If I am doing script-based compilation, do I need to suppress this output?

Yes, the warnings are intentional. I find that they provide helpful hints when things go wrong. I don't think that you will find that you need to suppress them, even for script-based compilation. However, if you want to suppress them you can set either the eqnos-warning-level or xnos-warning-level variable to 0.

Cheers, Tom

kleinbottle commented 3 years ago

Thank you. Everything works now. :-)

On 30/11/2020 19:57, Thomas J. Duck wrote:

 1. Where, in my |defaults.yaml| file, may I include the declarations:

|eqnos-cleveref: True xnos-capitalise: True |

Since these are standard, I want to keep them in a defaults file.

You can write the following into your defaults file:

|variables: eqnos-cleveref: True xnos-capitalise: True filters: - pandoc-eqnos - citeproc |

 2. Do I need to install |pandoc-xnos| as well?

No. Pandoc-xnos is a dependency of pandoc-eqnos, and as such you will find that it is already installed.

 3. There is terminal output when I compile with |pandoc|. Is this
    intentional as some sort of explanatory message/warning? If I am
    doing script-based compilation, do I need to suppress this output?

Yes, the warnings are intentional. I find that they provide helpful hints when things go wrong. I don't think that you will find that you need to suppress them, even for script-based compilation. However, if you want to suppress them you can set either the |eqnos-warning-level| or |xnos-warning-level| variable to |True|.

Cheers, Tom

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tomduck/pandoc-eqnos/issues/56#issuecomment-735817919, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABPGUXVJ7WPNG7EVSZNFN3SSOTTZANCNFSM4UGVG5SA.

tomduck commented 3 years ago

Wonderful. Enjoy! ☺︎ --Tom