3

I'm writing a document with lots of chapters. A typical chapter looks something like this:

A Chapter

Section 1

Lorem ipsum ...

Section 2

Lorem ipsum ...

Topic 1

Lorem ipsum ...

Section 3

Lorem ipsum ...

Topic 2

Lorem ipsum ...

Section 4

Lorem ipsum ...

So there are a second class of headings, at the "same level" as sections, but numbered independently. The question is, how to accomplish this kind of thing in TeX, specifically in ConTeXt.

(I see that there is a very similar question here, but of course the LaTeX answers provided there are not what I'm looking for.)

MWE for examples sake:

\definehead
  [topic]
  [section]

% \setuphead
%   [topic]
%   [???]

\starttext

\startchapter[title=A Chapter]
  \startsection[title=Alpha] Lorem ipsum ... \stopsection
  \startsection[title=Beta]  Lorem ipsum ... \stopsection
  \starttopic[title=One]     Lorem ipsum ... \stoptopic
  \startsection[title=Gamma] Lorem ipsum ... \stopsection
  \starttopic[title=Two]     Lorem ipsum ... \stoptopic
  \startsection[title=Delta] Lorem ipsum ... \stopsection
\stopchapter

\stoptext
1
  • 1
    (1) This question is a duplicate of ConTeXt: independent titles. (2) I don't see why anybody would want this and to me it doesn't make any sense to have several different sectioning structures. Aug 13, 2017 at 1:03

2 Answers 2

3

There is no such thing as independent sectioning structures. The whole purpose of the sectioning structure is to define an ordered hierarchy of titles.

In ConTeXt the idiomatic way to achieve such a thing (usually needed for theorems) is to use enumeration. An enumeration can be prefixed with the chapter and the title can be customized to “look like a section”. Of course, it will not show up in the table of contents. See also the other answer for more details.

Leaving those drawbacks aside, I do not recommend such a thing anyway because it is very confusing for your readers if they encounter the same section number twice for no apparent reason. If also makes referencing really awkward, e.g. does “see 1.2” refer to Section 1.2 or Topic 1.2? The list of problems continues...

\defineenumeration
  [topic]
  [text=,
   title=yes,
   titleleft=,
   titleright=,
   titlestyle=\tfa,
   numbercommand=\groupedcommand{\tfa}{},
   prefix=yes,
   prefixsegments=chapter]

\starttext

\startchapter[title=A Chapter]
  \startsection[title=Alpha] Lorem ipsum ... \stopsection
  \startsection[title=Beta]  Lorem ipsum ... \stopsection
  \starttopic[title=One]     Lorem ipsum ... \stoptopic
  \startsection[title=Gamma] Lorem ipsum ... \stopsection
  \starttopic[title=Two]     Lorem ipsum ... \stoptopic
  \startsection[title=Delta] Lorem ipsum ... \stopsection
\stopchapter

\stoptext

enter image description here

2
  • +1, in particular for adding the comments about drawbacks.
    – mickep
    Aug 13, 2017 at 4:59
  • +1, @HenriMenke thanks for your feedback. I realize it's a weird request, the particular use case I has in mind is for sections & examples (so a chapter might contain sec. 1, sec. 2, ex. 1, sec. 3, ex. 2), which is pretty similar to the situation with theorems you mention.
    – 9tTn9B
    Aug 13, 2017 at 9:28
3

It is not clear from your question that you really need another head

And I don't see how one should do that (probably one of the wizards will soon show you). In the mean time:

If you could live with having the topics as enumerations, then you could do something like below. Also, it is not clear from the question how you want your sections/topics to be numbered, but that is flexible with this solution. I show also how you add your topics to the table of contents.

% This is the essential part
\defineenumeration[topic]
\setupenumeration[topic][
headstyle=\tfa,
text=,
title=yes,
titleleft=,
titleright=,
titlestyle=\tfa,
prefix=yes,
prefixsegments=chapter,
way=bychapter,
before={\blank[big]},
]

% Just to have the same space in sections and topics
\setuphead[section][
before={\blank[big]},
]

% The three setups below are not necessary.
% I only used them to get everything on one page
\setuppapersize[A5]
\setupbodyfont[10pt]
\setuphead[chapter][
page=no
]

\starttext

\placelist[chapter,section,topic][before=,after=]

\startchapter[title=A Chapter]
  \startsection[title=Alpha] Lorem ipsum ... \stopsection
  \startsection[title=Beta]  Lorem ipsum ... \stopsection
  \starttopic[title=One]     Lorem ipsum ... \stoptopic
  \startsection[title=Gamma] Lorem ipsum ... \stopsection
  \starttopic[title=Two]     Lorem ipsum ... \stoptopic
  \startsection[title=Delta] Lorem ipsum ... \stopsection
\stopchapter
\stoptext

Output of the ConTeXt code

1
  • +1, especially for explaining how to add them to the table of contents. I didn't realize it could be done so simply!
    – 9tTn9B
    Aug 13, 2017 at 9:32

You must log in to answer this question.

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