Apostrophe rendered differently in html, notebook and Rstudio - r

This is a problem I have been having for the longest time and have found no solution.
When a rmd file below is used to render html, notebook and pdf, the apostrophe is rendered differently.
In Rstudio it is also rendered differently.
---
title: "R Notebook"
output:
html_document: default
html_notebook: default
pdf_document: default
---
```{r}
library(tidyverse)
```
I am using RStudio (Version 1.3.1093) on Windows 10 Pro
Language settings on English USA
How to fix such that the Rstudio and notebook renders the apostrophe correctly?
HTML Document render
Notebook document render
PDF Document render
RStudio Rmarkdown render

Related

When knitting an Rmd file to pdf, hashtags in links to bookdown books are converted to %23 and don't work

When I knit the following Rmd file to pdf, the # in the link to the bookdown book is converted to %23 and doesn't work. The link works fine if the Rmd is knitted to html instead of pdf.
I tried escaping the # with \ and \\; neither worked.
---
output: pdf_document
urlcolor: blue
---
This link does not work in the rendered pdf:
https://bookdown.org/yihui/bookdown/markdown-syntax.html#inline-formatting
Is there any way to get such a link to work in a rendered pdf document?
As per the comments, it's an issue with the PDF Viewer.
Reference: https://tex.stackexchange.com/questions/555559/href-broken-links-due-to-url-encoding-hash-sign-23

Displaying figures from RMarkdown with github_document output

I am trying to display figures on github from RMarkdown without success.
The figure is displayed on the local html preview.
After pushing on Github the md file the figure is not displayed.
title: "Untitled"
output: github_document
summary(cars)
plot(pressure)
Need to push the images files containing figures too.

embedding svg figures in rmarkdown child files

I have a Rmd report that looks like this:
---
output:
pdf_document:
latex_engine: xelatex
---
Some text
```{r child="children/stuff.Rmd", results="asis", cache=FALSE}
```
The stuff.Rmd file is in a subfolder of the project called children. The image I want to include is in a subfolder of the project called figures.
stuff.Rmd looks like this, and the image preview in RStudio works:
something, something
![this is a picture](figures/school_stages.svg)
It seems to be erroring out on the child rmd not being able to find the _school_stages.svg_, you can see this error when editing the child
(no image at path figures/school_stages.svg)
knitting the file gives an error, apparently from the child Rmd:
! Unable to load picture or PDF file 'figures/school_stages.svg'.
Changing figure.Rmd to:
something, something
![this is a picture](../figures/school_stages.svg)
gets rid of the error in edit mode but on knitting gives:
! Unable to load picture or PDF file '../figures/school_stages.svg'.
Any idea how to resolve this?
RStudio Version 1.2.1335
Knitr version 1.23
This is highly dependent on the image type. .png and .pdf are fine, but .svg (plain or inkscape versions don't currently work)

Export to PDF using rmarkdown render without PDF navigation buttons

I am using the render function from rmarkdown to export a .Rmd file to PDF.
The .Rmd file is the template generated within RStudio using
New File > R Markdown > Presentation > PDF (Beamer)
When export to PDF, each PDF page has navigation buttons at the bottom of the page which I would like to exclude during the export process. Below are the buttons.
Does anyone know how to exclude these navigation buttons?
You can add a command to turn them off in your header:
---
title: "Untitled"
output: beamer_presentation
header-includes:
- \beamertemplatenavigationsymbolsempty
---

use highlight.js theme in rmarkdown::html_document() .Rmd

Can I specify a highlight.js style in RMarkdown front matter when using html_document?
example:
Instead of using pandoc's espresso highlighting say I want highlight.js's tommorrow highlithing which lives here
---
title: "Untitled"
output:
html_document:
highlight: espresso
---
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r}
summary(cars)
```
etc...
How might I do this?
As far as I know, there is not built-in way to do this but you can add the following lines at the beginning of your Rmd document to get what you want:
<style type="text/css">
#import "https://highlightjs.org/static/demo/styles/tomorrow.css";
</style>

Resources