PowerToys icon indicating copy to clipboard operation
PowerToys copied to clipboard

Add new language for math and science to Quick Accent

Open Cheese-Echidna opened this issue 2 years ago • 16 comments

Description of the new feature / enhancement

I would really like to add a new language for math and science to Quick Accent.

I am a student studying, among other things, Physics and Computer Science, and Quick Accent has been really helpful for me as I often need Greek letters to use in maths equations. (π, ε, Δ, Σ, etc) and the other symbols that can be used in maths (≥, ≠, ±) but I feel like many are missing that could be very useful, but don't fit into a specific language group: ∫, ⋃, √, ∀, ∞; and there are many others that I don't think I will ever use, but since there is no dedicated option, I need to leave enabled.

I propose that there be a separate language called "Math" or "Science" or something similar designed for English speakers who do not want access to the various language characters but would like to use the Greek letters that permeate maths and other symbols used in the same field.

Another solution to the problem might be to allow the user to define their own language set/keyboard mapping.

Scenario when this would be used?

This would be super helpful for anyone who needs to type out complex math expressions and is not in an environment that supports latex, or would like to quickly write an equation.

Supporting information

No response

Cheese-Echidna avatar May 25 '23 02:05 Cheese-Echidna

Having it work with fraction, exposant and indice would also be a nice add. ½¾¹²³

Ekareya avatar Jun 01 '23 08:06 Ekareya

Here is my current implementation for the GetDefaultLetter function for the Math language. (From Languages.cs) As per your suggestion, I have added the fractions to the slash symbol. Feel free to give input if you think there are any missing.

private static string[] GetDefaultLetterKeyMATH(LetterKey letter)
        {
            return letter switch
            {
                LetterKey.VK_0 => new string[] { "₀", "⁰" },
                LetterKey.VK_1 => new string[] { "₁", "¹" },
                LetterKey.VK_2 => new string[] { "₂", "²" },
                LetterKey.VK_3 => new string[] { "₃", "³" },
                LetterKey.VK_4 => new string[] { "₄", "⁴" },
                LetterKey.VK_5 => new string[] { "₅", "⁵" },
                LetterKey.VK_6 => new string[] { "₆", "⁶" },
                LetterKey.VK_7 => new string[] { "₇", "⁷" },
                LetterKey.VK_8 => new string[] { "₈", "⁸" },
                LetterKey.VK_9 => new string[] { "₉", "⁹" },
                LetterKey.VK_A => new string[] { "α", "⋀", "∀" },
                LetterKey.VK_B => new string[] { "β" },
                LetterKey.VK_C => new string[] { "∛", "χ" }
                LetterKey.VK_D => new string[] { "δ" },
                LetterKey.VK_E => new string[] { "∈", "ε", "∃" },
                LetterKey.VK_F => new string[] { "ƒ" },
                LetterKey.VK_G => new string[] { "γ" },
                LetterKey.VK_I => new string[] { "∞", "∫", "⇔", "⇒", "⇐", "⋃" },
                LetterKey.VK_L => new string[] { "λ" },
                LetterKey.VK_M => new string[] { "μ" },
                LetterKey.VK_N => new string[] { "ⁿ", "ν", "⋂" },
                LetterKey.VK_O => new string[] { "ø", "ω", "⋁" },
                LetterKey.VK_P => new string[] { "π", "φ", "ψ" },
                LetterKey.VK_R => new string[] { "ρ" },
                LetterKey.VK_S => new string[] { "√", "σ", "ß", "⊇", "⊆" },
                LetterKey.VK_T => new string[] { "θ", "τ", "þ" },
                LetterKey.VK_U => new string[] { "υ"},
                LetterKey.VK_X => new string[] { "ξ" },
                LetterKey.VK_Z => new string[] { "ζ" },
                LetterKey.VK_COMMA => new string[] { "¿", "¡", "∙", "₋", "⁻", "–", "≤", "≥", "≠", "≈", "≙", "±", "₊", "⁺" },
                LetterKey.VK_SLASH => new string[] { "½", "⅓", "⅔", "¼", "¾" },
                LetterKey.VK_PERIOD => new string[] { "\u0300", "\u0301", "\u0302", "\u0303", "\u0304", "\u0308", "\u030C" },
                LetterKey.VK_MINUS => new string[] { "~", "‐", "‑", "‒", "–", "—", "―", "⁓", "−", "⸺", "⸻" },
                _ => Array.Empty<string>(),
            };

Cheese-Echidna avatar Jun 01 '23 23:06 Cheese-Echidna

for some missing ones: ≡, ¬, ∄, ⊕, ×,⋅,÷,‰, ⊥,≪,≫, all the greek in caps (∑ and Π comes to mind) ,⊄,⊅,∉.

Most of your maths symbols are linked to the English words for it, like √ is in S, would be better to put it to ² or to 2 in order to be used by non english speaker.

I would have put ≤,⇐,⊆,⊂ with < ≥,⇒,⊇,⊃ with > ≠,≈,⇔,≡ with = ⋃, ⋁with | ( to stay with the programming logical OR ) ⋂,⋀ with & ( to stay with the programming logical AND) ¡,¬ with ! ¿ with ? ₊,⁺ with + ×,⋅ with * ∫ with S ( it means sums afterall) √ with ² or/and 2 ∛ with 3 ∞ with 8

And the options to add those key in addition to the user accentuated key would be great. ( I still need my accentuated letters ^^) example:

  • [x] Activate greek letters
  • [ ] Activate Math Symbols

Ekareya avatar Jun 02 '23 08:06 Ekareya

Here is my updated code:

        private static string[] GetDefaultLetterKeyMATH(LetterKey letter)
        {
            return letter switch
            {
                LetterKey.VK_0 => new string[] { "₀", "⁰" },
                LetterKey.VK_1 => new string[] { "₁", "¹", "¬" },
                LetterKey.VK_2 => new string[] { "₂", "²",  "√" },
                LetterKey.VK_3 => new string[] { "₃", "³", "∛" },
                LetterKey.VK_4 => new string[] { "₄", "⁴" },
                LetterKey.VK_5 => new string[] { "₅", "⁵" },
                LetterKey.VK_6 => new string[] { "₆", "⁶" },
                LetterKey.VK_7 => new string[] { "₇", "⁷", "⋂", "⋀" },
                LetterKey.VK_8 => new string[] { "₈", "⁸", "×", "⋅" },
                LetterKey.VK_9 => new string[] { "₉", "⁹" },
                LetterKey.VK_A => new string[] { "α", "∀" },
                LetterKey.VK_B => new string[] { "β" },
                LetterKey.VK_C => new string[] { "χ" }
                LetterKey.VK_D => new string[] { "δ" },
                LetterKey.VK_E => new string[] { "ε", "∃", "∄" },
                LetterKey.VK_F => new string[] { "ƒ" },
                LetterKey.VK_G => new string[] { "γ" },
                LetterKey.VK_I => new string[] { "∞", "∫" },
                LetterKey.VK_L => new string[] { "λ" },
                LetterKey.VK_M => new string[] { "μ" },
                LetterKey.VK_N => new string[] { "ⁿ", "ν" },
                LetterKey.VK_O => new string[] { "ø", "ω" },
                LetterKey.VK_P => new string[] { "π", "φ", "ψ", "⊥" },
                LetterKey.VK_R => new string[] { "ρ" },
                LetterKey.VK_S => new string[] { "σ", "ß", "⊇", "⊆" },
                LetterKey.VK_T => new string[] { "θ", "τ", "þ" },
                LetterKey.VK_U => new string[] { "υ"},
                LetterKey.VK_X => new string[] { "ξ", "⊕" },
                LetterKey.VK_Z => new string[] { "ζ" },
                LetterKey.VK_BACKSLASH => new string { "⋃", "⋁" }
                LetterKey.VK_EQUALS => new string[] {"≠","≈","⇔","≡", "≙", "±", "₊", "⁺" },
                LetterKey.VK_COMMA => new string[] { "≤", "⇐", "⊆", "⊂", "⊄", "∌", "∋", "≪"},
                LetterKey.VK_PERIOD => new string[] { "≥", "⇒", "⊇", "⊃", "⊅", "∈", "∉", "≫" },
                LetterKey.VK_SLASH => new string[] {  "÷", "½", "⅓", "⅔", "¼", "¾", "‰" },
                _ => Array.Empty<string>(),
            };
        }

I have taken on most of your feedback, and I definitely agree about the missing symbols. Just so you know, the capital versions of the Greek letters do not need to be specified in the file as they will replace the slower-case versions if the user is pressing shift or has caps lock on when pressing the key.

The only things I disagree on are integral and infinity which to me both feel like they should remain with the letter i.

Also, (and I don't know this) but given there is an "all" option within the software, I assume that's where you would need to go if you want accents and maths characters.

Also, I can't decide if "‰" should go with "/" where the other fractions are or with "%", what do you think?

Cheese-Echidna avatar Jun 03 '23 09:06 Cheese-Echidna

I would have put it with % but I don't know about the ease of access on your keyboard layout.

Ekareya avatar Jun 03 '23 20:06 Ekareya

Not all keyboard have the same layout, especially with the number row and punctuation mark. for example on my keyboard, the 8 key is where I have _ and \ but on yours you have *. so my questions is, do you know if it's possible to assign "×", "⋅" to * and not to 8 in order to not depend on the keyboard layout? https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes

Ekareya avatar Jun 04 '23 05:06 Ekareya

I think there is "VK_MULTIPLY" but I think that refers to the * on the Numpad. For me, % is on the 5 key.

Cheese-Echidna avatar Jun 06 '23 23:06 Cheese-Echidna

This is what I've been thinking! Are you going to make a PR? (I personally want to add degree, as in 100°C)(maybe map it to key 0)

Some opinions:

  1. Quick accent should not utilize the numpad, as a lot of laptops and smaller keyboards do not have them.
  2. Different keyboard layouts could be a problem. I have little knowledge about them though.
  3. Greek letters already exists. No need for the redundancy.
  4. I agree with Ekareya on these
  • "∞"to 8, and "∫" to S.

The mapping now is too English-centered.

Ali-C-Ila avatar Jun 07 '23 08:06 Ali-C-Ila

concerning the numpad, I could be nice to have though. As long as there is an alternative for those that don't have it.

Ekareya avatar Jun 07 '23 09:06 Ekareya

For now, I think it would be better to make changes that do not use the numpad. If someone else wants to do numpad bindings they are welcome. As for the Greek letters, although they are already in many of the other languages, there is no way to pick and choose just some of the languages, and as such including them in the "Math" language seems appropriate. Here is the current code, note I have added the ° symbol (thanks for the idea) and moved the "‰" to %.

        private static string[] GetDefaultLetterKeyMATH(LetterKey letter)
        {
            return letter switch
            {
                LetterKey.VK_0 => new string[] { "₀", "⁰", "°" },
                LetterKey.VK_1 => new string[] { "₁", "¹", "¬" },
                LetterKey.VK_2 => new string[] { "₂", "²",  "√" },
                LetterKey.VK_3 => new string[] { "₃", "³", "∛" },
                LetterKey.VK_4 => new string[] { "₄", "⁴" },
                LetterKey.VK_5 => new string[] { "₅", "⁵", "‰" },
                LetterKey.VK_6 => new string[] { "₆", "⁶" },
                LetterKey.VK_7 => new string[] { "₇", "⁷", "⋂", "⋀" },
                LetterKey.VK_8 => new string[] { "₈", "⁸", "∞", "×", "⋅" },
                LetterKey.VK_9 => new string[] { "₉", "⁹" },
                LetterKey.VK_A => new string[] { "α", "∀" },
                LetterKey.VK_B => new string[] { "β" },
                LetterKey.VK_C => new string[] { "χ" }
                LetterKey.VK_D => new string[] { "δ" },
                LetterKey.VK_E => new string[] { "ε", "∃", "∄" },
                LetterKey.VK_F => new string[] { "ƒ" },
                LetterKey.VK_G => new string[] { "γ" },
                LetterKey.VK_L => new string[] { "λ" },
                LetterKey.VK_M => new string[] { "μ" },
                LetterKey.VK_N => new string[] { "ⁿ", "ν" },
                LetterKey.VK_O => new string[] { "ø", "ω" },
                LetterKey.VK_P => new string[] { "π", "φ", "ψ", "⊥" },
                LetterKey.VK_R => new string[] { "ρ" },
                LetterKey.VK_S => new string[] { "σ", "ß", "∫" },
                LetterKey.VK_T => new string[] { "θ", "τ", "þ" },
                LetterKey.VK_U => new string[] { "υ"},
                LetterKey.VK_X => new string[] { "ξ", "⊕" },
                LetterKey.VK_Z => new string[] { "ζ" },
                LetterKey.VK_BACKSLASH => new string { "⋃", "⋁" }
                LetterKey.VK_EQUALS => new string[] {"≠","≈","⇔","≡", "≙", "±", "₊", "⁺" },
                LetterKey.VK_COMMA => new string[] { "≤", "⇐", "⊆", "⊂", "⊄", "∌", "∋", "≪"},
                LetterKey.VK_PERIOD => new string[] { "≥", "⇒", "⊇", "⊃", "⊅", "∈", "∉", "≫" },
                LetterKey.VK_SLASH => new string[] {  "÷", "½", "⅓", "⅔", "¼", "¾" },
                _ => Array.Empty<string>(),
            };
        }

Cheese-Echidna avatar Jun 08 '23 03:06 Cheese-Echidna

Yeah, that's great! Why not make a pull request?

Ali-C-Ila avatar Jun 08 '23 07:06 Ali-C-Ila

Ah, it seems there is no binding for the "|" key in the LetterKey enum. For now, I will make a push request without the changes.

Cheese-Echidna avatar Jun 09 '23 02:06 Cheese-Echidna

This has sort of been closed as not planned before in #21439, but some other symbols have gotten in already... Let's discuss this on the PR anyway.

jaimecbernardo avatar Jun 13 '23 11:06 jaimecbernardo

CC @damienleroy

Jay-o-Way avatar Jun 13 '23 12:06 Jay-o-Way

@octastylos-pseudodipteros Your contribution is welcome and thank you for your work on this. Feel free to open a PR. If you have any further questions don't worry to ask them.

htcfreek avatar Aug 24 '24 14:08 htcfreek

It would also be great to have some mathematical letters in here, e.g.:

  • 𝑥 which is U+1D465 mathematical italic small X
  • ℓ which is U+2113 cursive script lowercase L
  • 𝕎, ℍ, ℙ, and the rest of the blackboard bold (double-struck) characters. ℂ, ℕ, ℚ, ℝ, and ℤ from the Basic Multilingual Plane are already present, but not ℍ or ℙ. And the rest of the alphabet was added in https://en.wikipedia.org/wiki/Blackboard_bold#Usage, e.g. 𝕎 representing whole numbers.
  • Everything in https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols? That might be too much without hiding them by default and having a specific way to search for them as discussed in #37653, #16353, #37146, #26270, #34427, #25190, #27370 and #11612.

ukanuk avatar Mar 06 '25 18:03 ukanuk

As noted in #27287, ± ought to be in the same place as . I.e., it ought to be added to - and =. It is currently only under ,, and in spite of testing every combination I could possibly think of, I never thought to look for that character under ,.

ukanuk avatar Mar 28 '25 14:03 ukanuk

seems like we need another PR... I couldnt find ± in the , key though... At first I thought of = or - but even after reached out to this issues, couldnt find ± in , as well.

groutoutlook avatar May 27 '25 08:05 groutoutlook