Repository navigation
kalman_2: drop usetex, render CJK + math via font-manager + mathtext (#22) - #181
Merged
Merged
Conversation
Standardises kalman_2 on the zh edition's font-manager approach (the
convention on ~38 other lectures), removing the fragile usetex+CJKutf8+
cjk() machinery that caused a cascade of failures during the resync
(dropped cjk() def -> NameError; missing amsfonts -> LaTeX Undefined
control sequence). Chinese now renders via Source Han Serif; the
\mathbb{E}[...] plot titles render via matplotlib mathtext.
Implements the #22 decision to move away
from usetex (see issue discussion). two_auctions is the only other
usetex lecture and is handled the same way.
Co-Authored-By: Claude Fable 5 <[email protected]>
✅ Deploy Preview for astonishing-narwhal-a8fc64 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Closed
There was a problem hiding this comment.
Pull request overview
This PR updates lectures/kalman_2.md to stop using text.usetex + a custom cjk() LaTeX wrapper, and instead rely on the lecture’s existing Matplotlib font-manager setup (Source Han Serif SC) with MathText for inline math rendering.
Changes:
- Removed the pdfLaTeX/CJKutf8 preamble,
text.usetex=True, and thecjk()helper. - Replaced all
cjk(...)label/title call sites with plain Chinese strings and MathText strings (e.g.,r'$\mathbb{E}[\cdot]$ ...').
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This branch was previously deployed
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.
Standardises
kalman_2.mdon the zh edition's font-manager rendering approach and removestext.usetex, per the #22 decision.Why:
kalman_2andtwo_auctionswere the only two lectures in the edition usingtext.usetex=True. During the 2026-07-18 resync, the usetex path produced a cascade of failures — the resync dropped thecjk()helper (→NameErrorin every figure cell), and once restored the LaTeX preamble was missingamsfontsso upstream's\mathbbtitles raised "Undefined control sequence" andtight_layout()crashed. All of it was invisible until a cold (uncached) build. The other ~38 lectures render Chinese viaplt.rcParams['font.family'](Source Han Serif) with no usetex, and never hit this class of problem.What changed: removed the
CJKutf8/amsmath/amsfontspreamble and thedef cjk()helper; unwrapped the 13cjk(...)call sites to plain strings; the two\mathbb{E}[...]plot titles are now raw strings rendered via matplotlib mathtext (which supports\mathbb). The Chinese in plot labels now uses Source Han Serif — the same family as the rest of the edition — instead of the CJK LaTeX gbsn font.Companion: the same change on
two_auctions(the other usetex lecture) in the current resync wave.🤖 Generated with Claude Code