如何在标头中转义冒号-包含在 YAML 标头中 [英] How to escape a colon in the header-includes in a YAML header
问题描述
我在 rmarkdown::beamer_presentation
中使用自定义 LaTex beamer 主题
.
I use a custom LaTex beamer theme
in an rmarkdown::beamer_presentation
.
自定义主题包含一个标题框.根据 this SO post 可以使用 header-includes: - AtBeginDocument{ itleframe}
欺骗降价以使用新的标题框架.
The custom theme contains a title frame. As per this SO post markdown can be tricked to use the new title frame using header-includes: - AtBeginDocument{ itleframe}
.
我的标题包含一个冒号,最好是换行符:First line of title:
second line of title
.但是,如果我包含冒号,则演示文稿的编译会失败.
My title contains a colon and ideally a linebreak: First line of title:
second line of title
.
However, if I include the colon, the compilation of the presentation fails.
如何转义冒号,如果可行,在它之后强制换行?
How can I escape the colon and, if feasible, force a linebreak right after it?
---
# 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:
- itle{First line of the title: second line of the title}
- AtBeginDocument{ itleframe}
---
对于 MWE 的其余部分,即 beamertheme*.sty
文件,请参阅 提到的 SO 帖子.
For remainder of MWE, i.e. the beamertheme*.sty
files, see the mentioned SO post.
推荐答案
您可以在 .tex 文件中对 markdown 隐藏标题:
You can hide the title from markdown in a .tex file:
---
# 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{ itleframe}
---
test
preamble.tex:
preamble.tex:
itle[short version]{First line of the title: second line of the title}
这篇关于如何在标头中转义冒号-包含在 YAML 标头中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!