Repository navigation
Conversation
…ions sphinx-exercise 1.2.2 writes a captioned figure inside an exercise or solution box as [H], so the LaTeX build no longer stops with "Not in outer par mode". Restore the nine captions removed as the workaround in #1101, #1110 and #1119. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WT8bMZoSvoQTbzkdmZiMnd
mmcky
added a commit
to QuantEcon/lecture-python.zh-cn
that referenced
this pull request
Nov 10, 2026
sphinx-exercise 1.2.2 writes a captioned figure inside an exercise or solution box as [H], so the LaTeX build no longer stops with "Not in outer par mode". This lands before QuantEcon/lecture-python.myst#1121, whose restored captions in solutions reach this repository through the translation sync. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WT8bMZoSvoQTbzkdmZiMnd
Contributor
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🔵 Needs a closer look
This change alters PDF build behavior via a dependency upgrade and explicitly requires cross-repo coordination (moving the lecture-python.zh-cn pin first), so a reviewer should verify CI PDF output and downstream sync impacts before approval.
No open issues 🎉
What changed in this PR
Upgrades sphinx-exercise to 1.2.2 to address LaTeX figure placement inside exercise/solution boxes, and restores MyST-NB figure captions/labels for solution-embedded figures so they render correctly again (including in PDF builds).
Changes:
- Bump
sphinx-exercisefrom1.2.1to1.2.2in the main environment and the Colab workflow. - Re-add
mystnbfigurecaption/namemetadata for 9 figures across 5 lectures (inside gated solutions).
| File | Description |
|---|---|
| lectures/lucas_prescott_search.md | Restores MyST-NB figure caption/name metadata for three figures produced in gated solution code cells. |
| lectures/learning_approximation.md | Restores MyST-NB figure caption/name metadata for two solution-embedded figures. |
| lectures/information_transfer.md | Restores MyST-NB figure caption/name metadata for one solution-embedded figure. |
| lectures/genetic_classifier.md | Restores MyST-NB figure caption/name metadata for one solution-embedded figure. |
| lectures/exchange_rate_learning.md | Restores MyST-NB figure caption/name metadata for two figures inside gated solutions. |
| environment.yml | Updates the pinned sphinx-exercise version to 1.2.2 in the project environment. |
| .github/workflows/collab.yml | Updates the workflow’s pinned sphinx-exercise version to 1.2.2 in the dependency install step. |
Review effort: Balanced
📖 Netlify Preview Ready!Preview URL: https://pr-1121--sunny-cactus-210e3e.netlify.app Commit: 📚 Changed Lectures
Build Info
|
This branch has not been 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.
Upgrades sphinx-exercise from 1.2.1 to 1.2.2 and puts back the figure captions that were removed to keep the PDF build working.
sphinx-exercise 1.2.1 wrote a captioned figure inside an exercise or solution box as a floating
\begin{figure}[htbp], which LaTeX rejects there withNot in outer par mode. 1.2.2 writes it as[H], as Sphinx does inside its own admonitions; see executablebooks/sphinx-exercise#94 and executablebooks/sphinx-exercise#95. Until now the workaround was to drop themystnbfigure metadata from code cells inside solutions, as recorded on QuantEcon/meta#297.Changes
environment.ymland.github/workflows/collab.yml:sphinx-exercise==1.2.1→1.2.2. The release has the same dependencies as 1.2.1, and HTML output is unchanged.Testing
CI's Build PDF from LaTeX step (
jb build lectures --builder pdflatex -W --keep-going) is the test. If it passes with the nine captions back, 1.2.2 works on real lectures.Before merging
lecture-python.zh-cn builds HTML only (its PDF steps are commented out), so the restored captions need no change there; Dependabot will bring its pin to 1.2.2.
Part of QuantEcon/workspace-lectures#70.
🤖 Generated with Claude Code
https://claude.ai/code/session_01WT8bMZoSvoQTbzkdmZiMnd