我正在使用带有乳胶输出的Rmarkdown处理文档,该文件可以很好地编译并正确交付文档,但是我想删除出现在文档标题中的页码,即页码1。我尝试了其他方法\ thispagestyle {empty}之类的乳胶,但我找不到。我的代码如下:
---
title: |
| \vspace{5cm} \Huge [My title][1]
| \vspace{0.5cm} \LARGE My subtitle
author: "xxx"
date: "`r Sys.Date()`"
output:
pdf_document:
citation_package: natbib
fig_caption: yes
keep_tex: yes
number_sections: yes
highlight: zenburn
csl: ajpa.csl
bibliography: bibliography.bib
header-includes:
- \usepackage{draftwatermark}
- \usepackage{fancyhdr}
- \usepackage{xcolor, hyperref}
- \usepackage{lipsum}
- \usepackage{appendix}
- \setlength{\headheight}{47pt}
- \setlength{\footskip}{25pt}
- \renewcommand{\headrulewidth}{0.5pt}
- \renewcommand{\footrulewidth}{0.5pt}
- \rhead{\thepage}
- \hypersetup{colorlinks = true, linkcolor = black, urlcolor = blue, citecolor
= blue}
- \fancypagestyle{plain}{\pagestyle{fancy}}
- \pagestyle{fancy}
- \lhead{\includegraphics[width=7cm,height=1cm]{C:/mypath/stack.jpg}}
---
代码的结果是所有工作表的文档格式,但是我只需要从文档的首页删除数字1和顶部图像(请参阅附件图像)enter image description here,并删除数字1从下一张纸开始。非常感谢您的时间和建议。
该解决方案比我想象的要容易,但是花了一些时间才了解Rmarkdown中的结构。 \pagenumbering{gobble}
应该放置在YAML中,以删除标题页上的页码,然后在YAML元数据之外添加\pagenumbering{arabic}
。
header-includes:
- \usepackage{draftwatermark}
- \usepackage{fancyhdr}
- \usepackage{xcolor, hyperref}
- \usepackage{lipsum}
- \usepackage{appendix}
- \setlength{\headheight}{47pt}
- \setlength{\footskip}{25pt}
- \renewcommand{\headrulewidth}{0.5pt}
- \renewcommand{\footrulewidth}{0.5pt}
- \pagenumbering{gobble}
- \hypersetup{colorlinks = true, linkcolor = black, urlcolor = blue, citecolor
= blue}
- \pagestyle{fancy}
- \lhead{\includegraphics[width=7cm,height=1cm]{C:/mypath/stack.jpg}}
- \rhead{\thepage}
---
\newpage
\pagenumbering{arabic}
\renewcommand\contentsname{Contents}
我希望它能为遇到同样问题的其他人提供服务。问候。