Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Table of Contents page numbering for List of Figures and List of Tables #13

Open
eugenesit opened this issue Mar 24, 2020 · 4 comments
Labels

Comments

@eugenesit
Copy link

Describe the bug
In the generated PDF, the Lists of Figures and Lists of Tables page numbering is incorrect in the Table of Contents. Page numbers are ahead of where they should be (says page ii for LoF but the page is iv, iii for LoT but page is v).

To Reproduce
I followed the given instructions to produce the huskydown PDF.

I have been working on my own template adaptation of thesisdown (https://github.com/eugenesit/gaelsdown) and found that this issue applies to any section which follows the ToC and using the same page numbering (arabic), not just the LoF and LoT (PDF).

Efforts to Resolve
This issue might be corrected in LaTeX by compiling multiple times (https://tex.stackexchange.com/questions/41897/wrong-page-number-for-list-of-figures-within-table-of-contents). I don't understand the internal workings of pdf_book well enough to know if there's a way to pass along these instructions. I tried specifying global options for tinytex to compile multiple times tinytex.compile.min_times=3 and to leave files in place tinytex.clean=FALSE, but this didn't change the output.

I also tried using the LaTeX package tocbibind to pass LoT and LoF to the ToC but this doesn't fix the problem. I also encountered this issue in thesisdown variant dragondown, which you can see in their PDF preview as well. huwiwidown (https://github.com/phister/huwiwidown) had correct page numbers for LoF and LoT, which seems to be due to the fact that the LaTeX class for this template is article, not book.

If you have any ideas for how to solve this problem I'd love to hear them! Thanks!

@eugenesit eugenesit added the bug label Mar 24, 2020
@benmarwick
Copy link
Owner

Thanks for letting me know about this. I don't have any immediate ideas. Sounds like changing the LaTeX class could fix it, what do you think?

@hwyneken
Copy link

hwyneken commented Jun 4, 2021

Had this exact problem - I got around it with a pretty dumb trick.

not a mwe, but here's the relevant code in my title page. The page numbers for listoffigures and listoftables were not working.
I knew that the list of figures started on page "ix", so I restarted the roman numerals at that page number - same for the tables at "xiii". I don't know how to do this automatically, and this could easily break.

%\addcontentsline{toc}{chapter}{Contents}
\tableofcontents
\newpage
\cleardoublepage

\pagenumbering{roman}
\setcounter{page}{9}

\phantomsection
\addcontentsline{toc}{chapter}{\listfigurename}
\listoffigures
\newpage
\cleardoublepage

\pagenumbering{roman}
\setcounter{page}{13}

\phantomsection
\addcontentsline{toc}{chapter}{\listtablename}
\listoftables
\newpage
\cleardoublepage

@eugenesit
Copy link
Author

I gave this another try and obtained the correct ToC page numbers by setting options(tinytex.compile.min_times = 3) in an R chunk in index.Rmd. However, the LoT and LoF hyperlinks in the PDF still don't point to the right pages.

I can't remember why this didn't work the first time - maybe I tried setting options in the console, or maybe I was checking the LoT or LoF links instead of the ToC numbers. Henry, could you let me know if you've tried this? If I set options(tinytex.compile.min_times = 1) the problem reappears, so I think this should be the right fix.

Ben, apologies for not getting back last year. I figured that changing the document class from book would adversely affect some of the other functions and ended up not getting around to testing that.

@hwyneken
Copy link

hwyneken commented Jun 7, 2021

I just compiled with .tex file through RStudio - I'm not that familiar with adjusting the latex settings in Rstudio, but it looks like they can be customized:

https://support.rstudio.com/hc/en-us/articles/200532257-Customizing-LaTeX-Options

I'll try to run it with this option next weekend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants