[NTG-context] chapter-number prefixes on figure, etc, numbers, even in unnumbered section appearing in TOC

Sanjoy Mahajan sanjoy at olin.edu
Fri May 31 20:40:53 CEST 2019


Dear List,

The following, it seems, is a recurring question, which I had hoped to
solve by digging in the test suite
<https://wiki.contextgarden.net/Test_suite> -- but no luck.

The problem is to have figures, list items, problems, etc. numbered with
a chapter prefix (e.g. Figure 7.18) even in unnumbered sections that
appear in the TOC.

1. Using \subject as the section command, the figure number is correctly
prefixed, but the section itself doesn't appear in the TOC.

2. Using \section, the figure number is also correctly prefixed, and the
section appears in the TOC, but the section gets numbered (e.g. Section
2.7).

In one of the earlier threads, which are "Prefix for figure number lost
in unnumbered subsection"
<https://ntg.nl/pipermail/ntg-context/2015/082094.html>, "Unnumbered
subject in TOC, numbered exercises in text"
<https://ntg.nl/pipermail/ntg-context/2015/083710.html>, and
"incrementnumber vs. prefixsegments"
<https://ntg.nl/pipermail/ntg-context/2012/069765.html>, Hans suggested
looking in the test suite for fine control of the prefix segments.

I have done that, and the best MNWE that I can come up with is a
modification of doc/context/tests/mkiv/sections/figures-001.tex in the
test suite (see code below), but it also fails:

* When incrementnumber=list (as in the code), the TOC lists that
section, but the figure 5 doesn't get a chapter-number prefix.

* When incrementnumber=no (recreating \subject), the TOC is not correct,
but figure 5 gets its prefix.

* And wWhen incrementnumber-yes (recreating \section), the TOC lists
that section, but the section gets a number.

Is there a modification to what I tried that gets all the aspects right
(TOC entry, unnumbered, chapter prefix on figures, etc. within)?

-Sanjoy

The code:

\setupcaption[figure][way=bytext,prefixset=1:2]
\definehead[unnumberedsection][section]
\setuphead [unnumberedsection][incrementnumber=list]

\starttext
\placelist[chapter,section,unnumberedsection]

\chapter{One}
\placefigure{one}{1}

\section{Two}
\placefigure{two}{2}

\chapter{Three}
\placefigure{three}{3}
\placefigure{four}{4}

\unnumberedsection{Four}

\placefigure{five}{5}

\stoptext


More information about the ntg-context mailing list