5

I want to obtain the current page number, for use in Lua conditionals, e.g.:

\startlua
    if 10 <= \pagenumber < 20 then
        context("The pages are between 10 and 20")
    end
\stoplua

How can I display and work with the current page number in ConTeXt?

1
  • 1
    If you are using ConTeXt MkIV, you should use the latest version of the ConTeXt Standalone distribution.
    – Aditya
    Commented May 6, 2012 at 4:33

1 Answer 1

8

You can access the current page number with tex.count.pageno.

\startluacode
    if 10 <= tex.count.pageno and tex.count.pageno < 20 then
        context("The pages are between 10 and 20")
    end
\stopluacode

Another thing: You have to combine the two tests with an and. A simple concatenation like in your example does not work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .