You are browsing as a guest. Sign up (or log in) to start making projects!

9h 40m 15s logged

calc82: Devlog #5 16/07/2026

calc82: because calculators are for everyone

This devlog mainly follows the addition of algebraic I/O to my calculator. This is just a check-in since I was getting close to 10 hours since the last devlog - I still have some work to do on this aspect before I move on.

🌟 New functionality summary

  • Input and output formatting through KaTeX
  • Fractions and powers formatted correctly in the input
  • Ability to intuitively traverse the input with arrow keys

⚖️ Algebraic IO with KaTeX

I decided on KaTeX because it is both fast (no reflow!) and does not rely on dependencies.

KaTeX is a math formatting library that uses LaTeX commands to create beautiful equations from code.
For example,
\frac{2^{\frac{3}{4}}}{4\sin(30)}\times 2\pi
turns into the attached image.

Input is currently captured directly from the keyboard to build a 1D array of tokens. The tokens are then converted into KaTeX formatting for algebraic display.

In the future, there will also be buttons onscreen as an alternative.

Fractions and powers

Fractions and powers cannot be represented as a single token. Rather, fractions have a beginning, middle and end, and powers have a beginning and end. The program traverses the array to decide where to put them (and take them out for deletion).

🗒️ Notes

The cursor
It is surprisingly difficult to make a vertical bar to act as a cursor in KaTeX, without affecting the spacing of the rest of the expression. For now, I am using a \clap{\rule{0.1em}{0.5em}} for the cursor, but I am looking to replace this with custom CSS in the future.

Replicating exact behaviour?
The fx-82 has some interesting behaviour wherein an empty power is not allowed to exist directly after another power. I am unsure whether I should replicate this - but for now, I am leaving it out.

Dealing with broken LaTeX
I have been able to get the display pretty bulletproof when it comes to not producing broken LaTeX. However, I’m sure there’s something I haven’t run into in debugging! I want to have this be dealt with gracefully rather than blowing up in the user’s face.

📈 Next steps

Immediate:

  • Implement mixed fractions, roots, and Abs to algebraic display
  • Make the input token array able to be parsed into the AST to be calculated

Medium:

  • Multi-line calculation (Ans) and setting variables
  • Implement polar/rectangualr conversion (delayed until UI is more fleshed out)
  • Build UI

Long-term (but getting closer!):

  • Create a usable UX
  • Ship :)
0
1

Comments 0

No comments yet. Be the first!