yihui / bookdown-crc

A minimal example of using bookdown to write a book for Chapman & Hall/CRC
https://yihui.name/en/2018/08/bookdown-crc/
MIT License
72 stars 66 forks source link

Clicking on a chapter jumps to the next chapter instead. #10

Closed savadhanistablab closed 3 years ago

savadhanistablab commented 3 years ago

The hyperlinking in the given example jumps chapter by one unit.

cderv commented 3 years ago

Hi, thanks for the report.

Are you talking about the gitbook format ?

I tried to see what you meant but did not succeed.

Can you share more on what you see ?

Thank you.

savadhanistablab commented 3 years ago

Ah no, the gitbook works fine! This issue is in the pdfbook. When you click on a chapter heading (h1) in the Contents page, the jump happens to the next chapter.

Simply building the pdf_book will suffice.

cderv commented 3 years ago

Below is the file I obtain for building this repo. I don't see the +1 unit in jump when navigating the toc. What did I missed ? bookdown.pdf

savadhanistablab commented 3 years ago

This in fact does happen! :/ Here is a screen recording of the same:

https://user-images.githubusercontent.com/47740187/111983749-c078ad00-8b0a-11eb-9537-3c8a7d8b2b4a.mov

cderv commented 3 years ago

Thanks for sharing the screenshot. It made it clearer that it was in the toc inside the document. I was using a navigation toolbar in a pdf viewer and it works with that - I changed PDF viewer and can reproduce now. That is odd!

Thanks for the report and added information. I'll check if this happen only with this template.

cderv commented 3 years ago

It seems link to krantz.cls as I can't see that using documentclass: book.

@yihui have you encountered such issue already in the past ?

yihui commented 3 years ago

Yes, I've noticed this before, but didn't have time or interest to ask the help desk of Chapman & Hall. This is definitely a problem specific to their LaTeX class krantz.cls. If you want them to help, you may email texhelp@taylorandfrancis.com (if you do and get a solution, please also let me know). Thanks!

savadhanistablab commented 3 years ago

Alright! So here is the updated Krantz.cls that fixes the chapter & section jump issue. krantz.cls.txt

Could you please update this file in your repos? :) Many thanks :)

yihui commented 3 years ago

@savadhanistablab Thanks! I just committed the changes.

@cderv We may need to sync the latest krantz.cls in this repo to other books (bookdown, blogdown, rmarkdown guide, rmarkdown cookbook), but this is quite tricky because we have no tests for this LaTeX class. The only way to test it, unfortunately, is to manually inspect the PDF with our eyes. I have had several problems with this class before, and I don't want a new fix to introduce older problems. Again, unfortunately, these problems were reported by email and I'll have to dig them out. I'm not sure what would be the best to do (update the class in other books or not). Chapman & Hall really should manage this class as a LaTeX package in a public repo and have an issue tracker (and more importantly, tests)...