ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Rearrange Table of Contents section page numbers
@ 2014-01-31 22:20 Thangalin
  2014-02-01  8:59 ` Wolfgang Schuster
  0 siblings, 1 reply; 2+ messages in thread
From: Thangalin @ 2014-01-31 22:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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?

Thank you!
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Rearrange Table of Contents section page numbers
  2014-01-31 22:20 Rearrange Table of Contents section page numbers Thangalin
@ 2014-02-01  8:59 ` Wolfgang Schuster
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Schuster @ 2014-02-01  8:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 31.01.2014 um 23:20 schrieb Thangalin <thangalin@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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-02-01  8:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-31 22:20 Rearrange Table of Contents section page numbers Thangalin
2014-02-01  8:59 ` Wolfgang Schuster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).