2

I want the structure of my book and the table of contents to be:

Introduction chapter
Part the first
First chapter
Second chapter
Part the second
and so on 

I also want a so-called horizontal table of contents, with several sections on one line. I found code to do this here: How to adjust the position of entries in the table of contents in ConTeXt?. In my MWE I’ve removed the code to have several sections on one line.

If I use \completecontent to place the table of contents it works, but I can’t then have several sections on one line.

My MWE doesn’t display Introduction chapter in the table of contents. I understand why.

If I remove the % from the line %\part{I don't want this in the table of contents or in the book} then I see Introduction chapter in the table of contents but I also see I don't want this in the table of contents or in the book. Again I can see why.

Is there a way to get what I want ? That will let me use the code to have several sections on one line.

\setuplist [part] \setuplist [chapter]
\startsetups toc:chapter
    \placelist[chapter]
\stopsetups

\starttext
\placelist [part] [criterium=text,after=\setups{toc:chapter}]
%\part{I don't want this in the table of contents or in the book}
\chapter{Introduction chapter}
\part{Part the first}
\chapter{First chapter}
\chapter{Second chapter}
\part{Part the second}
\stoptext

TOC

1 Answer 1

3

It is not completely clear to me what you are looking for. But to avoid one part from the table of contents, one can for example define a new head as a copy of part and make sure it does not end up there.

Regarding several titles on one line, there is alternative=d when you do \setuplist.

You can play with the following example.

\setuphead[part][
    placehead=yes,
    number=no,
]

\definehead[mypart][part][
    number=no,
]



\setuphead[chapter][
    sectionsegments={chapter:section},
]

\setuphead[section][
    sectionsegments={chapter:section},
]


\setuplist[part][
    style={\bfa},
]

\setuplist[chapter][
    style={\bf},
]

\setuplist[chapter,section][
    headnumber=no,
]

\setuplist[section][
    alternative=d,
]

\setupcombinedlist[content][list={part,chapter,section}]

\starttext

\completecontent

\mypart[title={I don't want this in the table of contents or in the book}]

\chapter[title={Introduction chapter}]

\dorecurse{10}{
    \section[title=Section name]
    \samplefile{douglas}
}

\part[title={Part the first}]
\chapter[title={First chapter}]

\dorecurse{5}{
    \section[title=Section name]
    \samplefile{douglas}
}

\chapter[title={Second chapter}]

\dorecurse{8}{
    \section[title=Section name]
    \samplefile{douglas}
}

\part[title={Part the second}]
\stoptext

table of contents

1
  • That was kind of you to add those lines where I could customise the table of contents. I’ve done that and now it looks just how I want. Thank you again.
    – Stanley
    Dec 9, 2022 at 21:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .