ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* chapter-like headings with separate numbering
@ 2008-11-25  3:08 Sanjoy Mahajan
  2008-11-26  8:14 ` luigi scarso
  2008-12-05 22:48 ` Aditya Mahajan
  0 siblings, 2 replies; 9+ messages in thread
From: Sanjoy Mahajan @ 2008-11-25  3:08 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: chapter-like headings with separate numbering
  2008-11-25  3:08 chapter-like headings with separate numbering Sanjoy Mahajan
@ 2008-11-26  8:14 ` luigi scarso
  2008-11-26 11:45   ` Sanjoy Mahajan
  2008-12-05 22:48 ` Aditya Mahajan
  1 sibling, 1 reply; 9+ messages in thread
From: luigi scarso @ 2008-11-26  8:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1469 bytes --]

On Tue, Nov 25, 2008 at 4:08 AM, Sanjoy Mahajan <sanjoy@mit.edu> 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?
>
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

[-- Attachment #1.2: Type: text/html, Size: 2404 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: chapter-like headings with separate numbering
  2008-11-26  8:14 ` luigi scarso
@ 2008-11-26 11:45   ` Sanjoy Mahajan
  2008-11-26 13:43     ` Wolfgang Schuster
  0 siblings, 1 reply; 9+ messages in thread
From: Sanjoy Mahajan @ 2008-11-26 11:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users

"luigi scarso" <luigi.scarso@gmail.com> 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!)?"

-Sanjoy

`Until lions have their historians, tales of the hunt shall always
 glorify the hunters.'  --African Proverb
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: chapter-like headings with separate numbering
  2008-11-26 11:45   ` Sanjoy Mahajan
@ 2008-11-26 13:43     ` Wolfgang Schuster
  2008-11-29 18:39       ` Sanjoy Mahajan
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2008-11-26 13:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 26.11.2008 um 12:45 schrieb Sanjoy Mahajan:

> "luigi scarso" <luigi.scarso@gmail.com> 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

___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: chapter-like headings with separate numbering
  2008-11-26 13:43     ` Wolfgang Schuster
@ 2008-11-29 18:39       ` Sanjoy Mahajan
  2008-11-30 11:13         ` Wolfgang Schuster
  0 siblings, 1 reply; 9+ messages in thread
From: Sanjoy Mahajan @ 2008-11-29 18:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users

>From Wolfgang Schuster <schuster.wolfgang@googlemail.com>:

> 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
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: chapter-like headings with separate numbering
  2008-11-29 18:39       ` Sanjoy Mahajan
@ 2008-11-30 11:13         ` Wolfgang Schuster
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfgang Schuster @ 2008-11-30 11:13 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 29.11.2008 um 19:39 schrieb Sanjoy Mahajan:

>> From Wolfgang Schuster <schuster.wolfgang@googlemail.com>:
>
>> 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
  
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: chapter-like headings with separate numbering
  2008-11-25  3:08 chapter-like headings with separate numbering Sanjoy Mahajan
  2008-11-26  8:14 ` luigi scarso
@ 2008-12-05 22:48 ` Aditya Mahajan
  2008-12-06 14:10   ` Sanjoy Mahajan
  1 sibling, 1 reply; 9+ messages in thread
From: Aditya Mahajan @ 2008-12-05 22:48 UTC (permalink / raw)
  To: Sanjoy Mahajan; +Cc: ntg-context

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
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: chapter-like headings with separate numbering
  2008-12-05 22:48 ` Aditya Mahajan
@ 2008-12-06 14:10   ` Sanjoy Mahajan
  2008-12-06 17:51     ` Aditya Mahajan
  0 siblings, 1 reply; 9+ messages in thread
From: Sanjoy Mahajan @ 2008-12-06 14:10 UTC (permalink / raw)
  To: Aditya Mahajan; +Cc: ntg-context

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
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: chapter-like headings with separate numbering
  2008-12-06 14:10   ` Sanjoy Mahajan
@ 2008-12-06 17:51     ` Aditya Mahajan
  0 siblings, 0 replies; 9+ messages in thread
From: Aditya Mahajan @ 2008-12-06 17:51 UTC (permalink / raw)
  To: Sanjoy Mahajan; +Cc: ntg-context

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
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-12-06 17:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-25  3:08 chapter-like headings with separate numbering Sanjoy Mahajan
2008-11-26  8:14 ` luigi scarso
2008-11-26 11:45   ` Sanjoy Mahajan
2008-11-26 13:43     ` Wolfgang Schuster
2008-11-29 18:39       ` Sanjoy Mahajan
2008-11-30 11:13         ` Wolfgang Schuster
2008-12-05 22:48 ` Aditya Mahajan
2008-12-06 14:10   ` Sanjoy Mahajan
2008-12-06 17:51     ` Aditya Mahajan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).