This code, found at How to define items appearing in a list, which appears somewhere else in the document in ConTeXt?, allows users to add items to a list by using the code \definetopic{}
:
\definelist
[topics]
[criterium=chapter,
headnumber=always,
pagenumber=no]
\definecounter
[topic]
[way=bychapter]
\define[1]\definetopic{%
\incrementcounter[topic]%
\writetolist[topics]{\rawcountervalue[topic]}{#1}}
\starttext
\startchapter[title=Foo]
This chapter will talk about:
\placelist[topics]
\startsection[title=Bar]
\definetopic{How to build a temporary bridge from stones.}%
\input knuth
\definetopic{How to hunt for rabbits.}%
\input knuth
\definetopic{How to find firewood.}%
\input knuth
\stopsection
\stopchapter
\startchapter[title=Foo]
This chapter will talk about:
\placelist[topics]
\startsection[title=Bar]
\definetopic{How to hunt for rabbits.}%
\input knuth
\stopsection
\stopchapter
\stoptext
Sometimes my source code calls for the same information to be added to a list, multiple times, e.g.:
\chapter{One}
\definetopic{This is about rabbits.}
\definetopic{This is about birds.}
\definetopic{This is about rabbits.}
In such a case, I don't want the item to appear twice when calling \placelist[topics]
. Is there any way to remove duplicate items from this list?
register
rather than alist
.\startitemize
and\enditemize
?