chapter-like headings with separate numbering
I'm experimenting with making a heading that is like a chapter in format but has its own numbering (or lettering). The purpose to have an interlude, or extended example, every few chapters. The following almost-minimal example almost does so. However, the second interlude is numbered with 'A' instead of 'B'. Is there a missing key=value pair, or is the approach completely wrong? \definesection[nc] \setupsection[nc][conversion=Characters] \definehead[interlude][section=nc,default=chapter] \setuphead[interlude][incrementnumber=yes] \starttext \title{Contents} \placelist[chapter,interlude] \chapter{Chap 1} \interlude{Interlude 1} \chapter{Chap 2} \interlude{Interlude 2} \stoptext
On Tue, Nov 25, 2008 at 4:08 AM, Sanjoy Mahajan
I'm experimenting with making a heading that is like a chapter in format but has its own numbering (or lettering). The purpose to have an interlude, or extended example, every few chapters. The following almost-minimal example almost does so. However, the second interlude is numbered with 'A' instead of 'B'. Is there a missing key=value pair, or is the approach completely wrong?
It seem that interlude is like a section, so it's correct that at every chapter there is a reset of the alphabetical counter
\definesection[nc] \setupsection[nc][conversion=Characters] \definehead[interlude][section=nc,default=chapter] \setuphead[interlude][incrementnumber=yes]
\starttext
\title{Contents} \placelist[chapter,interlude]
\chapter{Chap 1}
\interlude{Interlude 1}
\chapter{Chap 2}
\interlude{Interlude 2}
\stoptext
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net
___________________________________________________________________________________
-- luigi
"luigi scarso"
It seem that interlude is like a section, so it's correct that at every chapter there is a reset of the alphabetical counter
I meant the interludes to be long examples based upon the preceding few chapters. So I think of interludes as at the same level as a chapter. But your comments suggests an idea: Is there a key=value pair that says "Don't ever reset the interlude counter (but do reset section numbers when a new chapter appears!)?" -Sanjoy `Until lions have their historians, tales of the hunt shall always glorify the hunters.' --African Proverb
Am 26.11.2008 um 12:45 schrieb Sanjoy Mahajan:
"luigi scarso"
wrote: It seem that interlude is like a section, so it's correct that at every chapter there is a reset of the alphabetical counter
I meant the interludes to be long examples based upon the preceding few chapters. So I think of interludes as at the same level as a chapter. But your comments suggests an idea: Is there a key=value pair that says "Don't ever reset the interlude counter (but do reset section numbers when a new chapter appears!)?"
Use the archive my dear padawan. http://archive.contextgarden.net/message/20030415.153451.374310d8.en.html Regards, Wolfgang
From Wolfgang Schuster
:
Use the archive my dear padawan.
I did, I did! It sometimes requires a mix of luck and skill in selecting the search phrases. As when using a dictionary to check the spelling of a word -- needs enough luck and skill to be in the vicinity.
http://archive.contextgarden.net/message/20030415.153451.374310d8.en.html
If your question is of interest to others as well, please add an entry to the Wiki!
Thanks, wikified. -Sanjoy `Until lions have their historians, tales of the hunt shall always glorify the hunters.' --African Proverb
Am 29.11.2008 um 19:39 schrieb Sanjoy Mahajan:
From Wolfgang Schuster
: Use the archive my dear padawan.
I did, I did! It sometimes requires a mix of luck and skill in selecting the search phrases. As when using a dictionary to check the spelling of a word -- needs enough luck and skill to be in the vicinity.
http://archive.contextgarden.net/message/20030415.153451.374310d8.en.html
If your question is of interest to others as well, please add an entry to the Wiki!
Thanks, wikified.
If you want to refer to your problem there is a better definition for \problem. \definecomplexorsimpleempty\problem \def\complexproblem[#1]% {\doglobal\increment\ProblemNumber \Problem[#1]{\ProblemNumber}} Wolfgang
On Mon, 24 Nov 2008, Sanjoy Mahajan wrote:
I'm experimenting with making a heading that is like a chapter in format but has its own numbering (or lettering). The purpose to have an interlude, or extended example, every few chapters. The following almost-minimal example almost does so. However, the second interlude is numbered with 'A' instead of 'B'. Is there a missing key=value pair, or is the approach completely wrong?
An enumeration passes the duck test [1] for headings, so ... [1] http://en.wikipedia.org/wiki/Duck_test \defineenumeration [interlude] [before=\page,conversion=Characters,way=bytext,list=interlude, text={Interlude }] \defineenumeration [interludeA] [before=\page,conversion=Characters,way=bytext,list=interludeA, text=, listtext=, title=yes, titleleft=, titleright=] \starttext \title{Contents} \placelist[chapter,enumeration:interlude,enumeration:interludeA] \chapter{Chap 1} \interlude{Interlude 1} \interludeA{{Interlude 1}} \chapter{Chap 2} \interlude{Interlude 2} \interludeA{{Interlude 2}} \stoptext Aditya
Thanks, that's a nice approach. It doesn't fully pass the duck test: The page headlines come from the chapter titles, even in the interludes. Here is an example. \startsetups[chheadline] {\ss\it Chapter \getmarking[chapternumber].\quad\getmarking[chapter]} \stopsetups \setupheadertexts[\setups{chheadline}][pagenumber] \defineenumeration [interlude] [before=\page,conversion=Characters,way=bytext,list=interlude, text={Interlude }] \defineenumeration [interludeA] [before=\page,conversion=Characters,way=bytext,list=interludeA, text=, listtext=, title=yes, titleleft=, titleright=] \starttext \title{Contents} \placelist[chapter,enumeration:interlude,enumeration:interludeA] \chapter{Chap 1} \interlude{Interlude 1} \interludeA{{Interlude 1}} \chapter{Chap 2} \interlude{Interlude 2} \interludeA{{Interlude 2}} \stoptext
On Sat, 6 Dec 2008, Sanjoy Mahajan wrote:
Thanks, that's a nice approach. It doesn't fully pass the duck test: The page headlines come from the chapter titles, even in the interludes.
Then beat the hell out of it, until it starts behaving like a duck. The main trouble is that descriptions do not set any marking, and there are not enough hooks to set a mark. But we can still use poor man's marks: macros! % First we need two types of headings: for chapters and for interludes startsetups[headline:chapter] {\ss\it Chapter \getmarking[chapternumber].\quad\getmarking[chapter]} \stopsetups % Marking version does not work ... see comment below % \definemarking[interlude] % \definemarking[interludenumber][expansion=yes] % % \startsetups[headline:interlude] % {\ss\it Interlude \getmarking[interludenumber].\quad\getmarking[interlude]} % \stopsetups % So we define our own marks \def\interludeMARK{empty} \def\interludenumberMARK{empty} % And a second version of heading \startsetups[headline:interlude] {\ss\it Interlude \interludenumberMARK.\quad\interludeMARK} \stopsetups % The header texts need to switch between the two \setupheadertexts[\setups{headline:\CURRENTDIVISION}][pagenumber] \setuppagenumbering[location=] % We start with current division as chapter \def\CURRENTDIVISION{chapter} % Provide an option of switching on interlude pages \couplepage[interlude][before={\gdef\CURRENTDIVISION{interlude}}] \startsetups interlude \page \pagetype[interlude] \stopsetups % And switch back on chapter pages \setuphead[chapter][before={\page[right]\def\CURRENTDIVISION{chapter}}] % Now define the enumeration \defineenumeration[interlude] [before=\setups{interlude}, conversion=Characters,way=bytext,list=interludeA, text=, listtext=, title=yes, titleleft=, titleright=, titlecommand=\interludemarking] \def\interludemarking#1% {\gdef\interludeMARK{#1}% \global \edef\interludenumberMARK{\getnumber[\currentdescriptionnumber]}% #1} % Ideally, I would have liked to use marks, but this does not work % Probably because we are inside a box % \def\interludemarking#1% % {\marking[interlude]{#1}% % \marking[interludenumber]{\getnumber[\currentdescriptionnumber]}% % #1} \starttext \title{Contents} \placelist[chapter,enumeration:interlude,enumeration:interludeA] \chapter{Chap 1} \dorecurse{5}{\input knuth \endgraf} \startinterlude {Interlude 1} \dorecurse{5}{\input knuth \endgraf} \stopinterlude \chapter{Chap 2} \dorecurse{5}{\input knuth \endgraf} \startinterlude {Interlude 2} \dorecurse{5}{\input knuth \endgraf} \stopinterlude \stoptext At this stage I am not sure whether you gain anything by using enumerations. You get predefined support for numbering and lists, but that is not too hard to write on your own. Aditya
participants (4)
-
Aditya Mahajan
-
luigi scarso
-
Sanjoy Mahajan
-
Wolfgang Schuster