Can an index be made to give both chapter number and page within that chapter?

Some of the books that I make using the Master Document mechanism are composed of chapters whose page numbers restart at 1 within each chapter. The page number in the headers has two parts, for example, “2-13” is page 13 within chapter 2. The trouble is, when I generate an index for the book, the page numbers in the index don’t indicate the chapter number, but only the page number within the chapter. So I would like to know whether there is any way to get the indexing mechanism to use these compound chapter-page numbers.

Barring that, I would like to be able to reference (and print) the consecutive page number within the book. Right now, I just use a pdf editor to add consecutive page numbers to the footer region after LibreOffice exports the pdf. But this is cumbersome, and of course these numbers are not referenced in the generated index. Ideally, a Master Document should be able to keep track of both consecutive page numbers and relative page numbers within each chapter.

For the first problem, Right click on the TOC → Modify. On the “contents” tab (I do not have an English version at hand so please check the names) click on the space to the left of the # button on the “structure” line and when there add the chapter number (first button below the structure line) and perhaps a space or a dash (just type them).

The second problem is more subtle and I do not think that there is an easy (or not easy) solution. On one hand you can insert a field at the beginning of each chapter to restart a “page counter” and then reference that counter on the footer together with a real page counter that runs through the whole document: just open the “more fields” dialogue and on the Variables tab you have the Set page variable → On (to be inserted at the beginning of each chapter) and the Show page variable (to be inserted on the footer). This will show a page number that restarts on each chapter and then you can use a normal, running number for the pages… but on the other hand now you have problems with the TOC.

Thank you, that is very helpful!

If the answer solves your question please tick the :heavy_check_mark:.