Subject: Re: bug#44799: 28.0.50; Calc: Meter not printed as \text in latex output

From: Mattias Engdegård <[email-masked]>
Date: Mon, 23 Nov 2020 11:26:00 +0100

22 nov. 2020 kl. 22.12 skrev Michael Heerdegen <[email-masked]>:

> Ah, so there can be a variable and a unit of the same name at the same
> time?  I can s s a variable "m".  Is it good to allow this?  I mean it's
> good that meters is "m" as expected but if someone wants to use "m" as a
> variable in the same formula it necessarily gets ugly.

Given the number of units, it seems difficult to disallow using the same symbols as variables. Many innocent-looking single-letter names are units: s, N, m, A, V, W, J, g, l, ...
For instance, 'e' both has a value (2.7something) and is a unit (electron charge).

Variables in Calc include not only names having an assigned concrete value, but also variables in the wider mathematical sense since Calc is capable of some symbolic computing. Units of measurement just use the same mechanism and are treated as any other variables in all computation except for operations explicitly related to units such as 'u s'.

A serious reform seems unlikely unless someone really is willing to do the work. More realistic might be adding a way to tell Calc which variables you want to have typeset as units, as this can vary from person to person and time to time.

> BTW, do you know (Bug#30231) why allowed characters in units are
> restricted?

No idea, but isn't it just the restriction of variable symbols in general? Unless they already play some syntactic role I suppose we could be more permissive. Currency symbols like €, ¥ and $ appear to be of special interest, but $ already has a special meaning.