Fix CJK tofu on the three pages flagged by the post-publish sweep (ols, ar1_turningpts, phillips_credibility) - #244
Conversation
sns.set_theme() runs ten lines after the i18n font cell and resets font.family to seaborn's defaults, so every figure in the lecture ships with tofu axis labels — live on the published site since 2025-11-06. Passing the font family through set_theme's rc override keeps the theme and the CJK font both. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
✅ Deploy Preview for astonishing-narwhal-a8fc64 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR fixes missing CJK glyphs (“tofu” axis labels) in the ols lecture by preventing Seaborn from resetting Matplotlib’s configured Chinese font when sns.set_theme() is applied.
Changes:
- Update
lectures/ols.mdto callsns.set_theme(rc=...)sofont.familyremains set to the intended CJK-capable font.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| from linearmodels.iv import IV2SLS | ||
| import seaborn as sns | ||
| sns.set_theme() | ||
| sns.set_theme(rc={'font.family': ['Source Han Serif SC', 'DejaVu Sans']}) # set_theme 会重置字体,用 rc 覆盖保留中文字体 |
The 2026-08-07 publish put both pages on the live site for the first
time, and bin/check-tofu flagged both. ar1_turningpts is the same
clobber class as ols through a third API: sns.set_style('white') resets
font.family after the i18n cell, so the rc override keeps the style and
the font both. phillips_credibility was seeded with no font
configuration at all (the action-translation#178 sync-path class); this
adds the standard i18n block used by its siblings.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Merge-order caveat: #230 in the open sync backlog re-delivers |
…ation ToC entry The rebase automation's regenerated ToC reintroduced the undelivered lecture (pattern on #210); main now supplies the #231 lectures and the source bibliography, so the cross-PR references resolve by inheritance. Zero dangling ToC entries verified. The remaining question for this preview is whether the mccall_risk CellExecutionError reproduces — its code is byte-identical to source, so a repeat points away from the translation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The 2026-08-07 publish (the first on this edition since 2025-11-06) fixed two of the three long-standing tofu pages (
divergence_measures,stats_examples— stale builds) and surfaced the full picture on the pages whose defect is in the executed code.bin/check-tofu --siteagainst the freshly published site flags exactly three pages; this PR fixes all three.ols.md—sns.set_theme()runs ten lines after the font configuration and resetsfont.familyto seaborn's defaults. Fixed by passing the font throughset_theme(rc=...), seaborn's documented override mechanism.ar1_turningpts.md— same clobber class through a third API:sns.set_style('white')also resetsfont.family. Samerc=override fix.phillips_credibility.md— seeded with no font configuration at all (the QuantEcon/action-translation#178 sync-path localisation gap made visible). Adds the standard i18n block its sibling lectures carry.Verification: the preview's three pages should show no
Glyph … missing from font(s)stderr output;bin/check-tofu --site(program bench) against the preview should report all three clean. Part of the publish-gate work tracked in QuantEcon/project-translation#25 — after merge, the pages come clean on the next cache run + republish. Companion PR for the same class on programming.zh-cn: QuantEcon/lecture-python-programming.zh-cn#87.🤖 Generated with Claude Code