4

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
    If you are using ConTeXt MkIV, you should use the latest version of the ConTeXt Standalone distribution. – Aditya May 6 '12 at 4:33
7

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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