Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Problem

The \pagenumber macro does not reflect the conversion attribute value within the context of front matter vs. body matter. The front matter uses Roman numerals, the body matter uses regular text.

Code

A minimum working example to show the problem:

\setuppapersize[letter][letter]

% See: http://tex.stackexchange.com/a/128858/2148
\setuplayout[
  % Allow text to be flush with the top
  topspace=\zeropoint,
  % Stretch the text to its maximum (to place page number at very bottom)
  height=fit,
  % Allow text to be flush with the bottom
  footerdistance=\zeropoint,
]

  \setupcolors[state=start]

\definecolor[colourhighlight][h=F5F6CE]
\definecolor[colourtocseparator][colourtertiary]

% Use Roman numerals for the front matter
\definestructureconversionset[frontpart:pagenumber] [] [romannumerals]

% Put a coloured box around the page number
\setuppagenumbering[
  command={\inframed[
    frame=no,
    background=color,
    backgroundcolor=colourhighlight,
    width=2em,
    height=2em,
  ]{\pagenumber}},
]

  % Right-align the page number in the footer and assume single-sided pages
  \setuppagenumbering[location={footer,right,margin},alternative=singlesided]

  % Do not define a double-sided document environment.
  % See: http://tex.stackexchange.com/a/122349/2148
  \setupmakeup[standard][page=yes, doublesided=no]

\starttext
\startfrontmatter
  \setuppagenumbering[conversion=romannumerals]
  \setcounter[userpage][1]

  % Title page (front cover)
  \startstandardmakeup
    Title page
  \stopstandardmakeup

  % Copyright page
  \startstandardmakeup
    Copyright
  \stopstandardmakeup

  % Table of Contents
  \completecontent
\stopfrontmatter

\startbodymatter
  \setuppagenumbering[conversion=numbers]
  \setcounter[userpage][2]

  \startchapter[
    title={chapter},
    reference=sec:chapter,
  ]

  \input knuth

  \stopchapter

\stopbodymatter

\stoptext

Actual Results

The output for the front matter shows the normal page number (this is not desirable: it should be a roman numeral) beside the page number converted to a Roman numeral:

Front Matter Page Number

The output for the body matter shows the normal page number (this is desirable) beside the page number converted to a regular number:

Body Matter Page Number

Expected Results

I was expecting the page number to keep the context of the conversion value, thus showing up as a roman numeral within the \inframed macro. I am trying to accomplish the following in the front matter:

Roman Numeral within Inline Frame

If possible, I'd rather avoid creating a layer.

Question

How can you create a page number in a \framed (or \inframed) that is formatted according to the conversion value specified by:

\setuppagenumbering[conversion=romannumerals]

Related

share|improve this question
2  
Try to create more minimal examples next time and remove unnecessary settings like \setuppapersize, \setupcolors and the makeups. A minimal example for your problem would be: \setupuserpagenumber[numberconversion=romannumerals]\starttext\pagenumber\stopt‌​ext –  Marco Aug 18 '13 at 23:21
1  
For different conversion of page number in front part and bodypart see this mailinglist post –  Aditya Aug 19 '13 at 1:30

1 Answer 1

up vote 2 down vote accepted

Short Answer

Change \pagenumber to \userpagenumber.

Expanation

Lets see what is happening here. Run context --pipe and type

*\show\pagenumber
> \pagenumber=macro:
->\strc_counters_raw \s!userpage .

So, \pagenumber gives the raw value of the counter \s!userpage.

On the other hand,

*\show\userpagenumber
> \userpagenumber=macro:
->\directconvertedcounter \s!userpage \empty .

so \userpagenumber gives the converted value of the counter \s!userpage.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.