Skip to content

Conversation

@QuadnucYard
Copy link
Collaborator

@QuadnucYard QuadnucYard commented Mar 27, 2025

Closes #22. Fixes #132 and #141.

There are some problems:

  1. It is space-sensitive, and there may be some content magic on the user side. So we should not deliberately change spaces in math.
  2. We cannot distinguish between sin and cases. They have the same AST, but only the latter is really a function. Therefore, we must keep commas in args and not add extra ones.

These problems mean we have to keep the structure.

Line-breaking in math is also suppressed.

@QuadnucYard QuadnucYard changed the title feat: format expressions after hash in math feat: format args and hashed expressions in math Mar 27, 2025
@github-actions
Copy link

github-actions bot commented Mar 27, 2025

📊 Benchmark Performance Report

group                        base                                   pr
-----                        ----                                   --
attrs-cetz-manual            1.40     87.7±8.75µs        ? ?/sec    1.00     62.8±0.65µs        ? ?/sec
attrs-codly                  1.24   240.5±20.85µs        ? ?/sec    1.00    193.5±2.61µs        ? ?/sec
attrs-fletcher-diagram       1.28     51.0±0.39µs        ? ?/sec    1.00     40.0±6.76µs        ? ?/sec
attrs-fletcher-draw          1.29    153.5±9.98µs        ? ?/sec    1.00    118.8±2.16µs        ? ?/sec
attrs-tablex                 1.19    459.9±2.84µs        ? ?/sec    1.00    386.4±3.15µs        ? ?/sec
attrs-touying-core           1.23   293.7±10.21µs        ? ?/sec    1.00    239.7±2.63µs        ? ?/sec
attrs-touying-utils          1.25    159.0±1.68µs        ? ?/sec    1.00    127.3±2.97µs        ? ?/sec
attrs-undergraduate-math     1.31    119.7±6.89µs        ? ?/sec    1.00     91.1±1.31µs        ? ?/sec
pretty-cetz-manual           1.03    754.5±6.13µs        ? ?/sec    1.00   731.9±19.36µs        ? ?/sec
pretty-codly                 1.02  1783.9±11.88µs        ? ?/sec    1.00  1756.2±10.70µs        ? ?/sec
pretty-fletcher-diagram      1.03    511.5±7.15µs        ? ?/sec    1.00    497.6±6.80µs        ? ?/sec
pretty-fletcher-draw         1.02  1228.5±10.61µs        ? ?/sec    1.00  1205.6±12.20µs        ? ?/sec
pretty-tablex                1.02      3.4±0.04ms        ? ?/sec    1.00      3.3±0.01ms        ? ?/sec
pretty-touying-core          1.03      2.2±0.01ms        ? ?/sec    1.00      2.1±0.01ms        ? ?/sec
pretty-touying-utils         1.02  1194.9±11.22µs        ? ?/sec    1.00  1172.7±29.33µs        ? ?/sec
pretty-undergraduate-math    1.01    835.2±7.71µs        ? ?/sec    1.00    826.2±6.46µs        ? ?/sec

Generated by GitHub Actions on Fri Mar 28 02:56:10 UTC 2025

@Enter-tainer
Copy link
Collaborator

interestingly this pr greatly improves the performance🤔

Copy link
Collaborator

@Enter-tainer Enter-tainer left a comment

Choose a reason for hiding this comment

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

snapshot LGTM

@QuadnucYard
Copy link
Collaborator Author

interestingly this pr greatly improves the performance🤔

No, just because the computation of attributes is simplified due to fewer disabling cases.

@QuadnucYard QuadnucYard merged commit 3c09d1d into typstyle-rs:master Mar 28, 2025
15 checks passed
@QuadnucYard QuadnucYard deleted the math-hash branch March 28, 2025 11:00
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.

bad indent for math equation Correctly handle function calls in math mode

2 participants