ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Zhichu Chen" <zhichu.chen@gmail.com>
To: "mailing list for ConTeXt users" <ntg-context@ntg.nl>
Subject: Converting counters?
Date: Tue, 1 Apr 2008 15:18:45 +0800	[thread overview]
Message-ID: <769ba7780804010018n1f4ad1a7kf0c20195877f872a@mail.gmail.com> (raw)


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

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

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

[-- Attachment #2: Type: text/plain, Size: 487 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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

             reply	other threads:[~2008-04-01  7:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-01  7:18 Zhichu Chen [this message]
2008-04-01  7:41 ` Wolfgang Schuster
2008-04-01  7:56   ` Zhichu Chen
2008-04-01  8:49     ` Wolfgang Schuster
2008-04-01  9:04       ` Wolfgang Schuster
2008-04-01 11:37         ` Zhichu Chen
2008-04-02  6:18         ` Wolfgang Schuster

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=769ba7780804010018n1f4ad1a7kf0c20195877f872a@mail.gmail.com \
    --to=zhichu.chen@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).