From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/39772 Path: news.gmane.org!not-for-mail From: "Zhichu Chen" Newsgroups: gmane.comp.tex.context Subject: Re: Converting counters? Date: Tue, 1 Apr 2008 15:56:16 +0800 Message-ID: <769ba7780804010056n370caa3ele529f95cf5711771@mail.gmail.com> References: <769ba7780804010018n1f4ad1a7kf0c20195877f872a@mail.gmail.com> <115224fb0804010041s17d4da00t3564f57209abf8ee@mail.gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2110149938==" X-Trace: ger.gmane.org 1207038633 19252 80.91.229.12 (1 Apr 2008 08:30:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 1 Apr 2008 08:30:33 +0000 (UTC) To: "mailing list for ConTeXt users" Original-X-From: ntg-context-bounces@ntg.nl Tue Apr 01 10:31:01 2008 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1JgbtQ-0008Ok-G3 for gctc-ntg-context-518@m.gmane.org; Tue, 01 Apr 2008 10:30:56 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id A45D51FC77; Tue, 1 Apr 2008 10:30:17 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 06412-01-24; Tue, 1 Apr 2008 10:30:17 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 0CD961FBBA; Tue, 1 Apr 2008 09:57:06 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id B810C1FBB5 for ; Tue, 1 Apr 2008 09:57:03 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 32615-09-10 for ; Tue, 1 Apr 2008 09:56:18 +0200 (CEST) Original-Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.168]) by ronja.ntg.nl (Postfix) with ESMTP id EB39E1FBBA for ; Tue, 1 Apr 2008 09:56:17 +0200 (CEST) Original-Received: by wf-out-1314.google.com with SMTP id 23so2284153wfg.5 for ; Tue, 01 Apr 2008 00:56:17 -0700 (PDT) Original-Received: by 10.142.241.10 with SMTP id o10mr4457186wfh.217.1207036576962; Tue, 01 Apr 2008 00:56:16 -0700 (PDT) Original-Received: by 10.143.165.19 with HTTP; Tue, 1 Apr 2008 00:56:16 -0700 (PDT) In-Reply-To: <115224fb0804010041s17d4da00t3564f57209abf8ee@mail.gmail.com> X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:39772 Archived-At: --===============2110149938== Content-Type: multipart/alternative; boundary="----=_Part_18114_10786875.1207036576958" ------=_Part_18114_10786875.1207036576958 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Yes, only I don't need that complex. I mean \chinesenumber{123} will give "one hundred and twenty-three" but all I want is "one two three." Besides, I don't like to copy such long codes since I really don't want to load font-chi.tex which gives weird spacing problems while typesetting Chinese along with English. Anyway, I'd love to learn something rather than to use something. Thanks. On Tue, Apr 1, 2008 at 3:41 PM, Wolfgang Schuster < schuster.wolfgang@googlemail.com> wrote: > Hi Chen, > > You could use \chinesenumber from font-chi.tex > > Wolfgang > > On Tue, Apr 1, 2008 at 9:18 AM, Zhichu Chen wrote: > > Hi, > > > > I'm trying to convert the counter to Chinese character one on one, like > > 0->a, 1->b, etc., so 10 will be "ba" (I use a, b, c, . . . to denote the > > Chinese > > glyphs which makes more sense for you). I used some codes like: > > ====================================================== > > \def\ChineseZero {o} > > \def\ChineseOne {a} > > \def\ChineseTwo {b} > > \def\ChineseThree{c} > > \def\ChineseFour {d} > > \def\ChineseFive {e} > > \def\ChineseSix {f} > > \def\ChineseSeven{g} > > \def\ChineseEight{h} > > \def\ChineseNine {i} > > > > \unexpanded\def\zhnumber > > {\bgroup > > \catcode`\0=\active \uccode`\~=`\0 \uppercase{\let~\ChineseZero}% > > \catcode`\1=\active \uccode`\~=`\1 \uppercase{\let~\ChineseOne}% > > \catcode`\2=\active \uccode`\~=`\2 \uppercase{\let~\ChineseTwo}% > > \catcode`\3=\active \uccode`\~=`\3 \uppercase{\let~\ChineseThree}% > > \catcode`\4=\active \uccode`\~=`\4 \uppercase{\let~\ChineseFour}% > > \catcode`\5=\active \uccode`\~=`\5 \uppercase{\let~\ChineseFive}% > > \catcode`\6=\active \uccode`\~=`\6 \uppercase{\let~\ChineseSix}% > > \catcode`\7=\active \uccode`\~=`\7 \uppercase{\let~\ChineseSeven}% > > \catcode`\8=\active \uccode`\~=`\8 \uppercase{\let~\ChineseEight}% > > \catcode`\9=\active \uccode`\~=`\9 \uppercase{\let~\ChineseNine}% > > \loggingall > > \dozhnumber } > > > > \def\stripunwantedspaces{} > > > > \def\dozhnumber#1% > > {\expandafter\scantokens\expandafter > > {\detokenize{#1\stripunwantedspaces}}\egroup} > > ====================================================== > > It works fine with \zhnumber{15}, it gives "ae" which is exactly what I > > want. > > But it won't work in the following situation: > > ++++++++++++++++++++++++++ > > \newcount\tcpageno > > \advance\tcpageno15 > > \zhnumber{\number\tcpageno} > > ++++++++++++++++++++++++++ > > I know it's not weird, I just don't know how to expand the counter to > > number. > > > > > > Thank you in advance. > > > > -- > > Best Regards > > Chen > > ___________________________________________________________________________________ > 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://tex.aanhet.net > archive : https://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > > ___________________________________________________________________________________ > -- Best Regards Chen ---------------------------------------------------------------- Zhi-chu Chen | Shanghai Synchrotron Radiation Facility No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China tel: 086 21 5955 3405 | zhichu.chen.googlepages.com | www.sinap.ac.cn ---------------------------------------------------------------- ------=_Part_18114_10786875.1207036576958 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Yes, only I don't need that complex. I mean \chinesenumber{123} will give
"one hundred and twenty-three" but all I want is "one two three." Besides,
I don't like to copy such long codes since I really don't want to load font-chi.tex
which gives weird spacing problems while typesetting Chinese along with
English. Anyway, I'd love to learn something rather than to use something.

Thanks.

On Tue, Apr 1, 2008 at 3:41 PM, Wolfgang Schuster <schuster.wolfgang@googlemail.com> wrote:
Hi Chen,

You could use \chinesenumber from font-chi.tex

Wolfgang

On Tue, Apr 1, 2008 at 9:18 AM, Zhichu Chen <zhichu.chen@gmail.com> wrote:
> Hi,
>
> I'm trying to convert the counter to Chinese character one on one, like
> 0->a, 1->b, etc., so 10 will be "ba" (I use a, b, c, . . . to denote the
> Chinese
> glyphs which makes more sense for you). I used some codes like:
> ======================================================
> \def\ChineseZero {o}
> \def\ChineseOne  {a}
> \def\ChineseTwo  {b}
> \def\ChineseThree{c}
> \def\ChineseFour {d}
> \def\ChineseFive {e}
> \def\ChineseSix  {f}
> \def\ChineseSeven{g}
> \def\ChineseEight{h}
> \def\ChineseNine {i}
>
> \unexpanded\def\zhnumber
>   {\bgroup
>    \catcode`\0=\active \uccode`\~=`\0 \uppercase{\let~\ChineseZero}%
>    \catcode`\1=\active \uccode`\~=`\1 \uppercase{\let~\ChineseOne}%
>    \catcode`\2=\active \uccode`\~=`\2 \uppercase{\let~\ChineseTwo}%
>    \catcode`\3=\active \uccode`\~=`\3 \uppercase{\let~\ChineseThree}%
>    \catcode`\4=\active \uccode`\~=`\4 \uppercase{\let~\ChineseFour}%
>    \catcode`\5=\active \uccode`\~=`\5 \uppercase{\let~\ChineseFive}%
>    \catcode`\6=\active \uccode`\~=`\6 \uppercase{\let~\ChineseSix}%
>    \catcode`\7=\active \uccode`\~=`\7 \uppercase{\let~\ChineseSeven}%
>    \catcode`\8=\active \uccode`\~=`\8 \uppercase{\let~\ChineseEight}%
>    \catcode`\9=\active \uccode`\~=`\9 \uppercase{\let~\ChineseNine}%
>    \loggingall
>    \dozhnumber }
>
> \def\stripunwantedspaces{}
>
> \def\dozhnumber#1%
>   {\expandafter\scantokens\expandafter
>         {\detokenize{#1\stripunwantedspaces}}\egroup}
> ======================================================
> It works fine with \zhnumber{15}, it gives "ae" which is exactly what I
> want.
> But it won't work in the following situation:
> ++++++++++++++++++++++++++
> \newcount\tcpageno
> \advance\tcpageno15
> \zhnumber{\number\tcpageno}
> ++++++++++++++++++++++++++
> I know it's not weird, I just don't know how to expand the counter to
> number.
>
>
> Thank you in advance.
>
> --
> Best Regards
> Chen
___________________________________________________________________________________
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________



--
Best Regards
Chen
----------------------------------------------------------------

Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
| www.sinap.ac.cn
---------------------------------------------------------------- ------=_Part_18114_10786875.1207036576958-- --===============2110149938== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --===============2110149938==--