-
Notifications
You must be signed in to change notification settings - Fork 22
feat: Added possibility for shared numbering of theorems, fixing issue #64 #161
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
base: main
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
|
@Ljon4ik4 : Thank you for contributing. If I read #64 correctly, this PR does it slightly different compared to what the original issue creator intended. As far as I can deduce from the original issue, the request was that you could "group" the numbering of certain admonitions of this extension, where you could have several different groups sharing the numbering. Am I correct that your suggestions groups them all together? |
|
@douden Oh yes, sorry - I did not read the issue precisely, you are absolutely right. |
|
I looked at your code, and because of the manner you implemented it, I think it could be doable to have the grouped numbering. Currently I would say that we could reuse the config value you introduced, and if it is a dictionary, you could map each given key to it's corresponding value, where key is the real type and the value is the counter type. I think that line 42 is the location to expand/adapt for this. Are you willing to add this functionality? |
|
Yes, thanks a lot - I think that should be possible! |
Also thanks to you! Let me know when you changed it, I will then review. |
for more information, see https://pre-commit.ci
|
@douden , in the end it was simpler to just pass a dictionary in any case, and just set the dictionary to have a constant value "theorem" for uniform numbering. I think it is built in now... |
|
Although I agree with the idea of only using a dictionary, the default behavior of the extension now would significantly change. I think the best would be to
This would allow a user in the conf.py/_config.yml to indicate only which directives should be using a different counter, while all others are untouched. So if in the config a user sets The directives |
for more information, see https://pre-commit.ci
|
Ah, that's a very good idea! |
This PR is an attempt to resolve issue #64 .
This is done by adding a configuration variable
proof_uniform_numbering. When it is set to true all numbered proof environments share a counter.under the hood I have split the
typeparameter of the node into who parameters,countertypeandrealtye.In the default setting, those two agree.
When
proof_uniform_numbering = Trueis set inconf.py, then thecountertypeof all objects istheorem, i.e. they all share the same counter.pytestseems to pass, and the uniformly numbered version seems to work fine on the docs.However, I don't really know how to write python tests, so I could not add tests for the new version.