Skip to content

Fix broken cross-references and brace-protect bib title capitalization#877

Merged
d-morrison merged 4 commits into
mainfrom
chore/bib-caps-and-broken-xrefs
Jun 5, 2026
Merged

Fix broken cross-references and brace-protect bib title capitalization#877
d-morrison merged 4 commits into
mainfrom
chore/bib-caps-and-broken-xrefs

Conversation

@d-morrison

Copy link
Copy Markdown
Owner

Global cleanup split off from the count-regression work (per request to keep these separate from the per-chapter PRs).

Broken cross-references (from a whole-book audit)

Was Now Why
@sec-linreg-inference @sec-infer-LMs anchor never existed; sec-infer-LMs is the LM-inference section
intro-MLEs.qmd#sec-intro-MLEs (×2) added {#sec-intro-MLEs} to the intro-MLEs H1 page existed, anchor didn't
inference.qmd#sec-CI added {#sec-CI} to "Confidence intervals" page existed, anchor didn't
intro-bayes.qmd#sec-bayes bare intro-bayes.qmd no such anchor; link targets the chapter
count-regression.qmd#sec-count-reg bare count-regression.qmd no such anchor
OR-RR.qmd logistic-regression.qmd#sec-OR-RR root OR-RR.qmd is an orphan, never rendered

Bibliography capitalization

Brace-protected letters that must stay capitalized in sentence-case titles so sentence-case citation styles don't lowercase them: acronyms ({EM}, {SAS}, {SPSS}, {WinBUGS}), software/proper nouns ({R}, {BuCy2}, {Fisher}, {Bayesian}), and named studies ({Nurses' Health Study}, {Heart and Estrogen/progestin Replacement Study}, {Western Collaborative Group Study}, {Gaspe Peninsula}).

Not in this PR (handled on their own branches)

🤖 Generated with Claude Code

d-morrison and others added 2 commits June 3, 2026 12:57
Wrap letters that must stay capitalized in sentence-case titles so
sentence-case citation styles don't lowercase them:
- acronyms: {EM}, {SAS}, {SPSS}, {WinBUGS}
- software/proper nouns: {R} (mid-title), {BuCy2}, {Fisher}, {Bayesian}
- named studies: {Nurses' Health Study},
  {Heart and Estrogen/progestin Replacement Study},
  {Western Collaborative Group Study}, {Gaspe Peninsula}

(The hepatitis {C} fix in tsui2009hcv is on the count-regression PR branch,
where that entry lives.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
From a whole-book crossref audit:
- @sec-linreg-inference -> @sec-infer-LMs (the anchor was never defined;
  sec-infer-LMs is the LM-inference section).
- Add the named anchors the links expect: {#sec-intro-MLEs} on the
  intro-MLEs H1 and {#sec-CI} on the "Confidence intervals" heading, so
  intro-MLEs.qmd#sec-intro-MLEs (x2) and inference.qmd#sec-CI resolve.
- intro-bayes.qmd#sec-bayes -> bare intro-bayes.qmd (no such anchor; the
  link points at the chapter).
- count-regression.qmd#sec-count-reg -> bare count-regression.qmd (no such
  anchor).
- OR-RR.qmd (orphan, never rendered) -> logistic-regression.qmd#sec-OR-RR.

The count-regression poisson.qmd#def-offset link is handled on the
count-regression PR branch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
@claude

claude Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Claude finished @d-morrison's task in 2m 30s —— View job


Code Review

  • Gather diff and context
  • Verify cross-reference targets exist in the codebase
  • Review bibliography capitalization changes
  • Post final review

Cross-Reference Fixes ✅

All six cross-reference fixes are correct and verified:

Fix Verification
@sec-linreg-inference@sec-infer-LMs {#sec-infer-LMs} confirmed at chapters/Linear-models-overview.qmd:62
Added {#sec-intro-MLEs} to intro-MLEs.qmd Now at chapters/intro-MLEs.qmd:23; consumed by inference.qmd:31
Added {#sec-CI} to inference.qmd Now at chapters/inference.qmd:71
intro-bayes.qmd#sec-bayesintro-bayes.qmd {#sec-bayes} confirmed absent from intro-bayes.qmd; bare link is safe
count-regression.qmd#sec-count-regcount-regression.qmd {#sec-count-reg} confirmed absent from count-regression.qmd
OR-RR.qmdlogistic-regression.qmd#sec-OR-RR {#sec-OR-RR} defined in _subfiles/logistic-regression/_sec_odds_ratios.qmd:55, which is transitively included by logistic-regression.qmd via _sec_intro_bernoulli_models.qmd:36

Bibliography Capitalization — One Issue Found ⚠️

Most bib fixes look correct. However there is one oversight in kleinman2009sas:

references.bib, kleinman2009sas entry:

- and R: Data management, statistical analysis, and graphics},
+ and {R}: Data management, statistical analysis, and graphics},

SAS is the first word of the title — in BibTeX, only the very first character of a title is preserved in sentence-case conversion, so positions 2–3 (AS) would be lowercased, yielding Sas. The fix should be:

Compare with muenchen2011r in the same PR, which correctly writes {SAS} (mid-title). The same logic applies at the start of a title since only character position 1 is inherently protected.

All other bib protections are correct:

  • {Nurses' Health Study}, {Heart and Estrogen/progestin Replacement Study}, {Western Collaborative Group Study}, {Gaspe Peninsula} — named studies, all mid-title ✓
  • {EM}, {Fisher}, {BuCy2}, {WinBUGS}, {SPSS} — acronyms/proper nouns, all mid-title ✓
  • {Bayesian} in aragon2018population and statrethink2e — mid-title ✓
  • {Bayesian} in kery-bayes-pop not added — correct, since Bayesian opens that title and B is already protected as the first character ✓
  • {R} in kleinman2009sas — correct ✓
  • {SAS} and {SPSS} in muenchen2011r — correct ✓

Fix this →


Summary: All cross-reference fixes are verified correct. One small bib omission: SAS in kleinman2009sas should be {SAS} — it's the first word of the title but only its first character is auto-protected, so AS would be lowercased in sentence-case styles.

@d-morrison

Copy link
Copy Markdown
Owner Author

@claude please review — this fixes broken cross-references found in a whole-book audit and brace-protects capitalization in bib titles. Note cross-chapter crossref/link resolution is best confirmed against the rendered preview.

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

👀 Picked up by workflow run #26910001527. R/Quarto/renv setup runs first (~3-5 min); Claude itself responds after that.

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

I've reviewed all the changes. Here's my assessment:


Cross-references — all verified ✓

Change Verification
@sec-linreg-inference@sec-infer-LMs {#sec-infer-LMs} exists at chapters/Linear-models-overview.qmd:62
Added {#sec-intro-MLEs} to H1 Anchor now exists; inference.qmd#sec-intro-MLEs link resolves correctly
Added {#sec-CI} to "Confidence intervals" Anchor now exists
Stripped #sec-bayes from intro-bayes.qmd link Confirmed: no such anchor in intro-bayes.qmd
Stripped #sec-count-reg from count-regression.qmd link Confirmed: no such anchor in count-regression.qmd
OR-RR.qmdlogistic-regression.qmd#sec-OR-RR OR-RR.qmd doesn't exist in chapters/; sec-OR-RR is defined in _sec_odds_ratios.qmd, which is included via _sec_intro_bernoulli_models.qmdlogistic-regression.qmd

Bibliography capitalization — correct throughout

All braced terms are legitimate sentence-case hazards: acronyms ({EM}, {SAS}, {SPSS}, {WinBUGS}), proper nouns/software ({R}, {Fisher}, {Bayesian}, {BuCy2}), and named studies. The logic is consistent.

One minor gap to consider (non-blocking):

In kleinman2009sas, the PR braces {R} but leaves SAS unbraced at the start of the title:

title={SAS and {R}: Data management...}

In BibTeX sentence-case rendering, only the first character of the first word is preserved — so SAS would render as "Sas". Compare with muenchen2011r, where {SAS} is correctly braced mid-title. A follow-up could change this to {SAS} and {R}: for consistency. Not a regression (the original also had SAS unbraced), so this doesn't need to block the PR.

Changes look correct. Ready to merge.

— posted by @claude post-step from workflow run

@d-morrison

Copy link
Copy Markdown
Owner Author

@claude review

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

👀 Picked up by workflow run #26915836969. R/Quarto/renv setup runs first (~3-5 min); Claude itself responds after that.

@d-morrison

Copy link
Copy Markdown
Owner Author

Claude Code CLI (local session) is working on this — paws off until I'm done.

Only the first character of a title is auto-protected in BibTeX
sentence-case conversion, so AS would be lowercased to 'as'.
Wrap SAS in braces to preserve the acronym.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@d-morrison

Copy link
Copy Markdown
Owner Author

Addressed the one finding from the latest review: in kleinman2009sas, brace-protected SAS at the start of the title ({SAS}), since only the first character is auto-protected by BibTeX sentence-case conversion and AS would otherwise be lowercased. Pushed in 320b507; the pull_request review workflow will re-review on this push.

@claude

claude Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Claude finished @d-morrison's task in 2m 7s —— View job


Code Review — PR #877

  • Gather diff and context
  • Verify cross-reference fixes
  • Review bibliography capitalization changes (including the 320b507 SAS fix)
  • Post final review

Cross-Reference Fixes ✅

All six cross-reference fixes are correct and verified against the current branch:

Change Verification
@sec-linreg-inference@sec-infer-LMs {#sec-infer-LMs} exists at chapters/Linear-models-overview.qmd:62
Added {#sec-intro-MLEs} to intro-MLEs.qmd H1 Anchor now at chapters/intro-MLEs.qmd:23; consumed by inference.qmd:31
Added {#sec-CI} to "Confidence intervals" Anchor now at chapters/inference.qmd:71
Stripped #sec-bayes from intro-bayes.qmd link Confirmed: no {#sec-bayes} in intro-bayes.qmd — bare link is correct ✓
Stripped #sec-count-reg from count-regression.qmd link Confirmed: no {#sec-count-reg} in count-regression.qmd — bare link is correct ✓
OR-RR.qmdlogistic-regression.qmd#sec-OR-RR OR-RR.qmd absent from chapters/; {#sec-OR-RR} defined at _subfiles/logistic-regression/_sec_odds_ratios.qmd:55, transitively included via _sec_intro_bernoulli_models.qmd:36logistic-regression.qmd:37

Bibliography Capitalization ✅

All brace-protections are correct, including the kleinman2009sas SAS fix from 320b507:

Entry Change Rationale
Grodstein2001 {Nurses' Health Study} Named study, mid-title ✓
Vittinghoff2003 {Heart and Estrogen/progestin Replacement Study} Named study, mid-title ✓
mclachlan2007em {EM} Acronym, mid-title ✓
efron1978assessing {Fisher} Proper noun, mid-title ✓
anderson1935irises {Gaspe Peninsula} Place name, mid-title ✓
kleinman2009sas {SAS} and {R} {SAS} at title start (only first char auto-protected by BibTeX, so AS would otherwise lowercase); {R} mid-title ✓
rosenman1975coronary {Western Collaborative Group Study} Named study, mid-title ✓
copelan1991treatment {BuCy2} Proper noun, mid-title ✓
muenchen2011r {SAS} and {SPSS} Acronyms, mid-title ✓
aragon2018population {Bayesian} Proper adj., mid-title ✓
kery-bayes-pop {WinBUGS} (both title and booktitle) Software name, mid-title; Bayesian at title start correctly left unbraced — first char B is auto-protected ✓
statrethink2e {Bayesian} (both title and booktitle) Proper adj., mid-title (Statistical is first word) ✓

All changes are verified correct. Ready to merge.

A `(@ref)` at the start of a (wrapped) line inside a bullet-list item is
parsed by Pandoc as an example-list marker `(@Label)`, not a cross-reference:
the label is consumed and the following text becomes an `<ol class="example">`
item, so the crossref silently vanishes in the rendered output.

Move the `(@ref)` to the end of the preceding line so it parses inline:
- _sec_linear_algebra.qmd: @sec-vector-calculus, @sec-infer-LMs (the
  "quadratic forms" list — both were rendering blank).
- _calc_integrals_ftc.qmd: @eq-ftc-deriv-of-integral, @eq-ftc-part2 (the
  FTC Part 1 / Part 2 list).

(Six other `(@…)`-at-line-start spots exist but sit in plain paragraphs, not
list items, so Pandoc renders them correctly; left unchanged.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@claude

claude Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Claude finished @d-morrison's task in 2m 15s —— View job


Code Review — PR #877

  • Gather diff and context
  • Verify cross-reference targets
  • Review bibliography capitalization changes
  • Review latest commit (8fdc87c — Pandoc example-list-syntax fix)
  • Post final review

Latest Commit (8fdc87c) — Pandoc example-list fix ✅

This is a real and subtle Pandoc parsing issue: (@label) at the start of a wrapped continuation line inside a list item is parsed as an example-list marker (@label), not a cross-reference — the label is silently consumed and the text following it becomes an <ol class="example"> item. Two crossrefs in _sec_linear_algebra.qmd and two in _calc_integrals_ftc.qmd were rendering blank.

The fix (move (@ref) to the end of the preceding line) is correct:

File Refs fixed
_sec_linear_algebra.qmd @sec-vector-calculus, @sec-infer-LMs
_calc_integrals_ftc.qmd @eq-ftc-deriv-of-integral, @eq-ftc-part2

The commit message notes 6 other (@…) at-line-start occurrences in the codebase — I verified all 6 sit in plain paragraphs (::: notes divs or sentence continuations), not list items, so Pandoc renders them correctly and they were correctly left unchanged.


Cross-Reference Fixes (431db10) ✅

All six fixes verified:

Change Verification
@sec-linreg-inference@sec-infer-LMs {#sec-infer-LMs} at chapters/Linear-models-overview.qmd:62
Added {#sec-intro-MLEs} to intro-MLEs.qmd H1 Anchor at chapters/intro-MLEs.qmd:23; consumed by inference.qmd:31
Added {#sec-CI} to "Confidence intervals" Anchor at chapters/inference.qmd:71
Stripped #sec-bayes from intro-bayes.qmd link Confirmed: no {#sec-bayes} in intro-bayes.qmd — bare link is correct ✓
Stripped #sec-count-reg from count-regression.qmd link Confirmed: no {#sec-count-reg} in count-regression.qmd — bare link is correct ✓
OR-RR.qmdlogistic-regression.qmd#sec-OR-RR OR-RR.qmd absent from chapters/; {#sec-OR-RR} defined at _subfiles/logistic-regression/_sec_odds_ratios.qmd:55, included transitively via _sec_intro_bernoulli_models.qmd:36logistic-regression.qmd:37

Bibliography Capitalization (97aaec3 + 320b507) ✅

All brace-protections correct, including the {SAS} fix from 320b507:

Entry Change Rationale
Grodstein2001 {Nurses' Health Study} Named study, mid-title ✓
Vittinghoff2003 {Heart and Estrogen/progestin Replacement Study} Named study, mid-title ✓
mclachlan2007em {EM} Acronym, mid-title ✓
efron1978assessing {Fisher} Proper noun, mid-title ✓
anderson1935irises {Gaspe Peninsula} Place name, mid-title ✓
kleinman2009sas {SAS} and {R} {SAS} at title start — only first char auto-protected, so AS would otherwise lowercase; {R} mid-title ✓
rosenman1975coronary {Western Collaborative Group Study} Named study, mid-title ✓
copelan1991treatment {BuCy2} Proper noun, mid-title ✓
muenchen2011r {SAS} and {SPSS} Acronyms, mid-title ✓
aragon2018population {Bayesian} Proper adj., mid-title ✓
kery-bayes-pop {WinBUGS} (both title and booktitle) Software name, mid-title; Bayesian at title start left unbraced — first char B is auto-protected ✓
statrethink2e {Bayesian} (both title and booktitle) Proper adj., mid-title (Statistical is first word) ✓

All changes verified correct. Ready to merge.

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.

2026-06-05 00:20 UTC

@d-morrison d-morrison merged commit 462fd21 into main Jun 5, 2026
3 of 4 checks passed
@d-morrison d-morrison deleted the chore/bib-caps-and-broken-xrefs branch June 5, 2026 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant