
Tengo un documento que mostrará un resumen al principio de cada capítulo. El resumen enumerará puntos importantes que aparecerán más adelante a lo largo de los pasajes.
Por ejemplo:
This chapter will talk about:
\printtopics
Section 1
Building a bridge is very easy. First start with some stones. Then,
\definetopic{How to build a temporary bridge from stones.}
find a narrow area in a river. Throw the stones into the river
until the river has completely stopped.
...
Esto produciría:
This chapter will talk about:
1. How to build a temporary bridge from stones.
2. How to hunt for rabbits.
3. How to find firewood.
Section 1
Building a bridge is very easy. First start with some stones. Then,
find a narrow area in a river. Throw the stones into the river
until the river has completely stopped.
...
El uso de \definetopic{How to build a temporary bridge from stones.}
significa que esas palabras se agregan a la lista y aparecen en el resumen al comienzo del capítulo.
¿Cómo puedo definir elementos que se agregarán a una lista, que aparecen al comienzo de un capítulo, pero definirlos dentro del texto del documento, en ConTeXt?
Respuesta1
Puede definir una lista local de capítulos para este propósito.
\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