为什么我的pdf r markdown标题显示在页眉

ozxc1zmp  于 2023-01-10  发布在  其他
关注(0)|答案(1)|浏览(199)

我要包括在我所有的pdf页面的标题部分的标志。
我的文档中也有目录。
现在,当我在下面添加命令时,我得到了我想要的徽标,但是我也得到了标题部分的#标题。我如何避免在标题中显示标题?

---
title: "my title"
output:
  pdf_document:
    latex_engine: xelatex
    toc: true 
    toc_depth: 4 
    fig_caption: true

header-includes:
  - \usepackage{fancyhdr}
  - \usepackage{multicol}
  - \usepackage{xcolor}
  - \usepackage{graphicx}
  - \usepackage{lscape}
  - \renewcommand{\familydefault}{\sfdefault}
  - \usepackage[debrief, save]{silence} 
  - \WarningFilter{fancyhdr}{\headheight is too small}
  - \WarningFilter{fancyhdr}{\footskip is too small}
  - \usepackage{floatrow}
  - \floatsetup[figure]{capposition=top}
  - \floatsetup[table]{capposition=top}
  - \usepackage{fontspec}
---
\addtolength{\headheight}{1.0cm} 
\pagestyle{fancyplain} 
\lhead{\includegraphics[height=1.2cm]{C:/Path/to/logo/mylogo.png}} 
\renewcommand{\headrulewidth}{0pt}

```{r setup, include=FALSE}
knitr::opts_chunk$set(
    echo = FALSE,
    message = FALSE,
    warning = FALSE
)

\newpage

Cats

cat cat cat

\newpage

Dogs

dog dog dog

\newpage


![](https://i.stack.imgur.com/z7Qw2.png)
ql3eal8s

ql3eal8s1#

要从标题中删除标题,可以使用\fancyhead[RO,RE]{}

---
title: "my title"
output:
  pdf_document:
    latex_engine: xelatex
    toc: true 
    toc_depth: 4 
    fig_caption: true

header-includes:
  - \usepackage{fancyhdr}
  - \usepackage{multicol}
  - \usepackage{xcolor}
  - \usepackage{graphicx}
  - \usepackage{lscape}
  - \renewcommand{\familydefault}{\sfdefault}
  - \usepackage[debrief, save]{silence} 
  - \WarningFilter{fancyhdr}{\headheight is too small}
  - \WarningFilter{fancyhdr}{\footskip is too small}
  - \usepackage{floatrow}
  - \floatsetup[figure]{capposition=top}
  - \floatsetup[table]{capposition=top}
  - \usepackage{fontspec}
---

\addtolength{\headheight}{1.0cm} 
\pagestyle{fancyplain} 
\lhead{\includegraphics[height=1.2cm]{posit-logo.png}}
\fancyhead[RO,RE]{}
\renewcommand{\headrulewidth}{0pt}

```{r setup, include=FALSE}
knitr::opts_chunk$set(
    echo = FALSE,
    message = FALSE,
    warning = FALSE
)

\newpage

Cats

cat cat cat

\newpage

Dogs

dog dog dog

\newpage

相关问题