ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Jairo A. del Rio" <jairoadelrio6@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Two questions concerning numerals in ConTeXt
Date: Mon, 1 Jun 2020 23:25:55 -0500	[thread overview]
Message-ID: <CAKyqqaaxQHLXBPc56maPfRa8YJn-YGVFkXcaWNRRjJtKUppkAw@mail.gmail.com> (raw)


[-- 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
___________________________________________________________________________________

                 reply	other threads:[~2020-06-02  4:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKyqqaaxQHLXBPc56maPfRa8YJn-YGVFkXcaWNRRjJtKUppkAw@mail.gmail.com \
    --to=jairoadelrio6@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).