Dear Wolfgang,

 

Thank you for taking the time to go through the example and indicating these improvements.

 

I will definitely evaluate and start applying this to my own code.

 

Kind regards,

Jan Willem

 

 

 

 

From: Wolfgang Schuster
Sent: Friday, 4 September 2020 10:47
To: mailing list for ConTeXt users; Jan Willem Flamma
Subject: Re: [NTG-context] \setupuserpagenumber not working as expected

 

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