[NTG-context] An Index problem (repost II)

Hans Hagen pragma at wxs.nl
Tue Mar 6 10:57:18 CET 2007


luigi scarso wrote:
> I have the following
> \starttext
> %%\placemaincontent
> \chapter{AAA}
> \section{Hause one} Foo one \page
> \section{Hause two} Foo  two \page
> \section{Hause three} Foo  three \page
> \section{Hause four} Foo  four\page
> \section{Dog boo} Koo   \page
> \section{Dog foo} Boo \page
> \section{Money ba} Boo \page
> \section{Mail bee} Ugh \page
> \stoptext
> In main content I should like to have
> \bf{AAA} %% no problem here
> \bf{HAUSE} one ..... page x
>  Hause two ..............page x
>  Hause three............page x
>  Hause four ..............page x
> \bf{DOG} boo ...........page x
>  Dog foo.....................page x
> \bf{MONEY} ba.........page x
> \bf{MAIL} bee.............page x
>
> ie, the very first word in bold face and upper case,
> the following in normal face if and only of the very first word was
> equal to the first
> word of actual item (I know, it's strange).
>   
\let\LastSectionEntry\empty

\def\ChapterEntry#1%
  {\global\let\LastSectionEntry\empty
   #1}

\def\SectionEntry#1%
  {\splitstring#1\at{ }\to\PartA\and\PartB
   \doifelse\PartA\LastSectionEntry
     {#1}
     {\global\let\LastSectionEntry\PartA
      {\bf\PartA} \PartB}}

\setuplist[chapter][style=bold,textcommand=\ChapterEntry]
\setuplist[section][textcommand=\SectionEntry]

\starttext
\placelist[chapter,section]
\chapter{AAA}
\section{Hause one} Foo one \page
\section{Hause two} Foo  two \page
\section{Hause three} Foo  three \page
\section{Hause four} Foo  four\page
\section{Dog boo} Koo   \page
\section{Dog foo} Boo \page
\section{Money ba} Boo \page
\section{Mail bee} Ugh \page
\chapter{BBB}
\section{Mail bee} Ugh \page
\section{Mail bee} Ugh \page
\section{Mail bee} Ugh \page
\stoptext



-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------



More information about the ntg-context mailing list