Am 08.11.2012 um 00:29 schrieb Marco Patzer
Hi!
How do I highlight the current chapter in the table of contents? The TOC is displayed on each page. For illustration I misused the interaction colour, which of course only works for the first page of a chapter.
\setupheadertexts [\setups{headlist}]
\startsetups [headlist] \framed[align=normal, frame=off] {\placelist [chapter] [alternative=f, criterium=all]} \stopsetups
\setupinteraction [state=start, color=lightgray, contrastcolor=darkgreen]
\starttext \startchapter [title=alpha] \stopchapter \startchapter [title=beta] \page\input knuth \stopchapter \startchapter [title=gamma] \stopchapter \stoptext
You can use the marking mechanism to get the title of the current chapter. The problem for the solution below is to get a expandable version of the list entry because \currentlistentrytitle itself isn’t expandable and can’t be used in \doifelse. Instead of using \ctxcommand better ask Hans for a raw/expandable version of the tile/pagenumber commands. \setupheadertexts [\setups{headlist}] \startsetups [headlist] \framed[align=normal, frame=off] {\placelist [chapter] [alternative=highlight, criterium=all]} \stopsetups \definelistalternative [highlight] [renderingsetup=list:highlight] \startsetups [list:highlight] \par \startlinealignment[middle] \doifelse{\fetchmark[chapter][first]}{\currentlistentrytitle} %\doifelse{\fetchmark[chapter][first]}{\ctxcommand{listtitle("\currentlist",\currentlistindex)}} {\color[red] {\currentlistentrytitle}} {\color[blue]{\currentlistentrytitle}} \stoplinealignment \par \stopsetups \setupinteraction [state=start, color=lightgray, contrastcolor=darkgreen] \starttext \startchapter [title=alpha] \stopchapter \startchapter [title=beta] \page\input knuth \stopchapter \startchapter [title=gamma] \stopchapter \stoptext Wolfgang