* [NTG-context] conversion from realpage to pagenumber
@ 2024-01-12 9:18 mf
2024-01-12 11:02 ` [NTG-context] " Wolfgang Schuster
[not found] ` <05e1164f-55d8-40fb-b191-4b587aa14ab8@fiee.net>
0 siblings, 2 replies; 4+ messages in thread
From: mf @ 2024-01-12 9:18 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hello list,
how do I convert the realpage number to a page number?
Suppose you have a document with a frontmatter of 20 pages in roman
numerals, followed by the main text starting from page 1 in arabic numerals.
So the twelfth page is 'XII', while the twenty-second is '2'.
How do I get 'XII' from 12 and '2' from 22?
Massi
___________________________________________________________________________________
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: conversion from realpage to pagenumber
2024-01-12 9:18 [NTG-context] conversion from realpage to pagenumber mf
@ 2024-01-12 11:02 ` Wolfgang Schuster
2024-01-14 14:18 ` mf
[not found] ` <05e1164f-55d8-40fb-b191-4b587aa14ab8@fiee.net>
1 sibling, 1 reply; 4+ messages in thread
From: Wolfgang Schuster @ 2024-01-12 11:02 UTC (permalink / raw)
To: mailing list for ConTeXt users, mf
mf schrieb am 12.01.2024 um 10:18:
> Hello list,
>
> how do I convert the realpage number to a page number?
>
> Suppose you have a document with a frontmatter of 20 pages in roman
> numerals, followed by the main text starting from page 1 in arabic
> numerals.
>
> So the twelfth page is 'XII', while the twenty-second is '2'.
>
> How do I get 'XII' from 12 and '2' from 22?
\defineconversionset
[frontpart:pagenumber] [] [romannumerals]
\setuppagenumber
[way=byblock]
% Alternative method for "way=byblock" when you have an appendix where
% the pagenumber of the bodypart continues rather than being reset
%
% \startsectionblockenvironment[bodypart]
% \resetuserpagenumber
% \stopsectionblockenvironment
\starttext
\startfrontmatter
\dorecurse{20}{\samplefile{lorem}\page}
\stopfrontmatter
\startbodymatter
\dorecurse{20}{\samplefile{lorem}\page}
\stopbodymatter
\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
* [NTG-context] Re: conversion from realpage to pagenumber
[not found] ` <05e1164f-55d8-40fb-b191-4b587aa14ab8@fiee.net>
@ 2024-01-12 11:08 ` mf
0 siblings, 0 replies; 4+ messages in thread
From: mf @ 2024-01-12 11:08 UTC (permalink / raw)
To: mailing list for ConTeXt users
Il 12/01/24 10:39, Henning Hraban Ramm ha scritto:
> Am 12.01.24 um 10:18 schrieb mf:
>> Hello list,
>>
>> how do I convert the realpage number to a page number?
>>
>> Suppose you have a document with a frontmatter of 20 pages in roman
>> numerals, followed by the main text starting from page 1 in arabic
>> numerals.
>>
>> So the twelfth page is 'XII', while the twenty-second is '2'.
>>
>> How do I get 'XII' from 12 and '2' from 22?
>
> try \realpagenumber
>
The right one would be \userpagenumber, but it works only with the
current page.
The code for registers does that translation -- from an arbitrary
realpage of your document to the corresponding user page number, with
the right formatting -- but I could not find the code that does that in
strc-reg.* source files.
Massi
___________________________________________________________________________________
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: conversion from realpage to pagenumber
2024-01-12 11:02 ` [NTG-context] " Wolfgang Schuster
@ 2024-01-14 14:18 ` mf
0 siblings, 0 replies; 4+ messages in thread
From: mf @ 2024-01-14 14:18 UTC (permalink / raw)
To: mailing list for ConTeXt users, Wolfgang Schuster
Thank you Wolfgang,
but my problem is getting back the page of the document starting from a
"realpage" value picked from structures.registers.collected in the .tuc
file.
Anyway, looking at the .tuc file produced by your example, I found that
structures.pages.collected has all the information I need to reconstruct
the printed page number.
Here's an excerpt of the .tuc file:
utilitydata.structures.pages.collected={
{
["block"]="frontpart",
["number"]=1,
["numberdata"]=1,
["prefixdata"]=2,
["state"]="start",
},
{
["block"]="frontpart",
["number"]=2,
["numberdata"]=1,
["prefixdata"]=2,
["state"]="start",
},
...
{
["block"]="bodypart",
["number"]=1,
["numberdata"]=1,
["prefixdata"]=2,
["state"]="start",
},
{
["block"]="bodypart",
["number"]=2,
["numberdata"]=1,
["prefixdata"]=2,
["state"]="start",
},
...
So your answer was not the solution, but it's been the way to the solution.
Thank you again,
Massi
Il 12/01/24 12:02, Wolfgang Schuster ha scritto:
> mf schrieb am 12.01.2024 um 10:18:
>> Hello list,
>>
>> how do I convert the realpage number to a page number?
>>
>> Suppose you have a document with a frontmatter of 20 pages in roman
>> numerals, followed by the main text starting from page 1 in arabic
>> numerals.
>>
>> So the twelfth page is 'XII', while the twenty-second is '2'.
>>
>> How do I get 'XII' from 12 and '2' from 22?
>
> \defineconversionset
> [frontpart:pagenumber] [] [romannumerals]
>
> \setuppagenumber
> [way=byblock]
>
> % Alternative method for "way=byblock" when you have an appendix where
> % the pagenumber of the bodypart continues rather than being reset
> %
> % \startsectionblockenvironment[bodypart]
> % \resetuserpagenumber
> % \stopsectionblockenvironment
>
> \starttext
>
> \startfrontmatter
> \dorecurse{20}{\samplefile{lorem}\page}
> \stopfrontmatter
>
> \startbodymatter
> \dorecurse{20}{\samplefile{lorem}\page}
> \stopbodymatter
>
> \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-01-14 14:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-12 9:18 [NTG-context] conversion from realpage to pagenumber mf
2024-01-12 11:02 ` [NTG-context] " Wolfgang Schuster
2024-01-14 14:18 ` mf
[not found] ` <05e1164f-55d8-40fb-b191-4b587aa14ab8@fiee.net>
2024-01-12 11:08 ` mf
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).