* Header counter that resets with page @ 2001-09-20 19:45 Johannes Huesing 2001-09-20 20:45 ` Johannes Huesing 2001-09-21 9:04 ` Hans Hagen 0 siblings, 2 replies; 7+ messages in thread From: Johannes Huesing @ 2001-09-20 19:45 UTC (permalink / raw) Hi all, is it possible (within ConTeXt) to define a head whose counter resets with every page, as a footnote does? Greetings Johannes -- Johannes Hüsing | Terrorism treats the ending of a hannes@ruhrau.de | state as damage, and routes around it ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Header counter that resets with page 2001-09-20 19:45 Header counter that resets with page Johannes Huesing @ 2001-09-20 20:45 ` Johannes Huesing 2001-09-21 9:04 ` Hans Hagen 1 sibling, 0 replies; 7+ messages in thread From: Johannes Huesing @ 2001-09-20 20:45 UTC (permalink / raw) On Thu, Sep 20, 2001 at 09:45:54PM +0200, hannes wrote: > > Hi all, > > is it possible (within ConTeXt) to define a head > whose counter resets with every page, as a footnote does? ok I have found that myself: \appendtoks \resetmyhead \to \aftereverypage \defineenumeration[myhead] except that I have "myhead" in the text, which I do not want to. oh, and the conversion=character option doesn't work here; it sticks to numbers. Greetings Johannes -- Johannes Hüsing | Terrorism treats the ending of a hannes@ruhrau.de | state as damage, and routes around it ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Header counter that resets with page 2001-09-20 19:45 Header counter that resets with page Johannes Huesing 2001-09-20 20:45 ` Johannes Huesing @ 2001-09-21 9:04 ` Hans Hagen 2001-09-22 16:02 ` Johannes Huesing 1 sibling, 1 reply; 7+ messages in thread From: Hans Hagen @ 2001-09-21 9:04 UTC (permalink / raw) Cc: ntg-context At 09:45 PM 9/20/2001 +0200, Johannes Huesing wrote: >Hi all, > >is it possible (within ConTeXt) to define a head >whose counter resets with every page, as a footnote does? \starttext \newcounter\MyHeadCounter \newcounter\MyPageCounter \definieernummer[TestNumber] \definehead[TestHead][section] \setuphead[TestHead][ownnumber=yes] \def\MyTestHead% {\dosingleempty\doMyTestHead} \def\doMyTestHead[#1]% {\doglobal\increment\MyHeadCounter \doifreferencefoundelse{pnm:\MyHeadCounter} {\ifnum\currentrealreference>\MyPageCounter\relax \global\let\MyPageCounter\currentrealreference \resetnummer[TestNumber]% \fi} {} \verhoognummer[TestNumber]% \expanded{\TestHead[pnm:\MyHeadCounter,#1]{\ruwenummer[TestNumber]}}} \dorecurse{10}{\MyTestHead[ref:\recurselevel]{A Head} \input tufte } \stoptext sorry for the dutch commands; later i will build this into the nuemal numbering mechanism. Hans ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl 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 ------------------------------------------------------------------------- ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Header counter that resets with page 2001-09-21 9:04 ` Hans Hagen @ 2001-09-22 16:02 ` Johannes Huesing 2001-09-23 9:59 ` Hans Hagen 0 siblings, 1 reply; 7+ messages in thread From: Johannes Huesing @ 2001-09-22 16:02 UTC (permalink / raw) [-- Attachment #1: Type: text/plain, Size: 539 bytes --] On Fri, Sep 21, 2001 at 11:04:57AM +0200, Hans Hagen wrote: > At 09:45 PM 9/20/2001 +0200, Johannes Huesing wrote: > > \starttext > [deletia] > > \stoptext > This works, as long as I don't try to refer to these heads. An example which leads to an error is included. Moreover, I am still uncertain why my minimal example doesn't work. If I replace the head with an enumeration I get an error too. Greetings Johannes -- Johannes Hüsing | Terrorism treats the ending of a hannes@ruhrau.de | state as damage, and routes around it [-- Attachment #2: counter.tex --] [-- Type: text/x-tex, Size: 827 bytes --] %%% Counter that resets with every page \newcounter\MyHeadCounter \newcounter\MyPageCounter \definieernummer[TestNumber] \definehead[TestHead][section] \setuphead[TestHead][ownnumber=yes] \def\MyTestHead% {\dosingleempty\doMyTestHead} \def\doMyTestHead[#1]% {\doglobal\increment\MyHeadCounter \doifreferencefoundelse{pnm:\MyHeadCounter} {\ifnum\currentrealreference>\MyPageCounter\relax \global\let\MyPageCounter\currentrealreference \resetnummer[TestNumber]% \fi} {} \verhoognummer[TestNumber]% \expanded{\TestHead[pnm:\MyHeadCounter,#1]{\ruwenummer[TestNumber]}}} %%% \starttext \MyTestHead[ch:tufte]{Tufte} \input tufte \page \MyTestHead[ch:knuth]{Knuth} \input knuth \MyTestHead[ch:zapf]{Zapf} \input zapf see also \in[ch:knuth] on page \at[ch:knuth]. \stoptext [-- Attachment #3: longrun-minimal.tex --] [-- Type: text/x-tex, Size: 1275 bytes --] \setupoutput[pdftex] \def\NWmargintag#1{\inmargin{\tfx #1}} \def\NWprevnextdefs#1#2{\ifx\relax#1\else% \goto{$\triangleleft$}[#1]~\fi\ifx\relax#2\else% \goto{$\triangleright$}[#2]\fi} \def\NWalsodefined#1{also defined in \at[#1]\crlf} \definehead[NWcodechunkhead][section] % Comment out the previous line and uncomment the next line to cause error %\defineenumeration[NWcodechunkhead]% % [conversion=character] %\appendtoks \resetNWcodechunkhead \to \aftereverypage \defineframedtext[NWcodechunk][frame=off, leftframe=on, background=screen, width=\textwidth] \def\NWtagstyle{\it} \defineframedtext[NWdeflinemarkup][frame=on, background=none] \setuptype[space=on] \setupinteraction[state=start] \starttext \startNWcodechunk \NWcodechunkhead[NWlont-*-1]{*~{\NWtagstyle{}\at[NWlont-*-1].\in[NWlont-*-1]}} \NWmargintag{{\NWtagstyle{}\at[NWlont-*-1].\in[NWlont-*-1]}}\crlf \startNWdeflinemarkup\NWprevnextdefs{\relax}{NWlont-*-2}\stopNWdeflinemarkup function calculating the probability of a subsequence of length k out of n~{\NWtagstyle{}\at[NWlont-fun1C-1].\in[NWlont-fun1C-1]}\type{}\crlf \stopNWcodechunk{} \stoptext ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Header counter that resets with page 2001-09-22 16:02 ` Johannes Huesing @ 2001-09-23 9:59 ` Hans Hagen 2001-09-23 13:28 ` Johannes Huesing 0 siblings, 1 reply; 7+ messages in thread From: Hans Hagen @ 2001-09-23 9:59 UTC (permalink / raw) Cc: ntg-context At 06:02 PM 9/22/2001 +0200, Johannes Huesing wrote: counter.tex works ok here the other one also runs ok, but i don't know what to expect >Moreover, I am still uncertain why my minimal example doesn't work. >If I replace the head with an enumeration I get an error too. this has to do with expansion, you can control that by setting expansion [in head] to yes|command|no and alike, i need a bit more info on what you want to achieve -) Hans ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl 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 ------------------------------------------------------------------------- ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Header counter that resets with page 2001-09-23 9:59 ` Hans Hagen @ 2001-09-23 13:28 ` Johannes Huesing 2001-09-29 17:01 ` Hans Hagen 0 siblings, 1 reply; 7+ messages in thread From: Johannes Huesing @ 2001-09-23 13:28 UTC (permalink / raw) On Sun, Sep 23, 2001 at 11:59:35AM +0200, Hans Hagen wrote: > At 06:02 PM 9/22/2001 +0200, Johannes Huesing wrote: > > counter.tex works ok here > strange, here too (should've saved that log file when it didn't). > the other one also runs ok, but i don't know what to expect That's what I am describing below. It runs ok with head, though it doesn't what I want it to do (I don't want the counter to increment along with sections, and I want to reset it with every page). It exits with an error message when I replace the def'n of a head with that of an enumeration. > > >Moreover, I am still uncertain why my minimal example doesn't work. > >If I replace the head with an enumeration I get an error too. > > this has to do with expansion, you can control that by setting expansion > [in head] to yes|command|no and alike, Yes, within setuphead, not within setupenumeration. > > i need a bit more info on what you want to achieve -) > 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. I sound like the doctors who switch on their computer for using SAS every half a year, and then phone me up for details :-( Greetings Johannes -- Johannes Hüsing | Terrorism treats the ending of a hannes@ruhrau.de | state as damage, and routes around it ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Header counter that resets with page 2001-09-23 13:28 ` Johannes Huesing @ 2001-09-29 17:01 ` Hans Hagen 0 siblings, 0 replies; 7+ messages in thread From: Hans Hagen @ 2001-09-29 17:01 UTC (permalink / raw) Cc: ntg-context 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 | pragma@wxs.nl 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 ------------------------------------------------------------------------- ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2001-09-29 17:01 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2001-09-20 19:45 Header counter that resets with page Johannes Huesing 2001-09-20 20:45 ` Johannes Huesing 2001-09-21 9:04 ` Hans Hagen 2001-09-22 16:02 ` Johannes Huesing 2001-09-23 9:59 ` Hans Hagen 2001-09-23 13:28 ` Johannes Huesing 2001-09-29 17:01 ` Hans Hagen
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).