如何在标头中转义冒号-包括在YAML标头中 [英] How to escape a colon in the header-includes in a YAML header

查看:65
本文介绍了如何在标头中转义冒号-包括在YAML标头中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 rmarkdown :: beamer_presentation 中使用自定义的 LaTex投影仪主题.

自定义主题包含标题框架.根据

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{\titleframe}.

我的标题包含一个冒号,最好是一个换行符:标题的第一行:\ n标题的第二行.但是,如果我包含冒号,则演示文稿的编译将失败.

My title contains a colon and ideally a linebreak: First line of title:\n 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:
  - \title{First line of the title: second line of the title}
  - \AtBeginDocument{\titleframe}   
---

有关MWE的其余部分,即 beamertheme * .sty 文件,请参见

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{\titleframe}   
---

test

preamble.tex:

preamble.tex:

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

这篇关于如何在标头中转义冒号-包括在YAML标头中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆