2

I have a shiny app which produces a pdf report using multiple Rmd files and the bookdown package, the Rmd files mostly consist of Latex code with some code chunks for plots. I've been getting some inconsistent results between the pdf produced by the app running locally (via my browser/Rstudio) and the pdf produced by the hosed version running on shinyapps. When the pdf is produced locally the spacing is perfect and what I would expect, as seen below.

local table of contents

local text

When downloaded from the hosted app the spacing between table of contents items becomes more compressed as does the spacing between headings and corresponding paragraphs (this is less noticeable) as seen below.

hosted table of contents

hosted text

I have tried the latex commands

\onehalfspacing

and

\fontsize{10}{16}
\selectfont

to try and extend the table of contents but to no avail.

I have uploaded an example app to GitHub which exhibits the issue here: https://github.com/matt-888/stackoverflow

Any help would be greatly appreciated :) I've been trying to figure out what is going on for a while now and have implemented some work arounds but haven't found the source of the issue. I am also having a similar problem with plot positioning which I will post presently.

Matt.M.888
  • 71
  • 4
  • 1
    check what Latex engine is been used on the server. It may be a different engine than what you have locally. – lz100 Nov 11 '21 at 17:48
  • Thanks for your reply @lz100 The Latex engine seems to be the same, I specify it in the YAML and the console prints "--pdf-engine xelatex" right before rendering in both the shinyapps.io logs and the Rstudio console. Is that the best way to check? I also tried specifying a different latex engine locally, pdflatex throws an error because I am using the fontspec package and lualatex gives the same result as xelatex (no errors akin to hosted pdf) so I assume they can't be used on shinyapps.io. – Matt.M.888 Nov 11 '21 at 22:58

0 Answers0