# [NTG-context] using \doifnumberelse in a ToC numbercommand=

Stuart Jansen sjansen at gurulabs.com
Wed Aug 16 22:28:19 CEST 2006

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:

-----

\def\myappendixlistnumber#1{\vbox{Appendix #1\crlf}}
\def\mychapterlistnumber#1{\vbox{Chapter #1\crlf}}
\def\mysectionlistnumber#1{\emspace\emspace}
\def\mysectionlisttext#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
\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
\input douglas
\section{Baz}
\startappendices
\appendix{Corge}
\section{Grault}
\input zapf
\stopappendices
\stoptext

-----

--
Stuart Jansen <sjansen at gurulabs.com>
Guru Labs, L.C.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://www.ntg.nl/pipermail/ntg-context/attachments/20060816/9b9e15f1/attachment.bin