[201_84]: Fix "Prefix by section number" not applying to Question/Answer#2845
Open
divyansharma001 wants to merge 1 commit intoMoganLab:mainfrom
Open
Conversation
Create question-env counter group with group-individual-counters to replace the broken individual-counter approach. Question and Answer now route through the proper display chain for section prefixing while keeping individual counters and remark rendering. Fixes MoganLab#2806
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where the "Prefix by section number" style option was not working for Question and Answer environments, while it worked correctly for other environments like Theorem and Proposition.
Changes:
- Created a new
question-envcounter group following the same pattern asexercise-env, with individual counters and proper section prefix support - Added a
new-questionmacro that uses the new counter group withrender-remarkfor consistent visual styling - Replaced the problematic
new-remark+individual-counterapproach with the newnew-questionmacro for Question and Answer environments
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| devel/201_84.md | Dev documentation explaining the root cause and fix approach |
| TeXmacs/packages/environment/env-base.ts | Added question-env counter group and new-question macro |
| TeXmacs/packages/environment/env-theorem.ts | Changed Question/Answer to use new-question instead of new-remark + individual-counter |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
LGTM |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #2806
Problem
The "Prefix by section number" style option works for Theorem and Proposition but not for Question and Answer.
Root Cause
In
env-theorem.ts, Question and Answer were created withnew-remark(adding them totheorem-env) and thenindividual-counterwas called. However,individual-counterreplacesdisplay-questionwith the raw identity function, breaking the display chain:After
individual-counter, the chain becomesdisplay-question → identity(nr), losing the section prefix entirely.Fix
question-envcounter group inenv-base.tsas a sub-group ofstd-envwithgroup-individual-counters(same pattern asexercise-env)new-questionmacro usingquestion-envfor counters andrender-remarkfor renderingnew-remark+individual-countertonew-questionThis preserves individual counters while maintaining the proper display chain for section prefixing.
How to Test
Dev doc:
devel/201_84.md