I agree with you that exploiting the document structure is a convenient choice for this end: it offers a high degree of configurability and comes with neat extras like list (read: table of contents) building by default. So the following will be a structure based solution, leaving the enumerations based approach to somebody else.
The trick is the ownnumbers key of structure headers.
It allows precise control over the counter mechanism for every head.
Headers that are defined with ownnumbers=yes
take a mandatory first argument by means of which their counter value can be set explicitly.
Counters created by \definecounter
each have their own way key that allows fine-grained control of the reset, or disabling it as required by this question (way=text
).
Once the counters are in place, all that’s left is to suppress placement of the structure title element.
This is done in two parts: First, all headers are defined to be accessed only implicitly.
The user level macros \week
, \activity
and \presentation
are wrappers that at the same time pass the headers their “ownnumbers” and an empty title string.
Second, placement method \activityhead
is defined that chooses the display string from a mapping of labels, ignoring the structure title altogether.
(Coding style is mkiv for consistency as \defineheadplacement
does not support named arguments.)
\unprotect
%% (1) define the base commands. Notice the “ownnumber” key in
%% \base_presentation and \base_activity. This lets us supply an
%% independent numbering scheme.
\definehead [base_week] [chapter]
\definehead [base_activity] [section]
\definehead [base_presentation] [section]
\setuphead [part]
[sectionresetset=default]
\setuphead [base_week]
[number=yes,alternative=activityhead,
sectionsegments=chapter]
\setuphead [base_activity]
[number=yes,alternative=activityhead,
sectionsegments=section,ownnumber=yes,
before={\blank[line]\incrementcounter[activity]},]
\setuphead [base_presentation]
[number=yes,alternative=activityhead,
sectionsegments=section,ownnumber=yes,
before={\blank[line]\incrementcounter[presentation]},]
%% (2) define a placement method for headings that omits the title.
\defineheadplacement[activityhead][vertical]#1#2{%
\labeltext{\currenthead}\hskip\numberheaddistance #1%
}
%% (3) heading text is static so we use labels.
%% The following line is cramped due to an exception in option
%% parsing.
%% Cf. http://archive.contextgarden.net/message/20120611.090327.dd9b1347.en.html
\setuplabeltext[base_week=Week,base_activity=Activity,base_presentation=Presentation]
%% (4a) define counters for use with the “presentation” and “activity”
%% heads.
\definecounter [presentation] [start=0,way=text]
\definecounter [activity] [start=0,way=text]
%% (4b) define a reset trigger for the part structural.
\definestructureresetset [default] [0] [0]
%% (5) define a set of wrappers. These compensate for the fact that you
%% can’t have a simple structure head without the mandatory
%% argument. We start with a plain one.
\define \week{\base_week{}}
%% The “\presentation” and “\activity” macros need special treatment
%% to make it respect the separate counter.
\define \activity{\base_activity {\rawcountervalue[activity]} \empty}
\define\presentation{\base_presentation{\rawcountervalue[presentation]}\empty}
%% (6) side effect: the table of contents needs a placement method on
%% its own in order to conform with the requirements. This step is
%% optional if you don’t care for a toc.
\unexpanded\def\week_list#1#2#3{%
\blank[line]%
{\tfa\word\sc\labeltext{\currentlist}}%
\space#1\hfill#3\par
}
\unexpanded\def\activity_list#1#2#3{%
\hskip\emwidth
\labeltext{\currentlist}%
\space#1\hfill#3\par
}
\setuplist [base_week] [alternative=command,command=\week_list]
\setuplist [base_activity] [alternative=command,command=\activity_list]
\setuplist [base_presentation] [alternative=command,command=\activity_list]
\protect
\starttext
\placelist[base_week, base_activity, base_presentation]\page
\part {My Life ...}
\week
\activity
Dear diary. Today I was pompous and my sister was crazy.
\activity
This is some text.
\activity
This is some text.
\week
\activity
This is some more text.
\presentation
This is some more text.
\activity
This is some more text.
\activity
This is some more text.
\part{... the Exciting Story of a Great Man}
\week
\activity
This is yet some more text.
\presentation
This is yet some more text.
\activity
This is yet some more text.
\stoptext
It seems that use of titling
http://www.ctan.org/pkg/titling is a way to do it
Code
\documentclass[notitlepage]{report}
\usepackage[left=1in, right=1in, top=1in, bottom=1in]{geometry}
\usepackage{titling}
\usepackage{lipsum}
\pretitle{\begin{center}\Huge\bfseries}
\posttitle{\par\end{center}\vskip 0.5em}
\preauthor{\begin{center}\Large\ttfamily}
\postauthor{\end{center}}
\predate{\par\large\centering}
\postdate{\par}
\title{TITLE}
\author{NAME and ID}
\date{\today}
\begin{document}
\maketitle
\thispagestyle{empty}
\begin{abstract}
\lipsum[1]
\end{abstract}
\section*{First bit}
If you want to ramp your text straight onto the title page, start the text at
something that does not cause a page break, like a section. Here's a handy
place to introduce some of your woofy conventions, like quotes in equations.
\chapter{New Page}
A new chapter starts a new page.
\end{document}
Best Answer
Depending on how the section headers are set up (show code, please, not ASCII art), a possible option is the
\testpage
command, used as:This inserts a page break before a section header, unless at least one line can fit below the header without introducing a page break.
See also: