Skip to content

Write variables as math text in examples and README - #12

Merged
FridrichMethod merged 1 commit into
mainfrom
docs/math-labels
Nov 17, 2026
Merged

FridrichMethod merged 1 commit into
mainfrom
docs/math-labels

Conversation

@FridrichMethod

Copy link
Copy Markdown
Owner

Summary

Variables and formulas in figure text are written as math text, so they are set like an equation: variables in Arial Italic, function names, numbers and parentheses upright (the style's mathtext.it / mathtext.rm). Math text uses Matplotlib's built-in TeX parser and needs no LaTeX installation.

  • examples/styles_demo.py: "x", "y", "sin(x)", "cos(x)", "X measure", "Y measure" become "$x$", "$y$", r"$\sin(x)$", r"$\cos(x)$", "$X$ measure", "$Y$ measure" (also in the Matplotlib-defaults comparison, so the two differ only in style).
  • README's Quick start and "Axis lengths in inches" code use the same labels; the style table and Fonts section describe math text, and the add_custom_fonts example registers Arial Italic.
  • examples/_common.py: the Arial check also requires the italic face, which math variables use.
  • AGENTS.md: rendering rule to write variables and formulas as math text, never as upright text.
  • Regenerated: default_style, graphpadprism_style, graphpadprism_errorbar (PNG, SVG, PDF). The Prism PDFs embed ArialMT and Arial-ItalicMT, both TrueType.

Test plan

  • New test_math_variables_are_italic_and_functions_upright: with the style, mathtext.it resolves to an Italic/Oblique face and mathtext.rm to an upright one.
  • Visual check of the three regenerated figures; README example code runs.
  • pre-commit run --all-files
  • pytest (300 passed), also locally with Matplotlib 3.8.0 / NumPy 1.26.4.

Labels and legends in the examples and README code write variables and
formulas as math text ($x$, $y$, $\sin(x)$, $X$ measure), so variables are
set in Arial Italic and function names upright, as in an equation. The
Arial check in the examples also requires the italic face. README and
AGENTS.md state the convention, and a test checks that the style resolves
math variables to an italic face and function names to an upright one.
Copilot AI balanced review requested due to automatic review settings November 17, 2026 02:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@FridrichMethod
FridrichMethod merged commit 40b103a into main Nov 17, 2026
3 checks passed
@FridrichMethod
FridrichMethod deleted the docs/math-labels branch November 17, 2026 02:21
@FridrichMethod FridrichMethod mentioned this pull request Nov 17, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants