R Markdown: How to use icons - r

I would like to inlcude Icons at the beginning of my titles in an R markdown script. I found a CV template of a girl that does so, but this does not work for me:
https://github.com/loreabad6/R-CV/blob/master/CV.Rmd
'library(fontawesome)'
\faIcon{university}
I also tried: In `rmarkdown`, how to add icon in sentence?
`r icons::fontawesome("markdown")`
What do I need to do instead?

HTML
You can use the following code to add icons:
---
title: "Untitled"
author: "Author"
date: "2022-08-15"
output: html_document
---
```{r setup, include=FALSE}
remotes::install_github("mitchelloharawild/icons")
icons::download_fontawesome()
```
# This is my title `r icons::fontawesome("markdown")`
Output:
PDF
You can use the latex package fontawesome5. I had to install the package rsvg (just in console) before running the following code:
---
title: "Untitled"
author: "Author"
date: "2022-08-15"
output:
pdf_document:
keep_tex: true
header-includes:
- \usepackage{fontawesome5}
---
# This is my title `r icons::fontawesome("markdown")`
Output:

Related

hyphen in RMarkdown

Hello I'm quite new to using Rmarkdown and using Latex in genral.
I would like to use a hyphen with in a formula in a Rmarkdown html reprot.
This is my code:
---
pagetitle: "Home"
author: "R lumpe"
date: "`r format(Sys.Date(),'%d.%m.%Y')`"
output:
html_document:
df_print: paged
word_document: default
pdf_document: default
keep_md: yes
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(echo = F)
```
$$\frac{variable-name}{other-variable-name}$$
But in the document I only recive a "long" Minus sign and not a - "short" hyphen
Thanks for you help.
Change to text mode using \text
$$\frac{variable\text-name}{other\text-variable\text-name}$$

r - rmarkdown - yaml - Is it possible to include inline, internal document hyperlink in title?

is it possible to include an inline (internal document) hyperlink in the YAML title block of a RMarkdown document? Or is there a R package that allows this?
Below is what I am trying to do:
---
title: blah {#one1} and so on {#two2}
...
---
# Bibliography
1. Reference note to [explain](#one1) in title
2. Reference note to [explain](#two2) in title
Thank you.
The title is parsed as markdown, so you can use regular markdown link syntax in order to get the behavior you want.
---
title: 'There is a link in this title...[LINK](#anchor)'
author: "Jason Punyon"
date: "6/16/2020"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Bibliography
<p id='anchor'>Here's where I went!</p>
You could also just put the link in manually...
---
title: 'There is a link in this title...LINK'
author: "Jason Punyon"
date: "6/16/2020"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Bibliography
<p id='anchor'>Here's where I went!</p>

Display YAML and chunks without executing them in blogdown

In an article made with blogdown, I would like to show the YAML and some chunks I used in a previous work. Therefore, I would like to display them without executing them, just as-is. I tried to embed the YAML and the chunks with 4 backticks but the execution of chunks still depends on their options. Here's an example:
---
title: ""
author: ''
date: ""
output:
blogdown::html_page
---
Display a fake YAML and a fake chunk:
````
---
title: ""
author: ''
date: ""
output:
pdf_document
---
```{r}
1 + 1
```
````
As you can see, the chunk containing 1+1 is executed. This is what should be displayed:
---
title: ""
author: ''
date: ""
output:
pdf_document
---
```{r}
1 + 1
```
How can I do that? If it matters, the extension of my file is .Rmarkdown, and not .Rmd.
I had a look in the source of the RMarkdown book. Besides the four backticks the trick is to put
`r ''`
in front of the code chunk. Try this:
---
title: "Untitled"
output: html_document
---
````markdown
---
title: ""
author: ''
date: ""
output:
pdf_document
---
`r ''````{r}
1 + 1
```
````

R Markdown keywords don't appear in the document

I want to knit a pdf-document but the keywords don't appear in the final document. Can someone say me what I'm doing wrong?
---
title: "title"
subtitle: "subtitle"
author: "author"
date: "09 04 2019"
output:
pdf_document:
keywords: "word1, word2, word3"
footerdate: yes
abstract: 'Insert abstract here'
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Introduction
When knitting to PDF, keywords are sent to the file metadata but are not actually visible in the file. Source
You can customize the template for PDF generation or render Rmd files with base_format: rticles::elsevier_article.
However, there is another way to show keywords on the PDF just by adding few codes to the Rmd file:
Add a LaTeX code to provide the \keyword command (\providecommand{\keywords}[1]{\textbf{\textit{Keywords---}} #1}) into YAML's header-includes key;
Add keywords in the text section using the LaTeX command
---
title: "title"
subtitle: "subtitle"
author: "author"
date: "09 04 2019"
output:
pdf_document:
# keywords: "word1, word2, word3" # <- You don't have to add your keywords here since they only appear as the 'invisible' metadata of PDF
footerdate: yes
abstract: 'Insert abstract here'
header-includes:
- |
```{=latex}
\providecommand{\keywords}[1]{\textbf{\textit{Keywords---}} #1}
```
---
```{=latex}
\keywords{word1, word2, word3}
```
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Introduction

Change the caption title of a figure in markdown

I'm currently writing a small report in German. Hence I want my figure caption titles to be changed from Figure 1 to Abbildung 1 and so on.
---
title: "Untitled"
author: "me"
date: '`r format(Sys.time(), "%d %B, %Y")`'
output:
pdf_document: default
---
```{r iris, fig.cap='Iris sepal lengths'}
hist(iris$Sepal.Length)
```
Question: How can I change the default figure title (not sure if it's actually called that way) in R Markdown?
If you are writing in any language other than English, you can change the language options of the outputted pdf with the lang YAML option. This will override all the captions, labels, table of contents etc.
---
output: pdf_document
lang: de
---
```{r iris, fig.cap='Iris sepal lengths'}
hist(iris$Sepal.Length)
```
Other language options include fr (French), it (Italian) etc. See http://pandoc.org/MANUAL.html#language-variables for more details.
Following the example from this question, you can define your own tex file where you can change figure caption defaults.
header.tex:
\usepackage{caption}
\captionsetup[figure]{name=Abbildung}
This is the main .Rmd file:
---
title: "Untitled"
author: "me"
date: '`r format(Sys.time(), "%d %B, %Y")`'
output:
pdf_document:
includes:
in_header: header.tex
---
```{r iris, fig.cap='Iris sepal lengths'}
hist(iris$Sepal.Length)
```

Resources