At 2021-10-26T17:19:56-0700, Dale Snell wrote: > On Tue, Oct 26, 2021 at 2:38 PM Peter Schaffter <pe...@schaffter.ca> wrote: > > Second question, maybe not so trivial. Is it > > acceptable to use a comma for decimal fractions that > > are arguments to requests and macros (say .ps 12,5 > > instead of .ps 12.5) if a user's locale supports it?
I believe the answer is 'no'. > That’s a very interesting question, but alas, I don’t > know the answer. Is groff written to pay attention to > localization at all? I don’t know. GNU troff, the formatter, does call setlocale(3), but only to collect the value of `LC_CTYPE` from the environment[1]. The parsing of numeric values, as far as I can tell, recognizes only a dot as a decimal separator, and that only in arguments to requests and escapes[2]. This seems like a sound choice to me to keep the input language (not the language of the document text) consistent and portable. In general, groff, like troff before it, avoids non-integer arithmetic. Example: $ groff -Tps -z .tm \n[.ps] 10000 \s[10.25] .tm \n[.ps] 10250 .ps 8.75z .tm \n[.ps] 8750 Regards, Branden [1] https://git.savannah.gnu.org/cgit/groff.git/tree/src/roff/troff/input.cpp#n8019 [2] https://git.savannah.gnu.org/cgit/groff.git/tree/src/roff/troff/number.cpp#n490 https://git.savannah.gnu.org/cgit/groff.git/tree/src/roff/troff/number.cpp#n490
signature.asc
Description: PGP signature