Hi,

>I need a heading with a counter on its own, which is referrable,
>and listable, and which resets with each new page. Eventually,
>it should have a number that consists of the page number and
>an alphabetical counter, so subsequent entries on one page 6 have
>counters 6a, 6b, and so on.

let's first get your file working -)

you say : \defineenumeration[nwcodechunkhead]

the enumeration and description commands take an argument delimited by a 
\par (or empty line); they do so because they can apply a font to a 
definition.

\defineenumeration[test]

\test something \par

or (was already suggested by someone else here)

\starttest
   something \par
   something more
\stoptest

which is the better way.

btw, you can put enum's in the margin directly

so

\nwmargintag{{\nwtagstyle{}\at[NWlont-*-1].\in[NWlont-*-1]}}\par

will work ok for you. Now to the page sync'd enumerations.

% The following can go into cont-new.tex

\unprotect

% some new code
\newif\ifpagechanged \let\lastchangedpage\empty

\def\checkpagechange#1%
   {\gettwopassdata{\s!paragraph}%
    \pagechangedfalse
    \iftwopassdatafound
      \ifnum\twopassdata>0\getvalue{\s!paragraph:p:#1}\relax
        \pagechangedtrue
      \fi
    \fi
    \ifpagechanged
      \global\letvalue{\s!paragraph:p:#1}\twopassdata
      \global\let\lastchangedpage\twopassdata
    \else
      \global\let\lastchangedpage\realfolio
    \fi
    \doparagraphreference}

% a bonus

\def\changedpage#1%
   {\getvalue{\s!paragraph:p:#1}}

% an overloaded macro

\def\verhoognummer[#1]%
   {\doifelsevalue{\s!number#1\c!wijze}{\v!per\v!pagina}
      {\checkpagechange{#1}%
       \ifpagechanged\resetcounter{\s!number#1}\fi}
      {\checknummer{#1}}%
    \ifnummeren
      \pluscounter{\s!number#1}%
    \else
      \setcounter{\s!number#1}{0\getvalue{\s!number#1\c!start}}%
    \fi}

\protect
% so far for cont-new. Here is your test material

\defineenumeration [test] [way=bypage,text=\lastchangedpage]

\starttext \dorecurse{10}{\test \input tufte \par} \stoptext

% happy hacking

Hans

-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | [EMAIL PROTECTED]
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------

Reply via email to