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: TOC: Chapters with and without page-numbers
Date: Fri, 15 Mar 2013 19:13:21 +0100	[thread overview]
Message-ID: <ADB794E7-8BAA-4777-82B9-D8F03BFF7F75@gmail.com> (raw)
In-Reply-To: <5142C3C5.4020307@mmnetz.de>


Am 15.03.2013 um 07:46 schrieb H. Özoguz <h.oezoguz@mmnetz.de>:

> Maybe I have not made it clear, what I mean?
> 
> My Minexample is:
> 
> \setuplist[chapter][pagenumber=no]
> \starttext
> \completecontent
> \chapter{Chapter 1}
> \section{Section 1}
> \chapter{Chapter 2}
> \stoptext
> 
> Now Chapter 1 is without pagenumber in the TOC, correct, because it has a section after the chapter-title! But Chapter 2 has no sections, so it need a page number, how to do that?


You can play with the following solution, it’s a bit dirty because you have to save the values of the chapter entry before you check for section entries.

\setuplist[chapter][alternative=mychapter]

\definelistalternative[mychapter][renderingsetup=list:mychapter]

\startsetups[list:mychapter]

  \par

  \setbox\scratchboxone\hbox{\currentlistentrynumber \quad \currentlistentrytitle \quad \currentlistentrypagenumber}
  \setbox\scratchboxtwo\hbox{\currentlistentrynumber \quad \currentlistentrytitle}

  \determinelistcharacteristics[section]

  \ifnum\listlength=0
    \box\scratchboxone
  \else
    \box\scratchboxtwo
  \fi

  \par

\stopsetups

\starttext
\completecontent
\chapter{Chapter 1}
\section{Section 1}
\chapter{Chapter 2}
\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
___________________________________________________________________________________


  parent reply	other threads:[~2013-03-15 18:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-15  6:46 "H. Özoguz"
2013-03-15  8:07 ` Keith J. Schultz
2013-03-15 15:53   ` john Culleton
2013-03-15 17:24     ` Jonathan Barchi
2013-03-15 18:13 ` Wolfgang Schuster [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-03-12 11:03 "H. Özoguz"
2013-03-12 11:01 "H. Özoguz"

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=ADB794E7-8BAA-4777-82B9-D8F03BFF7F75@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).