ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Rearrange Table of Contents section page numbers
Date: Sat, 1 Feb 2014 09:59:55 +0100	[thread overview]
Message-ID: <8B514E1C-A5F1-44AF-B1B1-17460CB2BE97@gmail.com> (raw)
In-Reply-To: <CAANrE7p5ew7w_Ohv7c7nLqz4Z=gE7=tqRP+ypdBg55QSuT2ePg@mail.gmail.com>


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
___________________________________________________________________________________


      reply	other threads:[~2014-02-01  8:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-31 22:20 Thangalin
2014-02-01  8:59 ` Wolfgang Schuster [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8B514E1C-A5F1-44AF-B1B1-17460CB2BE97@gmail.com \
    --to=schuster.wolfgang@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).