Re: [NTG-context] last chapter number

2010-01-18 Thread Hans Hagen

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
___


Re: [NTG-context] last chapter number

2010-01-18 Thread Andreas Harder

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
___


Re: [NTG-context] last chapter number in Metapost

2010-01-18 Thread Andreas Harder

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
___


Re: [NTG-context] last chapter number in Metapost

2010-01-18 Thread Hans Hagen

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
___


Re: [NTG-context] last chapter number

2010-01-17 Thread 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.

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
___


Re: [NTG-context] last chapter number

2010-01-17 Thread Andreas Harder

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
___


Re: [NTG-context] last chapter number

2010-01-17 Thread Wolfgang Schuster

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
___


Re: [NTG-context] last chapter number

2010-01-17 Thread Hans Hagen

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
___


[NTG-context] last chapter number

2010-01-16 Thread 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.

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
___


Re: [NTG-context] last chapter number

2010-01-16 Thread 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]

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
___


Re: [NTG-context] last chapter number

2010-01-16 Thread Andreas Harder

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
___