Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: use U+2212 for minus sign in integer MIN/MAX text #93612

Merged
merged 1 commit into from
Feb 5, 2022

Conversation

tspiteri
Copy link
Contributor

@tspiteri tspiteri commented Feb 3, 2022

Closes #90793.

@rust-highfive
Copy link
Collaborator

r? @yaahc

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 3, 2022
@m-ou-se
Copy link
Member

m-ou-se commented Feb 4, 2022

I'm personally a big fan of the actual 'minus sign' character (−), as it matches up nicely with the (ascii) plus sign (+) in width and thickness and spacing. Seeing a hyphen used as minus sign in a variable width font makes the typesetting nerd in me scream. I also agree with your reasoning in #90793 that the parts that this PR is changing are clearly not code (with the superscript notation for power), such that it doesn't matter if it doesn't match the exact character used in Rust expressions.

It's also nice for accessibility. For example, Google Translate pronounces '1 - 2' as 'one to two', but '1 − 2' as 'one minus two'. (But none of these tools would pronounce <sup> as 'to the power of', so it doesn't really help that much in this case.)

However, I am worried here about maintaining this, because our documentation is part of our code, and usually viewed and edited in monospace, where it's even harder than usual to see the difference between the ascii hyphen-minus (-) and the (non-ascii) real minus sign (−). Our code is collectively maintained by a huge number of people, and this is easily missed by future contributors and reviewers.

How about using &minus; instead? Then it's directly visible that it's not just the ascii hyphen, easy to type on any keyboard, and Google-able.

(In the long term it might be nice to have LaTeX support in rustdoc. (But only if done without javascript. E.g. through (a Rust port of) KaTeX at 'compile' time, rather than with MathJax in the browser.) Then formulas like this can be written as $2^{32} - 1$ and it'll pick all the right characters. Though then we should be careful not to start using mathematical notation for too many things, as a big part of our target audience are not mathematicians.)

@tspiteri
Copy link
Contributor Author

tspiteri commented Feb 4, 2022

How about using &minus; instead? Then it's directly visible that it's not just the ascii hyphen, easy to type on any keyboard, and Google-able.

I like this; I updated the PR.

@m-ou-se
Copy link
Member

m-ou-se commented Feb 4, 2022

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Feb 4, 2022

📌 Commit d6e1df8 has been approved by m-ou-se

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 4, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 5, 2022
…askrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#90132 (Stabilize `-Z instrument-coverage` as `-C instrument-coverage`)
 - rust-lang#91589 (impl `Arc::unwrap_or_clone`)
 - rust-lang#93495 (kmc-solid: Fix off-by-one error in `SystemTime::now`)
 - rust-lang#93576 (Emit more valid HTML from rustdoc)
 - rust-lang#93608 (Clean up `find_library_crate`)
 - rust-lang#93612 (doc: use U+2212 for minus sign in integer MIN/MAX text)
 - rust-lang#93615 (Fix `isize` optimization in `StableHasher` for big-endian architectures)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9ba09f9 into rust-lang:master Feb 5, 2022
@rustbot rustbot added this to the 1.60.0 milestone Feb 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

doc: dash used instead of minus in mathematical expressions
6 participants