ConTeXt 문서의 다른 곳에 나타나는 목록에 나타나는 항목을 정의하는 방법은 무엇입니까?

ConTeXt 문서의 다른 곳에 나타나는 목록에 나타나는 항목을 정의하는 방법은 무엇입니까?

각 장의 앞에 요약을 표시하는 문서가 있습니다. 요약에는 나중에 구절 전반에 걸쳐 나타나는 중요한 사항이 나열됩니다.

예를 들어:

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

이는 다음을 생성합니다.

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

를 사용한다는 \definetopic{How to build a temporary bridge from stones.}것은 해당 단어가 목록에 추가되고 장 시작 부분의 요약에 나타나는 것을 의미합니다.

장의 시작 부분에 나타나는 목록에 추가할 항목을 정의하고 ConTeXt의 문서 텍스트 내에서 항목을 정의하려면 어떻게 해야 합니까?

답변1

이 목적을 위해 장-로컬 목록을 정의할 수 있습니다.

\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

여기에 이미지 설명을 입력하세요

관련 정보