fix: render index slot suffixes as a comma subscript - #213
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #213 +/- ##
=======================================
Coverage 94.51% 94.52%
=======================================
Files 27 27
Lines 2937 2939 +2
=======================================
+ Hits 2776 2778 +2
Misses 161 161 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Benchmark Results
Details
| Benchmark suite | Current: 4077d66 | Previous: e7e7648 | Ratio |
|---|---|---|---|
Accumulation/Many-mode H/foldl M=16 |
11041 ns |
10980 ns |
1.01 |
Accumulation/Many-mode H/foldl M=24 |
24586 ns |
24876 ns |
0.99 |
Accumulation/Many-mode H/foldl M=8 |
2765.1111111111113 ns |
2800.777777777778 ns |
0.99 |
Accumulation/Many-mode H/sum M=16 |
1718.2 ns |
1697.1 ns |
1.01 |
Accumulation/Many-mode H/sum M=24 |
2294.222222222222 ns |
2305.4444444444443 ns |
1.00 |
Accumulation/Many-mode H/sum M=8 |
695.4850746268656 ns |
729.7297297297297 ns |
0.95 |
Accumulation/Same-site/foldl |
6205.6 ns |
6275.6 ns |
0.99 |
Accumulation/Same-site/sum |
2346.5555555555557 ns |
2295.3333333333335 ns |
1.02 |
Commutator/Nested JC/depth=1 |
1671.1 ns |
1705.1 ns |
0.98 |
Commutator/Nested JC/depth=2 |
18285 ns |
17583 ns |
1.04 |
Commutator/Nested JC/depth=3 |
66674 ns |
66503 ns |
1.00 |
Commutator/Nested JC/depth=4 |
170669 ns |
168372 ns |
1.01 |
Commutator/Nested JC/depth=5 |
378527 ns |
372361 ns |
1.02 |
Commutator/Schrieffer-Wolff/[S, V] |
196577 ns |
198388 ns |
0.99 |
Commutator/Schrieffer-Wolff/[S, [S, H0]] |
359101 ns |
367321 ns |
0.98 |
Indexing/Diagonal collapse/[H_Dicke, S_j] |
43261 ns |
44253 ns |
0.98 |
Indexing/Diagonal collapse/[H_JC, σ_j] |
62326 ns |
63227 ns |
0.99 |
Indexing/Simplify/double-sum spin-spin |
16641 ns |
16551 ns |
1.01 |
Indexing/Simplify/indexed JC H |
1150.2 ns |
1169.1 ns |
0.98 |
Indexing/Sum construction/double Σ_ij(J_ij*S_i*S_j) |
8512.333333333334 ns |
8766 ns |
0.97 |
Indexing/Sum construction/single Σ_i(σ_i*σ_j) |
11552 ns |
10669 ns |
1.08 |
Normal Order/Fock (c*c')^n/n=2 |
621.9545454545455 ns |
611.7403314917127 ns |
1.02 |
Normal Order/Fock (c*c')^n/n=3 |
894.2033898305085 ns |
892.1754385964912 ns |
1.00 |
Normal Order/Fock (c*c')^n/n=4 |
1198.2 ns |
1183.2 ns |
1.01 |
Normal Order/Fock (c*c')^n/n=5 |
1597.9 ns |
1565.9 ns |
1.02 |
Normal Order/Ground state/3-level rewrite |
840.8 ns |
809.5487804878048 ns |
1.04 |
Normal Order/Multi-mode/2-mode 6-op chain |
978.8 ns |
964.421052631579 ns |
1.01 |
Simplify/Jaynes-Cummings/H |
1078 ns |
1050 ns |
1.03 |
Simplify/Jaynes-Cummings/H² |
2431.222222222222 ns |
2412.3333333333335 ns |
1.01 |
Simplify/Two cavities/H |
1113.1 ns |
1103 ns |
1.01 |
Simplify/Two cavities/H² |
4497 ns |
4495.428571428572 ns |
1.00 |
Simplify/Λ-system/H |
1343.5 ns |
1352.5 ns |
0.99 |
Simplify/Λ-system/H² |
2284.222222222222 ns |
2276.4444444444443 ns |
1.00 |
This comment was automatically generated by workflow using github-action-benchmark.
An index accumulates numeric per-slot suffixes as the pipeline transforms
it, via `(i::Index)(k)` (e.g. `i` -> `i_2` -> `i_2_1` when a second distinct
atom is later collapsed to its position-1 representative). `_latex_index_suffix`
emitted the name verbatim as `_{i_2_1}`, whose unbraced `_2_1` is a double
subscript that MathJax rejects ("Double subscripts: use braces to clarify"),
leaving whole equations unrendered in Documenter pages and notebooks.
Join the slot numbers into a single comma subscript instead (`i_2_1` renders
as `i_{2,1}`); bare index names are unchanged. Add a regression test.
Bump version to 0.9.5.
oameye
force-pushed
the
fix/index-latex-double-subscript
branch
from
July 16, 2026 14:30
f09083a to
4077d66
Compare
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.
Problem
An index accumulates numeric per-slot suffixes as the pipeline transforms it, via
(i::Index)(k)(which doesSymbol(name, "_", k)). For example an index reachesi_2_1when completion mints a second distinct atomi(2)(i_2, slot 2) andscalelater collapses it to its position-1 representative(i_2)(1)(i_2_1, slot 1)._latex_index_suffixemitted the name verbatim as_{i_2_1}. The unbraced_2_1is a double subscript, which MathJax rejects with "Double subscripts: use braces to clarify", so the entire equation was left unrendered (raw LaTeX source) in Documenter pages and notebooks.Surfaced by the QuantumCumulants
superradiant_laser_indexedexample (corr_sc.eqs), while investigating QuantumCumulants PR #317.Fix
The suffixes are slot numbers, so join them into a single comma subscript:
i_2_1renders asi_{2,1}. Bare index names (:i,:j) have no suffix and are unchanged.The accumulated
_2part is load-bearing (it distinguishes the second-atom representative from the first, so two-atom moments do not fold into same-atom ones), so the name itself is preserved; only its rendering changes.Tests
Added a regression testset in
test/printing/printing_test.jlpinningi_{2,1}and confirming bare names are untouched. All 133 rendering tests pass.Verified the transformed output renders in both MathJax v2 and v3.