The unfulfilling fight against nested parentheses

Hi all, in my work I use a lot of trigonometric functions. For example, in one of my projects I had the following formula:

(z/abs(z))atan((abs((xsin(z/2))²-(y/2)²)^(1/2))/(xcos(z/2)))*

The Expression component is great but it lacks coloring for nested parentheses which would make life much, much easier.
After spending twenty minutes counting the parentheses for this formula, I thought I would try doing it in notepad++ and copy/paste it but it is supposed to be used for programming and you have to define a programing language in order to color code and I couldn’t find anything good (It has a loooong list of languages)

I am thinking of four solutions:

  1. somebody knows what language I should select in Notepad++ that is best for this kind of annotation. I know you can define your own but that means having to to make a rule for each and every operator. That would be an entire operation on its own.
  2. somebody knows another application that can do that.
  3. pray to the gods of grasshopper (cough cough @DavidRutten) to add this behavior (at least as an option) to expression.
  4. something I can’t imagine but somebody out there knows.

any ideas?

One way to illustrate this could be to underline them, but then nested parenthesis would eat up a bit more vertical space. Could be worth it though.

Cludgy, but if you paste the expression into a Python component and select a parenthesis, then the matching parenthesis is indicated:

Or implement a Reverse Polish expression and do away with pesky parentheses!

Coloring is a very good idea. Read an expression this long is painful.

image
I just googled it for a few seconds and I’m afraid to go down that rabbit hole! :slight_smile:

yes, you have this behavior in notepad++ as well but it would be much more intuitive to have a constant color coding as with programing languages.

I have also had this problem in the past with particularly massive expressions. It’s enough to make me want to break into Desmos’ source code and steal their LaTeX typesetting system.

Honestly though, Desmos’ system would be the gold standard for the functionality of this component.

@anikolo this makes sense, I’ve added RH-75556 Make expressions easier to read by adding colors to parenthesis pairs

3 Likes

This is good news, thanks!