GNU bug report logs -
#44799
28.0.50; Calc: Meter not printed as \text in latex output
Previous Next
To reply to this bug, email your comments to 44799 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#44799
; Package
emacs
.
(Sun, 22 Nov 2020 15:21:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Michael Heerdegen <michael_heerdegen <at> web.de>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 22 Nov 2020 15:21:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hello,
in Calc, C-u d L to switch to latex language with \text{} printed units.
`min' for example is then printed "\text{min}" but (bug) Meter still
"m". AFAIU, the printing code assumes that any unit has at least two
characters, which is obviously not the case for some units.
TIA,
Michael.
In GNU Emacs 28.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.23, cairo version 1.16.0)
of 2020-11-22 built on drachen
Repository revision: ce5458fe6eeb37df37119d04228ac7fcd5d39236
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: Debian GNU/Linux bullseye/sid
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#44799
; Package
emacs
.
(Sun, 22 Nov 2020 16:39:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 44799 <at> debbugs.gnu.org (full text, mbox):
It seems to be a heuristic for distinguishing units from variables, both of which unfortunately have the same representation in Calc. We could make it more precise by looking in the unit table (and allow for prefixes), but it would mean that a variable 'm' would always look like a unit. I'm afraid I have no other good solution at hand.
For that matter, shouldn't units use \mathrm{} rather than \text{} ?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#44799
; Package
emacs
.
(Sun, 22 Nov 2020 21:13:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 44799 <at> debbugs.gnu.org (full text, mbox):
Mattias Engdegård <mattiase <at> acm.org> writes:
> It seems to be a heuristic for distinguishing units from variables,
> both of which unfortunately have the same representation in Calc. We
> could make it more precise by looking in the unit table (and allow for
> prefixes), but it would mean that a variable 'm' would always look
> like a unit. I'm afraid I have no other good solution at hand.
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.
> For that matter, shouldn't units use \mathrm{} rather than \text{} ?
I dunno. latex language mode has several submodes (see
`calc-latex-language'), but none of them uses that.
BTW, do you know (Bug#30231) why allowed characters in units are
restricted?
Thanks,
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#44799
; Package
emacs
.
(Mon, 23 Nov 2020 10:27:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 44799 <at> debbugs.gnu.org (full text, mbox):
22 nov. 2020 kl. 22.12 skrev Michael Heerdegen <michael_heerdegen <at> web.de>:
> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#44799
; Package
emacs
.
(Mon, 23 Nov 2020 12:18:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 44799 <at> debbugs.gnu.org (full text, mbox):
Mattias Engdegård <mattiase <at> acm.org> writes:
> 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.
Would it be possible to make output syntax depend on how the symbol is
actually interpreted by Calc in the given context?
> > 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?
You mean, in Calc? Then I wonder why we have that restriction.
Regards,
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#44799
; Package
emacs
.
(Mon, 23 Nov 2020 13:53:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 44799 <at> debbugs.gnu.org (full text, mbox):
23 nov. 2020 kl. 13.16 skrev Michael Heerdegen <michael_heerdegen <at> web.de>:
> Would it be possible to make output syntax depend on how the symbol is
> actually interpreted by Calc in the given context?
Not sure if that is even possible. For example, adding 2 m and 3 m gives 5 m, and Calc doesn't care whether m is a variable or unit here.
>>> 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?
>
> You mean, in Calc? Then I wonder why we have that restriction.
Again, it's probably a matter of history. Calc is old and may even predate full Unicode support in Emacs.
Latin and Greek letters suffice for the vast majority of units; the only major exceptions I can think of are Å and ° (for the angle and °C). Same goes for variables, although diacritics could be useful. Then there are currencies, but as mentioned, $ has special meaning and cannot be used.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#44799
; Package
emacs
.
(Mon, 23 Nov 2020 14:23:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 44799 <at> debbugs.gnu.org (full text, mbox):
Mattias Engdegård <mattiase <at> acm.org> writes:
> > Would it be possible to make output syntax depend on how the symbol is
> > actually interpreted by Calc in the given context?
>
> Not sure if that is even possible. For example, adding 2 m and 3 m
> gives 5 m, and Calc doesn't care whether m is a variable or unit here.
You are probably right. Why don't we then just print all symbol names
as we do for units now? In mathematical contexts variables like in $v$
are printed as Calc currently prints units.
> Latin and Greek letters suffice for the vast majority of units; the
> only major exceptions I can think of are Å and ° (for the angle and
> °C). Same goes for variables, although diacritics could be
> useful. Then there are currencies, but as mentioned, $ has special
> meaning and cannot be used.
There are variants of the latin alphabet including the same letters
looking a bit different. People may also want to use these. I don't
see a reason to exclude anything...oh wait, ok, the characters must be
compatible with all supported language modes, that may be the reason for
the restrictions.
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#44799
; Package
emacs
.
(Mon, 23 Nov 2020 15:14:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 44799 <at> debbugs.gnu.org (full text, mbox):
23 nov. 2020 kl. 15.20 skrev Michael Heerdegen <michael_heerdegen <at> web.de>:
> You are probably right. Why don't we then just print all symbol names
> as we do for units now? In mathematical contexts variables like in $v$
> are printed as Calc currently prints units.
It's a matter of taste -- most (La)TeX users probably prefer variables in italic as usual.
For that matter, Calc's unit typesetting has more flaws that you may want to fix while you are at it. It omits the space between the number and the unit, normally written something like $9.8\ \mathrm{m/s^2}$. It also gives the unsightly \frac{23 m}{s} instead of the expected 23\ \mathrm{m/s}.
> There are variants of the latin alphabet including the same letters
> looking a bit different.
Right. I don't know how often they are used in Calc formulae though, but why not.
This bug report was last modified 4 years and 262 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.