PDF 输出中的公司徽标仅在第一页上 [英] Company logo in PDF output only on the first page

查看:46
本文介绍了PDF 输出中的公司徽标仅在第一页上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有办法将公司徽标包含在 R Markdown 创建的 PDF 文档中仅在文档的第一页.我搜索了一个答案,我能找到的最接近的是 这个.答案中提供了多种解决方案,但是,它们都不适合我,因为它们要么:

I was wondering if there is a way to include the company logo to a PDF document created by R Markdown only on the first page of the document. I have searched for an answer and the closest I could find is this. There are multiple solutions presented in the answers, however, neither of them works for me because they either:

  • 在文档的每一页(不仅仅是第一页)都包含徽标;或
  • 在标题中包含章节标题(及其下方的水平线)以及徽标.

我正在寻找一种方法,可以仅在 PDF R 的第一页中包含纯徽标没有章节标题Markdown 文档,我已经用完了我可以在网上找到的所有资源.有人可以帮助我吗?

I am looking for a way to include just the plain logo, with no chapter titles only on the first page of a PDF R Markdown document and I've ran out of all the resources I could find online. Is there someone who could aid me?

在有人问之前:是的,它必须是 PDF 文档,而不是 HTML.

Before anyone asks: yes, it strictly has to be a PDF document, not HTML.

推荐答案

\includegraphics 代码行插入在 Markdown 中的 R SETUP 块之后.这是我放置 \includegraphics 行的示例:

The \includegraphics code line is insert after the R SETUP chunk in markdown. Here is an example of where I put the line \includegraphics :

---
geometry: "margin=1.5cm"
classoption: landscape
output:
  pdf_document: # Export to pdf
    number_sections: yes 
includes:
          in_header: ltx.sty
---



```{r SETUP, include=FALSE, message=FALSE, warning=FALSE}

knitr::opts_chunk$set(echo = FALSE,  
                  warning = FALSE,  
                  message = FALSE,  
                  results = "asis")

library(knitr) 
library(kableExtra) 
library(some_packages)

options(scipen = 999,
    digits = 2,
    width = 110)

```

\definecolor{astral}{RGB}{87,146,204}
\allsectionsfont{\color{astral}}
\setcounter{tocdepth}{5}


<!-- Title page -->
\includegraphics[width=7cm]{logo.jpg}

\begin{center}\begin{Large}
Project 1
\end{Large}\end{center}

\vfill


# Some R chunk
```{r results='asis'}
# Table, code, graphics.
```

所以该行在 R SETUP 块和下一个 R 块之间插入.

So the line is insert between the R SETUP chunk and the next R chunk.

这篇关于PDF 输出中的公司徽标仅在第一页上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆