ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] last page number for a list
@ 2024-03-30 19:59 Alan Bowen
  2024-04-03 10:55 ` [NTG-context] " Bruce Horrocks
  2024-04-03 15:55 ` Wolfgang Schuster
  0 siblings, 2 replies; 4+ messages in thread
From: Alan Bowen @ 2024-03-30 19:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

How can I get the last page number of a chapter for a list (ToC)?

Outside of a list, I use \lastpagenumber.
But that does not work in a list such as the ToC.

Any tips or pointers will be gladly received.

Alan

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

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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

* [NTG-context] Re: last page number for a list
  2024-03-30 19:59 [NTG-context] last page number for a list Alan Bowen
@ 2024-04-03 10:55 ` Bruce Horrocks
  2024-04-03 15:16   ` Alan Bowen
  2024-04-03 15:55 ` Wolfgang Schuster
  1 sibling, 1 reply; 4+ messages in thread
From: Bruce Horrocks @ 2024-04-03 10:55 UTC (permalink / raw)
  To: ntg-context mailing list



> On 30 Mar 2024, at 19:59, Alan Bowen <bowenalan03@gmail.com> wrote:
> 
> How can I get the last page number of a chapter for a list (ToC)?
> 
> Outside of a list, I use \lastpagenumber. 
> But that does not work in a list such as the ToC.
> 
> Any tips or pointers will be gladly received.


I'm not quite sure what you want to do with these numbers: something like printing out a contents page but instead of the start page of a chapter it shows the last page of the chapter?

If so then try creating a custom list and use \writetolist immediately before each \stopchapter command?

\definelist[LastPages][criterium=all]
\starttext
\completecontent
\page
\completelist[LastPages]
\page
\dorecurse{10}{
  \startchapter[title={This is my chapter}]
  This is a chapter\par \dorecurse{6}{\input knuth } \input math-kontinuitet-sv

  \writetolist[LastPages]{3.}{\namedstructurevariable{chapter}{title}}
  \stopchapter
}
\stoptext

But I can't get the number option of \writetolist to work - the "3." above is ignored. :-(

—
Bruce Horrocks
Hampshire, UK

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

* [NTG-context] Re: last page number for a list
  2024-04-03 10:55 ` [NTG-context] " Bruce Horrocks
@ 2024-04-03 15:16   ` Alan Bowen
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Bowen @ 2024-04-03 15:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hi, Bruce—
This does not quite work—the page numbers are those of the first page of
the chapter, not the last. But thanks for the tip about \writetolist.
Perhaps I can get that to work.

What I need are ToC entries like
AuthorName
ShortTitle                       1–6

I need this pagination because one of the requirements of continuous
publication on the OJS is that once an item is published changes are not
permitted. So I cannot go with normal continuous publication since, for us
anyway, items are not processed in strict sequential order (e,g., we may
have, paper+paper+ review+paper...)

If it helps: I currently have

\startFMTitle[reference=\Reference, title={}][itemAuthor=AuthorName,
itemTitle=ShortTitle,...]
\setuplist[FMTitle][state=start, alternative=startendfmpages,
criterium=all,]
(\Reference is defined at the in the preamble to input of the
file/component.)

\definelistalternative[startendfmpages][renderingsetup=list:startendfmpages]

\startsetups[list:startendfmpages]
          \structurelistuservariable{itemAuthor}\crlf
          \structurelistuservariable{itemTitle}\hfill%
           \at[\currentlistentrypagenumber]–\at[\lastpagenumber]
\vglue1pc
\stopsetups
where I have \reference[\lastpagenumber]{} at the end of the file. But this
gives me ??–viii (the viii is correct and interactive) for the FMTitle.
Sadly the entries for all my other Titles (SourceTitle, StudyTitle...) is
??–viii.
(Each title is a modified chapter.)

Curiously, \at[\Reference]–\convertnumber{r}{\lastpagenumber}  and
\at[\Reference]–\at[\lastpagenumber] work properly in the body text.
The overall structure is project-product sort with many components in the
product.

This is probably TMI. The bottom line is that I am truly stumped.

All best,
Alan

On Wed, Apr 3, 2024 at 6:56 AM Bruce Horrocks <ntg@scorecrow.com> wrote:

>
>
> > On 30 Mar 2024, at 19:59, Alan Bowen <bowenalan03@gmail.com> wrote:
> >
> > How can I get the last page number of a chapter for a list (ToC)?
> >
> > Outside of a list, I use \lastpagenumber.
> > But that does not work in a list such as the ToC.
> >
> > Any tips or pointers will be gladly received.
>
>
> I'm not quite sure what you want to do with these numbers: something like
> printing out a contents page but instead of the start page of a chapter it
> shows the last page of the chapter?
>
> If so then try creating a custom list and use \writetolist immediately
> before each \stopchapter command?
>
> \definelist[LastPages][criterium=all]
> \starttext
> \completecontent
> \page
> \completelist[LastPages]
> \page
> \dorecurse{10}{
>   \startchapter[title={This is my chapter}]
>   This is a chapter\par \dorecurse{6}{\input knuth } \input
> math-kontinuitet-sv
>
>   \writetolist[LastPages]{3.}{\namedstructurevariable{chapter}{title}}
>   \stopchapter
> }
> \stoptext
>
> But I can't get the number option of \writetolist to work - the "3." above
> is ignored. :-(
>
> —
> Bruce Horrocks
> Hampshire, UK
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki     : https://wiki.contextgarden.net
>
> ___________________________________________________________________________________
>

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

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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

* [NTG-context] Re: last page number for a list
  2024-03-30 19:59 [NTG-context] last page number for a list Alan Bowen
  2024-04-03 10:55 ` [NTG-context] " Bruce Horrocks
@ 2024-04-03 15:55 ` Wolfgang Schuster
  1 sibling, 0 replies; 4+ messages in thread
From: Wolfgang Schuster @ 2024-04-03 15:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Alan Bowen

Alan Bowen schrieb am 30.03.2024 um 20:59:
> How can I get the last page number of a chapter for a list (ToC)?
> 
> Outside of a list, I use \lastpagenumber.
> But that does not work in a list such as the ToC.
> 
> Any tips or pointers will be gladly received.

You can try this:

\definepagestate[alanpage]
\definecounter  [alanindex]

\setuphead
   [chapter]
   [insidesection={\setpagestate[alanpage]},
    aftersection={\setpagestate[alanpage]}]

\setuphead
   [title]
   [insidesection=,
    aftersection=]

\define[1]\ChapterListPage
 
{\pagestaterealpage{alanpage}{\number\numexpr\incrementedcounter[alanindex]\relax}%
    \thinspace --\thinspace
 
\pagestaterealpage{alanpage}{\number\numexpr\incrementedcounter[alanindex]\relax}}

\setuplist[chapter][pagecommand=\ChapterListPage]
\setuplist[chapter][pagecommand=\ChapterListPage]

\showgrid

\starttext

\completecontent

\startchapter [title=Knuth]
\dorecurse{12}{\samplefile{knuth}}
\stopchapter

\startchapter [title=Zapf]
\dorecurse{12}{\samplefile{zapf}}
\stopchapter

\stoptext

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2024-04-03 15:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-30 19:59 [NTG-context] last page number for a list Alan Bowen
2024-04-03 10:55 ` [NTG-context] " Bruce Horrocks
2024-04-03 15:16   ` Alan Bowen
2024-04-03 15:55 ` Wolfgang Schuster

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).