A discussion that spans pages

A term is often discussed across several pages rather than mentioned at one. range="open" and range="close" say where such a discussion begins and where it ends, and the index prints one locator spanning the two rather than a locator at each end.

The discussion of [otters]{.index range="open"} begins here.

...several pages of it...

And the discussion of [otters]{.index range="close"} ends here.

In a PDF that prints as otters, 12--15; in HTML the entry carries a single numbered link, pointing at the opening mark, and the closing mark contributes no link of its own. Both marks keep their visible text exactly as written.

The two marks are paired by the entry they index. Nothing else has to be written: the closing mark is the next range="close" on the same entry as an opening. Write the same entry= (or the same visible term) on both.

A range can be the principal discussion. Put mention="principal" on either of its two marks and the whole range prints emphasized — otters, **12--15** — and in HTML the single link carries qi-principal and a <strong>, exactly as a lone principal mention does. The role belongs to the span rather than to either mark, so write it once, on whichever end you like.

A range pairs within one chapter. Quarto renders each chapter of an HTML book in its own process, so a range whose two marks are in one chapter is paired there and prints as one locator, exactly as it does in a single document. A range whose marks are in different chapters is not paired: each mark indexes on its own, as though you had not written range= at all. Each chapter reports its own half — the opening as never closed in that chapter, the closing as never opened there — and the book adds one report naming the pairs it can see split across its chapters. A PDF book is unaffected — Quarto renders it as one merged document, so its ranges span chapters as you would expect.

An ordinary mark inside a range disappears into it. If you also write a plain [otters]{.index} on a page inside the range, makeindex folds that locator into the range and prints nothing extra — silently, and without a line in its own transcript. The extension cannot warn about this: it does not know page numbers, so it cannot tell which marks fall inside a range and which do not, and a warning would fire on every mark of the term. Mark the term outside its own range, or accept that the range covers it.

Five things the extension refuses. Each is reported, and in each the mark indexes exactly as it would with no range= written — which for the first three and the last means an ordinary page number, and for the mark carrying a cross-reference means the cross-reference, which takes a locator’s place either way. The reason a refused range never reaches the index tool is that makeindex writes a transcript warning for a range it cannot pair, and Quarto fails the whole render on that warning:

  • an opening that is never closed;
  • a closing with no opening before it;
  • a second opening for a term whose range is still open — the first opening is the one the next closing pairs with;
  • a range mark that also carries see= or see-also=, since a cross-reference takes the place of a locator and a range is a locator;
  • a range= value that is neither open nor close — including an empty one, since range="" is a value you wrote rather than an attribute you left off.

Two overlapping ranges of one term cannot be told apart, since pairing is by entry; that is the third case above, and it is reported rather than guessed at.