GithubHelp home page GithubHelp logo

dialoa / statement Goto Github PK

View Code? Open in Web Editor NEW
14.0 2.0 1.0 1.84 MB

Statement - theorems and statement support in Pandoc's markdown

Home Page: https://dialoa.github.io/statement/

License: MIT License

Makefile 0.82% Lua 99.18%
amsthm html jats-xml latex pandoc pandoc-filter theorems jats-statement markdown

statement's People

Contributors

jdutant avatar twsh avatar

Stargazers

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

Watchers

 avatar  avatar

Forkers

twsh

statement's Issues

Cite cross different html files

Hi, I'm using pandoc to convert a folder of markdown files to HTML, with each markdown to one HTML.
How can I refer to a statement in a different markdown file?

For example, in file A.md, I have a statement like

::: {.theorem #einstein}
Einstein
:::

And in file B.md, I want to cite the theorem as

See @Pre:einstein.

If the output is a standalone big HTML, then the above way works. But if there are many generated HTML files, the link in B.html to the theorem is broken. How can I fix this?

Make label-based kind recognition case-insensitive

At present localized labels are recognized:

Théorème
: La somme des angles d'un triangle est égale à deux droits.

But in a case-sensitive manner. In English kind recognition appears capitalization-insensitive because both Theorem (the label) and thereom (the internal kind name) are recognized. This will be confusing to users; better make label recognition case-insensitive.

Add controls for shorthand

Each (document-level) theorem kind should have a shorthand option that allows the user to enter theroem of that kind via a shorthand. Use cases:

  • a user could specify that statements of a certain kinds are jokes and enter them as follows:
::: joke
Decimals have a point.
:::
  • perhaps some users may want to use our predefined styles but deactivate their shortands, so that the following isn't interpreted as a mathematical proposition?
::: proposition
Decimals have a point.
:::

But that at the same time they could still write:

::: {.statement kind=proposition}
Substracting the same from the same yields the same.
:::

Proposal: add a property shorthand to statement kinds. Question: should that be a switch (yes / no, and the shorthand is the kind name?) or a string (so that user could set up jk as a shorthand for joke)?

I favour the switch.

Default metadata should be combined with user-provided value

Suppose a user partially specify some properties of a default kind. E.g. their metadata block contains something like:

statement-filter:
  kinds:
    lemma: 
       counter: lemma

The most natural interpretation is that they want to override that property of the defaults, but keep the defaults as is otherwise. So we should still fill in the lemma kind with its style etc.

Solution: when the filter provides defaults it should do so by adding to existing properties. So:

  1. If the properties are stored in a local filter variable rather than the pandoc document metadata, read the properties in the doc's metadatablock first.
  2. Add the default properties, by checking each time that they're not set: if kinds.property = nil then ....

Unless of course the user as set to true the switch that blocks the filter from setting any default.

Use theorem styles

It is probably wiser to follow the LaTeX approach of using theorem styles. LaTeX defines three theorem styles (plain, definition and remark) that are typeset differently. This allows specifying a unique style for many theorems.

Proposed addition to the object model:

statement-filter:
  kinds:
     theorem: 
       - ...
       - style: plain
    ...
  styles:
     plain: [style specification]

The question is how the user provides the style specification: in a format-independent way (makes it difficult to provide a fine control of the margins or PDF-specific behaviour), or by format-specific code.

Changing label of theorem not working

Hi, Thank you for developing this filter, it helped me a lot. I'm having trouble with using my custom labels for the theorem environment.

Below is my metadata yaml config:

statement-filter:
  kinds:
    theorem:
      - label: "定理"
      - counter: "theorem"
      - prefix: thm  # ref to theorem with `@thm:
    lemma:
      - label: "Lemma"
      - counter: "lemma"
      - prefix: lem

Here I changed the default label Theorem to 定理 (theorem in Mandarin).

In my markdown file, I tested it with an example:

::: theorem
Here is a test
:::

But I still got Theorem (in HTML output) as the rendered label:

image

Also, the counter "lemma" seems not working as expected, it increases with the "theorem" counter:
图片

May I ask what's wrong here?

All counters reset with the same level: default but allow override?

We typically want all statements numbering to reset at the same level. If theorems numbering rests at each chapter, then axioms and definitions should too. That's a good default.

But perhaps not something we should make mandatory. Here's an idea of a book: Ten Principles of Mathematical Problem Solving. The book has several chapters, with theorems, definitions etc, whose numbering is best reset at each chapter (Theorem 2.1, etc). But the eponymous Principles need to be numbered continously throughout the book: Principle 1, Principle 2, etc.

All we need to allow that is to provide a statement-kind-level option for resetting counters:

statement-filter:
  kinds: 
    principle:
       counter: pple
       reset-counter-with-level: 0

What if two kinds share a counter and the user specifies a reset-with-level value for only one of them? Then assume that the counters rest with that level.

What if two statement kinds share a counter but the user specifies reset-with-level properties? Then apply the last you happen to process and throw a warning ("Duplicate and conflicting reset-counter-with-level values for counter ").

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.