-
Notifications
You must be signed in to change notification settings - Fork 127
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
TOC with more than a page stops the render. #314
Comments
@beatrizmilz, thank you for sharing this workaround. I'm experiencing the same issue, and confirm that (thankfully) the PDF rendered after changing to |
Could you please provide a minimal reproducible example? I can't reproduce this problem with the following Rmd example:
I think the error comes from pagedown/inst/resources/js/config.js Line 62 in 466c1c1
and the fix may be simple (i.e., change el.parentElement to el?.parentElement ), but without a reproducible example, we don't know what really went wrong.
Thanks! |
Hi Yihui! Thanks for responding! Sorry, one thing that I didn't mention is that I'm using the I'll try to create a reprex with the error I'm experiencing! With your reprex and the thesis_paged template, it does not generate an error, but the toc does not show properly:
|
Thank you @yihui for all your incredible work. After trying to recreate the issue I found the problem in my case was the TOC CSS I was using as a template to build off of (pasted below). After commenting out the CSS the PDF rendered perfectly with the TOC. The CSS comes from the nice {pagedreport} package (but of course I'm not blaming that code). Thanks again. /* ----------------------- Table of contents ----------------------- */
.toc a {
line-height: 30px;
text-decoration: none;
font-size: 14pt;
padding-right: .33em;
}
.toc ul {
list-style: none;
padding-left: 0;
overflow-x: hidden;
margin-right: 0%;
}
.toc li li{
padding-left: 1em;
}
.toc ul, .toc a, .toc a::after {
background-color: #ffffff;
color: var(--main-color);
font-weight: bold;
}
.toc ul > li > ul > li > a {
color: #000000;
}
/* page number */
.toc a::after {
content: target-counter(attr(href), page);
float: right;
background: white;
}
.toc a.front-matter-ref::after {
content: target-counter(attr(href), page, lower-roman);
}
.toc .leaders::before {
float: left;
width: 0;
white-space: nowrap;
content: ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ";
} |
@beatrizmilz Thanks for the clarification! Now I can see this output format is indeed problematic when the TOC is longer than one page. Your TOC page was truncated, and my PDF (generated on macOS) was completely truncated after the TOC: toc.pdf. I don't know how to fix it, though (cc @brentthorne). @ASNDataAnalytics Thanks for sharing the solution! |
Hi ! I have the same issue. The bug seems to be related to all .toc ul tags. If I remove it, the toc can be on two pages (but the layout misses some specs). I don't know if it helps someone to solve the bug, it's too complicated for my knowledge in css.... |
Hi all, like @ASNDataAnalytics pointed out, the issue is in the css, I found that if we change the above line in overflow-x: clip; Then the toc is able to render, but I am not too sure how this solve the bug |
This worked for me with the book_crc template. |
Hi!
When the document has a table of contents longer than a page, the document does not render.
It only renders when I set
toc: false.
This is the message that shows up:
I'm using the CRAN version of pagedown.
I'm creating this issue because this happened to me more than once.
Does anyone know how to handle this?
Thanks!
The text was updated successfully, but these errors were encountered: