Proektsoftbg / Calcpad

Free and open source software for mathematical and engineering calculations.
https://calcpad.eu
MIT License
372 stars 45 forks source link

Units more separated from variables #298

Open FEA-eng opened 7 months ago

FEA-eng commented 7 months ago

Hi,

currently, units are entered like variables and only differ by the color. So when typing an equation, some variables have to be defined while others (whose symbols are the same as those of some units) are treated as units. It can become a bit confusing with larger equations when you get a result (incorrect one) even though a variable is undefined (because it's treated as a unit). Thus, I would like to suggest an optional (many users may not like it if it's obligatory) key stroke to enter units. Like in SMath where you have to press ' first before adding a unit symbol. Maybe it could also add space between the value and the unit (after all, that's the correct notation for msot units). I hope that it makes sense.

Proektsoftbg commented 7 months ago

Hi! Maybe you are using an older version. :)

There is such an option already. Type a dot "." before the name to force it to be unit and make difference in case you have a variable with the same name. Also variables are italic and units are normal style. There is also a space before the unit.

image

FEA-eng commented 7 months ago

There is such an option already. Type a dot "." before the name to force it to be unit and make difference in case you have a variable with the same name.

Thanks for the reply. I was thinking about something a bit different - adding an option to enable a mode where you are forced to press an additional key to enter a unit (e.g. you press ' or . and only then m becomes a unit). I know that many people wouldn't like it because it would increase the number of necessary key strokes so it should be optional. The benefit would be no more confusion and variables becoming units before they are defined (I often enter the equation first and then define its variables). Maybe it's not worth implementing but I thought that it could make sense to make it work similar to SMath. The ' or . symbol could even disappear for clarity or it could be a mode where you have to hold some key when adding a unit.

There is also a space before the unit.

Right, it just appears to be small sometimes so I thought there was no space ;-)