Search code examples
rpandocbookdown

R bookdown: different output depending on operating system


I render the exact same R bookdown source, but get slightly different results depending on the operating system. This only regards the wrapping of the output width of code chunks when rendering with pandoc to HTML.

If the output is rather large like this enter image description here

on Windows 10 it adds a horizontal scroll bar, when looking at it on smaller screens. enter image description here

Running the same code on Ubuntu 20.04 gives me a different result enter image description here

I checked the output message of bookdown::render_book("index.Rmd", "bookdown::gitbook") and it's the exact same for both operating systems. The pandoc version is the same, too (2.11.4).

Any idea is highly appreaciated.


Solution

  • To inspect options("width") was the right hint from @thothal. I explicitly set the tibble.width but not the width globally.

    The lines will break without a horizontal scroll bar, if tibble.width > width. After updating my packages and RStudio I saw the same behavior on both operating systems. Not quiet sure though, what caused the difference in the first place. Maybe something changed for the tibble.width option internally. Or the default width depends on the OS or screen width of the device where it's run (unlikely).

    To summarise: The tibble.width has to be equal or smaller than the global width to avoid that ugly line break. It's best to set both explicitly.