繁体   English   中英

调整PDF输出中的R Markdown标题位置

[英]Adjusting R Markdown Title Position in PDF output

我正在创建R Markdown报告,找不到找到将我的标题下移到页面的方法。

这是一个最小的示例,我想将标题下移5cm:

---
title: "This is my title to display at 5cm below the top"
output:
  pdf_document:
    includes:
      in_header: header.tex
---

\thispagestyle{titlepage}

header.tex文件包含一些自定义样式:

\usepackage{fancyhdr}
\fancypagestyle{titlepage}{
    \fancyfoot[LE,RO]{\thepage\ of \pageref{LastPage}}
    \fancyfoot[LE,LO]{Project}
    \fancyhead[L]{\includegraphics[width=4cm]{logo.png}} 
    }

输出 在此处输入图片说明

请注意,我并不是在讨论页边距,只是想移动标题,以使其不总是位于页面顶部。

这将达到目的:

\setlength{\headsep}{5cm}
\thispagestyle{title page} 

另一个选择是使用titling LaTeX的软件包,该软件包可以轻松更改标题的样式。 我在YAML的header-includes参数中包括了一些自定义内联:

---
title: "This is my title to display at 5cm below the top"
output: pdf_document
header-includes:
  - \usepackage{titling}
  - \setlength{\droptitle}{5em} 
---

# Content
And then something here...

\newpage

# Next Page
Some more text

在此处输入图片说明

对于这样的小修改,通常可以在YAML中包括LaTeX命令,但是如果您要进行进一步的自定义,我建议将其保存在单独的.tex文件中,如R Markdown权威指南中所述。

暂无
暂无

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

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