Dan*_*l_D 17 pdf yaml r knitr r-markdown
我开始使用R markdown,我想logo.png在每页的右上角创建一个包含公司图像的新报告.
有没有办法在YAML部分编码,或者需要在R块部分完成?
tmp*_*345 23
您可以使用includesyaml中的选项指定乳胶头的自定义添加.yaml部分看起来像
---
output:
pdf_document:
keep_tex: true
includes:
in_header: header.tex
---
Run Code Online (Sandbox Code Playgroud)
并且您需要保存一个单独的文件header.tex,使用以下定义您的公司徽标,如下所示:
\usepackage{fancyhdr}
\pagestyle{fancy}
\rhead{\includegraphics[width = .05\textwidth]{logo.png}}
Run Code Online (Sandbox Code Playgroud)
在这里,我使用fancyhdr乳胶包添加徽标,但还有其他潜在的解决方案.请参阅此处了解更多选项.
Dan*_*l_D 19
好的,我找到了解决方案:
---
title:
header-includes:
\usepackage{graphicx}
\usepackage{fancyhdr}
\pagestyle{fancy}
\setlength\headheight{28pt}
\fancyhead[L]{\includegraphics[width=5cm]{GPIM_Logo_300x85.png}}
\fancyfoot[LE,RO]{GPIM}
output: pdf_document
---
Run Code Online (Sandbox Code Playgroud)
小智 14
我已尝试过在这里和其他论坛中提出的许多解决方案,其中没有一个有效.我终于找到了适合我的解决方案.
---
title: 'Fancy Title Here'
author: "Diego"
date: "today"
output:
pdf_document:
toc: yes
header-includes:
- \usepackage{fancyhdr}
---
\addtolength{\headheight}{1.0cm} % make more space for the header
\pagestyle{fancyplain} % use fancy for all pages except chapter start
\rhead{\includegraphics[height=1.2cm]{C:/Path/to/logo/logo}} % right logo
\renewcommand{\headrulewidth}{0pt} % remove rule below header
Run Code Online (Sandbox Code Playgroud)
我希望以与帮助我相同的方式帮助某人.
| 归档时间: |
|
| 查看次数: |
19590 次 |
| 最近记录: |