From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/39768 Path: news.gmane.org!not-for-mail From: "Zhichu Chen" Newsgroups: gmane.comp.tex.context Subject: Converting counters? Date: Tue, 1 Apr 2008 15:18:45 +0800 Message-ID: <769ba7780804010018n1f4ad1a7kf0c20195877f872a@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="===============0430742926==" X-Trace: ger.gmane.org 1207034426 6525 80.91.229.12 (1 Apr 2008 07:20:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 1 Apr 2008 07:20:26 +0000 (UTC) To: "mailing list for ConTeXt users" Original-X-From: ntg-context-bounces@ntg.nl Tue Apr 01 09:20:54 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 1JganZ-000651-OB for gctc-ntg-context-518@m.gmane.org; Tue, 01 Apr 2008 09:20:49 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id BD4BE1FB4E; Tue, 1 Apr 2008 09:20:08 +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 28778-01-6; Tue, 1 Apr 2008 09:19:26 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 88AA71FB95; Tue, 1 Apr 2008 09:19:26 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 061CF1FB1D for ; Tue, 1 Apr 2008 09:19:24 +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 26793-04-6 for ; Tue, 1 Apr 2008 09:18:49 +0200 (CEST) Original-Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.170]) by ronja.ntg.nl (Postfix) with ESMTP id A53471FBA8 for ; Tue, 1 Apr 2008 09:18:48 +0200 (CEST) Original-Received: by wf-out-1314.google.com with SMTP id 23so2266624wfg.5 for ; Tue, 01 Apr 2008 00:18:45 -0700 (PDT) Original-Received: by 10.142.172.12 with SMTP id u12mr4521324wfe.16.1207034325120; Tue, 01 Apr 2008 00:18:45 -0700 (PDT) Original-Received: by 10.143.165.19 with HTTP; Tue, 1 Apr 2008 00:18:45 -0700 (PDT) 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:39768 Archived-At: --===============0430742926== Content-Type: multipart/alternative; boundary="----=_Part_18091_16922744.1207034325123" ------=_Part_18091_16922744.1207034325123 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 ---------------------------------------------------------------- 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_18091_16922744.1207034325123 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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
----------------------------------------------------------------

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_18091_16922744.1207034325123-- --===============0430742926== 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 ___________________________________________________________________________________ --===============0430742926==--