r-如何转义标头中的冒号-包括在YAML标头中



我在rmarkdown::beamer_presentation中使用自定义LaTex beamer theme

自定义主题包含一个标题框架。根据这一点,post markdown可以使用header-includes: - AtBeginDocument{titleframe}来欺骗使用新的标题框架。

我的标题包含一个冒号和理想的换行符:First line of title:n second line of title。但是,如果我包含冒号,则表示的编译失败。

如何转义冒号,如果可行的话,在它后面强制换行?

MWE (YAML header)

---
# do not add title here, else markdown generates a second title page
# ==> add title manually below with header-includes
subtitle: "Beamer presentation with R-markdown"
institute: "some place"
date: "`r format(Sys.time(), '%B %d, %Y')`"
author: "Donald Duck"
output:
bookdown::pdf_book:
base_format: rmarkdown::beamer_presentation
theme: "THEMENAME"
latex_engine: xelatex
toc: false
slide_level: 2
keep_tex: true 
header-includes:
- title{First line of the title: second line of the title}
- AtBeginDocument{titleframe}   
---

对于MWE的其余部分,即beamertheme*.sty文件,请参阅前面提到的SO帖子。

可以在.tex文件中隐藏标题:

---
# do not add title here, else markdown generates a second title page
# ==> add title manually below with header-includes
subtitle: "Beamer presentation with R-markdown"
institute: "some place"
date: "`r format(Sys.time(), '%B %d, %Y')`"
author: "Donald Duck"
output:
bookdown::pdf_book:
base_format: rmarkdown::beamer_presentation
theme: "THEMENAME"
latex_engine: xelatex
toc: false
slide_level: 2
keep_tex: true 
header-includes:
- input{preamble}
- AfterBeginDocument{titleframe}   
---
test

preamble.tex:

title[short version]{First line of the title: second line of the title}

最新更新