Skip to content

fix(typeset): a substituted term that opens with a minus prints as a subtraction - #759

Merged
FBumann merged 3 commits into
mainfrom
fix/substituted-minus
Sep 28, 2026
Merged

FBumann merged 3 commits into
mainfrom
fix/substituted-minus

Conversation

@FBumann

@FBumann FBumann commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Prompt: Do the first step now

Note

The following content was generated by AI.

What this changes

A substituted term that opens with a minus prints as a subtraction: a - b and a - b + c, not a + -b. The fix is split out of #740.

Guards, gates

The test fails on main and passes here. Mutation table, taken by hand with a git checkout -- restore and a clean tree after:

Guard removed Result
substitute before the sign folding caught: the new test, and the walk line census
re-associate a sum on the right of a plus caught: the new test

The golden model gains net and netted, so the line census reaches both new lines. The golden output and the notation page are regenerated.

Gates: I could not install pixi here, so I ran the gates in a Python 3.12 venv. pytest passes (2117), and ruff, pyrefly, typos and prettier are clean. zensical build --strict gives only the docs.python.org inventory warning, which main also gives here. Not run: compile-tex, reuse lint, zizmor, taplo.

Why

The file written out prints a - b. The substituted file printed the same term differently.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CQxVP5uX2V4rpvJNPhbyR2

…subtraction

Substituting a plain named expression whose body opens with a minus printed
`a + -b`, and one whose body is a sum printed `a + -b + c`. The walk now
substitutes the body before it folds the sign, and re-associates a sum on the
right of a plus to the left, so both print as the file written out does:
`a - b` and `a - b + c`. The golden model carries the case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CQxVP5uX2V4rpvJNPhbyR2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CQxVP5uX2V4rpvJNPhbyR2
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 mathspec | 🛠️ Build #34807177 | 📁 Comparing 14e75dc against latest (8418623)

  🔍 Preview build  

2 files changed
± changelog/index.html
± reference/notation/index.html

@FBumann
FBumann enabled auto-merge (squash) September 28, 2026 15:50
@FBumann
FBumann disabled auto-merge September 28, 2026 15:53
@FBumann
FBumann merged commit b82076c into main Sep 28, 2026
7 checks passed
FBumann pushed a commit that referenced this pull request Sep 28, 2026
Brings #742, #743, #756 and #759. Only CHANGELOG.md conflicted, and it keeps
both sides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CQxVP5uX2V4rpvJNPhbyR2
FBumann pushed a commit that referenced this pull request Sep 28, 2026
#740 gives each of the nine sums one owning fragment, names the terms in
`pypsa.yaml`, simplifies the splitter and adds a page per fragment. The
language, typesetter and their tests keep main's side, which holds #742 and
#759 as merged. The PyPSA files take #740's side, the splitter writes
`empty: true` on each owner block, and the fragments and pages are
regenerated from `pypsa.yaml`, which keeps #717's per-snapshot coefficients.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CQxVP5uX2V4rpvJNPhbyR2
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