繁体   English   中英

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

[英]Reduce top margin when creating PDF from Rmarkdown using knitr

我正在使用 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\\}
---

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM