-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New filter request: Theorem like environment #18
Comments
Hi Uwe. Thanks for this feedback. I'm not really sure what to do about it because pandoc doesn't currently support theorems. Pandoc-eqnos and friends add referencing to existing pandoc elements. |
Woukd it be possible to simply "duplicate" Eqnos, name it Theonos, and change "Equation" to "Theorem" in the YAML? (Same with the abbreviation). That way it would be possible to have, both, equation and theorem numbering and cross-referencing separate. |
How do you write theorems into markdown documents? |
In bookdown it's implemented this way (there are I think a wide range of ways to use theorems in terms of how long they are, how much text versus formulas etc) Very roughly it would be a numbered version (analogous to figures or equations) of using
that can be referred to as a theorem. |
That's an interesting idea, @jrennstich. The syntax you give above is how pandoc supports definition lists, and pandoc has a DefinitionList block element in its json format. I can imagine writing pandoc-defnos or some such thing. Below are some thoughts on a possible implementation. The first requirement would be to attach attributes to a definitions list. @jgm recommends using bracketed spans for this purpose (see also bracketed spans in the pandoc README). As such, the syntax would look something like
where References would look like I have already checked to see how pandoc processes the above markdown, and it is manageable. However, there would need to be some differences from the other pandoc-xnos filters. Where should the reference name come from? In pandoc-eqnos it comes from a yaml variable (with the sensible default of 'eq.'). I'm thinking for this it should come from what is in the square brackets, above. But what if people use different text in the brackets? i.e., maybe a document has a bunch of Finally, there would need to be a specialization for when Comments? |
Thanks for looking into this! Your proposed syntax would be exactly what I was looking for/would fit my needs and I believe would be flexible enough for the needs of others.
I fully agree. Would it be possible to work alone the lines of Perhaps it's possible to stick to the definitions of the LaTeX environment (also used in the Bookdown and theorem environment examples: theorem, lemma, definition, corollary, proposition, example, exercise. So, in For example:
Would produce Theorem 1 (Pythagorean theorem) For a right triangle, if whereas
Would produce Definition 1 The sum of all the somethings add to the something else. This would require, that if the text in the brackets would be scanned for the "type" of theorem (e.g., "theorem", "definition", etc.) and then would put the respective "type" into the numbering (as in the example above). Seems a bit complicated but workable, at least in min mind :-) Would it be possible to list in the YAML---again, analogous to the theorem environment--- also the theoremstyles (plain/definition/remark)? |
Addendum: Here's what I see as the key challenges to meet:
So after having returned from the walk in the woods with my dog I figured it would be perhaps best, not to differentiate in the pandoc-theoremnos
Types (used in
|
pandoc-theoremnos would be absolutely fantastic! |
What about proofs? Proofs does not require numbering, but such blocks are clearly useful.
One thing I do not like is that each block has to be closed, but this might change when side-marked syntax being reconsidered. |
@tomduck First of all, thanks a lot for the great work with your pandoc-*nos filters. I wrote a first version of a pandoc-theoremnos filter based on the ideas of @jrennstich. I'd be very happy to share this, would you like to set up a repository for that? |
FANTASTIC. I would be thrilled to see such a contribution made to the filter suite. ☺︎ How would you like to proceed? I can set up a repository as you suggest, but I also would be perfectly comfortable with it if you wanted to do so under your own account. |
I'd also be comfortable with both options. My first thought was that it would probably receive more attention and be less confusing for new users if it's under your account. I honestly don't have any preference, so, if you don't mind I'd suggest that you just create an empty repository and I open a pull request for my first version. |
Thanks, @ValiValpas. I just created an empty pandoc-theoremnos. Please go ahead and make a PR. I'm not married to this name. We can discuss it more once I have a sense of the range of things your new filter supports. In particular, I take from @chaoxu's comment that the new filter should be described as generally as possible. Again, thank you. It is exciting to receive such a contribution to the project. |
@tomduck, thank you very much. I'm quite busy at the moment and have not found the time yet to prepare the PR. I'll come back to this for sure, I just wanted to give a sign of life from my side. |
No worries, @ValiValpas. I completely understand. Thanks for your note. :o) Cheers, Tom |
@tomduck Could you please add an initial commit to the pandoc-theoremnos repository? Unfortunately, I cannot fork from an empty repository. |
@ValiValpas Done. |
Pandoc-theoremnos is now being developed on GitHub. Thanks to @ValiValpas for this wonderful contribution. |
Hi
pandoc-eqnos is a great leap forward in order to produce decent epub3 math documents, what I am missing right now, are theorem likes environments, its automatic enumeration and references.
any intention to include it?
thanks
Uwe Brauer
The text was updated successfully, but these errors were encountered: