Am 31.01.2014 um 23:20 schrieb Thangalin thanga...@gmail.com:
Hi,
I am trying to recreate the following ToC entries:
http://i.stack.imgur.com/ig6LX.png
The code on the wiki uses:
\doifelse\currentlistentrylocation{\structureheadlocation{chapter}}
{{\bfb\currentlistentrytitle}}
{ \currentlistentrytitle}\NC\NR
However, there are syntax errors and the conditional expression
assumes that the ToC is being placed on every page. This assumption
allows it to resolve the namedstructureheadlocation value. For a ToC
at the start of a document, there is no current chapter and so the
head location for the chapter entry returns 0.
Here is what I have so far:
\startsetups [list:TOC]
\starttabulate
\currentlistentrypagenumber{} \hskip 1em \NC \currentlistentrytitle{} \NR
\stoptabulate
\stopsetups
\definelistalternative
[TOC]
[renderingsetup=list:TOC]
% Format the ToC style.
\setupcombinedlist[content][
alternative=TOC,
]
\starttext
\completecontent
\startchapter [title=alpha] \stopchapter
\startsection[title=alphasec] \stopsection
\startchapter [title=beta] \stopchapter
\startsection[title=alphasec] \stopsection
\startchapter [title=gamma] \stopchapter
\startsection[title=alphasec] \stopsection
\stoptext
How do you determine whether or not the chapter title should be displayed?
\define[3]\SectionListEntry
{\par \leftaligned\bgroup
\hbox to 2em{\color[red]{#3}}%
\hskip 1em
\vtop{\hsize\dimexpr\textwidth-3em\relax#2}
\egroup \par}
\setuplist[chapter][headnumber=no,pagenumber=no,style=\bfc]
\setuplist[section][alternative=command,command=\SectionListEntry]
\starttext
\completecontent
\dorecurse{100}
{\chapter{Chapter #1}
\dorecurse{2}{\section{Section #1.##1}}}
\stoptext
Wolfgang
___
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___