\setupuserpagenumber not working as expected
![](https://secure.gravatar.com/avatar/adf1b6085515459d1ea446f4bf2c673a.jpg?s=120&d=mm&r=g)
Am seeking to have frontmatter pages in roman numerals and from Chapter 1 onwards in arabic numerals. I have achieved something of the kind, but page 1 (arabic) is appearing on the last page of the frontmatter and not the first page of Chapter 1. I do not know why this is happening. My setup for page numbering is as follows (something I found somewhere - wiki? elsewhere? Not sure. I didn't make it up!): \definestructureconversionset[frontpart:pagenumber][][romannumerals] \definestructureconversionset[bodypart:pagenumber] [][numbers] \startsectionblockenvironment[frontpart] \setupuserpagenumber[numberconversion=romannumerals] \setuplist[chapter][pageconversionset=pagenumber] \setuppagenumber[number=1] \stopsectionblockenvironment \startsectionblockenvironment[bodypart] \setuppagenumber[number=1] \stopsectionblockenvironment The frontmatter is some 16 pages worth (ends on a verso page but that verso carries the arabic number 1 instead of page xvi which it should be, since the final paragraph on that page ends with \stopfrontmatter. That means Chapter 1 (immediately after \startbodymatter) is now page 2 instead of page 1! I tried a slightly simpler version of the above which I found on Stackexchange: |\definestructureconversionset[frontpart:pagenumber][][romannumerals]|| | |\startsectionblockenvironment[bodypart]| |\setcounter[userpage][1]\stopsectionblockenvironment| but it gave me the same result. Any idea how I can get the correct result? Julian
![](https://secure.gravatar.com/avatar/74d41c3215dcdd377343cdc47311757c.jpg?s=120&d=mm&r=g)
jbf schrieb am 03.09.2020 um 06:04:
Am seeking to have frontmatter pages in roman numerals and from Chapter 1 onwards in arabic numerals. I have achieved something of the kind, but page 1 (arabic) is appearing on the last page of the frontmatter and not the first page of Chapter 1. I do not know why this is happening. My setup for page numbering is as follows (something I found somewhere - wiki? elsewhere? Not sure. I didn't make it up!):
\definestructureconversionset[frontpart:pagenumber][][romannumerals] \definestructureconversionset[bodypart:pagenumber] [][numbers] \startsectionblockenvironment[frontpart] \setupuserpagenumber[numberconversion=romannumerals] \setuplist[chapter][pageconversionset=pagenumber] \setuppagenumber[number=1] \stopsectionblockenvironment
\startsectionblockenvironment[bodypart] \setuppagenumber[number=1] \stopsectionblockenvironment
The frontmatter is some 16 pages worth (ends on a verso page but that verso carries the arabic number 1 instead of page xvi which it should be, since the final paragraph on that page ends with \stopfrontmatter. That means Chapter 1 (immediately after \startbodymatter) is now page 2 instead of page 1!
I tried a slightly simpler version of the above which I found on Stackexchange:
|\definestructureconversionset[frontpart:pagenumber][][romannumerals]|| |
|\startsectionblockenvironment[bodypart]|
|\setcounter[userpage][1]\stopsectionblockenvironment|
but it gave me the same result. Any idea how I can get the correct result?
Do you have these settings in your document? \setupsectionblock [frontpart] [page=] \setupsectionblock [bodypart] [page=] When this is the case change them to \setupsectionblock [frontpart] [page=yes] \setupsectionblock [bodypart] [page=yes] or add \page before \stopfrontmatter. Wolfgang
![](https://secure.gravatar.com/avatar/adf1b6085515459d1ea446f4bf2c673a.jpg?s=120&d=mm&r=g)
Thanks Jan, that is an extensive bit of work below! Might take me a while to digest, but I'll explore it carefully. Julian On 3/9/20 6:29 pm, Jan Willem Flamma wrote:
Dear Julian,
I use something similar using a main product file, an environment file that contain the styling and several components that build up the frontmatter, the manual and the appendices.
Below my setup where I start the roman numbering on the table of contents page (page 5 or v in roman)
Once the bodymatter starts the pagenumber is set to the arabic 1 (see below in the main product file)
You should be able to copy and adapt to your needs.
Kind regards,
Jan Willem Flamma
*The main product file*
==============
\environment env-WA
\startproduct currentproduct
% Document definitions
\define\MyManual{Course Manual}
\define\MyTitle{Title}
\define\MySubtitleOne{Subtitle 1}
\define\MySubtitleTwo{Subtitle 2}
\define\MyRevnumber{Revision number}
% Load frontmatter files
\startfrontmatter
\component fm-frontpage
\component fm-titlepage
\component fm-tableofcontents
\stopfrontmatter
% Load bodymatter file
\startbodymatter
\setupbackgrounds
[leftpage]
[setups=pagenumber:left]
\setupbackgrounds
[rightpage]
[setups=pagenumber:right]
\setuppagenumber[number=1]
\component co-01
\component co-02
\stopbodymatter
% Load backmatter files
\startbackmatter
\setupbackgrounds
[leftpage]
[setups=pagenumber:left]
\setupbackgrounds
[rightpage]
[setups=pagenumber:right]
\startappendices
\component co-ap-01
\component co-ap-02
\stopappendices
\stopbackmatter
% Load external PDF documents
\setuppagenumber[state=stop]
\copypages[External PDF/app1.pdf][n=4]
\stopproduct
=============
*The env-WA.tex file (below is about pagenumbering only)*
=============
% Start chapter on right (odd) page, pagenumber = bottom right
\setuppagenumbering
[alternative=doublesided,
location=right]
% Pagenumbering style
\definestructureconversionset
[frontpart:pagenumber][][romannumerals]
\definestructureconversionset
[bodypart:pagenumber] [][numbers]
\definestructureconversionset
[appendix:pagenumber] [][numbers]
=============
*The fm-frontpage.tex file*
============
\startcomponent currentcomponent
\product product
% Front page layout
\startstandardmakeup
% Place logo centered on page
\framed[height=5cm,width=broad,frame=off]
{\externalfigure[frontpage-logo.png][width=12cm]}
% Place course titles
\blank[6*big]
\color[Modu_Blue]{\midaligned{\bfc \MyManual}}
\blank[4*big]
\color[Modu_Blue]{\midaligned{\tfc \MyTitle}}
\blank[2*big]
\color[Modu_Blue]{\midaligned{\tfc \MySubtitleOne}}
\blank[2*big]
\color[Modu_Blue]{\midaligned{\tfc \MySubtitleTwo}}
\vfill
\stopstandardmakeup
\stopcomponent
============
*The fm-titlepage.tex file*
============
\startcomponent currentcomponent
\product product
\startstandardmakeup
\color[Modu_Blue]{\midaligned{\tfb \MyManual}}
\blank[2*big]
\color[Modu_Blue]{\midaligned{\tfb \MyTitle}}
\blank[2*big]
\color[Modu_Blue]{\midaligned{\tfb \MySubtitleOne}}
\blank[2*big]
\color[Modu_Blue]{\midaligned{\tfb \MySubtitleTwo}}
\blank[10*big]
\color[Modu_Blue]{\midaligned{\tfb \MyRevnumber}}
\blank
\midaligned{\color[Modu_Blue]{\tfb \currentdate[month,year]}}
\blank[10*big]
\midaligned{\color[Modu_Blue]{\tfb Written by:}}
\blank
\midaligned{\color[Modu_Blue]{\tfb Company name}}
\blank
\midaligned{\color[Modu_Blue]{\tfb City, Country}}
\vfill
\stopstandardmakeup
\stopcomponent
============
*The fm-tableofcontents.tex file*
============
\startcomponent currentcomponent
\product product
\setupbackgrounds
[leftpage]
[setups=pagenumber:left]
\setupbackgrounds
[rightpage]
[setups=pagenumber:right]
% This is where I want the roman numbering to start
\setuppagenumber[number=5]
\starttitle[title=Table of Contents]
\placecontent
\stoptitle
\stopcomponent
============
*From: *jbf mailto:roma83537@gmail.com *Sent: *Thursday, 3 September 2020 06:05 *To: *mailing list for ConTeXt users mailto:ntg-context@ntg.nl *Subject: *[NTG-context] \setupuserpagenumber not working as expected
Am seeking to have frontmatter pages in roman numerals and from Chapter 1 onwards in arabic numerals. I have achieved something of the kind, but page 1 (arabic) is appearing on the last page of the frontmatter and not the first page of Chapter 1. I do not know why this is happening. My setup for page numbering is as follows (something I found somewhere - wiki? elsewhere? Not sure. I didn't make it up!):
\definestructureconversionset[frontpart:pagenumber][][romannumerals] \definestructureconversionset[bodypart:pagenumber] [][numbers] \startsectionblockenvironment[frontpart] \setupuserpagenumber[numberconversion=romannumerals] \setuplist[chapter][pageconversionset=pagenumber] \setuppagenumber[number=1] \stopsectionblockenvironment
\startsectionblockenvironment[bodypart] \setuppagenumber[number=1] \stopsectionblockenvironment
The frontmatter is some 16 pages worth (ends on a verso page but that verso carries the arabic number 1 instead of page xvi which it should be, since the final paragraph on that page ends with \stopfrontmatter. That means Chapter 1 (immediately after \startbodymatter) is now page 2 instead of page 1!
I tried a slightly simpler version of the above which I found on Stackexchange:
\definestructureconversionset[frontpart:pagenumber][][romannumerals]
\startsectionblockenvironment[bodypart]
\setcounter[userpage][1] \stopsectionblockenvironment
but it gave me the same result. Any idea how I can get the correct result?
Julian
___________________________________________________________________________________ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________
![](https://secure.gravatar.com/avatar/74d41c3215dcdd377343cdc47311757c.jpg?s=120&d=mm&r=g)
Jan Willem Flamma schrieb am 03.09.2020 um 10:29:
Dear Julian,
I use something similar using a main product file, an environment file that contain the styling and several components that build up the frontmatter, the manual and the appendices.
Below my setup where I start the roman numbering on the table of contents page (page 5 or v in roman)
Once the bodymatter starts the pagenumber is set to the arabic 1 (see below in the main product file)
You should be able to copy and adapt to your needs.
There are lot of things which can be improved in your example. 1. Pass the filename of the component/product to \startcomponent and not some dummy name (or just use *), this allows you to print the filename with \currentcomponent or \currentproduct 2. Use \setvariables or \setupdocument to set the document title, revision etc. 3. Use \startsectionblockenvironment to move setups from the document content into the environment file. 4. Use pagestate=start to increase the page counter with \startstandardmakeup. 5. Set search path for figures (\copypages use the figure mechanism) with \setupexternalfigure[location=...]. Below is a modified (but untested) version of your sample document. Wolfgang %%%% begin product \startproduct product \environment env-WA % \setvariables % [document] % [ manual={Course Manual}, % title={Title}, % subtitleone={Subtitle 1}, % subtitletwo={Subtitle 2}, % revnumber={Revision number}] \setupdocument [ manual={Course Manual}, title={Title}, subtitleone={Subtitle 1}, subtitletwo={Subtitle 2}, revnumber={Revision number}] \startfrontmatter \component fm-frontpage \component fm-titlepage \component fm-tableofcontents \stopfrontmatter \startbodymatter \component co-01 \component co-02 \stopbodymatter \startappendices \component co-ap-01 \component co-ap-02 \stopappendices \startbackmatter \copypages[app1.pdf][n=4] \stopbackmatter \stopproduct %%%% end product %%%% begin environment \startenvironment env-WA \setuppagenumbering [alternative=doublesided, location=right] \defineconversionset [frontpart:pagenumber] [] [romannumerals] \setupexternalfigures [directory={External PDF}] \startsectionblockenvironment [frontpart] \setupbackgrounds [leftpage] [setups=pagenumber:left] \setupbackgrounds [rightpage] [setups=pagenumber:right] \stopsectionblockenvironment \startsectionblockenvironment [bodypart] \setupbackgrounds [leftpage] [setups=pagenumber:left] \setupbackgrounds [rightpage] [setups=pagenumber:right] \setuppagenumber [number=1] \stopsectionblockenvironment \startsectionblockenvironment [appendix] \setupbackgrounds [leftpage] [setups=pagenumber:left] \setupbackgrounds [rightpage] [setups=pagenumber:right] \stopsectionblockenvironment \startsectionblockenvironment [backpart] \setuppagenumber[state=stop] \stopsectionblockenvironment \stopenvironment %%%% end environment %%%% begin component \startcomponent fm-frontpage \product product \startstandardmakeup [top=,pagestate=start,align=middle,color=Modu_Blue] % \dontleavehmode\externalfigure[frontpage-logo.png][width=12cm] \framed [height=5cm,width=broad,frame=off] {\externalfigure[frontpage-logo.png][width=12cm]} \blank[6*big] {\bfc \documentvariable{manual}} \blank[4*big] {\tfc \documentvariable{title}} \blank[2*big] {\tfc \documentvariable{subtitleone}} \blank[2*big] {\tfc \documentvariable{subtitletwo}} \stopstandardmakeup \stopcomponent %%%% end component %%%% begin component \startcomponent fm-titlepage \product product \startstandardmakeup [top=,pagestate=start,align=middle,color=Modu_Blue] {\tfb \documentvariable{manual}} \blank[2*big] {\tfb \documentvariable{title}} \blank[2*big] {\tfb \documentvariable{subtitleone}} \blank[2*big] {\tfb \documentvariable{subtitletwo}} \blank[10*big] {\tfb \documentvariable{revnumber}} \blank {\tfb \currentdate[month,year]} \blank[10*big] {\tfb Written by:} \blank {\tfb Company name} \blank {\tfb City, Country} \stopstandardmakeup \stopcomponent %%%% end component %%%% begin component \startcomponent fm-tableofcontents \product product \starttitle [title=Table of Contents] \placecontent \stoptitle \stopcomponent %%%% end component
participants (3)
-
Jan Willem Flamma
-
jbf
-
Wolfgang Schuster