问题描述
我在 LaTex beamer theme
中使用自定义 rmarkdown::beamer_presentation
。
自定义主题包含一个标题框架。根据 this SO post markdown 可以通过 header-includes: - \AtBeginDocument{\titleframe}
欺骗使用新的标题框架。
我的标题包含一个冒号,最好是一个换行符:First line of title:\n second line of title
。
但是,如果我包含冒号,则演示文稿的编译会失败。
如何转义冒号,并在可行的情况下在冒号后立即强制换行?
MWE(YAML 标头)
---
# 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
文件,请参阅 the mentioned SO post。
解决方法
你可以在 .tex 文件中隐藏 markdown 的标题:
---
# 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}