ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Stuart Jansen <sjansen@gurulabs.com>
Subject: Re: using \doifnumberelse in a ToC numbercommand=
Date: Wed, 16 Aug 2006 14:28:19 -0600	[thread overview]
Message-ID: <1155760099.3406.17.camel@vision.buscaluz.org> (raw)
In-Reply-To: <6faad9f00608161246l2cd68086w90dbc84721692795@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1772 bytes --]

On Wed, 2006-08-16 at 21:46 +0200, Mojca Miklavec wrote:
> My guess is that \doifnunmberelse won't work since it's not only the
> number hidden there, but also formatting, conversion, ... etc.

You're probably right.

> But I have no idea how to do it in some other way. You may take a look
> at the following, but it has the side-effect that it will not only be
> used in TOC, but also in text which is most probably not what you
> want:

Unfortunately, your solution didn't work for me. It did, however, get me
thinking in the right direction. In case anyone is every crazy enough to
follow the same path, here's a much more simple solution that doesn't
even need \doifnumberelse:

-----

\definehead[appendix][chapter]
\def\myappendixlistnumber#1{\vbox{Appendix #1\crlf}}
\def\mychapterlistnumber#1{\vbox{Chapter #1\crlf}}
\def\mysectionlistnumber#1{\emspace\emspace}
\def\mysectionlisttext#1{%
  \doifelse{#1}{Lab Tasks}{\hskip-1em\bf#1\hfilll}{#1}}
\setuplist[appendix][width=1em,numberstyle=bold,%
  numbercommand=\myappendixlistnumber,textstyle=bold]
\setuplist[chapter][width=1em,numberstyle=bold,%
  numbercommand=\mychapterlistnumber,textstyle=bold]
\setuplist[section][width=2em,numbercommand=\mysectionlistnumber,%
  textcommand=\mysectionlisttext]

\starttext
\bgroup{}Table of Contents\egroup\par
\startcolumns[n=2,distance=.3in,balance=no]
\bgroup
\placelist[chapter,appendix,section][criterium=all,alternative=b]
\egroup
\stopcolumns
\page
\chapter{Foo}
\section{Bar}
\input knuth
\writetolist[section]{}{Lab Tasks}
\input douglas
\section{Baz}
\startappendices
\appendix{Corge}
\section{Grault}
\input zapf
\stopappendices
\stoptext

-----

-- 
Stuart Jansen <sjansen@gurulabs.com>
Guru Labs, L.C.

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

  reply	other threads:[~2006-08-16 20:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-16 18:48 Stuart Jansen
2006-08-16 19:46 ` Mojca Miklavec
2006-08-16 20:28   ` Stuart Jansen [this message]
2006-08-16 21:36 ` Hans Hagen
2006-08-16 23:16   ` Stuart Jansen

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=1155760099.3406.17.camel@vision.buscaluz.org \
    --to=sjansen@gurulabs.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).