ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Two questions concerning numerals in ConTeXt
@ 2020-06-02  4:25 Jairo A. del Rio
  0 siblings, 0 replies; only message in thread
From: Jairo A. del Rio @ 2020-06-02  4:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1665 bytes --]

Hi, everybody. I expect you to be safe.

I found the following issues.

*First. *The following gives wrong results for Spanish numbers

\mainlanguage[es]
\starttext
\convertnumber{words}{100}
%Prints "ciento" instead of "cien"
\convertnumber{words}{2000000}
%Prints "dos millón" instead of "dos millones"
\stoptext

I've read other messages from the list concerning numerals and I found the
following in core-con.lua

[100] = "ciento",
[1000000] = "millón",
[1000000000] = "mil millones",
[1000000000000] = "billón",

"cien" (for numbers from 100 to 199) and "millones" (for numbers from 2 000
000 to 999 999 999 999) are missing (no issue with "billón", as Lua doesn't
seem to handle too big numbers natively).

*Second. *I tried to use Unicode tally marks (U1D377 and U1D378):

\definefont[tallyfont][babelstonehan]
%\mainlanguage[es]
\startluacode
userdata = userdata or {}
userdata.tallymarks = function(n)
local one  = [[\char"1D377]]
--Also tried "\u{1D377}"
local five = [[\char"1D378]]
--Also tried "\u{1D377}"
return string.rep(five, (tonumber(n)//5))..string.rep(one, (tonumber(n)%5))
end
\stopluacode
\def\tallymarks#1{\ctxlua{userdata.tallymarks("#1")}}
\starttext
\tallyfont \tallymarks{47}
\stoptext

This works on Lua 5.4.0 (rc4) interpreter, but it doen't on ConTeXt LMTX
nor LuaTeX and codes are printed instead (1D3781D378...). What is weird
considering that

\starttext
\char"1D377
\stoptext

gives the right output with an adequate font. Btw, I know about the Metafun
alternative described on the book, but I'd prefer to use Unicode when
possible.

Thank you in advance.

Jairo :D

[-- Attachment #1.2: Type: text/html, Size: 2376 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-02  4:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-02  4:25 Two questions concerning numerals in ConTeXt Jairo A. del Rio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).