[NTG-context] page range reference (how to compare references)

MF massifr at fastwebnet.it
Fri Sep 23 15:02:03 CEST 2016

I found a solution, but it's tricky (and there's no check on reference
existence in structures.references.collected).

  function userdata.printrange(singular, plural, label)
    local coll_ref = structures.references.collected[""]
    local pagestart = coll_ref[label .. ":start"].references.realpage
    local pagestop = coll_ref[label .. ":stop"].references.realpage
    if pagestart == pagestop then
    context.ref({"page"}, {label .. ":start"})
    if pagestart ~= pagestop then
      context.ref({"page"}, {label .. ":stop"})

  function userdata.printpagerange(label)
    userdata.printrange("page", "pages", label)



Tufte quote at \printpagerange{tufte}.

% start of quote reference

%\page  % comment/uncomment this to toggle from page range to single

% end of quote reference


More information about the ntg-context mailing list