Skip to content

Exercise group intro/conclusion spacing#2964

Open
ascholerChemeketa wants to merge 2 commits into
PreTeXtBook:masterfrom
ascholerChemeketa:intro-exgroup-space
Open

Exercise group intro/conclusion spacing#2964
ascholerChemeketa wants to merge 2 commits into
PreTeXtBook:masterfrom
ascholerChemeketa:intro-exgroup-space

Conversation

@ascholerChemeketa

Copy link
Copy Markdown
Contributor

Addresses spacing issues identified by @jjrsylvestre in exercise group intro/conclusions.

I'm not sure the horizontal indent on conclusion makes sense, feels like it should match the intro, not the exercises, but that is what was there historically.

@rbeezer

rbeezer commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

For PDF (since I was just doing it) we only indent the exercise themselves.

To keep the two PDF conversions in-sync, I have just started an area in pretext-common.xsl with "Distances and Colors". Don't know if you want to mine that or not? No colors yet, "Sage blue" might be the first. (I think this has been pushed!)

@ascholerChemeketa

Copy link
Copy Markdown
Contributor Author

Removed the conclusion indent to match PDF and force pushed.

Leaving exercise indentation as is for now.

@rbeezer

rbeezer commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

All CSS, so I will ask @oscarlevin to handle this one. Also, I don't know enough to follow Claude's reservations. Posting that next.

@rbeezer rbeezer requested a review from oscarlevin June 30, 2026 21:18
@rbeezer

rbeezer commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

The exercisegroup spacing problem is real and the fix works for it, but two of the three CSS changes reach well beyond exercise groups — worth a look before merge.

1. .introduction/.conclusion in _spacing.scss is document-wide, and it wins the cascade. Both intro/conclusion templates set the class from local-name(), so class="introduction" lands on every division intro too — <section class="introduction">, not just the exercisegroup <div class="introduction">. The edited rule (specificity (0,3,0)) beats the high-level :is(section, article, …) > * rule ((0,1,1)) within the same @layer, so every chapter/section introduction and conclusion drops from 1.5em to 0.5em inter-item spacing. The sample article alone has ~10 multi-paragraph section introductions that this re-spaces. The exercisegroup case genuinely needs the fix (those <div> intros matched nothing in the spacing layer), but scoping it — e.g. .exercisegroup .introduction, .exercisegroup .conclusion — would keep it off the division <section> intros.

2. .exercise-like > *:not(:first-child) { margin-top: 1em } is also global. It is at the top level of _exercises.scss (not under .exercisegroup) and outside @layer, so it overrides the layered 1.5em for every exercise — intra-exercise spacing (statement/hint/answer/solution) tightens to 1em document-wide. Reads as intended, just confirming that is the goal and not meant to be exercisegroup-only.

3. Dropping the conclusion margin-left: 40px — agreed. Flush-left intro and conclusion bracketing the indented exercises is a cleaner hierarchy than the historical indent; your instinct in the description is right.

Minor: _spacing.scss still has no trailing newline; sample-article test cases read clean.

Net: #3 is good; #1 and #2 work for exercisegroups but currently apply to the whole document, and #1 in particular silently re-spaces all division introductions via specificity — worth either scoping or making an explicit, tested decision.

Claude Opus 4.8, acting as a review assistant for Rob Beezer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants