【问题标题】:How to delete the number page in the title in a document Rmarkdown?如何删除文档Rmarkdown中标题中的数字页?
【发布时间】:2020-02-07 02:23:10
【问题描述】:

我正在使用带有乳胶输出的 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 从下一张纸开始。 非常感谢您的宝贵时间和建议。

【问题讨论】:

标签: r latex r-markdown


【解决方案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}

我希望它可以服务于遇到同样问题的其他人。问候。

【讨论】:

    猜你喜欢
    • 2015-10-29
    • 1970-01-01
    • 2022-10-15
    • 1970-01-01
    • 2012-10-16
    • 2017-06-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多