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?
1 Like
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.
cderv
November 8, 2021, 1:55pm
3
For reference, issue has been opened
opened 03:08AM - 21 Oct 21 UTC
closed 10:06PM - 24 Jan 22 UTC
tinytex
I initially opened [a thread about this in the RStudio Community forum](https://… community.rstudio.com/t/index-refers-to-wrong-page-when-indexing-words-outside-of-the-mainmatter/118516/2), but after further investigation, I think this might be a bug.
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 separate 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. I have looked in this `bookdown` repo and see the same thing happens with the demo book:
There is an Index entry in the front matter (`index.Rmd`) for Git Book on [line 54](https://github.com/rstudio/bookdown/blob/6ae8900f1438a463a6e14ab8ffbe75eecb1d59a4/inst/examples/index.Rmd#L54) that looks like this:
```
... and imported the GitBook\index{GitBook} style ...
```
Then in [the pdf](https://bookdown.org/yihui/bookdown/bookdown.pdf) the index entry for Git Book is "ix", which is a list of figure page:
<img width="555" alt="Screen Shot 2021-10-20 at 8 02 25 PM" src="https://user-images.githubusercontent.com/6865016/138204456-901abfa4-2149-4740-b802-74a3404786eb.png">
<img width="552" alt="Screen Shot 2021-10-20 at 8 02 56 PM" src="https://user-images.githubusercontent.com/6865016/138204471-32512596-ef5a-49db-8ffa-c46cf890c64a.png">
we'll look into that there.
system
Closed
November 29, 2021, 1:55pm
4
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.