ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "luigi scarso" <luigi.scarso@gmail.com>
Subject: Re: Register with numeric values
Date: Wed, 26 Apr 2006 17:47:12 +0200	[thread overview]
Message-ID: <fe8d59da0604260847h72969506h9cde04a1ec6792f3@mail.gmail.com> (raw)
In-Reply-To: <444E9E08.6010108@wxs.nl>

I make an example here:
%% BEGIN %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setupinteraction[state=start]
\setupcolors[state=start]
\definecolor[BackBrand][black]
\definecolor[Brand][white]

\newcount\ICfdigit
\newif\ifDoZero   \DoZerotrue
\newif\ifDoOne	  \DoOnetrue
\newif\ifDoTwo	  \DoTwotrue
\newif\ifDoThree  \DoThreetrue
\newif\ifDoFour	  \DoFourtrue
\newif\ifDoFive	  \DoFivetrue
\newif\ifDoSix	  \DoSixtrue
\newif\ifDoSeven  \DoSeventrue
\newif\ifDoEight \DoEighttrue
\newif\ifDoNine   \DoNinetrue
\newif\ifDoOtherDig   \DoOtherDigtrue

\defineregister[IndexCode][IndexCodes]
\def\ICTextCommand#1{%
\getfirstcharacter{#1}\ICfdigit=\firstcharacter%
\ifcase\firstcharacter %%\ICfdigit %% 0
\ifDoZero\global\DoZerofalse\ICHeadLetterCommand{0}\fi
\or%% 1
\ifDoOne\global\DoOnefalse\ICHeadLetterCommand{1}\fi
\or%% 2
\ifDoTwo\global\DoTwofalse\ICHeadLetterCommand{2}\fi
\or%% 3
\ifDoThree\global\DoThreefalse\ICHeadLetterCommand{3}\fi
\or%% 4
\ifDoFour\global\DoFourfalse\ICHeadLetterCommand{4}\fi
\or%% 5
\ifDoFive\global\DoFivefalse\ICHeadLetterCommand{5}\fi
\or%% 6
\ifDoSix\global\DoSixfalse\ICHeadLetterCommand{6}\fi
\or%% 7
\ifDoSeven\global\DoSevenfalse\ICHeadLetterCommand{7}\fi
\or%% 8
\ifDoEight\global\DoEightfalse\ICHeadLetterCommand{8}\fi
\or%% 9
\ifDoNine\global\DoNinefalse\ICHeadLetterCommand{9}\fi
\else
\ifDoOtherDig\global\DoOtherDigfalse\ICHeadLetterCommandSym{$\bigstar$}{*}\fi
\fi%
\hskip1sp#1%
}%%
\def\ICPageCommand#1{\relax}
%
\def\ICHeadLetterCommand#1{%
\blank
\framed[strut=no,width=2em,height=2em,background=color,backgroundcolor=BackBrand,foregroundcolor=Brand]{\bfb
#1\pagereference[IndexCode:NR#1]}\par\nobreak}
%
\def\ICHeadLetterCommandSym#1#2{%
\blank
\framed[strut=no,width=2em,height=2em,background=color,backgroundcolor=BackBrand,foregroundcolor=Brand]{\bfb
#1\pagereference[IndexCode:NR#2]}\par\nobreak}
\def\ICHeadLetterOtherCommand#1{\relax}
%%%%%
\setupregister[IndexCode][n=2,
                         align=yes,
			 balance=no,
                         symbol=1,
                         %distance=0pt,
                         %expand=no,
                         %distance=0bp,
			 %partnumber=no,
			 %indicator=yes,
			 %% interaction=text,
                         textstyle={\tfa},
			 textcommand={\ICTextCommand},
			 %% pagecommand={\ICPageCommand},
			 command={\ICHeadLetterOtherCommand},%
                         ]

\def\ICLetterEntry#1{%
\bTD
\doifreferencepermittedelse{IndexCode:NR#1}{%
\goto{\framed[strut=no,width=2em,height=2em,background=color,backgroundcolor=BackBrand,foregroundcolor=Brand]{\bfb
#1}}[IndexCode:NR#1]}
{\framed[strut=no,width=2em,height=2em,background=color,backgroundcolor=BackBrand,foregroundcolor=Brand]{\bfb}}
\eTD%
}

\def\ICLetterEntrySymbol#1#2{%
\bTD
\doifreferencepermittedelse{IndexCode:NR#2}{%
\goto{\framed[strut=no,width=2em,height=2em,background=color,backgroundcolor=BackBrand,foregroundcolor=Brand]{\bfb
#1}}[IndexCode:NR#2]}
{\framed[strut=no,width=2em,height=2em,background=color,backgroundcolor=BackBrand,foregroundcolor=Brand]{}}
\eTD%
}

\def\PutICLetterEntry{%
\setupTABLE[frame=off]
\bTABLE
\bTR
\ICLetterEntry{0}\ICLetterEntry{1}\ICLetterEntry{2}\ICLetterEntry{3}%
\ICLetterEntry{4}\ICLetterEntry{5}\ICLetterEntry{6}\ICLetterEntry{7}
\eTR
\bTR
\ICLetterEntry{8}\ICLetterEntry{9}\ICLetterEntrySymbol{$\bigstar$}{*}%
\eTR\eTABLE
}


\starttext
\IndexCode{00328273}    {00328273}            \par
\IndexCode{12328273}    {12328273}            \par
\IndexCode{2328273}	{2328273}             \par
\IndexCode{3328273}	{3328273}             \par
\IndexCode{3334328273}	{3334328273}          \par
\IndexCode{4}		{4}                   \par
\IndexCode{5553}	{5553}                \par
\IndexCode{644328273}	{644328273}           \page
\IndexCode{844328273}	{844328273}           \par
\IndexCode{944328273}	{944328273}           \par
\IndexCode{944328273}	{944328273}           \par
\IndexCode{944328273}	{944328273}           \par

\page
{\tfd TEST }\par
\PutICLetterEntry\par
\page
\placeIndexCode

\stoptext
%% END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> you can file a feature request to treat numbers 'as characters'
>
> Hans
Sorry, I don't understand that.

      reply	other threads:[~2006-04-26 15:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-24 12:33 luigi scarso
2006-04-25 22:09 ` Hans Hagen
2006-04-26 15:47   ` luigi scarso [this message]

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=fe8d59da0604260847h72969506h9cde04a1ec6792f3@mail.gmail.com \
    --to=luigi.scarso@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).