summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/strc-pag.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/strc-pag.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/strc-pag.lua18
1 files changed, 16 insertions, 2 deletions
diff --git a/Master/texmf-dist/tex/context/base/strc-pag.lua b/Master/texmf-dist/tex/context/base/strc-pag.lua
index 460d4ff008e..f70d37d6397 100644
--- a/Master/texmf-dist/tex/context/base/strc-pag.lua
+++ b/Master/texmf-dist/tex/context/base/strc-pag.lua
@@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['strc-pag'] = {
license = "see context related readme files"
}
-local texcount, format = tex.count, string.format
+local texcount = tex.count
local allocate, mark = utilities.storage.allocate, utilities.storage.mark
@@ -69,6 +69,9 @@ function pages.save(prefixdata,numberdata)
end
end
+-- We can set the pagenumber but as it only get incremented in the page
+-- builder we have to make sure it starts at least at 1.
+
function counters.specials.userpage()
local r = texcount.realpageno
if r > 0 then
@@ -78,12 +81,23 @@ function counters.specials.userpage()
if trace_pages then
report_pages("forcing pagenumber of realpage %s to %s",r,t.number)
end
+ return
end
end
+ local u = texcount.userpageno
+ if u == 0 then
+ if trace_pages then
+ report_pages("forcing pagenumber of realpage %s to %s (probably a bug)",r,1)
+ end
+ counters.setvalue("userpage",1)
+ texcount.userpageno = 1
+ end
end
+local f_convert = string.formatters["\\convertnumber{%s}{%s}"]
+
local function convertnumber(str,n)
- return format("\\convertnumber{%s}{%s}",str or "numbers",n)
+ return f_convert(str or "numbers",n)
end
function pages.number(realdata,pagespec)