-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
split by rmd puts some footnotes outside "page-inner" div #947
Comments
This appears to be closely related to #662 (Formatting of the last element before a new section gets distorted in a GitBook). Perhaps even a duplicate, although in that case he doesn't it only being a problem with split by: rmd. |
Yes I can confirm that there is something not intended in the splitting process and the relocating of footnotes. I took some time to look on what is going on, and see if it is easy - but it is not. I think this is because there is the level 1 <div id="chapter-1" class="section level1" number="1"> but your other files does not contains level 1 heading so the closing I am not really sure bookdown support writting Rmd files without first level header - There is a warning about that was introduced, I think to warn against this sort of non supported behavior - see #305 So I am not really sure it is a bug - Each Rmd files must contains a level 1 header and |
Thanks for taking a look. I'm bummed it's not simple to change the behavior. I was under the impression that by merging first, that I wouldn't need every file to start with a first level header. Indeed, if every file has to start with a first level header, isn't it the case that split by rmd is exactly the same functionality as split by chapter? |
The split is the same but the difference is in the html file names. Per the doc:
By curiosity, why the need of multiple Rmd files for one chapter ? |
That's odd. "Split by" doesn't seem to imply that it is about naming, but rather where the files are broken up into new web pages. That's what I took away from the bookdown book saying "The main difference between rendering in R Markdown and bookdown is that a book will generate multiple HTML pages by default. To change the way the HTML pages are split, the split_by argument can be specified. This defaults to split_by: chapter, but readers may prefer to use split_by: section if there are many sections within chapters, in which case a chapter page may be too long." Nothing about naming is mentioned, and in my case, I don't care what the html files are named. I just want the experience to be good for the reader—not empty pages, and not super long pages. Currently I appear to be stuck having one or the other of those: I have a book where I need to go back and forth from splitting by chapter or splitting by section. Because the content is like this:
Splitting by chapter doesn't work, because they are way too long. Splitting by section doesn't work, because then I end up with very confusing pages that just say "Chapter 2" or "Chapter 3" with no other content. Those pages should also contain the content of the first section in the chapter. Split by rmd does exactly what I want. Except for this footnote problem. By the way, I'm not the only person using it this way: |
By the way, if you have other suggestions for how I could handle this, I'm all ears. |
Thanks for the explanation and the links toward other use case. I see how this can be useful.
There could be other issue you are not seeing because of the splitting. Basically, bookdown is splitting some html file into several parts and having level 1 header only in some file but not all creates some undesired html structure. @yihui when implementing
I am curious if you tried using |
You're right. Upon closer examination, it does appear there is a bit of trouble in the HTML. But very little that I saw. Mostly it looks like some elements didn't get named properly.
I haven't. I'll give it a try. |
PART does not work for a few reasons.
I would need to make up a meaningless "chapter" before I could put the content in. This might not seem like a high hurdle, but my use of bookdown is almost exclusively to put high-quality reproductions of old books available online. I don't have the freedom to just change the book by making up and adding a chapter title. Perhaps the title of this issue should be changed to "Feature request: allow Rmd files to start with h2"? Would a pull request be welcome if I can find somebody to work on that feature? |
@cderv I'm also using multiple rmd files for one chapter. As a matter of fact the #Chapter headline often stands for its own. The reason is that I can delegate the creation and maintenance of content of a long chapter to different people. This approach works really nice with bs4_book. There is a clean structure on the left side and a detailed toc on the right one. @jtbayly Thanks to this issue I now have an idea why sometimes the footnotes are beneath the navigation arrows in a bs4_book. |
I just changed a book to split by rmd instead of section, putting each section into its own file. The output for the bookdown::gitbook version takes each chapter's final section's footnotes and puts them outside the "page-inner" div, thus messing up the footnote styling for that section only. I've tried it on the default and dev versions of bookdown, as well as the packaged version of Pandoc and Pandoc 2.10.1. It's the same all around.
Here's a simple demonstration book with the problem visible in sections 1.3 and 2.2, but all other sections working fine:
bd-footnote-problem.zip
If you switch back to split by section and rebuild, the problem disappears.
xfun::session_info('bookdown')
By filing an issue to this repo, I promise that
xfun::session_info('bookdown')
. I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('rstudio/bookdown')
.I understand that my issue may be closed if I don't fulfill my promises.
The text was updated successfully, but these errors were encountered: