RMarkdown: How to change the font color?

The answer given at the link provided by @Ben Bolker: Roses are <span style=”color:red”>red</span>, violets are <span style=”color:blue”>blue</span>. does work if you select HTML (ioslides) as the output format. However, it does not work if you select pdf (beamer) as output format. If you want to create a pdf, use LaTeX syntax: Roses are \textcolor{red}{red}, … Read more

Insert a logo in upper right corner of R markdown pdf document

You can use the includes option in the yaml to specify a custom addition to your latex header. The yaml part would look like — output: pdf_document: keep_tex: true includes: in_header: header.tex — and you need to save a separate file called header.tex with the following defining your company logo like so: \usepackage{fancyhdr} \pagestyle{fancy} \rhead{\includegraphics[width … Read more

How to hold figure position with figure caption in pdf output of knitr?

For me adding the float package and then \floatplacement{figure}{H} in YAML solved the issue like : — title: “test” date: “`r Sys.Date()`” output: pdf_document : keep_tex: true number_sections: true header-includes: \usepackage{booktabs} \usepackage{longtable} \usepackage{array} \usepackage{multirow} \usepackage[table]{xcolor} \usepackage{wrapfig} \usepackage{float} \floatplacement{figure}{H} —

How to add table of contents in Rmarkdown?

The syntax is — title: “Sample Document” output: html_document: toc: true theme: united — in the documentation. Make sure this is at the beginning of your document. Also make sure your document actually has headers otherwise R can’t tell what you want in the table of contents.

Split the title onto multiple lines?

Examples for adding an abtract show the use of pipes | to break lines and include paragraphs. This works as well for the title and other yaml elements. For an abstract or title: — abstract: | What works for the abstract. Works for the title, too! title: | | title | subtitle output: pdf_document —

R Markdown HTML Number Figures

The other answers provided are relatively out of date, and this has since been made very easy using the bookdown package. This package provides a number of improvements which includes the built-in numbering of figures across Word, HTML and PDF. To be able to use bookdown, you need to first install the package install.packages(“bookdown”) and … Read more

RMarkdown: How to end tabbed content

My approach to this problem is simple, but it works: ## title {.tabset .tabset-fade} content above tabbed region. ### tab 1 tab content 1 ### tab 2 tab content 2 ## content below tabbed region The tab works only for ‘sub-headers of the header with the.tabset attribute to appear within tabs rather than as standalone … Read more