ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* last chapter number
@ 2010-01-16 16:46 Andreas Harder
  2010-01-16 19:52 ` Wolfgang Schuster
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Harder @ 2010-01-16 16:46 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi all,

is there already an equivalent to \lastpage for the last chapter number in a document. I tried something like \getmarking[chapternumber][last], but the output is still the current chapter number.

Thanks in advance

	Andreas
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: last chapter number
  2010-01-16 16:46 last chapter number Andreas Harder
@ 2010-01-16 19:52 ` Wolfgang Schuster
  2010-01-16 22:08   ` Andreas Harder
  0 siblings, 1 reply; 11+ messages in thread
From: Wolfgang Schuster @ 2010-01-16 19:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 16.01.2010 um 17:46 schrieb Andreas Harder:

> Hi all,
> 
> is there already an equivalent to \lastpage for the last chapter number in a document. I tried something like \getmarking[chapternumber][last], but the output is still the current chapter number.

can you try \convertedstructurecounter[chapter][type=last]

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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: last chapter number
  2010-01-16 19:52 ` Wolfgang Schuster
@ 2010-01-16 22:08   ` Andreas Harder
  2010-01-17  8:13     ` Wolfgang Schuster
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Harder @ 2010-01-16 22:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 16.01.2010 um 20:52 schrieb Wolfgang Schuster:

> 
> Am 16.01.2010 um 17:46 schrieb Andreas Harder:
> 
>> Hi all,
>> 
>> is there already an equivalent to \lastpage for the last chapter number in a document. I tried something like \getmarking[chapternumber][last], but the output is still the current chapter number.
> 
> can you try \convertedstructurecounter[chapter][type=last]

Hello Wolfgang,

I tried, but it only outputs nothing visible. Here a test file

\starttext
\dorecurse{10}{\chapter{Kapitel #1}
  \tex{getmarking[chapternumber]} = \getmarking[chapternumber] \crlf
  \tex{convertedstructurecounter[chapter][type=last]} =
  \convertedstructurecounter[chapter][type=last] 
}
\stoptext


Greetings
	Andreas
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: last chapter number
  2010-01-16 22:08   ` Andreas Harder
@ 2010-01-17  8:13     ` Wolfgang Schuster
  2010-01-17 12:06       ` Andreas Harder
  0 siblings, 1 reply; 11+ messages in thread
From: Wolfgang Schuster @ 2010-01-17  8:13 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 16.01.2010 um 23:08 schrieb Andreas Harder:

>> can you try \convertedstructurecounter[chapter][type=last]
> 
> Hello Wolfgang,
> 
> I tried, but it only outputs nothing visible.

Sorry, my fault. Section numbering use their own system to save and get the numbers.

What you can do is to save the number of the last chapter at the end of the document
with two pass data (\definetwopasslist) and use the result in the second run or you
what for a solution from Hans.

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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: last chapter number
  2010-01-17  8:13     ` Wolfgang Schuster
@ 2010-01-17 12:06       ` Andreas Harder
  2010-01-17 12:36         ` Wolfgang Schuster
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Harder @ 2010-01-17 12:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 17.01.2010 um 09:13 schrieb Wolfgang Schuster:

> 
> Am 16.01.2010 um 23:08 schrieb Andreas Harder:
> 
>>> can you try \convertedstructurecounter[chapter][type=last]
>> 
>> Hello Wolfgang,
>> 
>> I tried, but it only outputs nothing visible.
> 
> Sorry, my fault. Section numbering use their own system to save and get the numbers.
> 
> What you can do is to save the number of the last chapter at the end of the document
> with two pass data (\definetwopasslist) and use the result in the second run or you
> what for a solution from Hans.

Thank you Wolfgang! You pointed me to \definetwopasslist and that brought me to the following solution (without \definetwopasslist):

\newcounter\ChapNum
\def\NofChaps{0}

\definehead
  [chapter]
  [before=\increment\ChapNum,
    after=\savecurrentvalue\NofChaps{\countervalue{ChapNum}}]

\starttext
Dieses Dokument besteht aus \NofChaps\ Kapiteln.
\dorecurse{9}{\chapter{Kapitel #1}}
\stoptext

Nonetheless the needed information is already present even more if one uses a table of contents …


	Andreas
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: last chapter number
  2010-01-17 12:06       ` Andreas Harder
@ 2010-01-17 12:36         ` Wolfgang Schuster
  2010-01-17 22:57           ` Hans Hagen
  2010-01-18 12:11           ` Hans Hagen
  0 siblings, 2 replies; 11+ messages in thread
From: Wolfgang Schuster @ 2010-01-17 12:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 17.01.2010 um 13:06 schrieb Andreas Harder:

> Nonetheless the needed information is already present even more if one uses a table of contents …

The table of contents needs two passes too but only Hans can say (or provide
a command like \convertedstructurecounter for section numbers) how you can
access these information.

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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: last chapter number
  2010-01-17 12:36         ` Wolfgang Schuster
@ 2010-01-17 22:57           ` Hans Hagen
  2010-01-18 12:11           ` Hans Hagen
  1 sibling, 0 replies; 11+ messages in thread
From: Hans Hagen @ 2010-01-17 22:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 17-1-2010 13:36, Wolfgang Schuster wrote:
>
> Am 17.01.2010 um 13:06 schrieb Andreas Harder:
>
>> Nonetheless the needed information is already present even more if one uses a table of contents …
>
> The table of contents needs two passes too but only Hans can say (or provide
> a command like \convertedstructurecounter for section numbers) how you can
> access these information.

i'm sure that you can figure it out if needed but i can certainly add 
something

  \convertedstructurecounter[chapter][type=last]

but as

  \convertedstructurecounter[section][type=last]

is ambiguous it needs a bit of thinking, as it more relates to lists 
like criteria then

of course one can use a reference for the last chapter instead

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: last chapter number
  2010-01-17 12:36         ` Wolfgang Schuster
  2010-01-17 22:57           ` Hans Hagen
@ 2010-01-18 12:11           ` Hans Hagen
  2010-01-18 15:04             ` Andreas Harder
  2010-01-18 15:47             ` last chapter number in Metapost Andreas Harder
  1 sibling, 2 replies; 11+ messages in thread
From: Hans Hagen @ 2010-01-18 12:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 17-1-2010 13:36, Wolfgang Schuster wrote:
>
> Am 17.01.2010 um 13:06 schrieb Andreas Harder:
>
>> Nonetheless the needed information is already present even more if one uses a table of contents …
>
> The table of contents needs two passes too but only Hans can say (or provide
> a command like \convertedstructurecounter for section numbers) how you can
> access these information.

the beta now has

\starttext

\dorecurse {5} {
     \chapter{Test #1}
     first: \somestructureheadnumber[chapter][first]\par
     current: \somestructureheadnumber[chapter][current]\par
     last: \somestructureheadnumber[chapter][last]
     \dorecurse {3} {
     \section{Test #1}
         first: \somestructureheadnumber[section][first]\par
         current: \somestructureheadnumber[section][current]\par
         last: \somestructureheadnumber[section][last]
     }
}

\stoptext

upto the two of you who wikifies this

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: last chapter number
  2010-01-18 12:11           ` Hans Hagen
@ 2010-01-18 15:04             ` Andreas Harder
  2010-01-18 15:47             ` last chapter number in Metapost Andreas Harder
  1 sibling, 0 replies; 11+ messages in thread
From: Andreas Harder @ 2010-01-18 15:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 18.01.2010 um 13:11 schrieb Hans Hagen:

> the beta now has
> 
> \starttext
> 
> \dorecurse {5} {
>    \chapter{Test #1}
>    first: \somestructureheadnumber[chapter][first]\par
>    current: \somestructureheadnumber[chapter][current]\par
>    last: \somestructureheadnumber[chapter][last]
>    \dorecurse {3} {
>    \section{Test #1}
>        first: \somestructureheadnumber[section][first]\par
>        current: \somestructureheadnumber[section][current]\par
>        last: \somestructureheadnumber[section][last]
>    }
> }
> 
> \stoptext
> 
> upto the two of you who wikifies this

Thanks a lot!

I’ve wikified your example.

Greetings
	Andreas

___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: last chapter number in Metapost
  2010-01-18 12:11           ` Hans Hagen
  2010-01-18 15:04             ` Andreas Harder
@ 2010-01-18 15:47             ` Andreas Harder
  2010-01-18 16:22               ` Hans Hagen
  1 sibling, 1 reply; 11+ messages in thread
From: Andreas Harder @ 2010-01-18 15:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 18.01.2010 um 13:11 schrieb Hans Hagen:

> the beta now has
> 
> \starttext
> 
> \dorecurse {5} {
>    \chapter{Test #1}
>    first: \somestructureheadnumber[chapter][first]\par
>    current: \somestructureheadnumber[chapter][current]\par
>    last: \somestructureheadnumber[chapter][last]
>    \dorecurse {3} {
>    \section{Test #1}
>        first: \somestructureheadnumber[section][first]\par
>        current: \somestructureheadnumber[section][current]\par
>        last: \somestructureheadnumber[section][last]
>    }
> }
> 
> \stoptext

One more question appeared: How to access them in a Metapost environment? I tried some methods but none of them seems to work.

% \setupMPvariables
%   [test]
%   [current={\somestructureheadnumber[chapter][current]},
%    last={\somestructureheadnumber[chapter][last]}]

\startuseMPgraphic{test} 
  current := \somestructureheadnumber[chapter][current] ;
  last    := \somestructureheadnumber[chapter][last]    ;
  % current := 2 ;
  % last    := 6 ;
  
  skip    := TextHeight * (current-1)/last ;
  StartPage ;
    fill fullcircle scaled 3cm shifted (skip,skip) ;
  StopPage ;
\stopuseMPgraphic

\defineoverlay[test][\useMPgraphic{test}]

\setupbackgrounds[page][background=test]

\starttext
\dorecurse{6}{\chapter{Kapitel #1}
  Kapitel \somestructureheadnumber[chapter][current] von
  \somestructureheadnumber[chapter][last] }
\stoptext

Thank you in advance

	Andreas

___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: last chapter number in Metapost
  2010-01-18 15:47             ` last chapter number in Metapost Andreas Harder
@ 2010-01-18 16:22               ` Hans Hagen
  0 siblings, 0 replies; 11+ messages in thread
From: Hans Hagen @ 2010-01-18 16:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 18-1-2010 16:47, Andreas Harder wrote:

> \startuseMPgraphic{test}
>    current := \somestructureheadnumber[chapter][current] ;
>    last    := \somestructureheadnumber[chapter][last]    ;
>    % current := 2 ;
>    % last    := 6 ;
>
>    skip    := TextHeight * (current-1)/last ;
>    StartPage ;
>      fill fullcircle scaled 3cm shifted (skip,skip) ;
>    StopPage ;
> \stopuseMPgraphic

not expandable and typeset ... so you i'll add

\somenamedheadnumber{chapter}{current}

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2010-01-18 16:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-16 16:46 last chapter number Andreas Harder
2010-01-16 19:52 ` Wolfgang Schuster
2010-01-16 22:08   ` Andreas Harder
2010-01-17  8:13     ` Wolfgang Schuster
2010-01-17 12:06       ` Andreas Harder
2010-01-17 12:36         ` Wolfgang Schuster
2010-01-17 22:57           ` Hans Hagen
2010-01-18 12:11           ` Hans Hagen
2010-01-18 15:04             ` Andreas Harder
2010-01-18 15:47             ` last chapter number in Metapost Andreas Harder
2010-01-18 16:22               ` 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).