index refers to wrong page when indexing words outside of the mainmatter

When using bookdown to render to pdf following the instructions in Write a Book with bookdown and Publish with Chapman & Hall, we have found in two projects that items that are indexed in the frontmatter are given the wrong page number - they get pointed to a page of the list of figures, but not to the preface.

So, including something like this in index.Rmd (which comes before the /mainmatter command):

Basic familiarity with version control\index{version control} and ...

Gets a page number of x - which is one of the pages of the list of figures. Has anyone else encountered this? And found a solution?

This also happens in the bookdown package demo book. On this line is an index entry in front matter ( index.Rmd ) for GitBook: https://github.com/rstudio/bookdown/blob/6ae8900f1438a463a6e14ab8ffbe75eecb1d59a4/inst/examples/index.Rmd#L54

And then in the pdf, if you look in the index for GitBook it refers to page ix, which again is a page in the list of figures.

For reference, issue has been opened

we'll look into that there.