# RStudio IDE 1.4 and Pandoc(?) completely freezes

After updating to IDE 1.4 when I use rmarkdown::render("notebook/voed.Rmd") R and Rstudio complete freeze after this appears in my console.

/usr/local/bin/pandoc +RTS -K512m -RTS voed.utf8.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output voed.html --lua-filter /Library/Frameworks/R.framework/Versions/4.0/Resources/library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /Library/Frameworks/R.framework/Versions/4.0/Resources/library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --standalone --section-divs --template /Library/Frameworks/R.framework/Versions/4.0/Resources/library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --include-in-header /var/folders/yk/y0ktcp9n62g7vf4g0y5ypscw0000gn/T//RtmpN87ysg/rmarkdown-str10ed1ea848eb.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --citeproc

The header of my .Rmd is this:

## output: tufte::tufte_html: default bibliography: references.bib link-citations: yes csl: apa.csl

library(tufte)
# invalidate cache when the tufte version changes
knitr::opts_chunk$set(tidy = FALSE, cache.extra = packageVersion('tufte')) options(htmltools.dir.version = FALSE)  This work without any problems for the past month, until my update to IDE 1.4. Now I have to force quit (on Mac) because stopping the current process in Rstudio doesn't even work. I have no clue what has happened... After some trails, and errors, I found that the freeze only occurs with the apa.csl style. In this case it doesn't matter whether I use apa.csl or one of the other app.#.#.csl formats. When using chicago-author-date-16th-edition.csl no problems occur.$version
[1] ‘2.11.3.2’

So you got the last one.

Can you share a link to the csl style that does not work ?

The apa style(s) from https://github.com/citation-style-language/styles

Things are even more strange. This sentence in a paragraph

Zie k2015[181] en gill[496] voor details en discussie van \hat{R}.

Results in the following sentence in HTML:

Zie Kruschke (2015, 181) en Kruschke (2015, 181) voor details en discussie van R̂.

When I move the gill to the next paragraph ALL citations in that paragraph are changed into gill.

So it looks like within one paragraph in the .Rmd file ALL citations are changed to the first one.

And, when link-citations: yes is commented, and the bibliography is printed at the bottom of the document, kruschke and gill are rendered as they should in the paragraph.

Can you provide an example Rmd with this?

Sure. Watch what happens when one changes link-citations: yes to link-citations: no

With link-citations: yes in every paragraph all references after the first are changed "into" the first.
When changing to the apa-6th-edition.csl R and Rstudio completely freeze after pandoc is called.

The partial .Rmd

https://robertvoogdgeert.nl/voed/tmp/pandoc_rstudio14.Rmd

And the bib file

https://robertvoogdgeert.nl/voed/tmp/pandoc_rstudio14.bib

1 Like

Thanks I'll have a look and report back

1 Like

Tried the same doc and bib, but now within bookdown. There everything works like it should. So problem is related to Tufte, I suppose.

My last reply was premature... With APA bookdown also freezes.

1 Like

Thanks for sharing all this. After a quick step by step debugging, I found that the issue was not related to R Markdown but with an entry in your bib file. The only reference causing issue is @lg which I think as an incorrect syntax because using 2 like that : {{ }} in the title field

@article{lg,
author  = {Leenders, C. and G. Geerdink},
journal = {Tijdschrift voor Lerarenopleiders},
number  = {3},
pages   = {55--66},
title   = {{Mannelijke pabostudenten kiezen niet voor kleuters. Weloverwogen of op basis van misconcepties? }},
volume  = {34},
year    = {2013}
}


If you remove the duplicated { and }, I believe it will work as expected.

It could be an issue with Pandoc new citeproc that does not throw an error and hand. Because with old Pandoc 2.7.3 it works ok, but with new version shipped in RStudio, it does not. You can as in Pandoc discussion (https://groups.google.com/g/pandoc-discuss) using a minimal example without rmarkdown.
For example in test.md

---
title: "Studievoortgang aan de pabo"
bibliography: references.bib
csl: https://www.zotero.org/styles/apa-6th-edition
---

studies van Gerda Geerdink waarvan een meer recente @lg


with the faulty bib file and using this commandline

pandoc -t html -f markdown --citeproc test.md


Hope it helps

1 Like

1 Like

Thanks for the report @RobertVoogdgeert! This is indeed a bug in tufte with the moving references in margin.

@RobertVoogdgeert the issue has beend fixed now in dev version of tufte

You can install with

remotes::install_github('rstudio/tufte')


Please report if it does not work for you.

Just tested it. Works like a charm with any Chicago as csl.

Any of the APA.###.csl results in a bibliography at the bottom even with link-citations: yes. But the references are produced correctly, even if multiple within one and the same paragraph, with Chicago as well as with APA.

The new thing now, is the references being placed at the bottom instead of in a side note, which is what the link-citations: yesshould produce.

Oh thanks, so the fix is not complete. I believe it highly dependent of the CSL used. I'll fix that to be more generic.

@RobertVoogdgeert I pushed another fix to work with these type of CSL which use hanging indents for references.

Try the new dev version from Github with APA style. Thank you!

Hurray! It works as it should! Thank you so much!

Thank you for the feedback! It is greatly appreciated!

Here I am with some new small things I noticed. Math is not rendered correctly when part of the title-field of a .bib entry. E.g. the $\widehat{R}$part of the title in:

@article{vehtari_2020,
title     = {Rank-Normalization, Folding, and Localization: An Improved $\widehat{R}$ for Assessing Convergence of MCMC},
issn      = {1936-0975},
url       = {http://dx.doi.org/10.1214/20-BA1221},
doi       = {10.1214/20-ba1221},
journal   = {Bayesian Analysis},
publisher = {Institute of Mathematical Statistics},
author    = {Vehtari, Aki and Gelman, Andrew and Simpson, Daniel and Carpenter, Bob and Bürkner, Paul-Christian},
year      = {2020},
month     = {Jul}
}


is rendered as (hat{R}):

Vehtari, A., Gelman, A., Simpson, D., Carpenter, B., & Bürkner, P.-C. (2020). Rank-normalization, folding, and localization: An improved (hat{R}) for assessing convergence of MCMC. Bayesian Analysis. https://doi.org/10.1214/20-ba1221


So it seems something with MathJax is not going as should be.