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.

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?

share|improve this question
    
If you are using ConTeXt MkIV, you should use the latest version of the ConTeXt Standalone distribution. –  Aditya May 6 '12 at 4:33

1 Answer 1

up vote 6 down vote accepted

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.

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.