Skip to content

docs: render math in the discrete event simulation tutorials - #4058

Merged
quaquel merged 1 commit into
mesa:mainfrom
arzaanxeng:fix-tutorial-math-rendering
Nov 9, 2026
Merged

quaquel merged 1 commit into
mesa:mainfrom
arzaanxeng:fix-tutorial-math-rendering

Conversation

@arzaanxeng

Copy link
Copy Markdown
Contributor

Summary

Math in the tutorials (e.g. https://mesa.readthedocs.io/latest/tutorials/11_discrete_event_simulation.html) is shown as raw $$...$$ text instead of being rendered.

Cause

  • docs/conf.py doesn't enable MyST's dollarmath extension.
  • In tutorial 11, most formulas have doubled backslashes (\\frac, \\rho), which would still break after enabling math.
  • Formulas placed directly under a text line are parsed as inline math with stray $ characters, so each needs a blank line above it.

Changes

  • Enable myst_enable_extensions = ["dollarmath"] in docs/conf.py.
  • Tutorial 11: fix the backslashes, add blank lines before formulas, move "(Stable system)" onto its own line.
  • Tutorial 12: add a blank line before its one formula (same problem, affected once math is enabled).

Testing

Built the docs locally with python -m sphinx -b html -D nb_execution_mode=off . _build and checked tutorials 11 and 12 in the browser: formulas render and no stray $ is left. No other docs page contains $ outside code, so nothing else is affected.

Screenshots

Tutorial 12

Before Fix
Bug in Tutorial 12

After Fix
Fixed Tutorial 12


Tutorial 11

Before Fix
Bug in Tutorial 11

After Fix
Fixed Tutorial 11

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Performance benchmarks:

Model Size Init time [95% CI] Run time [95% CI]
BoltzmannWealth small 🔵 -1.9% [-2.5%, -1.3%] 🔵 -0.6% [-0.8%, -0.5%]
BoltzmannWealth large 🔵 +0.9% [-0.6%, +2.5%] 🔵 +4.5% [-1.2%, +11.2%]
Schelling small 🔴 +5.2% [+4.6%, +5.9%] 🔴 +5.4% [+4.3%, +6.5%]
Schelling large 🔵 +1.9% [+1.3%, +2.4%] 🔴 +10.1% [+8.6%, +12.3%]
WolfSheep small 🔵 +1.2% [+0.6%, +1.9%] 🔵 +6.2% [+2.1%, +10.3%]
WolfSheep large 🔵 -4.3% [-6.4%, -1.9%] 🔵 -5.8% [-9.6%, -1.5%]
SugarscapeG1mt small 🔵 -0.6% [-1.3%, +0.1%] 🔵 -0.6% [-2.3%, +1.0%]
SugarscapeG1mt large 🔵 -3.1% [-4.0%, -2.0%] 🔵 -3.9% [-6.0%, -2.0%]
BoidFlockers small 🔵 -2.7% [-3.5%, -1.9%] 🔵 -2.5% [-3.1%, -1.9%]
BoidFlockers large 🔵 -2.4% [-3.0%, -1.8%] 🔵 -2.0% [-2.2%, -1.8%]
MultiLevelAllianceModel small 🔵 +0.8% [-1.5%, +3.0%] 🔵 -0.7% [-1.2%, -0.3%]
MultiLevelAllianceModel large 🔵 +1.0% [-2.4%, +4.6%] 🔵 -3.5% [-6.5%, -0.7%]

@dietcoke-17 dietcoke-17 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good fix lgtm fine and well documented

@quaquel
quaquel merged commit 7ffc3bc into mesa:main Nov 9, 2026
17 checks passed
@quaquel quaquel added the docs Release notes label label Nov 9, 2026
@arzaanxeng
arzaanxeng deleted the fix-tutorial-math-rendering branch November 10, 2026 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Release notes label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants