使用Knitr从Rmarkdown创建PDF时减少上边距

问题描述

我正在使用knitr和Rmarkdown创建PDF文档,但徽标和标题距离文档顶部远。

如何减少首页的页边距?预先非常感谢。

这是我的代码:

---
title: "Title come here (there is a logo before the title)"

output:
  pdf_document:
header-includes:
  - \usepackage{titling}
  - \pretitle{\begin{center}
  -  \includegraphics[width=1.5in,height=1.5in]{logo.png}\LARGE\\}

---

解决方法

我找到了一个可行的解决方案(不确定它是否是“干净的”解决方案,但确实可以完成工作):我在- \setlength{\droptitle}{-1.1in}中添加了负值

---
title: "\\vspace{0.5in} Title here"

output:
  pdf_document:
header-includes:
  - \usepackage{titling}
  - \setlength{\droptitle}{-1.1in}
  - \pretitle{\begin{center}
  -  \includegraphics[height=1.5in]{logo.png}\LARGE\\}
---

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...