Math Keyboard

A side keyboard for scientists and engineers

Public Chat
Similar projects worth following
Writing mathematical equations on a computer is always a pain in the neck regardless of how you wish to do it, be it in plaintext, with the Office equations editor, or in LaTeX.

Let's face it: The average user will never need to type greek letters or volume integrals. Therefore, mathematical typing is not prioritized by developers.

Faced with these problems in my daily life, I decided to create a small side keyboard, also known as a macro keyboard, with most of the characters and mathematical operators I often need.

The ultimate goal of the mathematical keyboard is to make my life easier. I often write equations, and I have long been frustrated by the amount of time spent looking up special Unicode symbols on google, clicking around in the Equations Editor in Word and Powerpoint, and looking up LaTeX math codes. I feel like I would save time if I had a keyboard that could insert the correct symbols, operators, and LaTeX codes automatically.

The Mathematical Keyboard aims to do all this. It is a 4x4 macro keyboard from 1UP Keyboards with custom firmware and blank keycaps. The blank keycaps allow you to change the behaviour of the keyboard to your liking and enables rapid development.

The current version of the mathematical keyboard has the following symbols and operators:

  • Lowercase and uppercase greek letters ( α, β, ... ω )
  • Comparative operators ( ≠ ≈ ∝ ≤ ≥ ≡ )
  • Dot and cross product ( ⋅⨯ )
  • Common accents ( ◌̂ ◌̌ ◌̃ ◌̄ ◌⃗ ◌̇ )
  • Operators and radicals ( ∫ ∮ ∑ ∏ √ )
  • Common set operators ( ⋃ ⋂ ∈ ∉ ⊂ ⊄ )
  • Commonly used symbols ( → ⇒ ° ∂ ∇ )

I will be putting the firmware on github soon.

End goals

I want to eventually come up with a design that works seamlessly on Windows, Mac, and Linux, and which can switch between plaintext mode, LaTeX mode, and Math ML mode. The current design uses an off-the-shelf macro pad because this allows for rapid development. As I refine the behaviour of the keyboard, I can begin considering changing key layouts and overall design. I will be making it all open source, and hope to create something that is actually useful for many people.

  • 1 × Sweet 16 Macro Pad PCB Macro pad PCB from 1UP keyboards
  • 1 × Pro Micro mcu Microcontroller, sold by 1UP keyboards with the macro pad PCB
  • 16 × Diodes Sold by 1UP keyboards with the macro pad PCB
  • 1 × Reset switch Sold by 1UP keyboards with the macro pad PCB
  • 16 × Switches, 5-pin PCB mounted

View all 6 components

  • Deciding on the layout

    Magne Lauritzen08/01/2022 at 19:24 0 comments

    The apparently simple task of deciding which symbols go where on the math keyboard has been more challenging than I had anticipated.

    The main problem is lack of real-estate. Consider that the keyboard only has 16 buttons, while Wikipedia lists hundreds of mathematical Unicode symbols:

    Clearly, it will not be possible to fit every mathematical symbol on the math keyboard. We have two ways of approaching this problem:

    1. Fit more than one symbol on each button
    2. Focus on the most-used symbols

    The second solution is a bit more tricky because it requires us to make a decision about which symbols common enough to be granted a spot on the math keyboard. 

    Fitting several symbols per button

    This approach is easy. Everyone is already used to the concept of keyboard buttons having more than one symbol. Just look at the number row, for example. They all have numbers and symbols on each button.

    For the mathematical keyboard, I decided to fit 6 symbols per button. This may sound like it will get confusing very quickly, but I think it'll work fine. I take advtantage of the fact that the keycaps have a sloped front so one can see symbols printed on the front face. 

    A single button
    A single keycap showing the locations of the 6 symbols that it can fit.

    The button is separated into two columns of symbols: A blue A-column, and a cyan B-column. f you simply press the button, you get a. If you hold Shift while pressing the button, you get A. If you hold Alt while pressing the button, you get α, the front-facing symbol. The same is true for the cyan B-coloumn, which is accessed by holding down Opt. So, Opt+button gives b. Opt+Shift+button gives B. And Opt+Alt+button gives β.

    Therefore, by giving up only 3 buttons for Shift, Alt, and Opt, we can fit 6 times as many symbols on the remaining 13 buttons. And by a lucky coincidence we can exactly fit the 26 greek letters by placing two on each button! Perfect.

    We can push this approach even further by allowing certain symbols to have multiple different versions accessible by double-tapping, triple-tapping, or even quadruble-tapping the same button. This is useful for certain symbols like roots (√, ∛, ∜) and integrals (∫, ∬, ∭). It can also be used to negate symbols (∈∉, ∃∄), or to access uppercase-versions of letters (δΔ, θΘ, σΣ).

    Selecting the most commonly used symbols

    This part has been difficult. The goal of the math keyboard is to be as useful as possible to as many people as possible, which means that the symbols that go on the keyboard must be the most commonly used ones. But what is a "common" symbol? I decided to refer to Wikipedia on this matter, with their excellent Glossary of Mathematical Symbols.

    From this article and based on my own experience, I decided on the following groups of symbols (with a few examples in paranthesis):

    • Greek letters (α, β, γ)
    • Comparisons and equivalence (≠, ≈, ≪)
    • Algebra and calculus (∑, ∫, √)
    • Set theory (⋂, ∈, ⊂)
    • Logic (⇔, ∃, ¬)
    • Diacritics and supscripts (◌̂, ◌̃, ◌⁰)
    • Various others (⋅, ±, ∞)

    These groups should hopefully cover most of what a regular mathematician, phycisist, or engineer will need. It is of course likely that many users will miss a few special symbols that they need often, but this is unavoidable.

    The layout

    I eventually decided on the following layout:

    Each key is separated into a light 2x2 top face and a dark 2x1 front face. Each key also has a green main section and blue Alt section.

    The symbols with a red triangle in corner has additional symbols accessible by multi-tapping the key. Double-tapping greek letters gives their uppercase versions if they differ from the Latin alphabet. So double-tapping σ will give you Σ, but double tapping α does nothing since that would...

    Read more »

  • Motivation

    Magne Lauritzen07/05/2022 at 10:18 0 comments

    This log entry relates to the motivation behind creating the mathematical keyboard.

    When you want to type mathematical equations on a computer, you have a set of options.

    • Type it in LaTeX
    • Type it in the Microsoft Office or Apache Open Office equations editor
    • Type it in plaintext for simple equations like α ≤ β ± 2 °C

    The TL;DR is:

    • LaTeX is really flexible but requires practice and memorization of codes
    • Equation editors are flexible but requires a lot of clicking around in menus
    • Plaintext requires copypasting from a source for each symbol 

    In each case, the mathematical keyboard will save the user time by reducing the amount of memorization, clicking, or copypasting, by simply having the codes, symbols, and operators available with a single keystroke.

    Typing in LaTeX

    Of the three, typing in LaTeX is the most flexible and has long been the standard in many scientific fields like mathematics and physics. The downside to LaTeX is that it requires you to memorize LaTeX codes. Often these codes are logical, like `\alpha` to get α, or `\plusminus` to get ±. Other times they can be a bit more obscure, like `\ngtr` for ≯ . And when you get into limits, sup/subscripts, and advanced formatting it quickly gets messy. Let's look at what's needed to type the Fourier Transform definition:

    The LaTeX code for this equation looks as follows:

    \hat{f}(\xi) = \int_{-\infty}^{\infty} f(x)\ e^{-i 2\pi \xi x}\,dx,\quad \forall\ \xi \in \mathbb R

     If you have never written equations in LaTeX this can seem daunting. Many new users of LaTeX spend a good chunk of their time looking up the codes for the symbols they need, and how to make sure they appear in the way they want them to. You'll usually see undergraduate and graduate students alike with LaTeX cheat sheets covering the walls of their study area. A keyboard that automatically writes the correct  codes for commonly used symbols and operators might save them some time.

    Typing in an equations editor

    Typing in the Microsoft Office or Apache Open Office equations editor has the benefit of much of the same flexibility as LaTeX, but with the need for copious amount of clicking around in menus. Typing the Fourier Transform definition in the Word equations editor took me 46 mouse clicks in 5 different menus, and that's the best case after some practice. All this time spent clicking around and looking for the correct symbols in different menus could be reduced by the mathematical keyboard.

    Typing in plaintext

    The Unicode standard defines a large set of mathematical symbols, and it is therefore possible to type simple equations alongside the regular text. This is very useful when you just want to, for example, remind the reader that σ = ±2.2 or that ε ∈ ℂ . You can even define slightly more advanced equations, but there is a limit due to the lack of Unicode support for superscript, subscript, and much more. But if we try to write the Fourier Transform in plaintext we get:

    f̂(ξ) = ∫_(-∞)^∞ f(x)e^(-i2πξx) dx, ∀ ξ∈R 

     Doesn't look too great, but it works. The downside to typing in plaintext is that almost none of the symbols are available to you on a typical keyboard layout. When did you last see a keyboard with an integral sign on it? You will either need to copypaste every symbol from a source like Wikipedia, or memorize their 4-character Unicodes. For example, typing in Alt+222B gives you ∫. But this also requires you have a keyboard with a numpad, which isn't that common anymore. A mathematical keyboard would be hugely useful when you want to type plaintext equations.

View all 2 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates