-
Notifications
You must be signed in to change notification settings - Fork 65
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
✍️ LaTeX/JATS improvements for Proofs #694
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
'tex-to-myst': patch | ||
--- | ||
|
||
Add `algorithm` and `algorithmic` handlers for latex parsing | ||
|
||
- Figures: Environment centering | ||
- newtheorem in frontmatter is parsed | ||
- safely ignore `itemsep`, `setcounter`, `cmidrule` for now |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'myst-spec-ext': patch | ||
--- | ||
|
||
Add `Line` to myst-spec-ext |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'myst-to-jats': patch | ||
--- | ||
|
||
Add statements to JATS, count and number `statements` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
cases: | ||
- title: Proof | ||
tree: | ||
type: root | ||
children: | ||
- type: proof | ||
kind: algorithm | ||
label: alg:cap | ||
identifier: alg:cap | ||
enumerated: true | ||
enumerator: '1' | ||
children: | ||
- type: admonitionTitle | ||
children: | ||
- type: text | ||
value: An algorithm with caption | ||
- type: line | ||
indent: 1 | ||
enumerator: '1' | ||
children: | ||
- type: strong | ||
children: | ||
- type: text | ||
value: 'Require: ' | ||
- type: text | ||
value: 'alg' | ||
jats: '<statement specific-use="algorithm" id="alg:cap"><label>Algorithm 1</label><title>An algorithm with caption</title><p specific-use="line"><x>1: </x> <bold>Require: </bold>alg</p></statement>' |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fwkoch this is probably the most controversial change in the PR. I have added a new node of type
Line
which can have indentation and line numbers. This is to support the algorithm parsing, falling back to a div here is totally fine in the current theme.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, my only thoughts are:
Line
conflicts withline
in unist positions; maybe slightly confusing that it does not correspond to a "line" in the source. But that's probably ok? Not sure what else we'd call it,Step
? Meh - something more specific likeAgorithmLine
? (This would be similar toDefinitionTerm
which can be used in places other than just definitions.)indent
andenumerator
as optional attributes onParagraph
? We overload most of the other default node types with extra attributes. That would make fall-back behaviour more straightforward (just ignore the attributes)... I dunno, maybe then it feels like we are going down a path of "you can enumerate everything" which feels... complicated (as opposed to having intentionality about what may be enumerated).Overall, though, this is probably fine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did start there, adding attributes to paragraph, and went back and forth. I wanted the JAST to have a "specific-use" identifier and the UI to have a special style, and this seemed special enough for its own type. A div is also probably a more appropriate fallback based on style than a paragraph in this case?
At some point we should do an assessment of these types and do a clean up. I think that we can collapse a few things like
admonitionTitle
andproof
-->statement
perhaps.I changed this to
algorithmLine
based on your first point!