References Truncated in Beamer Presentation prepared in Knitr/RMarkdown

╄→尐↘猪︶ㄣ 提交于 2019-11-29 00:00:03

As @David above said in the comments:

For me it didnt work with ## References {.allowframebreaks} but it worked out with # References {.allowframebreaks}.

I would like to point out that, apparently for the reference slide to work you have to create a last slide with the same heading level es set by slide_level: __ at the YAML section.

So, the user should set one of the following:

  • # References {.allowframebreaks}. for those using slide_level: 1, OR
  • ## References {.allowframebreaks}. for those using slide_level: 2, OR
  • ### References {.allowframebreaks}. for those using slide_level: 3 and so on...
scoa

{.allowframebreaks} is the solution for multislides bibliographies in beamer. It works out of the box with regular pandoc templates (see my previous answer). However, knitr has a setting that prevents it, by redefining \widowpenalties in its beamer template. You can verify that if you examine the .tex file with keep_tex: true.

In my opinion, this is a bug. A quick fix would be to reset \widowpenalties to its default value. It can be done in your yaml front matter:

---
title: Title
header-includes:
  - \widowpenalties 1 150
output: 
  beamer_presentation
---

Then, you can indicate the reference section as such:

## References {.allowframebreaks}

While this goes outside of using the regular pandoc citation template, I have found another approach that can be used to put the references across slides but it relies on the natbib citation package.

In the YAML front matter, I added:

---
title: "Title"
output: 
  beamer_presentation:
    citation_package: natbib
bibliography: ../../RefenceDesk.bib 
biblio-style: "apalike"
---

The reference slide does not get a title and I cannot seem to adjust the font size (by using a \scriptsize at the end of the .Rmd file), but at least they appear coherently.

EDIT: For parsimony, I removed the csl: ../../apa.csl line, since natbib does not require it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!