I am using below code to add a company logo in r markdown in a pdf version and
the output is fine.
I need to add 2 logo's on each page - one for my client and other for our
company.
Is is possible to add 2 logo's in a pdf using r markdown.
---
title: "Complaints Text Model"
author: "ANALYTICS TEAM"
date: '`r format(Sys.Date(), "%B %d, %Y")`'
output:
pdf_document:
toc: yes
header-includes:
- \usepackage{fancyhdr}
always_allow_html: yes
---
\addtolength{\headheight}{1.0cm}
\pagestyle{fancyplain}
\rhead{\includegraphics[height=1.2cm]{D:/D Drive Data/Shivi/R Project/my company.png}}
\renewcommand{\headrulewidth}{0pt}
One can be on one side of the page and other logo on the other side.
All you need to do is imitate your syntax for the left header:
\rhead{\includegraphics[height=1.2cm]{D:/D Drive Data/Shivi/R Project/my company.png}}
\lhead{\includegraphics[height=1.2cm]{D:/D Drive Data/Shivi/R Project/client.png}}
Related
How do I use \label and \ref to link sections in rmarkdown when outputting to pdf please. I have tried various permutations from https://bookdown.org/yihui/bookdown/cross-references.html and https://bookdown.org/yihui/rmarkdown-cookbook/cross-ref.html with no success.
One attempt
---
title: "Untitled"
output: pdf_document
---
See Section \#ref(sec:label).
# Section One (\#sec:label)
which gives
You can modify your document as follows:
---
title: "Untitled 1"
date: "28 de junio de 2020"
link-citations: yes
output:
pdf_document:
includes:
keep_tex: yes
number_sections: yes
toc_depth: 2
---
\section{This is the first section} \label{section1}
You will be some in \ref{section1}
Then you can see how numbers appear, just add \label{} to your sections and use \ref{} to call. Also, I suggest using \section{}, and modify YAML as I included. Hoping this can help.
I am trying to generate dynamic PDF reports from Rmarkdown with dynamic titles. To do this I use the function rmarkdown::render() in my R script and I pass in the argument params the title parametre as set.title = title.
The YAML of my Rmarkdown script I have the next code:
author: "Author test"
date: "`r Sys.setlocale('LC_TIME','C');format(Sys.Date(),'%B %d, %Y')`"
output:
pdf_document:
toc: yes
toc_depth: 5
keep_tex: yes
html_document:
theme: united
toc: yes
classoption: table
header-includes:
- \usepackage{array}
- \usepackage{float}
- \usepackage{xcolor}
- \usepackage{caption}
- \usepackage{longtable}
#- \usepackage{mulicol}
params:
set.title: title
title: "`r params$set.title`"
Once I run my code everything goes well and generate the different pdfs that I expect, the problem is that neither of these PDFs show the title, author and date. I am working with version 1.8 of rmarkdown package.
Can anyone help me with this issue?
For closing the conversation of this question I write how has been solved this question.
At the beginning I was thinking this issue was related with the code in YAML (where the title was informed from parameters) but eventually I discovered that there was nothing to do that. The problem was that I was using a the function cat() in the varible title that I pass as a parametre and this function changes the value of variable title into NULL.
For knowing exactly all the explanation about how to write dynamic titles in rmarkdown documents redirect yourself to the next entrance: Setting document title in Rmarkdown from parameters
I am using the following options to produce a pdf document with knitr:
---
title: "Test"
author: "Paulo Miramor"
date: "13-07-2015"
output: pdf_document
toc: yes
---
I would like to change the header of the table of contents (which is "Contents"), since I am producing a document in Portuguese. Is there any way to customize it?
Thanks to #Molx and #Chris in the comments I could find a solution.
Solution 1
Add \renewcommand{\contentsname}{Índice} to the document so that the .Rmd header is:
---
title: "Test"
author: "Paulo Miramor"
date: "13-07-2015"
output: pdf_document
header-includes:
- \renewcommand{\contentsname}{Whatever}
toc: yes
---
With this solution the header is Whatever you put inside \contentsname argument.
Solution 2
Add lang: portuguese to the document so that the .Rmd header is:
---
title: "Test"
author: "Paulo Miramor"
date: "13-07-2015"
output: pdf_document
lang: portuguese
toc: yes
---
Using this solution the header was a translation of "Contents" to Portuguese. This should work if your TeX installation supports the language.
I have an Rmarkdown document which I'm outputting to Word and I'm trying to insert a company logo to the top of the page, above the header that includes the title and author.
I haven't found a solution to this. I've tried using pandoc_args to --include-in-header, but this wasn't successful. I'm not confident that I was using it correctly though.
Is it possible to include an image above the header?
---
title: "Untitled"
author: "r.bot"
date: "Thursday, January 1, 2015"
output:
word_document:
fig_caption: yes
fig_height: 5
fig_width: 5
reference_docx: template.docx
pandoc_args: [
"--include-in-header", "C:\\path\\to\\file.png"
]
---
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>.
This is possible using image headers in a Word template. In Word 2010 go: insert header -> image and add the image of choice. Save this document as template_image.docx in the same folder as the .Rmd file.
Then, in the YAML header:
---
title: "Untitled"
author: "Simon"
date: "Thursday, May 21, 2015"
output:
word_document:
fig_caption: yes
fig_height: 5
fig_width: 5
reference_docx: template_image.docx
---
Knit the .Rmd file and the output should include the image.
Is it possible to add an institution and logo to the YAML front matter in R markdown version 2?
I'm looking for something like this
---
title: "My report"
author: "me"
institution: "Swansea University"
logo: "logo.png"
output:
pdf_document:
toc: yes
---
The answer is to use a template file, but it needs a bit of tweaking for the logo bit:
---
title: "My report"
author: "me"
output:
pdf_document:
toc: yes
includes:
in_header: style.tex
---
Prepare the document "style.tex" in the same folder as your markdown file and make sure you have changed you working directory in R to this folder.
Add the following lines to your "style.tex" file:
\institute{My institute}
\pgfdeclareimage[width=2cm]{logo}{logo.png}
\usebackgroundtemplate{\pgfuseimage{logo}}
Thanks to:
Inserting logo into beamer presentation using R Markdown